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

Replies are listed 'Best First'.
Re: Retrieve, modify, & display web page
by mrbbking (Hermit) on Jan 03, 2002 at 19:34 UTC
    Instead of writing to a file, write to STDOUT (or leave the filehandle out, since that's the default).

    Or, comment out your open and close statements, remove the OUTPUT filehandle from your print statement, and add this:

    print "Content-type: text/html\n\n";
    before writing any other output.

    Put the script in your web server's cgi-bin directory, make it executable and load it from a browser.

    That should get you started.

Re: Retrieve, modify, & display web page
by AidanLee (Chaplain) on Jan 03, 2002 at 19:49 UTC

    What you'll probably want to do is Walk through the bulleted list and for each bullet:

    1. Pull off the first line of text (the name)
    2. Then get the link from the link(s?) that comes after that bullet, but before the next.

    It may be difficult to do with TokeParser since the generated page doesn't close their list-element ( <li>) tags, and I don't know what it can or can't handle. If it does not work, as much as It's usually unwise to advocate it, since you have a "known format" you're working with, it would be possible to parse this page with regular expressions:

    my @document = split /\n/, $document; my $entry = ''; foreach my $line ( @document ) { m|^<li>(.*?)</strong>| and do { $entry = $1; next }; m|<a href=(.*?)>(.*?)</a>| and do { my $url = $1; $url =~ s/CMD=TABLES/CMD=RET/; my $text = $2; if ($text eq "STF1A" || $text eq "STF3A") { print OUTPUT "<a href=$url/FMT=HTML/T=P1>$entry $text</a>< +br />\n"; } next; }; }