| | |
Making global constants/Making constants global
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Is there a standard way to make constants defined using the
Or even better, to make the constants defined in a package available to other packages that use that package? It seems like anything defined using
That means having to declare certain constants multiple times. Which kind of defeats the purpose of these constants.
use constant pragma available to all of the packages that are use'd from an executed file?Or even better, to make the constants defined in a package available to other packages that use that package? It seems like anything defined using
use constant is only available in the scope of a single package (and is even unavailable to OO packages that use @ISA to inherit another package). That means having to declare certain constants multiple times. Which kind of defeats the purpose of these constants.
Plato forgot the nullahedron..
You may would like to try
our $MY_VARIABLE_AS_CONSTANT;
this variable should be available in all the packages.
the other option is to have a package that exports functions in main:: namespace.
Svet
our $MY_VARIABLE_AS_CONSTANT;
this variable should be available in all the packages.
the other option is to have a package that exports functions in main:: namespace.
Svet
Last edited by lordspace; Feb 6th, 2007 at 12:08 pm. Reason: typo
•
•
•
•
You may would like to try
our $MY_VARIABLE_AS_CONSTANT;
like STATUS_ERROR instead of $STATUS_ERROR :lol:
•
•
•
•
the other option is to have a package that exports functions in main:: namespace.
That got hella convuluted after a while.
Plato forgot the nullahedron..
![]() |
Similar Threads
- Mac bar (HTML and CSS)
- run the number to the word equivalent (Java)
- Global v/s Public (Visual Basic 4 / 5 / 6)
- template issues - need expert debugger! (C++)
- Need help battling About:Blank...please HELP! (Viruses, Spyware and other Nasties)
Other Threads in the Perl Forum
- Previous Thread: Someone PLEASE help end the loops!!!
- Next Thread: Creating a Robust Logout System
| Thread Tools | Search this Thread |






