Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Looking for wrong file to find package methods

by hesco (Deacon)
on May 08, 2011 at 23:48 UTC ( #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/ 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/ line 186
In fact, at:

I find:

My questions are these:

  • Why is it seeking this: auto/Config/Simple/Extended/, instead of this: Config/Simple/, 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 "" 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://903672]
Approved by herveus
[choroba]: Good morning!

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-05-21 08:00 GMT
Find Nodes?
    Voting Booth?