Thank you for your help!
Lets say I have a class Stock:
package Stock;
use Moose;
has 'quantity' => ( is => 'rw', );
has 'price' => ( is => 'rw', );
has 'value' => ( is => 'ro', );
1;
How can I calculate the value (quantity*price) when value is used, not when price or quantity change?
EDIT: Sorry, if this was not complete, but of course value should always return the latest value of quantity*price, as those can change.
This should be simple, but I guess I don't see the wood for the all trees...
Thank you very much for your help!