Skip Menu |

This queue is for tickets about the MIME-tools CPAN distribution.

Report information
The Basics
Id: 22682
Status: resolved
Priority: 0/
Queue: MIME-tools

People
Owner: Nobody in particular
Requestors: at [...] altlinux.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 5.420_02



Subject: [PATCH] MIME/Decoder.pm (new): warn about errors
Date: Sat, 28 Oct 2006 15:10:27 +0400
To: bug-mime-tools [...] rt.cpan.org
From: Alexey Tourbin <at [...] altlinux.ru>
MIME::Decoder->new can return undef silently without any diagnose. Since the failure is rarely expected, it should rather die, but that's non-trivial API change. So let's just issue a mandatory warning (when absolutely necessary, the warning can be shut up by setting $SIG{__WARN__}). --- lib/MIME/Decoder.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib/MIME/Decoder.pm b/lib/MIME/Decoder.pm index bb36c57..fe6a8a8 100644 --- a/lib/MIME/Decoder.pm +++ b/lib/MIME/Decoder.pm @@ -167,12 +167,16 @@ sub new { $encoding = lc($encoding || ''); ### Get the class: - ($concrete_name = $DecoderFor{$encoding}) or return undef; + ($concrete_name = $DecoderFor{$encoding}) or do { + carp "no decoder for $encoding"; + return undef; + }; ($concrete_path = $concrete_name.'.pm') =~ s{::}{/}g; ### Create the new object (if we can): my $self = { MD_Encoding => lc($encoding) }; unless (eval "require '$concrete_path';") { + carp $@; return undef; } bless $self, $concrete_name; -- 1.4.3.GIT