package FooBar; use strict; use base 'Class::DBI'; FooBar->set_db('Main','dburl','user','password'); FooBar->table('Foo'); # Foo is the default table FooBar->columns(Primary=> qw/id/ ); FooBar->columns(Other=> qw/name/ ); package main; my $foo = FooBar->retrieve(1); print $foo->name(), "\n"; FooBar->table('Bar'); #switch table my $bar1 = FooBar->retrieve(1); # this give the same as $foo, it shouldn't. my $bar2 = FooBar->retrieve(2); # this is different