You want real life experience?

Don't

Disclaimer: my use of Switch is about 18 months old. I'm not sure how actively it has been developed since then. My impression was that it works as advertised for little hello world scripts, but in bigger pieces of work, it seems to introduce garbage behind the scenes (due to source filtering), and the parser barfs on perfectly valid code.

Symptoms usually involved the fact that the parser thought it was coming out a string (single or double quoted) when in fact it was going into one, or vice versa. (update: reading broquaint's reponse... "Yes, exactly!" The syntax errors in question are miles away from the switch statement).

Change a line around, and an error crops up somewhere else. It was most infuriating, and eventually any attempt to use it in a non-trivial script resulted in failure.

Some time after that, Petruchio posted Help Debug Switch.pm! but I must admit that I had neither the time nor inclination to go back and try again. Maybe it works better these days, but the alternate P5 ways of implementing a switch are ok by me. I'll wait for P6 for the real thing.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'

In reply to Re: Switch.pm gotchas? by grinder
in thread Switch.pm gotchas? by alanj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.