You're passing data on the command line without any quoting. In case it doesn't look like anything malicious was attempted, this will only get the first word into your script.

In other words: make your whole text your first parameter. Quote it.

If on Unix — and it looks like you are — then take a look at String::ShellQuote. It looks to me like that's a safe catch-all way to get your whole string into your script.

Another way to make sure your data gets though uncorrupted, is to use piping. Make the data come through the child script's STDIN. Thus, replace

system("perl prn_to_file.pl $param1 > ../results/output.txt");
with
open SYSTEM, "| perl prn_to_file.pl > ../results/output.txt"); print SYSTEM $param1; close SYSTEM;
Untested, but basically, something like that.

And finally, I think nothing works just because your user has no rights to write to the "../results" directory — I bet the CGI isn't run under the user name "myname". That's what permissions "drwxrwxr-x" tell me: no "w" for "world".


In reply to Re: Failed System/Exec Call under Right Permission with CGI by bart
in thread Failed System/Exec Call under Right Permission with CGI by neversaint

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.