XML::Spice

Generating XML has never been so Perly!
Download

XML::Spice Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Robert Norris
  • Publisher web site:
  • http://search.cpan.org/~robn/

XML::Spice Tags


XML::Spice Description

Generating XML has never been so Perly! XML::Spice is yet another XML generation module written in Perl. It tries to take some of the pain out of generating XML by making it more like Perl.Unless you've got a really good module for producing XML for your particular use (like a module for interfacing with a specific web service), you've probably found that you end up resorting to code like this: my $xml = q{< foo >< bar >< baz / >< /bar >< quux / >< /foo >};Of course this works great, and you can't beat it for speed, but it quickly becomes difficult to work with. Your syntax highlighting probably just displays it as a giant string. You can't easily see mismatched brackets or other bugs until your code runs and tries to parse the thing. And, once you start adding attributes and character data into the mix, it rapidly moves towards being impossible to read.Instead of this, you could use XML::Spice and write the same thing in Perl: my $xml = foo(bar(baz()), quux());You'll can add liberal amounts of whitespace to convey structure without it making your output larger. You get Perl checking to make sure that you haven't left anything out. You can use all the power of Perl to generate and include data without having to pepper your code with interpolated strings or concatenation operators. And you get a guarantee that the XML produced is valid.SYNOPSIS use XML::Spice qw(html head title body h1 p a); print html( head( title("my great page"), ), body( h1("my great page"), p("this is my great page, made with ", a("spice", { href => "http://en.wikipedia.org/wiki/Spice/" }), ), ), ); Requirements: · Perl


XML::Spice Related Software