in reply to Re: Get HTML source code
in thread Get HTML source code

First of all thanks for the quick answers. I haven't tried any of them, but when I solve my problem I'll tell.

I'll explain what I need:
This HTML page the script produces is a very large page, with lots of images and forms.
I often need to send the information this script produces by email, either by doing:
- "Edit -> Select All", "Edit -> Copy", and "Edit -> Paste" in Outlook)
- "File -> Send -> Page by Email"

So, I want to strip the html code of all the forms and informations I don't need. If I can get the HTML code in a variable I can delete everything between "<form>...</form>" and therefore make a similar page, without the forms.

If anyone can give me a better sugestion, I'll be most grateful.
Thanks

Replies are listed 'Best First'.
Re^3: Get HTML source code
by jeffa (Bishop) on Nov 04, 2005 at 17:45 UTC

    Oh! I completely read your original question wrong. At the expense of adding more programming logic to your script, couldn't you simply pass in a CGI parameter (as_email) and exclude certain portions of the HTML page if present? Here's is where tools such as HTML::Template and Template Toolkit are a big win:

    use strict; use warnings; use CGI; use HTML::Template; my $cgi = CGI->new; my $tmpl = HTML::Template->new( filehandle => \*DATA, associate => $cgi, ); print $cgi->header, $tmpl->output; __DATA__ <html> <head> <title>insert generic title</title> </head> <body> <h1>Hello World.</h1> <tmpl_unless as_email> <p>This only appears when as_email is not present.</p> </tmpl_unless> </body> </html>
    Try calling this CGI script with the parameter as_email set to a true value.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)