bin/linksite

filter: Statementstmt 73.3% 22 / 30 Branchbran 33.3% 4 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 62.2% 33 / 53 CC 1 SCAR 0.0
CC
1
Cov
60%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/App/LinkSite/Site.pm ↑ Summary t/file-parameter.t »
1 #!/usr/bin/env perl
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use feature 'say';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 8 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 ▶use App::LinkSite;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 my %opt;
13 3 ▶GetOptions(\%opt, 'help', 'version', 'file=s') or exit 2;
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions(\%opt, "help", "version", "file=s") or exit 2 3 0 3
14  
15 3 ▶if ($opt{help} || $opt{version}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{"help"} or $opt{"version"}) 0 3 3
Condition33%1/3
$opt{"help"} or $opt{"version"}
l!l&&r!l&&!r
003
MC/DC0%0/2
$opt{"help"} or $opt{"version"}
$opt{"help"} $opt{"version"}
Truth table33%1/3
A or B
A= $opt{"help"}B= $opt{"version"}
ABresult
1X1
011
000
16 0 my $me = basename $0;
17 0 ▶ if ($opt{version}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{"version"}) 0 0 0
18 0 say "$me $App::LinkSite::VERSION";
19 0 ▶ say '' if $opt{help};
Branch: 1 branch
BranchTrueFalseTotal
if $opt{"help"} 0 0 0
20 }
21  
22 0 ▶ if ($opt{help}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{"help"}) 0 0 0
23 0 say "Usage: $me [--file <filename>] [--help] [--version]";
24 0 say "\nCreate a link site from a simple input file. See 'man $me' for details";
25 }
26  
27 0 exit;
28 }
29  
30 3 ▶App::LinkSite->new(exists $opt{file} ? (file => $opt{file}) : ())->run;
Branch: 1 branch
BranchTrueFalseTotal
exists $opt{'file'} ? : 2 1 3
31  
32 =head1 linksite
33  
34 Create a link site from a simple input file.
35  
36 This program parses a JSON file (called C<links.json> by default) and turns the data
37 into a link site (a bit like LinkTree).
38  
39 =head1 SYNOPSIS
40  
41 linksite [--file <filename>] [--help] [--version]
42  
43 =head1 OPTIONS
44  
45 =over 4
46  
47 =item --file <filename>
48  
49 Specify the path to the JSON file containing link data. Defaults to C<links.json>.
50  
51 =item --help
52  
53 Display usage information.
54  
55 =item --version
56  
57 Display the version number.
58  
59 =back
60  
61 =head1 EXIT STATUS
62  
63 Returns zero after a successful build or an informational option. Invalid
64 options, including C<--file> without a filename, return status 2 without building.
65 Input or build failures return a non-zero status.
66  
67 For more information see L<https://linksite.davecross.co.uk/>.
68  
69 =cut
« lib/App/LinkSite/Site.pm ↑ Summary t/file-parameter.t »