Re: Magic for object constructor wanted
- From: Koszalek Opalek <koszalekopalek@xxxxxxxxxx>
- Date: Thu, 31 Jan 2008 09:06:23 -0800 (PST)
On Jan 31, 3:18 pm, bugbear <bugbear@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Koszalek Opalek wrote:
my @people = (
Dude->new("joe"),
Dude->new("tom"),
Dude->new("ann").
Dude->new("jane")
);
Alternatively/additioanaly, you might have a "group"
class (set of Dudes) that allow Dudes t be found by name.
No, then instead of saying
$ann->fill( friends => [ $tom, $tim] );
I'd have to say smth like
$ann->fill( friends => Friends->findByName("tom", "tim") );
If your set of names becomes large, declaring all the
variables implied by your original approach becomes ugly.
It will never get very large.
You might be thinking Dudes are some jerks from a database.
In fact they are tokens. The module user has two define
Dudes (tokens) and relationships between them and the
module will produce a parse tree. (Specifying Dudes
using a BNF grammar is not scheduled for this release:-)
Koszalek
.
- References:
- Magic for object constructor wanted
- From: Koszalek Opalek
- Re: Magic for object constructor wanted
- From: bugbear
- Magic for object constructor wanted
- Prev by Date: Re: how to remove blocks between nested brackets
- Next by Date: Re: LaTeX rendering
- Previous by thread: Re: Magic for object constructor wanted
- Next by thread: Re: Magic for object constructor wanted
- Index(es):