in reply to Problems with the enum Module and File Scoping
Use "our" to declare these variables (instead of "my") so that they become visible to other packages, which is what you want. Now you can access these variables in just the way you tried:our $SM_UNK_REC = 1; our $SM_HDR_REC = 2; our $SM_TTL_REC = 3;
$stat = &slib::ABC($slib::SM_HDR_REC);
By the way, a stylistic note - the ampersand in front of slib::ABC is almost definitely not needed.
If you want, you can also make the constants available from the calling program directly by changing slib.pl to slib.pm and having it look a bit like this:
and from your main programpackage slib; use Exporter; our @ISA = qw/Exporter/; our @EXPORT_OK = qw/ABC $SM_UNK_REC $SM_HDR_REC $SM_TTL_REC/; ...
or whatever you want.use slib qw/ABC $SM_UNK_REC $SM_HDR_REC $SM_TTL_REC/; $stat = ABC(SM_HDR_REC);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problems with the enum Module and File Scoping
by ozboomer (Friar) on Sep 03, 2005 at 05:56 UTC |