line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::BWIPP; |
2
|
3
|
|
|
3
|
|
62044
|
use 5.010; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
116
|
|
3
|
3
|
|
|
3
|
|
3312
|
use utf8; |
|
3
|
|
|
|
|
33
|
|
|
3
|
|
|
|
|
17
|
|
4
|
3
|
|
|
3
|
|
97
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
123
|
|
5
|
3
|
|
|
3
|
|
18
|
use warnings FATAL => 'all'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
131
|
|
6
|
3
|
|
|
3
|
|
2556
|
use English qw(-no_match_vars %LAST_PAREN_MATCH); |
|
3
|
|
|
|
|
12524
|
|
|
3
|
|
|
|
|
17
|
|
7
|
3
|
|
|
3
|
|
3682
|
use File::ShareDir qw(dist_file); |
|
3
|
|
|
|
|
18499
|
|
|
3
|
|
|
|
|
255
|
|
8
|
3
|
|
|
3
|
|
2696
|
use IO::File qw(); |
|
3
|
|
|
|
|
41844
|
|
|
3
|
|
|
|
|
101
|
|
9
|
3
|
|
|
3
|
|
3373
|
use Moose::Meta::Class qw(); |
|
3
|
|
|
|
|
579618
|
|
|
3
|
|
|
|
|
222
|
|
10
|
3
|
|
|
3
|
|
3212
|
use Moose qw(has); |
|
3
|
|
|
|
|
241986
|
|
|
3
|
|
|
|
|
32
|
|
11
|
3
|
|
|
3
|
|
5065
|
use MooseX::ClassAttribute qw(class_has); |
|
3
|
|
|
|
|
130832
|
|
|
3
|
|
|
|
|
22
|
|
12
|
3
|
|
|
3
|
|
5191
|
use Storable qw(dclone); |
|
3
|
|
|
|
|
10535
|
|
|
3
|
|
|
|
|
2965
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.007'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'barcode_source_handle' => ( |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
isa => 'IO::File', |
19
|
|
|
|
|
|
|
default => sub { |
20
|
|
|
|
|
|
|
return IO::File->new(dist_file('Alien-BWIPP', 'barcode.ps'), 'r'); |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has '_chunks' => (is => 'ro', isa => 'HashRef', lazy_build => 1,); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has '_encoders' => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'ArrayRef', |
29
|
|
|
|
|
|
|
lazy_build => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
class_has 'encoders_meta_classes' => (is => 'rw', isa => 'ArrayRef[Moose::Meta::Class]',); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _build__chunks { |
35
|
3
|
|
|
3
|
|
7
|
my ($self) = @_; |
36
|
3
|
|
|
|
|
5
|
my %chunks; |
37
|
|
|
|
|
|
|
{ |
38
|
3
|
|
|
|
|
7
|
while (defined(my $line = $self->barcode_source_handle->getline)) { |
|
3
|
|
|
|
|
102
|
|
39
|
22956
|
|
|
|
|
720220
|
state $block_type = 'HEADER'; |
40
|
22956
|
|
|
|
|
31180
|
state $block_name; |
41
|
|
|
|
|
|
|
|
42
|
22956
|
100
|
|
|
|
56573
|
if ($line =~ /\A% Barcode Writer in Pure PostScript - Version/) { |
43
|
3
|
|
|
|
|
10
|
$block_name = 'LICENCE'; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
22956
|
100
|
|
|
|
71889
|
if ($line =~ /\A %[ ]--BEGIN[ ](?<type>(?:RENDERER|ENCODER|RESOURCE))[ ](?<name>\w+)--/msx) { |
|
|
100
|
|
|
|
|
|
47
|
258
|
50
|
|
|
|
2597
|
$block_type = $LAST_PAREN_MATCH{type} if $LAST_PAREN_MATCH{type}; |
48
|
258
|
50
|
|
|
|
12832
|
$block_name = $LAST_PAREN_MATCH{name} if $LAST_PAREN_MATCH{name}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ($line =~ /\A % [ ] -- |
51
|
|
|
|
|
|
|
(?<feature_name>\w+) :? [ ]? |
52
|
|
|
|
|
|
|
(?<feature_value>.*?) |
53
|
|
|
|
|
|
|
(?:--)? \n \z/msx) { |
54
|
1554
|
100
|
|
|
|
23763
|
unless ($LAST_PAREN_MATCH{feature_name} =~ /^(?:BEGIN|END)$/) { |
55
|
1272
|
|
|
|
|
61829
|
$chunks{$block_type}{$block_name}{$LAST_PAREN_MATCH{feature_name}} |
56
|
|
|
|
|
|
|
= $LAST_PAREN_MATCH{feature_value}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else { |
60
|
21144
|
100
|
|
|
|
859777
|
$chunks{$block_type}{$block_name}{post_script_source_code} .= $line if $block_name; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
3
|
|
|
|
|
230
|
return \%chunks; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _build__encoders { |
68
|
3
|
|
|
3
|
|
9
|
my ($self) = @_; |
69
|
3
|
|
|
|
|
8
|
return [keys %{$self->_chunks->{ENCODER}}]; |
|
3
|
|
|
|
|
109
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub create_classes { |
73
|
3
|
|
|
3
|
1
|
3030
|
my ($self) = @_; |
74
|
3
|
|
|
|
|
7
|
my @meta_classes; |
75
|
3
|
|
|
|
|
8
|
my %chunks = %{$self->_chunks}; |
|
3
|
|
|
|
|
95
|
|
76
|
3
|
|
|
|
|
9
|
for my $encoder (@{$self->_encoders}) { |
|
3
|
|
|
|
|
146
|
|
77
|
243
|
|
|
|
|
1696
|
my $prepended = $chunks{HEADER}{LICENCE}{post_script_source_code}; |
78
|
243
|
|
|
|
|
805
|
for my $dependency_type (qw(REQUIRES SUGGESTS)) { |
79
|
486
|
100
|
|
|
|
2426
|
if (exists $chunks{ENCODER}{$encoder}{$dependency_type}) { |
80
|
243
|
|
|
|
|
1711
|
for my $dependency (split q{ }, $chunks{ENCODER}{$encoder}{$dependency_type}) { |
81
|
1074
|
|
|
|
|
1657
|
for my $resource_type (qw(RENDERER ENCODER RESOURCE)) { |
82
|
3222
|
100
|
|
|
|
11505
|
if (exists $chunks{$resource_type}{$dependency}{post_script_source_code}) { |
83
|
1038
|
|
|
|
|
8289
|
$prepended .= $chunks{$resource_type}{$dependency}{post_script_source_code}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
243
|
|
|
|
|
1436
|
my $class_name = $self->meta->name . q{::} . $encoder; |
91
|
243
|
|
|
|
|
7833
|
my $meta_class = Moose::Meta::Class->create($class_name, |
92
|
|
|
|
|
|
|
superclasses => ['Moose::Object'],); |
93
|
243
|
|
|
|
|
31621
|
for my $attribute_name (keys %{$chunks{ENCODER}{$encoder}}) { |
|
243
|
|
|
|
|
1378
|
|
94
|
1458
|
|
|
|
|
2651628
|
my $attribute_value = $chunks{ENCODER}{$encoder}{$attribute_name}; |
95
|
1458
|
50
|
|
|
|
5204
|
$attribute_value = dclone($attribute_value) if ref $attribute_value; |
96
|
1458
|
100
|
|
|
|
19534
|
$attribute_value = $prepended . $attribute_value |
97
|
|
|
|
|
|
|
if 'post_script_source_code' eq $attribute_name; |
98
|
6
|
|
|
6
|
|
1478
|
$meta_class->add_attribute($attribute_name => |
99
|
1458
|
|
|
|
|
8989
|
(is => 'ro', default => sub {return $attribute_value;},)); |
100
|
|
|
|
|
|
|
} |
101
|
243
|
|
|
|
|
536050
|
push @meta_classes, $meta_class; |
102
|
|
|
|
|
|
|
} |
103
|
3
|
|
|
|
|
217
|
$self->encoders_meta_classes([@meta_classes]); |
104
|
3
|
|
|
|
|
85
|
return; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub import { |
108
|
3
|
|
|
3
|
|
31
|
my ($class) = @_; |
109
|
3
|
|
|
|
|
34
|
$class->new->create_classes; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=encoding UTF-8 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 NAME |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Alien::BWIPP - Barcode Writer in Pure PostScript |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 VERSION |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This document describes C<Alien::BWIPP> version C<0.007>. It is based on |
126
|
|
|
|
|
|
|
I<Barcode Writer in Pure PostScript> version C<2014-07-30-1>. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SYNOPSIS |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
use Alien::BWIPP; |
132
|
|
|
|
|
|
|
say $_->name for @{Alien::BWIPP->encoders_meta_classes}; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DESCRIPTION |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This modules builds encoder classes from PostScript source. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 INTERFACE |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 C<import> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Class method, automatically called by L<use>. Creates an instance and calls |
144
|
|
|
|
|
|
|
L</create_classes>. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 C<create_classes> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Method, builds encoder classes. The generated classes may have the following |
149
|
|
|
|
|
|
|
attributes: |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item C<post_script_source_code> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Ready to use PostScript source code, concatenated from the encoder source |
156
|
|
|
|
|
|
|
code and the renderer needed by it. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item DESC |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Human readable description of this encoder. Example: |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
AusPost 4 State Customer Code |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item EXAM |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Example string for this encoder. Example: |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
0123456789 |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item EXOP |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Stringified list of example options for this encoder. Example: |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
includetext includecheck includecheckintext |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item RNDR |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Stringified list of renderers needed for this encoder. Example: |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
renlinear renmatrix |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item REQUIRES |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item SUGGESTS |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=back |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 C<encoders_meta_classes> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Class Attribute, returns the generated meta classes as |
191
|
|
|
|
|
|
|
ArrayRef[L<Moose::Meta::Class>]. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 EXPORTS |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Nothing. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
None. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
C<Alien::BWIPP> requires no configuration files or environment variables. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 Configure time |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Perl 5.10, L<Module::Build> >= 0.35_14 |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head2 Run time |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head3 core modules |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Perl 5.10, L<English>, L<IO::File>, L<Storable> |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head3 CPAN modules |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
L<File::ShareDir>, L<Moose>, L<Moose::Meta::Class>, L<MooseX::ClassAttribute> |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
None reported. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
No bugs have been reported. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
236
|
|
|
|
|
|
|
L<http://github.com/mcnewton/Alien-BWIPP/issues>, |
237
|
|
|
|
|
|
|
or send an email to the maintainer. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 TO DO |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
No future plans yet. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Suggest more future plans by L<filing a bug|/"BUGS AND LIMITATIONS">. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head1 AUTHOR |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head2 Original author |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Lars Dɪá´á´á´á´á´¡ C<< <daxim@cpan.org> >> |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head2 Current maintainer |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Matthew Newton C<< <mcnewton@cpan.org> >> |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 Contributors |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
See file F<AUTHORS>. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 F<barcode.ps> |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Barcode Writer in Pure PostScript - Version 2014-07-30-1 |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Copyright © 2004-2014 Terry Burton C<< <tez@terryburton.co.uk> >> |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any |
272
|
|
|
|
|
|
|
person obtaining a copy of this software and associated |
273
|
|
|
|
|
|
|
documentation files (the "Software"), to deal in the |
274
|
|
|
|
|
|
|
Software without restriction, including without |
275
|
|
|
|
|
|
|
limitation the rights to use, copy, modify, merge, |
276
|
|
|
|
|
|
|
publish, distribute, sublicense, and/or sell copies of |
277
|
|
|
|
|
|
|
the Software, and to permit persons to whom the Software |
278
|
|
|
|
|
|
|
is furnished to do so, subject to the following |
279
|
|
|
|
|
|
|
conditions: |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
The above copyright notice and this permission notice |
282
|
|
|
|
|
|
|
shall be included in all copies or substantial portions |
283
|
|
|
|
|
|
|
of the Software. |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
286
|
|
|
|
|
|
|
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
287
|
|
|
|
|
|
|
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
288
|
|
|
|
|
|
|
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
289
|
|
|
|
|
|
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
290
|
|
|
|
|
|
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
291
|
|
|
|
|
|
|
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
292
|
|
|
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
293
|
|
|
|
|
|
|
IN THE SOFTWARE. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head2 All other files |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
Copyright © 2010 Lars Dɪá´á´á´á´á´¡ C<< <daxim@cpan.org> >> |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Distributable under the same licence. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 SEE ALSO |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
homepage L<http://bwipp.terryburton.co.uk/>, |
306
|
|
|
|
|
|
|
manual L<https://github.com/bwipp/postscriptbarcode/wiki> |