X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=33c51f173ee9175d0e6c2093e5271eaac97fd146;hp=cf807dad380db98b5492b5c8409691aa0345c8db;hb=5fa003bf0b3308fd48519ff1173feb778c550c01;hpb=272a1930e662030c12797d6b982e51e849dec783 diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index cf807da..33c51f1 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -1,14 +1,12 @@ -#!/usr/bin/env perl package Mouse::Util; use strict; use warnings; use base qw/Exporter/; use Carp; -use Scalar::Util qw(blessed looks_like_number openhandle reftype weaken); our @EXPORT_OK = qw( - blessed looks_like_number openhandle reftype weaken get_linear_isa + apply_all_roles ); our %EXPORT_TAGS = ( all => \@EXPORT_OK, @@ -16,12 +14,13 @@ our %EXPORT_TAGS = ( BEGIN { my $impl; - if (\&mro::get_linear_isa) { + if ($] >= 5.009_005) { + require mro; $impl = \&mro::get_linear_isa; } else { my $loaded = do { local $SIG{__DIE__} = 'DEFAULT'; - eval "use MRO::Compat (); 1"; + eval "require MRO::Compat; 1"; }; if ($loaded) { $impl = \&mro::get_linear_isa; @@ -49,6 +48,7 @@ BEGIN { $impl = $code; } } + no strict 'refs'; *{ __PACKAGE__ . '::get_linear_isa'} = $impl; } @@ -57,6 +57,8 @@ sub apply_all_roles { my $meta = Mouse::Meta::Class->initialize(shift); my @roles; + + # Basis of Data::OptList my $max = scalar(@_); for (my $i = 0; $i < $max ; $i++) { if ($i + 1 < $max && ref($_[$i + 1])) { @@ -100,26 +102,5 @@ Mouse::Util - features, with or without their dependencies =head3 get_linear_isa -=head2 L - -=head3 blessed - -=head3 looks_like_number - -=head3 reftype - -=head3 openhandle - -=head3 weaken - -C I be implemented in XS. If the user tries to use C -without L, an error is thrown. - -=head2 Test::Exception - -=head3 throws_ok - -=head3 lives_ok - =cut