Re: Uninitialized value warning when deleting POP3 message

Mark Overmeer <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.mail-box
Organization MARKOV Solutions
Message-ID <[email protected]>
* David Phillips ([email protected]) [040126 15:12]:
> When a message is deleted, cron e-mails me the following warning:
> 
>     Use of uninitialized value in numeric ne (!=)
>     at /usr/lib/perl5/site_perl/5.6.1/Mail/Box/POP3/Message.pm line 47
> 
> This is the code from Mail/Box/POP3/Message.pm where the warning
> occurs - it occurs when "if $newdel != $olddel;" is evaluated:

I see.  The code can be improved here:

>     sub label(@)
>     {   my $self = shift;

> -       my $olddel = $self->label('deleted');
> -       my $ret    = $self->SUPER::label(@_);
> -       my $newdel = $self->label('deleted');

  +       my $olddel = $self->label('deleted') ? 1 : 0;
  +       my $ret    = $self->SUPER::label(@_);
  +       my $newdel = $self->label('deleted') ? 1 : 0;

(deleted can have a different true value than 1)

> Am I doing something wrong,

no.

> 
>      #!/usr/bin/perl -X
> ...at the top of my script, but this seems like overkill to me.

You could also encapsulate a small piece of the affected code with
  { no warnings;
  }
-- 
Thanks for the report,

               MarkOv

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.