From: Dagfinn Ilmari Mannsåker Date: Sun, 17 Mar 2013 18:26:49 +0000 (+0000) Subject: Don't reimplement perl's built-in default behaviour X-Git-Tag: v0.011017~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5409185046eb2cd43ad9e5a5558548d249ae35a;p=dbsrgits%2FSQL-Translator.git Don't reimplement perl's built-in default behaviour Bare 'return;' is context sensitive already, and non-existing hash elements return undef. --- diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index fc5f3a7..1f5e6ac 100644 --- a/lib/SQL/Translator/Schema.pm +++ b/lib/SQL/Translator/Schema.pm @@ -499,7 +499,7 @@ Returns all the procedures as an array or array reference. } else { $self->error('No procedures'); - return wantarray ? () : undef; + return; } } @@ -553,7 +553,7 @@ Returns all the tables as an array or array reference. } else { $self->error('No tables'); - return wantarray ? () : undef; + return; } } @@ -599,7 +599,7 @@ Returns all the triggers as an array or array reference. } else { $self->error('No triggers'); - return wantarray ? () : undef; + return; } } @@ -645,7 +645,7 @@ Returns all the views as an array or array reference. } else { $self->error('No views'); - return wantarray ? () : undef; + return; } } diff --git a/lib/SQL/Translator/Schema/Role/Extra.pm b/lib/SQL/Translator/Schema/Role/Extra.pm index f87fd86..1dfd7a1 100644 --- a/lib/SQL/Translator/Schema/Role/Extra.pm +++ b/lib/SQL/Translator/Schema/Role/Extra.pm @@ -49,7 +49,7 @@ around extra => sub { my $extra = $self->$orig; if (@_==1) { - return exists($extra->{$_[0]}) ? $extra->{$_[0]} : undef ; + return $extra->{$_[0]}; } elsif (@_) { my %args = @_; diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index 7d2d534..a4ade98 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -442,7 +442,7 @@ sub get_constraints { } else { $self->error('No constraints'); - return wantarray ? () : undef; + return; } } @@ -464,7 +464,7 @@ sub get_indices { } else { $self->error('No indices'); - return wantarray ? () : undef; + return; } } @@ -515,7 +515,7 @@ sub get_fields { } else { $self->error('No fields'); - return wantarray ? () : undef; + return; } } @@ -845,7 +845,7 @@ sub field_names { } else { $self->error('No fields'); - return wantarray ? () : undef; + return; } }