| 1 | package Astro::App::Satpass2::ParseTime::Code; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | 2 | ▶ | use 5.008; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 7 | |||||||||||||||||||
| 8 | 2 | ▶ | use parent qw{ Astro::App::Satpass2::ParseTime }; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | |||||||||||||||||||
| 10 | 2 | ▶ | use Astro::App::Satpass2::Utils qw{ CODE_REF HASH_REF @CARP_NOT }; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | 2 | our $VERSION = '0.059'; | |||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | 2 | ▶ | use constant DUMMY => 'DUMMY'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 15 | |||||||||||||||||||
| 16 | # __arguments() is normally called as a subroutine, but it needs access | ||||||||||||||||||
| 17 | # to this namespace to figure out the options, so we just load this | ||||||||||||||||||
| 18 | # module and then call __arguments() as a static method. | ||||||||||||||||||
| 19 | 2 | require Astro::App::Satpass2; | |||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | 1 | ▶ | sub attribute_names { | ||||||||||||||||
|
Subroutine
attribute_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 22 | 1 | my ( $self ) = @_; | |||||||||||||||||
| 23 | 1 | return ( $self->SUPER::attribute_names(), qw{ code } ); | |||||||||||||||||
| 24 | } | ||||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | 0 | ▶ | sub class_name_of_record { | ||||||||||||||||
|
Subroutine
class_name_of_record: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 27 | 0 | my ( $self ) = @_; | |||||||||||||||||
| 28 | 0 | my $code = $self->code(); | |||||||||||||||||
| 29 | 0 | ▶ | ref $code | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 30 | and $code = DUMMY; | ||||||||||||||||||
| 31 | 0 | return $code; | |||||||||||||||||
| 32 | } | ||||||||||||||||||
| 33 | |||||||||||||||||||
| 34 | 1 | ▶ | sub code { | ||||||||||||||||
|
Subroutine
code: called CC=8 SCAR=30.1
Pod
documented
| |||||||||||||||||||
| 35 | 1 | my ( $self, @args ) = @_; | |||||||||||||||||
| 36 | 1 | ▶ | if ( @args ) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 37 | 1 | my ( $val, $name ) = @args; | |||||||||||||||||
| 38 | 1 | ▶ | if ( my $ref = ref $val ) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 39 | 1 | ▶ | if ( CODE_REF eq $ref ) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 40 | 1 | ▶ | defined $name | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 41 | or $name = $val; | ||||||||||||||||||
| 42 | 1 | return $self->_code_storage( $name, $val ); | |||||||||||||||||
| 43 | } | ||||||||||||||||||
| 44 | } elsif ( $val =~ m/ ( .* ) :: ( .* ) /smx ) { | ||||||||||||||||||
| 45 | 0 | ▶ | if ( my $code = $1->can( $2 ) ) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 46 | 0 | return $self->_code_storage( $val, $code ); | |||||||||||||||||
| 47 | } | ||||||||||||||||||
| 48 | } elsif ( my $code = caller->can( $val ) ) { | ||||||||||||||||||
| 49 | 0 | return $self->_code_storage( $val, $code ); | |||||||||||||||||
| 50 | } | ||||||||||||||||||
| 51 | $self->wail( | ||||||||||||||||||
| 52 | 0 | 'Code attribute must be a CODE ref or a subroutine name' ); | |||||||||||||||||
| 53 | } | ||||||||||||||||||
| 54 | 0 | return $self->_attr()->{code}; | |||||||||||||||||
| 55 | } | ||||||||||||||||||
| 56 | |||||||||||||||||||
| 57 | 3 | ▶ | sub delegate { | ||||||||||||||||
|
Subroutine
delegate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 58 | 3 | return __PACKAGE__; | |||||||||||||||||
| 59 | } | ||||||||||||||||||
| 60 | |||||||||||||||||||
| 61 | 18 | ▶ | sub parse_time_absolute { | ||||||||||||||||
|
Subroutine
parse_time_absolute: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 62 | 18 | my ( $self, $string ) = @_; | |||||||||||||||||
| 63 | 18 | return $self->_call_code( parse => $string ); | |||||||||||||||||
| 64 | } | ||||||||||||||||||
| 65 | |||||||||||||||||||
| 66 | 0 | ▶ | sub tz { | ||||||||||||||||
|
Subroutine
tz: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 67 | 0 | my ( $self, @args ) = @_; | |||||||||||||||||
| 68 | @args | ||||||||||||||||||
| 69 | 0 | ▶ | and $self->_call_code( tz => $args[0] ); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 70 | 0 | return $self->SUPER::tz( @args ); | |||||||||||||||||
| 71 | } | ||||||||||||||||||
| 72 | |||||||||||||||||||
| 73 | 0 | ▶ | sub use_perltime { | ||||||||||||||||
|
Subroutine
use_perltime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 74 | 0 | my ( $self ) = @_; | |||||||||||||||||
| 75 | 0 | return $self->_call_code( 'use_perltime' ); | |||||||||||||||||
| 76 | } | ||||||||||||||||||
| 77 | |||||||||||||||||||
| 78 | 19 | ▶ | sub _attr { | ||||||||||||||||
|
Subroutine
_attr: called CC=2 SCAR=6.9
| |||||||||||||||||||
| 79 | 19 | my ( $self ) = @_; | |||||||||||||||||
| 80 | 19 | my $pkg = __PACKAGE__; | |||||||||||||||||
| 81 | 19 | ▶ | return $self->{$pkg} ||= {}; | ||||||||||||||||
|
Condition100%2/2
$self->{$pkg} ||= {}
MC/DC100%1/1
$self->{$pkg} ||= {}
$self->{$pkg}
Truth table100%2/2
A
A= $self->{$pkg}
| |||||||||||||||||||
| 82 | } | ||||||||||||||||||
| 83 | |||||||||||||||||||
| 84 | 18 | ▶ | sub _call_code { | ||||||||||||||||
|
Subroutine
_call_code: called CC=2 SCAR=7.0
| |||||||||||||||||||
| 85 | 18 | my ( $self, @args ) = @_; | |||||||||||||||||
| 86 | 18 | ( undef, @args ) = Astro::App::Satpass2->__arguments( @args ); | |||||||||||||||||
| 87 | my $code = $self->_attr()->{_code} | ||||||||||||||||||
| 88 | 18 | ▶ | or $self->wail( 'No code specified' ); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 89 | 18 | return $code->( $self, @args ); | |||||||||||||||||
| 90 | } | ||||||||||||||||||
| 91 | |||||||||||||||||||
| 92 | 1 | ▶ | sub _code_storage { | ||||||||||||||||
|
Subroutine
_code_storage: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 93 | 1 | my ( $self, $name, $code ) = @_; | |||||||||||||||||
| 94 | 1 | my $attr = $self->_attr(); | |||||||||||||||||
| 95 | 1 | $attr->{code} = $name; | |||||||||||||||||
| 96 | 1 | $attr->{_code} = $code; | |||||||||||||||||
| 97 | 1 | return $self; | |||||||||||||||||
| 98 | } | ||||||||||||||||||
| 99 | |||||||||||||||||||
| 100 | 2 | 1; | |||||||||||||||||
| 101 | |||||||||||||||||||
| 102 | __END__ | ||||||||||||||||||