me no reinvent wheels mon
| [reply] |
Using native Perl isn't "re-inventing wheels". Larry invented the wheels many years ago, your just using them.
Any api you or anyone devised to perform that operation would of necessity be either:
- So specific to that operation, that it would have no other use than that single operation.
It would have to be called something like:
sub createHoAoHfromAoHbyIndexingByTheValueOfOneKey{
my( $AoHref, $key ) = @_;
### About 20 lines of parameter checking and error reporting/excep
+tion
### handling here. Because unlike doing it in-line, the programmer
+ writing
### this function cannot know what the caller will pass him.
my %HoAoH;
push @{ $HoAoH{ delete $_->{ $key } } }, $_ for @$AoHref;
return \%HoAoH;
}
And to put that on CPAN, you'd need to wrap it in a package and add tests and documentation and dependencies and all bullshit--and how many times would it ever get used?
And all of that to replace one, simple, long existing, simple, intuitive wheel.
All it requires is for you to read the docs and apply a little thought; rather than expecting someone else to do your thinking for you.
- The only alternative would be some very generic, nested structure restructuring tool.
Something that could equally be used to do:createAoHoAfromHoHoAbyTheValueOfOneKeyFromTheHashAndTheValueOfTheThirdElementOfTheSecondArray()
And any API to do that kind of manipulation would have to be incredibly complex. Because it would essentially have to re-create all Perl's hash and array manipulation possibilities, without the benefit of Perl's very clear, concise and orthogonal syntax.
And the complexity of any such undertaking would simply be ridiculous to the point of absurdity.
You're not trying to avoid "reinventing wheels", just avoid having to think!
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
not only that, but getting a good module means it covers a lot of useful cases and might be useful in a lot of places.
I bend over backwards to find something on CPAN before writing new code.
All new code must be tested, documented thoroughly. The community aspect of CPAN leads to that being done for me automatically.
| [reply] |
| [reply] |