emilford has asked for the wisdom of the Perl Monks concerning the following question:
Someone else came behind and added code that basically checks for file existence:unless ($return = do $file) { warn "couldn't parse $file: $@" if $@; warn "couldn't do $file: $!" unless defined $return; warn "couldn't run $file" unless $return; }
This causes the second error check to fail. I print the error message and get "couldn't do file: No such file or directory". The file being checked for might not always exist. What gives? The file compiles correctly from the command line, yet fails with the doif (-e "/path/to/file") { # do something here; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with do and file existence.
by sauoq (Abbot) on Oct 04, 2005 at 15:20 UTC | |
by emilford (Friar) on Oct 04, 2005 at 15:43 UTC | |
by sauoq (Abbot) on Oct 04, 2005 at 15:50 UTC | |
by emilford (Friar) on Oct 04, 2005 at 15:57 UTC | |
by sauoq (Abbot) on Oct 04, 2005 at 16:02 UTC | |
|
Re: problem with do and file existence.
by Perl Mouse (Chaplain) on Oct 04, 2005 at 15:20 UTC | |
by emilford (Friar) on Oct 04, 2005 at 15:44 UTC | |
|
Re: problem with do and file existence.
by blazar (Canon) on Oct 04, 2005 at 15:31 UTC |