The module you want to look at is Exporter. In general, if you create your modules using 'h2xs -X', all of this will be set up for you. You can export constants just like functions (because really, thats all they are)
require Exporter; our @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not expo +rt # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. # This allows declaration use My::Module ':all'; # If you do not need this, moving things directly into @EXPORT or @EXP +ORT_OK # will save memory. our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( );
In reply to Re: How do I export methods and constants from a package module?
by ehdonhon
in thread How do I export methods and constants from a package module?
by krisraman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |