...then don't tie people in to the method names, provide them with the ability to redefine them.
Subclass or wrap all you want. Perl already has perfect features to support what you wish :)
Here are three examples to accomplish this task, but there a lot of other ways to do it.
# 1) subclassing
package Foo::Bar::Sub;
use base 'Foo::Bar';
sub begin_work { shift->try_it }
sub commit { shift->do_it }
sub begin_work { shift->try_it }
# 2) wrapping
package Foo::Bar::Wrap;
use Attribute::Property;
use Scalar::Util qw(blessed)
sub new : New;
sub object : Property { blessed }
sub begin_work { shift->object->try_it }
sub commit { shift->object->do_it }
sub rollback { shift->object->fallback }
# 3) intruding
sub Foo::Bar::begin_work { shift->try_it }
sub Foo::Bar::commit { shift->do_it }
sub Foo::Bar::rollback { shift->fallback }
Juerd
# { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
|