On Thu, 21 Feb 2008, Emil Janev wrote:
> The problem certainly can be fixed with providing a default value of
> this parameter of an empty string,
> if an 'undef' value gets trough.
Passing on the arg list from the wrapper to the Log4perl log call is
probably the easiest solution:
sub wrapper_get_logger {
...
my $logger = get_logger(@_);
...
}
> My question is also if there is any planned future change, where undef
> case will be treated in the same way as the one with an empty string,
> or an empty array.
It's not really obvious to me what 'undef' should stand for -- maybe
we'll leave it undefined until someone has a smart idea.
> p.s. As a coincidence, these days reading the Linux Pro Magazine on the
> subway ride to/from work,
> I came upon the 2007-12 article "I think in Perl' :)
It's even available online if anybody is interested what I'm doing when
I'm not working on Log4perl :)
http://w3.linux-magazine.com/issue/85/Perlmeister_Michael_Schilli.pdf
-- Mike
Mike Schilli
m...@pe...
> >> my $logger = get_logger(undef);
> >>
> >
> > That's an interesting case. While
> >
> > # get a logger for the current package
> > get_logger()
> >
> > and
> >
> > # get the root logger
> > get_logger("")
> >
> > are defined cases, using 'undef' as in
> >
> > get_logger( undef )
> >
> > isn't defined. There was a change in 1.15 that now brings this undefined
> > behavior to light (unfortunately for you :).
> >
> > If you want to use a variable to toggle between "" and the empty list,
> > use an array:
> >
> > my @array = ();
> > my $logger = get_logger(@array);
> >
> > # vs.
> >
> > my @array = ("");
> > my $logger = get_logger(@array);
> >
> > Does that work for you?
> >
> > -- Mike
> >
> > Mike Schilli
> > m...@pe...
> >
>
>
> --
> Emil Janev
>
>
|