| 1 | package ExtUtils::XSpp::Node::Raw; | ||||||||||
| 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'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | =head1 NAME | ||||||||||
| 7 | |||||||||||
| 8 | ExtUtils::XSpp::Node::Raw - Node for data that should be included in XS verbatim | ||||||||||
| 9 | |||||||||||
| 10 | =head1 DESCRIPTION | ||||||||||
| 11 | |||||||||||
| 12 | An L<ExtUtils::XSpp::Node> subclass representing code that should be included | ||||||||||
| 13 | in the output XS code verbatim. | ||||||||||
| 14 | |||||||||||
| 15 | =head1 METHODS | ||||||||||
| 16 | |||||||||||
| 17 | =head2 new | ||||||||||
| 18 | |||||||||||
| 19 | Creates a new C<ExtUtils::XSpp::Node::Raw>. | ||||||||||
| 20 | |||||||||||
| 21 | Named parameters: C<rows> should be a reference to | ||||||||||
| 22 | an array of source code lines. A trailing newline | ||||||||||
| 23 | is automatically appended. | ||||||||||
| 24 | |||||||||||
| 25 | =cut | ||||||||||
| 26 | |||||||||||
| 27 | 52 | ▶ | sub init { | ||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 52 | my $this = shift; | |||||||||
| 29 | 52 | my %args = @_; | |||||||||
| 30 | |||||||||||
| 31 | 52 | $this->{ROWS} = $args{rows}; | |||||||||
| 32 | 52 | $this->{EMIT_CONDITION} = $args{emit_condition}; | |||||||||
| 33 | 52 | push @{$this->{ROWS}}, "\n"; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | =head1 ACCESSORS | ||||||||||
| 37 | |||||||||||
| 38 | =head2 rows | ||||||||||
| 39 | |||||||||||
| 40 | Returns an array reference holding the rows to be output in the final file. | ||||||||||
| 41 | |||||||||||
| 42 | =cut | ||||||||||
| 43 | |||||||||||
| 44 | 51 | ▶ | sub rows { $_[0]->{ROWS} } | ||||||||
|
Subroutine
rows: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 45 | |||||||||||
| 46 | 29 | ▶ | sub print { | ||||||||
|
Subroutine
print: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 47 | 29 | my $this = shift; | |||||||||
| 48 | 29 | my $state = shift; | |||||||||
| 49 | 29 | my $out = ''; | |||||||||
| 50 | |||||||||||
| 51 | 29 | ▶ | $out .= '#if ' . $this->emit_condition . "\n" if $this->emit_condition; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 29 | $out .= join( "\n", @{$this->rows} ) . "\n"; | |||||||||
| 53 | 29 | ▶ | $out .= '#endif // ' . $this->emit_condition . "\n" if $this->emit_condition; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | |||||||||||
| 55 | 29 | return $out; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 21 | 1; | |||||||||