Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Best option for "switch/case" functionality? (magic numbers)

by Anonymous Monk
on Jun 29, 2016 at 00:09 UTC ( [id://1166827]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Best option for "switch/case" functionality? (magic numbers)
in thread Best option for "switch/case" functionality?

Isn't that lexical to the BEGIN{} block?
  • Comment on Re^3: Best option for "switch/case" functionality? (magic numbers)

Replies are listed 'Best First'.
Re^4: Best option for "switch/case" functionality? (BEGIN)
by tye (Sage) on Jun 29, 2016 at 02:28 UTC

    Nope. Otherwise, 'use' couldn't work as it is just syntactic sugar for pretty much what I wrote (well, 'no' more than 'use' in this case). Now, if you put 'use' in a BEGIN block, then it could have impacts lexically scoped to the BEGIN block, but that is because it would be short for:

    BEGIN { BEGIN { require ...; ...->import( ... ) } }

    - tye        

      The eval block?

        Maybe instead of tossing off random questions, why don't you try it and see? I already did that before I posted it.

        If I wanted to make it lexically scoped to the 'eval' block, then I'd have to write:

        BEGIN { eval { BEGIN { require ...; ...->import( ... ) } ... } }

        Which, of course, I didn't.

        - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1166827]
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: (4)
As of 2024-04-23 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found