use strict;
use warnings;
+use Class::Load qw(is_class_loaded);
use Class::MOP;
use List::MoreUtils qw( first_index uniq );
use Moose::Util::MetaRole;
my $exporting_package = shift;
if ( !exists $EXPORT_SPEC{$exporting_package} ) {
- my $loaded = Class::MOP::is_class_loaded($exporting_package);
+ my $loaded = is_class_loaded($exporting_package);
die "Package in also ($exporting_package) does not seem to "
. "use Moose::Exporter"
C<Moose::Exporter> also makes sure all these functions get removed
when C<unimport> is called.
+=item * meta_lookup => sub { ... }
+
+This is a function which will be called to provide the metaclass
+to be operated upon by the exporter. This is an advanced feature
+intended for use by package generator modules in the vein of
+L<MooseX::Role::Parameterized> in order to simplify reusing sugar
+from other modules that use C<Moose::Exporter>. This function is
+used, for example, to select the metaclass to bind to functions
+that are exported using the C<with_meta> option.
+
+This function will receive one parameter: the class name into which
+the sugar is being exported. The default implementation is:
+
+ sub { Class::MOP::class_of(shift) }
+
+Accordingly, this function is expected to return a metaclass.
+
=back
You can also provide parameters for C<Moose::Util::MetaRole::apply_metaroles>