Do you know where your variables are? | |
PerlMonks |
Re^5: how to create a constant file and use it in other fileby alexm (Chaplain) |
on Jul 17, 2008 at 01:51 UTC ( [id://698212]=note: print w/replies, xml ) | Need Help?? |
It took me a while but I finally got something that works as you want:
Note 1: the position of our combined with Readonly is tricky. Using our Readonly::Scalar $const1 => 1 instead won't export $const1, but won't complain either. Note 2: be careful to not import any other symbols from other modules (e.g. Data::Dumper exports Dumper by default).
Thanks to Abigail's code referenced by zentara on Re: Listing the functions of a package / methods of an object. Update: There's a simpler method, which is to export a hash and make everything to be exported a member of that hash, so there's only 1 element to export.
In Section
Seekers of Perl Wisdom
|
|