| 1 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Acme::Marvel::CinematicUniverse::Characters; | ||||||||||
| 6 | |||||||||||
| 7 | 1 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||
| 8 | 1 | our $VERSION = '0.004'; | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Module::Pluggable ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | search_path => [ 'Acme::Marvel::CinematicUniverse::Character::Instance' ], | |||||||||
| 12 | sub_name => 'instance_modules', | ||||||||||
| 13 | require => 1, | ||||||||||
| 14 | 1 | ); | |||||||||
| 15 | |||||||||||
| 16 | 1 | my @characters; | |||||||||
| 17 | |||||||||||
| 18 | 6 | ▶ | sub load_character { | ||||||||
|
Subroutine
load_character: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 19 | 6 | my ( $class ) = ( shift ); | |||||||||
| 20 | 6 | push @characters, @_; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 1 | ▶ | sub characters { | ||||||||
|
Subroutine
characters: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 24 | 1 | my ( $class ) = ( shift ); | |||||||||
| 25 | 1 | return @characters; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 2 | ▶ | sub find { | ||||||||
|
Subroutine
find: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 29 | 2 | my ( $class, $search ) = ( shift, @_ ); | |||||||||
| 30 | my $re = | ||||||||||
| 31 | ref( $search ) | ||||||||||
| 32 | ? $search | ||||||||||
| 33 | 2 | ▶ | : do { my $q = quotemeta( $search ); qr/$q/i }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 2 | my @found = grep /$re/, @characters; | |||||||||
| 35 | 2 | ▶ | wantarray ? @found : $found[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | unless ( $ENV{MITE_COMPILE} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 1 | $_->init( __PACKAGE__ ) for __PACKAGE__->instance_modules; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 1 | 1; | |||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||