| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package ubic; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $ubic::VERSION = '1.59'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 51 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | # ABSTRACT: command-line frontend to ubic services | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 11 | ▶ | use Getopt::Long 2.33; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 11 | ▶ | use Pod::Usage; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use Ubic; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | ▶ | use Ubic::Cmd; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | return 1 if caller(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | unless (grep { $_ eq '/usr/local/bin' } split /:/, $ENV{PATH}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $ENV{PATH} = "/usr/local/bin:$ENV{PATH}"; | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $force; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | GetOptions( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 'f|force' => \$force, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ) or pod2usage(2); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not @ARGV or @ARGV == 1 and $ARGV[0] eq "help"
@ARGV == 1 and $ARGV[0] eq "help"
MC/DC0%0/3
not @ARGV or @ARGV == 1 and $ARGV[0] eq "help"
not @ARGV
@ARGV == 1
$ARGV[0] eq "help"
Truth table0%0/4
not(A) or B and C
A= not @ARGVB= @ARGV == 1C= $ARGV[0] eq "help"
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | not @ARGV | ||||||||||||||||||||||||||||||||||||||||||
| 28 | or @ARGV == 1 and $ARGV[0] eq 'help' | ||||||||||||||||||||||||||||||||||||||||||
| 29 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | pod2usage(2); | |||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $command = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if (@ARGV) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | Ubic::Cmd->run({ | |||||||||||||||||||||||||||||||||||||||||
| 36 | name => [@ARGV], | ||||||||||||||||||||||||||||||||||||||||||
| 37 | command => $command, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | force => $force, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | Ubic::Cmd->run({ | |||||||||||||||||||||||||||||||||||||||||
| 43 | name => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | command => $command, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | force => $force, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | __END__ | ||||||||||||||||||||||||||||||||||||||||||