Greetings Monks,
I'm working on a web page that will allow access to documents and accept uploads as well. I have the upload mechanism working properly, but require a path for the file to be uploaded to. The methods I have used in the past to determine the location of the perl script do not work when called by apache, they simply report "/". I have tried using a system call, as well as the following methods (Which works fine when the program is run from the command line) to no avail:
use CGI; use Cwd; my $currentdir = getcwd; print "Current dir is: $currentdir \n";
Also, FindBin returns the same results:
use FindBin; print "\nBinary is: $FindBin::Bin \n";
Both report the location to be "/".I have searched with Google and found no satisfactory solution. I really need to be able to determine where the perl script was executed from, any assistance would be greatly appreciated!

Best Regards!

smack

In reply to Using FindBin or CWD from within a CGI program by smack

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.