exodist / exporter-declare Goto Github PK
View Code? Open in Web Editor NEWDeclarative function exporting
Declarative function exporting
The bundled recipes should not be loaded at startup, they should instead be loaded when needed. The get_recipe() method should see if it knows how to load a recipe that isn't registered using a table containing the bundled ones.
This should also make Devel::BeginLift drop-able as a dependency. Tests for the Begin recipe should skip if its not installed. Begin itself should give a useful die message if Devel::BeginLift is not installed.
...
# You can create a function to mangle the arguments before they are
# parsed into a Exporter::Declare::Spec object.
sub alter_import_args {
my ($class, $args) = @_;
# fiddle with args before importing routines are called
@$args = grep { !/^skip_/ } @$args
}
...
Exporter::Declare v0.113
passes to alter_import_args
3 arguments: class, name of importer package, and reference to args, so synopsis should look like
sub alter_import_args {
my ($class, $importer, $args) = @_;
The prereqs needed for testing are improperly declared in the 'build' category, meaning they (and all downstream dependents) are unneccessarily installed in environments that skip testing.
It would also be straightforward to switch off of Module::Build at the same time, but that's a much less significant issue.
NAME
Exporter::Declare::Meta - The mata object which stoes meta-data
for all exporters.
Note typos: "mata", "stoes". Also, abstract is a bit confusing. Do you really mean one meta object stores meta-data for all exporters? The next section, DESCRIPTION, says:
All classes that use Exporter::Declare have an associated Meta
object. Meta objects track available exports, tags, and options.
It looks like one meta object stores meta-data for one exporter, so abstract from NAME section is not correct.
Parser.pm should have methods for parsing a signature.
Export parser should take signature as a param in the specs
codeblock:
function (sig) { ... }
sub and method:
function (sig) { ... }
function name(sig) { ... }
the arrow form currently accepts a prototype this should be expanded
All exporters have a meta class, the only way to get the
meta object is to call the exporter_meta() method on the
class/object that is an exporter. Any class that uses
Exporter::Declare gets this method, and a meta-object.
Test:
$ cat t.pl
#!/use/bin/perl
package Foo;
use strict;
use warnings;
use Exporter::Declare;
my $meta = __PACKAGE__->exporter_meta();
exit 0;
$ perl t.pl
Can't locate object method "exporter_meta" via package "Foo" at t.pl line 6.
It seems documentation is wrong and real method name is export_meta
, not exporter_meta
.
@list = $meta->get_tag( $name )
Get the list of items associated with the specified
tag. $name should be the tag name WITHOUT -/: prefix.
Test:
$ cat t.pl
#!/use/bin/perl
package Foo;
use strict;
use warnings;
use Exporter::Declare;
export_tag foo =>qw{ a1 a2 };
my $meta = __PACKAGE__->export_meta();
my @items = $meta->get_tag( 'foo' );
exit 0;
$ perl t.pl
Can't locate object method "get_tag" via package "Exporter::Declare::Meta" at t.pl line 8.
??? exporter_meta
documented but does not exist, get_tag
documented but does not exist. It seems the documentation is massively outdated.
Exporter::Declare::Meta interface is not complete. Documentation says
All classes that use Exporter::Declare have an associated Meta
object. Meta objects track available exports, tags, and options.
If you know a name, you can detect if it is a name of option (is_option
), or tag (is_tag
), or argument (is_)argument
). Then, you may get list of exports, associated with the tag (get_tag
), or get export definition (get_export
). You can even add options (add_options
), exports (add_export
).
But there is no method to iterate through (or get names of) all the existing exports, tags, options, arguments.
Name "AirG::Billing::Logger::export_meta" used only once: possible typo at /home/ad/harmans/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/Exporter/Declare.pm line 231.
Failed test 'no (unexpected) warnings (via END block)'
Seems Devel::Declare is required for -magic; but it is not listed in Build.PL, even as a 'recommends'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.