develooper Front page | perl.beginners | Postings from April 2002

Re: A Switch Case for multi-state returns.

Thread Previous | Thread Next
Jonathan E. Paton
April 1, 2002 06:58
Re: A Switch Case for multi-state returns.
Message ID:
> > What if there is HUNDREDS of items, then
> > it'd be really slow.  For a better approach
> > using hashes then see what I did in:
> >
> >
> The question that now comes to mind is why
> not put all of the 'response functions'
> into a Perl Module - so that one can
> maintain it independent of the 'usage' in
> the script?

The concept of the hash based lookup, and the
way non-OO and OO code work is related.  The
hash based approach is useful in a subset of
problems, not all.

If the logic can usefully be turned into a
module then go for it.

Have a read of Chapter 10 of the Camel, and
you'll see the relationship between perl's
symbol tables and hashes.  The closeness of
what I'm doing, OO syntax and regular perl
is interesting :)

> At which point we do get to the
> 'OO v. Proceduralist' issues since the
> simple 'new' function of
> [snip]
> really is little more than returning a
> 'hash' to begin with...

As I say, read Chapter 10, then return knowing
perl implements both OO or procedural
approaches pretty much the same way.  Perl 6
should use objects in the core, but allow
either programming approach on the surface.

Jonathan Paton

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About