[tpm] Fwd: Perl modules

Shaun Fryer sfryer at sourcery.ca
Thu Jan 14 17:07:55 PST 2010


without seeing the code, it's hard to know for sure, but my guess would be
you tried to import something (or didn't) for which there's no export. the
&main::whatever is the clue here.

if you're doing something like...

use Foo;
foo_function();

and getting &main::foo_function(), it's because Foo is not automatically
exporting foo_function(). you might try doing.

use Foo;
Foo::foo_function();

or perhaps you meant to do.

use Foo qw(foo_function);

and forgot..?

or use Exporter (et al), or
http://perl.plover.com/TPC/1998/Hardware-notes.html#Manual_Exporting

anyway, that'd be my guess based on available info.

cheers,
--
Shaun Fryer

On Thu, Jan 14, 2010 at 7:21 PM, <arocker at vex.net> wrote:

>
> I defined a set of subroutines in a module.
>
> They worked perfectly well when the module was in the same directory as
> the caller.
>
> Then I moved the module to a directory on the @INC array, so it would
> become generally available, and now it's broken. Specifically, although
> the program compiles, when running it dies with an "Undefined subroutine
> &main::whatever" message.
>
> What have I done wrong?
>
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20100114/98866070/attachment.html>


More information about the toronto-pm mailing list