in reply to Cleanup tools (auto HereDoc?)

I'm not sure this is a perfect solution, but you could just eval that bit of code, and print the results. This would interpolate the variables, which would give you empty spots (ie where you have value="$markup"). So perhaps you would want to escape the sigils before you eval the code, then all you need do is throw in a $display = <<EOHTML arround it and you're done.

Although while you're there, why not replace all the interpolations with [% $template_engine_name %] tags right off the bat, and then you won't have to come back and re-visit it when you come to roll out your template version.

The more of the code you delete now, the less you have to come back and delete later, right?

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Replies are listed 'Best First'.
Re^2: Cleanup tools (auto HereDoc?)
by garrison (Scribe) on Dec 03, 2006 at 03:05 UTC
    Ah I was hoping someone would suggest eval(). I've been working on:
    my $line = 0; while (<>) { s/^([\smy]*\$\w+\s+\.?=\s+)['"](.*?)\\?n?['"];/$1<<END;\n$2/ unless $line > 0; s/^\s*\$\w+\s+\.=\s+['"](.*?)\\?n?['"];$/$1/g; s/\\"/"/g; $line++; print $_; } print "END\n";
    which works but is (I believe) a poor design. I'll play with your suggestion next. See my response to graff for why I can't jump right to template tags.