line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Paper::Specs::base::brand; |
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
269
|
|
6
|
|
|
|
|
|
|
$VERSION=0.02; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 Paper::base::brand |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Base class for brand information |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$things = Paper::Brand->find( '1234'); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Returns things that match the supplied code. Typical code name normalization is applied |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub find { |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $code = $self->normalize( shift ); |
25
|
0
|
0
|
|
|
|
|
return "We need a code to search for\n" unless $code; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
eval "use ${self}::$code"; |
28
|
0
|
0
|
|
|
|
|
return "${self}::$code"->new unless $@; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
if ($Paper::Specs::debug) { |
31
|
0
|
|
|
|
|
|
warn $@; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return (); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item Class->normalize( code ) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Returnes a normalized code name for consistent searching. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
- strip leading zeros from the code name |
45
|
|
|
|
|
|
|
- strip leading spaces |
46
|
|
|
|
|
|
|
- switch to all lower case |
47
|
|
|
|
|
|
|
- switch spaces to "_" |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=back |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub normalize { |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
my $code=$_[1]; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$code =~ s/^0+//; |
58
|
0
|
|
|
|
|
|
$code =~ s/^\s+//; |
59
|
0
|
|
|
|
|
|
$code =~ s/\s+/_/; |
60
|
0
|
|
|
|
|
|
$code =~ tr/A-Z/a-z/; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $code; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|