diff -r f5f3abf44414 -r 7ce40ff50871 install --- a/install Sun Sep 01 12:13:15 2013 +0200 +++ b/install Sun Sep 01 12:59:13 2013 +0200 @@ -7,41 +7,48 @@ use Sys::Hostname; use autodie; use Getopt::Long; +use English qw(-no_match_vars); + +our $VERSION = '0.0'; my $opt_force = 0; GetOptions('f|force!' => \$opt_force) - or die "Usage: $0 [--force]\n"; + or die "Usage: $PROGRAM_NAME [--force]\n"; # list of files/dirs to exclude -my @exclude = map { qr/$_/ } qw( - ^\.\.?$ - ^\.hg$ -), basename $0; + +my @exclude = map { qr/$_/xms } qw( + ^\.\.?$ + ^\.hg$ + ), basename $PROGRAM_NAME; ... if $opt_force; -foreach my $this (grep { not $_ ~~ @exclude } glob('.*')) { +foreach my $this (grep { not $_ ~~ @exclude } glob q{.*}) { my $link = catfile $ENV{HOME}, $this; given ($link) { - when (not -e) { - { no autodie; unlink $link } # may be necessary if it's a broken symlink - symlink abs2rel($this, $ENV{HOME}) => $link; - say "$link linked"; - next; - } - when(not -l) { - warn "$link is not a link, skipping\n"; - next; - } - when(-l) { - my $dst = rel2abs(readlink, $ENV{HOME}); - next if $dst eq rel2abs($this); - warn "$link is a link to $dst, skipping\n"; - next; - } - default { ... } + when (not -e) { + { + no autodie; + unlink $link + } # may be necessary if it's a broken symlink + symlink abs2rel($this, $ENV{HOME}) => $link; + say "$link linked"; ## no critic + next; + } + when (not -l) { + warn "$link is not a link, skipping\n"; + next; + } + when (-l) { + my $dst = rel2abs(readlink, $ENV{HOME}); + next if $dst eq rel2abs($this); + warn "$link is a link to $dst, skipping\n"; + next; + } + default { ... } } }