johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
The User object is stored correctly in the session the first time. But after I retrieve it from the session, the call to $user->age() fails, claiming there is no such method. When I do a data dump, $user is given as:package User; use strict; use base 'Class::DBI'; User->table('user'); User->columns(Primiary=>qw/name/); User->columns(Other=>qw/password age/); 1;
bless({ name=> "test", password=>"password", age=>10},"User") # bless({ name=> "test", password=>"password", age=>10},"User")->age() + gives error.
This only happens within CGI::Session. When used by itself, all is ok:
use User; bless({ name=> "test", password=>"password", age=>10},"User")->age(); # returns 10
|
|---|