I
Ignoramus27279
Just a pointer to a perl manpage would be great.
I am looking to write a bunch of modules on which to perform
operations like addition etc.
The modules would represent objects such as constants (1, 2/3, pi/2,
etc), as well as polynomials and general math functions.
What I would like is to overload operations so that I could "drop in"
the values of that type into existing subroutines.
Suppose that I already have a subroutine
sub myGreatComputation {
my ($a, $b) = @_.
# do big stuff with arithmetics on $a and $b
}
is there some way to define my new module so that other subroutines
that do arithmetics would work properly when passed objects of that
module rather than regular scalar values, without rewriting that
subroutine?
thanks
I am looking to write a bunch of modules on which to perform
operations like addition etc.
The modules would represent objects such as constants (1, 2/3, pi/2,
etc), as well as polynomials and general math functions.
What I would like is to overload operations so that I could "drop in"
the values of that type into existing subroutines.
Suppose that I already have a subroutine
sub myGreatComputation {
my ($a, $b) = @_.
# do big stuff with arithmetics on $a and $b
}
is there some way to define my new module so that other subroutines
that do arithmetics would work properly when passed objects of that
module rather than regular scalar values, without rewriting that
subroutine?
thanks