| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Basename qw/basename/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use FindBin qw/$RealBin/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use lib "$RealBin/../lib"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use File::MagicPP qw/file $VERSION/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | local $0 = basename $0; | |||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub logmsg{local $0=basename $0; print STDERR "$0: @_\n";} | ||||||||||||||||||||||||||
|
Subroutine
logmsg: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 16 | 1 | exit(main()); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | sub main{ | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=6 SCAR=25.6
| |||||||||||||||||||||||||||||
| 19 | 1 | my $settings={}; | |||||||||||||||||||||||||||
| 20 | 1 | ▶ | GetOptions($settings,qw(help version)) or die $!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | if($$settings{version}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 0 | print basename($0)." v$VERSION\n"; | |||||||||||||||||||||||||||
| 23 | 0 | return 0; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | usage() if(!@ARGV || $$settings{help}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not @ARGV or $settings->{"help"}
MC/DC0%0/2
not @ARGV or $settings->{"help"}
not @ARGV
$settings->{"help"}
Truth table33%1/3
not(A) or B
A= not @ARGVB= $settings->{"help"}
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | for my $file(@ARGV){ | |||||||||||||||||||||||||||
| 29 | 0 | print file($file); | |||||||||||||||||||||||||||
| 30 | 0 | print "\n"; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | return 0; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 1 | ▶ | sub usage{ | ||||||||||||||||||||||||||
|
Subroutine
usage: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | 1 | print "$0: determines file type from magic | |||||||||||||||||||||||||||
| 38 | Usage: $0 [options] file | ||||||||||||||||||||||||||||
| 39 | --version Print version and exit | ||||||||||||||||||||||||||||
| 40 | --help This useful help menu | ||||||||||||||||||||||||||||
| 41 | \n"; | ||||||||||||||||||||||||||||
| 42 | 1 | exit 0; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||