Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exists(): error message on wrong argument type is incorrect (5.8.7 cygwin) #8414

Closed
p5pRT opened this issue Apr 20, 2006 · 8 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Apr 20, 2006

Migrated from rt.perl.org#38955 (status was 'resolved')

Searchable as RT38955$

@p5pRT
Copy link
Author

p5pRT commented Apr 20, 2006

From jeremyhetzler@gmail.com

Created by jeremyhetzler@gmail.com

Message-Id​: <5.8.7_3884_1145571853@​frederick>

This is a bug report for perl from jeremyhetzler@​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

Perl Info

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

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2006

From @rgs

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.

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2006

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2006

From jeremyhetzler@gmail.com

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

@p5pRT
Copy link
Author

p5pRT commented May 17, 2008

From p5p@spam.wizbit.be

On Thu Apr 20 15​:31​:19 2006, jeremyhetzler@​gmail.com 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.

[...]

Patch that changes the error message to​:
  'exists argument is not a HASH or ARRAY element or a subroutine'
attached.

@p5pRT
Copy link
Author

p5pRT commented May 17, 2008

From p5p@spam.wizbit.be

patch_op_exists

@p5pRT
Copy link
Author

p5pRT commented May 18, 2008

From @rgs

2008/5/17 Bram via RT <perlbug-followup@​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.

@p5pRT
Copy link
Author

p5pRT commented May 18, 2008

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant