Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Replace explicit undef returns with bare returns #8
Explicitly returning undef can cause a subtle bug, where the return
This could be considered a controversial change, nevertheless, I thought I'd submit it just in case you want perlcritic compatability. If you don't want the change, just close unmerged, I won't be offended :-)
For the external API, this 100% must be done how Minion::Backend::Pg (the official backend) does it. So, if it's got bare returns, we can do bare returns. If it has explicit
The problem with defaulting to list context is that it can also create undesired behavior: Bare
my %vars = ( worker_info => $minion->worker(1)->info, );
I recall sri being proactive when that Bugzilla issue hit, so he probably went through and made sure every method had a single expected return context.
For the internal API (
So, if Minion::Backend::Pg also does bare return, then we must. Otherwise, we must keep it as-is to keep compatibility with the API.
I've tried to grok the code in https://github.com/kraih/minion/blob/master/lib/Minion/Backend/Pg.pm and it looks like explicit