Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Variable Scope

by jdporter (Canon)
on Oct 10, 2013 at 00:39 UTC ( #1057647=note: print w/ replies, xml ) Need Help??


in reply to Variable Scope

The problem -- and it is admittedly a subtle one -- is that if your module isa Exporter, then the semantics of argument passing to the module is (re)defined by Exporter. As the docs clearly state, arguments you pass to the use of an Exporter-derived module are supposed to be the symbols you want to import from it.

Of course, you're not seeing the error that should occur because you're also re-defining import, rather than using the one provided by Exporter. The docs, at section "Exporting without using Exporter's import method", explain how to do what you're trying to do. In a nutshell, add the following line to your import sub:

$class->export_to_level(1,);
I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.


Comment on Re: Variable Scope
Download Code
Re^2: Variable Scope
by DanielSpaniel (Scribe) on Oct 10, 2013 at 01:41 UTC

    Ah, thank you so much. Yes, I've now tried that and it works as expected.

    Many thanks!!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2014-10-30 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls