S
Sisyphus
Hi,
Say I have 2 modules, called module_x and module_y, and that both
modules overload the * operator (with a subroutine named over_mul).
let's further assume that I run the following script:
use warnings;
use module_x;
use module_y;
my $x = module_x->new(10);
my $y = module_y->new(12);
my $z1 = $x * $y;
my $z2 = $y * $x;
It looks to me that the first multiplication will use the
module_x:ver_mul subroutine, and that the second multiplication will
use the module_y:ver_mul subroutine - and that there's nothing one can
do to change that behaviour - ie I can't write 'my $z = $x * $y;' and
"trick" it into using the module_y:ver_mul subroutine.
Now that all seems quite sane to me, but I know from past experience
that doesn't mean that I've necessarily got it right.
Basically, all I'm asking is that someone let me know if I'm wrong.
Cheers,
Rob
Say I have 2 modules, called module_x and module_y, and that both
modules overload the * operator (with a subroutine named over_mul).
let's further assume that I run the following script:
use warnings;
use module_x;
use module_y;
my $x = module_x->new(10);
my $y = module_y->new(12);
my $z1 = $x * $y;
my $z2 = $y * $x;
It looks to me that the first multiplication will use the
module_x:ver_mul subroutine, and that the second multiplication will
use the module_y:ver_mul subroutine - and that there's nothing one can
do to change that behaviour - ie I can't write 'my $z = $x * $y;' and
"trick" it into using the module_y:ver_mul subroutine.
Now that all seems quite sane to me, but I know from past experience
that doesn't mean that I've necessarily got it right.
Basically, all I'm asking is that someone let me know if I'm wrong.
Cheers,
Rob