Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-16 17:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found