perltidy and block labels

perltidy has its own mind at times. Most of the time, its mind is better than my hands reformatting code.

But I've been writing lots of test code recently and found that I use blocks and labels, along with nested blocks with labels. Stuff that looks like:
USER: {
my $shared_db_thingy = create_db_thingy( %params );

SKIP: {
# create user tests
skip 'DB Thingy not created', $test_count
unless $shared_db_thingy;

lives_ok { $shared_db_thingy->create_user( %user_parameters ) } 'create_user';
}

SKIP: {
# retrieve user tests
}
}
Frustratingly, perltidy likes to tidy this into:
USER: {
SKIP: {
}
SKIP: {
}
}
I had to do some real digging into perltidy to find the -ola that outdents labels.

Setting the -nola fixes it. And doesn't having any (seen) side effects.

w00t!

Comments

Popular posts from this blog

Template Toolkit Debugging inside of Perl Dancer

BootstrapX clickover

Changing Dancer::Plugin::Ajax's content type