packetstormer has asked for the wisdom of the Perl Monks concerning the following question:
Struggling again.....two questions really.
I am writing an app the will have a lot of user changeable strings (button names, customer names, error messages etc.). I thought the best way to do this is to create a variable.pl file, list all my variables in here and then call them from my other files. Obviously the whole, local/global variable issue arises when using strict pragma. But I can't think of a Perl way to do it.
I have been looking at Exporter but it seems I need to specify each variable to export, which could be literally 100's. Is there any way to Export a whole file from a package? I have read the perldoc Exporter page but there doesn't seem to be anyway to use the whole file instead of specifying individual variables or functions etc.
I am thinking I might be able to do this by creating a hash of all my variables and just exporting that, but I am not sure if this is acceptable?
And, is this bad Perl practice?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exporting Variables
by mr_mischief (Monsignor) on Feb 07, 2011 at 21:35 UTC | |
|
Re: Exporting Variables
by Anonymous Monk on Feb 07, 2011 at 21:39 UTC | |
by ikegami (Patriarch) on Feb 07, 2011 at 22:14 UTC |