use warnings;
use Scalar::Util 'blessed';
-our $VERSION = '0.93_02';
+our $VERSION = '1.23';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use List::MoreUtils qw( all );
use List::Util qw( first );
+use Moose::Deprecated;
sub apply_metaclass_roles {
+ Moose::Deprecated::deprecated(
+ feature => 'pre-0.94 MetaRole API',
+ message =>
+ 'The old Moose::Util::MetaRole API (before version 0.94) has been deprecated'
+ );
+
goto &apply_metaroles;
}
my %args = @_;
_fixup_old_style_args(\%args);
- Carp::cluck('applying') if $::D;
+
my $for
= blessed $args{for}
? $args{for}
sub _fixup_old_style_args {
my $args = shift;
- return if $args->{class_metaroles} || $args->{roles_metaroles};
+ return if $args->{class_metaroles} || $args->{role_metaroles};
+
+ Moose::Deprecated::deprecated(
+ feature => 'pre-0.94 MetaRole API',
+ message =>
+ 'The old Moose::Util::MetaRole API (before version 0.94) has been deprecated'
+ );
$args->{for} = delete $args->{for_class}
if exists $args->{for_class};
=head1 USAGE
-B<It is very important that you only call this module's functions when
-your module is imported by the caller>. The process of applying roles
-to the metaclass reinitializes the metaclass object, which wipes out
-any existing attributes already defined. However, as long as you do
-this when your module is imported, the caller should not have any
-attributes defined yet.
-
-The easiest way to ensure that this happens is to use
-L<Moose::Exporter>, which can generate the appropriate C<init_meta>
-method for you, and make sure it is called when imported.
+The easiest way to use this module is through L<Moose::Exporter>, which can
+generate the appropriate C<init_meta> method for you, and make sure it is
+called when imported.
=head1 FUNCTIONS
=head2 apply_metaroles( ... )
-This function will apply roles to one or more metaclasses for the
-specified class. It accepts the following parameters:
+This function will apply roles to one or more metaclasses for the specified
+class. It will return a new metaclass object for the class or role passed in
+the "for" parameter.
+
+It accepts the following parameters:
=over 4
=head1 COPYRIGHT AND LICENSE
-Copyright 2009 by Infinity Interactive, Inc.
+Copyright 2009-2010 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>