Processing Data Partitions in Perl

Tom Hukins tom at eborcom.com
Tue Jul 8 00:32:12 PDT 2008


On Fri, Jul 04, 2008 at 11:54:35AM +0100, Ziya Suzen wrote:
> On Wed, Jul 2, 2008 at 9:32 PM, Tom Hukins <tom at eborcom.com> wrote:
> [..]
> >   1  Cuba     NB
> >   2  New Inn  NB
> >   3  Spoons   CMK
> >   4  Vaults   Stony
> >   5  Crown    Stony
> 
> Assuming ordered by location I suppose?

Not necessarily ordered, although items with the same location must
appear consecutively.  Number 6 must not have the location 'NB' or
'CMK', but it might have any other value.

> This hurts my brain... Too many code refs and recursion :-(

Yeah, same here.  I posted it to the list in the hope that someone
would tell me how I could write it better.  Everything I thought of
just made it look more complicated.

> But hey, if it works I don't want to know what's under the bonnet.

Exactly.  I can think of a few CPAN modules that I use although their
internals look scary.  I prefer to use clean, comprehensible code when
possible.  I can also think of scary code that I try to avoid, but
that's another story..

> I think more object oriented sort of API might be easier to
> understand and use.

I like this idea.  I like the 'column_name' argument for iterators
that return hash-based records, such as DBI's fetchrow_hashref().  The
constructor could also have a 'column_offset' argument for array-based
records, such as those returned by DBI's fetchrow_arrayref().

Thanks for the helpful comments,
Tom


More information about the MiltonKeynes-pm mailing list