| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Test::Web::AssetLib::TestRole; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 5 |  |  | 5 |  | 16297660 | use Moose::Role; | 
|  | 5 |  |  |  |  | 292528 |  | 
|  | 5 |  |  |  |  | 45 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 5 |  |  | 5 |  | 18755 | use Log::Log4perl qw(:easy); | 
|  | 5 |  |  |  |  | 33323 |  | 
|  | 5 |  |  |  |  | 42 |  | 
| 6 | 5 |  |  | 5 |  | 6435 | use Env qw/LOG_TRACE/; | 
|  | 5 |  |  |  |  | 9824 |  | 
|  | 5 |  |  |  |  | 21 |  | 
| 7 | 5 |  |  | 5 |  | 1127 | use Data::Dump qw/dump/; | 
|  | 5 |  |  |  |  | 3937 |  | 
|  | 5 |  |  |  |  | 260 |  | 
| 8 | 5 |  |  | 5 |  | 457 | use Test::Most qw(-Test::Deep); | 
|  | 5 |  |  |  |  | 13127 |  | 
|  | 5 |  |  |  |  | 40 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 5 |  |  | 5 |  | 22454 | use v5.14; | 
|  | 5 |  |  |  |  | 14 |  | 
| 11 | 5 |  |  | 5 |  | 20 | no if $] >= 5.018, warnings => "experimental"; | 
|  | 5 |  |  |  |  | 6 |  | 
|  | 5 |  |  |  |  | 39 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 5 |  |  | 5 |  | 7830 | use Getopt::Std; | 
|  | 5 |  |  |  |  | 157 |  | 
|  | 5 |  |  |  |  | 238 |  | 
| 14 | 5 |  |  | 5 |  | 474 | use Method::Signatures; | 
|  | 5 |  |  |  |  | 41138 |  | 
|  | 5 |  |  |  |  | 45 |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | with 'Web::AssetLib::Role::Logger'; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | has 'testclass' => ( is => 'ro', isa => 'Str' ); | 
| 19 |  |  |  |  |  |  | has 'verbose'   => ( is => 'rw', isa => 'Bool' ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | # command line args/options | 
| 22 |  |  |  |  |  |  | has 'opts' => ( | 
| 23 |  |  |  |  |  |  | is      => 'rw', | 
| 24 |  |  |  |  |  |  | isa     => 'HashRef', | 
| 25 |  |  |  |  |  |  | default => sub { {} }, | 
| 26 |  |  |  |  |  |  | traits  => ['Hash'], | 
| 27 |  |  |  |  |  |  | handles => { | 
| 28 |  |  |  |  |  |  | get_opt => 'get', | 
| 29 |  |  |  |  |  |  | set_opt => 'set' | 
| 30 |  |  |  |  |  |  | }, | 
| 31 |  |  |  |  |  |  | ); | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub BUILD { | 
| 34 | 4 |  |  | 4 | 0 | 4023 | my $self = shift; | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 4 |  |  |  |  | 7 | my %opts; | 
| 37 | 4 |  |  |  |  | 24 | getopts( 'l', \%opts ); | 
| 38 | 4 |  |  |  |  | 179 | $self->opts( \%opts ); | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 4 |  |  |  |  | 25 | say "opts: " . dump \%opts; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub main { | 
| 44 | 4 |  |  | 4 | 0 | 716 | my $self = shift; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | # log level | 
| 47 | 4 |  |  |  |  | 12 | my $LOG_LEVEL = $ERROR; | 
| 48 | 4 | 50 |  |  |  | 135 | if ( defined $self->get_opt('l') ) { | 
| 49 | 0 |  |  |  |  | 0 | for ( lc( $self->get_opt('l') ) ) { | 
| 50 | 0 |  |  |  |  | 0 | when ('debug') { | 
| 51 | 0 |  |  |  |  | 0 | $LOG_LEVEL = $DEBUG; | 
| 52 | 0 |  |  |  |  | 0 | $self->verbose(1); | 
| 53 |  |  |  |  |  |  | } | 
| 54 | 0 |  |  |  |  | 0 | when ('info') { | 
| 55 | 0 |  |  |  |  | 0 | $LOG_LEVEL = $INFO; | 
| 56 |  |  |  |  |  |  | } | 
| 57 | 0 |  |  |  |  | 0 | when ('warn') { | 
| 58 | 0 |  |  |  |  | 0 | $LOG_LEVEL = $WARN; | 
| 59 |  |  |  |  |  |  | } | 
| 60 | 0 |  |  |  |  | 0 | when ('error') { | 
| 61 | 0 |  |  |  |  | 0 | $LOG_LEVEL = $ERROR; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  | } ## end if ( defined $opt->{l}) | 
| 65 | 4 | 50 |  |  |  | 31 | $LOG_LEVEL = $TRACE if ($LOG_TRACE); | 
| 66 |  |  |  |  |  |  |  | 
| 67 | 4 |  |  |  |  | 104 | Log::Log4perl->easy_init($LOG_LEVEL); | 
| 68 |  |  |  |  |  |  |  | 
| 69 | 4 | 50 |  |  |  | 9726 | use_ok( $self->testclass ) | 
| 70 |  |  |  |  |  |  | if ( $self->testclass ); | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 4 |  |  |  |  | 21 | $self->do_tests(); | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | 1; | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | __END__ | 
| 78 |  |  |  |  |  |  |  |