Skip Menu |

This queue is for tickets about the Geo-Shapefile-Writer CPAN distribution.

Report information
The Basics
Id: 97611
Status: resolved
Priority: 0/
Queue: Geo-Shapefile-Writer

People
Owner: Nobody in particular
Requestors: SLAFFAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.004
Fixed in: (no value)



Subject: experimental warnings for given/when under perl 5.20
Thanks for this very useful module. given/when has been marked as experimental under Perl 5.20 so loading Geo::Shapefile::Writer raises experimental warnings. This is pretty easy to fix, and I'm happy to do so. Just let me know if there is a code repository somewhere to work from. Regards, Shawn.
Hi! The project lives at google-code: http://code.google.com/p/geo-shapefile-writer/ It would be very nice if you sent me a patch. Втр Июл 29 22:42:54 2014, SLAFFAN писал: Show quoted text
> Thanks for this very useful module. > > given/when has been marked as experimental under Perl 5.20 so loading > Geo::Shapefile::Writer raises experimental warnings. > > This is pretty easy to fix, and I'm happy to do so. Just let me know > if there is a code repository somewhere to work from. > > Regards, > Shawn.
Draft patch attached. Let me know if it needs tweaking. Regards, Shawn. On Wed Jul 30 03:43:49 2014, LIOSHA wrote: Show quoted text
> Hi! > > The project lives at google-code: http://code.google.com/p/geo- > shapefile-writer/ > > It would be very nice if you sent me a patch. > > > Втр Июл 29 22:42:54 2014, SLAFFAN писал:
> > Thanks for this very useful module. > > > > given/when has been marked as experimental under Perl 5.20 so loading > > Geo::Shapefile::Writer raises experimental warnings. > > > > This is pretty easy to fix, and I'm happy to do so. Just let me know > > if there is a code repository somewhere to work from. > > > > Regards, > > Shawn.
Subject: Writer.pm.patch
Index: lib/Geo/Shapefile/Writer.pm =================================================================== --- lib/Geo/Shapefile/Writer.pm (revision 15) +++ lib/Geo/Shapefile/Writer.pm (working copy) @@ -170,39 +170,38 @@ my ($xmin, $ymin, $xmax, $ymax); my $rdata; - given ( $self->{TYPE} ) { - when ( $shape_type{NULL} ) { - $rdata = pack( 'L', $self->{TYPE} ); - } + my $type = $self->{TYPE}; - when ( $shape_type{POINT} ) { - $rdata = pack( 'Ldd', $self->{TYPE}, @$data ); - ($xmin, $ymin, $xmax, $ymax) = ( @$data, @$data ); - } + if ($type == $shape_type{NULL} ) { + $rdata = pack( 'L', $self->{TYPE} ); + } + elsif ($type == $shape_type{POINT} ) { + $rdata = pack( 'Ldd', $self->{TYPE}, @$data ); + ($xmin, $ymin, $xmax, $ymax) = ( @$data, @$data ); + } + elsif ($type == $shape_type{POLYLINE} || $type == $shape_type{POLYGON} ) { + my $rpart = q{}; + my $rpoint = q{}; + my $ipoint = 0; - when ( [ @shape_type{'POLYLINE','POLYGON'} ] ) { - my $rpart = q{}; - my $rpoint = q{}; - my $ipoint = 0; - - for my $line ( @$data ) { - $rpart .= pack 'L', $ipoint; - for my $point ( @$line ) { - my ($x, $y) = @$point; - $rpoint .= pack 'dd', $x, $y; - $ipoint ++; - } + for my $line ( @$data ) { + $rpart .= pack 'L', $ipoint; + for my $point ( @$line ) { + my ($x, $y) = @$point; + $rpoint .= pack 'dd', $x, $y; + $ipoint ++; } + } - $xmin = min map {$_->[0]} map {@$_} @$data; - $ymin = min map {$_->[1]} map {@$_} @$data; - $xmax = max map {$_->[0]} map {@$_} @$data; - $ymax = max map {$_->[1]} map {@$_} @$data; + $xmin = min map {$_->[0]} map {@$_} @$data; + $ymin = min map {$_->[1]} map {@$_} @$data; + $xmax = max map {$_->[0]} map {@$_} @$data; + $ymax = max map {$_->[1]} map {@$_} @$data; - $rdata = pack 'LddddLL', $self->{TYPE}, $xmin, $ymin, $xmax, $ymax, scalar @$data, $ipoint; - $rdata .= $rpart . $rpoint; - } + $rdata = pack 'LddddLL', $self->{TYPE}, $xmin, $ymin, $xmax, $ymax, scalar @$data, $ipoint; + $rdata .= $rpart . $rpoint; } + my $attr0 = $attributes[0]; if ( ref $attr0 eq 'HASH' ) {
Updated, thanks Срд Июл 30 04:06:14 2014, SLAFFAN писал: Show quoted text
> Draft patch attached.