| 1 | package cli; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Getopt::Long qw(:config pass_through); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Pod::Usage; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub provide_help { | ||||||||||
| 9 | 1 | ▶ | my $man = 0; | ||||||||
|
Subroutine
provide_help: called CC=3 SCAR=11.3
| |||||||||||
| 10 | 1 | my $help = 0; | |||||||||
| 11 | 1 | GetOptions('help|?' => \$help, 'man' => \$man); | |||||||||
| 12 | |||||||||||
| 13 | # for --help option, show basic usage info and exit | ||||||||||
| 14 | 1 | ▶ | pod2usage(-verbose => 1, -exitstatus => 0) if $help; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | |||||||||||
| 16 | # for --man option, show the full POD documentation and exit | ||||||||||
| 17 | 1 | ▶ | pod2usage(-verbose => 2, -exitstatus => 0, -noperldoc => 1) if $man; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | sub error { | ||||||||||
| 21 | 0 | ▶ | my ($message, $exitstatus) = @_; | ||||||||
|
Subroutine
error: not called CC=2 SCAR=17.9
| |||||||||||
| 22 | 0 | ▶ | $exitstatus = 1 unless defined $exitstatus; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | # show message+synopsis and exit | ||||||||||
| 24 | 0 | pod2usage(-message => $message."\n", -verbose => 0, -exitstatus => $exitstatus); | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 1 | provide_help; | |||||||||
| 28 | |||||||||||
| 29 | 1 | 1; | |||||||||