lib/PAR/Filter/Bleach.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 23 CC 1 SCAR 6.9
CC
1
Cov
0%
apply
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package PAR::Filter::Bleach;
2 use 5.006;
3 use strict;
4 use warnings;
5 use base 'PAR::Filter';
6  
7 =head1 NAME
8  
9 PAR::Filter::Bleach - Bleach filter
10  
11 =head1 SYNOPSIS
12  
13 PAR::Filter::Bleach->apply(\$code); # transforms $code
14  
15 =head1 DESCRIPTION
16  
17 This filter removes all the unsightly printable characters from
18 your source file, using an algorithm similar to Damian Conway's
19 L<Acme::Bleach>.
20  
21 =cut
22  
23 sub apply {
24 my $ref = $_[1];
25  
26 $$ref = unpack("b*", $$ref);
27 $$ref =~ tr/01/ \t/;
28 $$ref =~ s/(.{9})/$1\n/g;
29 $$ref = q($_=<<'';y;\r\n;;d;y; \t;01;;$_=pack'b*',$_;$_=eval;$@&&die$@;$_)."\n$$ref\n\n";
30 }
31  
32 1;
33  
34 =head1 SEE ALSO
35  
36 L<PAR::Filter>
37  
38 =head1 AUTHORS
39  
40 Audrey Tang E<lt>cpan@audreyt.orgE<gt>
41  
42 You can write
43 to the mailing list at E<lt>par@perl.orgE<gt>, or send an empty mail to
44 E<lt>par-subscribe@perl.orgE<gt> to participate in the discussion.
45  
46 Please submit bug reports to E<lt>bug-par-packer@rt.cpan.orgE<gt>.
47  
48 =head1 COPYRIGHT
49  
50 Copyright 2003-2009 by Audrey Tang E<lt>cpan@audreyt.orgE<gt>.
51  
52 This program is free software; you can redistribute it and/or modify it
53 under the same terms as Perl itself.
54  
55 See F<LICENSE>.
56  
57 =cut