use Class::MOP;
use Module::Pluggable::Object;
-our $VERSION = '0.0006';
+our $VERSION = '0.0007';
=head1 NAME
and will overload each other. You may also add attributes through has.
Please note that when you load at runtime you lose the ability to wrap C<BUILD>
-and roles using C<has> will not go through comile time checks like C<required>
+and roles using C<has> will not go through compile time checks like C<required>
and <default>.
Even though C<override> will work , I STRONGLY discourage it's use
and a warning will be thrown if you try to use it.
-This is closely linked to the way multiple roles being applies is handles and is not
+This is closely linked to the way multiple roles being applied is handled and is not
likely to change. C<override> bevavior is closely linked to inheritance and thus will
likely not work as you expect it in multiple inheritance situations. Point being,
save yourself the headache.
#Father, please forgive me for I have sinned.
my @roles = grep{ /${o}$/ } $self->_plugin_locator->plugins;
- die("Unable to locate plugin") unless @roles;
+ croak("Unable to locate plugin '$plugin'") unless @roles;
return $roles[0] if @roles == 1;
my $i = 0;
my ($self, $role) = @_;
die("You must provide a role name") unless $role;
- #don't re-require...
- unless( Class::MOP::is_class_loaded($role) ){
- eval Class::MOP::load_class($role) || die("Failed to load role: $role");
- }
+ eval { Class::MOP::load_class($role) };
+ confess("Failed to load role: ${role} $@") if $@;
carp("Using 'override' is strongly discouraged and may not behave ".
"as you expect it to. Please use 'around'")
if scalar keys %{ $role->meta->get_override_method_modifiers_map };
- die("Failed to apply plugin: $role") unless $role->meta->apply( $self );
+ $role->meta->apply( $self );
return 1;
}