Hi, I want to share variables among various modules. The shared variables would be in a module "data_pool.pm". Some module "run.pm" would use them. Both data_pool.pm and run.pm are in the same folder.
I've tried some variants with mixed results. The scripts below produce a diag: # "moon" is not exported by the data_pool module. File 'PPC HD:Applications 2:MacPerl versions:MacPerl 5.20r4 Ä:lib:Exporter.pm'; Line 111 Things work if I don't use EXPORT_OK, place "moon" in EXPORT, and remove it from the use statement in run.pm. Any suggestion ? Thanks. #!/usr/local/bin/perl -w # this is data_pool.pm package data_pool; use strict; require Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK $sun $moon); @ISA = qw(Exporter); @EXPORT = qw($sun); #@EXPORT = qw($sun $moon); @EXPORT_OK = qw($moon); # fails $sun = 'gold'; $moon = 'silver'; 1; __END__ #!/usr/local/bin/perl -w # this is run.pm use strict; use data_pool qw(moon); # fails #use data_pool; $\ = "\n"; print $sun; print $moon; __END__