{ package Foo; use Moose; # Not necessary, but advisable # class definition } my $foo = Foo->new; use KiokuDB; use feature 'say'; # You can also use a file and an in-memory hash backend instead of DBI my $db = KiokuDB->new( dsn => 'dbi:SQLite:db=mydb' ); my $scope = $db->new_scope; # Store the object my $id = $db->insert($foo); undef $foo; # retrieve the object using id lookup $foo = $db->lookup($id); say ref $foo; # 'Foo'