In a message dated 5/1/2003 11:56:46 AM Eastern Standard Time, Jam...@ta... writes:
> In Log::Log4perl::Config::config_read, this code is used to determine if a
> hashref
> of key/value pairs has been passed to Log::Log4perl::init:
>
> if (ref($config) eq 'HASH') { # convert the hashref into a list
>
> Unfortunately, our in-house confiugration module uses tied hashes blessed
> into their
> own class. So this check fails and init() throws an exception because we
> haven't given it a scalar reference.
Tough one. I'm not entirely sure that interpreting a hash behind a blessed object is something I want to encourage. I think that once an object has been blessed, one should forget about its implementation.
I'm particularily worried that if one day we want to pass a, say, URI::URL object to the method, I'll have to distinguish between interpreting it as an object or as a blessed hash which I want to interpret as key/value pairs.
Could you work around the problem by having your objects provide a $obj->as_hashref method and using their result for init() ?
-- Mike
############################
# Mike Schilli #
# log...@pe... #
# http://perlmeister.com #
# log4perl.sourceforge.net #
############################
|