/usr/share/perl5/Exporter/Easiest.pm is in libexporter-easy-perl 0.18-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | package Exporter::Easiest;
$Exporter::Easiest::VERSION = '0.18';
use 5.006;
use strict;
use warnings;
no strict 'refs';
require Exporter::Easy;
sub import
{
my $pkg = shift;
my $callpkg = caller(0);
@_ = ($callpkg, parse_spec(@_));
goto &Exporter::Easy::set_export_vars;
}
sub parse_spec
{
# maybe we were passed a string or an array of strings, allow both
my @spec = grep { /\S/ } map { split(/\s+/) } @_;
my %spec;
my $key = "";
while (@spec)
{
my $new_key = shift @spec;
my $arrow = shift @spec;
$arrow = "" unless defined($arrow);
die "Expected '=>' not '$arrow' after $new_key" unless ($arrow eq '=>');
if ($new_key =~ s/^://)
{
# if the new key starts with a : then it and the following list are
# pushed onto the TAGS entry
push(@{$spec{TAGS}}, $new_key, suck_list(\@spec));
}
else
{
$key = $new_key;
# VARS and ISA should aren't necessarily a list
if(
($key =~ /^(VARS|ISA)$/ and $spec[0] =~ /^\d+$/) or
($key eq 'ALL')
)
{
$spec{$key} = shift @spec;
}
else
{
$spec{$key} = suck_list(\@spec);
}
}
}
return %spec;
}
sub suck_list
{
# takes a ref to a list and removes elements from the front of the list
# until the list is empty or it's 2 shift away from removing a =>
# returns a ref to a list of the removed list elements
my $list = shift;
my @sucked;
while (@$list)
{
if ($#$list and ($list->[1] eq '=>'))
{
last;
}
else
{
push(@sucked, shift(@$list));
}
}
return \@sucked;
}
=head1 NAME
Exporter::Easiest - Takes even more drudgery out of Exporting symbols
=head1 SYNOPSIS
In module YourModule.pm:
package YourModule;
use Exporter::Easiest q(
EXPORT => :tag1
OK => munge frobnicate
:tag1 => a b c
:tag2 => :tag1 d e f
FAIL => f g h
);
In other files which wish to use YourModule:
use ModuleName qw(frobnicate); # import listed symbols
frobnicate ($left, $right) # calls YourModule::frobnicate
=head1 DESCRIPTION
The Exporter::Easiest module is a wrapper around Exporter::Easy. It allows
you to pass the arguments into Exporter::Easy without all those tiresome []s
and qw()s. You pass arguments in as a string or an array of strings. You no
longer need to bracket lists or take references. If want, you can also leave
out the TAGS key and just put tag definitions along with the other keys.
The important thing to remember is that tags should be preceded by ':'
everywhere, including to the left of the '=>', otherwise it'll get confused.
And don't worry I haven't done something horribly pythonesque, whitespace is
not significant, all the parsing logic revolves around the use of ':'s and
'=>'s
=head1 SEE ALSO
For the real details on exporting symbols see L<Exporter>
and L<Exporter::Easy>.
=head1 REPOSITORY
L<https://github.com/neilb/Exporter-Easy>
=head1 AUTHOR
Written by Fergal Daly <fergal@esatclear.ie>.
=head1 LICENSE
Under the same license as Perl itself
=cut
|