Data/Riak/Fast/MapReduce/Phase/Link.pm

filter: Statementstmt 64.7% 11 / 17 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 0.0% 0 / 1 totaltotal 44.8% 13 / 29 CC 5 SCAR 30.8
CC
5
Cov
44%
pack
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 21.7
« Data/Riak/Fast/Link.pm ↑ Summary Data/Riak/Fast.pm »
1 package Data::Riak::Fast::MapReduce::Phase::Link;
2 22 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 22 ▶use JSON::XS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: Link phase of a MapReduce
7  
8 22 with ('Data::Riak::Fast::MapReduce::Phase');
9  
10 =head1 DESCRIPTION
11  
12 A map/reduce link phase for Data::Riak::Fast
13  
14 =head1 SYNOPSIS
15  
16 my $lp = Data::Riak::Fast::MapReduce::Phase::Link->new(
17 bucket=> "foo",
18 tag => "friend",
19 keep => 0
20 );
21  
22 =head2 bucket
23  
24 The name of the bucket from which links should be followed.
25  
26 =cut
27  
28 22 has bucket => (
29 is => 'rw',
30 isa => 'Str',
31 predicate => 'has_bucket'
32 );
33  
34 22 has phase => (
35 is => 'ro',
36 isa => 'Str',
37 default => 'link'
38 );
39  
40 =head2 tag
41  
42 The name of the tag of links that should be followed
43  
44 =cut
45  
46 22 has tag => (
47 is => 'rw',
48 isa => 'Str',
49 predicate => 'has_tag'
50 );
51  
52 =head1 METHOD
53 =head2 pack()
54  
55 Serialize this link phase.
56  
57 =cut
58  
59 0 ▶sub pack {
Subroutine pack: not called CC=5 SCAR=34.0
Pod undocumented
60 0 my $self = shift;
61  
62 0 my $href = {};
63  
64 0 ▶ $href->{keep} = $self->keep ? JSON::XS::true() : JSON::XS::false() if $self->has_keep;
Branch: 2 branches
BranchTrueFalseTotal
if $self->has_keep 0 0 0
$self->keep ? : 0 0 0
65 0 ▶ $href->{bucket} = $self->bucket if $self->has_bucket;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_bucket 0 0 0
66 0 ▶ $href->{tag} = $self->tag if $self->has_tag;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_tag 0 0 0
67  
68 0 $href;
69 }
70  
71 22 1;
« Data/Riak/Fast/Link.pm ↑ Summary Data/Riak/Fast.pm »