Hello, I would like to export constants from a file global_constants.pm. The traditional way to export them is:
package global_constants;
use strict;
use warnings;
use base 'Exporter';
use constant LOAD_ARABIC=>1;
use constant LOG_USERS_ACTIONS=>1;
use constant ENABLE_RCSE=>;
our @EXPORT_OK = ('LOAD_ARABIC','LOG_USERS_ACTIONS','ENABLE_RCSE');
1;
And in the perl file test.pl:
use global_constants('LOAD_ARABIC' , 'LOG_USERS_ACTIONS','ENABLE_RCSE');
Is it possible to export everything at once (i.e. without listing the names of the constants in the export of both files?? I have so many constants and i need a neater way to export (preferably without any module)
Thanks :))
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.