| 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 <areibens@cpan.org>. | ||||||||||||||||||||||||||||||||||||
| 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: code3of9.pm,v 2.0 2005/11/16 02:18:23 areibens Exp $ | ||||||||||||||||||||||||||||||||||||
| 31 | # | ||||||||||||||||||||||||||||||||||||
| 32 | #======================================================================= | ||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||
| 34 | package PDF::API3::Compat::API2::Resource::XObject::Form::BarCode::code3of9; | ||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use PDF::API3::Compat::API2::Util; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Utils; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | use PDF::API3::Compat::API2::Resource::XObject::Form::BarCode; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | use POSIX; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | use vars qw(@ISA $VERSION); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||
| 46 | 1 | @ISA = qw( PDF::API3::Compat::API2::Resource::XObject::Form::BarCode ); | |||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||
| 48 | 1 | ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:18:23 $ | |||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | no warnings qw[ deprecated recursion uninitialized ]; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | =item $res = PDF::API3::Compat::API2::Resource::XObject::Form::BarCode::code3of9->new $pdf | ||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||
| 55 | Returns a code3of9 object. | ||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||
| 57 | =cut | ||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 60 | 0 | my ($class,$pdf,%opts) = @_; | |||||||||||||||||||||||||||||||||||
| 61 | 0 | my $self; | |||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $class = ref $class if ref $class; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self=$class->SUPER::new($pdf,%opts); | |||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||
| 67 | 0 | my @bar; | |||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if($opts{-ext} && $opts{-chk}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$opts{"-ext"} and $opts{"-chk"}
MC/DC0%0/2
$opts{"-ext"} and $opts{"-chk"}
$opts{"-ext"}
$opts{"-chk"}
Truth table0%0/3
A and B
A= $opts{"-ext"}B= $opts{"-chk"}
| |||||||||||||||||||||||||||||||||||||
| 69 | 0 | @bar = &encode_3of9_ext_w_chk($opts{-code}); | |||||||||||||||||||||||||||||||||||
| 70 | } elsif($opts{-ext}) { | ||||||||||||||||||||||||||||||||||||
| 71 | 0 | @bar = &encode_3of9_ext($opts{-code}); | |||||||||||||||||||||||||||||||||||
| 72 | } elsif($opts{-chk}) { | ||||||||||||||||||||||||||||||||||||
| 73 | 0 | @bar = &encode_3of9_w_chk($opts{-code}); | |||||||||||||||||||||||||||||||||||
| 74 | } else { | ||||||||||||||||||||||||||||||||||||
| 75 | 0 | @bar = &encode_3of9($opts{-code}); | |||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||
| 78 | 0 | $self->drawbar([@bar]); | |||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||
| 80 | 0 | return($self); | |||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||
| 83 | 1 | my $code3of9 = q|1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*|; | |||||||||||||||||||||||||||||||||||
| 84 | 1 | my $code3of9_chk = q|0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%|; | |||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||
| 86 | 1 | my @bar3of9 = qw/ | |||||||||||||||||||||||||||||||||||
| 87 | 2112111121 1122111121 2122111111 1112211121 | ||||||||||||||||||||||||||||||||||||
| 88 | 2112211111 1122211111 1112112121 2112112111 | ||||||||||||||||||||||||||||||||||||
| 89 | 1122112111 1112212111 2111121121 1121121121 | ||||||||||||||||||||||||||||||||||||
| 90 | 2121121111 1111221121 2111221111 1121221111 | ||||||||||||||||||||||||||||||||||||
| 91 | 1111122121 2111122111 1121122111 1111222111 | ||||||||||||||||||||||||||||||||||||
| 92 | 2111111221 1121111221 2121111211 1111211221 | ||||||||||||||||||||||||||||||||||||
| 93 | 2111211211 1121211211 1111112221 2111112211 | ||||||||||||||||||||||||||||||||||||
| 94 | 1121112211 1111212211 2211111121 1221111121 | ||||||||||||||||||||||||||||||||||||
| 95 | 2221111111 1211211121 2211211111 1221211111 | ||||||||||||||||||||||||||||||||||||
| 96 | 1211112121 2211112111 1221112111 1212121111 | ||||||||||||||||||||||||||||||||||||
| 97 | 1212111211 1211121211 1112121211 abaababaa1 | ||||||||||||||||||||||||||||||||||||
| 98 | /; | ||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||
| 101 | 1 | my %bar3of9ext=( | |||||||||||||||||||||||||||||||||||
| 102 | "\x00" => '%U', | ||||||||||||||||||||||||||||||||||||
| 103 | "\x01" => '$A', | ||||||||||||||||||||||||||||||||||||
| 104 | "\x02" => '$B', | ||||||||||||||||||||||||||||||||||||
| 105 | "\x03" => '$C', | ||||||||||||||||||||||||||||||||||||
| 106 | "\x04" => '$D', | ||||||||||||||||||||||||||||||||||||
| 107 | "\x05" => '$E', | ||||||||||||||||||||||||||||||||||||
| 108 | "\x06" => '$F', | ||||||||||||||||||||||||||||||||||||
| 109 | "\x07" => '$G', | ||||||||||||||||||||||||||||||||||||
| 110 | "\x08" => '$H', | ||||||||||||||||||||||||||||||||||||
| 111 | "\x09" => '$I', | ||||||||||||||||||||||||||||||||||||
| 112 | "\x0a" => '$J', | ||||||||||||||||||||||||||||||||||||
| 113 | "\x0b" => '$K', | ||||||||||||||||||||||||||||||||||||
| 114 | "\x0c" => '$L', | ||||||||||||||||||||||||||||||||||||
| 115 | "\x0d" => '$M', | ||||||||||||||||||||||||||||||||||||
| 116 | "\x0e" => '$N', | ||||||||||||||||||||||||||||||||||||
| 117 | "\x0f" => '$O', | ||||||||||||||||||||||||||||||||||||
| 118 | "\x10" => '$P', | ||||||||||||||||||||||||||||||||||||
| 119 | "\x11" => '$Q', | ||||||||||||||||||||||||||||||||||||
| 120 | "\x12" => '$R', | ||||||||||||||||||||||||||||||||||||
| 121 | "\x13" => '$S', | ||||||||||||||||||||||||||||||||||||
| 122 | "\x14" => '$T', | ||||||||||||||||||||||||||||||||||||
| 123 | "\x15" => '$U', | ||||||||||||||||||||||||||||||||||||
| 124 | "\x16" => '$V', | ||||||||||||||||||||||||||||||||||||
| 125 | "\x17" => '$W', | ||||||||||||||||||||||||||||||||||||
| 126 | "\x18" => '$X', | ||||||||||||||||||||||||||||||||||||
| 127 | "\x19" => '$Y', | ||||||||||||||||||||||||||||||||||||
| 128 | "\x1a" => '$Z', | ||||||||||||||||||||||||||||||||||||
| 129 | "\x1b" => '%A', | ||||||||||||||||||||||||||||||||||||
| 130 | "\x1c" => '%B', | ||||||||||||||||||||||||||||||||||||
| 131 | "\x1d" => '%C', | ||||||||||||||||||||||||||||||||||||
| 132 | "\x1e" => '%D', | ||||||||||||||||||||||||||||||||||||
| 133 | "\x1f" => '$E', | ||||||||||||||||||||||||||||||||||||
| 134 | "\x20" => ' ', | ||||||||||||||||||||||||||||||||||||
| 135 | "!" => '/A', | ||||||||||||||||||||||||||||||||||||
| 136 | '"' => '/B', | ||||||||||||||||||||||||||||||||||||
| 137 | "#" => '/C', | ||||||||||||||||||||||||||||||||||||
| 138 | '$' => '/D', | ||||||||||||||||||||||||||||||||||||
| 139 | '%' => '/E', | ||||||||||||||||||||||||||||||||||||
| 140 | '&' => '/F', | ||||||||||||||||||||||||||||||||||||
| 141 | "'" => '/G', | ||||||||||||||||||||||||||||||||||||
| 142 | '(' => '/H', | ||||||||||||||||||||||||||||||||||||
| 143 | ')' => '/I', | ||||||||||||||||||||||||||||||||||||
| 144 | '*' => '/J', | ||||||||||||||||||||||||||||||||||||
| 145 | '+' => '/K', | ||||||||||||||||||||||||||||||||||||
| 146 | ',' => '/L', | ||||||||||||||||||||||||||||||||||||
| 147 | '-' => '-', | ||||||||||||||||||||||||||||||||||||
| 148 | '.' => '.', | ||||||||||||||||||||||||||||||||||||
| 149 | '/' => '/O', | ||||||||||||||||||||||||||||||||||||
| 150 | '0' => '0', | ||||||||||||||||||||||||||||||||||||
| 151 | '1' => '1', | ||||||||||||||||||||||||||||||||||||
| 152 | '2' => '2', | ||||||||||||||||||||||||||||||||||||
| 153 | '3' => '3', | ||||||||||||||||||||||||||||||||||||
| 154 | '4' => '4', | ||||||||||||||||||||||||||||||||||||
| 155 | '5' => '5', | ||||||||||||||||||||||||||||||||||||
| 156 | '6' => '6', | ||||||||||||||||||||||||||||||||||||
| 157 | '7' => '7', | ||||||||||||||||||||||||||||||||||||
| 158 | '8' => '8', | ||||||||||||||||||||||||||||||||||||
| 159 | '9' => '9', | ||||||||||||||||||||||||||||||||||||
| 160 | ':' => '/Z', | ||||||||||||||||||||||||||||||||||||
| 161 | ';' => '%F', | ||||||||||||||||||||||||||||||||||||
| 162 | '<' => '%G', | ||||||||||||||||||||||||||||||||||||
| 163 | '=' => '%H', | ||||||||||||||||||||||||||||||||||||
| 164 | '>' => '%I', | ||||||||||||||||||||||||||||||||||||
| 165 | '?' => '%J', | ||||||||||||||||||||||||||||||||||||
| 166 | '@' => '%V', | ||||||||||||||||||||||||||||||||||||
| 167 | 'A' => 'A', | ||||||||||||||||||||||||||||||||||||
| 168 | 'B' => 'B', | ||||||||||||||||||||||||||||||||||||
| 169 | 'C' => 'C', | ||||||||||||||||||||||||||||||||||||
| 170 | 'D' => 'D', | ||||||||||||||||||||||||||||||||||||
| 171 | 'E' => 'E', | ||||||||||||||||||||||||||||||||||||
| 172 | 'F' => 'F', | ||||||||||||||||||||||||||||||||||||
| 173 | 'G' => 'G', | ||||||||||||||||||||||||||||||||||||
| 174 | 'H' => 'H', | ||||||||||||||||||||||||||||||||||||
| 175 | 'I' => 'I', | ||||||||||||||||||||||||||||||||||||
| 176 | 'J' => 'J', | ||||||||||||||||||||||||||||||||||||
| 177 | 'K' => 'K', | ||||||||||||||||||||||||||||||||||||
| 178 | 'L' => 'L', | ||||||||||||||||||||||||||||||||||||
| 179 | 'M' => 'M', | ||||||||||||||||||||||||||||||||||||
| 180 | 'N' => 'N', | ||||||||||||||||||||||||||||||||||||
| 181 | 'O' => 'O', | ||||||||||||||||||||||||||||||||||||
| 182 | 'P' => 'P', | ||||||||||||||||||||||||||||||||||||
| 183 | 'Q' => 'Q', | ||||||||||||||||||||||||||||||||||||
| 184 | 'R' => 'R', | ||||||||||||||||||||||||||||||||||||
| 185 | 'S' => 'S', | ||||||||||||||||||||||||||||||||||||
| 186 | 'T' => 'T', | ||||||||||||||||||||||||||||||||||||
| 187 | 'U' => 'U', | ||||||||||||||||||||||||||||||||||||
| 188 | 'V' => 'V', | ||||||||||||||||||||||||||||||||||||
| 189 | 'W' => 'W', | ||||||||||||||||||||||||||||||||||||
| 190 | 'X' => 'X', | ||||||||||||||||||||||||||||||||||||
| 191 | 'Y' => 'Y', | ||||||||||||||||||||||||||||||||||||
| 192 | 'Z' => 'Z', | ||||||||||||||||||||||||||||||||||||
| 193 | '[' => '%K', | ||||||||||||||||||||||||||||||||||||
| 194 | '\\' => '%L', | ||||||||||||||||||||||||||||||||||||
| 195 | ']' => '%M', | ||||||||||||||||||||||||||||||||||||
| 196 | '^' => '%N', | ||||||||||||||||||||||||||||||||||||
| 197 | '_' => '%O', | ||||||||||||||||||||||||||||||||||||
| 198 | '`' => '%W', | ||||||||||||||||||||||||||||||||||||
| 199 | 'a' => '+A', | ||||||||||||||||||||||||||||||||||||
| 200 | 'b' => '+B', | ||||||||||||||||||||||||||||||||||||
| 201 | 'c' => '+C', | ||||||||||||||||||||||||||||||||||||
| 202 | 'd' => '+D', | ||||||||||||||||||||||||||||||||||||
| 203 | 'e' => '+E', | ||||||||||||||||||||||||||||||||||||
| 204 | 'f' => '+F', | ||||||||||||||||||||||||||||||||||||
| 205 | 'g' => '+G', | ||||||||||||||||||||||||||||||||||||
| 206 | 'h' => '+H', | ||||||||||||||||||||||||||||||||||||
| 207 | 'i' => '+I', | ||||||||||||||||||||||||||||||||||||
| 208 | 'j' => '+J', | ||||||||||||||||||||||||||||||||||||
| 209 | 'k' => '+K', | ||||||||||||||||||||||||||||||||||||
| 210 | 'l' => '+L', | ||||||||||||||||||||||||||||||||||||
| 211 | 'm' => '+M', | ||||||||||||||||||||||||||||||||||||
| 212 | 'n' => '+N', | ||||||||||||||||||||||||||||||||||||
| 213 | 'o' => '+O', | ||||||||||||||||||||||||||||||||||||
| 214 | 'p' => '+P', | ||||||||||||||||||||||||||||||||||||
| 215 | 'q' => '+Q', | ||||||||||||||||||||||||||||||||||||
| 216 | 'r' => '+R', | ||||||||||||||||||||||||||||||||||||
| 217 | 's' => '+S', | ||||||||||||||||||||||||||||||||||||
| 218 | 't' => '+T', | ||||||||||||||||||||||||||||||||||||
| 219 | 'u' => '+U', | ||||||||||||||||||||||||||||||||||||
| 220 | 'v' => '+V', | ||||||||||||||||||||||||||||||||||||
| 221 | 'w' => '+W', | ||||||||||||||||||||||||||||||||||||
| 222 | 'x' => '+X', | ||||||||||||||||||||||||||||||||||||
| 223 | 'y' => '+Y', | ||||||||||||||||||||||||||||||||||||
| 224 | 'z' => '+Z', | ||||||||||||||||||||||||||||||||||||
| 225 | '{' => '%P', | ||||||||||||||||||||||||||||||||||||
| 226 | '|' => '%Q', | ||||||||||||||||||||||||||||||||||||
| 227 | '}' => '%R', | ||||||||||||||||||||||||||||||||||||
| 228 | '~' => '%S', | ||||||||||||||||||||||||||||||||||||
| 229 | "\x7f" => '%T' | ||||||||||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub encode_3of9_char { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9_char: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $char=shift @_; | |||||||||||||||||||||||||||||||||||
| 234 | 0 | return($bar3of9[index($code3of9,$char)]); | |||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub encode_3of9_string { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $string=shift @_; | |||||||||||||||||||||||||||||||||||
| 239 | 0 | my $bar; | |||||||||||||||||||||||||||||||||||
| 240 | 0 | my @c=split(//,$string); | |||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||
| 242 | 0 | foreach my $char (@c) { | |||||||||||||||||||||||||||||||||||
| 243 | 0 | $bar.=encode_3of9_char($char); | |||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||
| 245 | 0 | return($bar); | |||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub encode_3of9_string_w_chk { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9_string_w_chk: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $string=shift @_; | |||||||||||||||||||||||||||||||||||
| 250 | 0 | my ($bar,$num); | |||||||||||||||||||||||||||||||||||
| 251 | 0 | my @c=split(//,$string); | |||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||
| 253 | 0 | foreach my $char (@c) { | |||||||||||||||||||||||||||||||||||
| 254 | 0 | $num+=index($code3of9_chk,$char); | |||||||||||||||||||||||||||||||||||
| 255 | 0 | $bar.=encode_3of9_char($char); | |||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||
| 257 | 0 | $num%=43; | |||||||||||||||||||||||||||||||||||
| 258 | 0 | $bar.=$bar3of9[$num]; | |||||||||||||||||||||||||||||||||||
| 259 | 0 | return($bar); | |||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | sub encode_3of9 { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $string=shift @_; | |||||||||||||||||||||||||||||||||||
| 264 | 0 | my @bar; | |||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||
| 266 | 0 | $string=uc($string); | |||||||||||||||||||||||||||||||||||
| 267 | 0 | $string=~s/[^0-9A-Z\-\.\ \$\/\+\%]+//g; | |||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||
| 269 | 0 | push(@bar, encode_3of9_char('*') ); | |||||||||||||||||||||||||||||||||||
| 270 | 0 | push(@bar, [ encode_3of9_string($string), $string ] ); | |||||||||||||||||||||||||||||||||||
| 271 | 0 | push(@bar, $bar[0] ); | |||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||
| 273 | 0 | return(@bar); | |||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | sub encode_3of9_w_chk { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9_w_chk: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 277 | 0 | my $string=shift @_; | |||||||||||||||||||||||||||||||||||
| 278 | 0 | my @bar; | |||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||
| 280 | 0 | $string=uc($string); | |||||||||||||||||||||||||||||||||||
| 281 | 0 | $string=~s/[^0-9A-Z\-\.\ \$\/\+\%]+//g; | |||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||
| 283 | 0 | push(@bar, encode_3of9_char('*') ); | |||||||||||||||||||||||||||||||||||
| 284 | 0 | push(@bar, [ encode_3of9_string_w_chk($string), $string ] ); | |||||||||||||||||||||||||||||||||||
| 285 | 0 | push(@bar, $bar[0] ); | |||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||
| 287 | 0 | return(@bar); | |||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | sub encode_3of9_ext { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9_ext: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 291 | 0 | my $string=shift @_; | |||||||||||||||||||||||||||||||||||
| 292 | 0 | my @c=split(//,$string); | |||||||||||||||||||||||||||||||||||
| 293 | 0 | my ($enc,@bar); | |||||||||||||||||||||||||||||||||||
| 294 | 0 | map { $enc.=$bar3of9ext{$_}; } (@c); | |||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||
| 296 | 0 | push(@bar, encode_3of9_char('*') ); | |||||||||||||||||||||||||||||||||||
| 297 | 0 | push(@bar, [ encode_3of9_string($enc), $string ] ); | |||||||||||||||||||||||||||||||||||
| 298 | 0 | push(@bar, $bar[0] ); | |||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||
| 300 | 0 | return(@bar); | |||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub encode_3of9_ext_w_chk { | ||||||||||||||||||||||||||||||||||
|
Subroutine
encode_3of9_ext_w_chk: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $string=shift @_; | |||||||||||||||||||||||||||||||||||
| 305 | 0 | my @c=split(//,$string); | |||||||||||||||||||||||||||||||||||
| 306 | 0 | my ($enc,@bar); | |||||||||||||||||||||||||||||||||||
| 307 | 0 | map { $enc.=$bar3of9ext{$_}; } (@c); | |||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||
| 309 | 0 | push(@bar, encode_3of9_char('*') ); | |||||||||||||||||||||||||||||||||||
| 310 | 0 | push(@bar, [ encode_3of9_string_w_chk($enc), $string ] ); | |||||||||||||||||||||||||||||||||||
| 311 | 0 | push(@bar, $bar[0] ); | |||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||
| 313 | 0 | return(@bar); | |||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||
| 316 | 1 | 1; | |||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||
| 318 | __END__ | ||||||||||||||||||||||||||||||||||||