[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exclude patterns
--As of June 29, 2014 6:40:39 PM -0700, jerry is alleged to have said:
The one major thing is that you never close your big if statement
(`if ( -e $excludes_filename )`). I think that means this will work
fine until the first time you run it on a directory without an
excludes file - when it will silently do nothing.
*** Actually, that "if" is closed, just above the bottom foreach.
If there is no excludes file, it simply executes tarsnap, passing
it all the original ARGV stuff.
Nope. Ignore your indents, and actually check the balancing. The last
parens there closes the upper foreach, not the if. You need another
parens. ;) (perltidy or a code editor is your friend here.)
If you do close it there, it will work like you think it does. But because
you haven't, the if doesn't close until the end of the file, meaning
everything is conditional on the presence of the exclude file.
However, I do notice that I repeated the "delete leading and trailing
spaces" stuff. Also, one of the regexes looks a little bogus. I swear,
sometimes I look at stuff I wrote and wonder how it worked at all. :)
I noticed the repeated cleanup as well. I think the regrexes work, though
there are a couple that could probably be improved. You aren't actually
*using* Data::Dumper. You don't actually need a newline on $tarsnap_cmd.
And since you never use `$num_excludes`, there's no reason to slurp the
file. But those are all minor issues. ;) I've seen *far* worse. ;)
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------