Hi all, I'm seeing the following strange behavior that's driving me nuts. I'm doing something standard: in a web application, when someone logs in, I'll load a User object, and store it in a CGI::Session. Next time the session comes back again, I'll simply get the User object from the session. My User object is a simple subclass of Class::DBI (say with columns: name,password, age):
package User;
use strict;
use base 'Class::DBI';
User->table('user');
User->columns(Primiary=>qw/name/);
User->columns(Other=>qw/password age/);
1;
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:
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.