File Coverage

blib/lib/EPL2/Command/B.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 21 21 100.0


line stmt bran cond sub pod time code
1             package EPL2::Command::B;
2             # ABSTRACT: B Command (Bar code)
3             $EPL2::Command::B::VERSION = '0.001';
4 3     3   1298 use Moose;
  3         275768  
  3         15  
5 3     3   12882 use MooseX::Method::Signatures;
  3         864540  
  3         18  
6 3     3   420 use namespace::autoclean;
  3         5  
  3         20  
7 3     3   532 use EPL2::Types ( 'Natural', 'Rotation', 'Human', 'Barcode', 'Text' );
  3         4  
  3         16  
8 3     3   6556 use 5.010;
  3         7  
9              
10             extends 'EPL2::Command';
11              
12             #Public Attributes
13             has h_pos => ( is => 'rw', isa => Natural, default => 0 );
14             has v_pos => ( is => 'rw', isa => Natural, default => 0 );
15             has rotation => ( is => 'rw', isa => Rotation, default => 0 );
16             has barcode => ( is => 'rw', isa => Barcode, default => 3 );
17             has narrow_bar => ( is => 'rw', isa => Natural, default => 3 );
18             has wide_bar => ( is => 'rw', isa => Natural, default => 7 );
19             has height => ( is => 'rw', isa => Natural, default => 20 );
20             has human => ( is => 'rw', isa => Human, default => 'N' );
21             has text => ( is => 'ro', isa => Text, required => 1 );
22              
23             #Methods
24 3     3   272187 method string ( Str :$delimiter = "\n" ) {
25             sprintf 'B%d,%d,%d,%s,%d,%d,%d,%s,%s%s',
26             $self->h_pos, $self->v_pos, $self->rotation, $self->barcode, $self->narrow_bar,
27             $self->wide_bar, $self->height, $self->human, $self->text, $delimiter;
28             }
29              
30             __PACKAGE__->meta->make_immutable;
31              
32             1;
33              
34             __END__
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             EPL2::Command::B - B Command (Bar code)
43              
44             =head1 VERSION
45              
46             version 0.001
47              
48             =head1 SYNOPSIS
49              
50             my $B = EPL2::Command::B->new( text => q{"BARCODETEXT"} );
51             say $B->string;
52              
53             =head1 ATTRIBUTES
54              
55             =head2 text ( Text required )
56              
57             Text used to create barcode.
58              
59             =head2 h_pos ( Natural default = 0 )
60              
61             Horizontal Position in dots.
62              
63             =head2 v_pos ( Natural default = 0 )
64              
65             Vertical Position in dots.
66              
67             =head2 rotation ( Rotation default = 0 )
68              
69             Rotation of Barcode.
70              
71             =head2 barcode ( Barcode default = 3 )
72              
73             Type of Barcode.
74              
75             =head2 narrow_bar ( Natural default = 3 )
76              
77             Thickness of narrow bar.
78              
79             =head2 wide_bar ( Natural default = 7 )
80              
81             Thickness of wide bar.
82              
83             =head2 height ( Natural default = 20 )
84              
85             Height of barcode.
86              
87             =head2 human ( Human default = 'N' )
88              
89             Print Human readable text of barcode.
90              
91             =head1 METHODS
92              
93             =head2 string
94              
95             param: ( delimiter => "\n" )
96              
97             Return an EPL2 formatted string used for describing a barcode.
98              
99             =head1 SEE ALSO
100              
101             L<EPL2>
102              
103             L<EPL2::Types>
104              
105             =head1 AUTHOR
106              
107             Ted Katseres <tedkat@cpan.org>
108              
109             =head1 COPYRIGHT AND LICENSE
110              
111             This software is copyright (c) 2016 by Ted Katseres.
112              
113             This is free software; you can redistribute it and/or modify it under
114             the same terms as the Perl 5 programming language system itself.
115              
116             =cut