1Exporter::Declare::SpecUss(e3r)Contributed Perl DocumentEaxtpioornter::Declare::Specs(3)
2
3
4
6 Exporter::Declare::Specs - Import argument parser for Exporter::Declare
7
9 Import arguments can get complicated. All arguments are assumed to be
10 exports unless they have a - or : prefix. The prefix may denote a tag,
11 a boolean option, or an option that takes the next argument as a value.
12 In addition almost all these can be negated with the ! prefix.
13
14 This class takes care of parsing the import arguments and generating
15 data structures that can be used to find what the exporter needs to
16 know.
17
19 $class->new( $package, @args )
20 Create a new instance and parse @args.
21
22 $specs->package()
23 Get the name of the package that should do the exporting.
24
25 $hashref = $specs->config()
26 Get the configuration hash, All specified options and tags are the
27 keys. The value will be true/false/undef for tags/boolean options.
28 For options that take arguments the value will be that argument.
29 When a config hash is provided to a tag it will be the value.
30
31 @names = $specs->arguments()
32 @names = $specs->options()
33 @names = $specs->tags()
34 Get the argument, option, or tag names that were specified for the
35 import.
36
37 $hashref = $specs->argument_info()
38 Get the arguments that were specified for the import. The key is
39 the name of the argument and the value is what the user supplied
40 during import.
41
42 $hashref = $specs->option_info()
43 Get the options that were specified for the import. The key is the
44 name of the user supplied option and the value will evaluate to
45 true.
46
47 $hashref = $specs->tag_info()
48 Get the values associated with the tags used during import. The key
49 is the name of the tag and the value is an array ref containing the
50 values given to export_tag() for the associated name.
51
52 $hashref = $specs->exports()
53 Get the exports hash. The keys are names of the exports. Values are
54 an array containing the export, item specific config hash, and
55 arguments array. This is generally not intended for direct
56 consumption.
57
58 $arrayref = $specs->excludes()
59 Get the arrayref containing the names of all excluded exports.
60
61 $specs->export( $package )
62 Do the actual exporting. All exports will be injected into
63 $package.
64
65 $specs->add_export( $name, $value )
66 $specs->add_export( $name, $value, \%config )
67 Add an export. Name is required, including sigil. Value is
68 required, if it is a sub it will be blessed as a ::Sub, otherwise
69 blessed as a ::Variable.
70
71 $specs->add_export( '&foo' => sub { return 'foo' });
72
74 Chad Granum exodist7@gmail.com
75
77 Copyright (C) 2010 Chad Granum
78
79 Exporter-Declare is free software; Standard perl licence.
80
81 Exporter-Declare is distributed in the hope that it will be useful, but
82 WITHOUT ANY WARRANTY; without even the implied warranty of
83 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license
84 for more details.
85
86
87
88perl v5.30.1 2020-01-30 Exporter::Declare::Specs(3)