Usage of qw(:const) with use statement
perl
Solution
use libExample qw(:const)
will pick all names in `$EXPORT_TAGS{const}` anonymous array and will import them to current namespace.
Whereas
use libExample qw(const)
will pick const and will import it in current namespace.
There are also other variants:
[!]name This name only
[!]:DEFAULT All names in @EXPORT
[!]:tag All names in $EXPORT_TAGS{tag} anonymous array
[!]/pattern/ All names in @EXPORT and @EXPORT_OK which match
Please go through Exporter documentation for more details on the topic.
Problem
Sorry for a very basic question, but I'm beginner level at Perl and could not find a suitable explanation on SO (or anywhere else!) for this question. I understand I can write a few examples and try to decipher this but I can really use some knowledge from the experts. I'm going through some code where the developer has sourced libraries using: ``` use libExample qw(:const) ``` Now from what I understand this means sourcing the constants from libExample but would really like to know how this works. Why can't I simply say: `use libExample qw(const)` (Trying to understand relevance of `:`) Is there something we can/should write in `libExample.pm` itself to make other developers utilizing this library to mention such options in place of const that is. Thanks!