in reply to A general method of locally overriding subroutines
output:use Sub::Override; use strict; use warnings; $, = ' '; $\ = "\n"; sub a{ 'a' } sub b{ 'b' } sub c{ 'c' } sub d{ ( a, b, c ) }; print d(); { my $override = Sub::Override->new; $override->replace(a => sub { "changed" }) ->replace(b => sub { "changed" }) ->replace(c => sub { "changed" }); print d(); } print d();
a b c changed changed changed a b c Tool completed successfully
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: A general method of locally overriding subroutines
by xdg (Monsignor) on Mar 11, 2006 at 14:08 UTC | |
by fizbin (Chaplain) on Mar 18, 2006 at 01:48 UTC |