in reply to repeated use of module and EXPORT
Z uses L, so L is compiled and executed before the body of Z is even parsed. At compilation of L the assignment to @EXPORT in package Z hasn't been executed, so tough noogies - L doesn't get sub zProc, since that isn't there yet... Exporter's import (which is what's executed in Z at Z->import() ) sees an empty @EXPORT.
Use a BEGIN block to execute the assignment before compiling L via use:
package Z; use strict; use Exporter; BEGIN { our (@EXPORT) = qw(zProc subzProc); our (@ISA) = qw(Exporter); } use L; sub zProc { print "I am zProc\n"; } sub subzProc { print "I am subzProc\n"; L::lProc(); L::sublProc(); } 1;
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: repeated use of module and EXPORT
by rpelak (Sexton) on May 23, 2008 at 16:32 UTC | |
by rpelak (Sexton) on May 23, 2008 at 16:52 UTC | |
by almut (Canon) on May 23, 2008 at 17:33 UTC | |
by rpelak (Sexton) on May 23, 2008 at 19:47 UTC | |
by shmem (Chancellor) on May 23, 2008 at 20:34 UTC | |
|