Reputation: 19552
I am reading about Log4Perl
from perl.com
In the tutorial it says: use Log::Log4perl qw(:easy);
What is the :
in front of easy
? Is it some kind of special syntax?
Upvotes: 8
Views: 1654
Reputation: 206689
It is special syntax, for Specialised Import Lists, specifically for export tags.
Here's the example exporter part of a module from that documentation
@EXPORT = qw(A1 A2 A3 A4 A5);
@EXPORT_OK = qw(B1 B2 B3 B4 B5);
%EXPORT_TAGS = (T1 => [qw(A1 A2 B1 B2)], T2 => [qw(A1 A2 B3 B4)]);
A user of that module could say:
use Module qw(:DEFAULT :T2);
to import all of the names from the default set (@EXPORT
) plus the ones defined in the T2
set.
Unless...
the package in question overloads the import
sub and does whatever it wants with the option, which is what this package seems to do according to amesee's answer.
Upvotes: 11
Reputation: 4737
This is not a special perl syntax. It's just some prefix determined by the author that makes this string look more like a value for configuration. You can see for yourself in the import definition. It just looks for the existence of a value in a hash with the key of :easy
. Just a string consisting of characters ':', 'e', 'a', 's', 'y'.
Upvotes: 4