| 1 | #!/usr/local/bin/perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use 5.10.1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use IRC::Indexer::Conf; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | my($cftype, $outpath, $show); | |||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | GetOptions( | ||||||||||||||||||||||||||||
| 12 | 1 | ▶ | help => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | print( | |||||||||||||||||||||||||||
| 14 | "ircindexer-examplecf\n", | ||||||||||||||||||||||||||||
| 15 | " Write example configuration files.\n\n", | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | " -s, --show\n", | ||||||||||||||||||||||||||||
| 18 | " Display, rather than write, the example config.\n\n", | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | " -o, --output=PATH\n", | ||||||||||||||||||||||||||||
| 21 | " Path to the destination to write.\n\n", | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | " -t, --type=TYPE\n", | ||||||||||||||||||||||||||||
| 24 | " Type of config to output.\n", | ||||||||||||||||||||||||||||
| 25 | " One of: httpd, spec\n\n", | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||
| 28 | 1 | exit 0 | |||||||||||||||||||||||||||
| 29 | }, | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 3 | 'type|config=s' => \$cftype, | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 'output|file=s' => \$outpath, | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 'show!' => \$show, | ||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 2 | ▶ | $cftype = lc($cftype||''); | ||||||||||||||||||||||||||
|
Condition50%1/2
$cftype || ''
MC/DC0%0/1
$cftype || ''
$cftype
Truth table50%1/2
A
A= $cftype
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | die "Invalid --type\nShould be one of: httpd, spec\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cftype and $cftype ~~ ["httpd", "spec"]
MC/DC0%0/2
$cftype and $cftype ~~ ["httpd", "spec"]
$cftype
$cftype ~~ ["httpd", "spec"]
Truth table33%1/3
A and B
A= $cftypeB= $cftype ~~ ["httpd", "spec"]
| |||||||||||||||||||||||||||||
| 41 | unless $cftype and $cftype ~~ [qw/httpd spec/]; | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 2 | ▶ | if ($show) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 2 | print IRC::Indexer::Conf->get_example_cf($cftype); | |||||||||||||||||||||||||||
| 45 | 2 | exit 0 | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | die "No --output file specified\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | unless $outpath; | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | print "Writing: $outpath\n"; | |||||||||||||||||||||||||||
| 53 | 0 | IRC::Indexer::Conf->write_example_cf($cftype, $outpath); | |||||||||||||||||||||||||||
| 54 | 0 | exit 0 | |||||||||||||||||||||||||||