Monks ~
I'm developing a web site using templates. Some time ago I created a small script to parse a template file, suck up all the template VARiables and IFs, and spit them out into a nicely formatted template assignment, kinda like this:
$template->param( THIS_IS_A_LONG_VARIABLE_NAME => ,
ANOTHER => ,
YOU_GET_THE_IDEA =>
);
This makes it very easy to (a) make sure I get all the template variables the first pass, and (b) paste this block into the script and fill in the blanks. I'm using a format to make sure the "=> ," lines up correctly, which makes it easier to read and edit.
Today I decided that the whole operation just took too damn long, so I've been fiddling with the Win32::Clipboard (won't work in Debian, sadly ;). It all works nicely except for the format, because I'm ".=" assigning to a variable, then setting the clipboard to that variable. I figure I have two options:
- Parse everything before assignment, figure out the longest line, pad all the other lines. *Ick*
- Write the format to a variable (or a variable pretending to be a filehandle) instead of a filehandle.
That's where I'm stuck. The second option is much cleaner, assuming it's possible. Ideas anyone?
Thanks!
P.S. For those who haven't used Win32::Clipboard, it's pretty simple. Here's the code that does stuff:
$clipboard = Win32::Clipboard();
$clipboard->Set( $temp );
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.