Re: GET works, but not from user httpd

Bill Moninger (moninger@fsl.noaa.gov)
Tue, 20 Feb 96 21:51:47 GMT


This is a follow up to my previous message.

The real problem seems NOT to have been web vs non-web, but rather
something to do with associative arrays.

This is what seems to cause problems (SOMETIMES!) on the web:
&badURL($in{'htmlURL'},$in{'psURL'},$in{'otherFormatURL'});

However, this works fine:
&badURL("http://x.y.z","http://a.b.c");

Even if I set the assoc. array variables equal to 'my' variables and pass
the 'my' variables to the subroutine, I had problems.

The work-around was to use a regular expression to capture the content of
variables that had been part of associative arrays (see the #####-marked
code below).

Does anyone have a clue about what aspects of associative arrays might be
causing this bizzare behavior?

Hoping I'm not bugging this group too much, I am

sincerely,

-Bill Moninger
        
========================================
sub badURL {
    #print "into badURL<pre><br>\n";
    use LWP::UserAgent;
    use HTTP::Request;
    use HTTP::Response;

    my $ua = new LWP::UserAgent;
    my ($request,$response,$msg);
    my (@myURLs) = @_;
    #print "myURLs are |@myURLs|<br>\n";
    my @bads=();
    foreach $xURL (@myURLs) {
        if ($xURL) {
            #I sure as hell don't know why I need to do this vvvvvvvvvv
            $_=$xURL;     #####################
            /(.*)/;       #####################
            $myURL=$1;    #####################
            #but it has something to do with assoc. arrays ^^^^^^^^^^
            #print "myURL is |$myURL|<br>\n";
            $request = new HTTP::Request('GET',"$myURL" );
            $response = $ua->request($request);
            if ($response->isError) {
                $msg= $response->asString;
                $msg =~ /Message: (.*)\n/;
                push (@bads,$1);
            }
        }
    }
    if(@bads) {
        print "The following URL(s) apparently have errors:<br>\n";
        foreach $bad (@bads) {
            print "$bad<br>\n";
        }
        return 1;
    }
    return 0;           # return number of bad URL's
}

-------------------------
William R. Moninger, Nat'l Oceanic & Atmospheric Administration (NOAA)
Forecast Systems Laboratory, R/E/FS1
325 Broadway;     Boulder, CO 80303; USA
moninger@fsl.noaa.gov; Voice: 303-497-6435;  Fax: 303-497-3329
URL: http://www.fsl.noaa.gov/frd-bin/bill.homepage.cgi