File Coverage

blib/lib/Acme/Bleach.pm
Criterion Covered Total %
statement 6 10 60.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod 0 4 0.0
total 9 18 50.0


line stmt bran cond sub pod time code
1             package Acme::Bleach;
2             our $VERSION = '1.150';
3             my $tie = " \t"x8;
4 0     0 0 0 sub whiten { local $_ = unpack "b*", pop; tr/01/ \t/; s/(.{9})/$1\n/g; $tie.$_ }
  0         0  
  0         0  
  0         0  
5 2     2 0 4 sub brighten { local $_ = pop; s/^$tie|[^ \t]//g; tr/ \t/01/; pack "b*", $_ }
  2         465  
  2         9  
  2         248  
6 2     2 0 8 sub dirty { $_[0] =~ /\S/ }
7 2     2 0 35 sub dress { $_[0] =~ /^$tie/ }
8             open 0 or print "Can't rebleach '$0'\n" and exit;
9             (my $shirt = join "", <0>) =~ s/(.*)^\s*use\s+Acme::Bleach\s*;\n//sm;
10             my $coat = $1;
11             my $pressed = '#line ' . ("$coat\n" =~ tr/\n/\n/) . ' ' . (caller)[1] . "\n";
12             local $SIG{__WARN__} = \&dirty;
13             do {eval $coat . brighten $shirt; print STDERR $@ if $@; exit}
14             unless dirty $shirt && not dress $shirt;
15             open 0, ">$0" or print "Cannot bleach '$0'\n" and exit;
16             print {0} "${coat}use Acme::Bleach;\n", whiten $pressed.$shirt and exit;
17             __END__