Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: fastcgi broke my Exports

by perrin (Chancellor)
on Jul 15, 2009 at 19:10 UTC ( [id://780443]=note: print w/replies, xml ) Need Help??


in reply to Re^3: fastcgi broke my Exports
in thread fastcgi did NOT break my Exports, issue now resolved

Two things: can you show us the code where you call this, and why are you calling an exported function as a method? In general, methods are not something you would export.

Also, try this:

perl -e 'use My::Module::Account qw(_GenerateAccountSummary); _Generat +eAccountSummary();'

Replies are listed 'Best First'.
Re^5: fastcgi broke my Exports
by hesco (Deacon) on Jul 15, 2009 at 21:41 UTC
    Thank you to perrin and to the Anonymous Monk, as well:

    # perl -e 'use My::Module::Account qw(_GenerateAccountSummary); _Gener +ateAccountSummary();' Undefined subroutine &main::_GenerateAccountSummary called at -e line +1. # perl -e 'use My::Module::Account qw(_GenerateAccountSummary); My::Mo +dule::_GenerateAccountSummary();' Undefined subroutine &My::Module::_GenerateAccountSummary called at -e + line 1.
    As for the advice from the anonymous monk, I was ready to dismiss the idea that I had typos in my code because this aspect of the code was working fine before the Etch-Lenny dist-upgrade and before installing fastcgi. However . . .

    DEBUG: What the symbol table says about My::Module:: -- . . . 'log' => *My::Module::log, 'import' => *My::Module::import, . . .
    Which is rather confusing because there is no ->import() method in either my base class, not in any of the custom modules it loads which I have written (at least if my grep pipe is to be believed). There is a ->new(), ->log(), ->_show_login_form(), ->_log_out() and a couple of others which are shown by Dumper(My::Module::).

    Where might that ::import() be coming from if not from Exporter? And how is it I would figure that out?

    So I rewrote my debug code like so:

    { $ENV{PATH} = "/bin"; foreach my $module (keys %INC){ my $result = `grep '^sub import' $INC{$module}`; if ($result){ print STDERR "The module: $module includes: \n$result \n"; } if($module =~ m/Account/){ print STDERR "The next module is: $module \n"; print STDERR `grep _GenerateAccountSummary $INC{$module}`; print STDERR "\n\n"; } } }
    yielding the following output:

    So perhaps a third or more of the modules in %INC sport an ->import() method. Are they stomping on each other? And if so, how would I make them stop that and play nice?

    -- Hugh

    if( $lal && $lol ) { $life++; }
      # perl -e 'use My::Module::Account qw(_GenerateAccountSummary); _Gener +ateAccountSummary();' Undefined subroutine &main::_GenerateAccountSummary called at -e line +1.
      Three possibilities:
      1. &My::Module::Account::import doesn't exist and My::Module::Account doesn't inherit a method named import.

        Test:

        perl -wle'use My::Module::Account qw(_GenerateAccountSummary); print M +y::Module::Account->can("import") || "no"'
      2. The import does not create a sub named _GenerateAccountSummary in the caller's namespace in response to the call.

        Test:

        perl -wle'use My::Module::Account qw(_GenerateAccountSummary); print * +{$::{_GenerateAccountSummary}}{CODE} || "no"'
      3. _GenerateAccountSummary is successfully exported, but it has not been defined.

        Test:

        perl -wle'use My::Module::Account qw(_GenerateAccountSummary); print d +efined(&_GenerateAccountSummary) ? "yes" : "no"'

      The first to output "no" indicates the cause.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found