Perl6::Export::Attrs

Perl6::Export::Attrs - the Perl 6 'is export(...)' trait as a Perl 5 attribute.
Download

Perl6::Export::Attrs Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Damian Conway
  • Publisher web site:
  • http://search.cpan.org/~dconway/

Perl6::Export::Attrs Tags


Perl6::Export::Attrs Description

Perl6::Export::Attrs - the Perl 6 'is export(...)' trait as a Perl 5 attribute. Perl6::Export::Attrs - the Perl 6 'is export(...)' trait as a Perl 5 attribute.SYNOPSIS package Some::Module; use Perl6::Export::Attrs; # Export &foo by default, when explicitly requested, # or when the ':ALL' export set is requested... sub foo :Export(:DEFAULT) { print "phooo!"; } # Export &var by default, when explicitly requested, # or when the ':bees', ':pubs', or ':ALL' export set is requested... # the parens after 'is export' are like the parens of a qw(...) sub bar :Export(:DEFAULT :bees :pubs) { print "baaa!"; } # Export &baz when explicitly requested # or when the ':bees' or ':ALL' export set is requested... sub baz :Export(:bees) { print "baassss!"; } # Always export &qux # (no matter what else is explicitly or implicitly requested) sub qux :Export(:MANDATORY) { print "quuuuuuuuux!"; } IMPORT { # This block is called when the module is used (as usual), # but it is called after any export requests have been handled. # Those requests will have been stripped from its @_ argument list }Implements a Perl 5 native version of what the Perl 6 symbol export mechanism will look like.It's very straightforward:· If you want a subroutine to be capable of being exported (when explicitly requested in the use arguments), you mark it with the :Export attribute.· If you want a subroutine to be automatically exported when the module is used (without specific overriding arguments), you mark it with the :Export(:DEFAULT) attribute.· If you want a subroutine to be automatically exported when the module is used (even if the user specifies overriding arguments), you mark it with the :Export(:MANDATORY) attribute.· If the subroutine should also be exported when particular export groups are requested, you add the names of those export groups to the attribute's argument list. Requirements: · Perl


Perl6::Export::Attrs Related Software