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

do q() [or qq() or qw(), etc] #2339

Closed
p5pRT opened this issue Aug 9, 2000 · 3 comments
Closed

do q() [or qq() or qw(), etc] #2339

p5pRT opened this issue Aug 9, 2000 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 9, 2000

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

Searchable as RT3663$

@p5pRT
Copy link
Author

p5pRT commented Aug 9, 2000

From [email protected]

Created by [email protected]

The do() function, when given a string quoted with the q, qq, or qw
operators, and when used without parentheses, causes a syntax error​:

  jeffp@​hut [9​:25am] ~ #105> perl -we 'do q{foo.bar}'
  syntax error at -e line 1, near "do q{"
  Unquoted string "foo" may clash with future reserved word at -e line 1.
  Unquoted string "bar" may clash with future reserved word at -e line 1.
  Execution of -e aborted due to compilation errors.

  jeffp@​hut [9​:25am] ~ #106> perl -MO=Deparse -we 'do q{foo.bar}'
  syntax error at -e line 1, near "do q{"
  Unquoted string "foo" may clash with future reserved word at -e line 1.
  Unquoted string "bar" may clash with future reserved word at -e line 1.
  -e had compilation errors.

In 5.005_03, this is the course of events​:

  jefpin@​towers [9​:22am] ~ #69> perl -we 'do q{foo.bar}'
  Unquoted string "foo" may clash with future reserved word at -e line 1.
  Unquoted string "bar" may clash with future reserved word at -e line 1.
  Can't use subscript on constant item at -e line 1, near "bar}"
  Execution of -e aborted due to compilation errors.

  jefpin@​towers [9​:22am] ~ #70> perl -MO=Deparse -we 'do q{foo.bar}'
  Unquoted string "foo" may clash with future reserved word at -e line 1.
  Unquoted string "bar" may clash with future reserved word at -e line 1.
  Can't use subscript on constant item at -e line 1, near "bar}"
  -e had compilation errors.
  do $q{'foobar'};

In 5.005_02, this is the course of events​:

  jeffp@​friday [9​:20am] pa #117> perl -we 'do q{foo.bar}'
  Unquoted string "foo" may clash with future reserved word at -e line 1.
  Unquoted string "bar" may clash with future reserved word at -e line 1.
  Can't use subscript on constant item at -e line 1, near "bar}"
  Execution of -e aborted due to compilation errors.

  jeffp@​friday [9​:20am] pa #118> perl -MO=Deparse -we 'do q{foo.bar}'
  Unquoted string "foo" may clash with future reserved word at -e line 1.
  Unquoted string "bar" may clash with future reserved word at -e line 1.
  Can't use subscript on constant item at -e line 1, near "bar}"
  -e had compilation errors.
  do $q{'foobar'};

What in the world is that? Seems mighty nasty to me.

5.6 doesn't do that q -> $q conversion, but it is still icky. Workarounds
include​:

  jeffp@​hut [9​:25am] ~ #107> perl -we 'do +q{foo.bar}'

  jeffp@​hut [9​:27am] ~ #108> perl -MO=Deparse -we 'do +q{foo.bar}'
  do 'foo.bar';
  -e syntax OK

  jeffp@​hut [9​:27am] ~ #110> perl -we 'do(q{foo.bar})'

  jeffp@​hut [9​:27am] ~ #111> perl -MO=Deparse -we 'do(q{foo.bar})'
  do 'foo.bar';
  -e syntax OK

I don't enough to make an intelligent analysis, but I'd fumbly say it's a
parsing issue of some sort.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.6.0:

Configured by robsiemb at Wed Jun 28 15:35:19 EDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=freebsd, osvers=2.2.8-release, archname=i386-freebsd
    uname='freebsd hut.crusoe.net 2.2.8-release freebsd 2.2.8-release #0: fri sep 3 10:23:22 edt 1999 [email protected]:usrsrcsyscompilehut i386 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2.1
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=true
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-lm -lc -lcrypt
    libc=/usr/lib/libc.so.3.1, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fpic', lddlflags='-Bshareable  -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /usr/local/lib/perl5/5.6.0/i386-freebsd
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.005
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=/home/jeffp
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/usr/ucb:/usr/sbin:/usr/openwin/bin:/bin:/crusoe/appl/bin:/usr/local/netscape:/usr/ccs/bin:.:/home/jeffp/utils:/home/jeffp/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh


@p5pRT
Copy link
Author

p5pRT commented Jul 20, 2003

From [email protected]

This seems to have been resolved in 5.8

@p5pRT
Copy link
Author

p5pRT commented Jul 20, 2003

[email protected] - 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