develooper Front page | perl.perl5.porters | Postings from June 2004

[perl #30409] charnames.pm clobbers default variable

Thread Next
From:
Marcel "Grünauer"
Date:
June 22, 2004 10:08
Subject:
[perl #30409] charnames.pm clobbers default variable
Message ID:
rt-3.0.9-30409-91174.12.8617678524438@perl.org
# New Ticket Created by  Marcel Grünauer 
# Please include the string:  [perl #30409]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=30409 >



This is a bug report for perl from marcel@noug.at,
generated with the help of perlbug 1.35 running under perl v5.9.2.

charnames.pm's import() clobbers $_.

$ perl -Mcharnames=:full -le print
:full

Here's a patch:

diff -ruN src.orig/lib/charnames.pm src/lib/charnames.pm
--- src.orig/lib/charnames.pm	Mon Feb  9 22:30:09 2004
+++ src/lib/charnames.pm	Tue Jun 22 18:38:23 2004
@@ -190,8 +190,8 @@
   ## fill %h keys with our @_ args.
   ##
   my ($promote, %h, @args) = (0);
-  while (@_ and $_ = shift) {
-    if ($_ eq ":alias") {
+  while (my $arg = shift) {
+    if ($arg eq ":alias") {
       @_ or
 	croak ":alias needs an argument in charnames";
       my $alias = shift;
@@ -210,11 +210,11 @@
       alias_file ($alias);
       next;
     }
-    if (m/^:/ and ! ($_ eq ":full" || $_ eq ":short")) {
-      warn "unsupported special '$_' in charnames";
+    if (substr($arg, 0, 1) eq ':' and ! ($arg eq ":full" || $arg eq ":short")) {
+      warn "unsupported special '$arg' in charnames";
       next;
     }
-    push @args, $_;
+    push @args, $arg;
   }
   @args == 0 && $promote and @args = (":full");
   @h{@args} = (1) x @args;



Marcel

---
Flags:
    category=library
    severity=low
---
Site configuration information for perl v5.9.2:

Configured by marcel at Tue Jun 22 18:01:17 CEST 2004.

Summary of my perl5 (revision 5 version 9 subversion 2 patch 22969) configuration:
  Platform:
    osname=darwin, osvers=7.4.0, archname=darwin-2level
    uname='darwin pcgr.cc.univie.ac.at 7.4.0 darwin kernel version 7.4.0: wed may 12 16:58:24 pdt 2004; root:xnuxnu-517.7.7.obj~7release_ppc power macintosh powerpc '
    config_args='-Dusedevel -Dprefix=/opt/perl -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include',
    optimize='-Os',
    cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1640)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib'

Locally applied patches:
    DEVEL22511

---
@INC for perl v5.9.2:
    /opt/perl/lib/5.9.2/darwin-2level
    /opt/perl/lib/5.9.2
    /opt/perl/lib
    /opt/perl/lib/5.9.2/darwin-2level
    /opt/perl/lib/5.9.2
    /opt/perl/lib/site_perl/5.9.2/darwin-2level
    /opt/perl/lib/site_perl/5.9.2
    /opt/perl/lib/site_perl
    .

---
Environment for perl v5.9.2:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/marcel
    LANG (unset)
    LANGUAGE (unset)
    LC_ALL=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/perl/bin:/opt/local/bin:/Users/marcel/bin:/usr/local/bin:/sw/bin:/sw/sbin:/opt/perl/bin:/opt/local/bin:/Users/marcel/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/X11R6/bin
    PERL5LIB=/opt/perl/lib
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About