in reply to File Open Issue

Well it's windows what more can i say.....
Use your open function like this
open (FILE, "<..\\htdocs\\info.txt") || print........
Tell us if it works

``The wise man doesn't give the right answers, he poses the right questions.'' TIMTOWTDI

Replies are listed 'Best First'.
Re^2: File Open Issue
by Anonymous Monk on Jun 01, 2005 at 12:20 UTC
    Yes it's Windows, it didn't work like that.
Re^2: File Open Issue
by BrowserUk (Patriarch) on Jun 01, 2005 at 12:26 UTC

    If this would work on windows:

    open (FILE, "<..\\htdocs\\info.txt") || print........

    then this would also work on windows:

    open (FILE, "<../htdocs/info.txt") || print........
    Well it's windows what more can i say.....

    I'll let you decide ... but nothing would probably be appropriate.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
      That's way I am going trough this because this line of code,
      open (FILE, "<../info.txt") || print "There is no file here info.txt";

      doesn't work unless it has a absolute link, and I can't have it like that, it has to be relative.

        My post wasn't addressing your OP, just the misinformation that you have to use doubled backslashes instead of slashes on Windows.

        To address your problem, I think that you need to follow the advice of the other posters and add a  die $!; clause to your open and come back and tell us what error you are getting when the open fails.

        My guess (note: I do very little web server programming), is that the userid that your web server is running under is not allowed to access files/directories below your cgi-bin directory, and the error you are getting is "Permission denied".

        There are two ways of addressing that problem.

        1. Give your web server userid appropriate permissions to read the directory you are trying to access.

          I don't think that this is advisable as you are opening up your parts of your directory structure that should not be accessible from via the web server account. YOU PROBABLY SHOULD NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING OR TAKE ADVISE FROM SOMEONE WHO YOU TRUST DOES!

        2. Move the files you need your web server account to access into (a subdirectory) within your cgi-bin directory.

        If you *really* cannot put the files you are trying to access within/below you cgi-in directory, and if you are using NTFS on your webserver, you might also consider creating a junction to map the directory you need to access to a position within your cgi-bin directory. Note: You will need to read and understand the link I gave you, particularly the bit about using ACLs you secure the link.

        You'll also need to obtain the tools for doing this. I'd recommend you look at SysInternal's Junction utility, but make sure you understand the implications of doing this.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.