My apologies, shigetsu and I did not read your question carefully enough.

So if I understand clearly now, you used /somefolder/somesubfolder/digest.passwd thinking it would be relative to the DocumentRoot. The catch is that Perl knows absolutely nothing about DocumentRoot. The leading / tells Perl it's an absolute path. While you want to access d:\www\blabla/somefolder/somesubfolder/digest.passwd, you're actually attempting to access d:/somefolder/somesubfolder/digest.passwd.

It's a bit safer if you don't store your password file in your public web space. Solve two problems with one stone by moving your password file to somewhere outside of your DocumentRoot directory tree.

In short,

Cocument Root which is /

I think you meant "/ is DocumentRoot". If so, that's only the case in Apache's configuration files.

why apache can locate th file based on that?

Apache has nothing to do with it. Perl is the one trying to open the file.


In reply to Re^3: Cannot open a file using a relative path by ikegami
in thread Cannot open a file using a relative path by Nik

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.