line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::DataMatrix; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
7
|
1
|
|
|
1
|
|
9808
|
use Term::ANSIColor; |
|
1
|
|
|
|
|
14668
|
|
|
1
|
|
|
|
|
521
|
|
8
|
|
|
|
|
|
|
require Barcode::DataMatrix; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
|
|
0
|
1
|
|
my($class, %args) = @_; |
12
|
0
|
|
0
|
|
|
|
bless { |
|
|
|
0
|
|
|
|
|
13
|
|
|
|
|
|
|
# Barcode::DataMatrix doesn't take any constructor params |
14
|
|
|
|
|
|
|
text_dmcode => Barcode::DataMatrix->new(), |
15
|
|
|
|
|
|
|
white_text => colored(' ', delete $args{white} || 'on_white'), |
16
|
|
|
|
|
|
|
black_text => colored(' ', delete $args{black} || 'on_black'), |
17
|
|
|
|
|
|
|
%args, |
18
|
|
|
|
|
|
|
}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub plot { |
22
|
0
|
|
|
0
|
1
|
|
my($self, $text) = @_; |
23
|
0
|
0
|
|
|
|
|
croak 'Not enough arguments for plot()' unless $text; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $arref = $self->{text_dmcode}->barcode($text); |
26
|
0
|
|
|
|
|
|
$self->_add_blank($arref); |
27
|
0
|
0
|
|
|
|
|
$self->{stdoutbuf} = join "\n", map { join '', map { |
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$_ ? $self->{black_text} : $self->{white_text} |
29
|
|
|
|
|
|
|
} @$_ } @$arref; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _add_blank { |
33
|
0
|
|
|
0
|
|
|
my($self, $ref) = @_; |
34
|
0
|
|
0
|
|
|
|
unshift @$_, 0 and push @$_, 0 for @$ref; |
35
|
0
|
|
|
|
|
|
unshift @$ref, [(0) x scalar @{$ref->[0]}]; |
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
push @$ref, [(0) x scalar @{$ref->[0]}]; |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
__END__ |