[Petal] proposed changes

Fergal Daly fergal at esatclear.ie
Wed Jun 11 14:00:10 BST 2003


In order to play around with the expressions in Petal, I'd like to make some 
changes to CodeGenerator so instead of hard coding $hash->get('$variable') it 
calls a method. So lines like

    push @code, ("    " x $indent . "if (\$hash->get ('$variable')) {");

become

    push @code, ("    " x $indent . "if (\".$class->comp_expr('$hash', 
$variable).") {");

if comp_expr is just

sub comp_expr
{
	my $hash_var = shift;
	my $variable = shift;

	return "$hash_var->get( '$variable')";
}

then the code generated will be the same but you can now start to try 
different code generators with different expression compilers. I used this 
technique to integrate Text::Engine into Petal a few version ago, it passed 
almost all the tests (except the plugins).

I'd also like to change

	push @code, ("    " x $indent . "blah");

to

	$class->add_code("blah");

and let add_code handle the indenting, rather than having all those "    " x 
$indent everywhere.

Let me know if you want these changes and I'll do them and send you a patch,

F



More information about the Petal mailing list