Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

[perl #38955] exists(): error message on wrong argument type is incorrect (5.8.7 cygwin)

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Apr 20, 2006, 3:31 PM

Post #1 of 4 (257 views)
Permalink
[perl #38955] exists(): error message on wrong argument type is incorrect (5.8.7 cygwin)

# New Ticket Created by Jeremy Hetzler
# Please include the string: [perl #38955]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38955 >


Message-Id: <5.8.7_3884_1145571853[at]frederick>

This is a bug report for perl from jeremyhetzler[at]gmail.com,
generated with the help of perlbug 1.35 running under perl v5.8.7.

-----------------------------------------------------------------
The error message when passing exists() a wrong argument type is:

$ perl -e'exists $foo'
exists argument is not a HASH or ARRAY element at -e line 1.

Likewise, /bin/splain reports:

$ perl -e'exists $foo' 2>&1 | splain
exists argument is not a HASH or ARRAY element at -e line 1 (#1)
(F) The argument to exists() must be a hash or array element, such as:

$foo{$bar}
$ref->{"susie"}[12]

However, the argument to exists can legitimately also be a subroutine
name:

$ perl -e'exists &foo'

The docs correctly state that the argument can be any of a hash element,
an array element, or a subroutine name.

The error message should be:
exists argument is not a HASH or ARRAY element or subroutine name at
-e line 1.

The splain output should be:
(F) The argument to exists() must be a hash or array element or
a subroutine name, such as:

$foo{$bar}
$ref->{"susie"}[12]
&foo

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl v5.8.7:

Configured by gerrit at Fri Dec 30 02:40:15 2005.

Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=cygwin, osvers=1.5.18(0.13242),
archname=cygwin-thread-multi-64int
uname='cygwin_nt-5.1 inspiron 1.5.18(0.13242) 2005-07-02 20:30 i686
unknown unknown cygwin '
config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads
-Uusemymalloc -Doptimize=-O3 -Dman3ext=3pm -Dusesitecustomize'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing
-pipe -I/usr/local/include',
optimize='-O3',
cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe
-I/usr/local/include'
ccversion='', gccversion='3.4.4 (cygming special) (gdc 0.12, using
dmd 0.125)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='ld2', ldflags =' -s -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -lcrypt -lgdbm_compat
perllibs=-lcrypt -lgdbm_compat
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'

Locally applied patches:
SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962

---
@INC for perl v5.8.7:
/home/steveb/lib/perl
lib
/usr/lib/perl5/5.8/cygwin
/usr/lib/perl5/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
.

---
Environment for perl v5.8.7:
HOME=/home/steveb
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR=/home/steveb/log

PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/usr/local/bin:/usr/bin:/c/Program
Files/VDMSound:/c/Program Files/ATI Technologies/ATI Control
Panel:/d/Java/jdk1.5.0_05/bin:/d/programs/diskeeper/:/c/Program
Files/MKVtoolnix:~/scripts:/c/Program Files/PuTTY
PERL5LIB=/home/steveb/lib/perl:lib
PERLIO=perlio
PERLLIB=/e/steveb/lib/perl
PERL_BADLANG (unset)
SHELL=/usr/bin/bash


rgarciasuarez at mandriva

Apr 21, 2006, 9:36 AM

Post #2 of 4 (242 views)
Permalink
Re: [perl #38955] exists(): error message on wrong argument type is incorrect (5.8.7 cygwin) [In reply to]

Jeremy Hetzler (via RT) wrote:
> The error message when passing exists() a wrong argument type is:
>
> $ perl -e'exists $foo'
> exists argument is not a HASH or ARRAY element at -e line 1.

> However, the argument to exists can legitimately also be a subroutine
> name:
>
> $ perl -e'exists &foo'
>
> The docs correctly state that the argument can be any of a hash element,
> an array element, or a subroutine name.
>
> The error message should be:
> exists argument is not a HASH or ARRAY element or subroutine name at
> -e line 1.

So, one should probably merge both error messages :

$ perl -e 'exists &foo()'
exists argument is not a subroutine name at -e line 1.


jeremyhetzler at gmail

Apr 21, 2006, 1:40 PM

Post #3 of 4 (238 views)
Permalink
Re: [perl #38955] exists(): error message on wrong argument type is incorrect (5.8.7 cygwin) [In reply to]

Rafael Garcia-Suarez via RT wrote:
> So, one should probably merge both error messages :
>
> $ perl -e 'exists &foo()'
> exists argument is not a subroutine name at -e line 1.
>
I hadn't noticed that. Yes, they should both give the same error
message. Here's an updated version that's a little more clear:

exists argument is not a HASH element, ARRAY element, or subroutine
name at -e line 1.

I think this would work for both the $foo and &foo() cases.

Jeremy


rgarciasuarez at gmail

May 18, 2008, 12:56 AM

Post #4 of 4 (90 views)
Permalink
Re: [perl #38955] exists(): error message on wrong argument type is incorrect (5.8.7 cygwin) [In reply to]

2008/5/17 Bram via RT <perlbug-followup[at]perl.org>:
> Patch that changes the error message to:
> 'exists argument is not a HASH or ARRAY element or a subroutine'
> attached.

Thanks, applied as #33849.

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.