From: Jesse Luehrs Date: Sun, 11 Mar 2012 01:14:03 +0000 (-0600) Subject: update the docs X-Git-Tag: 2.0500~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=de000acd315ecc61bf575e9487fc7f1d09e9600e;p=gitmo%2FMoose.git update the docs --- diff --git a/lib/Moose/Exporter.pm b/lib/Moose/Exporter.pm index 8d41838..d0f5683 100644 --- a/lib/Moose/Exporter.pm +++ b/lib/Moose/Exporter.pm @@ -787,9 +787,8 @@ __END__ =head1 DESCRIPTION This module encapsulates the exporting of sugar functions in a -C-like manner. It does this by building custom C, -C, and C methods for your module, based on a spec you -provide. +C-like manner. It does this by building custom C and +C methods for your module, based on a spec you provide. It also lets you "stack" Moose-alike modules so you can export Moose's sugar as well as your own, along with sugar from any random C module, as @@ -809,21 +808,20 @@ This module provides two public methods: =item B<< Moose::Exporter->setup_import_methods(...) >> -When you call this method, C builds custom C, -C, and C methods for your module. The C method +When you call this method, C builds custom C and +C methods for your module. The C method will export the functions you specify, and can also re-export functions -exported by some other module (like C). +exported by some other module (like C). If you pass any parameters +for L, the C method will also call +C and +C as needed, after making +sure the metaclass is initialized. The C method cleans the caller's namespace of all the exported functions. This includes any functions you re-export from other packages. However, if the consumer of your package also imports those functions from the original package, they will I be cleaned. -If you pass any parameters for L, this method will -generate an C for you as well (see below for details). This -C will call C and -C as needed. - Note that if any of these methods already exist, they will not be overridden, you will have to use C to get the coderef that would be installed. @@ -896,15 +894,13 @@ are "class_metaroles", "role_metaroles", and "base_class_roles". =item B<< Moose::Exporter->build_import_methods(...) >> -Returns two or three code refs, one for C, one for -C, and optionally one for C, if the appropriate -options are passed in. +Returns two code refs, one for C and one for C. Accepts the additional C option, which accepts an arrayref of method -names to install into your exporting package. The valid options are C, -C, and C. Calling C is equivalent -to calling C with C<< install => [qw(import unimport -init_meta)] >> except that it doesn't also return the methods. +names to install into your exporting package. The valid options are C +and C. Calling C is equivalent +to calling C with C<< install => [qw(import unimport)] >> +except that it doesn't also return the methods. The C method is built using L. This means that it can take a hashref of the form C<< { into => $package } >> to specify the package @@ -933,38 +929,6 @@ Moose->init_meta >> to do the real work: return Moose->init_meta( @_, metaclass => 'My::Metaclass' ); } -Keep in mind that C will return an C -method for you, which you can also call from within your custom -C: - - my ( $import, $unimport, $init_meta ) - = Moose::Exporter->build_import_methods(...); - - sub import { - my $class = shift; - - ... - - # You can either pass an explicit package to import into ... - $class->$import( { into => scalar(caller) }, ... ); - - ...; - } - - # ... or you can use 'goto' to provide the correct caller info to the - # generated method - sub unimport { goto &$unimport } - - sub init_meta { - my $class = shift; - - ... - - $class->$init_meta(...); - - ... - } - =head1 METACLASS TRAITS The C method generated by C will allow the