Please reference the code on my home node for details on what I am doing here.

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:

sub makemeanode { my $parameter = shift; return << "EOR"; node myNode { fooParam $parameter } EOR }
You'd be surprised just how well this works. Let's extrapolate this a little further though.
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 }
While this may produce PML (PoopModellingLanguage) correct code, it is also ugly and difficult to read:
node myContainer { someParam WhateverWeWerePassed node myNode { fooParam DogPoopMonk } }
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: I think these are acceptable, but I havent ever written VRML by hand, either. These are generally acceptable by perl coders and even some c coders. I leave that up to you. I'm going to work on the guts of the module.

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.


In reply to Automagically indenting (implementation, code) by deprecated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.