Carp instead of croak when recoverable/abortable

main
Daniel Asher Resnick 11 months ago
parent 5dee70cd48
commit 06cf0a8c7a
  1. 8
      HexGrid/Tile.pm
  2. 2
      wiki-map.pl

@ -63,14 +63,14 @@ sub pin($this, $pin, $dock = undef)
{ {
foreach my $dock (keys %$pin) foreach my $dock (keys %$pin)
{ {
croak "dock $dock doesn't exist" unless grep { $_ eq $dock } keys %docks; (carp("dock $dock doesn't exist") && return) unless grep { $_ eq $dock } keys %docks;
$this->{pins}{$dock} = $pin->{$dock}; $this->{pins}{$dock} = $pin->{$dock};
} }
return; return;
} }
else else
{ {
croak "bad pin type"; carp ("bad pin type") && return;
} }
} }
@ -78,7 +78,7 @@ sub _do_pin($this, $pin, $dock = undef)
{ {
if($dock) if($dock)
{ {
croak "bad dock" unless $dock =~ /^sw|se|n$/i; (carp("bad dock") && retrun) unless $dock =~ /^sw|se|n$/i;
$this->{pins}{$dock} = $pin; $this->{pins}{$dock} = $pin;
} }
else else
@ -94,7 +94,7 @@ sub _do_pin($this, $pin, $dock = undef)
last DOCK; last DOCK;
} }
} }
croak "no free dock" unless $success; (carp("no free dock") && return) unless $success;
} }
} }

@ -419,7 +419,7 @@ if($regiondir)
{ {
say STDERR "Rendering Location $location_name\'s grid"; say STDERR "Rendering Location $location_name\'s grid";
open (my $location_fh, "> $location_name.$extension") open (my $location_fh, "> $location_name.$extension")
or croak "Couldn't open $location_name.extension for writing: $!"; or croak "Couldn't open $location_name.$extension for writing: $!";
say $location_fh ($html_document ? wrap_in_html($location_grid) : $location_grid->render); say $location_fh ($html_document ? wrap_in_html($location_grid) : $location_grid->render);
close $location_fh; close $location_fh;
} }

Loading…
Cancel
Save