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

Inaccuracy in perldiag #882

Closed
p5pRT opened this issue Nov 21, 1999 · 3 comments
Closed

Inaccuracy in perldiag #882

p5pRT opened this issue Nov 21, 1999 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 21, 1999

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

Searchable as RT1814$

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 1999

From mcafee@waits.facilities.med.umich.edu

The perldiag man page includes the following paragraph​:

  Can't use an undefined value as %s reference
  (F) A value used as either a hard reference or a
  symbolic reference must be a defined value. This helps
  to delurk some insidious errors.

In fact, it appears that this is only a fatal error when strict refs is in
effect. It's not an error at all, otherwise.

Perl Info


Site configuration information for perl 5.00503:

Configured by mcafee at Tue Aug 31 13:06:59 EDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos waits.facilities.med.umich.edu 5.6 generic_105181-03 sun4u sparc '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc -B/usr/ccs/bin/ -B/usr/ccs/bin/', optimize='-O', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc -B/usr/ccs/bin/ -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
    


@INC for perl 5.00503:
    /usr/local/lib/perl5/5.00503/sun4-solaris
    /usr/local/lib/perl5/5.00503
    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.005
    .


Environment for perl 5.00503:
    HOME=/export/home/mcafee
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=en_US
    LD_LIBRARY_PATH=/usr/local/gnome/lib:/usr/local/lib:/usr/um/tcl/lib:/usr/um/tk/lib:/usr/local/qt/lib
    LOGDIR (unset)
    PATH=/export/home/mcafee/bin:/usr/local/gnome/bin:/usr/local/bin:/usr/openwin/bin:/usr/um/gnu/bin:/usr/um/bin:/usr/ccs/bin:/usr/bin:/usr/um/perl/bin:/usr/games:/usr/local/qt/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 1999

From @tamias

On Sun, Nov 21, 1999 at 04​:52​:21AM -0500, Sean McAfee wrote​:

The perldiag man page includes the following paragraph​:

 Can't use an undefined value as %s reference
     \(F\) A value used as either a hard reference or a
     symbolic reference must be a defined value\.  This helps
     to delurk some insidious errors\.

In fact, it appears that this is only a fatal error when strict refs is in
effect. It's not an error at all, otherwise.

~> perl
no strict;
undef->[1];
Can't use an undefined value as an ARRAY reference at - line 2.
~>

Ronald

@p5pRT
Copy link
Author

p5pRT commented Nov 30, 1999

From [Unknown Contact. See original ticket]

Ronald J Kimball <rjk@​linguist.dartmouth.edu> wrote​:

On Sun, Nov 21, 1999 at 04​:52​:21AM -0500, Sean McAfee wrote​:

The perldiag man page includes the following paragraph​:

 Can't use an undefined value as %s reference
     \(F\) A value used as either a hard reference or a
     symbolic reference must be a defined value\.  This helps
     to delurk some insidious errors\.

In fact, it appears that this is only a fatal error when strict refs is in
effect. It's not an error at all, otherwise.

~> perl
no strict;
undef->[1];
Can't use an undefined value as an ARRAY reference at - line 2.

Guess I should have included a code sample. Sorry about the oversight.

bash-2.03$ perl -le '$x = undef; print @​$x'

bash-2.03$ perl -le 'use strict; my $x = undef; print @​$x'
Can't use an undefined value as an ARRAY reference at -e line 1.
bash-2.03$

Here's the essential part of the code which originally brought the behavior
to my attention​:

use strict;
my (@​result, %id, %dup);

%id = ( 1 => 'a', 2 => 'b', 3 => 'c');
%dup = ( 2 => [ 'x', 'y', 'z' ] );

@​result = map +($id{$_}, @​{ $dup{$_} }), 1, 2, 3;

I got the above error until I preceded the last line with "no strict 'refs'".

--
Sean McAfee | GCS d->-- s+++​: a27 C++ US+++ P+++$ L++ E- W+ N++ |
  | K w--- O? M- V-- PS+ PE Y+ PGP?>++ t+() 5++ X R+ | mcafee@​
  | tv+ b++ DI++ D+ G e++ h r---* y+>++ | umich.edu

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