praveenkumar has asked for the wisdom of the Perl Monks concerning the following question:
#======================================= # First.pm package First; use strict; use warnings; use Second; use Exporter; our @EXPORT_OK = qw(first_method); sub first_method { print "Inside first_method\n"; } #=================================================== # Second.pm package Second; use strict; use warnings; use First qw(first_method); sub second_method { print "Inside second_method\n"; first_method(); } #===================================================
When I compile First.pm (perl -wc First.pm), the compiler after looking at the line "use Second" should start compiling Second.pm. By the time the compiler compiles the line "use First qw(first_method)", First was not compiled yet and therefore First's @EXPORT_OK will be empty. So, the compilation should fail saying that first_method not exported by First. But, the compilation succeeds. Why?
Regards,
- Praveen.
Edit: g0n - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem in using Exporter
by mscharrer (Hermit) on Apr 21, 2008 at 14:34 UTC | |
by praveenkumar (Novice) on Apr 22, 2008 at 06:05 UTC |