NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Passing hashref to constructor (Score:1)
and
Speed is not the only reason, and I believe its no
life is short
Re:Passing hashref to constructor (Score:1)
line number where I made the mistake, and not the line inside your
constructor where you assign @_ to an hash (the common approach).
That's what Perl Best Practices recommends too, I think,
although it looks terrible.
Reply to This
Parent
Re: (Score:1)
But truth be told, there is no need to use that trick to get the proper error line. If module authors that accept hashes add this line:
croak('FATAL: odd number of parameters, ') if @_ % 2;
(Use Carp qw( croak ) at the top also)
It would also work.
Best regards,
life is short