rob_au has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for some feedback on the best way to approach a particular function which I am seeking to implement. I need to modify some existing HTML documents to add a small portion of HTML immediately before the </body> tag within these documents, but do not want to otherwise modify the layout or structure of the HTML document.
The Apache::Footer example module outlined in Lincoln Stein's Cool Tricks With Perl and Apache (Perl Conference 1998) uses a simple regular expression to insert HTML content immediately before the </body> tag - See this code here. I am however concerned about the application of this method across the wide range of HTML documents involved (which may include example HTML within <pre></pre> tags).
The alternate approach which I have considered is using one of the HTML::Parser modules to step through the HTML tokens, but am concerned about modifying the layout and structure of HTML documents.
Any other suggestions or approaches which I should consider?
perl -le "print unpack'N', pack'B32', '00000000000000000000001011011101'"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML document modification
by BrowserUk (Patriarch) on May 28, 2004 at 02:04 UTC | |
|
Re: HTML document modification
by davido (Cardinal) on May 28, 2004 at 01:53 UTC | |
by rob_au (Abbot) on May 28, 2004 at 02:39 UTC | |
by perrin (Chancellor) on May 28, 2004 at 04:00 UTC | |
by zakzebrowski (Curate) on May 28, 2004 at 13:51 UTC | |
|
Re: HTML document modification
by ryantate (Friar) on May 28, 2004 at 21:43 UTC |