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

[PATCH] Fix use of == to compare strings in perlref.pod #15094

Closed
p5pRT opened this issue Dec 15, 2015 · 7 comments
Closed

[PATCH] Fix use of == to compare strings in perlref.pod #15094

p5pRT opened this issue Dec 15, 2015 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 15, 2015

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

Searchable as RT126933$

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2015

From @ilmari

Created by @ilmari

The examples for refaliasing were using == to compare strings.
The attached patch fixes this.

Perl Info

Flags:
    category=docs
    severity=low
    Type=Patch
    PatchStatus=HasPatch

Site configuration information for perl 5.23.4:

Configured by ilmari at Tue Oct  6 23:14:52 BST 2015.

Summary of my perl5 (revision 5 version 23 subversion 4) configuration:
  Derived from: 30e379a544579363811d8b35c4fe4b5527859188
  Platform:
    osname=linux, osvers=4.1.0-1-amd64, archname=x86_64-linux
    uname='linux nurket 4.1.0-1-amd64 #1 smp debian 4.1.3-1 (2015-08-03) x86_64 gnulinux '
    config_args='-des -Dusedevel -Uversiononly'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='4.9.3', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    uncommitted-changes


@INC for perl 5.23.4:
    lib
    /home/ilmari/.perlbrew/libs/18.2@std/lib/perl5/x86_64-linux
    /home/ilmari/.perlbrew/libs/18.2@std/lib/perl5
    /usr/local/lib/perl5/site_perl/5.23.4/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.23.4
    /usr/local/lib/perl5/5.23.4/x86_64-linux
    /usr/local/lib/perl5/5.23.4
    .


Environment for perl 5.23.4:
    HOME=/home/ilmari
    LANG=en_GB.utf8
    LANGUAGE=en_GB:en
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ilmari/.perlbrew/libs/18.2@std/bin:/home/ilmari/perl5/perlbrew/bin:/home/ilmari/perl5/perlbrew/perls/18.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL5LIB=/home/ilmari/.perlbrew/libs/18.2@std/lib/perl5
    PERLBREW=command perlbrew
    PERLBREW_BASHRC_VERSION=0.73
    PERLBREW_HOME=/home/ilmari/.perlbrew
    PERLBREW_LIB=std
    PERLBREW_MANPATH=/home/ilmari/.perlbrew/libs/18.2@std/man:/home/ilmari/perl5/perlbrew/perls/18.2/man
    PERLBREW_PATH=/home/ilmari/.perlbrew/libs/18.2@std/bin:/home/ilmari/perl5/perlbrew/bin:/home/ilmari/perl5/perlbrew/perls/18.2/bin
    PERLBREW_PERL=18.2
    PERLBREW_ROOT=/home/ilmari/perl5/perlbrew
    PERLBREW_VERSION=0.73
    PERLDOC_PAGER=less -Ri
    PERL_AUTOINSTALL_PREFER_CPAN=1
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=/home/ilmari/.perlbrew/libs/18.2@std
    PERL_MB_OPT=--install_base /home/ilmari/.perlbrew/libs/18.2@std
    PERL_MM_OPT=INSTALL_BASE=/home/ilmari/.perlbrew/libs/18.2@std
    PERL_MM_PREFER_CPAN=1
    PERL_MM_USE_DEFAULT=1
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2015

From @ilmari

0001-Fix-use-of-to-compare-strings-in-perlref.pod.patch
From 8dbef62fbe38ab1811044a0fd27425d7d8c8f3f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Tue, 15 Dec 2015 23:45:00 +0000
Subject: [PATCH] Fix use of == to compare strings in perlref.pod

---
 pod/perlref.pod | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pod/perlref.pod b/pod/perlref.pod
index e570b72..5804c17 100644
--- a/pod/perlref.pod
+++ b/pod/perlref.pod
@@ -887,7 +887,7 @@ for obfuscated code:
     # @harry is (1,2,3)
 
     my $type = ref $thingy;
-    ($type ? $type == 'ARRAY' ? \@foo : \$bar : $baz) = $thingy;
+    ($type ? $type eq 'ARRAY' ? \@foo : \$bar : $baz) = $thingy;
 
 The C<foreach> loop can also take a reference constructor for its loop
 variable, though the syntax is limited to one of the following, with an
@@ -906,7 +906,7 @@ arrays-of-arrays, or arrays-of-hashes:
     }
 
     foreach \my %h (@array_of_hashes) {
-        $h{gelastic}++ if $h{type} == 'funny';
+        $h{gelastic}++ if $h{type} eq 'funny';
     }
 
 B<CAVEAT:> Aliasing does not work correctly with closures.  If you try to
-- 
2.6.2

@p5pRT
Copy link
Author

p5pRT commented Dec 16, 2015

@khwilliamson - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Dec 16, 2015

From @khwilliamson

Thanks, applied as 74bfae2
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Dec 16, 2015

@khwilliamson - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 13, 2016

From @khwilliamson

Thank you for submitting this report. You have helped make Perl better.
 
With the release of Perl 5.24.0 on May 9, 2016, this and 149 other issues have been resolved.

Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0

@p5pRT
Copy link
Author

p5pRT commented May 13, 2016

@khwilliamson - Status changed from 'pending release' 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