blib/lib/App/Angle2Zodiac.pm

filter: Statementstmt 53.1% 17 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 71.4% 5 / 7 Podpod 100% 2 / 2 totaltotal 44.4% 24 / 54 CC 5 SCAR 26.6
CC
5
Cov
40%
run
30.0
new
2.0
BEGIN
1.0
CRAP 14.3
↑ Summary
1 package App::Angle2Zodiac;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Getopt::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Unicode::UTF8 qw(encode_utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Zodiac::Angle;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = 0.01;
11  
12 # Constructor.
13 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
14 0 my ($class, @params) = @_;
15  
16 # Create object.
17 0 my $self = bless {}, $class;
18  
19 # Object.
20 0 return $self;
21 }
22  
23 # Run.
24 0 ▶sub run {
Subroutine run: not called CC=5 SCAR=34.0
Pod documented
25 0 my $self = shift;
26  
27 # Process arguments.
28 0 $self->{'_opts'} = {
29 'a' => 0,
30 'h' => 0,
31 };
32 0 ▶ if (! getopts('ah', $self->{'_opts'}) || @ARGV < 1
Branch: 1 branch
BranchTrueFalseTotal
if (not &getopts("ah", $self->{"_opts"}) or @ARGV < 1 or $self->{"_opts"}{"h"}) 0 0 0
Condition0%0/6
not &getopts("ah", $self->{"_opts"}) or @ARGV < 1 or $self->{"_opts"}{"h"}
l!l&&r!l&&!r
000
not &getopts("ah", $self->{"_opts"}) or @ARGV < 1
l!l&&r!l&&!r
000
MC/DC0%0/3
not &getopts("ah", $self->{"_opts"}) or @ARGV < 1 or $self->{"_opts"}{"h"}
not &getopts("ah", $self->{"_opts"}) @ARGV < 1 $self->{"_opts"}{"h"}
Truth table0%0/4
not(A) or B or C
A= not &getopts("ah", $self->{"_opts"})B= @ARGV < 1C= $self->{"_opts"}{"h"}
ABCresult
1XX1
01X1
0011
0000
33 || $self->{'_opts'}->{'h'}) {
34  
35 0 print STDERR "Usage: $0 [-a] [-h] [--version] angle\n";
36 0 print STDERR "\t-a\tOutput will be in ascii form ".
37 "(e.g. 2 sc 31'28.9560'').\n";
38 0 print STDERR "\t-h\t\tHelp.\n";
39 0 print STDERR "\t--version\tPrint version.\n";
40 0 print STDERR "\tangle\tAngle in numeric (e.g. 212.5247100).\n";
41 0 return 1;
42 }
43 0 $self->{'_angle'} = shift @ARGV;
44  
45 print encode_utf8(Zodiac::Angle->new->angle2zodiac($self->{'_angle'}, {
46 'second' => 1,
47 0 ▶ $self->{'_opts'}->{'a'} ? (
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_opts'}{'a'} ? : 0 0 0
48 'sign_type' => 'ascii',
49 ) : (),
50 }))."\n";
51  
52 0 return 0;
53 }
54  
55 2 1;
56  
57  
58 __END__
↑ Summary