String::Divert

String Object supporting Folding and Diversions
Download

String::Divert Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Ralf S. Engelschall
  • Publisher web site:
  • http://search.cpan.org/~rse/

String::Divert Tags


String::Divert Description

String Object supporting Folding and Diversions String::Divert is small Perl 5 module that provides a scalar-like string object with some overloaded operators, supporting the concept of Folding and Diversion. This allows nested generation of structured output. The idea is to decouple the sequential generation of output from the nested and non-sequential structure of the output.The two most prominent examples are the generation of code in SGML/XML based languages like HTML (where large and deeply nested structures occur) and the generation of code in typed 3GL procedural languages like C/C++ (where symbols have to be declared before usage). Here String::Divert allows you to generate the code in steps from the outer to the inner level or to append code to already generated previous or later inserted parts.This is achieved by leveraging two basic concepts: content folding and operation diversion.SYNOPSIS use String::Divert; # standard object-oriented API (SAPI) $x = new String::Divert; $x->assign("foo"); $x->fold("sub"); $x->append("quux"); $x->divert("sub"); $x->append("bar"); $x->undivert(0); print "x=".$x->string()."\n"; $x->destroy(); # extended operator-overloaded API (XAPI) $x = new String::Divert; $x->overload(1); $x .= "foo"; $x *= "sub"; $x .= "quux"; $x >> "sub"; $x .= "bar"; $x < < 0; print "x=$x\n"; undef $x; Requirements: · Perl


String::Divert Related Software