in reply to RE: Re: Grabbing Data
in thread Grabbing Data

They code he pasted is just a simple Perl script, not a CGI script. If you're trying to run this as a CGI script, you will need to modify it so it prints standard CGI headers. Most simply:
print "Content-type: text/html\n\n";
should be sufficient. You may be interested in a book on writing Perl CGI scripts. Additionally, it's up to you to actually do something with this data. All the script does is print the content it retrieves straight back to the client/browser.

Replies are listed 'Best First'.
RE: RE: RE: Re: Grabbing Data
by ImpalaSS (Monk) on Oct 30, 2000 at 20:48 UTC
    Ok guys, 
    this is what i did. I added a line at the end, print "works"; and then commented everything else out, the script worked. Then i started un-commenting lines.
    1: require 5; (worked fine)
    2: use strict; (worked fine)
    3: use LWP::UserAgent; (500 Error)
    
    I hope this somewhat helps
    Thanks again,
    Dipul
    
        I think thats it.. I cant find any of the modules.. Also, in the var/log/ dir, there are no sub directories, just syslog.1 .2 .3 etc..
        Thanks
        Dipul
RE: RE: RE: Re: Grabbing Data
by ImpalaSS (Monk) on Oct 30, 2000 at 20:27 UTC
    Hey guys,
    I tried everything Mentioned above, still gettin the 500 error. I changed the shebang line to where the perl is located, but still no luck. I went to look for the log, but again, i no luck. I went to /var/log but no apache directory??
    Thanks guys
    Dipul
      Common locations for your apache log-dir are:
      • /home/httpd/logs/
      • /var/log/httpd/
      • /usr/local/apache/logs/
      And it wouldn't hurt actually searching for it yourself: find / -name error_log -print

      update
      Read jcwren's post below and ye shall learn how to harness the power of Grep, for it is truly powerful!

      [ar0n]

      Usually, it's in /var/log, the directory will be called 'httpd', not 'apache'. So check the /var/log/httpd directory.

      If it's still not there, find the file called 'httpd.conf' (you may be able to use the locate command to find it. 'locate httpd.conf'), and grep for 'ErrorLog' and 'CustomLog'. These should tell you what directory the logs are placed in.

      But as mentioned above, the script, as written, is not meant to be a CGI script, but rather, a command line script. You'll need to add the aforementioned headers, plus possibly some other code, to get it to run as a CGI process.

      --Chris

      e-mail jcwren
RE: RE: RE: Re: Grabbing Data
by ImpalaSS (Monk) on Oct 30, 2000 at 20:33 UTC
    Thanks again guys for the speedy replies. 
    Ok, i did everything mentioned above yet i still get errors. I did change the shebang line to the one i used in my other scripts, but still no luck.
    I also added the mime line, but again, the 500 error. 
    Then I tried looking for the error.log, but in the /var/log folder there was no apache folder, and the only logs in there weren't for errors.
    Any ideas?
    Dipul
    
    PS - I don't know if this helps, but when i went into the dir mentioned in the shebang line, /usr/local/bin/perl , i could get as far as usr/local/bin but there was no perl directory in there, just a perl@?