Reply/Plugin/Defaults.pm

filter: Statementstmt 33.9% 20 / 59 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 5 / 15 Podpod 70.0% 7 / 10 totaltotal 34.7% 32 / 92 CC 5 SCAR 12.3
CC
5
Cov
30%
compile
6.0
print_error
6.0
print_result
6.0
CRAP 3.4
« Reply/Plugin/Pager.pm ↑ Summary Reply/Plugin/DataPrinter.pm »
1 package Reply::Plugin::Defaults;
2 1 our $AUTHORITY = 'cpan:DOY';
3 1 $Reply::Plugin::Defaults::VERSION = '0.42';
4 # XXX Eval::Closure imposes its own hints on things that are eval'ed at the
5 # moment, but this may be fixed in the future
6 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 our $default_hints = $^H;
8 1 our $default_hinthash = { %^H };
9 1 our $default_warning_bits = ${^WARNING_BITS};
10 }
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use base 'Reply::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use Eval::Closure 0.11;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
20 0 my $class = shift;
21  
22 0 my $self = $class->SUPER::new(@_);
23 0 $self->{quit} = 0;
24  
25 0 return $self;
26 }
27  
28 0 ▶sub prompt { "> " }
Subroutine prompt: not called CC=1 SCAR=6.9
Pod documented
29  
30 0 ▶sub read_line {
Subroutine read_line: not called CC=1 SCAR=6.9
Pod documented
31 0 my $self = shift;
32 0 my ($next, $prompt) = @_;
33  
34 0 print $prompt;
35 0 return scalar <STDIN>;
36 }
37  
38 1 (my $PREFIX = <<'PREFIX') =~ s/__PACKAGE__/__PACKAGE__/ge;
39 BEGIN {
40 $^H = $__PACKAGE__::default_hints;
41 %^H = %$__PACKAGE__::default_hinthash;
42 ${^WARNING_BITS} = $__PACKAGE__::default_warning_bits;
43 }
44 3 PREFIX
45  
46 0 ▶sub compile {
Subroutine compile: not called CC=2 SCAR=17.9
Pod documented
47 0 my $self = shift;
48 0 my ($next, $line, %args) = @_;
49  
50 0 my $env = { map { %$_ } $self->publish('lexical_environment') };
51 0 my $package = ($self->publish('package'))[-1];
52 0 ▶ $package = 'main' unless defined $package;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $package 0 0 0
53  
54 0 my $prefix = "package $package;\n$PREFIX";
55  
56 0 my $code = eval_closure(
57 source => "sub {\n$prefix;\n$line\n}",
58 terse_error => 1,
59 alias => 1,
60 environment => $env,
61 %args,
62 );
63  
64 0 return $code;
65 }
66  
67 0 ▶sub execute {
Subroutine execute: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69 0 my ($next, $code, @args) = @_;
70  
71 0 return $code->(@args);
72 }
73  
74 0 ▶sub print_error {
Subroutine print_error: not called CC=2 SCAR=17.9
Pod documented
75 0 my $self = shift;
76 0 my ($next, $error) = @_;
77  
78 0 ▶ print $error
Branch: 1 branch
BranchTrueFalseTotal
if defined $error 0 0 0
79 if defined $error;
80 }
81  
82 0 ▶sub print_result {
Subroutine print_result: not called CC=2 SCAR=17.9
Pod documented
83 0 my $self = shift;
84 0 my ($next, @result) = @_;
85  
86 0 ▶ print @result, "\n"
Branch: 1 branch
BranchTrueFalseTotal
if @result 0 0 0
87 if @result;
88 }
89  
90 0 ▶sub command_q {
Subroutine command_q: not called CC=1 SCAR=6.9
Pod undocumented
91 0 my $self = shift;
92 0 $self->{quit} = 1;
93 0 return '';
94 }
95  
96 0 ▶sub command_vars {
Subroutine command_vars: not called CC=1 SCAR=6.9
Pod undocumented
97 0 my $self = shift;
98  
99 0 my %env = map { %$_ } $self->publish('lexical_environment');
100 0 return '(' . join(', ', map { qq<'$_'> } keys %env) . ')';
101 }
102  
103 0 ▶sub loop {
Subroutine loop: not called CC=2 SCAR=17.9
Pod documented
104 0 my $self = shift;
105 0 my ($continue) = @_;
106  
107 0 ▶ $continue = 0 if $self->{quit};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"quit"} 0 0 0
108  
109 0 return $continue;
110 }
111  
112 =begin Pod::Coverage
113  
114 new
115 command_q
116 command_vars
117  
118 =end Pod::Coverage
119  
120 =cut
121  
122 1 1;
« Reply/Plugin/Pager.pm ↑ Summary Reply/Plugin/DataPrinter.pm »