in reply to help with getting my perl script to run via web

Mate,

Your problem is that you're trying to run a command line written script as a CGI. That's why you get all the errors. Command line parameters work differently in command line driven apps, than with CGIs (You do know what a CGI is, right? In a nutshell, running your perl script on a webserver, what you're trying to achieve.

The easiest way, would be use alter your code slightly...

#!/usr/bin/perl -w use strict; use CGI; my $cgi = new CGI; my $i = $cgi->param("ip"); my $s = $cgi->param("server"); my $c = $cgi->param("config"); print "Content-type: text/html\n\n";

Now you can call you app by running (as an example!) http://www.example.com/cgi-bin/myapp.pl?i=192.168.1.1&s=server.example.com&c=config.sys

This might work, but you'll probably find that the formatting is all busted up. THe easiest way is to have

print "<html><pre>\n";
at the top and
print "</pre></html\n";
right at the bottom. At least you'll have a functional program. Now you have make it look nice with all the HTML stuff in between.

Hope this helps.

#!/massyn.pl

Don't -- me without telling me why. If you asked a stupid question, I wouldn't down vote you.

Replies are listed 'Best First'.
Re: Re: help with getting my perl script to run via web
by liljunior (Initiate) on Aug 06, 2003 at 17:32 UTC
    Being new to using cgi. How would i implement what you are saying into my script?
Re: Re: help with getting my perl script to run via web
by MidLifeXis (Monsignor) on Aug 06, 2003 at 02:22 UTC