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

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:

I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057647]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2018-01-21 00:49 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.