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