John wrote:
> I have just started using perl critic to analyse my code.
>
> I have often used @_ as a temporary array like this:
[..]
> Critic complains with 'Always unpack @_ first', why?
> What is so wrong with this usage?
anthony.okusa...@usbank.com gave an excellent response to what perl critic
means by 'always unpack @_ first'.
What I'd add is that Critic correctly identified the problem, but gave the
wrong flag. The real problem here is
247. Don’t be clever.
People use @_ to pass parameters between subroutines. Use of @_ for
temporary variables (like heavy use of $_) is too clever.
Better would be
my @row_ary = $h_wk->selectrow_array("SELECT COUNT(*) FROM v_internals");
or even @temp_ary = to be more clear. When people (and modules like
Perl::Critic) see @_, they think subroutine variables.
--woody
--
Dr. Robert "Woody" GBS Cybersecurity &
Weaver Privacy
IT Security Architect Cell: 301-524-8138
--
What is wanted is not the will to believe, but the will to find out,
which is the exact opposite.
-- Bertrand Russell, "Skeptical Essays", 1928
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs