Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

cgi-lib.pl

by Anonymous Monk
on Jun 16, 2005 at 01:49 UTC ( #467133=perlquestion: print w/replies, xml ) Need Help??

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

My hosting provider didn't install cgi-lib.pl (http://cgi-lib.berkeley.edu//)

So I upload it in my 'cat'(myhost.com/cat) directory and put this on the top of my script "use lib '/cat';" before "require("cgi-lib.pl")"

But I get the '500' error.

What did I do wrong. Plz help. TQ

Replies are listed 'Best First'.
Re: cgi-lib.pl
by jZed (Prior) on Jun 16, 2005 at 01:54 UTC
    What did I do wrong.
    You tried to use cgi-lib.pl an ancient, long-abandoned, dangerous module that used to be used by people who didn't know any better. Instead use CGI, which has a cgi-lib compatability mode in case you have scripts that work with the old style.
      You are blithely assuming perl 5 :)
      This is the code for the script
      #!/usr/bin/perl require("cgi-lib.pl") print &PrintHeader; &ReadParse(*form_data); print qq|<HTML><HEAD><TITLE>Reverse Script</TITLE></HEAD> <BODY BGCOLOR="FFFFFF" TEXT="000000"> <!--start of data-->\n|; $original = $form_data{'originalstring'}; $reverse = "$original"; $original2 = $form_data{'originalstring2'}; $reverse2 = "$original2"; $original3 = $form_data{'originalstring3'}; $reverse3 = "originalstring3"; } if ($form_data{'javacgibridge'} eq "on") { print "$reverse~|~$reverse2~|~$reverse3~|~~|~\n"; } else { # javacgibridge is not on print "This is the original string:<P>"; print "$original\n"; print "<P>"; print "This is the reversed string:<P>"; print "$reverse"; print "<P>"; } print "<!--end of data--> </BODY></HTML>\n";
      Thanks
        You need, at a minimum to to replace these three lines:
        require("cgi-lib.pl") print &PrintHeader; &ReadParse(*form_data);
        with:
        use CGI; print CGI::header(); my %form_data = CGI::Vars;
        But I'm not sure I'm doing you a favor by telling you that. You really should start by learning something about perl and CGI. Just copying scripts and code snippets is likely to get you into trouble.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: cgi-lib.pl
by johnnywang (Priest) on Jun 16, 2005 at 06:24 UTC
    your "use lib'/cat';" is apparently not correct, you need the file path to cat, not the url path. Also try to run the script from commandline, which will give you more informative error messages.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://467133]
Approved by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2023-12-10 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?