File Coverage

blib/lib/Acme/Backwards.pm
Criterion Covered Total %
statement 81 132 61.3
branch 7 12 58.3
condition 7 18 38.8
subroutine 13 13 100.0
pod n/a
total 108 175 61.7


line stmt bran cond sub pod time code
1             package Acme::Backwards;
2             our $VERSION = '0.05';
3 3     3   172840 use Keyword::Declare;
  3         287888  
  3         31  
4 3     3   30 sub import {
  0         0  
5 3     3   71370 keytype OKAY is m{(?:fisle (?&PerlNWS)(?&PerlExpression).*?;|esle (?&PerlNWS).*?;)?+}xms;
  3         6  
6 0 50 50 3   0 keyword rof (/(my\s*\$\w+)?/ $declare, Expr $test, /.+?;$/ $code) {_backwards('for', ($declare ? $declare : ()), $test, $code);};
  0         0  
  0         0  
  3         51  
  3         155050  
  3         6  
  3         6  
  3         59  
7 0 50 50 4   0 keyword fi (Expr $test, /.+?;/ $code, OKAY @next) {_backwards('if', $test, $code)._process_backwards(@next);};
  0         0  
  0         0  
  0         0  
  3         13  
  3         6  
  3         26  
  4         208749  
  4         10  
  4         8  
  3         56  
8 0 50 50 1   0 keyword sselnu (Expr $test, /.+?;/ $code, OKAY @next) {_backwards('unless', $test, $code)._process_backwards(@next);};
  0         0  
  0         0  
  0         0  
  0         0  
  3         50  
  3         10  
  4         8  
  3         26  
  1         53056  
  1         4  
  1         3  
9 0         0 }
  0         0  
  4         68  
  3         9  
  1         2  
10 0     5   0 sub _process_backwards {join' ',map{$_=~m/(fisle|esle)(.*)$/;return"_$1"->($2)}@_;}
  0         0  
  0         0  
  3         83  
  3         5  
  1         18  
  5         63  
  3         29  
  3         80  
11 0     2   0 sub _esle {_backwards('else','',shift)}
  0         0  
  0         0  
  3         5  
  4         124  
  4         8  
  2         70  
12 0     1   0 sub _fisle {shift=~m/\s*((?&PerlExpression))\s*(.*?;) $PPR::GRAMMAR/gxm;_backwards('elsif', $1, $2);}
  0         0  
  0         0  
  0         0  
  3         38  
  4         1074  
  1         34  
  1         3  
  1         25300  
  1         81  
13 0 100   11   0 sub _backwards {scalar@_>3?sprintf"%s %s %s { %s }",@_:sprintf"%s %s { %s }",@_;}
  0         0  
  4         53  
  1         252  
  11         186  
14 0         0  
  0         0  
  0         0  
  3         56  
  3         10  
  1         16  
15 0         0 1;
  0         0  
  0         0  
  3         1243  
  4         52  
  4         7  
16 0         0 __END__