Bad Switch statement

Posted by hsoli on 2010-01-21 11:44
Forums: PDK Support | OS: Windows XP Pro

Hello
I am trying to use switch statement
i get error when i tried to generate excutable file using perlapp
Bad switch statment ( Problem in the code block?)
any ideas about how to fix this issue.
It seems it is a bug.

Thanks
Hany

grahams
ActiveState Staff
Thu, 2010-02-04 10:35

Switch.pm is one of several modules that are written using source code filters. Source filters are incompatible with Perl Dev Kit.

It's in the release notes for PDK8, but it's been a listed known limitation in other older releases.
http://docs.activestate.com/pdk/8.2/Release.html#release_what_s_new_in_p...

monger_39 | Mon, 2017-01-30 13:18

I'm using Switch.pm for a very simple operation in a Perl GUI.
It runs fine in PL mode, but PerlApp (still) generates the
"Bad switch statement (problem in the code block?)"
I do not see the limitation about 'source code filters' mentioned in the PDK9.5 release notes.

What's the status ?

grahams
ActiveState Staff
Tue, 2017-01-31 16:30

The original "Switch" was implemented with source code filters. Code Filters are incompatible with the Perl Dev Kit by design. They cannot be predicted, and therefore can't be wrapped.

5.10 introduced a different Switch. Don't use that either. It was deprecated in 5.14 and has been removed. Even the module itself says:
Switch - A switch statement for Perl, do not use if you can use given/when