deprecated has asked for the wisdom of the Perl Monks concerning the following question:
I am making pretty extensive use of heredocs to fit VRML into scalars. I then take these scalars and pass them to parent scalars. These scalars are called, in the VRML terminology, 'Nodes'. So lets look at this code:
You'd be surprised just how well this works. Let's extrapolate this a little further though.sub makemeanode { my $parameter = shift; return << "EOR"; node myNode { fooParam $parameter } EOR }
While this may produce PML (PoopModellingLanguage) correct code, it is also ugly and difficult to read:sub makeMeContainer { my $parameter = shift; # see, muzakfetch? we're not all so uptight... my $child = makemeanode( "DogPoopMonk" ); return <<"EOR"; node myContainer { someParam $parameter $child } EOR }
I am hoping to put this to the monastery as something akin to the HTML::Pretty (or was that CGI::Pretty?) module. I would like to be able to prettify the output of my code (optionally) so that it is easier to read for VRML hackers when they get to reading it. I think probably a regular expression would be able to embody rules like this:node myContainer { someParam WhateverWeWerePassed node myNode { fooParam DogPoopMonk } }
node myNode { parm thisParm }
thanks for your help everyone,
dep.
ps. and isnt this more productive than golf? working together on a project? and just as fun?
--
Laziness, Impatience, Hubris, and Generosity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Automagically indenting (implementation, code)
by perlmonkey (Hermit) on May 11, 2001 at 08:18 UTC |