Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^7: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)

by hobbs (Monk)
on Aug 04, 2017 at 14:28 UTC ( #1196733=note: print w/replies, xml ) Need Help??


in reply to Re^6: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
in thread Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)

The ellipses are enough to make that quote inaccurate. This is a package with a block, which means it continues until the end of the block. Which means that at the end of the block, things go back to being in the surrounding package.
  • Comment on Re^7: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)

Replies are listed 'Best First'.
Re^8: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
by soonix (Canon) on Aug 04, 2017 at 16:28 UTC
    I don't think so. Yes, it's a partial quote, but what I left off (end of surrounding block etc.) doesn't change much. When a package begins, the previous package ends. As I understand it, at end of enclosing block, the package ends, and you are in package main.
    Update: I was completely wrong, see below...
      As I understand it, at end of enclosing block, the package ends, and you are in package main.

      No. You are back in the package you came from:

      package Foo { print "(1) package " . __PACKAGE__ . $/; package Bar { print "(2) package " . __PACKAGE__ . $/; } print "(3) package " . __PACKAGE__ . $/; } print "(4) package " . __PACKAGE__ . $/; __END__ (1) package Foo (2) package Bar (3) package Foo (4) package main
      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
        That's what I deserve for posting before testing :-/

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2022-08-09 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?