I just want to thank all of you for your responses!

I have spent some time trying to clean up my code and I got rid of that old home-rolled 'ParseForm' code –- and am now using 'CGI.pm' for the job.

I’m not great at purification but it’s never too late to learn to use ‘strict’ and ‘warnings’ which my code now passes, but I still get a CGI header warning when I apply the taint –T flag.

Special thanks to BUU, as soon as I read what you wrote about chomp I knew you were right –- and you were! Such a simple thing hanging days worth of effort and rewrites. That seem to be how it goes sometimes.

Thank you all again,

langsor
~still so much to learn

If any are interested -- here is how the entire code stands now. Maybe not great, but working.
#!perl BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); } use strict; use warnings; use CGI qw(:standard escapeHTML); use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)"); &ParseList; exit; sub ParseList { my(@list, $line, $first, $last, $content, $profile); if( param('input') =~ /^(\w.*)$/ && -r $1 ){ open(IN, "<$1") || print "$!"; @list = <IN>; close(IN); }else{ print "<h3>Could not read from INPUT file</h3>"; exit; } foreach $line (@list){ chomp($line); ($first, $last) = split(/\|/, $line); $content = AimAgent($first,$last); if( $content =~ /<option/gi ){ while( $content =~ /<option.*?value=\"(.*?)\">/gi ){ $profile = AimAgent($first,$last,$1); PublishProfile($first, $last, $profile); } }else{ PublishProfile($first, $last, $content); } } } sub AimAgent { my($first, $last, $license, $request, $response); ($first, $last, $license) = @_; $request = HTTP::Request->new(POST=>"http://cgi.docboard.org/cgi-shl +/nhayer.exe"); $request->content_type("application/x-www-form-urlencoded"); if( $license ){ $request->content("form_id=medname&state=na&medlname=$last&medfnam +e=$first&mednumb=$license"); }else{ $request->content("form_id=medname&state=na&medlname=$last&medfnam +e=$first"); } $response = $ua->request($request); if( $response->is_success ){ return $response->content; }else{ return $response->status_line; } } sub PublishProfile { my($first, $last, @people, $person, $relevant, $profile, $html, $out +put); ($first, $last, @people) = @_; foreach $person (@people){ $person =~ /CENTER><B><B><B>(.*?)Please read the AIM/gi; $relevant = $1; $relevant =~ s/<img.*?>//gi; $relevant =~ s/<a href.*?>//gi; $relevant =~ s/<font.*?>//gi; $relevant =~ s/<b>//gi; $relevant =~ s/<\/font>|<\/a>|<\/b>//gi; $profile = <<endline; <table class="profile" width=350 align="center" border=1> <tr> <td>$relevant</td> </tr> </table> endline } $html = <<endline; <html> <head> <title>AIM Search</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> <link rel="stylesheet" type="text/css" href="aim.css"> </head> <body> <div align="center"> <table class="head" width=500 border=1 align="center"> <tr> <td><span class="title">$first $last</span></td> $profile </td> </tr> </table> <span class="label">Please Read Output File For Details</span><br><b +r> <a href="index.html"><span class="label">CLICK HERE TO RETURN TO SEA +RCH PAGE</span></a><br></div> </div> </body> </html> endline if( param('output') =~ /^(\w.*)$/ && -w $1 && -T $1){ $output = $1; open(OUT, ">>$output") || print "$!"; }else{ open(OUT, ">>results.html") || print "$!"; } print OUT $html; print $html; close(OUT) || print "$!"; }

In reply to Re: Batch process LWP search by langsor
in thread Batch process LWP search by langsor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.