Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform: osname=solaris, osvers=2.8, archname=sun4-solaris
I think 5.6.1. is OK?
The code is a small component in my HTML:Mason site. Basically, it's a Perl subroutine embedded in an html page. Mason components run in the HTML::Mason::Commands namespace. This component should just spit out the user's name. Errors are caught by Mason and formatted as html, hence the <br />'s:
use MyApp::Person; my $user = $session->param('user'); # CGI::Session my $name; eval{$name = $user->full_name} if $user; if ($@) { my $dump_user = Data::Dumper->Dump([$user], ['$user']); $dump_user =~ s|,|,<br />|g; my $package = __PACKAGE__; my @methods = qw( ... all the methods from MyApp::Person ... ); my $check_methods; foreach my $method (@methods) { $check_methods .= sprintf "%s %s <br />", $user->can($method) +? 'CAN' : 'CANNOT', $method; } my $dummy = $MyApp::Person::dummy_true ? $MyApp::Person::dummy_tru +e : 'FALSE'; my $loaded_modules; foreach my $mod (sort values %INC) { $loaded_modules .= "$mod<br />"; } my $ref_user = ref($user); die "Current package: $package<br /> Dummy variable: $dummy<br /> \$user is a $ref_user<br /> $check_methods<br /> \@INC:<br /> $loaded_modules<br /> $dump_user<br />"; } else { [... do something with $name ...] }
The MyAPP was a typo ...
All the things in the die statement check out - except all the methods come out CANNOT:
Current package: HTML::Mason::Commands Dummy variable: 1 $user is a Icapb::Person CANNOT new CANNOT _init CANNOT _check_user_type CANNOT _load_cv CANNOT ... etc etc etc @INC: ... /home/dave05/lib/perl5/mylib/MyApp/Person.pm ...
and $user is initialised with all the appropriate data.
I like Chmrr's suggestion. I develop in Win32, and run this thing on solaris, so maybe a bad line/file ending got in there somewhere, I'll check that out.
I'm not sure how use base can help me? My Person object isn't derived from anything else.
Thanks all, progress report soon!
In reply to Re: Lost methods
by Dave05
in thread Lost methods
by Dave05
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |