Your script runs as a different user when it is executed via the Web Browser. That is why you may notice Net::Ping functionality work when you test it from the console, but not from the Web Browser. This is *part* of the problem...
To fix this, you have to make your script executable by someone who has those rights... in Win32 IIS he is usually called IUSR+name of your web server. You do that in the IIS Admin tool.
The other part of this problem may be that the path to your system command is unknown to the console.
*This will work on Win32
#!/perl/bin/perl
use strict;
#use CGI qw(:all); #Install this module!
#print header; #Life will get much easier!
print "Content-type: text/html\n\n";
# Or you can hand code like the above all you want
my @output = `echo %path%`;
# my @output = `set`; #see all the goodies
print "<b>Your web browsers path:</b><br> @output";
Name the file path.cgi or whatever...
If your executable is not in your path.. viola` you have found why it doesn't work. Making the script run as a user who has that in his path, or physically moving the executable or a link to it in /perl/bin will also let you do it....
Hope this helps! :-)
Revised: Added Win32 statement
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.