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

Switch module doesn't like subroutine prototypes? [rt.cpan.org #71512] #8529

Closed
p5pRT opened this issue Jul 18, 2006 · 6 comments
Closed

Switch module doesn't like subroutine prototypes? [rt.cpan.org #71512] #8529

p5pRT opened this issue Jul 18, 2006 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 18, 2006

Migrated from rt.perl.org#39861 (status was 'rejected')

Searchable as RT39861$

@p5pRT
Copy link
Author

p5pRT commented Mar 6, 2004

From @rgs

Created by rafael@dat.local

The following program doesn't work (with Switch 2.10) :

#!perl
use Switch 'perl6';
sub foo ($) {
  my $var = shift;
  given ($var){
  when 'hej' {print "Hopp\n";}
  else {die "D'oh\n";}
  }
}
foo('hej');
__END__

Using another prototype for foo() makes Switch recognize properly the
switch statement.

I guess "$)" confuses slighty the source filter. (Maybe the problem
is in Text​::Balanced.)

Perl Info

Flags:
    category=library
    severity=low

Site configuration information for perl v5.9.1:

Configured by rafael at Wed Mar  3 22:57:57 CET 2004.

Summary of my perl5 (revision 5 version 9 subversion 1 patch 21538) configuration:
  Platform:
    osname=linux, osvers=2.4.20, archname=i686-linux
    uname='linux dat 2.4.20 #1 sun dec 1 21:25:14 cet 2002 i686 unknown '
    config_args='-des -Dusedevel -Dprefix=/opt/perl -Doptimize=-g -DDEBUGGING'
    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 ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-85)', 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 -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    DEVEL21538


@INC for perl v5.9.1:
    /home/rafael/bleadperl/lib
    /opt/perl/lib/5.9.1/i686-linux
    /opt/perl/lib/5.9.1
    /opt/perl/lib/site_perl/5.9.1/i686-linux
    /opt/perl/lib/site_perl/5.9.1
    /opt/perl/lib/site_perl
    .


Environment for perl v5.9.1:
    HOME=/home/rafael
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/perl/bin:/home/rafael/bin:/usr/local/subversion/bin:/usr/local/gcc34s/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2006

From @steve-m-hay

Created by @steve-m-hay

The following program​:

use Switch;
sub foo($) { switch ($_[0]) { case 1 { print "OK\n" } } }
foo(1);

outputs the following errors​:

Number found where operator expected at test.pl line 2, near "case 1"
  (Do you need to predeclare case?)
syntax error at test.pl line 2, near ") {"
syntax error at test.pl line 2, near "} }"
Execution of test.pl aborted due to compilation errors.

If you delete the prototype on the subroutine foo() then the program
prints OK as expected.

(I'm using an old perlbug here, because later ones seem to do absolutely
nothing on Win32.)

Perl Info

Flags:
     category=library
     severity=medium

This perlbug was built using Perl v5.6.1 - Tue Apr 17 15:55:30 2001
It is being executed now by  Perl v5.9.4 - Wed Jul 12 12:12:13 2006.

Site configuration information for perl v5.9.4:

Configured by steveh at Wed Jul 12 12:12:13 2006.

Summary of my perl5 (revision 5 version 9 subversion 4) configuration:
   Platform:
     osname=MSWin32, osvers=5.1, archname=MSWin32-x86-perlio
     uname=''
     config_args='undef'
     hint=recommended, useposix=true, d_sigaction=undef
     useithreads=undef, usemultiplicity=undef
     useperlio=define, d_sfio=undef, uselargefiles=undef, usesocks=undef
     use64bitint=undef, use64bitall=undef, uselongdouble=undef
     usemymalloc=y, bincompat5005=undef
   Compiler:
     cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_DEBUGGING_MSTATS 
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
     optimize='-Od -MD -Zi -DDEBUGGING',
     cppflags='-DWIN32'
     ccversion='12.00.8804', gccversion='', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=4
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='link', ldflags ='-nologo -nodefaultlib -debug 
-libpath:"C:\perl5\lib\CORE"  -machine:x86'
     libpth="C:\Program Files\Microsoft Visual Studio\VC98\lib"
     libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib 
