It was my understanding that most of the "automagic dereferencing" behaviors
are being removed because although they *usually* do what you mean, they
sometimes do not and that leads to mysterious and difficult to track down bugs.
Mark
On Tuesday, January 26, 2016 10:05 AM, Robert Stone via Houston
<[email protected]> wrote:
Greetings,
I've just released a heavily refactored version of my WWW::LogicBoxes module to
cpan (http://search.cpan.org/dist/WWW-LogicBoxes/lib/WWW/LogicBoxes.pm),
Huzzahs are in order!
However, cpan testers pointed out an issue to me:
Experimental keys on scalar is now forbidden at
/tmp/loop_over_bdir-8387-8qtZ5O/WWW-LogicBoxes-1.0.1-syf1_3/blib/lib/WWW/LogicBoxes/Role/Command/Raw.pm
line 165.
Looking at the perldiag documentation:
5.22
keys on reference is experimental(S experimental::autoderef) keys with a scalar
argument is experimental and may change or be removed in a future Perl version
5.23
Experimental %s on scalar is now forbidden(F) An experimental feature added in
Perl 5.14 allowed each, keys, push, pop, shift, splice, unshift, and values to
be called with a scalar argument. This experiment is considered unsuccessful,
and has been removed. The postderef feature may meet your needs better.
So, this code will now cause compilation failures:
my $hashref = { key => 'value',};
for my $key ( keys $hashref ) { print $key . "\n";}
And should instead be:
for my $key ( keys %{ $hashref } ) { print $key . "\n";}
Good times!
I have to admit that the later is more explicit but I kinda feel like this
violated the spirit of perl's "Do what I mean." Is there any more backstory,
or can anyone else put forward additional reasons as to why this functionality
is being removed?
Best Regards,Robert Stone
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/