naveedm9
Recent Actions
-
Commented on I hate unpacking sub calls with shift
We have started using https://metacpan.org/pod/Function::Parameters for everything at work. It's great. It uses perl's built in keyword api, not Devel::Declare. And the support for parameter type constraints makes our code a lot cleaner, safer, and self documenting....
-
Commented on Automatic variable highlighting in vim: the easy way
This is much better, thanks! Can you pull request this to https://github.com/pjcj/vim-hl-var ? Or create a new github project for it. Vim plugins are easier to manage via pathogen/vundle if they have a corresponding github repo....
-
Commented on Automatic variable highlighting in vim
Robin, Ultimatto, confuseAcat fixes the sigil negotiation and does it with much less and simpler code: https://blogs.perl.org/users/confuseacat/2014/05/automatic-variable-highlighting-in-vim-the-easy-way.html...
-
Commented on fatal warnings are a ticking time bomb (via chromatic)
@gvl, that would be too easy. Also, isn't chromatic guilty of doing a similar type of thing by enabling UNIVERSAL::isa inside of Test::MockObject, which modifies core functionality globally? I remember that causing me a load trouble because of incompatibilities between...
Comment Threads
-
Tim Bunce commented on
Automatic variable highlighting in vim
Damian Conway has implemented a typically awesome plugin for automatic variable highlighting (and more):
https://github.com/thoughtstream/Damian-Conway-s-Vim-Setup/blob/master/plugin/trackperlvars.vim
-
jakoblog.de commented on
I hate unpacking sub calls with shift
Function::Parameters is great but it won't become recommended best practice unless it is a core module or required by Moo.*.
-
pumpingcode commented on
I hate unpacking sub calls with shift
Newcomers need to understand that sub call arguments are passed in an array. And to appreciate the power of arrays, a programmer needs to understand how shift, unshift, pop, push etc are array operators.
I agree that placing a shift deep inside a subroutine is not helpful but this is more a poor coding style. One could also place a @_ on line 100 of the code.
My five cents-it is no big deal.
-
Tom Molesworth commented on
I hate unpacking sub calls with shift
$! is common enough that it shouldn't need comments, though?
If the argument is that people learning perl won't understand them, I'd disagree:
open my $fh, '
tends to be covered very early in most tutorials, and is also described in perldoc perlopentut. To some extent the same applies to $/, reading in paragraph mode or in fixed chunks is something that you encounter very early.…
-
Olivier Mengué (dolmen) commented on
I hate unpacking sub calls with shift
Note also that @_ is alias to arguments given to the sub which means that it gives you not only read access to the argument, but also write access if it is a variable.
my $a = 2; say $a;
sub change_arg_0
{
$_[0] = 1;
}change_arg_0($a);
say $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.