Template::Declare::Bricolage

Perlish XML Generation for Bricolage's SOAP API
Download

Template::Declare::Bricolage Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • David Wheeler
  • Publisher web site:
  • http://search.cpan.org/~dwheeler/

Template::Declare::Bricolage Tags


Template::Declare::Bricolage Description

Perlish XML Generation for Bricolage's SOAP API It can be a lot of work generating XML for passing to the Bricolage SOAP interface. After experimenting with a number of XML-generating libraries, I got fed up and created this module to simplify things. It's a very simple subclass of Template::Declare that supplies a functional interface to templating your XML. All the XML elements understood by the Bricolage SOAP interface are exported from Template::Declare::TagSet::Bricolage, which you can use independent of this module if you require a bit more control over the output.But the advantage to using Template::Declare::Bricolage is that it sets up a bunch of stuff for you, so that the usual infrastructure of setting up the templating environment, outputting the top-level element and the XML namespace, is just handled. You can just focus on generating the XML you need to send to Bricolage.And the nice thing about Template::Declare's syntax is that it's, well, declarative. Just use the elements you need and it will do the rest. For example, the code from the Synopsis returns: < assets xmlns="" > < workflow id="1027" > < name >Blogs< /name > < description >Blog Entries< /description > < site >Main Site< /site > < type >Story< /type > < active >1< /active > < desks > < desk start="1" >Blog Edit< /desk > < desk publish="1" >Blog Publish< /desk > < /desks > < /workflow > < /assets >bricolage {}In addition to all of the templating functions exported by Template::Declare::TagSet::Bricolage, Template::Declare::Bricolage exports one more function, bricolage. This is the main function that you should use to generate your XML. It starts the XML document with the XML declaration and the top-level < assets > element required by the the Bricolage SOAP API. Otherwise, it simply executes the block passed to it. That block should simply use the formatting functions to generate the XML you need for your assets. That's it.Synopsis use Template::Declare::Bricolage; say bricolage { workflow { attr { id => 1027 }; name { 'Blogs' } description { 'Blog Entries' } site { 'Main Site' } type { 'Story' } active { 1 } desks { desk { attr { start => 1 }; 'Blog Edit' } desk { attr { publish => 1 }; 'Blog Publish' } } } }; Requirements: · Perl


Template::Declare::Bricolage Related Software