Re: [OT] Wrapping methods

2009-07-07 Thread Andy Wardley
Nicholas Clark wrote: Of course this can also be solved in various other ways, [...] but that doesn't feel as elegant an interface. Perhaps not, but IMHO having two distinct methods is the Right Way To Do It. Anything else runs the risk of being Too Clever By Far[1]. I would have an

[OT] Wrapping methods

2009-07-06 Thread Nicholas Clark
Sorry to mention the 4 letter word... I'm not sure if there is a good answer to this, but: Say I have a system of interchangeable components defined by @ISA = 'Generic::Base::Class'; sub run { ... # does stuff } such that it's invoked to do its work as $object-run(...); Is

Re: [OT] Wrapping methods

2009-07-06 Thread David Cantrell
On Mon, Jul 06, 2009 at 05:06:03PM +0100, Nicholas Clark wrote: but Generic::Base::ClassWithTimeout has done something funky to wrap run in a routine that does the eval block/alarm/$SIG{ALARM} handler? Basically, the fun is that I'd like to do something equivalent to invert the order of

Re: [OT] Wrapping methods

2009-07-06 Thread Joel Bernstein
On 6 Jul 2009, at 17:06, Nicholas Clark wrote: such that it's invoked to do its work as $object-run(...); Is there any not-insanely-hacky way to conjure up a wrapper class Generic::Base::ClassWithTimeout such that a component could be written as @ISA = 'Generic::Base::ClassWithTimeout';

Re: [OT] Wrapping methods

2009-07-06 Thread Ask Bjørn Hansen
On Jul 6, 2009, at 9:06, Nicholas Clark wrote: Of course this can also be solved in various other ways, such as having the code be @ISA = 'Generic::Base::ClassWithTimeout'; sub run_with_timeout { ... # does stuff } and Generic::Base::ClassWithTimeout having a run() method

Re: [OT] Wrapping methods

2009-07-06 Thread Daniel Ruoso
Em Seg, 2009-07-06 às 17:06 +0100, Nicholas Clark escreveu: Sorry to mention the 4 letter word... I'm not sure if there is a good answer to this, but: Say I have a system of interchangeable components defined by @ISA = 'Generic::Base::Class'; sub run { ... } such that it's invoked to

Re: [OT] Wrapping methods

2009-07-06 Thread Eden Cardim
On Mon, Jul 6, 2009 at 2:24 PM, Joel Bernsteinj...@fysh.org wrote: Basically, the fun is that I'd like to do something equivalent to invert the order of inheritance, such that the parent's run seems to be called first, and it can SUPER delegate to its child. That's exactly what the