ExtUtils::XSpp::Node::Raw - Node for data that should be included in XS verbatim


ExtUtils-XSpp documentation Contained in the ExtUtils-XSpp distribution.

Index


Code Index:

NAME

Top

ExtUtils::XSpp::Node::Raw - Node for data that should be included in XS verbatim

DESCRIPTION

Top

An ExtUtils::XSpp::Node subclass representing code that should be included in the output XS code verbatim.

METHODS

Top

new

Creates a new ExtUtils::XSpp::Node::Raw.

Named parameters: rows should be a reference to an array of source code lines. A trailing newline is automatically appended.

ACCESSORS

Top

rows

Returns an array reference holding the rows to be output in the final file.


ExtUtils-XSpp documentation Contained in the ExtUtils-XSpp distribution.
package ExtUtils::XSpp::Node::Raw;
use strict;
use warnings;
use base 'ExtUtils::XSpp::Node';

sub init {
  my $this = shift;
  my %args = @_;

  $this->{ROWS} = $args{rows};
  $this->{EMIT_CONDITION} = $args{emit_condition};
  push @{$this->{ROWS}}, "\n";
}

sub rows { $_[0]->{ROWS} }

sub print {
  my $this  = shift;
  my $state = shift;
  my $out = '';

  $out .= '#if ' . $this->emit_condition . "\n" if $this->emit_condition;
  $out .= join( "\n", @{$this->rows} ) . "\n";
  $out .= '#endif // ' . $this->emit_condition . "\n" if $this->emit_condition;

  return $out;
}

1;