simonodell1 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys,

I need a little help with a system I'm building. Its opensource so anyone that wants to have a look at the code just drop me a mail or a message to simonodell@hotmail.com

I have written a system for rendering webpages which takes a document called .axml and renders it into html. The axml document contains xml tags which correspond to perl plugins which get eval'd and the result pasted back into the doc. The upshot is that I can develop documents which are very similar to html but with all the power of a perl CGI system behind it.


action.pl?ref=somedata

a <qd>ref</qd> tag in the document will trigger the qd plugin which then returns the value "somedata". This value is then pasted into the document in the place where the <qd> tag was. I have defined several dozen such tags and have a set large enough to build most small CGI applications with.

a simple axml case statement action.pl?ref=file1
<case> <c><qd>ref</qd></c> <file1><insertfile>data/file1.xml</insertfile></file1> <file2><insertfile>data/file2.xml</insertfile></file2> <else> <insertfile>data/file3.xml</insertfile> </else> </case> update a value in an xml file <changexmlvalue> <d>actions/publicpages/db/publicpages.xml</d> <key>page</key> <match>id=<qd>edit</qd></match> <change>stylesheet</change> <newvalue><qd>file</qd></newvalue> </changexmlvalue> foreach... <foreach> <s>publicpages</s> <key>page</key> <mask> <d>pagename</d><br/> </mask> </foreach> <p>where s can be a file or some data, key is the xml primary key to t +he data, mask is the output for each instance, d is a data item.</p> given the data <page> <pagename>welcome</pagename> <title>Welcome to Widgets.com</title> </page> <page> <pagename>login</pagename> <title>Login to Widgets.com</title> </page> the foreach in this example will produce; welcome<br/> login<br/>
------------------------

i have built dozens of useful little plugins for the system and the main parser allows for these plugins to be assembled like little lego blocks for just about any complex output to be built.

axml allows for 3 types of tags, delimted by the standard <>, and two non-standards... and ( )

axml tags are processed from the inside outwards. the tags are left to the final pass, whilst ( ) tags are processed before < > tags. using these three bracket types ive been able to construct complex processing orders. for instance (case) (qd)ref(/qd) <....

in this case, the qd is run first, and then the case, both of which are in ( ) brackets and therefore run prior to any < > tags which the case contains.

I need to write a plugin to handle RSS. The code I've built for parsing the axml and running the plugins doesnt use any modules, it stands alone with the main action.pl at just under 600 lines, and many more lines of code in the plugin files themselves. I'm not too hot on object orientated programing and frankly cpan is scarey!

Anyway, what I need to do is simply connect to a given RSS url feed, and return the contents. I've spent ages looking around the net for info on this and all i can find is info on how to use the XML::RSS module, which is not really what im after since it doesnt fit in with the schema of my system and its plugin files.

Can anyone help?

Yours

Simon Odell

Replies are listed 'Best First'.
Re: RSS plugin needed
by Corion (Patriarch) on Apr 12, 2007 at 07:09 UTC

    As I already told you, the RSS modules provide a wealth of tools to handle RSS. Most likely XML::RSS::TimingBot is a module you want, because it handles the fetching and caching of RSS according to the refetch times for you. Respecting these timeouts and not refetching needlessly is considered polite.

Re: RSS plugin needed
by gloryhack (Deacon) on Apr 12, 2007 at 07:00 UTC
    I'm not too hot on object orientated programing and frankly cpan is scarey!

    I suggest that it might be a much gentler education, and much faster besides, to overcome your fear of CPAN and add some OO skills to your repertoire rather than to reinvent that particular wheel while avoiding the use of OO.

    Doing XML without OO... interesting. Just so fine a wall that you can't help but feel compelled to bash your face into it repeatedly? :-)