gnustavo / Git-Hooks

Framework for implementing Git (and Gerrit) hooks
http://search.cpan.org/dist/Git-Hooks/
41 stars 17 forks source link

Fix bug: return correctly from sub #72

Closed mikkoi closed 2 years ago

mikkoi commented 2 years ago

I was getting errors like this in Git when I pushed to remote host:

remote: Exiting subroutine via next at [..]/local/lib/perl5/Git/Hooks/CheckWhitespace.pm line 30.

The command next should not be used to return from a sub.

[..]
next cannot return a value from a block that typically returns a value,
such as eval {}, sub {}, or do {}. It will perform its flow control
behavior, which precludes any return value. It should not be used
to exit a grep or map operation.
[Perldoc function next, https://perldoc.perl.org/functions/next]

Signed-off-by: Mikko Johannes Koivunalho mikko.koivunalho@iki.fi

gnustavo commented 2 years ago

Thank you, Mikko.