As someone commented before- this is a cgi, right? So.. it's being run by a http trigger, so.. it's run by apache.. Unless you have suexec running, if you look at the process, it would be running under wwwrun, or some other 'user' . Even though the script may be owned by you.

So, when you ask for $ENV{HOME} (if it is set) or ~, you are asking for the home of some other user. Likely.

If yuo're on a *ix box, you're lucky or smart; so why don't you try this.. print STDERR $ENV{HOME};

Then in your shell prompt, do this ..  tail -f /var/log/httpd/error_log - that will let you see STDERR as you go (leave that window runninng, and as you try out your script, the window will output your cgi STDERR). *your* exact apache error log may be somewhere else, like /var/log/apache2/error_log .

That will help debugging


In reply to Re: creating a file with a cgi script by leocharre
in thread creating a file with a cgi script by Anonymous Monk

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.