Heal Your Church WebSite


Teaching, rebuking, correcting & training in righteous web design.

DailyManna 1.0 using XML::Simple

Tired of screen-scraping your Daily Verse? Can’t wait to use XML instead? Well wait no longer as the good folks over at the International Bible Society recently began rendering their Daily Manna in a yummy variety of XML formats.

Unfortunately, they tried fitting a square peg into a round whole by delivering the goods using dated RSS 0.91 specification. I say unfortunately, because they were compelled to shove the link for the audio version of the daily verse into the /Channel/Description element, which in effect is adding an inner node. This means you get some unexpected results when using RSS parsing tools such as XML::RSS, as this inner node displays as Hash(0×12356) after the verse. In short, they’re offering an XML feed that doesn’t validate..

To get around this problem, I employed XML::Simple”>XML::Simple instead. Then I created the class ‘DailyManna‘ which parses the incoming rss stream into an easy to access and use object. Along the way, I customized some of the titles and the passage to fit my situation. Meaning, even though the IBS is now using RSS, they’re really not using it in a way that’s entirely friendly to those of us who want to control how the data looks and feels. Likewise, they fail to take advantage of the ability to list not only the current day’s verse, but those from the past week.

Over the weekend, I’m going to toy with creating an example of what I would prefer the IBS use, either via the RSS 2.0 and/or Atom. Please no RSS religious wars, though I would be interested in what you guys have to offer (i.e. examples) either way.

Until then, here is code to slice-n-dice the XML feed to your needs:



usage notes:

  1. Using your favorite editor, copy and paste the above code.
  2. Make sure you have installed LWP::Simple, XML::Simple and HTTP::Date
  3. chmod 755 DailyManna.pl (set permission)
  4. create an empty output file such as ‘DailyManna.pl’
  5. set the permissions of the target output file to 766 or 777
  6. run the script once from the shell – test for errors
  7. crontab to taste e.g.: crontab -e 0 2 * * * perl /path/DailyManna.pl>dailyManna.inc.php
  8. include the verse file in your documents
  9. edit your .css documents to accomodate the <div> containing the reference

Two requests.

  1. Leave comments if you’ve got improvements, and;
  2. please, give me time to make this a MovableType plug-in. I have plans of doing this, but I want to test the application, and get your opinions before I create the plug-in.

One Comment

  1. Yes, I developed screen scrapping application that converted information into XML Webservice and then I email BibleGateway.com team asking them when are they agoing to make it available. I even offered my services but it takes time for them I am not sure why.

    It would be cool to have a webservice and then a SmartTag for the Office to query the webservice and inject scripture into the document!

    Maxim