| 1 | package ExtUtils::XSpp::Node; | ||||||||||
| 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 Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | =head1 NAME | ||||||||||
| 7 | |||||||||||
| 8 | ExtUtils::XSpp::Node - Base class for elements of the parser output | ||||||||||
| 9 | |||||||||||
| 10 | =head1 DESCRIPTION | ||||||||||
| 11 | |||||||||||
| 12 | ExtUtils::XSpp::Node is a base class for all elements of the | ||||||||||
| 13 | parser's output. | ||||||||||
| 14 | |||||||||||
| 15 | =head1 METHODS | ||||||||||
| 16 | |||||||||||
| 17 | =head2 new | ||||||||||
| 18 | |||||||||||
| 19 | Calls the C<$self->init(@_)> method after construction. | ||||||||||
| 20 | Override C<init()> in subclasses. | ||||||||||
| 21 | |||||||||||
| 22 | =cut | ||||||||||
| 23 | |||||||||||
| 24 | 3966 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 25 | 3966 | my $class = shift; | |||||||||
| 26 | 3966 | my $this = bless {}, $class; | |||||||||
| 27 | |||||||||||
| 28 | 3966 | $this->init( @_ ); | |||||||||
| 29 | |||||||||||
| 30 | 3966 | return $this; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | =head2 init | ||||||||||
| 34 | |||||||||||
| 35 | Called by the constructor. Every sub-class needs to override this. | ||||||||||
| 36 | |||||||||||
| 37 | =cut | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 40 | 0 | Carp::croak( | |||||||||
| 41 | "Programmer was too lazy to implement init() in her Node sub-class" | ||||||||||
| 42 | ); | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | =head2 ExtUtils::XSpp::Node::print | ||||||||||
| 46 | |||||||||||
| 47 | Return a string to be output in the final XS file. | ||||||||||
| 48 | Every sub-class must override this method. | ||||||||||
| 49 | |||||||||||
| 50 | =cut | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub print { | ||||||||
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | 0 | Carp::croak( | |||||||||
| 54 | "Programmer was too lazy to implement print() in her Node sub-class" | ||||||||||
| 55 | ); | ||||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 30 | ▶ | sub condition { $_[0]->{CONDITION} } | ||||||||
|
Subroutine
condition: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub condition_expression { | ||||||||
|
Subroutine
condition_expression: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 61 | 0 | my $this = shift; | |||||||||
| 62 | |||||||||||
| 63 | 0 | ▶ | return $this->emit_condition if $this->emit_condition; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 0 | ▶ | return 'defined( ' . $this->condition . ' )' if $this->condition; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 0 | return '1'; | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 394 | ▶ | sub emit_condition { $_[0]->{EMIT_CONDITION} } | ||||||||
|
Subroutine
emit_condition: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 69 | |||||||||||
| 70 | 21 | 1; | |||||||||