Hopen/G/OutputOp.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 30 / 30 CC 3 SCAR 5.6
CC
3
Cov
100%
_run
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Hopen/Visitor.pm ↑ Summary Hopen/G/Goal.pm »
1 # Data::Hopen::G::OutputOp - operation with a fixed output
2 package Data::Hopen::G::OutputOp;
3 2 ▶use Data::Hopen;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Data::Hopen::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '0.000018';
8  
9 2 ▶use parent 'Data::Hopen::G::Op';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Class::Tiny qw(output);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # Docs {{{1
13  
14 =head1 NAME
15  
16 Data::Hopen::G::OutputOp - operation with a fixed output
17  
18 =head1 SYNOPSIS
19  
20 This is a L<Data::Hopen::G::Op> that simply outputs a fixed value you
21 provide. Usage:
22  
23 my $op = Data::Hopen::G::OutputOp(output => { foo => 42, bar => 1337 });
24  
25 =head1 MEMBERS
26  
27 =head2 output
28  
29 A hashref that will be the output.
30  
31 =cut
32  
33 # }}}1
34  
35 =head1 FUNCTIONS
36  
37 =head2 _run
38  
39 Implementation of L<Data::Hopen::G::Runnable/run>.
40  
41 =cut
42  
43 sub _run {
44 13 ▶ my $self = shift or croak 'Need an instance';
Subroutine _run: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("Need an instance") 1 12 13
45 12 ▶ croak 'output is not a hashref' unless ref $self->output eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->output eq "HASH" 1 11 12
46 11 return $self->output;
47 } #_run()
48  
49 2 1;
50 __END__
« Hopen/Visitor.pm ↑ Summary Hopen/G/Goal.pm »