Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Looking for wrong file to find package methods

by hesco (Deacon)
on May 08, 2011 at 23:48 UTC ( [id://903672]=perlquestion: print w/replies, xml ) Need Help??

hesco has asked for the wisdom of the Perl Monks concerning the following question:

This is the feedback I get at the command line, running my test, which includes in relevant part:

package AClient::Mail::Log::Parse::ListMaintainence; sub tabulate_template_fields_by_email { my $self = shift; my $email = shift; isa_ok($self->{'cfg'},'Config::Simple::Extended'); can_ok($self->{'cfg'},'param'); can_ok($self->{'cfg'},'params'); my $uid = AClient::CMS::Drupal::SimpleNews::get_uid_from_email($self +,$email); # at which point it is bombing out. } package AClient::CMS::Drupal::SimpleNews; sub get_uid_from_email { my $self = shift; my $email = shift; my $sql_get_uid = $self->{'cfg'}->param("sql.get_uid_from_email"); my $sth_get_uid = $self->{'dbh'}->prepare($sql_get_uid); $sth_get_uid->execute($email); my ($uid) = $sth_get_uid->fetchrow_array(); return $uid; }
first from Test::More's isa_ok, and then from afailure:

ok 1 - The object isa Config::Simple::Extended ok 2 - Config::Simple::Extended->can('param') not ok 3 - Config::Simple::Extended->can('params') Can't locate auto/Config/Simple/Extended/params.al in @INC (@INC conta +ins: /home/hesco/system_admin/perl/lib lib /usr/lib64/perl5/site_perl +/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/ +lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-t +hread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_pe +rl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5. +8.8 .) at /home/hesco/system_admin/perl/lib/ClientsCompany/Mail/Log/P +arse/ListMaintainence.pm line 186
In fact, at:

/usr/lib/perl5/5.8.8
I find:

/usr/lib/perl5/site_perl/5.8.8/Config/Simple/Extended.pm
My questions are these:

  • Why is it seeking this: auto/Config/Simple/Extended/params.al, instead of this: Config/Simple/Extended.pm, which uses base 'Config::Simple' and accesses its ->param() (not ->params()) method?
  • What does the .al signfiy? I have no files named that do I?
  • What is the significance of the auto/ directory where it seems to be looking?
if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }

Replies are listed 'Best First'.
Re: Looking for wrong file to find package methods (autoload)
by tye (Sage) on May 09, 2011 at 01:35 UTC

    You are inheriting from something that inherits from an 'autoload' module. You can fix this by avoiding either of the two inheritance steps. Or you can add your own AUTOLOAD method so that 'autoload' module's one doesn't get called.

    For example, this is found in my Win32API::Registry module:

    # Since we ISA DynaLoader which ISA AutoLoader, we ISA AutoLoader so w +e # need this next chunk to prevent Win32API::Registry->nonesuch() from # looking for "nonesuch.al" and producing confusing error messages: use vars qw($AUTOLOAD); sub AUTOLOAD { require Carp; Carp::croak( "Can't locate method $AUTOLOAD via package Win32API::Registry" ) +; }

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://903672]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found