README
1Eporter::Easy gets rid of the drudgery of exporting symbols allowing you to
2eliminate those bits of code that exists in every single module that uses
3Exporter.
4
5It also allows you to define tags in terms of other tags and you no longer
6have to worry about filling in @EXPORT_OK.
7
8So
9
10require Exporter;
11our @ISA = ('Exporter');
12our @EXPORT = qw( open close );
13
14becomes
15
16use Exporter::Easy(EXPORT => [qw( open close ]);
17
18and
19
20use strict;
21
22our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS, @VARS, @);
23require Exporter;
24our @ISA = ('Exporter');
25@EXPORT = qw(getservbyname getservbyport getservent getserv);
26@EXPORT_OK = qw( $s_name @s_aliases $s_port $s_proto );
27%EXPORT_TAGS = (FIELDS => [ @EXPORT_OK, @EXPORT ] );
28
29our ($s_name, @s_aliases, $s_port, $sx_proto);
30
31$s_port = 8080;
32
33becomes
34
35use strict;
36
37use Exporter::Easy(
38 EXPORT => [qw(getservbyname getservbyport getservent getserv)],
39 OK => [qw( $s_name @s_aliases $s_port $s_proto ]),
40 ALL => 'FIELDS',
41);
42
43$s_port = 8080;
44
45and finally this becomes possible without lots of nasty arrays
46
47use Exporter::Easy (
48 EXPORT => [qw( init :base )],
49 TAGS => [
50 base => [qw( open close )],
51 read => [qw( read sysread readline )],
52 write => [qw( print write writeline )],
53 misc => [qw( select flush )],
54 most => [qw( :base :read :write)],
55 no_misc => [qw( :all !:misc )],
56 ],
57 OK => [qw( $some $other $stuff )],
58 ALL => 'all',
59);
60
61Exporter::Easiest lets you do leave out almost all of the punctuation, so
62the above becomes
63
64use Exporter::Easy q(
65
66 :base => open close
67 :read => read sysread readline
68 :write => print write writeline
69 :misc => select flush
70 :most => :base :read :write
71 :no_misc => :all !:misc
72
73 EXPORT => init :base
74 OK => $some $other $stuff
75 ALL => all
76);
77
78
79
80 epxorting symbols can't get
81any easier than this!
82
83Written by Fergal Daly <fergal@esatclear.ie>
84