Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

XML/Perl integration and experience?

by r.joseph (Hermit)
on May 11, 2001 at 05:27 UTC ( #79619=perlmeditation: print w/replies, xml ) Need Help??

Hello all! Well, following the recent horrific crash of both my main webserver and the backup server *tries not to cry...too much*, I have been forced to completely re-do my website.

Before the Great Crash of '01, my site was completely dynamic, pulling data from here and there and everywhere, you know, the normal CGI-overkill site: but it worked well. However, lately, I have been hearing much about the 8th wonder of the world and the savior of humanity, XML, and the amazing things that it can do. Therefore, I think that it is time to sersiouly consider, when I begin the rewrite of my site, doing it with an XML backend instead of HTML and all that old skool stuff.

Now, I have two questions. First, do any of my fellow monks have experience using an XML/Perl/CGI-driven website (ie: one in which data files are stored in some variant of XML (could even be proprietary) and the main functions of the site are carried out by a Perl/CGI script that acts as the orchestrator and what not), and specifically, how well this setup translates into foreign data exchange. I want to be able to share data files directly from my site with a friend of mine who is firmly entreched in ASP and another friend who is equally dedicated to Flash (yes, Flash 5 supports XML up the wazoo). Second, what resources (books, tutorials, articles, etc) have you guys come across that tie in XML and perl together very well. I know of an incredible plethora of XML books out there (as it seems to be the main buzzword of today), but what I am looking for specifically is information targeted at the experienced Perl user about integrating XML and Perl. Any thoughts?

I know that this post might not exactly be as Perl-centric as it should, but I believe it is pertinent. Thanks for your time!

r. j o s e p h
"Violence is a last resort of the incompetent" - Salvor Hardin, Foundation by Issac Asimov

Replies are listed 'Best First'.
Re: XML/Perl integration and experience?
by Falkkin (Chaplain) on May 11, 2001 at 05:59 UTC
    First, do any of my fellow monks have experience using an XML/Perl/CGI-driven website (ie: one in which data files are stored in some variant of XML (could even be proprietary) and the main functions of the site are carried out by a Perl/CGI script that acts as the orchestrator and what not), and specifically, how well this setup translates into foreign data exchange.
    How about... *drum roll* ;)

    Search for "XML Ticker" in the search box, and you'll come across the Other Users ticker, the Chatterbox Ticker, and a few others. As far as I know, all the data on this site is stored as XML, with pages generated by perl & CGI.

    As far as foreign data exchange, it seems to work well enough... there are a bunch of Chatterbox Clients, in various programming languages (like Java), that parse the various XML files and do useful things. (I know there's a more extensive list of CB clients somewhere, but can't seem to find it at the moment.)


      Actually, Perl Monks isn't xml-driven. All (or at least most of) the data is in a database; it's just that vroom created some xml-generating nodes for monks that wanted roll their own CB clients, and generally do cool stuff with it.

      And Perl Monks isn't CGI-powered, but mod_perl powered.


      ar0n ]

Re: XML/Perl integration and experience?
by mirod (Canon) on May 11, 2001 at 10:40 UTC

    The first question youhave to ask yourself is how dynamic your content really is? I tend to store data in XML but then I generate static XHTML from it, so the server is not burdened by the XML processing each time a page is served. Of course you can also put a cache in front of it and then it is dynamic for you but mostly static for the users.

    If you want a truly dynamic site you might want to look into AxKit, and read the XML application servers thread. AxKit will let you define stylesheets applied to your XML data and it will take care of the caching. Be ready to learn XSLT or XPathScript though.

    As for resources on Perl and XML, Data Munging with Perl by Davorg has a section on XML that describes XML::Parser and XML::DOM, the Module Reviews section here has got a bunch of reviews of XML modules, has got a number of articles on Perl and XML, look for Kip Hapmton's column, and I have a list of articles, mostly about Perl and XML, all linked from here. Generic info on XML can be found on The XML Cover Page which has a (short) section on XML and Perl.

Re: XML/Perl integration and experience?
by LD2 (Curate) on May 11, 2001 at 07:11 UTC
Re: XML/Perl integration and experience?
by Sherlock (Deacon) on May 11, 2001 at 17:23 UTC
    I've done some work with XML so maybe I can point you to a few of the resources I used. First of all, I've written a simple XML tutorial that is online here. Unfortunately, I haven't yet added a section on XML and Perl, but you can pick up the basics of XML. It does, however, cover XML interfaced with HTML, JavaScript, & CSS. Hopefully, if time ever permits, I'll get Perl in there, too. I also used XML By Example, by Benoit Marchal, to learn XML, but I wasn't overly thrilled with that book. However, it worked. :)

    If you're interested in using XML with Flash (I know you said this was your friend's work, but I wasn't sure if you were looking for material on this as well), I can recommend a few good books. Foundation ActionScript, by Sham Bhangal, Flash 5 Dynamic Content Studio, by David Beard, and a new upcoming book Flash 5 ActionScript Studio, by Brendan Dawes, et al. These books are all published by FriendsOfEd and, as far as I'm concerned, are some of the best books on Flash out there.

    I'm currently working on a scheduling system that uses XML to store all the data input by a client and then display that content dynamically to a site reader, so I'm fairly familiar with using XML::Parser to get data in and out of XML, so if you have any questions trying to interface Perl with XML, just let me know - I'd be happy to help.

    If you'd like to take a look at the scheduling system, to see how I'm using it, I'd be happy to show you the code and give you links to the site, just /msg me. (That goes for anyone else that might be interested, as well.)

    Good luck to you!

    - Sherlock

    Skepticism is the source of knowledge as much as knowledge is the source of skepticism.
Re: XML/Perl integration and experience?
by stefan k (Curate) on May 11, 2001 at 16:48 UTC
    well I did the XML decision end of last year and since I only needed static HTML pages I wrote a little perl program (which you can find here if you are interested) that takes a whole XML tree, builds one large XML document from that and pushes it thru an XSLT stylesheet.

    OK, adding new pages and auto-link them is very easy now (hmm, from the XML point of view, only: as a matter of fact my sysad has disabled ftp in our firewalls so I don't have to bear with our pages right now :-).
    Changing the layout only involves _one_ document: the stylesheet. But that is really ugly. I have been cursing XSLT for weeks!

    Another problem of _that_ time was that the XML::XSL perl modules were not complete. I dunno of the current situation (though I'd really like to put that into my script -> any volunteers? ;-). So I used saxon (which is written in Java which is just incredibly slow on my home machine).

    A good source for me has been at with loads of examples for XML, XSL, XSLT, CSS, Perl, ....

    Regards... Stefan

Re: XML/Perl integration and experience?
by DrZaius (Monk) on May 11, 2001 at 18:52 UTC
    I recommend it a lot, but Apache::PageKit may be what you are looking for.

    Also, if you are into XSLT instead of HTML::Template, look into Apache::AxKit.

    Both these modules use mod_perl to create a framework. Into this framework, you toss your templates, your data sources and your components (perl code). You should never have to deal with CGI again or any of that stuff.

    Good luck.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://79619]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2017-02-21 17:30 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (314 votes). Check out past polls.