#======================================= # 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
In reply to Problem in using Exporter by praveenkumar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |