Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Re: Re: Re: Re: Speed, and my sanity.

by btrott (Parson)
on Aug 26, 2001 at 22:19 UTC ( #107963=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: Re: Speed, and my sanity.
in thread Speed, and my sanity.

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://107963]
[LanX]: # Pestis Africana Suum
[erix]: that's an old plan, I think. Isn't there already a danewal (or some such name)?
[marto]: Build with -Wall
[erix]: Danewerk
[LanX]: I seem to remember that the danewall was build by the Frankish empire against the Danes
[erix]: 500 AD thru viking age
[erix]: that would make sense but wikipedia thinks otherwise
[LanX]: oh me was wrong ...
[erix]: but it always works both ways of course
[LanX]: Funny some weeks ago, I met people from the Cimbrian peninsula who didn't know it's called the Cimbrian peninsula ...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2018-03-22 18:42 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (283 votes). Check out past polls.