"Rob Dixon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Todd wrote: > > > > Perl is so slick: > > > > if ( $self->{code} ) { > > $string = $self->{code}; > > } else { > > $self->{class}{file}{generator}{tt2}->process( > > $self->{class}{file}{generator}{fmgr}{templates}{CollectionProperty}, > > $self, > > \$string > > ) || die $self->{class}{file}{generator}{tt2}->error(), "\n"; > > } > > > > Objects created by other objects in the same class heirarchy get a property > > set to a reference to the object that created it. This piece of code is from > > a code generator that uses Template::Toolkit. $string is returned, being > > called for in the first place by another method call placed in a > > Template::Toolkit template. > > > > Vive OO. > > > > Todd W. > > Maybe. But I would take at least a couple of minutes > to understand what you've written.
I wote that code years ago. I did explain it above. The code above is part of a source code generator. $string contains programming source code. The language of the source code depends on a flag being set in an XML file. I understand it completely. I wrote it. > That's not why Perl is slick. You must have missed the point. ( There was no point to posting it, I was just rereading some code and thought it looked neat enough to post. But if I post it and you counter with "That's not why Perl is slick." then you still missed the point. ) You can do what it says above in any language. What I've coded is a high-level implementation of a tree. In JavaScript, for instance, instead of seperating the properties with "}{" you could just use ".". What makes perl so cool is the amount of code that I did NOT wite being executed in the above snippet. The ->process() method of a Template::Toolkit object does some serious work. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]