line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Amazon::MWS::Enumeration; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
5
|
|
130286
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
5
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
5
|
|
10
|
use Exporter; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
192
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload ( |
9
|
|
|
|
|
|
|
'""' => \&as_string, |
10
|
9
|
|
|
12
|
|
3132
|
'cmp' => sub { "$_[0]" cmp $_[1] }, |
11
|
2
|
|
|
5
|
|
883
|
); |
|
2
|
|
|
|
|
833
|
|
|
2
|
|
|
|
|
23
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub as_string { |
14
|
14
|
|
|
17
|
1
|
209
|
my $self = shift; |
15
|
14
|
|
|
|
|
205
|
return $$self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub define { |
19
|
3
|
|
|
6
|
1
|
14
|
my $class = shift; |
20
|
2
|
|
|
5
|
|
253
|
no strict 'refs'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
330
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
9
|
*{"${class}::import"} = *Exporter::import; |
|
3
|
|
|
|
|
27
|
|
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
11
|
foreach my $const (@_) { |
25
|
22
|
|
|
|
|
46
|
my $string = $const; |
26
|
22
|
|
|
|
|
41
|
my $ref = \$string; |
27
|
22
|
|
|
|
|
47
|
bless $ref, $class; |
28
|
|
|
|
|
|
|
|
29
|
22
|
|
|
13
|
|
78
|
*{"${class}::$const"} = sub { $ref }; |
|
22
|
|
|
3
|
|
115
|
|
|
10
|
|
|
3
|
|
4936
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
3
|
|
|
|
30
|
22
|
|
|
|
|
46
|
push @{"${class}::EXPORT_OK"}, $const; |
|
22
|
|
|
|
|
86
|
|
31
|
22
|
|
|
|
|
42
|
push @{ ${"${class}::EXPORT_TAGS"}{'all'} }, $const; |
|
22
|
|
|
|
|
33
|
|
|
22
|
|
|
|
|
145
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Amazon::MWS::Enumeration |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Base class for enumeration values that stringify to themselves, used to |
46
|
|
|
|
|
|
|
represent the various enum values defined in the MWS api. Using these instead |
47
|
|
|
|
|
|
|
of just raw strings buys you compile-time checking to make sure you didn't |
48
|
|
|
|
|
|
|
misspell the rather long all-caps names. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use Amazon::MWS::Enumeration::FeedType qw(:all); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
_POST_PRODUCT_DATA_ # no warnings or strict violations, checked for typos! |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 define ( @constants ) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
For each string passed, installs a class method / exportable sub into the |
61
|
|
|
|
|
|
|
calling subclass by that name. The value returned by that sub will be an |
62
|
|
|
|
|
|
|
object blessed into the calling package which stringifies into the constant |
63
|
|
|
|
|
|
|
itself, e.g. $class->CONSTANT eq 'CONSTANT'; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 as_string () |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
The stringifier for these enums - simply dereferences the blessed scalar. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Paul Driver C<< frodwith@cpan.org >> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Copyright (c) 2009, Plain Black Corporation L<http://plainblack.com>. |
76
|
|
|
|
|
|
|
All rights reserved |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. |