Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    XML::Spice 0.01

    Download button

    No screenshots available
    Downloads: 259  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Robert Norris | More programs
    Perl Artistic License / FREE
    March 14th, 2010, 13:58 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    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/" }),
     ),
     ),
     );



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    XML generator | Perl module | Perl | XML | generator

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM