develooper Front page | perl.perl5.porters | Postings from December 2010

weird Switch behavior with -s in code block

Thread Next
From:
Jan Hnatek
Date:
December 15, 2010 00:57
Subject:
weird Switch behavior with -s in code block
Message ID:
4D07889A.9090706@oracle.com
Hi,

guided by the Perl's Switch.pm doc, BUGS section:
   "Bug reports and other feedback are most welcome.",
could you please try the following code on
your perl installation?

===
#!/usr/bin/perl

use strict;
use warnings;
use Switch;

switch (shift) {
         case "test" {
                 -s "/etc/motd";
         }
         else {
                 print "unknown command";
         }
}
===

What's I'm getting on Solaris perl 5.8.4 and
Linux perl v5.10.1, is this:

$ ./fail_size test
syntax error at ./fail_size line 13, near "else"
syntax error at ./fail_size line 15, near "} continue"
syntax error at ./fail_size line 15, near "C_A_S_E_1: }"
Execution of ./fail_size aborted due to compilation errors.

I.e. the -s command somehow derails the switch parsing.
Please point me to your tracker if you want me to file a bug.

Regards,
hnhn

-- 
Jan Hnatek
jan.hnatek@oracle.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