script/RRTYPEgen

filter: Statementstmt 90.4% 19 / 21 Branchbran 62.5% 5 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 75.0% 27 / 36 SCAR 0.1
CC
1
Cov
78%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Net/DNS/Extlang/Nsechelp.pm ↑ Summary
1 #!/usr/local/bin/perl
2  
3 2 our $VERSION = '0.1';
4  
5 =head1 NAME
6  
7 RRTYPEgen - Generate Net::DNS RR subtype packages
8  
9 =head1 SYNOPSIS
10  
11 RRTYPEgen RRTYPE=<version> <name>:<number <attribute> ...
12  
13 =head1 DESCRIPTION
14  
15 B<RRTYPEgen> builds a perl Net::DNS RR subtype implementation package
16 from the DNS extension language specification using the code generator
17 in Net::DNS::Extlang. It prints the generated
18 code to stdout.
19  
20 If called with no arguments, it prints "1;\n" for success, which is how
21 Net::DNS tests that RRTYPEgen has been installed.
22  
23 =cut
24  
25 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 # see what we think of the arguments
29 2 my ( $tag, $identity, @attribute ) = @ARGV;
30  
31 2 ▶unless($tag) { # for probe in Parameters.pm
Branch: 1 branch
BranchTrueFalseTotal
unless ($tag) 1 1 2
32 1 print "1;\n";
33 1 exit;
34 }
35  
36 1 ▶exit 1 unless defined($tag) && $tag =~ /^RRTYPE=\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $tag and $tag =~ /^RRTYPE=\d+$/ 0 1 1
Condition33%1/3
defined $tag and $tag =~ /^RRTYPE=\d+$/
!ll&&!rl&&r
001
MC/DC0%0/2
defined $tag and $tag =~ /^RRTYPE=\d+$/
defined $tag $tag =~ /^RRTYPE=\d+$/
Truth table33%1/3
A and B
A= defined $tagB= $tag =~ /^RRTYPE=\d+$/
ABresult
0X0
100
111
37  
38 # include now to avoid startup recursion
39 1 ▶eval("require Net::DNS::Extlang") or die "Cannot load Net::DNS::Extlang from\n" . join("\n ",@INC);
Branch: 1 branch
BranchTrueFalseTotal
eval "require Net::DNS::Extlang" or die "Cannot load Net::DNS::Extlang from\n" . join("\n ", @INC) 0 1 1
40  
41 1 my $ext = new Net::DNS::Extlang(domain => 'invalid');
42  
43 1 my $rrr = $ext->_xlstorerecord($identity, @attribute);
44  
45 1 my $code = $ext->compilerr($rrr);
46  
47 1 ▶if ($code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code) 1 0 1
48 1 print $code;
49 1 exit 0;
50 }
51 0 print "0; # compile failed\n";
52 0 exit 1;
53  
54 =head1 COPYRIGHT
55  
56 Copyright 2017 John R. Levine.
57  
58 =head1 LICENSE
59  
60 Permission to use, copy, modify, and distribute this software and its
61 documentation for any purpose and without fee is hereby granted, provided
62 that the above copyright notice appear in all copies and that both that
63 copyright notice and this permission notice appear in supporting
64 documentation, and that the name of the author not be used in advertising
65 or publicity pertaining to distribution of the software without specific
66 prior written permission.
67  
68 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
71 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
73 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
74 DEALINGS IN THE SOFTWARE.
75  
76  
77 =head1 SEE ALSO
78  
79 L<perl>, L<Net::DNS:RR>, L<Net::DNS::Parameters>, L<Net::DNS::Extlang>
80  
81 =cut
« lib/Net/DNS/Extlang/Nsechelp.pm ↑ Summary