| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
542
|
use utf8; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Dancer::Plugin::Interchange6::Cart::Product; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Dancer::Plugin::Interchange6::Cart::Product |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Extends L<Interchange6::Cart::Product>. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
49
|
use Interchange6::Types -types; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
3917
|
use Moo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
7
|
|
|
18
|
1
|
|
|
1
|
|
312
|
use MooseX::CoverableModifiers; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
19
|
|
|
|
|
|
|
extends 'Interchange6::Cart::Product'; |
|
20
|
1
|
|
|
1
|
|
114
|
use namespace::clean; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
See L<Interchange6::Cart::Product/ATTRIBUTES> for inherited attributes. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 dbic_product |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Used to stash the related L<Interchange6::Schema::Result::Product> object |
|
29
|
|
|
|
|
|
|
so that other accessors can be lazily built from it on demand. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Required. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has dbic_product => ( |
|
36
|
|
|
|
|
|
|
is => 'lazy', |
|
37
|
|
|
|
|
|
|
required => 1, |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 selling_price |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Inherited. Lazily set via L</dbic_product>. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item clearer: clear_selling_price |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=back |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L</clear_selling_price> is called whenever |
|
51
|
|
|
|
|
|
|
L<Interchange6::Cart::Product/set_quantity> gets called so that possible |
|
52
|
|
|
|
|
|
|
quantity based pricing is recalculated. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has '+selling_price' => ( |
|
57
|
|
|
|
|
|
|
is => 'lazy', |
|
58
|
|
|
|
|
|
|
clearer => 1, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _build_selling_price { |
|
62
|
75
|
|
|
75
|
|
170282
|
my $self = shift; |
|
63
|
75
|
|
|
|
|
1060
|
$self->dbic_product->selling_price({quantity => $self->quantity}); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
after 'set_quantity' => sub { |
|
67
|
12
|
|
|
12
|
|
7675
|
shift->clear_selling_price; |
|
68
|
|
|
|
|
|
|
}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |