in reply to Re: Can I add methods to an existing object?
in thread Can I add methods to an existing object?
Right, sorry..
I'm doing some Cat stuff and using Authen::Simple for authentication. My Cat instance has a Log::Dispatch logger which has methods like 'error','warning','debug' etc... Authen::Simple objects can take a logging object too, but it has to provide 'debug','info','warn' and 'error'. Log::Dispatch provides 'warning' but not 'warn'. To work around this, I made my own class which I called Log::Dispatch::Warn, which is a subclass of Log::Dispatch with a 'warn' sub which just calls 'warning'.
It seems kind of silly to create a whole module just to make an object call $self->warning(@_) if someone calls $object->warn($blah).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can I add methods to an existing object?
by linuxer (Curate) on Apr 02, 2009 at 23:55 UTC | |
by educated_foo (Vicar) on Apr 03, 2009 at 13:18 UTC | |
by linuxer (Curate) on Apr 03, 2009 at 15:28 UTC | |
by educated_foo (Vicar) on Apr 03, 2009 at 17:39 UTC | |
by Jenda (Abbot) on Apr 04, 2009 at 13:46 UTC | |
by linuxer (Curate) on Apr 03, 2009 at 17:47 UTC | |
by Your Mother (Archbishop) on Apr 03, 2009 at 17:58 UTC | |
|
Re^3: Can I add methods to an existing object?
by roubi (Hermit) on Apr 02, 2009 at 23:46 UTC |