Text::PORE

Text::PORE is a Perl Object Rendering Engine.
Download

Text::PORE Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Zhengrong Tang
  • Publisher web site:
  • http://search.cpan.org/~ztang/Text-PORE-1.02/PORE.pm

Text::PORE Tags


Text::PORE Description

Text::PORE is a Perl Object Rendering Engine. Text::PORE is a Perl Object Rendering Engine.poreintr.v.1. To read or study carefully and attentivelyThe American Heritage Dictionary of the English Language, Fourth EditionSYNOPSISHow to use PORE to render Perl objects. use Text::PORE::Template; use Text::PORE::Object;The Perl object to be rendered: $obj = new Text::PORE::Object('name'=>'Joe Smith'); @chilren = ( new Text::PORE::Object('name'=>'John Smith', 'age'=>10, 'gender'=>'M'), new Text::PORE::Object('name'=>'Jack Smith', 'age'=>15, 'gender'=>'M'), new Text::PORE::Object('name'=>'Joan Smith', 'age'=>20, 'gender'=>'F'), new Text::PORE::Object('name'=>'Jim Smith', 'age'=>25, 'gender'=>'M'), ); $obj->{'children'} = @chilren;The template file (demo.tpl): Name: < PORE.render attr=name > Children: < PORE.list attr=children > < PORE.render attr=name >, < PORE.render attr=age >, < PORE.if cond="gender EQ 'M'" >Male< PORE.else >Female< /PORE.if > < /PORE.list >The code that renders the object using this template: # # create a template # $tpl = new Text::PORE::Template('file'=>'demo.tpl'); # # render the object using the template # the result is printed to STDOUT # my $fh = new FileHandle(); $fh->open('>& STDOUT'); Text::PORE::render($obj, $tpl, $fh); $fh->close();The rendering result: Name: Joe Smith Children: John Smith, 10, Male Jack Smith, 15, Male Joan Smith, 20, Female Jim Smith, 25, Male Requirements: · Perl


Text::PORE Related Software