Gents, I am having a problem executing some functions within perl scripts via relative paths. This snippet of code comes from an HTML file that executes a perl script via a relative path. When the user selects the option, the PERL script is executed. Works like a champ.
<option VALUE="./cgi-bin/test.pl?sys=WMD">
However, on a different HTML page, I run into some problems. A form and submit button is automatically is generated by calling the following perl script:
<script src="./cgi-bin/check.pl"></script>
fine The output of the above is a javascript file that is called later in the html document. That js file creates a form tag with a submit button whose action is yet another PERL script, as follows:
<form style='margin-bottom:0; margin-top:0;' ACTION = './cgi-bin/upda +te.pl' TARGET = 'FRAME2'> <input type='submit' value='Update Page'></form>
It's apparent the script begins to do it's thing, however the problem results when a "open" function is called within the script (as listed):
open (UPDATE, "../update/update.txt") or die "Cannot open update.txt";
(relative to the perl script being called, the file is up one directory, over to the 'update' directory, then down to the 'update.txt' file.)
I get the dreaded "Cannot open update.txt" message.
The following is a rough schematic of my website:
ROOT_NODE html files cgi_bin/ all .pl and .cgi files are here update/ update.txt is here jsfiles/ all javascript files are here etc/ other files

I've checked the relative path from the working html document several hundred times and am convinced it is correct. The 'update.txt' file also exists in every case. File and folder permissions are not the problem either. The relative path simply does not work.
When I put in the absolute path, however, it works fine....
I also have the same type of problem when calling an 'opendir' function.
I'm using Windows 2000 Server.
Any thoughts?
Thanks,
Travis

In reply to problems with relative paths when using open and opendir functions by Travis M.

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.