Subject: | avoid sprintf warning under 5.21+ |
Perl 5.21 introduces warnings when sprintf does not use all passed arguments. This is triggered in Geo::Shapefile::Writer::_get_header.
The attached patch avoids the warning by subscripting to use only the first two items in the passed array.
Regards,
Shawn.
Subject: | Writer.pm.patch |
Index: lib/Geo/Shapefile/Writer.pm
===================================================================
--- lib/Geo/Shapefile/Writer.pm (revision 16)
+++ lib/Geo/Shapefile/Writer.pm (working copy)
@@ -144,7 +144,7 @@
map {[ $_->[0], $_->[1], $_->[2] && ($self->{$_->[2]} // $self->{"$file_type$_->[2]"}) // $_->[3] ]}
@header_fields;
- my $pack_string = join q{ }, map { sprintf '@%d%s', @$_ } (@use_fields, [$header_size, q{}]);
+ my $pack_string = join q{ }, map { sprintf '@%d%s', @$_[0,1] } (@use_fields, [$header_size, q{}]);
return pack $pack_string, map { $_->[2] } @use_fields;
}
}