Your message dated Sun, 3 Apr 2016 22:59:05 +0300
with message-id <[email protected]>
and subject line Re: Bug#261953: perl: confusing error message when using STDIN 
as IO::Handle without require
has caused the Debian Bug report #261953,
regarding perl: confusing error message when using STDIN as IO::Handle without 
require
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
261953: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261953
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: perl
Version: 5.8.4-2
Severity: wishlist

Running the following command:
  perl -e 'STDIN->close'
causes the following error message to be printed:
  Can't locate object method "close" via package "IO::Handle" at -e line 1.

I find this message confusing, as it implies that the IO::Handle package
doesn't have a close method (it does). The real problem is that IO::Handle
has not been loaded, but STDIN is automagically an IO::Handle. The code can
be fixed by adding a 'require IO::Handle' statement.

Clearly it's not all that confusing in this example; if you're going to use
the IO::Handle features of STDIN, then 'require' it. However, when I first
ran into it, my program was something like this:
 - a module's function took a file handle as a parameter. Clearly it
   shouldn't require IO::Handle, as the file handle could be any blessed
   object that implements the right functions.
 - the main script passed *STDIN to the module function. It didn't require
   IO::Handle because it didn't know how the module function was going to use
   the parameter.
In this example, the "right" thing to do is to 'require IO::Handle' in the
main script. However, the error message that says:
  Can't locate object method "close" via package "IO::Handle" IN THE MODULE
is rather confusing. It makes one believe that:
 a) the error is in the module
 b) there is no close method in IO::Handle, which is not really true

Possible solutions include:
 - a better error message that indicates that IO::Handle has not actually
   been loaded, which is the real problem.
 - automagically load IO::Handle when needed so that this is never a problem

I suspect both solutions would be more trouble to implement than they're
worth, thus the "wishlist" severity of this report.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-1-k7-smp
Locale: LANG=C, LC_CTYPE=C

Versions of packages perl depends on:
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libdb4.2                    4.2.52-16    Berkeley v4.2 Database Libraries [
ii  libgdbm3                    1.8.3-2      GNU dbm database routines (runtime
ii  perl-base                   5.8.4-2      The Pathologically Eclectic Rubbis
ii  perl-modules                5.8.4-2      Core Perl modules.

-- no debconf information


--- End Message ---
--- Begin Message ---
Version: 5.14.0-1

On Thu, Jul 29, 2004 at 01:51:52AM -0400, Jeff King wrote:
> Package: perl
> Version: 5.8.4-2
> Severity: wishlist
> 
> Running the following command:
>   perl -e 'STDIN->close'
> causes the following error message to be printed:
>   Can't locate object method "close" via package "IO::Handle" at -e line 1.

> Possible solutions include:
>  - a better error message that indicates that IO::Handle has not actually
>    been loaded, which is the real problem.
>  - automagically load IO::Handle when needed so that this is never a problem

Your second suggestion was implemented in Perl 5.13.8 with
 
http://perl5.git.perl.org/perl.git/commit/15e6cdd91beb4cefae4b65e855d68cf64766965d

Apologies for the delay, closing accordingly.
-- 
Niko Tyni   [email protected]

--- End Message ---

Reply via email to