D
Darren Dunham
I have a set of about 5 or 6 scripts related to a single task. Rather
than have each one define all the variables they need in common, I want
to have them load a "header" file defining them.
Is this a good use of Exporter? When I read over the documentation, I'm
left with the idea that I'm overlooking an easier or better idea.
Something like...
<variables>
package LocalPackage;
[...]
use Exporter;
@EXPORT = qw($top_dir, $bin_dir, $process_user);
$top_dir="/path/to/data";
1;
<script>
use LocalPackage;
package LocalPackage;
[...]
chdir $topdir;
Is this worse than just defining the variables and 'require'ing the
file?
The scripts already exist, they're not OO, I'm not going to rewrite
them. I just want to make it easier to have the shared variables in one
file rather than independently defined in several places.
Thanks.
than have each one define all the variables they need in common, I want
to have them load a "header" file defining them.
Is this a good use of Exporter? When I read over the documentation, I'm
left with the idea that I'm overlooking an easier or better idea.
Something like...
<variables>
package LocalPackage;
[...]
use Exporter;
@EXPORT = qw($top_dir, $bin_dir, $process_user);
$top_dir="/path/to/data";
1;
<script>
use LocalPackage;
package LocalPackage;
[...]
chdir $topdir;
Is this worse than just defining the variables and 'require'ing the
file?
The scripts already exist, they're not OO, I'm not going to rewrite
them. I just want to make it easier to have the shared variables in one
file rather than independently defined in several places.
Thanks.