Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Importing Symbol Tablesby moebius (Novice) |
on Mar 27, 2002 at 00:08 UTC ( [id://154538]=perlquestion: print w/replies, xml ) | Need Help?? |
moebius has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I am trying to better understand symbol tables wrt packages. I am working with a .pm and a .pl along the following lines: a.pm: package a; $fred = 'test'; b.pl: #!/bin/perl use strict; use a; print "$fred\n"; At its basest, I would like to print $fred without the use of Exporter. I am working with the notion of a shared globals file, and I want to share this between multiple packages without the overhead and hassle of @EXPORT and the whole Exporter module. It seems like there should be a way to import the symbol table via a simple mass typeglob, but as of this writing I have not been able to figure out how. I can get as far as being able to print $main::fred by doing '*main = *a::;', but I want to get this down even more (ie to being able to simply print $fred). I can do this long hand but I'm considering globals files of 1000s of globals potentially. More of a theoretical exercise than anything. Thanks in advance.
Back to
Seekers of Perl Wisdom
|
|