XML::XSH2::Inline - Insert XSH commands directly into your Perl scripts


XML-XSH2 documentation Contained in the XML-XSH2 distribution.

Index


Code Index:

NAME

Top

XML::XSH2::Inline - Insert XSH commands directly into your Perl scripts

SYNOPSIS

Top

   # perl code

   use XML::XSH2::Inline;

   # XSH Language commands (see L<XSH>)

   no XML::XSH2::Inline;

   # perl code

REQUIRES

Top

Filter::Simple, XML::XSH2

EXPORTS

Top

None.

AUTHOR

Top

Petr Pajas, pajas@matfyz.cz

SEE ALSO

Top

xsh, XSH, XML::XSH2


XML-XSH2 documentation Contained in the XML-XSH2 distribution.

# $Id: Inline.pm,v 2.3 2007-01-02 22:03:22 pajas Exp $

package XML::XSH2::Inline;

use vars qw($VERSION $terminator);

use strict;
use XML::XSH2 qw(xsh_init);
  $VERSION='2.1.1'; # VERSION TEMPLATE
$terminator = undef;

use Filter::Simple;

sub filter {
  my $t=defined($terminator) ? $terminator : '__END__';
  s/$terminator\s*$// if defined($terminator);
  $_="XML::XSH2::xsh(<<'$t');\n".$_."$t\n";
  $_;
};

xsh_init();

FILTER(\&filter);

1;