http://qs1969.pair.com?node_id=1196733


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 :-/