line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=======================================================================
|
2
|
|
|
|
|
|
|
# ____ ____ _____ _ ____ ___ ____
|
3
|
|
|
|
|
|
|
# | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
|
4
|
|
|
|
|
|
|
# | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
|
5
|
|
|
|
|
|
|
# | __/| |_| | _| _ _ / ___ \| __/| | / __/
|
6
|
|
|
|
|
|
|
# |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
|
7
|
|
|
|
|
|
|
#
|
8
|
|
|
|
|
|
|
# A Perl Module Chain to faciliate the Creation and Modification
|
9
|
|
|
|
|
|
|
# of High-Quality "Portable Document Format (PDF)" Files.
|
10
|
|
|
|
|
|
|
#
|
11
|
|
|
|
|
|
|
# Copyright 1999-2005 Alfred Reibenschuh .
|
12
|
|
|
|
|
|
|
#
|
13
|
|
|
|
|
|
|
#=======================================================================
|
14
|
|
|
|
|
|
|
#
|
15
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or
|
16
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
17
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
18
|
|
|
|
|
|
|
# version 2 of the License, or (at your option) any later version.
|
19
|
|
|
|
|
|
|
#
|
20
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
21
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
23
|
|
|
|
|
|
|
# Lesser General Public License for more details.
|
24
|
|
|
|
|
|
|
#
|
25
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
26
|
|
|
|
|
|
|
# License along with this library; if not, write to the
|
27
|
|
|
|
|
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
28
|
|
|
|
|
|
|
# Boston, MA 02111-1307, USA.
|
29
|
|
|
|
|
|
|
#
|
30
|
|
|
|
|
|
|
# $Id: ean13.pm,v 2.0 2005/11/16 02:18:23 areibens Exp $
|
31
|
|
|
|
|
|
|
#
|
32
|
|
|
|
|
|
|
#=======================================================================
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
package PDF::API3::Compat::API2::Resource::XObject::Form::BarCode::ean13;
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
BEGIN {
|
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
|
6
|
use PDF::API3::Compat::API2::Util;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
288
|
|
40
|
1
|
|
|
1
|
|
7
|
use PDF::API3::Compat::API2::Basic::PDF::Utils;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
161
|
|
41
|
1
|
|
|
1
|
|
7
|
use PDF::API3::Compat::API2::Resource::XObject::Form::BarCode;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
7
|
use POSIX;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
|
4093
|
use vars qw(@ISA $VERSION);
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
176
|
|
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
42
|
@ISA = qw( PDF::API3::Compat::API2::Resource::XObject::Form::BarCode );
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
51
|
( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:18:23 $
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
}
|
52
|
1
|
|
|
1
|
|
7
|
no warnings qw[ deprecated recursion uninitialized ];
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1654
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item $res = PDF::API3::Compat::API2::Resource::XObject::Form::BarCode::ea13->new $pdf
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns a ean13 object.
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub new {
|
61
|
0
|
|
|
0
|
1
|
|
my ($class,$pdf,%opts) = @_;
|
62
|
0
|
|
|
|
|
|
my $self;
|
63
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class;
|
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self=$class->SUPER::new($pdf,%opts);
|
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my @bar = $self->encode($opts{-code});
|
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$self->drawbar([@bar]);
|
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return($self);
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my @ean_code_odd =qw( 3211 2221 2122 1411 1132 1231 1114 1312 1213 3112 );
|
77
|
|
|
|
|
|
|
my @ean_code_even=qw( 1123 1222 2212 1141 2311 1321 4111 2131 3121 2113 );
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub encode {
|
80
|
0
|
|
|
0
|
0
|
|
my $self=shift @_;
|
81
|
0
|
|
|
|
|
|
my $string=shift @_;
|
82
|
0
|
|
|
|
|
|
my @c=split(//,$string);
|
83
|
0
|
|
|
|
|
|
my ($enc,@bar);
|
84
|
0
|
|
|
|
|
|
my $v=shift @c;
|
85
|
0
|
|
|
|
|
|
push(@bar,['07',"$v"]);
|
86
|
0
|
|
|
|
|
|
push(@bar,'a1a');
|
87
|
0
|
0
|
|
|
|
|
if($v==0) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
foreach(0..5) {
|
89
|
0
|
|
|
|
|
|
my $f=shift @c;
|
90
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
91
|
|
|
|
|
|
|
}
|
92
|
|
|
|
|
|
|
} elsif($v==1) {
|
93
|
0
|
|
|
|
|
|
my $f=shift @c;
|
94
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
95
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} elsif($v==2) {
|
101
|
0
|
|
|
|
|
|
my $f=shift @c;
|
102
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
103
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} elsif($v==3) {
|
109
|
0
|
|
|
|
|
|
my $f=shift @c;
|
110
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
111
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
} elsif($v==4) {
|
117
|
0
|
|
|
|
|
|
my $f=shift @c;
|
118
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
119
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
} elsif($v==5) {
|
125
|
0
|
|
|
|
|
|
my $f=shift @c;
|
126
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
127
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
} elsif($v==6) {
|
133
|
0
|
|
|
|
|
|
my $f=shift @c;
|
134
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
135
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} elsif($v==7) {
|
141
|
0
|
|
|
|
|
|
my $f=shift @c;
|
142
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
143
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
} elsif($v==8) {
|
149
|
0
|
|
|
|
|
|
my $f=shift @c;
|
150
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
151
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
} elsif($v==9) {
|
157
|
0
|
|
|
|
|
|
my $f=shift @c;
|
158
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
159
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_even[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
$f=shift @c; push(@bar,[$ean_code_odd[$f],"$f"]);
|
|
0
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
}
|
165
|
0
|
|
|
|
|
|
push(@bar,'1a1a1');
|
166
|
0
|
|
|
|
|
|
foreach(0..5) {
|
167
|
0
|
|
|
|
|
|
my $f=shift @c;
|
168
|
0
|
|
|
|
|
|
push(@bar,[$ean_code_odd[$f],"$f"]);
|
169
|
|
|
|
|
|
|
}
|
170
|
0
|
|
|
|
|
|
push(@bar,'a1a');
|
171
|
0
|
|
|
|
|
|
return @bar;
|
172
|
|
|
|
|
|
|
}
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
1;
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
__END__
|