X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=a34870026c8bf4dfd7d71b56bf90d7439e062dde;hp=01a9efc993f7333093abf1b7f987ef5c436fe2c6;hb=53ddfcecdb4f292ff080ce5dc21b7463869193fe;hpb=53875581c2449e237cc1135b8c2cf1674a874aed diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 01a9efc..a348700 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -1,11 +1,12 @@ package Mouse::Util; use strict; use warnings; -use base qw/Exporter/; + +use Exporter; use Carp qw(confess); -use B (); +our @ISA = qw(Exporter); our @EXPORT_OK = qw( find_meta does_role @@ -95,6 +96,8 @@ BEGIN { my ($coderef) = @_; ref($coderef) or return; + require B; + my $cv = B::svref_2object($coderef); $cv->isa('B::CV') or return; @@ -247,7 +250,7 @@ sub apply_all_roles { if ($i + 1 < $max && ref($_[$i + 1])) { push @roles, [ $_[$i++] => $_[$i] ]; } else { - push @roles, [ $_[$i] => {} ]; + push @roles, [ $_[$i] => undef ]; } my $role_name = $roles[-1][0]; load_class($role_name); @@ -331,9 +334,17 @@ Mouse::Util - features, with or without their dependencies =head2 Class::MOP -=head3 C +=head2 C<< is_class_loaded(ClassName) -> Bool >> + +Returns whether C is actually loaded or not. It uses a heuristic which +involves checking for the existence of C<$VERSION>, C<@ISA>, and any +locally-defined method. -=head3 C +=head3 C<< load_class(ClassName) >> + +This will load a given C (or die if it's not loadable). +This function can be used in place of tricks like +C or using C. =head2 MRO::Compat @@ -353,5 +364,15 @@ C =back +=head1 SEE ALSO + +L + +L + +L + +L + =cut