[Petal] Re: [PATCH] Petal::Hash::Var error on undef + misc
Steve Purkis
spurkis at mkdoc.com
Wed Jul 9 16:18:34 BST 2003
Don't you just hate it when you click on 'Send' instead of 'Attach'?
-Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Petal-0.96-error-on-undef.patch
Type: application/octet-stream
Size: 16752 bytes
Desc: not available
Url : http://www.email-lists.org/pipermail/petal/attachments/20030709/3e1cef51/Petal-0.96-error-on-undef.obj
-------------- next part --------------
On Wednesday, July 9, 2003, at 02:51 pm, Steve Purkis wrote:
> Hi all,
>
> As the functionality introduced in my previous patches doesn't seem to
> have made it into the main distro, I've produced another patch for
> Petal which implements the main point of my previous patches -- a user
> controllable flag for error on undefined variables -- without the
> performance hit (see below).
>
> The flag can be set as such:
> $Petal::Hash::Var::ERROR_ON_UNDEF = 0 || 1;
>
> Though arguably it should be a class/instance var of the processor:
> my $tmpl = Petal->new->error_on_undef( 0 || 1 );
>
> I don't mind implementing that if people prefer it.
>
> The patch also has some better error reporting when you try to access
> vars you shouldn't. And because I've been extremely lazy, it includes
> extra tests that were copied over from the last patch. The more the
> merrier, I say.
>
> The same benchmark script is included so you can all see I'm not on
> crack:
>
> % perl t/benchmark.pl
>
> Templates Processed /s
> Machine: 400MHz PPC 1.7 GHz x86
> v0.96: 66.26/s 308.36/s
> Patched: 63.74/s 295.07/s
>
> This indicates roughly a 4% decrease in performance, most likely due
> to the extra error reporting. If that's not livable, please let me
> know and I'll rewrite it in assembler ;-).
>
> Regards,
> -Steve
>
More information about the Petal
mailing list