API3/Compat/API2/Resource/XObject/Form/BarCode/codabar.pm

filter: Statementstmt 69.7% 23 / 33 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 50.0% 1 / 2 totaltotal 67.3% 31 / 46 CC 2 SCAR 7.4
CC
2
Cov
66%
new
6.0
encode_char
2.0
BEGIN
1.0
CRAP 2.1
« API3/Compat/API2/Resource/ExtGState.pm ↑ Summary API3.pm »
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: codabar.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::codabar;
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::codabar->new $pdf
54
55 Returns a codabar object.
56
57 =cut
58
59 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
60 0 my ($class,$pdf,%opts) = @_;
61 0 my $self;
62
63 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
64
65 0 $self=$class->SUPER::new($pdf,%opts);
66
67 0 my @bar = $self->encode($opts{-code});
68
69 0 $self->drawbar([@bar]);
70
71 0 return($self);
72 }
73
74
75 1 my $codabar=q|0123456789-$:/.+ABCD|;
76
77 1 my @barcodabar=qw(
78 11111221 11112211 11121121 22111111 11211211
79 21111211 12111121 12112111 12211111 21121111
80 11122111 11221111 21112121 21211121 21212111
81 11212121 11221211 12121121 12121121 11122211
82 );
83
84 0 ▶sub encode_char {
Subroutine encode_char: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my $self=shift @_;
86 0 my $char=uc(shift @_);
87 0 return($barcodabar[index($codabar,$char)]);
88 }
89
90
91
92
93 1 1;
94
95 __END__
« API3/Compat/API2/Resource/ExtGState.pm ↑ Summary API3.pm »