| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | { | 
| 2 |  |  |  |  |  |  | use strict; | 
| 3 | 1 |  |  | 1 |  | 21 | use warnings; | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 66 |  | 
| 4 | 1 |  |  | 1 |  | 14 | no warnings qw( once void ); | 
|  | 1 |  |  |  |  | 8 |  | 
|  | 1 |  |  |  |  | 91 |  | 
| 5 | 1 |  |  | 1 |  | 11 |  | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 222 |  | 
| 6 |  |  |  |  |  |  | our $USES_MITE = "Mite::Class"; | 
| 7 |  |  |  |  |  |  | our $MITE_SHIM = "Mite::Shim"; | 
| 8 |  |  |  |  |  |  | our $MITE_VERSION = "0.011000"; | 
| 9 |  |  |  |  |  |  | # Mite keywords | 
| 10 |  |  |  |  |  |  | BEGIN { | 
| 11 |  |  |  |  |  |  | my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Thingy" ); | 
| 12 | 1 |  |  | 1 |  | 5 | ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { | 
| 13 | 1 |  |  |  |  | 3 | no warnings 'redefine'; | 
| 14 |  |  |  |  |  |  | ( | 
| 15 | 1 |  |  | 1 |  | 9 | sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, | 
|  | 1 |  |  |  |  | 33 |  | 
|  | 1 |  |  |  |  | 307 |  | 
| 16 |  |  |  |  |  |  | sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, | 
| 17 | 0 |  |  |  |  | 0 | sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, | 
| 18 | 0 |  |  |  |  | 0 | sub {}, | 
| 19 | 0 |  |  |  |  | 0 | sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, | 
| 20 |  |  |  |  |  |  | sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, | 
| 21 | 1 |  |  |  |  | 14 | sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, | 
| 22 | 0 |  |  |  |  | 0 | ); | 
| 23 | 0 |  |  |  |  | 0 | }; | 
| 24 | 1 |  |  |  |  | 57 |  | 
| 25 |  |  |  |  |  |  | # Gather metadata for constructor and destructor | 
| 26 |  |  |  |  |  |  | no strict 'refs'; | 
| 27 |  |  |  |  |  |  | my $class      = shift; $class = ref($class) || $class; | 
| 28 |  |  |  |  |  |  | my $linear_isa = mro::get_linear_isa( $class ); | 
| 29 |  |  |  |  |  |  | return { | 
| 30 | 1 |  |  | 1 |  | 6 | BUILD => [ | 
|  | 1 |  |  |  |  | 8 |  | 
|  | 1 |  |  |  |  | 797 |  | 
| 31 | 1 |  | 33 | 1 |  | 2 | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | 
|  | 1 |  |  |  |  | 15 |  | 
| 32 | 1 |  |  |  |  | 10 | map { "$_\::BUILD" } reverse @$linear_isa | 
| 33 |  |  |  |  |  |  | ], | 
| 34 |  |  |  |  |  |  | DEMOLISH => [ | 
| 35 | 1 | 50 |  |  |  | 2 | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | 
|  | 1 |  |  |  |  | 8 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 36 | 1 |  |  |  |  | 3 | map { "$_\::DEMOLISH" } @$linear_isa | 
| 37 |  |  |  |  |  |  | ], | 
| 38 |  |  |  |  |  |  | HAS_BUILDARGS => $class->can('BUILDARGS'), | 
| 39 | 1 | 50 |  |  |  | 1 | HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), | 
|  | 1 |  |  |  |  | 47 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 40 | 1 |  |  |  |  | 4 | }; | 
|  | 1 |  |  |  |  | 5 |  | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | # Standard Moose/Moo-style constructor | 
| 45 |  |  |  |  |  |  | my $class = ref($_[0]) ? ref(shift) : shift; | 
| 46 |  |  |  |  |  |  | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 47 |  |  |  |  |  |  | my $self  = bless {}, $class; | 
| 48 |  |  |  |  |  |  | my $args  = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; | 
| 49 |  |  |  |  |  |  | my $no_build = delete $args->{__no_BUILD__}; | 
| 50 | 1 | 50 |  | 1 |  | 160 |  | 
| 51 | 1 |  | 33 |  |  | 8 | # Attribute xyz | 
| 52 | 1 |  |  |  |  | 3 | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 3 | 
| 53 | 1 | 50 |  |  |  | 7 | if ( exists $args->{"xyz"} ) { $self->{"xyz"} = $args->{"xyz"}; } ; | 
|  | 0 | 50 |  |  |  | 0 |  | 
| 54 | 1 |  |  |  |  | 1 |  | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | # Call BUILD methods | 
| 57 |  |  |  |  |  |  | $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); | 
| 58 | 1 | 50 |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 59 |  |  |  |  |  |  | # Unrecognized parameters | 
| 60 |  |  |  |  |  |  | my @unknown = grep not( /\Axyz\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 1 | 50 | 33 |  |  | 3 | return $self; | 
|  | 1 | 50 |  |  |  | 8 |  | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 1 | 50 |  |  |  | 2 | # Used by constructor to call BUILD methods | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 66 |  |  |  |  |  |  | my $class = ref( $_[0] ); | 
| 67 | 1 |  |  |  |  | 5 | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 68 |  |  |  |  |  |  | $_->( @_ ) for @{ $meta->{BUILD} || [] }; | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | # Destructor should call DEMOLISH methods | 
| 72 | 0 |  |  | 0 |  | 0 | my $self  = shift; | 
| 73 | 0 |  | 0 |  |  | 0 | my $class = ref( $self ) || $self; | 
| 74 | 0 | 0 |  |  |  | 0 | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
|  | 0 |  |  |  |  | 0 |  | 
| 75 |  |  |  |  |  |  | my $in_global_destruction = defined ${^GLOBAL_PHASE} | 
| 76 |  |  |  |  |  |  | ? ${^GLOBAL_PHASE} eq 'DESTRUCT' | 
| 77 |  |  |  |  |  |  | : Devel::GlobalDestruction::in_global_destruction(); | 
| 78 |  |  |  |  |  |  | for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { | 
| 79 | 1 |  |  | 1 |  | 2 | my $e = do { | 
| 80 | 1 |  | 33 |  |  | 3 | local ( $?, $@ ); | 
| 81 | 1 |  | 33 |  |  | 4 | eval { $demolisher->( $self, $in_global_destruction ) }; | 
| 82 | 1 | 50 |  |  |  | 2 | $@; | 
| 83 |  |  |  |  |  |  | }; | 
| 84 |  |  |  |  |  |  | no warnings 'misc'; # avoid (in cleanup) warnings | 
| 85 | 1 | 50 |  |  |  | 2 | die $e if $e;       # rethrow | 
|  | 1 |  |  |  |  | 4 |  | 
| 86 | 0 |  |  |  |  | 0 | } | 
| 87 | 0 |  |  |  |  | 0 | return; | 
| 88 | 0 |  |  |  |  | 0 | } | 
|  | 0 |  |  |  |  | 0 |  | 
| 89 | 0 |  |  |  |  | 0 |  | 
| 90 |  |  |  |  |  |  | my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; | 
| 91 | 1 |  |  | 1 |  | 13 |  | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 415 |  | 
| 92 | 0 | 0 |  |  |  | 0 | # Accessors for xyz | 
| 93 |  |  |  |  |  |  | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 3 | 
| 94 | 1 |  |  |  |  | 10 | if ( $__XS ) { | 
| 95 |  |  |  |  |  |  | Class::XSAccessor->import( | 
| 96 |  |  |  |  |  |  | chained => 1, | 
| 97 |  |  |  |  |  |  | "getters" => { "xyz" => "xyz" }, | 
| 98 |  |  |  |  |  |  | ); | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  | else { | 
| 101 |  |  |  |  |  |  | *xyz = sub { @_ == 1 or Mite::Shim::croak( 'Reader "xyz" usage: $self->xyz()' ); $_[0]{"xyz"} }; | 
| 102 |  |  |  |  |  |  | } | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | # See UNIVERSAL | 
| 106 |  |  |  |  |  |  | my ( $self, $role ) = @_; | 
| 107 |  |  |  |  |  |  | our %DOES; | 
| 108 |  |  |  |  |  |  | return $DOES{$role} if exists $DOES{$role}; | 
| 109 |  |  |  |  |  |  | return 1 if $role eq __PACKAGE__; | 
| 110 |  |  |  |  |  |  | if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { | 
| 111 |  |  |  |  |  |  | $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  | return $self->SUPER::DOES( $role ); | 
| 114 | 7 |  |  | 7 |  | 12 | } | 
| 115 | 7 |  |  |  |  | 8 |  | 
| 116 | 7 | 50 |  |  |  | 15 | # Alias for Moose/Moo-compatibility | 
| 117 | 7 | 50 |  |  |  | 12 | shift->DOES( @_ ); | 
| 118 | 7 | 50 | 0 |  |  | 13 | } | 
|  |  |  | 33 |  |  |  |  | 
| 119 | 0 | 0 | 0 |  |  | 0 |  | 
| 120 |  |  |  |  |  |  | 1; | 
| 121 | 7 |  |  |  |  | 35 | use strict; | 
| 122 |  |  |  |  |  |  | use warnings; | 
| 123 |  |  |  |  |  |  | no warnings qw( once void ); | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | our $USES_MITE = "Mite::Class"; | 
| 126 | 7 |  |  | 7 |  | 707 | our $MITE_SHIM = "Mite::Shim"; | 
| 127 |  |  |  |  |  |  | our $MITE_VERSION = "0.011000"; | 
| 128 |  |  |  |  |  |  | # Mite keywords | 
| 129 |  |  |  |  |  |  | BEGIN { | 
| 130 |  |  |  |  |  |  | my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest" ); | 
| 131 |  |  |  |  |  |  | ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { | 
| 132 | 1 |  |  | 1 |  | 13 | no warnings 'redefine'; | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 133 | 1 |  |  | 1 |  | 6 | ( | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 134 | 1 |  |  | 1 |  | 5 | sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 115 |  | 
| 135 |  |  |  |  |  |  | sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, | 
| 136 |  |  |  |  |  |  | sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, | 
| 137 |  |  |  |  |  |  | sub {}, | 
| 138 |  |  |  |  |  |  | sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, | 
| 139 |  |  |  |  |  |  | sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, | 
| 140 |  |  |  |  |  |  | sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, | 
| 141 | 1 |  |  | 1 |  | 9 | ); | 
| 142 | 1 |  |  |  |  | 3 | }; | 
| 143 |  |  |  |  |  |  |  | 
| 144 | 1 |  |  | 1 |  | 7 | # Gather metadata for constructor and destructor | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 205 |  | 
| 145 |  |  |  |  |  |  | no strict 'refs'; | 
| 146 | 0 |  |  |  |  | 0 | my $class      = shift; $class = ref($class) || $class; | 
| 147 | 0 |  |  |  |  | 0 | my $linear_isa = mro::get_linear_isa( $class ); | 
| 148 | 0 |  |  |  |  | 0 | return { | 
| 149 |  |  |  |  |  |  | BUILD => [ | 
| 150 | 1 |  |  |  |  | 4 | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | 
| 151 | 0 |  |  |  |  | 0 | map { "$_\::BUILD" } reverse @$linear_isa | 
| 152 | 0 |  |  |  |  | 0 | ], | 
| 153 | 1 |  |  |  |  | 76 | DEMOLISH => [ | 
| 154 |  |  |  |  |  |  | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | 
| 155 |  |  |  |  |  |  | map { "$_\::DEMOLISH" } @$linear_isa | 
| 156 |  |  |  |  |  |  | ], | 
| 157 |  |  |  |  |  |  | HAS_BUILDARGS => $class->can('BUILDARGS'), | 
| 158 |  |  |  |  |  |  | HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), | 
| 159 | 1 |  |  | 1 |  | 9 | }; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 608 |  | 
| 160 | 1 |  | 33 | 1 |  | 2 | } | 
|  | 1 |  |  |  |  | 5 |  | 
| 161 | 1 |  |  |  |  | 3 |  | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | # Standard Moose/Moo-style constructor | 
| 164 | 1 | 50 |  |  |  | 2 | my $class = ref($_[0]) ? ref(shift) : shift; | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 165 | 1 |  |  |  |  | 12 | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 166 |  |  |  |  |  |  | my $self  = bless {}, $class; | 
| 167 |  |  |  |  |  |  | my $args  = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; | 
| 168 | 1 | 50 |  |  |  | 2 | my $no_build = delete $args->{__no_BUILD__}; | 
|  | 1 |  |  |  |  | 14 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 169 | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 3 |  | 
| 170 |  |  |  |  |  |  | # Attribute foo | 
| 171 |  |  |  |  |  |  | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 8 | 
| 172 |  |  |  |  |  |  | Mite::Shim::croak "Missing key in constructor: foo" unless exists $args->{"foo"}; | 
| 173 |  |  |  |  |  |  | $self->{"foo"} = $args->{"foo"}; | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | # Call BUILD methods | 
| 177 |  |  |  |  |  |  | $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); | 
| 178 |  |  |  |  |  |  |  | 
| 179 | 2 | 50 |  | 2 |  | 24 | # Unrecognized parameters | 
| 180 | 2 |  | 66 |  |  | 8 | my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); | 
| 181 | 2 |  |  |  |  | 4 |  | 
| 182 | 2 | 50 |  |  |  | 9 | return $self; | 
|  | 0 | 50 |  |  |  | 0 |  | 
| 183 | 2 |  |  |  |  | 3 | } | 
| 184 |  |  |  |  |  |  |  | 
| 185 |  |  |  |  |  |  | # Used by constructor to call BUILD methods | 
| 186 |  |  |  |  |  |  | my $class = ref( $_[0] ); | 
| 187 | 2 | 50 |  |  |  | 6 | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 188 | 2 |  |  |  |  | 5 | $_->( @_ ) for @{ $meta->{BUILD} || [] }; | 
| 189 |  |  |  |  |  |  | } | 
| 190 |  |  |  |  |  |  |  | 
| 191 |  |  |  |  |  |  | # Destructor should call DEMOLISH methods | 
| 192 | 2 | 50 | 33 |  |  | 6 | my $self  = shift; | 
|  | 2 | 50 |  |  |  | 16 |  | 
| 193 |  |  |  |  |  |  | my $class = ref( $self ) || $self; | 
| 194 |  |  |  |  |  |  | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 195 | 2 | 50 |  |  |  | 4 | my $in_global_destruction = defined ${^GLOBAL_PHASE} | 
|  | 2 |  |  |  |  | 43 |  | 
|  | 2 |  |  |  |  | 8 |  | 
| 196 |  |  |  |  |  |  | ? ${^GLOBAL_PHASE} eq 'DESTRUCT' | 
| 197 | 2 |  |  |  |  | 6 | : Devel::GlobalDestruction::in_global_destruction(); | 
| 198 |  |  |  |  |  |  | for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { | 
| 199 |  |  |  |  |  |  | my $e = do { | 
| 200 |  |  |  |  |  |  | local ( $?, $@ ); | 
| 201 |  |  |  |  |  |  | eval { $demolisher->( $self, $in_global_destruction ) }; | 
| 202 | 0 |  |  | 0 |  | 0 | $@; | 
| 203 | 0 |  | 0 |  |  | 0 | }; | 
| 204 | 0 | 0 |  |  |  | 0 | no warnings 'misc'; # avoid (in cleanup) warnings | 
|  | 0 |  |  |  |  | 0 |  | 
| 205 |  |  |  |  |  |  | die $e if $e;       # rethrow | 
| 206 |  |  |  |  |  |  | } | 
| 207 |  |  |  |  |  |  | return; | 
| 208 |  |  |  |  |  |  | } | 
| 209 | 2 |  |  | 2 |  | 1494 |  | 
| 210 | 2 |  | 33 |  |  | 8 | my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; | 
| 211 | 2 |  | 33 |  |  | 5 |  | 
| 212 | 2 | 50 |  |  |  | 11 | # Accessors for foo | 
| 213 |  |  |  |  |  |  | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 8 | 
| 214 |  |  |  |  |  |  | if ( $__XS ) { | 
| 215 | 2 | 50 |  |  |  | 4 | Class::XSAccessor->import( | 
|  | 2 |  |  |  |  | 7 |  | 
| 216 | 0 |  |  |  |  | 0 | chained => 1, | 
| 217 | 0 |  |  |  |  | 0 | "accessors" => { "foo" => "foo" }, | 
| 218 | 0 |  |  |  |  | 0 | ); | 
|  | 0 |  |  |  |  | 0 |  | 
| 219 | 0 |  |  |  |  | 0 | } | 
| 220 |  |  |  |  |  |  | else { | 
| 221 | 1 |  |  | 1 |  | 8 | *foo = sub { @_ > 1 ? do { $_[0]{"foo"} = $_[1]; $_[0]; } : ( $_[0]{"foo"} ) }; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 529 |  | 
| 222 | 0 | 0 |  |  |  | 0 | } | 
| 223 |  |  |  |  |  |  |  | 
| 224 | 2 |  |  |  |  | 8 | # Delegated methods for foo | 
| 225 |  |  |  |  |  |  | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 8 | 
| 226 |  |  |  |  |  |  |  | 
| 227 |  |  |  |  |  |  |  | 
| 228 |  |  |  |  |  |  | # See UNIVERSAL | 
| 229 |  |  |  |  |  |  | my ( $self, $role ) = @_; | 
| 230 |  |  |  |  |  |  | our %DOES; | 
| 231 |  |  |  |  |  |  | return $DOES{$role} if exists $DOES{$role}; | 
| 232 |  |  |  |  |  |  | return 1 if $role eq __PACKAGE__; | 
| 233 |  |  |  |  |  |  | if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { | 
| 234 |  |  |  |  |  |  | $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; | 
| 235 |  |  |  |  |  |  | } | 
| 236 |  |  |  |  |  |  | return $self->SUPER::DOES( $role ); | 
| 237 |  |  |  |  |  |  | } | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | # Alias for Moose/Moo-compatibility | 
| 240 | 3 | 100 | 66 | 3 |  | 12 | shift->DOES( @_ ); | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 51 |  | 
|  | 2 |  |  |  |  | 27 |  | 
| 241 |  |  |  |  |  |  | } | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | 1; | 
| 244 | 1 |  |  | 1 |  | 6 | use strict; | 
| 245 | 2 |  |  | 2 |  | 13 | use warnings; | 
| 246 |  |  |  |  |  |  | no warnings qw( once void ); | 
| 247 |  |  |  |  |  |  |  | 
| 248 |  |  |  |  |  |  | our $USES_MITE = "Mite::Class"; | 
| 249 |  |  |  |  |  |  | our $MITE_SHIM = "Mite::Shim"; | 
| 250 | 7 |  |  | 7 |  | 17 | our $MITE_VERSION = "0.011000"; | 
| 251 | 7 |  |  |  |  | 8 | # Mite keywords | 
| 252 | 7 | 50 |  |  |  | 15 | BEGIN { | 
| 253 | 7 | 50 |  |  |  | 12 | my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest2" ); | 
| 254 | 7 | 50 | 0 |  |  | 14 | ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { | 
|  |  |  | 33 |  |  |  |  | 
| 255 | 0 | 0 | 0 |  |  | 0 | no warnings 'redefine'; | 
| 256 |  |  |  |  |  |  | ( | 
| 257 | 7 |  |  |  |  | 35 | sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, | 
| 258 |  |  |  |  |  |  | sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, | 
| 259 |  |  |  |  |  |  | sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, | 
| 260 |  |  |  |  |  |  | sub {}, | 
| 261 |  |  |  |  |  |  | sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, | 
| 262 | 7 |  |  | 7 |  | 909 | sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, | 
| 263 |  |  |  |  |  |  | sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, | 
| 264 |  |  |  |  |  |  | ); | 
| 265 |  |  |  |  |  |  | }; | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | # Gather metadata for constructor and destructor | 
| 268 | 1 |  |  | 1 |  | 7 | no strict 'refs'; | 
|  | 1 |  |  |  |  | 9 |  | 
|  | 1 |  |  |  |  | 36 |  | 
| 269 | 1 |  |  | 1 |  | 6 | my $class      = shift; $class = ref($class) || $class; | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 270 | 1 |  |  | 1 |  | 6 | my $linear_isa = mro::get_linear_isa( $class ); | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 127 |  | 
| 271 |  |  |  |  |  |  | return { | 
| 272 |  |  |  |  |  |  | BUILD => [ | 
| 273 |  |  |  |  |  |  | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | 
| 274 |  |  |  |  |  |  | map { "$_\::BUILD" } reverse @$linear_isa | 
| 275 |  |  |  |  |  |  | ], | 
| 276 |  |  |  |  |  |  | DEMOLISH => [ | 
| 277 | 1 |  |  | 1 |  | 7 | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | 
| 278 | 1 |  |  |  |  | 2 | map { "$_\::DEMOLISH" } @$linear_isa | 
| 279 |  |  |  |  |  |  | ], | 
| 280 | 1 |  |  | 1 |  | 11 | HAS_BUILDARGS => $class->can('BUILDARGS'), | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 191 |  | 
| 281 |  |  |  |  |  |  | HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), | 
| 282 | 0 |  |  |  |  | 0 | }; | 
| 283 | 0 |  |  |  |  | 0 | } | 
| 284 | 0 |  |  |  |  | 0 |  | 
| 285 |  |  |  |  |  |  |  | 
| 286 | 1 |  |  |  |  | 4 | # Standard Moose/Moo-style constructor | 
| 287 | 0 |  |  |  |  | 0 | my $class = ref($_[0]) ? ref(shift) : shift; | 
| 288 | 0 |  |  |  |  | 0 | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 289 | 1 |  |  |  |  | 50 | my $self  = bless {}, $class; | 
| 290 |  |  |  |  |  |  | my $args  = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; | 
| 291 |  |  |  |  |  |  | my $no_build = delete $args->{__no_BUILD__}; | 
| 292 |  |  |  |  |  |  |  | 
| 293 |  |  |  |  |  |  | # Attribute foo | 
| 294 |  |  |  |  |  |  | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 18 | 
| 295 | 1 |  |  | 1 |  | 8 | Mite::Shim::croak "Missing key in constructor: foo" unless exists $args->{"foo"}; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 634 |  | 
| 296 | 1 |  | 33 | 1 |  | 2 | $self->{"foo"} = $args->{"foo"}; | 
|  | 1 |  |  |  |  | 4 |  | 
| 297 | 1 |  |  |  |  | 41 |  | 
| 298 |  |  |  |  |  |  |  | 
| 299 |  |  |  |  |  |  | # Call BUILD methods | 
| 300 | 1 | 50 |  |  |  | 2 | $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 301 | 1 |  |  |  |  | 5 |  | 
| 302 |  |  |  |  |  |  | # Unrecognized parameters | 
| 303 |  |  |  |  |  |  | my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); | 
| 304 | 1 | 50 |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 30 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 305 | 1 |  |  |  |  | 5 | return $self; | 
|  | 1 |  |  |  |  | 3 |  | 
| 306 |  |  |  |  |  |  | } | 
| 307 |  |  |  |  |  |  |  | 
| 308 |  |  |  |  |  |  | # Used by constructor to call BUILD methods | 
| 309 |  |  |  |  |  |  | my $class = ref( $_[0] ); | 
| 310 |  |  |  |  |  |  | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 311 |  |  |  |  |  |  | $_->( @_ ) for @{ $meta->{BUILD} || [] }; | 
| 312 |  |  |  |  |  |  | } | 
| 313 |  |  |  |  |  |  |  | 
| 314 |  |  |  |  |  |  | # Destructor should call DEMOLISH methods | 
| 315 | 1 | 50 |  | 1 |  | 12 | my $self  = shift; | 
| 316 | 1 |  | 33 |  |  | 7 | my $class = ref( $self ) || $self; | 
| 317 | 1 |  |  |  |  | 10 | my $meta  = ( $Mite::META{$class} ||= $class->__META__ ); | 
| 318 | 1 | 50 |  |  |  | 5 | my $in_global_destruction = defined ${^GLOBAL_PHASE} | 
|  | 0 | 50 |  |  |  | 0 |  | 
| 319 | 1 |  |  |  |  | 2 | ? ${^GLOBAL_PHASE} eq 'DESTRUCT' | 
| 320 |  |  |  |  |  |  | : Devel::GlobalDestruction::in_global_destruction(); | 
| 321 |  |  |  |  |  |  | for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { | 
| 322 |  |  |  |  |  |  | my $e = do { | 
| 323 | 1 | 50 |  |  |  | 3 | local ( $?, $@ ); | 
| 324 | 1 |  |  |  |  | 3 | eval { $demolisher->( $self, $in_global_destruction ) }; | 
| 325 |  |  |  |  |  |  | $@; | 
| 326 |  |  |  |  |  |  | }; | 
| 327 |  |  |  |  |  |  | no warnings 'misc'; # avoid (in cleanup) warnings | 
| 328 | 1 | 50 | 33 |  |  | 4 | die $e if $e;       # rethrow | 
|  | 1 | 50 |  |  |  | 5 |  | 
| 329 |  |  |  |  |  |  | } | 
| 330 |  |  |  |  |  |  | return; | 
| 331 | 1 | 50 |  |  |  | 2 | } | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 2 |  | 
| 332 |  |  |  |  |  |  |  | 
| 333 | 1 |  |  |  |  | 4 | my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; | 
| 334 |  |  |  |  |  |  |  | 
| 335 |  |  |  |  |  |  | # Accessors for foo | 
| 336 |  |  |  |  |  |  | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 18 | 
| 337 |  |  |  |  |  |  | if ( $__XS ) { | 
| 338 | 0 |  |  | 0 |  | 0 | Class::XSAccessor->import( | 
| 339 | 0 |  | 0 |  |  | 0 | chained => 1, | 
| 340 | 0 | 0 |  |  |  | 0 | "accessors" => { "foo" => "foo" }, | 
|  | 0 |  |  |  |  | 0 |  | 
| 341 |  |  |  |  |  |  | ); | 
| 342 |  |  |  |  |  |  | } | 
| 343 |  |  |  |  |  |  | else { | 
| 344 |  |  |  |  |  |  | *foo = sub { @_ > 1 ? do { $_[0]{"foo"} = $_[1]; $_[0]; } : ( $_[0]{"foo"} ) }; | 
| 345 | 1 |  |  | 1 |  | 559 | } | 
| 346 | 1 |  | 33 |  |  | 4 |  | 
| 347 | 1 |  | 33 |  |  | 3 | # Delegated methods for foo | 
| 348 | 1 | 50 |  |  |  | 4 | # has declaration, file ../../../../tmp/O2w0hyQfmG, line 18 | 
| 349 |  |  |  |  |  |  |  | 
| 350 |  |  |  |  |  |  |  | 
| 351 | 1 | 50 |  |  |  | 2 | # See UNIVERSAL | 
|  | 1 |  |  |  |  | 4 |  | 
| 352 | 0 |  |  |  |  | 0 | my ( $self, $role ) = @_; | 
| 353 | 0 |  |  |  |  | 0 | our %DOES; | 
| 354 | 0 |  |  |  |  | 0 | return $DOES{$role} if exists $DOES{$role}; | 
|  | 0 |  |  |  |  | 0 |  | 
| 355 | 0 |  |  |  |  | 0 | return 1 if $role eq __PACKAGE__; | 
| 356 |  |  |  |  |  |  | if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { | 
| 357 | 1 |  |  | 1 |  | 11 | $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 496 |  | 
| 358 | 0 | 0 |  |  |  | 0 | } | 
| 359 |  |  |  |  |  |  | return $self->SUPER::DOES( $role ); | 
| 360 | 1 |  |  |  |  | 4 | } | 
| 361 |  |  |  |  |  |  |  | 
| 362 |  |  |  |  |  |  | # Alias for Moose/Moo-compatibility | 
| 363 |  |  |  |  |  |  | shift->DOES( @_ ); | 
| 364 |  |  |  |  |  |  | } | 
| 365 |  |  |  |  |  |  |  | 
| 366 |  |  |  |  |  |  | 1; |