UR::Observer - bind callbacks to object changes
$rocket = Acme::Rocket->create( fuel_level => 100 ); $observer = $rocket->add_observer( aspect => 'fuel_level', callback => sub { print "fuel level is: " . shift->fuel_level . "\n" }, ); for (3 .. 0) { $rocket->fuel_level($_); } # fuel level is: 3 # fuel level is: 2 # fuel level is: 1 # fuel level is: 0 $observer->delete;
To install UR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UR
CPAN shell
perl -MCPAN -e shell install UR
For more information on module installation, please visit the detailed CPAN module installation guide.