Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Syntax error with use constant and switch with comment between

by ikegami (Patriarch)
on Dec 04, 2009 at 23:05 UTC ( [id://811175]=note: print w/replies, xml ) Need Help??


in reply to Syntax error with use constant and switch with comment between

Don't use Switch. It creates problems, and they're impossible to debug.

If you have 5.10, use given/when. See perlsyn

  • Comment on Re: Syntax error with use constant and switch with comment between

Replies are listed 'Best First'.
Re^2: Syntax error with use constant and switch with comment between
by ascetic (Novice) on Dec 06, 2009 at 18:01 UTC

    I guess I assumed that a core module would not create problems; especially in such a trivial example. I decided to give Switch a try after years of looking the other way because it seemed experimental. No, I don't have 5.10 at work, but this may cause me to push for an update. Curious why you didn't suggest getting rid of use const or not using comments because they create problems? ;)

      The problem with the Switch module is that it use a source filter to implement the syntax, but the parser is not very robust and that means it is easily confused. Simply best not to use it. Bewildering that it was ever made a part of the core.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      Curious why you didn't suggest getting rid of use const or not using comments because they create problems?

      Why would I suggest that you stop writing Perl so you can use an unnecessary and broken module?

        Unnecessary is a matter of opinion really. The fact is that this piece of code behaves differently when a comment is changed and I find this unsettling to say the least. Why wouldn't the first thing a source filter do is remove lines beginning with #?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://811175]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-24 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found