Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
First off I wasn't really suggesting that you use
<body bgcolor="<% $params{parse}->{BGCOLOR} %>">
The only difference between that and what your system currently uses is that you use a different syntax for tags. And there's nothing wrong with that. The above is just one way of using templates.

What I was suggesting, rather, is that your compilation phase could be turning this:

<body bgcolor="<@BGCOLOR@>">
into this:
$_out->('<body bgcolor="'); $_out->( $params{parse}->{BGCOLOR} ); $_out->('">');
This can be done by tokenizing your template, then turning everything like
<@ FOO @>
into a statement like
$_out->( $params{parse}->{FOO} );
This Perl statement can then be directly executed, and moreover you can write the Perl code to disk, then directly execute it again; this means that on subsequent requests to your template, it does not have to be reparsed.

As for whether this requires a major rewrite: it would require separating your compilation and execution phases, essentially. This is the biggest difference, because this is a mental difference: when you use the substitution operator to walk through a string and replace your template tags with other values, you are performing "compilation" and "execution" of your template at the same time. When you first compile to Perl code, then execute, you are splitting up those steps.

So it would require a rethink of a piece of your system, and yes, it would also require rewriting some of it. But it's something to think about.


In reply to Re: Re: Re: Re: Re: Speed, and my sanity. by btrott
in thread Speed, and my sanity. by Dylan

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-16 08:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found