in reply to OO sub, hash or hash reference.
Of course, you can add more checks and lots of cool stuff. But, that's basically the idea.sub someMethod { my $self = shift; my $hashRef; if (UNIVERSAL::isa($_[0], 'HASH')) { $hashRef = shift; } else { $hashRef = { @_ }; } }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: OO sub, hash or hash reference.
by dreadpiratepeter (Priest) on Feb 18, 2002 at 15:11 UTC | |
by IOrdy (Friar) on Feb 18, 2002 at 15:19 UTC |