hi,

i wrote a

*package Foo::Expression::Arithmetic*, a

*package Foo::Number* and a

*package Foo::Variable*.
I used

*overload* to be able to do the following:

`my $x1 = Foo::Number->new()->value( 10 );
my $x2 = Foo::Number->new()->value( 20 );
my $x3 = Foo::Number->new()->value( 30 );
my $x4 = Foo::Number->new()->value( 40 );
my $v1 = Foo::Variable->new()->name( 'a' )->value( 50 );
my $c1 = $v1 - $x1 + $x2 + $x3 - $x4;
my $c2 = $c1 * $v1;
`

$c1 and $c2 are now objects of type

*Foo::Expression::Arithmetic*.

*Foo::Expression::Arithmetic* has a output function, so outputing $c1 and $c2 gives me the following:

a - 10 + 20 + 30 - 40 # $c1
a - 10 + 20 + 30 - 40 * a # $c2

Now i want to be able to do the following:

`my $c3 = ( $x1 + $x2 ) * $v1;
`

not achieve the following output:

( 10 + 20 ) * a # $c3

`use overload
'(' => \&left_parenthesis,
')' => \&right_parenthesis,
`

is not working. :-(
Any ideas?

2006-02-07 Retitled by Arunbear, as per Monastery guidelines

Original title: 'overload'

Comment onUsing overload to parse arithmetic termsSelectorDownloadCode