blakesto has asked for the wisdom of the Perl Monks concerning the following question:
In the following case, why is it that I'm able to 'use' the module, yet am unable to call its exported function in the 'main' namespace? I know how to work around this, but I'm trying to understand why this doesn't work the way it is.
[test]$ cat test.pl #!/usr/bin/perl -w use strict; use dir::mod; hello("world"); [test]$ cat dir/mod.pm package mod; use strict; use warnings; use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(hello); sub hello { print "hello " . shift() . "\n"; } 1; [test]$ ./test.pl Undefined subroutine &main::hello called at ./test.pl line 7. [test]$
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unabled to use exported routine
by repellent (Priest) on Apr 02, 2009 at 20:57 UTC | |
|
Re: Unabled to use exported routine
by Fletch (Bishop) on Apr 02, 2009 at 20:59 UTC | |
by blakesto (Initiate) on Apr 02, 2009 at 21:02 UTC | |
by Fletch (Bishop) on Apr 02, 2009 at 21:28 UTC | |
by blakesto (Initiate) on Apr 02, 2009 at 21:42 UTC | |
by linuxer (Curate) on Apr 02, 2009 at 21:23 UTC |