in reply to Re^3: print() on closed filehandle
in thread print() on closed filehandle

I am referring to a file that is on another drive, a shared network drive. But I have done this with the input file that is used in the same system call. The file name is fine and so is the directory path. The permissions on the directory are fine.

Replies are listed 'Best First'.
Re^5: print() on closed filehandle
by davido (Cardinal) on Dec 14, 2004 at 16:37 UTC

    Yes, but when you open, and check the return value as recommended previously with the "or die $!" conditional, what error gets printed? That's an important part of the puzzle, you've got to check it.

    There is a possibility that you don't have write permissions in the network drive, or that your script isn't running with the correct permissions (especially if it's a CGI script, or being called by a CGI script, for example).

    Or there could be a network issue. Just try it with that "open FH, '>', $filename or die $!" statement and see that the error message is.


    Dave

Re^5: print() on closed filehandle
by ikegami (Patriarch) on Dec 14, 2004 at 16:53 UTC
    If you're so sure the open worked, how come you can't print to the handle? What is the objection you have to adding an error check? As those to whom you came for help, we're telling you that you should check if open succeeded.
      I did check and it came back with the error message.
        So what was the error message? Did you figure out how to fix the problem?
Re^5: print() on closed filehandle
by fglock (Vicar) on Dec 14, 2004 at 16:46 UTC

    How you are reading the permissions? Reading FLAT_FILE requires less permissions than writing to OUTPUT_FILE.

      Please explain further.

        Win32 permissions can be quite complex. For example, you may have rights to add information to a file, but you may not be able to create a new file in the same directory. That's why the easier way to check for permissions is to verify whether open() succeeds of fails.