Patch Barcode::DataMatrix to allow manual setting of matrix sizes.

Take maintainer.
This commit is contained in:
sthen 2016-05-18 10:31:26 +00:00
parent a46823c434
commit 79dd13eae9
3 changed files with 58 additions and 1 deletions

View File

@ -1,11 +1,14 @@
# $OpenBSD: Makefile,v 1.3 2016/03/26 12:46:09 sthen Exp $
# $OpenBSD: Makefile,v 1.4 2016/05/18 10:31:26 sthen Exp $
COMMENT = generate data for Data Matrix (IEC16022) barcodes
DISTNAME = Barcode-DataMatrix-0.08
REVISION = 0
CATEGORIES = graphics
MAINTAINER = Stuart Henderson <sthen@openbsd.org>
# Perl
PERMIT_PACKAGE_CDROM = Yes

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-lib_Barcode_DataMatrix_Engine_pm,v 1.1 2016/05/18 10:31:26 sthen Exp $
https://github.com/mstratman/Barcode-DataMatrix/pull/29
--- lib/Barcode/DataMatrix/Engine.pm.orig Thu Mar 24 20:06:06 2016
+++ lib/Barcode/DataMatrix/Engine.pm Tue May 17 16:42:57 2016
@@ -130,6 +130,7 @@ Convert a "width x height" format string into an inter
sub stringToFormat {
my $sz = shift;
return unless $sz;
+ return if $sz eq 'AUTO';
my ($w,$h) = map { +int } split /\s*x\s*/,$sz,2;
my $r;
for my $i (0..$#FORMATS) {

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-lib_Barcode_DataMatrix_pm,v 1.1 2016/05/18 10:31:26 sthen Exp $
https://github.com/mstratman/Barcode-DataMatrix/pull/29
--- lib/Barcode/DataMatrix.pm.orig Thu Mar 24 20:24:18 2016
+++ lib/Barcode/DataMatrix.pm Wed May 18 11:08:18 2016
@@ -10,6 +10,12 @@ has 'encoding_mode' => (
default => 'AUTO',
documentation => 'The encoding mode for the data matrix. Can be one of: ASCII C40 TEXT BASE256 NONE AUTO',
);
+has 'size' => (
+ is => 'ro',
+ isa => sub { my $type = shift; return 1 if defined Barcode::DataMatrix::Engine::stringToFormat $type; return 0; },
+ default => 'AUTO',
+ documentation => 'The module size for the data matrix. Can be one of: 10x10 12x12 14x14 16x16 18x18 20x20 22x22 24x24 26x26 32x32 36x36 40x40 44x44 48x48 52x52 64x64 72x72 80x80 88x88 96x96 104x104 120x120 132x132 144x144 8x18 8x32 12x26 12x36 16x36 16x48 AUTO',
+);
has 'process_tilde' => (
is => 'ro',
default => 0,
@@ -64,7 +70,7 @@ sub barcode {
my $engine = Barcode::DataMatrix::Engine->new(
$text,
$self->encoding_mode,
- undef, # size
+ $self->size,
$self->process_tilde,
);
@@ -89,6 +95,11 @@ sub barcode {
The encoding mode for the data matrix. Can be one of:
C<AUTO> (default), C<ASCII>, C<C40>, C<TEXT>, C<BASE256>, or C<NONE>.
+
+=head2 size
+
+The module size for the data matrix. Can be one of:
+C<AUTO> (default), 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>.
=head2 process_tilde