7 use Scalar::Util qw(blessed looks_like_number openhandle reftype weaken);
10 blessed looks_like_number openhandle reftype weaken
19 if (\&mro::get_linear_isa) {
20 $impl = \&mro::get_linear_isa;
23 local $SIG{__DIE__} = 'DEFAULT';
24 eval "use MRO::Compat (); 1";
27 $impl = \&mro::get_linear_isa;
29 # VVVVV CODE TAKEN FROM MRO::COMPAT VVVVV
30 my $code; # this recurses so it isn't pretty
34 my $classname = shift;
36 my @lin = ($classname);
38 foreach my $parent (@{"$classname\::ISA"}) {
39 my $plin = $code->($parent);
41 next if exists $stored{$_};
48 # ^^^^^ CODE TAKEN FROM MRO::COMPAT ^^^^^
53 *{ __PACKAGE__ . '::get_linear_isa'} = $impl;
57 my $meta = Mouse::Meta::Class->initialize(shift);
61 for (my $i = 0; $i < $max ; $i++) {
62 if ($i + 1 < $max && ref($_[$i + 1])) {
63 push @roles, [ $_[$i++] => $_[$i] ];
65 push @roles, [ $_[$i] => {} ];
69 foreach my $role_spec (@roles) {
70 Mouse::load_class( $role_spec->[0] );
73 ( $_->[0]->can('meta') && $_->[0]->meta->isa('Mouse::Meta::Role') )
74 || croak("You can only consume roles, "
76 . " is not a Moose role")
79 if ( scalar @roles == 1 ) {
80 my ( $role, $params ) = @{ $roles[0] };
81 $role->meta->apply( $meta, ( defined $params ? %$params : () ) );
84 Mouse::Meta::Role->combine_apply($meta, @roles);
95 Mouse::Util - features, with or without their dependencies
97 =head1 IMPLEMENTATIONS FOR
101 =head3 get_linear_isa
103 =head2 L<Scalar::Util>
107 =head3 looks_like_number
115 C<weaken> I<must> be implemented in XS. If the user tries to use C<weaken>
116 without L<Scalar::Util>, an error is thrown.
118 =head2 Test::Exception