in reply to RE: RE (tilly) 2: Handling cascading defaults
in thread Handling cascading defaults
OTOH if the indirection layer is all that is desired, then a reference to a sub does that without the OO machinery hanging around.
Incidentally I don't like to put full OO designs into a ton of code either. However I do like trying to put some sort of indirection in early. But to do it in a way where I can behind the scenes figure out how to do it better later.
For instance some of the arguments will likely go into many messages, so the code I posted could have been improved to
Now, while OO probably still isn't a great fit, at least I have done more with it than provide a level of indirection in how the subroutine is named. :-)package Err; sub new { return bless {@_}, shift; } sub err { my $self = shift; my %args = (%$self, @_); # Do something with %args here }
|
---|