Another New module on its way to CPAN

Stray Toaster mwk at stray-toaster.co.uk
Sat Nov 30 13:53:40 CST 2002


On Sat, Nov 30, 2002 at 01:32:42PM +0000, Liyang HU wrote:
>     for_loop(1, 10, sub { print shift(). " of ten!" });
> 
> Hopefully, support for iterating over arrays will come in the next
> release. Beta-testers are welcome! Please contact me for details!

*bam*

Can I beta test your next release which has something like, I dunno, you
take a value, right, let us call it a key, and assign it a value? What
do those new-fangled compsci people call it? Ah, yes, an associative
array.

(Liyang, it also would have been funnier if you actually had of
reinvented the for loop and had a file at the specified url. I was
expecting to download it and it to just be a text file which called me
names. Ah well, you missed that one. Boy, am I ever going to harang you
at the Christmas dinner.)

> Repeat after me: map is good. Erasing map from one's mind is baaaad.
> Mmkay?

I wasn't advocating forgetting map. I merely wanted a way to merge
hashrefs into one big one. And the clobbering of key/values was
deliberate.

> Well, you can justify *anything* using existing modules in CPAN...
> genocide, probably. I'm getting a distinct feeling somewhat akin to the
> freshmeat ``My First Shell Script'' syndrome... asserting copyright and
> specifying the license for one line of code is just silly[0].

Err, that bit is a no-brainer. I have skeleton files that create allthe
guff around my modules. What, you don't think I cut n paste (or, God
forbid, type) all that gubbins everytime?

> 
> How about actually merging hashes (dealing with key clashes), like the
> module's name suggests it ought to do? Something like:
> 
>     my $ref = merge_hashref(sub { my ($a, $b) = @_;
>         return $a > $b ? $a : $b }, $ref1, $ref2, ...);

But if you pass it a list of hashrefs, how are you supposed to know
which one clobbers the other? Arbitary numeric inquality type things?
Nope, I left it to the user (namely, me).

As opposed to this being a freshmeat first-script syndrome, I fear this
is more a /. bashing of me.

m.

-- 
He doesn't like Will and Grace because he is gay.
Karen lets Andrew's secret out
--
Family ties : http://www.thefamilykerr.co.uk
Playtime    : http://www.stray-toaster.co.uk



More information about the Belfast-pm mailing list