develooper Front page | perl.perl5.porters | Postings from October 2005

named escapes in eval fail

Thread Next
From:
Peter Scott
Date:
October 27, 2005 10:01
Subject:
named escapes in eval fail
Message ID:
pan.2005.10.27.16.42.22.748525@PSDT.com
The POD for charnames.pm says:

  BUGS
       Since evaluation of the translation function happens in a middle of
       compilation (of a string literal), the translation function should not
       do any "eval"s or "require"s.  This restriction should be lifted in a
       future version of Perl.

However, that restriction seems to extend to using named escapes in evals,
not merely custom forms of the translation function:

$ ./perl -Ilib -Mstrict -Mwarnings -l
use charnames qw( :full );
print "No eval: \N{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}";
eval q[ print "Eval: \N{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}" ];
$@ and print "Exception: $@";
^D
No eval: «
Exception: Constant(\N{...}): $^H{charnames} is not defined at (eval 2) line 1, within string

Should the POD be changed?

$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 9 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.6.10-1.741_fc3, archname=i586-linux
    uname='linux tweety.homeip.net 2.6.10-1.741_fc3 #1 thu jan 13 16:37:38 est 2005 i586 i586 i386 gnulinux '
    config_args='-des -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    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-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='3.4.3 20050227 (Red Hat 3.4.3-22.fc3)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
                        SPRINTF_RETURNS_STRLEN USE_LARGE_FILES USE_PERLIO
  Locally applied patches:
        DEVEL25849
  Built under linux
  Compiled at Oct 25 2005 17:33:42
  @INC:
    lib
    /usr/local/lib/perl5/5.9.3/i586-linux
    /usr/local/lib/perl5/5.9.3
    /usr/local/lib/perl5/site_perl/5.9.3/i586-linux
    /usr/local/lib/perl5/site_perl/5.9.3
    /usr/local/lib/perl5/site_perl
    .

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


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