File Coverage

blib/lib/EPL2/Command/P.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::P;
2             # ABSTRACT: P Command (Print)
3             $EPL2::Command::P::VERSION = '0.001';
4 3     3   429 use 5.010;
  3         7  
5 3     3   422 use Moose;
  3         275359  
  3         16  
6 3     3   12988 use MooseX::Method::Signatures;
  3         860682  
  3         17  
7 3     3   475 use namespace::autoclean;
  3         5  
  3         23  
8 3     3   637 use EPL2::Types qw(Positive Natural);
  3         6  
  3         18  
9              
10             extends 'EPL2::Command';
11              
12             #Public Attributes
13             has number_sets => ( is => 'rw', isa => Positive, default => 1, );
14             has number_copies => ( is => 'rw', isa => Natural, default => 0, );
15              
16             #Methods
17 3     3   284624 method string ( Str :$delimiter = "\n" ) {
18             my $string = sprintf 'P%d', $self->number_sets;
19             $string .= ',' . $self->number_copies if ( $self->number_copies );
20             return $string . $delimiter;
21             }
22              
23             __PACKAGE__->meta->make_immutable;
24              
25             1;
26              
27             __END__
28              
29             =pod
30              
31             =encoding UTF-8
32              
33             =head1 NAME
34              
35             EPL2::Command::P - P Command (Print)
36              
37             =head1 VERSION
38              
39             version 0.001
40              
41             =head1 SYNOPSIS
42              
43             my $P = EPL2::Command::P->new;
44             say $P->string;
45              
46             =head1 ATTRIBUTES
47              
48             =head2 number_sets ( Positive default = 1 )
49              
50             Number of label sets.
51              
52             =head2 number_copies ( Natural default = 0 )
53              
54             Number of copies per set.
55              
56             =head1 METHODS
57              
58             =head2 string
59              
60             param: ( delimiter => "\n" )
61              
62             Return an EPL2 formatted string used for printing form.
63              
64             =head1 SEE ALSO
65              
66             L<EPL2>
67              
68             L<EPL2::Types>
69              
70             =head1 AUTHOR
71              
72             Ted Katseres <tedkat@cpan.org>
73              
74             =head1 COPYRIGHT AND LICENSE
75              
76             This software is copyright (c) 2016 by Ted Katseres.
77              
78             This is free software; you can redistribute it and/or modify it under
79             the same terms as the Perl 5 programming language system itself.
80              
81             =cut