Skip Menu |

This queue is for tickets about the Net-IMAP-Simple CPAN distribution.

Report information
The Basics
Id: 31108
Status: resolved
Priority: 0/
Queue: Net-IMAP-Simple

People
Owner: Nobody in particular
Requestors: GWOLF [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.17
Fixed in: (no value)



Subject: Throws warnings at compile time if running with 'perl -w'
Hi, We received the following bug report in Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450955 Note that the warnings only get shown if running with the -w switch - "use warnings" does not trigger it. Now, besides the warning itself, the module will probably break at execution time if debugging to a handle, as it seems (to me at least) that 'write' was specified instead of 'print' - Looking at 'perldoc -f write', it does _not_ accept multi-argument invocations - If using write to fill in formats, it should be called with only the output filehandle. I think you wanted to use 'print' instead. So, here is my fix for it. Please comment on it --- I do not want to blindly push a fix that I might not really understand. Index: lib/Net/IMAP/Simple.pm =================================================================== --- lib/Net/IMAP/Simple.pm (revision 10046) +++ lib/Net/IMAP/Simple.pm (working copy) @@ -898,9 +898,9 @@ $str =~ s/\r/\\r/g; $str =~ s/\cM/^M/g; - my $line = "[$package :: $filename :: $line\@$dline -> $routine] $str\n"; + $line = "[$package :: $filename :: $line\@$dline -> $routine] $str\n"; if(ref($self->{debug}) eq 'GLOB'){ - write($self->{debug}, $line); + print $self->{debug} $line; } else { print STDOUT $line; }
Sorry for not checking earlier - This bug can be merged with 28154. Still, I hope the fix can help somebody else :)
Oops, there is a huge bug in my patch (which not only throws a warning at compile time, but renders it into a fatal error!). Here goes the patch again against your published version - Inlined, yes, instead of attached - It's still _very_ simple, and grabs attention more easily. Refer to 'perldoc -f print' for the weird syntax ;-) --- /usr/share/perl5/Net/IMAP/Simple.pm 2006-10-11 11:23:45.000000000 -0500 +++ lib/Net/IMAP/Simple.pm 2007-11-30 10:56:31.000000000 -0600 @@ -898,9 +898,9 @@ $str =~ s/\r/\\r/g; $str =~ s/\cM/^M/g; - my $line = "[$package :: $filename :: $line\@$dline -> $routine] $str\n"; + $line = "[$package :: $filename :: $line\@$dline -> $routine] $str\n"; if(ref($self->{debug}) eq 'GLOB'){ - write($self->{debug}, $line); + print { $self->{debug} } $line; } else { print STDOUT $line; }
Hello I was a bit annoyed with those warnings... I hope this patch will be useful: 901,906c901,904 < my $line = "[$package :: $filename :: $line\@$dline -> $routine] $str\n"; < if(ref($self->{debug}) eq 'GLOB'){ < write($self->{debug}, $line); < } else { < print STDOUT $line; < } --- Show quoted text
> $line = "[$package :: $filename :: $line\@$dline -> $routine] $str\n"; > ( ref $self->{debug} and $self->{debug}->can('write') ) > ? $self->{debug}->write($line) > : print STDOUT $line;
Regards, Bruno
This was fixed in 1.18 -- If riding in an airplane is flying, then riding in a boat is swimming. 107 jumps, 43.5 minutes of freefall, 83.4 freefall miles.