[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl::Critic Tests

To summarise discussion about Perl::Critic policy 

Matt Trout raised an issue that this policy leads to surprising 
behaviour when a function is used in a hash assignment. This has lead to 
security issues in other projects.

As an example conside the following code:

sub get_value {
my %hash = (
     row => get_value(),
     id  => 1
use Data::Dumper;
print Dumper \%hash;

which returns:
$VAR1 = {
           '1' => undef,
           'row' => 'id'

There was also discussion in the chat room:

I prefer an explicit "return undef;" as I think it's clearer, more 
obvious about the intention and less magical. Eric suggests we problably 
want to switch from "no return at all" to "return undef".

I therefore propose that we do not enforce the 
ProhibitExplicitReturnUndef policy and will add a comment to the tests 
to explain why.

Thanks to k-man and dcg_mx for initiating and sharing the discussion 
with Matt Trout.


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Ledger-smb-devel mailing list