Jon Jensen
- Website: www.endpointdev.com/team/jon-jensen/
Recent Actions
-
Commented on Are Restricted/Locked Hashes A Failed Experiment?
I've used restricted hashes in a few ecommerce situations where they were indispensable, exactly as important and useful as `use strict` for making sure lexical accesses aren't typos. I don't have any opinion about whether restricted hashes should be part...
Comment Threads
-
Andreas Koenig commented on
Are Restricted/Locked Hashes A Failed Experiment?
kid51: short example
% perl -le '
use Getopt::Long;
use Hash::Util qw(lock_keys);
lock_keys %Opt, qw(mrg);
GetOptions(\%Opt, "mrg=i") or die;
if ($Opt{mgr}){
print "INT=$Opt{mrg}";
}
'
Attempt to access disallowed key 'mgr' in a restricted hash at -e line 6.An example that combines with Pod::Usage:
http://repo.or.cz/cpan-testers-parsereport.git/blob/HEAD:/bin/ctgetreports
-
Mikko Koivunalho commented on
Are Restricted/Locked Hashes A Failed Experiment?
For me lock_keys is a typo checker, also but not limited for production code, also but not limited for blessed hashed.
-
Toby Inkster commented on
Are Restricted/Locked Hashes A Failed Experiment?
Locked hashes are great, but if the implementation is slowing down all hashes, then I agree they should no longer be built in, and should be moved to a module
That said, I think it's an important enough feature that this module should be bundled with Perl, so that people relying on fields.pm (which was first released with Perl 5.5) and Hash::Util (Perl 5.8) won't need to install anything extra.
-
Alceu Rodrigues de Freitas Junior commented on
Are Restricted/Locked Hashes A Failed Experiment?
I have used Hash::Utils more than once, specially in OOP projects that I was using "default" OOP model of Perl (not Moose or anything like that).
On the other hand, I usually don't start using it from scratch, usually when things starts to getting more complex and bugs starts to appear it is a sign that I should consider using it.
It is good to be have options... sometimes you need flexibility (like expanding a…
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.