| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 15 |  |  | 15 |  | 347 | use 5.010001; | 
|  | 15 |  |  |  |  | 68 |  | 
| 2 | 15 |  |  | 15 |  | 96 | use strict; | 
|  | 15 |  |  |  |  | 38 |  | 
|  | 15 |  |  |  |  | 427 |  | 
| 3 | 15 |  |  | 15 |  | 100 | use warnings; | 
|  | 15 |  |  |  |  | 50 |  | 
|  | 15 |  |  |  |  | 780 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | use Mite::Miteception -role, -all; | 
| 6 | 15 |  |  | 15 |  | 125 |  | 
|  | 15 |  |  |  |  | 37 |  | 
|  | 15 |  |  |  |  | 138 |  | 
| 7 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:TOBYINK'; | 
| 8 |  |  |  |  |  |  | our $VERSION   = '0.011000'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has required_methods => | 
| 11 |  |  |  |  |  |  | is            => ro, | 
| 12 |  |  |  |  |  |  | isa           => ArrayRef[MethodName], | 
| 13 |  |  |  |  |  |  | builder       => sub { [] }; | 
| 14 | 10 |  |  | 10 |  | 32 |  | 
| 15 |  |  |  |  |  |  | my $self = shift; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 2 |  |  | 2 | 0 | 6 | push @{ $self->required_methods }, @_; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 2 |  |  |  |  | 6 | return; | 
|  | 2 |  |  |  |  | 13 |  | 
| 20 |  |  |  |  |  |  | } | 
| 21 | 2 |  |  |  |  | 6 |  | 
| 22 |  |  |  |  |  |  | before inject_mite_functions => sub { | 
| 23 |  |  |  |  |  |  | my ( $self, $file, $arg ) = ( shift, @_ ); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | my $requested = sub { $arg->{$_[0]} ? 1 : $arg->{'!'.$_[0]} ? 0 : $arg->{'-all'} ? 1 : $_[1]; }; | 
| 26 |  |  |  |  |  |  | my $defaults  = ! $arg->{'!-defaults'}; | 
| 27 |  |  |  |  |  |  | my $shim      = $self->shim_name; | 
| 28 |  |  |  |  |  |  | my $package   = $self->name; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | no strict 'refs'; | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 15 |  |  | 15 |  | 122 | if ( $requested->( 'requires', $defaults ) ) { | 
|  | 15 |  |  |  |  | 44 |  | 
|  | 15 |  |  |  |  | 4159 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | *{ $package .'::requires' } = sub { | 
| 35 |  |  |  |  |  |  | $self->add_required_methods( @_ ); | 
| 36 |  |  |  |  |  |  | return; | 
| 37 |  |  |  |  |  |  | }; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | $self->imported_keywords->{requires} = 'sub {}'; | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  | }; | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | around _compile_mop_required_methods => sub { | 
| 44 |  |  |  |  |  |  | my ( $next, $self ) = ( shift, shift ); | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | my $code = $self->$next( @_ ); | 
| 47 |  |  |  |  |  |  | $code .= "\n" if $code; | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | if ( my @req = @{ $self->required_methods } ) { | 
| 50 |  |  |  |  |  |  | $code .= sprintf "    \$PACKAGE->add_required_methods( %s );\n", | 
| 51 |  |  |  |  |  |  | join( q{, }, map B::perlstring( $_ ), @req ), | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | return $code; | 
| 55 |  |  |  |  |  |  | }; | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | 1; |