|There's more than one way to do things|
HTML document modificationby rob_au (Abbot)
|on May 28, 2004 at 01:32 UTC||Need Help??|
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'"