# untested sample code my $a = Foo->retrieve(999); # $a is CDBI object &some_sub('' . $a); # cast object back to scalar, here 999