package Foo::DBI; use base 'Class::DBI'; use Class::MethodMaker new_with_init => 'new'; sub init { my $self = shift; __PACKAGE__->set_db('Main', 'dbi:Pg:dbname=kickcache;host=somewhere.sub.dom'); __PACKAGE__->table('kickcache'); __PACKAGE__->columns( All => qw( session username ) ); } sub test { my $x = Foo::DBI->new; my $y = $x->retrieve(0); print $y->username, $/; } 1; __END__ $ perl -MFoo::DBI -e 'Foo::DBI->test()' 1064452728 # which happens to be the right answer...