RST/Base.pm

filter: Statementstmt 45.4% 10 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 60.0% 3 / 5 totaltotal 43.2% 16 / 37 CC 2 SCAR 9.4
CC
2
Cov
42%
new
6.0
id
2.0
order
2.0
CRAP 2.6
« RST/Graph.pm ↑ Summary RST/ChangeLog.pm »
1 package ICANN::RST::Base;
2 # ABSTRACT: base class for other things.
3 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use YAML::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub new {
8 0 ▶ my ($package, $id, $ref, $spec) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
9  
10 0 ▶ carp("No reference for '$id'") unless (defined($ref));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ref 0 0 0
11  
12 return bless(
13 {
14 0 %{$ref},
15 'id' => $id,
16 'spec' => $spec,
17 },
18 $package,
19 );
20 }
21  
22 0 ▶sub id { $_[0]->{'id'} }
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
23 0 ▶sub order { int($_[0]->{'Order'}) }
Subroutine order: not called CC=1 SCAR=6.9
Pod documented
24 0 ▶sub spec { $_[0]->{'spec'} }
Subroutine spec: not called CC=1 SCAR=6.9
Pod documented
25  
26 sub dump {
27 0 ▶ my $self = shift;
Subroutine dump: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my %hash = %{$self};
29 0 delete($hash{'spec'});
30 0 return YAML::XS::Dump(\%hash);
31 }
32  
33 1 1;
34  
35 __END__
36  
37 =pod
38  
39 =encoding UTF-8
40  
41 =head1 NAME
42  
43 ICANN::RST::Base - base class for other things.
44  
45 =head1 VERSION
46  
47 version 0.03
48  
49 =head1 METHODS
50  
51 =head2 id()
52  
53 Returns a string containing the unique ID of the thing.
54  
55 =head2 order()
56  
57 Returns an integer representing the position of the thing among its siblings.
58  
59 =head2 spec()
60  
61 Returns a reference to the enclosing L<ICANN::RST::Spec> object.
62  
63 =head1 AUTHOR
64  
65 Gavin Brown <gavin.brown@icann.org>
66  
67 =head1 COPYRIGHT AND LICENSE
68  
69 This software is copyright (c) 2025 by Internet Corporation for Assigned Names and Number (ICANN).
70  
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73  
74 =cut
« RST/Graph.pm ↑ Summary RST/ChangeLog.pm »