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

Re: A Switch Case for multi-state returns.

Thread Previous | Thread Next
From:
Jonathan E. Paton
Date:
April 1, 2002 06:58
Subject:
Re: A Switch Case for multi-state returns.
Message ID:
20020401145823.63435.qmail@web14609.mail.yahoo.com
> > 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:
> >
> > http://groups.yahoo.com/group/perl-beginner/message/9583
>
> 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
http://uk.my.yahoo.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About