| 1 | package SVG::Barcode::DataMatrix; | ||||||||||||||||||||
| 2 | 2 | ▶ | use parent 'SVG::Barcode'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 2 | ▶ | use v5.24; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 2 | ▶ | use feature 'signatures'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | ▶ | no warnings 'experimental::signatures'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 2 | ▶ | use Exporter 'import'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 2 | our @EXPORT_OK = qw|plot_datamatrix|; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 2 | ▶ | use Barcode::DataMatrix; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 2 | our $VERSION = '0.13'; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 2 | use constant DEFAULTS => { | |||||||||||||||||||
| 18 | dotsize => 1, | ||||||||||||||||||||
| 19 | encoding_mode => 'AUTO', | ||||||||||||||||||||
| 20 | process_tilde => 0, | ||||||||||||||||||||
| 21 | size => 'AUTO', | ||||||||||||||||||||
| 22 | 2 | ▶ | }; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | SVG::Barcode::_param(__PACKAGE__, $_, DEFAULTS->{$_}) for keys DEFAULTS->%*; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | # functions | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | ▶ | sub plot_datamatrix ($text, %params) { | |||||||||||||||||||
|
Subroutine
plot_datamatrix: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 29 | 2 | return __PACKAGE__->new(%params)->plot($text); | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | # internal methods | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | ▶ | sub _plot ($self, $text) { | |||||||||||||||||||
|
Subroutine
_plot: called CC=2 SCAR=8.1
| |||||||||||||||||||||
| 35 | $self->{plotter} | ||||||||||||||||||||
| 36 | 4 | ▶ | ||= Barcode::DataMatrix->new($self->%{qw|encoding_mode process_tilde size|}); | ||||||||||||||||||
|
Condition33%1/3
$self->{"plotter"} ||= "Barcode::DataMatrix"->new(%$self{"encoding_mode", "process_tilde", "size"})
MC/DC0%0/2
$self->{"plotter"} ||= "Barcode::DataMatrix"->new(%$self{"encoding_mode", "process_tilde", "size"})
$self->{"plotter"}
"Barcode::DataMatrix"->new(%$self{"encoding_mode", "process_tilde", "size"})
Truth table33%1/3
A ||= B
A= $self->{"plotter"}B= "Barcode::DataMatrix"->new(%$self{"encoding_mode", "process_tilde", "size"})
| |||||||||||||||||||||
| 37 | 4 | $self->_plot_2d($self->{plotter}->barcode($text), 1); | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 2 | 1; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =encoding utf8 | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =head1 NAME | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | SVG::Barcode::DataMatrix - Generator for SVG based Data Matrix barcodes | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | =head1 SYNOPSIS | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | use SVG::Barcode::DataMatrix; | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | my $datamatrix = SVG::Barcode::DataMatrix->new; | ||||||||||||||||||||
| 53 | my $svg = $datamatrix->plot('https://perldoc.pl'); | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | $datamatrix->dotsize; # 1 | ||||||||||||||||||||
| 56 | $datamatrix->encoding_mode; # AUTO | ||||||||||||||||||||
| 57 | $datamatrix->process_tilde; # 0 | ||||||||||||||||||||
| 58 | $datamatrix->size; # AUTO | ||||||||||||||||||||
| 59 | # from SVG::Barcode: | ||||||||||||||||||||
| 60 | $datamatrix->foreground; # black | ||||||||||||||||||||
| 61 | $datamatrix->background; # white | ||||||||||||||||||||
| 62 | $datamatrix->margin; # 2 | ||||||||||||||||||||
| 63 | $datamatrix->id; | ||||||||||||||||||||
| 64 | $datamatrix->class; | ||||||||||||||||||||
| 65 | $datamatrix->width; | ||||||||||||||||||||
| 66 | $datamatrix->height; | ||||||||||||||||||||
| 67 | $datamatrix->scale; | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | my %params = ( | ||||||||||||||||||||
| 70 | level => 'H', | ||||||||||||||||||||
| 71 | margin => 4, | ||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||
| 73 | $datamatrix = SVG::Barcode::DataMatrix->new(%params); | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | # use as function | ||||||||||||||||||||
| 76 | use SVG::Barcode::DataMatrix 'plot_datamatrix'; | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | $svg = plot_datamatrix('https://perldoc.pl', %params); | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | =head1 DESCRIPTION | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | L<SVG::Barcode::DataMatrix> is a generator for SVG based Data Matrix barcodes. | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | =head1 FUNCTIONS | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | =head2 plot_datamatrix | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | use SVG::Barcode::DataMatrix 'plot_datamatrix'; | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | $svg = plot_datamatrix($text, %params); | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | Returns a Data Matrix using the provided text and parameters. | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | =head1 CONSTRUCTOR | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | =head2 new | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | $datamatrix = SVG::Barcode::DataMatrix->new; # create with defaults | ||||||||||||||||||||
| 99 | $datamatrix = SVG::Barcode::DataMatrix->new(%params); | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | Creates a new Data Matrix plotter. Inherited from L<SVG::Barcode|SVG::Barcode/new>. | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | =head1 METHODS | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | =head2 plot | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | $svg = $datamatrix->plot($text); | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | Creates a SVG code. Inherited from L<SVG::Barcode|SVG::Barcode/plot>. | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | =head1 PARAMETERS | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | Inherited from L<SVG::Barcode>: | ||||||||||||||||||||
| 114 | L<background|SVG::Barcode/background>, | ||||||||||||||||||||
| 115 | L<class|SVG::Barcode/class>, | ||||||||||||||||||||
| 116 | L<foreground|SVG::Barcode/foreground>, | ||||||||||||||||||||
| 117 | L<height|SVG::Barcode/height>, | ||||||||||||||||||||
| 118 | L<id|SVG::Barcode/id>, | ||||||||||||||||||||
| 119 | L<margin|SVG::Barcode/margin>, | ||||||||||||||||||||
| 120 | L<scale|SVG::Barcode/scale>, | ||||||||||||||||||||
| 121 | L<width|SVG::Barcode/width>. | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | =head2 dotsize | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | $value = $datamatrix->dotsize; | ||||||||||||||||||||
| 126 | $datamatrix = $datamatrix->dotsize($newvalue); | ||||||||||||||||||||
| 127 | $datamatrix = $datamatrix->dotsize(''); # 1 | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | Getter and setter for the size of the dots. Default C<1>. | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | =head2 encoding_mode | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | $value = $datamatrix->encoding_mode; | ||||||||||||||||||||
| 134 | $datamatrix = $datamatrix->encoding_mode($newvalue); | ||||||||||||||||||||
| 135 | $datamatrix = $datamatrix->encoding_mode(''); # AUTO | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | Getter and setter for the encoding mode. | ||||||||||||||||||||
| 138 | One of C<AUTO>, C<ASCII>, C<C40>, C<TEXT>, C<BASE256>, or C<NONE>. Default C<AUTO>. | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | =head2 process_tilde | ||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | $value = $datamatrix->process_tilde; | ||||||||||||||||||||
| 143 | $datamatrix = $datamatrix->process_tilde($newvalue); | ||||||||||||||||||||
| 144 | $datamatrix = $datamatrix->process_tilde(''); # 0 | ||||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | Getter and setter for the tilde flag. | ||||||||||||||||||||
| 147 | If set to C<1> the tilde character C<~> is being used to recognize special characters. | ||||||||||||||||||||
| 148 | Default C<0>. | ||||||||||||||||||||
| 149 | |||||||||||||||||||||
| 150 | =head2 size | ||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | $value = $datamatrix->size; | ||||||||||||||||||||
| 153 | $datamatrix = $datamatrix->size($newvalue); | ||||||||||||||||||||
| 154 | $datamatrix = $datamatrix->size(''); # AUTO | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | Getter and setter for the module size of the matrix. | ||||||||||||||||||||
| 157 | C<height x width>, one of C<AUTO>, C<10x10>, C<12x12>, C<14x14>, C<16x16>, C<18x18>, C<20x20>, C<22x22>, C<24x24>, C<26x26>, C<32x32>, C<36x36>, C<40x40>, C<44x44>, C<48x48>, C<52x52>, C<64x64>, C<72x72>, C<80x80>, C<88x88>, C<96x96>, C<104x104>, C<120x120>, C<132x132>, C<144x144>, C<8x18>, C<8x32>, C<12x26>, C<12x36>, C<16x36>, C<16x48>. | ||||||||||||||||||||
| 158 | Default C<AUTO>. | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | =head1 SEE ALSO | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | L<SVG::Barcode>, L<Barcode::DataMatrix>. | ||||||||||||||||||||
| 163 | |||||||||||||||||||||
| 164 | =head1 AUTHOR & COPYRIGHT | ||||||||||||||||||||
| 165 | |||||||||||||||||||||
| 166 | © 2019 by Tekki (Rolf Stöckli). | ||||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | =cut | ||||||||||||||||||||