Tweak doc changes for role_type & class_type
[gitmo/Moose.git] / lib / Moose / Exporter.pm
index f2b1646..9bf666c 100644 (file)
@@ -3,11 +3,6 @@ package Moose::Exporter;
 use strict;
 use warnings;
 
-our $VERSION = '1.9900';
-our $XS_VERSION = $VERSION;
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
-
 use Class::MOP;
 use List::MoreUtils qw( first_index uniq );
 use Moose::Util::MetaRole;
@@ -15,16 +10,12 @@ use Scalar::Util qw(reftype);
 use Sub::Exporter 0.980;
 use Sub::Name qw(subname);
 
-use XSLoader;
-
-XSLoader::load( 'Moose', $XS_VERSION );
-
 my %EXPORT_SPEC;
 
 sub setup_import_methods {
     my ( $class, %args ) = @_;
 
-    my $exporting_package = $args{exporting_package} ||= caller();
+    $args{exporting_package} ||= caller();
 
     $class->build_import_methods(
         %args,
@@ -136,7 +127,7 @@ sub _make_exporter {
 
         local %$seen = ( $exporting_package => 1 );
 
-        return uniq( _follow_also_real($exporting_package) );
+        return reverse uniq( _follow_also_real($exporting_package) );
     }
 
     sub _follow_also_real {
@@ -196,7 +187,7 @@ sub _make_sub_exporter_params {
     my $class           = shift;
     my $packages        = shift;
     my $export_recorder = shift;
-    my $is_reexport  = shift;
+    my $is_reexport     = shift;
 
     my %exports;
 
@@ -373,7 +364,7 @@ sub _make_import_sub {
     my $exporting_package = shift;
     my $exporter          = shift;
     my $exports_from      = shift;
-    my $is_reexport    = shift;
+    my $is_reexport       = shift;
 
     return sub {
 
@@ -544,7 +535,7 @@ sub _make_unimport_sub {
     my $exporting_package = shift;
     my $exports           = shift;
     my $export_recorder   = shift;
-    my $is_reexport    = shift;
+    my $is_reexport       = shift;
 
     return sub {
         my $caller = scalar caller();
@@ -562,7 +553,7 @@ sub _remove_keywords {
     my $package          = shift;
     my $keywords         = shift;
     my $recorded_exports = shift;
-    my $is_reexport   = shift;
+    my $is_reexport      = shift;
 
     no strict 'refs';
 
@@ -650,11 +641,9 @@ sub import {
 
 1;
 
-__END__
-
-=head1 NAME
+# ABSTRACT: make an import() and unimport() just like Moose.pm
 
-Moose::Exporter - make an import() and unimport() just like Moose.pm
+__END__
 
 =head1 SYNOPSIS
 
@@ -794,6 +783,10 @@ C<unimport>, and C<init_meta>. Calling C<setup_import_methods> is equivalent
 to calling C<build_import_methods> with C<< install => [qw(import unimport
 init_meta)] >> except that it doesn't also return the methods.
 
+The C<import> method is built using L<Sub::Exporter>. This means that it can
+take a hashref of the form C<< { into => $package } >> to specify the package
+it operates on.
+
 Used by C<setup_import_methods>.
 
 =back
@@ -821,29 +814,32 @@ Keep in mind that C<build_import_methods> will return an C<init_meta>
 method for you, which you can also call from within your custom
 C<init_meta>:
 
-  my ( $import, $unimport, $init_meta ) =
-      Moose::Exporter->build_import_methods( ... );
+  my ( $import, $unimport, $init_meta )
+      = Moose::Exporter->build_import_methods(...);
 
   sub import {
-     my $class = shift;
+      my $class = shift;
 
-     ...
+      ...
 
-     $class->$import(...);
+      # 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;
+      my $class = shift;
 
-     ...
+      ...
 
-     $class->$init_meta(...);
+      $class->$init_meta(...);
 
-     ...
+      ...
   }
 
 =head1 METACLASS TRAITS
@@ -864,20 +860,4 @@ a metaclass for the caller is an error.
 
 See L<Moose/BUGS> for details on reporting bugs.
 
-=head1 AUTHOR
-
-Dave Rolsky E<lt>autarch@urth.orgE<gt>
-
-This is largely a reworking of code in Moose.pm originally written by
-Stevan Little and others.
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
 =cut