|Perl Monk, Perl Meditation|
Untemplatingby tlhf (Scribe)
|on Jul 16, 2002 at 03:20 UTC||Need Help??|
tlhf has asked for the wisdom of the Perl Monks concerning the following question:
When searching the sites listed by google, it seemed that the world and his dog wanted to explain templating to me - how to get data from a dataset into some sort of styled html. Well, I need to do the opposite; use a template, some html pages, and some magic to get a nice, clean dataset.
Ok. So at first I was gonna attack the problem with some regexps. But, considering the number of seperate sets of data to untemplate, this is an extremely unattractive prospect.
I have a number of html pages for each day. Each day has one or more contributions. Also, the contributions have an option title.
Eg, a contribution like this may appear a few times in a page:
Unfortunately, the page HTML isn't always hunky-dory, it seems to side on the non-standard kind, which I think sidelines most of the HTML modules. Luckly though, all the contributions are all written in the same manner.
Can anyone help? Is there a module already written for something like this? If not, where would I start? Just quotemeta() the template and do some sort of match? But there's more than one match per page. I'm finding myself out of my league here...