Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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 ( [id://1196736]=note: print w/replies, xml ) Need Help??


in reply to Re^7: 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)

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...
  • Comment on Re^8: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
  • Download Code

Replies are listed 'Best First'.
Re^9: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
by shmem (Chancellor) on Aug 04, 2017 at 16:49 UTC
    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://1196736]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-23 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found