| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SVG::Barcode::Code128; |
|
2
|
2
|
|
|
2
|
|
143733
|
use parent 'SVG::Barcode'; |
|
|
2
|
|
|
|
|
628
|
|
|
|
2
|
|
|
|
|
13
|
|
|
3
|
2
|
|
|
2
|
|
25448
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
53
|
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
47
|
|
|
5
|
2
|
|
|
2
|
|
9
|
use utf8; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
10
|
|
|
6
|
2
|
|
|
2
|
|
49
|
use v5.24; |
|
|
2
|
|
|
|
|
7
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use feature 'signatures'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
145
|
|
|
8
|
2
|
|
|
2
|
|
10
|
no warnings 'experimental::signatures'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
62
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
9
|
use Exporter 'import'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
100
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw|plot_code128|; |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
1189
|
use Barcode::Code128; |
|
|
2
|
|
|
|
|
11055
|
|
|
|
2
|
|
|
|
|
153
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
554
|
use constant DEFAULTS => { |
|
18
|
|
|
|
|
|
|
lineheight => 30, |
|
19
|
|
|
|
|
|
|
linewidth => 1, |
|
20
|
|
|
|
|
|
|
textsize => 10, |
|
21
|
2
|
|
|
2
|
|
14
|
}; |
|
|
2
|
|
|
|
|
4
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
SVG::Barcode::_param(__PACKAGE__, $_, DEFAULTS->{$_}) for keys DEFAULTS->%*; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# functions |
|
26
|
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
1
|
13067
|
sub plot_code128 ($text, %params) { |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
16
|
|
|
28
|
2
|
|
|
|
|
17
|
return __PACKAGE__->new(%params)->plot($text); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# internal methods |
|
32
|
|
|
|
|
|
|
|
|
33
|
4
|
|
|
4
|
|
31111
|
sub _plot ($self, $text) { |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
26
|
|
|
|
4
|
|
|
|
|
14
|
|
|
34
|
4
|
|
33
|
|
|
39
|
$self->{plotter} ||= Barcode::Code128->new; |
|
35
|
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
77
|
my @code = split //, $self->{plotter}->barcode($text); |
|
37
|
4
|
|
|
|
|
1326
|
$self->_plot_1d(\@code, '#'); |
|
38
|
4
|
|
|
|
|
3292
|
$self->_plot_text($text); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding utf8 |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
SVG::Barcode::Code128 - Generator for SVG based Code 128 barcodes |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use SVG::Barcode::Code128; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $code128 = SVG::Barcode::Code128->new; |
|
54
|
|
|
|
|
|
|
my $svg = $code128->plot('https://perldoc.pl'); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$code128->linewidth; # 1 |
|
57
|
|
|
|
|
|
|
$code128->lineheight; # 30 |
|
58
|
|
|
|
|
|
|
$code128->textsize; # 10 |
|
59
|
|
|
|
|
|
|
# from SVG::Barcode: |
|
60
|
|
|
|
|
|
|
$code128->foreground; # black |
|
61
|
|
|
|
|
|
|
$code128->background; # white |
|
62
|
|
|
|
|
|
|
$code128->margin; # 2 |
|
63
|
|
|
|
|
|
|
$code128->id; |
|
64
|
|
|
|
|
|
|
$code128->class; |
|
65
|
|
|
|
|
|
|
$code128->width; |
|
66
|
|
|
|
|
|
|
$code128->height; |
|
67
|
|
|
|
|
|
|
$code128->scale; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my %params = ( |
|
70
|
|
|
|
|
|
|
lineheight => 40, |
|
71
|
|
|
|
|
|
|
textsize => 0, |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
$code128 = SVG::Barcode::Code128->new(%params); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# use as function |
|
76
|
|
|
|
|
|
|
use SVG::Barcode::Code128 'plot_code128'; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $svg = plot_code128('https://perldoc.pl', %params); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L is a generator for SVG based Code 128 barcodes. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 plot_code128 |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
use SVG::Barcode::Code128 'plot_code128'; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$svg = plot_code128($text, %params); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Returns a Code 128 barcode using the provided text and parameters. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 new |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$code128 = SVG::Barcode::Code128->new; # create with defaults |
|
99
|
|
|
|
|
|
|
$code128 = SVG::Barcode::Code128->new(\%params); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Creates a new Code 128 plotter. Inherited from L. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 METHODS |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 plot |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Creates a SVG code. Inherited from L. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 PARAMETERS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Inherited from L: |
|
112
|
|
|
|
|
|
|
L, |
|
113
|
|
|
|
|
|
|
L, |
|
114
|
|
|
|
|
|
|
L, |
|
115
|
|
|
|
|
|
|
L, |
|
116
|
|
|
|
|
|
|
L, |
|
117
|
|
|
|
|
|
|
L, |
|
118
|
|
|
|
|
|
|
L, |
|
119
|
|
|
|
|
|
|
L. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 lineheight |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$value = $code128->lineheight; |
|
124
|
|
|
|
|
|
|
$code128 = $code128->lineheight($newvalue); |
|
125
|
|
|
|
|
|
|
$code128 = $code128->lineheight(''); # 30 |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Getter and setter for the height of a line. Default C<30>. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 linewidth |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
$value = $code128->linewidth; |
|
132
|
|
|
|
|
|
|
$code128 = $code128->linewidth($newvalue); |
|
133
|
|
|
|
|
|
|
$code128 = $code128->linewidth(''); # 1 |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Getter and setter for the width of a single line. Default C<1>. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 textsize |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$value = $code128->textsize; |
|
140
|
|
|
|
|
|
|
$code128 = $code128->textsize($newvalue); |
|
141
|
|
|
|
|
|
|
$code128 = $code128->textsize(''); # 10 |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Getter and setter for the size of the text a the bottom. C<0> hides the text. Default C<10>. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 AUTHOR & COPYRIGHT |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
© 2019–2020 by Tekki (Rolf Stöckli). |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under the terms of the |
|
150
|
|
|
|
|
|
|
Artistic License version 2.0. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L, L. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |