| 1 | # $Id: Inline.pm,v 2.3 2007-01-02 22:03:22 pajas Exp $ | ||
| 2 | |||
| 3 | package XML::XSH2::Inline; | ||
| 4 | |||
| 5 | use vars qw($VERSION $terminator); | ||
| 6 | |||
| 7 | use strict; | ||
| 8 | use XML::XSH2 qw(xsh_init); | ||
| 9 | $VERSION='2.2.10'; # VERSION TEMPLATE | ||
| 10 | $terminator = undef; | ||
| 11 | |||
| 12 | use Filter::Simple; | ||
| 13 | |||
| 14 | sub filter { | ||
| 15 | my $t=defined($terminator) ? $terminator : '__END__'; | ||
| 16 | s/$terminator\s*$// if defined($terminator); | ||
| 17 | $_="XML::XSH2::xsh(<<'$t');\n".$_."$t\n"; | ||
| 18 | $_; | ||
| 19 | }; | ||
| 20 | |||
| 21 | xsh_init(); | ||
| 22 | |||
| 23 | FILTER(\&filter); | ||
| 24 | |||
| 25 | 1; | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | XML::XSH2::Inline - Insert XSH commands directly into your Perl scripts | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | # perl code | ||
| 34 | |||
| 35 | use XML::XSH2::Inline; | ||
| 36 | |||
| 37 | # XSH Language commands (see L<XSH>) | ||
| 38 | |||
| 39 | no XML::XSH2::Inline; | ||
| 40 | |||
| 41 | # perl code | ||
| 42 | |||
| 43 | =head1 REQUIRES | ||
| 44 | |||
| 45 | Filter::Simple, XML::XSH2 | ||
| 46 | |||
| 47 | =head1 EXPORTS | ||
| 48 | |||
| 49 | None. | ||
| 50 | |||
| 51 | =head1 AUTHOR | ||
| 52 | |||
| 53 | Petr Pajas, pajas@matfyz.cz | ||
| 54 | |||
| 55 | =head1 SEE ALSO | ||
| 56 | |||
| 57 | L<xsh>, L<XSH>, L<XML::XSH2> | ||
| 58 | |||
| 59 | =cut | ||
| 60 |