perl -V says:

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.