line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Barcode::Cuecat;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62;
|
4
|
1
|
|
|
1
|
|
661
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
621
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.20';
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new {
|
10
|
0
|
|
|
0
|
1
|
|
my $type = shift;
|
11
|
0
|
|
0
|
|
|
|
my $class = ref($type) || $type || "Barcode::Cuecat";
|
12
|
0
|
|
|
|
|
|
my $string = shift;
|
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my $self = bless [], $class;
|
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
$self->scan($string) if defined $string;
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
return $self;
|
19
|
|
|
|
|
|
|
}
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _decode {
|
22
|
0
|
|
|
0
|
|
|
my $input = shift;
|
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$input =~ tr/a-zA-Z0-9+-/ -_/;
|
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$input = unpack 'u', chr(32 + length($input)*3/4) . $input;
|
27
|
0
|
|
|
|
|
|
$input ^= "C" x length($input);
|
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $input;
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _cuecat_decode {
|
33
|
0
|
|
|
0
|
|
|
my $input = shift;
|
34
|
0
|
|
|
|
|
|
$input ^= chr(32) x length($input);
|
35
|
0
|
|
|
|
|
|
return join '', map {
|
36
|
0
|
|
|
|
|
|
$_ = sprintf("%02d", ord($_));
|
37
|
|
|
|
|
|
|
} split(//, $input);
|
38
|
|
|
|
|
|
|
}
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub scan ($) {
|
41
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
42
|
0
|
|
|
|
|
|
my $stuff = shift;
|
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return unless defined $stuff;
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my @items = (split(/\./, $stuff))[1..3];
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$self->[0] = _decode($items[0]);
|
49
|
0
|
|
|
|
|
|
$self->[1] = _decode($items[1]);
|
50
|
0
|
|
|
|
|
|
$self->[2] = _decode($items[2]);
|
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ($self->[1] =~ /^CC(.)/) {
|
53
|
0
|
|
|
|
|
|
$self->[1] = ':C1'; # Proprietary :CueCat
|
54
|
0
|
|
|
|
|
|
$self->[2] = _cuecat_decode($1 . $self->[2]);
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $self->[2];
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub serial {
|
61
|
0
|
|
|
0
|
1
|
|
return $_[0]->[0];
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub type {
|
65
|
0
|
|
|
0
|
1
|
|
return $_[0]->[1];
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub code {
|
69
|
0
|
|
|
0
|
1
|
|
return $_[0]->[2];
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1;
|
73
|
|
|
|
|
|
|
__END__
|