EvalServer/Language/Deparse.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 95.1% 39 / 41 CC 2 SCAR 2.0
CC
2
Cov
97%
evaluate
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« EvalServer/Language/Perl.pm ↑ Summary
1 package App::EvalServer::Language::Deparse;
2 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 $App::EvalServer::Language::Deparse::AUTHORITY = 'cpan:HINRIK';
4 }
5 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 $App::EvalServer::Language::Deparse::VERSION = '0.08';
7 }
8  
9 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use B::Deparse;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶sub evaluate {
Subroutine evaluate: called CC=2 SCAR=6.9
Pod undocumented
14 1 my ($package, $code) = @_;
15  
16 1 ▶ my $sub = eval "no strict; no warnings; sub{ $code\n }";
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶ print STDERR $@ if length($@);
Branch: 1 branch
BranchTrueFalseTotal
if length $@ 0 1 1
19 1 my $dp = B::Deparse->new(qw<-p -q -x7>);
20 1 my $ret = $dp->coderef2text($sub);
21  
22 1 $ret =~ s/\{//;
23 1 $ret =~ s/package (?:\w+(?:::)?)+;//;
24 1 $ret =~ s/ no warnings;//;
25 1 $ret =~ s/\s+/ /g;
26 1 $ret =~ s/\s*\}\s*$//;
27 1 $ret =~ s/^\s*//;
28  
29 1 return $ret;
30 }
31  
32 2 1;
33  
34 =encoding utf8
35  
36 =head1 NAME
37  
38 App::EvalServer::Language::Deparse - Deparse Perl code with B::Deparse
39  
40 =head1 AUTHOR
41  
42 Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com
43  
44 =head1 LICENSE AND COPYRIGHT
45  
46 Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson
47  
48 This program is free software, you can redistribute it and/or modify
49 it under the same terms as Perl itself.
50  
51 =cut
« EvalServer/Language/Perl.pm ↑ Summary