| 1 |
<HTML> |
| 2 |
<HEAD> |
| 3 |
<TITLE>stag-handle</TITLE> |
| 4 |
<LINK REV="made" HREF="mailto:[email protected]"> |
| 5 |
</HEAD> |
| 6 |
|
| 7 |
<BODY> |
| 8 |
|
| 9 |
<A NAME="__index__"></A> |
| 10 |
<!-- INDEX BEGIN --> |
| 11 |
|
| 12 |
<UL> |
| 13 |
|
| 14 |
<LI><A HREF="#name">NAME</A></LI> |
| 15 |
<LI><A HREF="#synopsis">SYNOPSIS</A></LI> |
| 16 |
<LI><A HREF="#description">DESCRIPTION</A></LI> |
| 17 |
<LI><A HREF="#examples">EXAMPLES</A></LI> |
| 18 |
</UL> |
| 19 |
<!-- INDEX END --> |
| 20 |
|
| 21 |
<HR> |
| 22 |
<P> |
| 23 |
<H1><A NAME="name">NAME</A></H1> |
| 24 |
<P>stag-handle.pl - streams a stag file through a handler into a writer</P> |
| 25 |
<P> |
| 26 |
<HR> |
| 27 |
<H1><A NAME="synopsis">SYNOPSIS</A></H1> |
| 28 |
<PRE> |
| 29 |
stag-handle.pl -w itext -c my-handler.pl myfile.xml > processed.itext |
| 30 |
stag-handle.pl -w itext -p My::Parser -m My::Handler myfile.xml > processed.itext</PRE> |
| 31 |
<P> |
| 32 |
<HR> |
| 33 |
<H1><A NAME="description">DESCRIPTION</A></H1> |
| 34 |
<P>will take a Stag compatible format (xml, sxpr or itext), turn the data |
| 35 |
into an event stream passing it through my-handler.pl</P> |
| 36 |
<DL> |
| 37 |
<DT><STRONG><A NAME="item_%2Dhelp%7Ch">-help|h</A></STRONG><BR> |
| 38 |
<DD> |
| 39 |
shows this document |
| 40 |
<P></P> |
| 41 |
<DT><STRONG><A NAME="item_%2Dmodule%7Cm_PERLMODULE">-module|m PERLMODULE</A></STRONG><BR> |
| 42 |
<DD> |
| 43 |
A module that is used to transform the input events |
| 44 |
the module should inherit from <A HREF="./Data/Stag/BaseHandler.html">the Data::Stag::BaseHandler manpage</A> |
| 45 |
<P></P> |
| 46 |
<DT><STRONG><A NAME="item_%2Dunit%7Cu_NODE_NAME">-unit|u NODE_NAME</A></STRONG><BR> |
| 47 |
<DD> |
| 48 |
(you should always use this option if you specify -m) |
| 49 |
<P>this is the unit that gets passed to the handler/transformer. this |
| 50 |
will get set automatically if you use the the -c, -s or -t options</P> |
| 51 |
<P>multiple units can be set</P> |
| 52 |
<PRE> |
| 53 |
-u foo -u bar -u boz</PRE> |
| 54 |
<P></P> |
| 55 |
<DT><STRONG><A NAME="item_%2Dwriter%7Cw_WRITER">-writer|w WRITER</A></STRONG><BR> |
| 56 |
<DD> |
| 57 |
writer for final transformed tree; can be xml, sxpr or itext |
| 58 |
<P></P> |
| 59 |
<DT><STRONG><A NAME="item_%2Dmodule%7Cm_MODULE">-module|m MODULE</A></STRONG><BR> |
| 60 |
<DD> |
| 61 |
perl modules for handling events |
| 62 |
<P></P> |
| 63 |
<DT><STRONG><A NAME="item_%2Dcodefile%7Cc_FILE">-codefile|c FILE</A></STRONG><BR> |
| 64 |
<DD> |
| 65 |
a file containing a perlhashref containing event handlers - see below |
| 66 |
<P></P> |
| 67 |
<DT><STRONG><A NAME="item_%2Dsub%7Cs_PERL">-sub|s PERL</A></STRONG><BR> |
| 68 |
<DD> |
| 69 |
a perl hashref containing handlers |
| 70 |
<P></P> |
| 71 |
<DT><STRONG><A NAME="item_%2Dtrap%7Ct_ELEMENT%3DSUB">-trap|t ELEMENT=SUB</A></STRONG><BR> |
| 72 |
<DD> |
| 73 |
</DL> |
| 74 |
<P> |
| 75 |
<HR> |
| 76 |
<H1><A NAME="examples">EXAMPLES</A></H1> |
| 77 |
<PRE> |
| 78 |
unix> cat my-handler.pl |
| 79 |
{ |
| 80 |
person => sub { |
| 81 |
my ($self, $person) = @_; |
| 82 |
$person->set_fullname($person->get_firstname . ' ' . |
| 83 |
$person->get_lastname); |
| 84 |
$person; |
| 85 |
}, |
| 86 |
address => sub { |
| 87 |
my ($self, $address) = @_; |
| 88 |
# remove addresses altogether from processed file |
| 89 |
return; |
| 90 |
}, |
| 91 |
}</PRE> |
| 92 |
|
| 93 |
</BODY> |
| 94 |
|
| 95 |
</HTML> |