File Coverage

blib/lib/Data/Result/Moo.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 3 3 100.0
total 34 34 100.0


line stmt bran cond sub pod time code
1             package Data::Result::Moo;
2              
3 1     1   122043 use Modern::Perl;
  1         2  
  1         7  
4 1     1   353 use Data::Result;
  1         3  
  1         30  
5 1     1   7 use Moo::Role;
  1         2  
  1         6  
6 1     1   316 use Carp qw(croak);
  1         1  
  1         49  
7 1     1   5 use namespace::clean;
  1         6  
  1         16  
8              
9              
10             =head1 NAME
11              
12             Data::Result::Moo - Data::Result Moo Role
13              
14             =head1 SYNOPSIS
15              
16             use Modern::Perl;
17             use Moo;
18             with('Data::Result::Moo);
19              
20             =head1 Description
21              
22             A simple Moo role wrapper for Data::Result
23              
24              
25             =head1 OO Methods
26              
27             =over 4
28              
29             =item * my $result->new_true($data,$extra|undef)
30              
31             Creates a new true Data::Result Object
32              
33             =item * my $result=$self->new_false($msg,$extra|undef)
34              
35             Creates a new false Data::Result Object
36              
37             =item * $class=$self->RESULT_CLASS;
38              
39             Returns the class being used to generate result object. Defaults to Data::Result;
40              
41             =cut
42              
43             sub new_true {
44 2     2 1 1575 my ($self,$data,$extra)=@_;
45 2         9 return $self->RESULT_CLASS->new_true($data,$extra);
46            
47             }
48              
49             sub new_false {
50 3     3 1 117 my ($self,$msg,$extra)=@_;
51 3 100       200 croak '$msg is a required argument' unless defined($msg);
52 2         8 return $self->RESULT_CLASS->new_false($msg,$extra);
53             }
54              
55 6     6 1 37 sub RESULT_CLASS { 'Data::Result' }
56              
57             =back
58              
59             =head1 Author
60              
61             Mike Shipper
62              
63             =cut
64              
65             1;