line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
499
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Dancer2::Plugin::Interchange6::Cart::Product; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Dancer2::Plugin::Interchange6::Cart::Product |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Extends L<Interchange6::Cart::Product>. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
45
|
use Interchange6::Types -types; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
4360
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
18
|
1
|
|
|
1
|
|
298
|
use MooseX::CoverableModifiers; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
19
|
|
|
|
|
|
|
extends 'Interchange6::Cart::Product'; |
20
|
1
|
|
|
1
|
|
120
|
use namespace::clean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
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
|
68
|
|
|
68
|
|
153435
|
my $self = shift; |
63
|
68
|
|
|
|
|
973
|
$self->dbic_product->selling_price({quantity => $self->quantity}); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
after 'set_quantity' => sub { |
67
|
5
|
|
|
5
|
|
3910
|
shift->clear_selling_price; |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |