blib/lib/ExtUtils/XSpp/Node/Destructor.pm

filter: Statementstmt 100% 18 / 18 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 96.7% 30 / 31 CC 3 SCAR 4.1
CC
3
Cov
95%
init
2.0
perl_function_name
2.0
BEGIN
1.0
CRAP 1.5
« blib/lib/ExtUtils/XSpp/Node/Raw.pm ↑ Summary blib/lib/ExtUtils/XSpp/Node/Method.pm »
1 package ExtUtils::XSpp::Node::Destructor;
2 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 21 ▶use base 'ExtUtils::XSpp::Node::Method';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 ExtUtils::XSpp::Node::Destructor - Node representing a destructor method
9  
10 =head1 DESCRIPTION
11  
12 An L<ExtUtils::XSpp::Node::Method> subclass representing a
13 destructor such as:
14  
15 class FooBar {
16 ~FooBar(); // <-- this one
17 };
18  
19 =head1 METHODS
20  
21 =head2 new
22  
23 Creates a new C<ExtUtils::XSpp::Node::Destructor>.
24  
25 Most of the functionality of this class is inherited. This
26 means that all named parameters of L<ExtUtils::XSpp::Node::Method>
27 and its base class are also valid for this class' destructor.
28  
29 Additionally, this class requires that no return type has
30 been specified as destructors do not have return types.
31  
32 =cut
33  
34 3 ▶sub init {
Subroutine init: called CC=2 SCAR=7.1
Pod documented
35 3 my $this = shift;
36 3 $this->SUPER::init( @_ );
37  
38 3 ▶ die "Can't specify return value in destructor" if $this->{RET_TYPE};
Branch: 1 branch
BranchTrueFalseTotal
if $this->{"RET_TYPE"} 0 3 3
39 }
40  
41 =head2 perl_function_name
42  
43 Returns the name of the class with C<::DESTROY> appended.
44  
45 =cut
46  
47 3 ▶sub perl_function_name {
Subroutine perl_function_name: called CC=2 SCAR=6.9
Pod documented
48 3 my $this = shift;
49  
50 3 ▶ if( $this->perl_name ne $this->cpp_name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($this->perl_name ne $this->cpp_name) { } 1 2 3
51 1 return $this->class->cpp_name . '::' . $this->perl_name;
52 } else {
53 2 return $this->class->cpp_name . '::' . 'DESTROY';
54 }
55 }
56  
57 6 ▶sub ret_type { undef }
Subroutine ret_type: called CC=1 SCAR=0.0
Pod documented
58  
59 21 1;
« blib/lib/ExtUtils/XSpp/Node/Raw.pm ↑ Summary blib/lib/ExtUtils/XSpp/Node/Method.pm »