|P is for Practical|
Lost methodsby Dave05 (Beadle)
|on Nov 26, 2002 at 11:51 UTC||Need Help??|
Dave05 has asked for the
wisdom of the Perl Monks concerning the following question:
OK, I'm on day 3 of trying to track down this one, so I'm turning to the Monks for some pointers.
This thing is a web site, running under HTML::Mason. I have a MyApp::Person object representing a logged in user. I can happily use the object to run through all the registered users in my database, and call methods to print out a list of names for instance.
But when I have a specific user logged in, and identified via a cookie, I get this error when trying to call methods off the user stored in the cookie (the cookie stores an ID string, which identifies a file on the server that holds the user data which is used to initialise the $user object):
Can't locate object method "full_name" via package "MyApp::Person" (perhaps you forgot to load "MyApp::Person"?)
Here's the thing. If I check %INC, MyAPP::Person _is_ loaded.
So basically, I can access the MyApp::Person namespace, but I can't use $user to get hold of any methods defined in there, despite ref($user) == MyApp::Person
One specific question I'd like to ask is: how can I check the package my code is currently running under?
But what I'd really like is suggestions as to where to look next.