File Coverage

blib/lib/Acme/BottomsUp.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Acme::BottomsUp;
2              
3 2     2   48599 use warnings;
  2         6  
  2         68  
4 2     2   20 use strict;
  2         5  
  2         106  
5              
6             our $VERSION = '0.02';
7              
8 2     2   2731 use Filter::Simple;
  2         82172  
  2         16  
9 2     2   2161 use PPI;
  2         430545  
  2         525  
10              
11             FILTER {
12             my $doc = PPI::Document->new(\$_);
13             $_ = join '',
14             map {
15             my $s = $_->content;
16             $s =~ s/;\s*$//s;
17             join("\n",
18             reverse
19             split "\n",
20             $s
21             ) . "\n;"
22             }
23             @{ $doc->find('PPI::Statement') };
24             };
25              
26             1;
27              
28             =pod
29              
30             =head1 NAME
31              
32             Acme::BottomsUp - Write individual statements backwards
33              
34             =head1 VERSION
35              
36             Version 0.02
37              
38             =head1 SYNOPSIS
39              
40             my @arr = (1..10);
41            
42             use Acme::BottomsUp;
43             @arr # first, start w/ numbers
44             grep { $_ % 2 } # then get the odd ones
45             map { $_**3 } # then cube each one
46             join ":", # and glue together
47             print # lastly, display result
48             ;
49             print "ok";
50             no Acme::BottomsUp;
51              
52             =head1 DESCRIPTION
53              
54             This module allows you to write multi-line perl statements in reverse order so that it "reads better". For example, normally one would write the code from the SYNOPSIS as:
55              
56             my @arr = (1..10);
57            
58             print # lastly, display result
59             join ":", # and glue together
60             map { $_**3 } # then cube each one
61             grep { $_ % 2 } # then get the odd ones
62             @arr # first, start with numbers
63             ;
64              
65             =head1 PREREQUISITES
66              
67             =over 4
68              
69             =item *
70              
71             L
72              
73             =item *
74              
75             L
76              
77             =back
78              
79             =head1 SEE ALSO
80              
81             L - Original location for RFC
82              
83             =head1 AUTHOR
84              
85             David Westbrook (davidrw), C<< >>
86              
87             =head1 BUGS
88              
89             Please report any bugs or feature requests to
90             C, or through the web interface at
91             L.
92             I will be notified, and then you'll automatically be notified of progress on
93             your bug as I make changes.
94              
95             I'm also available by email or via '/msg davidrw' on L.
96              
97             =head1 SUPPORT
98              
99             You can find documentation for this module with the perldoc command.
100              
101             perldoc Acme::BottomsUp
102              
103             You can also look for information at:
104              
105             =over 4
106              
107             =item * AnnoCPAN: Annotated CPAN documentation
108              
109             L
110              
111             =item * CPAN Ratings
112              
113             L
114              
115             =item * RT: CPAN's request tracker
116              
117             L
118              
119             =item * Search CPAN
120              
121             L
122              
123             =back
124              
125             =head1 COPYRIGHT & LICENSE
126              
127             Copyright 2006 David Westbrook, all rights reserved.
128              
129             This program is free software; you can redistribute it and/or modify it
130             under the same terms as Perl itself.
131              
132             =cut
133