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.


In reply to Re: help with getting my perl script to run via web by Massyn
in thread help with getting my perl script to run via web by liljunior

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.