Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Simple r-copy style backup

by graff (Chancellor)
on Jul 07, 2009 at 22:04 UTC ( #778035=note: print w/replies, xml ) Need Help??


in reply to Simple r-copy style backup

You seem to be checking for a failure of "mkpath" (using an eval block), but in the case where that actually fails, you keep moving ahead as if it succeeded.

I would recommend that you put an additional check before the "opendir()" call:

if ( ! -d "$copy_to/$dir" ) { warn "Cannot copy/zip $src because $copy_to/$dir does not +exist\n"; next; } opendir( $dh, $src ); ...

Update: on closer inspection, I realize that you really are not checking for failure in that eval block:

eval { mkpath (["$copy_to/$dir"]); 1}
That always returns true (because of the "1" at the end) regardless of return value from mkpath. In other words, there's no need for the eval at all, because you are defeating its purpose with the final "1".

Replies are listed 'Best First'.
Re^2: Simple r-copy style backup
by Anonymous Monk on Jul 08, 2009 at 11:38 UTC
    Maybe there is a missing use autodie;?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://778035]
help
Chatterbox?
[james28909]: also remember, that if 'Today' is may 1, then Yesterday is not may 31 lol
[james28909]: theoretically speaking ofcourse
[james28909]: so if you subtracting as you loop, be aware that you will eventually be subtracting into a past month, or year <.<
[james28909]: dontcha love it!
[james28909]: Today would be scalar localtime. Yesterday would be scalar localtime - 1. sunday - monday would variate scalar localtime - ?
[james28909]: oops s/sunday - monday/sunday - saturday/
[james28909]: my mind is blown haha

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2017-04-29 03:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.