Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Use of Carp outside of package won't compile...

by friedo (Prior)
on Dec 18, 2007 at 16:24 UTC ( [id://657699]=note: print w/replies, xml ) Need Help??


in reply to Use of Carp outside of package won't compile...

strict and Carp operate by somewhat different mechanisms. strict is scoped lexically, and so applies for the whole scope in which it is declared (in this case file scope), covering the subsequent package declaration. Carp works by exporting its functions to the calling namespace. In your example, Carp exports croak to the default package (main) but not to your Test package. When you change it to put the use Carp statement inside your package, then it works because croak gets exported to the Test namespace.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-18 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found