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 Class::Init;
sub _init {
my $self = shift;
exists $self->{dsn} || die "parameter 'dsn' missing";
$self->{_dbh} = DBI->connect($self->{dsn}) || die "DBI->connect failed";
}
sub users {
my $sth = shift->{_dbh}->prepare_cached("SELECT * FROM users");
$sth->execute(@_); return @{ $sth->fetchall_arrayref };
}
package main;
my $database = Something::Spiffy->new( dsn => '...' );
my @users = $database->users;
...
DESCRIPTION
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.