zentara has asked for the wisdom of the Perl Monks concerning the following question:
package Module; use warnings; use strict; use vars qw(@ISA @EXPORT_OK ); @ISA = qw(Exporter); # inherit the import() from Exporter.pm @EXPORT_OK = qw(); # list of things to export if asked to sub import(\@_) { print "You gave me (@_ )\n"; print "$_[0] $_[1]\n"; } 1;
Test code
#!/usr/bin/perl BEGIN { unshift(@INC,'.')}; $|=1; my $pid = $$; use Module($pid); # I can pass a constant here, but no $pid print "ztest->$$\n"; while(1){ print 1; sleep 1; }
edited: Tue Mar 16 16:22:44 2004 by jeffa - removed HTML link and replaced with In-House [id://] tag
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing a $var thru a "use module($var)"
by chip (Curate) on Mar 16, 2004 at 15:11 UTC | |
by Anonymous Monk on Mar 17, 2004 at 04:53 UTC | |
|
Re: passing a $var thru a "use module($var)"
by jeffa (Bishop) on Mar 16, 2004 at 15:22 UTC | |
by chip (Curate) on Mar 16, 2004 at 15:51 UTC | |
by jeffa (Bishop) on Mar 16, 2004 at 16:18 UTC | |
by chip (Curate) on Mar 16, 2004 at 16:22 UTC | |
by PodMaster (Abbot) on Mar 17, 2004 at 04:52 UTC | |
|
Re: passing a $var thru a "use module($var)"
by zentara (Cardinal) on Mar 16, 2004 at 15:42 UTC | |
|
Re: passing a $var thru a "use module($var)"
by zentara (Cardinal) on Mar 16, 2004 at 15:17 UTC |