in reply to Re^3: problem with do and file existence.
in thread problem with do and file existence.

It doesn't cause a return, but it is the last bit of code executed in x.cgi. By why would the file not existing cause x.cgi to return undef? How can this be resolved?
  • Comment on Re^4: problem with do and file existence.

Replies are listed 'Best First'.
Re^5: problem with do and file existence
by sauoq (Abbot) on Oct 04, 2005 at 16:02 UTC

    I was updating as you replied. The last expression evaluated is the value returned by do. If it is undef, then you can't tell it apart from the times when do returns an undef because the file doesn't compile or doesn't exist.

    If that if clause is the last thing being evaluated, and the file doesn't exist, it is evaluating to undef and being returned. (And setting $! to boot.) You can probably take care of it with else { return 0 } or similar.

    -sauoq
    "My two cents aren't worth a dime.";