Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Thursday January 04, 2007
02:17 AM

brian is a big, fat dumbass,'next' version

[ #32070 ]

It's not even a week into 2007 and I'm already a big dumbass. I have a little utility that cleans up a bunch of text files from the command line, and like a good little program it saves the original in a backup.

foreach my $file ( @ARGV )
    {
    if( -d $file )
        {
        warn "Skipping directory [$file]!\n";
        }
 
    my $bak = "$file.bak";
    rename( $file, $bak );
    ...
    }

I use this program and all of a sudden svn doesn't feel happy anymore because a lot of directories disappeared. Huh? I though I fixed this bug, and I'm pretty sure I did because I see the output "Skipping directory ...".

Well, let this be a lesson to you kids. You actually have to skip the directory to skip it. Perl doesn't have auto-next yet:

    if( -d $file )
        {
        warn "Skipping directory [$file]!\n";
        next;
        }

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.