Subject: | magic open() issue in Mail::Util::read_mbox() |
I have a script that uses read_mbox() that is choking on a file that has
trailing spaces. Apparently this is expected behavior with the
two-argument form of open():
"The filename passed to 2-argument (or 1-argument) form of open() will
have leading and trailing whitespace deleted, and the normal redirection
characters honored."
(Quoting "perldoc -f open".)
The attached patch (against 1.74) changes the two-argument open() call
to a three-argument open(), which fixes my problem. The only downside
is requiring 5.6.1, since in my reading of perldelta561.pod, that's
where the three-argument open() was introduced.
Subject: | read_mbox.patch |
--- Mail/Util.pm.orig 2006-01-21 03:16:10.000000000 -0600
+++ Mail/Util.pm 2006-07-27 14:10:14.000000000 -0500
@@ -13,7 +13,7 @@
use Exporter ();
BEGIN {
- require 5.000;
+ require 5.006_001;
$VERSION = "1.74";
@@ -102,7 +102,7 @@
local *FH;
local $_;
- open(FH,"< $file") or
+ open(FH,'<',$file) or
do {
require Carp;
Carp::croak("cannot open '$file': $!\n");