odbc32.lib odbccp32.lib msvcrt.lib
     perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib 
version.lib odbc32.lib odbccp32.lib msvcrt.lib
     libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl59.lib
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-libpath:"C:\perl5\lib\CORE"  -machine:x86'

Locally applied patches:



@INC for perl v5.9.4:
     C:/perl5/lib
     C:/perl5/site/lib
     .


Environment for perl v5.9.4:
     HOME (unset)
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\perl5\bin;U:\scripts\batch;C:\Program 
Files\ZipGenius 6\;C:\Program Files\Sybase\SQL Anywhere 
8\win32;C:\Program Files\Sybase\Shared\win32;C:\Program Files\Sybase\SQL 
Anywhere 8\drivers;C:\Program Files\Sybase\Shared\Sybase Central 
4.1;C:\Program Files\QuickTime\QTSystem\;C:\Program 
Files\InstallShield\InstallShield 5.5 Professional 
Edition\Program;C:\Program 
Files\Subversion\bin;C:\WATCOM\BINNT;C:\WATCOM\BINW
     PERL_BADLANG (unset)
     SHELL (unset)

-- 


------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.

@p5pRT
Copy link
Author

p5pRT commented Oct 6, 2011

From @cpansprout

Forwarding to the CPAN queue....

On Sat Mar 06 09​:34​:24 2004, rafael wrote​:

This is a bug report for perl from rafael@​dat.local,
generated with the help of perlbug 1.35 running under perl v5.9.1.

-----------------------------------------------------------------
[Please enter your report here]

The following program doesn't work (with Switch 2.10) :

#!perl
use Switch 'perl6';
sub foo ($) {
my $var = shift;
given ($var){
when 'hej' {print "Hopp\n";}
else {die "D'oh\n";}
}
}
foo('hej');
__END__

Using another prototype for foo() makes Switch recognize properly the
switch statement.

I guess "$)" confuses slighty the source filter. (Maybe the problem
is in Text​::Balanced.)

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags​:
category=library
severity=low
---
Site configuration information for perl v5.9.1​:

Configured by rafael at Wed Mar 3 22​:57​:57 CET 2004.

Summary of my perl5 (revision 5 version 9 subversion 1 patch 21538)
configuration​:
Platform​:
osname=linux, osvers=2.4.20, archname=i686-linux
uname='linux dat 2.4.20 #1 sun dec 1 21​:25​:14 cet 2002 i686
unknown '
config_args='-des -Dusedevel -Dprefix=/opt/perl -Doptimize=-g
-DDEBUGGING'
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 ='-DDEBUGGING -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/include/gdbm',
optimize='-g',
cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include
-I/usr/include/gdbm'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-
85)', 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 -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false,
libperl=libperl.a
gnulibc_version='2.2.5'
Dynamic Linking​:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:
DEVEL21538

---
@​INC for perl v5.9.1​:
/home/rafael/bleadperl/lib
/opt/perl/lib/5.9.1/i686-linux
/opt/perl/lib/5.9.1
/opt/perl/lib/site_perl/5.9.1/i686-linux
/opt/perl/lib/site_perl/5.9.1
/opt/perl/lib/site_perl
.

---
Environment for perl v5.9.1​:
HOME=/home/rafael
LANG=en_US
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)

PATH=/usr/local/bin​:/bin​:/usr/bin​:/usr/X11R6/bin​:/opt/perl/bin​:/home/rafael/bin​:/usr/local/subversion/bin​:/usr/local/gcc34s/bin

PERL\_BADLANG \(unset\)
SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Oct 6, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 6, 2011

@cpansprout - Status changed from 'open' to 'rejected'

@p5pRT p5pRT closed this as completed Oct 6, 2011
@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2014

From bug-Switch@rt.cpan.org

<URL​: https://rt.cpan.org/Ticket/Display.html?id=71512 >

Documented as limitation. http​://search.cpan.org/~chorny/Switch-2.17/Switch.pm#LIMITATIONS

--
Alexandr Ciornii, http​://chorny.net

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