blib/lib/Astro/App/Satpass2/ParseTime/Date/Manip/v5.pm

filter: Statementstmt 46.3% 25 / 54 Branchbran 7.6% 2 / 26 Conditioncond 28.5% 2 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 6 / 12 Podpod 100% 5 / 5 totaltotal 37.0% 40 / 108 CC 16 SCAR 31.2
CC
16
Cov
33%
tz
56.0
perltime
30.0
parse_time_absolute
12.0
CRAP 22.6
« blib/lib/Astro/App/Satpass2.pm ↑ Summary blib/lib/Astro/App/Satpass2/ParseTime/Date/Manip/v6.pm »
1 package Astro::App::Satpass2::ParseTime::Date::Manip::v5;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Astro::Coord::ECI::Utils 0.112 qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 looks_like_number greg_time_local };
8  
9 1 ▶use parent qw{ Astro::App::Satpass2::ParseTime::Date::Manip };
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Astro::App::Satpass2::Utils qw{ load_package @CARP_NOT };
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our $VERSION = '0.059';
14  
15 1 my $invalid;
16  
17 1 ▶BEGIN {
Subroutine BEGIN: called CC=4 SCAR=17.1
18 1 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { local $Date::Manip::Backend = "DM5"; load_package("Date::Manip") or return; "Date::Manip"->import; 1 } } or $invalid = $@ || "Unable to load Date::Manip" 0 1 1
19 1 local $Date::Manip::Backend = 'DM5';
20  
21 1 ▶ load_package( 'Date::Manip' )
Branch: 1 branch
BranchTrueFalseTotal
load_package("Date::Manip") or return 0 1 1
22 or return;
23  
24 0 Date::Manip->import();
25 0 ▶ 1;
Condition50%1/2
$@ || 'Unable to load Date::Manip'
l!l
01
MC/DC0%0/1
$@ || 'Unable to load Date::Manip'
$@
Truth table50%1/2
A
A= $@
Aresult
11
00
26 } or $invalid = ( $@ || 'Unable to load Date::Manip' );
27 }
28  
29 # NOTE that on Windows under Perl 5.8.9 using Date::Manip 6.56, the
30 # Date_Init() call may not return a 'TZ=' entry, leaving $default_zone
31 # undef. I'm hoping this behaves more nicely.
32 1 my $default_zone = sprintf 'TZ=%s', do {
33 1 local $@ = undef;
34 1 ▶ eval {
Condition50%1/2
eval { do { Date_TimeZone() } } || ''
l!l
01
MC/DC0%0/1
eval { do { Date_TimeZone() } } || ''
eval { do { Date_TimeZone() } }
Truth table50%1/2
A
A= eval { do { Date_TimeZone() } }
Aresult
11
00
35 1 Date_TimeZone()
36 } || '';
37 };
38  
39 0 ▶sub delegate {
Subroutine delegate: not called CC=1 SCAR=6.9
Pod documented
40 0 return __PACKAGE__;
41 }
42  
43 0 ▶sub parse_time_absolute {
Subroutine parse_time_absolute: not called CC=3 SCAR=24.8
Pod documented
44 0 my ( $self, $string ) = @_;
45 0 ▶ $invalid and $self->wail( $invalid );
Branch: 1 branch
BranchTrueFalseTotal
$invalid and $self->wail($invalid) 0 0 0
46 0 my $time = UnixDate( $string, '%s' ) - $self->__epoch_offset();
47 0 ▶ if ( $self->perltime() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->perltime) 0 0 0
48 0 my @gt = gmtime $time;
49 0 $gt[5] += 1900;
50 0 $time = greg_time_local( @gt );
51 }
52 0 return $time;
53 }
54  
55 0 ▶sub perltime {
Subroutine perltime: not called CC=5 SCAR=34.0
Pod documented
56 0 my ( $self, @args ) = @_;
57 0 ▶ $invalid and $self->wail( $invalid );
Branch: 1 branch
BranchTrueFalseTotal
$invalid and $self->wail($invalid) 0 0 0
58 0 ▶ if ( @args ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
59 0 ▶ my $zone = $args[0] ? 'GMT' : $self->tz();
Branch: 1 branch
BranchTrueFalseTotal
$args[0] ? : 0 0 0
60 0 ▶ $zone = defined $zone ? "TZ=$zone" : $default_zone;
Branch: 1 branch
BranchTrueFalseTotal
defined $zone ? : 0 0 0
61 0 Date_Init( $zone );
62 }
63 0 return $self->SUPER::perltime( @args );
64 }
65  
66 0 ▶sub use_perltime {
Subroutine use_perltime: not called CC=1 SCAR=6.9
Pod documented
67 0 return 1;
68 }
69  
70 0 ▶sub tz {
Subroutine tz: not called CC=7 SCAR=40.3
Pod documented
71 0 my ( $self, @args ) = @_;
72 0 ▶ $invalid and $self->wail( $invalid );
Branch: 1 branch
BranchTrueFalseTotal
$invalid and $self->wail($invalid) 0 0 0
73 0 ▶ if ( @args ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
74 0 ▶ if ( $args[0] || looks_like_number( $args[0] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[0] or &looks_like_number($args[0])) { } 0 0 0
Condition0%0/3
$args[0] or &looks_like_number($args[0])
l!l&&r!l&&!r
000
MC/DC0%0/2
$args[0] or &looks_like_number($args[0])
$args[0] &looks_like_number($args[0])
Truth table0%0/3
A or B
A= $args[0]B= &looks_like_number($args[0])
ABresult
1X1
011
000
75 0 $ENV{TZ} = $args[0]; ## no critic (RequireLocalizedPunctuationVars)
76 0 ▶ $self->perltime() or Date_Init( "TZ=$args[0]" );
Branch: 1 branch
BranchTrueFalseTotal
$self->perltime or Date_Init("TZ=$args[0]") 0 0 0
77 } else {
78 0 delete $ENV{TZ};
79 0 ▶ $self->perltime() or Date_Init( $default_zone );
Branch: 1 branch
BranchTrueFalseTotal
$self->perltime or Date_Init($default_zone) 0 0 0
80 }
81 }
82 0 return $self->SUPER::tz( @args );
83 }
84  
85 0 ▶sub __set_back_end_location {
Subroutine __set_back_end_location: not called CC=1 SCAR=6.9
86 0 return;
87 };
88  
89 1 1;
90  
91 =head1 NAME
92  
93 Astro::App::Satpass2::ParseTime::Date::Manip::v5 - Astro::App::Satpass2 wrapper for Date::Manip v5 interface
94  
95 =head1 SYNOPSIS
96  
97 No user-serviceable parts inside.
98  
99 =head1 DETAILS
100  
101 This class wraps L<Date::Manip|Date::Manip> version 5.54 or lower and
102 the C<DM5> back-end for L<Date::Manip|Date::Manip> 6.0 and higher, and
103 uses it to parse dates. It uses the C<perltime> mechanism, since these
104 versions of L<Date::Manip|Date::Manip> do not understand summer time.
105  
106 =head1 METHODS
107  
108 This class supports no public methods over and above those documented in
109 its superclass
110 L<Astro::App::Satpass2::ParseTime|Astro::App::Satpass2::ParseTime>.
111  
112 =head1 SUPPORT
113  
114 Support is by the author. Please file bug reports at
115 L<https://github.com/trwyant/perl-Astro-App-Satpass2/issues> or in
116 electronic mail to the author.
117  
118 =head1 AUTHOR
119  
120 Thomas R. Wyant, III F<harryfmudd at comcast dot net>
121  
122 =head1 COPYRIGHT AND LICENSE
123  
124 Copyright (C) 2009-2026 by Thomas R. Wyant, III
125  
126 This program is free software; you can redistribute it and/or modify it
127 under the same terms as Perl 5.10.0. For more details, see the full text
128 of the licenses in the files F<LICENSE-Artistic> and F<LICENSE-GPL>.
129  
130 This program is distributed in the hope that it will be useful, but
131 without any warranty; without even the implied warranty of
132 merchantability or fitness for a particular purpose.
133  
134 =cut
135  
136 __END__
« blib/lib/Astro/App/Satpass2.pm ↑ Summary blib/lib/Astro/App/Satpass2/ParseTime/Date/Manip/v6.pm »