license_syntax.pl untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 74 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #! /usr/bin/perl
2 #
3  
4 use Getopt::Long qw(:config no_ignore_case);
5 use Pod::Usage;
6 use FindBin;
7 use lib "$FindBin::RealBin/blib/lib";
8 use License::Syntax;
9 my $version = $License::Syntax::VERSION;
10 use Data::Dumper;
11  
12 my $verbose = 1;
13 my $help = 0;
14 my $list_only = 0;
15 my $mapfile = "$FindBin::RealBin/synopsis.csv;lauaas#c";
16  
17 GetOptions(
18 "verbose|v+" => \$verbose,
19 "version|V" => sub { print "$version\n"; exit },
20 "help|?" => \$help,
21 "list|l+" => \$list_only,
22 "mapfile|m=s" => \$mapfile,
23 "quiet" => sub { $verbose = 0; },
24 ) or $help++;
25  
26 my $input = shift or $list_only or $help++;
27  
28 pod2usage(-verbose => 1, -msg => qq{
29 license_syntax V$version Usage:
30  
31 $0 [options] "GPL-3 or MPL-1"
32 $0 [options] --list
33  
34 Valid options are:
35 -v Be more verbose. Default: $verbose.
36 -q Be quiet, not verbose.
37  
38 -m --mapfile license_map.csv
39 CSV-File of the mapping table. Default: $mapfile .
40  
41 -h --help -?
42 Print this online help.
43  
44 -l --list
45 Overview of all known licenses.
46 }) if $help;
47  
48 my $obj = new License::Syntax licensemap => $mapfile;
49  
50 if ($list_only)
51 {
52 print Dumper $obj->{licensemap}{cc};
53 exit 0;
54 }
55  
56 print "Analyzing '$input' ...\n" if $verbose;
57 my $tree = $obj->tokenize($input, 1);
58 print Dumper $tree if $verbose > 1;
59 my $name = $obj->format_tokens($tree);
60 print Dumper $obj->{diagnostics} if $verbose >= 1 and $obj->{diagnostics};
61  
62 print "canonical output: $name\n";