Skip Menu |
 

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 37114
Status: resolved
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: manuel.hecht [...] otrs.com
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Spam-Status: No, hits=-1.1 required=8.0 tests=BAYES_00,MSGID_MULTIPLE_AT
X-Mailer: Microsoft Office Outlook 12.0
Keywords: ((otrs))
Content-Language: de
X-Virus-Scanned: amavisd-new at otrs.com
content-type: text/plain; charset="utf-8"
Organization: OTRS AG
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 2D5184D8046 for <bug-MailTools [...] rt.cpan.org>; Thu, 26 Jun 2008 03:58:43 -0400 (EDT)
Received: (qmail 12836 invoked from network); 26 Jun 2008 07:58:43 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 26 Jun 2008 07:58:43 -0000
Received: from osser.otrs.com (HELO mail.otrs.com) (88.198.17.202) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Jun 2008 00:58:37 -0700
Received: from localhost (localhost [127.0.0.1]) by mail.otrs.com (Postfix) with ESMTP id EAF1970CD4 for <bug-MailTools [...] rt.cpan.org>; Thu, 26 Jun 2008 09:58:29 +0200 (CEST)
Received: from mail.otrs.com ([127.0.0.1]) by localhost (osser.otrs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24894-09 for <bug-MailTools [...] rt.cpan.org>; Thu, 26 Jun 2008 09:58:27 +0200 (CEST)
Received: from anakonda (unknown [81.27.174.154]) by mail.otrs.com (Postfix) with ESMTP id A192070A41 for <bug-MailTools [...] rt.cpan.org>; Thu, 26 Jun 2008 09:58:24 +0200 (CEST)
Delivered-To: cpan-bug+MailTools [...] diesel.bestpractical.com
Subject: Perl 5.10.0 displayed a "invalid dirhandle" warning in Mail/Field.pm
Return-Path: <manuel.hecht [...] otrs.com>
Thread-Index: AcjXYmrw6KC7ehWzSjO8TeE/GN6Y3w==
X-Original-To: bug-MailTools [...] rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Date: Thu, 26 Jun 2008 09:58:28 +0200
X-Spam-Level: *
Message-Id: <000001c8d762$6bb17d20$43147760$ [...] hecht [...] otrs.com>
To: <bug-MailTools [...] rt.cpan.org>
Content-Transfer-Encoding: 7bit
From: "Manuel Hecht - OTRS AG" <manuel.hecht [...] otrs.com>
X-RT-Original-Encoding: iso-8859-1
Content-Length: 2309
Download (untitled) / with headers
text/plain 2.2k
Hi @ all Perl 5.10.0 displayed a "invalid dirhandle" warning in Mail/Field.pm (line 51), if "use warnings" is enabled: Show quoted text
> index.pl: closedir() attempted on invalid dirhandle DIR at Mail/Field.pm
line 51. Here the code part: Show quoted text
> sub _require_dir > { my($class,$dir,$dir_sep) = @_; > > opendir DIR, $dir > or return; > > my @inc; > > foreach my $f (readdir DIR) > { $f =~ /^([\w\-]+)/ or next; > my $p = $1; > my $n = "$dir$dir_sep$p"; > > if(-d $n ) > { _require_dir("${class}::$f", $n, $dir_sep); > } > else > { $p =~ s/-/_/go; > eval "require ${class}::$p"; > } > } > closedir DIR; > }
The usage of the barewords as filehandles/dirhandles is deprecated in Perl 5.10! I think there are two solutions of this problem: 1. Use a indirect dirhandle: Show quoted text
> sub _require_dir > { my($class,$dir,$dir_sep) = @_; > > opendir my $DirHandle, $dir > or return; > > my @inc; > > foreach my $f (readdir $DirHandle) > { $f =~ /^([\w\-]+)/ or next; > my $p = $1; > my $n = "$dir$dir_sep$p"; > > if(-d $n ) > { _require_dir("${class}::$f", $n, $dir_sep); > } > else > { $p =~ s/-/_/go; > eval "require ${class}::$p"; > } > } > closedir $DirHandle; > }
This code works perfect under Perl 5.10, but I think the usage of indirect filehandles needs Perl 5.6.0 or later! 2. Disable Warnings in this part of the code: Show quoted text
> sub _require_dir > { my($class,$dir,$dir_sep) = @_; > > no warnings; > > opendir DIR, $dir > or return; > > my @inc; > > foreach my $f (readdir DIR) > { $f =~ /^([\w\-]+)/ or next; > my $p = $1; > my $n = "$dir$dir_sep$p"; > > if(-d $n ) > { _require_dir("${class}::$f", $n, $dir_sep); > } > else > { $p =~ s/-/_/go; > eval "require ${class}::$p"; > } > } > closedir DIR; > > use warnings; > }
This solution works with Perl 5.0, but I think it's not really a fix, is a workaround. ;-) Best regards, Manuel Hecht ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0)9421 56818 0 :: Fax: +49 (0)9421 56818 18 http://www.otrs.com/ :: Communication with success!
MIME-Version: 1.0
In-Reply-To: <000001c8d762$6bb17d20$43147760$ [...] hecht [...] otrs.com>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <000001c8d762$6bb17d20$43147760$ [...] hecht [...] otrs.com>
Message-Id: <rt-3.6.HEAD-4364-1215638067-905.37114-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 323
Download (untitled) / with headers
text/plain 323b
Sorry, your email got burried in my spam. I think the problem is differently. There is only one DIR, but the function is called recursively. This means that the inner call closes the file-handle of the outer call. When returning, the closedir complains about an undef DIR... Simple fix: add local *DIR before opendir.
MIME-Version: 1.0
X-Spam-Status: No, hits=-1.1 required=8.0 tests=BAYES_00,MSGID_MULTIPLE_AT
In-Reply-To: <rt-3.6.HEAD-4364-1215638067-905.37114-6-0 [...] rt.cpan.org>
X-Mailer: Microsoft Office Outlook 12.0
Keywords: ((otrs))
References: <RT-Ticket-37114 [...] rt.cpan.org> <000001c8d762$6bb17d20$43147760$ [...] hecht [...] otrs.com> <rt-3.6.HEAD-4364-1215638067-905.37114-6-0 [...] rt.cpan.org>
Content-Language: de
Content-Type: text/plain; charset="utf-8"
Organization: OTRS AG
X-RT-Original-Encoding: utf-8
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 4317B4D821D for <bug-MailTools [...] rt.cpan.org>; Thu, 10 Jul 2008 06:55:34 -0400 (EDT)
Received: (qmail 10389 invoked from network); 10 Jul 2008 10:55:34 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 10 Jul 2008 10:55:34 -0000
Received: from osser.otrs.com (HELO mail.otrs.com) (88.198.17.202) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Jul 2008 03:55:11 -0700
Received: from localhost (localhost [127.0.0.1]) by mail.otrs.com (Postfix) with ESMTP id 2E82175EFC for <bug-MailTools [...] rt.cpan.org>; Thu, 10 Jul 2008 12:55:06 +0200 (CEST)
Received: from mail.otrs.com ([127.0.0.1]) by localhost (osser.otrs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21158-01 for <bug-MailTools [...] rt.cpan.org>; Thu, 10 Jul 2008 12:55:03 +0200 (CEST)
Received: from anakonda (unknown [81.27.174.154]) by mail.otrs.com (Postfix) with ESMTP id 6E7B074446 for <bug-MailTools [...] rt.cpan.org>; Thu, 10 Jul 2008 12:55:03 +0200 (CEST)
Delivered-To: cpan-bug+MailTools [...] diesel.bestpractical.com
Subject: AW: [rt.cpan.org #37114] Perl 5.10.0 displayed a "invalid dirhandle" warning in Mail/Field.pm
Return-Path: <manuel.hecht [...] otrs.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-MailTools [...] rt.cpan.org
Thread-Index: AcjiDF7qvSHlCASoRU+yprv0Ha0joQAbP49Q
Date: Thu, 10 Jul 2008 12:54:55 +0200
X-Spam-Level: *
Message-Id: <000301c8e27b$63e70b40$2bb521c0$ [...] hecht [...] otrs.com>
To: <bug-MailTools [...] rt.cpan.org>
Content-Transfer-Encoding: quoted-printable
From: "Manuel Hecht - OTRS AG" <manuel.hecht [...] otrs.com>
RT-Message-ID: <rt-3.6.HEAD-28760-1215687358-1954.37114-0-0 [...] rt.cpan.org>
Content-Length: 1000
Download (untitled) / with headers
text/plain 1000b
Hi Hm, i overlooked the recursion. Sorry. I can verify the fix. It works perfect for me! :-) Thanks. Is the fix part of the next version? Best regards, Manuel Hecht ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0)9421 56818 0 :: Fax: +49 (0)9421 56818 18 http://www.otrs.com/ :: Communication with success! Show quoted text
-----Urspr√ľngliche Nachricht----- Von: Mark Overmeer via RT [mailto:bug-MailTools@rt.cpan.org] Gesendet: Mittwoch, 9. Juli 2008 23:14 An: manuel.hecht@otrs.com Betreff: [rt.cpan.org #37114] Perl 5.10.0 displayed a "invalid dirhandle" warning in Mail/Field.pm <URL: http://rt.cpan.org/Ticket/Display.html?id=37114 > Sorry, your email got burried in my spam. I think the problem is differently. There is only one DIR, but the function is called recursively. This means that the inner call closes the file-handle of the outer call. When returning, the closedir complains about an undef DIR... Simple fix: add local *DIR before opendir.
MIME-Version: 1.0
In-Reply-To: <000001c8d762$6bb17d20$43147760$ [...] hecht [...] otrs.com>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <000001c8d762$6bb17d20$43147760$ [...] hecht [...] otrs.com>
Message-Id: <rt-3.6.HEAD-12457-1220342878-1310.37114-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 28
2.04 was released on June 29


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.