Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Switch and function prototypes

Reply
Thread Tools

Switch and function prototypes

 
 
Joe Gottman
Guest
Posts: n/a
 
      10-09-2003
I tried to compile the following code in my Perl program:

#!/usr/bin/perl

use strict;
use Switch;

sub testSwitch ($)
{
my $param = shift;
switch ($param) {}
}


I got the following error:
syntax error at test.pl line 9, near ") {"
syntax error at test.pl line 10, near "}"
Execution of test.pl aborted due to compilation errors.

Strangely, when I declared the function with no prototype, or replaced the
"$" with "$;", the program compiled fine. Does anyone have any idea why
this is happening?

Joe Gottman


 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      10-09-2003
Joe Gottman <> wrote in comp.lang.perl.misc:
> I tried to compile the following code in my Perl program:
>
> #!/usr/bin/perl
>
> use strict;
> use Switch;
>
> sub testSwitch ($)
> {
> my $param = shift;
> switch ($param) {}
> }
>
>
> I got the following error:
> syntax error at test.pl line 9, near ") {"
> syntax error at test.pl line 10, near "}"
> Execution of test.pl aborted due to compilation errors.
>
> Strangely, when I declared the function with no prototype, or replaced the
> "$" with "$;", the program compiled fine. Does anyone have any idea why
> this is happening?


That looks like a bug in the Switch module to me, though it could also
be a bug in Perl's prototyping system. It's hard to see what's going on,
because Switch.pm uses a source filter. Unless someone else has a better
idea, I'd report it.

Anno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
function prototypes and function addresses Syren Baran C Programming 6 01-09-2008 06:34 PM
extern and function prototypes quarkLore C Programming 5 04-20-2007 08:59 PM
Include files with function prototypes and variable declaration/definition Kristian Virkus C Programming 7 02-08-2007 07:22 AM
function prototypes and declarations goldfita@signalsguru.net C Programming 5 05-13-2006 06:39 AM
New to Python; what about #include, extern and function prototypes Bo Jacobsen Python 6 03-07-2004 02:37 PM



Advertisments