File Coverage

blib/lib/App/RecordStream/Clumper/Key/WrappedCallback.pm
Criterion Covered Total %
statement 29 30 96.6
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 0 5 0.0
total 37 44 84.0


line stmt bran cond sub pod time code
1             package App::RecordStream::Clumper::Key::WrappedCallback;
2              
3 4     4   23 use strict;
  4         9  
  4         88  
4 4     4   18 use warnings;
  4         8  
  4         871  
5              
6             sub new
7             {
8 192     192 0 331 my $class = shift;
9 192         304 my $next = shift;
10 192         291 my $bucket = shift;
11 192         310 my $name = shift;
12 192         307 my $value = shift;
13              
14 192         594 my $this =
15             {
16             'next' => $next,
17             'bucket' => $bucket,
18             'name' => $name,
19             'value' => $value,
20             };
21 192         380 bless $this, $class;
22              
23 192         440 return $this;
24             }
25              
26             sub key_clumper_callback_begin
27             {
28 34     34 0 52 my $this = shift;
29              
30 34         76 $this->key_clumper_callback_begin_value($this->{'value'});
31             }
32              
33             sub key_clumper_callback_begin_value
34             {
35 83     83 0 142 my $this = shift;
36 83         150 my $value = shift;
37              
38 83         151 my $name = $this->{'name'};
39 83         143 my $bucket = $this->{'bucket'};
40 83 50       191 if(!defined($bucket))
41             {
42 0         0 die "clumper_callback_begin() called in bucketless position (did you call begin() in your end()?)";
43             }
44              
45 83         380 return $this->{'next'}->clumper_callback_begin({%$bucket, $name => $value});
46             }
47              
48             sub key_clumper_callback_push_record
49             {
50 191     191 0 309 my $this = shift;
51 191         301 my $cookie = shift;
52 191         308 my $record = shift;
53              
54 191         568 $this->{'next'}->clumper_callback_push_record($cookie, $record);
55             }
56              
57             sub key_clumper_callback_end
58             {
59 83     83 0 138 my $this = shift;
60 83         129 my $cookie = shift;
61              
62 83         247 $this->{'next'}->clumper_callback_end($cookie);
63             }
64              
65             1;