Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: -s testing for empty file; works on local, but not on remote

by ikegami (Pope)
on Sep 27, 2011 at 18:58 UTC ( #928145=note: print w/ replies, xml ) Need Help??


in reply to Re^2: -s testing for empty file; works on local, but not on remote
in thread -s testing for empty file; works on local, but not on remote

There is one difference:

If you don't check for errors, errors (incl non-existent files) being returned by -s will be mistaken as empty file.

If you don't check for errors, errors (incl non-existent files) being returned by -z will be mistaken as non-empty file.


Comment on Re^3: -s testing for empty file; works on local, but not on remote
Re^4: -s testing for empty file; works on local, but not on remote
by Jeri (Scribe) on Sep 27, 2011 at 19:03 UTC
    What exactly do you mean by 'error'? if the -s/-z can't figure if the file has anything in it or not?

      stat can fail for a number of reasons.

      Add the following before the if (-s) line:

      use Data::Dumper; print(Dumper(-s "/home/vcg/Documents/Trial/temp")); print(Dumper("$!"));

      What's the output?

Re^4: -s testing for empty file; works on local, but not on remote
by Jeri (Scribe) on Sep 27, 2011 at 19:15 UTC
    I see your point. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://928145]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2015-07-07 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls