File Coverage

blib/lib/HTML/Barcode/Code128.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package HTML::Barcode::Code128;
2 2     2   33472 use Any::Moose;
  2         69784  
  2         14  
3             extends 'HTML::Barcode::1D';
4 2     2   2183 use Barcode::Code128;
  2         4450  
  2         499  
5              
6             our $VERSION = '0.11';
7              
8             has '_code128' => (
9             is => 'ro',
10             default => sub { Barcode::Code128->new },
11             );
12              
13             sub barcode_data {
14 1     1 1 761 my ($self) = @_;
15 1         10 my $data_str = $self->_code128->barcode($self->text);
16             return [
17 1 100       417 map { $_ eq '#' ? 1 : 0 }
  101         203  
18             split //, $data_str
19             ];
20             }
21              
22             =head1 NAME
23              
24             HTML::Barcode::Code128 - Generate HTML representations of Code 128 barcodes
25              
26             =head1 SYNOPSIS
27              
28             L is required by this class, so please install it first.
29              
30             my $code = HTML::Barcode::Code128->new(text => 'MONKEY');
31             print $code->render;
32              
33             =head1 DESCRIPTION
34              
35             This class allows you to easily create HTML representations of Code 128 barcodes.
36              
37             =begin html
38              
39            

Here is an example of a Code 128 barcode rendered with this module:

40              
41            
MONKEY
42              
43             =end html
44              
45             This B L. You may also use the
46             L from this module in your text.
47             Be sure to provide their full package name.
48             For example:
49              
50             my $text = Barcode::Code128::FNC1 . '00000123455555555558';
51             HTML::Barcode::Code128->new(text => $text)->render;
52              
53             You can read more about Code 128 online (e.g. L).
54              
55             =head1 METHODS
56              
57             =head2 new (%attributes)
58              
59             Instantiate a new HTML::Barcode::Code128 object. The C<%attributes> hash
60             requires the L attribute, and can take any of the other
61             L listed below.
62              
63             =head2 render
64              
65             This is a convenience routine which returns C<< >> tags
66             and the rendered barcode.
67              
68             If you are printing multiple barcodes or want to ensure your C