Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: help with getting my perl script to run via web

by Massyn (Hermit)
on Aug 05, 2003 at 22:19 UTC ( [id://281200]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found