| 1 | # $Id: XSH.pm,v 1.1 2003/09/08 15:53:09 pajas Exp $ | ||
| 2 | |||
| 3 | package Inline::XSH; | ||
| 4 | |||
| 5 | use vars qw($VERSION $terminator); | ||
| 6 | |||
| 7 | use strict; | ||
| 8 | use XML::XSH qw(); | ||
| 9 | $VERSION = '0.1'; | ||
| 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::XSH::xsh(<<'$t');\n".$_."$t\n"; | ||
| 18 | $_; | ||
| 19 | }; | ||
| 20 | |||
| 21 | #sub import { | ||
| 22 | # if (@_>1) { | ||
| 23 | # $terminator = $_[1]; | ||
| 24 | # FILTER { filter() } $terminator; | ||
| 25 | # } | ||
| 26 | #} | ||
| 27 | |||
| 28 | FILTER(\&filter); | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | Inline::XSH - Insert XSH commands directly into your Perl scripts | ||
| 35 | |||
| 36 | =head1 SYNOPSIS | ||
| 37 | |||
| 38 | # perl code | ||
| 39 | |||
| 40 | use Inline::XSH; | ||
| 41 | |||
| 42 | # XSH Language commands (see L<XSH>) | ||
| 43 | |||
| 44 | no Inline::XSH; | ||
| 45 | |||
| 46 | # perl code | ||
| 47 | |||
| 48 | =head1 REQUIRES | ||
| 49 | |||
| 50 | Filter::Simple, XML::LibXML, XML::XUpdate::LibXML, XML::XSH | ||
| 51 | |||
| 52 | =head1 EXPORTS | ||
| 53 | |||
| 54 | None. | ||
| 55 | |||
| 56 | =head1 AUTHOR | ||
| 57 | |||
| 58 | Petr Pajas, pajas@matfyz.cz | ||
| 59 | |||
| 60 | =head1 SEE ALSO | ||
| 61 | |||
| 62 | L<xsh>, L<XSH>, L<XML::XSH> | ||
| 63 | |||
| 64 | =cut |