prep/dev guide for perlists
|
prep is described in the prep for
users document. this document describes how to write #require'able
extensions to prep, but you should better look at an
example while you read this.
first you need to enter the 'prep' namespace saying package prep; then you can define subs called do_<command> which either print something (if used as instructions) or return something (if used as insertions). you can also provide a set of static insertions by defining $prep::VAR{"<variableName>"} = <value> as for instance in $prep::VAR{ROOT} = $ENV{DOCUMENT_ROOT}. sub done is called at the end of parsing a source file, so you can do trailing output like closing html tables. larry wall requires you to end your perl file with "1;", the source code of prep itself resides in ibiza/lib/prep.pl. |