line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::CPI::Role::Item; |
2
|
|
|
|
|
|
|
# ABSTRACT: Role to represent a product in the cart |
3
|
4
|
|
|
4
|
|
1954
|
use Moo::Role; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
33
|
|
4
|
4
|
|
|
4
|
|
1204
|
use Business::CPI::Util::Types qw/Money/; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
44
|
|
5
|
4
|
|
|
4
|
|
1752
|
use Types::Standard qw/Str Int Num/; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.923'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has id => ( |
10
|
|
|
|
|
|
|
coerce => Str->coercion, |
11
|
|
|
|
|
|
|
isa => Str, |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has price => ( |
17
|
|
|
|
|
|
|
coerce => Money->coercion, |
18
|
|
|
|
|
|
|
isa => Money, |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
required => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has weight => ( |
24
|
|
|
|
|
|
|
coerce => Num->coercion, |
25
|
|
|
|
|
|
|
isa => Num, |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has shipping => ( |
30
|
|
|
|
|
|
|
coerce => Money->coercion, |
31
|
|
|
|
|
|
|
isa => Money, |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
predicate => 1, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has shipping_additional => ( |
37
|
|
|
|
|
|
|
coerce => Money->coercion, |
38
|
|
|
|
|
|
|
isa => Money, |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
predicate => 1, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has description => ( |
44
|
|
|
|
|
|
|
coerce => Str->coercion, |
45
|
|
|
|
|
|
|
isa => Str, |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has quantity => ( |
50
|
|
|
|
|
|
|
coercion => Int->coercion, |
51
|
|
|
|
|
|
|
isa => Int, |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
default => sub { 1 }, |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |