-
-
12 May 2004 08:28:42 UTC
- Distribution: Class-Init
- Module version: 1.1
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (465 / 0 / 12)
- Kwalitee
Bus factor: 0- 92.86% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (11.52KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Why not adopt me?
This distribution is up for adoption! If you're interested then please contact the PAUSE module admins via email.NAME
Class::Init - A base constructor class with support for local initialization methods.
SYNOPSIS
package Something::Spiffy; use base qw(Class::Init); sub _init { my $self = shift; exists $self->{dsn} || die "parameter 'dsn' missing"; $self->{_dbh} = DBI->connect($self->{dsn}) || die "DBI->connect failed"; } package main; my $database = Something::Spiffy->new( dsn => '...' ); my @users = $database->{_dbh}->...;
DESCRIPTION
Class::Init provides a constructor,
new()
, that returns blessed hashrefs by default; that constructor runs all instances of the subroutine_init
it finds in the inheritance tree, top-down (EVERY
).The goal of this module is to reduce the amount of effort required to construct a simple object class; it helps reduce the amount of code that's duplicated between classes by providing a generic constructor, while allowing individual classes a low-effort way to publish their own changes to the new object.
AUTHOR
Richard Soderberg, <perl@crystalflame.net>
COPYRIGHT AND LICENSE
Copyright 2004 by Richard Soderberg
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Class::Init, copy and paste the appropriate command in to your terminal.
cpanm Class::Init
perl -MCPAN -e shell install Class::Init
For more information on module installation, please visit the detailed CPAN module installation guide.