Nathan Torkington wrote:
> 
> Tee hee!  The point of the warning is to tell you that you should be
> checking it and aren't.  You're assuming the variable has a value,
> because you are treating it like a string.  But the variable doesn't
> have a value.  This is probably an error.

For me it's not, that's why it's so damn annoying! I'm so *Lazy*.
Ridiculously so. I do stuff like:

   do_stuff() unless ($string eq $maybe_undef);

All the time. And you can get to this point easily by;

   $maybe_undef = call_func_that_might_return_undef();

And putting stuff like this to catch it:

   $maybe_undef = call_func_that_might_return_undef() || '';

Is just plain a PITA.
 
> Saying:
> 
>   my $middle = '';

The problem is there's no easy way to do this for a large list of
values:

   my($a, $b, $c, $d, $e, $f) = ();

Doesn't work. This does:

   my($a, $b, $c, $d, $e, $f) = ('','','','','','');

But man, that really seems like it's not fun. And all alternatives are
bound to be longer than this:

   my($a, $b, $c, $d, $e, $f) = getpwnam($user) || 'anonymous';

Which is all I wanted to do in the first place! :-{

I just think it's a case of "crying wolf", especially when other
people's CPAN modules start spewing this stuff out from perfectly
reasonable code, filling up your web error logs with "uninitialized this
and that". As a sysadmin, that pisses me off. :-(

Perhaps I should post to p5p about splitting up uninitialized warnings
into numeric and string contexts. Then at least I could get rid of all
the annoying strings ones and keep the number ones around. But the
problem of other people's CPAN modules is still a biggie...

-Nate

Reply via email to