File Coverage

/tmp/V5ms7p7G_H.mite.pm
Criterion Covered Total %
statement 76 97 78.3
branch 21 44 47.7
condition 6 27 22.2
subroutine 15 16 93.7
pod n/a
total 118 184 64.1


line stmt bran cond sub pod time code
1             {
2             use strict;
3 1     1   5 use warnings;
  1         2  
  1         25  
4 1     1   4 no warnings qw( once void );
  1         8  
  1         28  
5 1     1   4  
  1         1  
  1         124  
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", "MyPerson" );
12 1     1   4 ( *after, *around, *before, *extends, *has, *signature_for, *with ) = do {
13 1         1 no warnings 'redefine';
14             (
15 1     1   6 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
  1         1  
  1         154  
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 4         8 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
22 0         0 );
23 0         0 };
24 1         36  
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   5 BUILD => [
  1         2  
  1         690  
31 1   33 1   2 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  1         4  
32 1         5 map { "$_\::BUILD" } reverse @$linear_isa
33             ],
34             DEMOLISH => [
35 1 50       1 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  1         5  
  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         25  
  0         0  
40 1         2 };
  1         2  
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   126  
51 1   33     5 # Attribute first_name
52 1         2 # has declaration, file ../../../../tmp/V5ms7p7G_H, line 3
53 1 50       6 my $args_for_first__name = {};
  0 50       0  
54 1         2 for ( "first_name", "given_name" ) { next unless exists $args->{$_}; $args_for_first__name->{"first_name"} = $args->{$_}; last; };
55             Mite::Shim::croak "Missing key in constructor: first_name" unless exists $args_for_first__name->{"first_name"};
56             $self->{"first_name"} = $args_for_first__name->{"first_name"};
57              
58 1         1 # Attribute last_name
59 1 100       1 # has declaration, file ../../../../tmp/V5ms7p7G_H, line 7
  2         4  
  1         2  
  1         2  
60 1 50       2 my $args_for_last__name = {};
61 1         3 for ( "last_name", "family_name", "surname" ) { next unless exists $args->{$_}; $args_for_last__name->{"last_name"} = $args->{$_}; last; };
62             Mite::Shim::croak "Missing key in constructor: last_name" unless exists $args_for_last__name->{"last_name"};
63             $self->{"last_name"} = $args_for_last__name->{"last_name"};
64              
65 1         2 # Attribute age
66 1 100       1 # has declaration, file ../../../../tmp/V5ms7p7G_H, line 11
  3         5  
  1         2  
  1         1  
67 1 50       4 if ( exists $args->{"age"} ) { $self->{"age"} = $args->{"age"}; } ;
68 1         1  
69             # Attribute height
70             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 14
71             if ( exists $args->{"height"} ) { $self->{"height"} = $args->{"height"}; } ;
72 1 50       3  
  0         0  
73              
74             # Call BUILD methods
75             $self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } );
76 1 50       1  
  0         0  
77             # Unrecognized parameters
78             my @unknown = grep not( /\A(?:age|f(?:amily_name|irst_name)|given_name|height|last_name|surname)\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
79              
80 1 50 33     11 return $self;
  1 50       10  
81             }
82              
83 1 50       2 # Used by constructor to call BUILD methods
  1         8  
  1         3  
84             my $class = ref( $_[0] );
85 1         4 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
86             $_->( @_ ) for @{ $meta->{BUILD} || [] };
87             }
88              
89             # Destructor should call DEMOLISH methods
90 0     0   0 my $self = shift;
91 0   0     0 my $class = ref( $self ) || $self;
92 0 0       0 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
  0         0  
93             my $in_global_destruction = defined ${^GLOBAL_PHASE}
94             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
95             : Devel::GlobalDestruction::in_global_destruction();
96             for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
97 1     1   624 my $e = do {
98 1   33     3 local ( $?, $@ );
99 1   33     12 eval { $demolisher->( $self, $in_global_destruction ) };
100 1 50       4 $@;
101             };
102             no warnings 'misc'; # avoid (in cleanup) warnings
103 1 50       1 die $e if $e; # rethrow
  1         4  
104 0         0 }
105 0         0 return;
106 0         0 }
  0         0  
107 0         0  
108             my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
109 1     1   13  
  1         1  
  1         607  
110 0 0       0 # Accessors for age
111             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 11
112 1         8 if ( $__XS ) {
113             Class::XSAccessor->import(
114             chained => 1,
115             "getters" => { "age" => "age" },
116             );
117             }
118             else {
119             *age = sub { @_ == 1 or Mite::Shim::croak( 'Reader "age" usage: $self->age()' ); $_[0]{"age"} };
120             }
121              
122             # Accessors for first_name
123             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 3
124             if ( $__XS ) {
125             Class::XSAccessor->import(
126             chained => 1,
127             "accessors" => { "first_name" => "first_name" },
128             );
129             }
130             else {
131             *first_name = sub { @_ > 1 ? do { $_[0]{"first_name"} = $_[1]; $_[0]; } : ( $_[0]{"first_name"} ) };
132             }
133              
134             # Aliases for first_name
135             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 3
136              
137             # Accessors for height
138             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 14
139             if ( $__XS ) {
140             Class::XSAccessor->import(
141             chained => 1,
142             "getters" => { "height" => "height" },
143 2     2   1499 );
144             }
145             else {
146             *height = sub { @_ == 1 or Mite::Shim::croak( 'Reader "height" usage: $self->height()' ); $_[0]{"height"} };
147             }
148              
149             # Accessors for last_name
150             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 7
151             if ( $__XS ) {
152             Class::XSAccessor->import(
153             chained => 1,
154             "getters" => { "last_name" => "last_name" },
155             "setters" => { "_set_last_name" => "last_name" },
156             );
157             }
158             else {
159             *last_name = sub { @_ == 1 or Mite::Shim::croak( 'Reader "last_name" usage: $self->last_name()' ); $_[0]{"last_name"} };
160             *_set_last_name = sub { @_ == 2 or Mite::Shim::croak( 'Writer "_set_last_name" usage: $self->_set_last_name( $newvalue )' ); $_[0]{"last_name"} = $_[1]; $_[0]; };
161             }
162              
163             # Aliases for last_name
164             # has declaration, file ../../../../tmp/V5ms7p7G_H, line 7
165              
166              
167             # See UNIVERSAL
168             my ( $self, $role ) = @_;
169             our %DOES;
170             return $DOES{$role} if exists $DOES{$role};
171             return 1 if $role eq __PACKAGE__;
172             if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) {
173 1     1   22 $meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1;
174 1     1   13 }
175             return $self->SUPER::DOES( $role );
176             }
177              
178             # Alias for Moose/Moo-compatibility
179 7     7   9 shift->DOES( @_ );
180 7         7 }
181 7 50       11  
182 7 50       9 1;