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

Re^2: Issue with Exporter

by palette (Scribe)
on Jan 12, 2007 at 11:43 UTC ( #594355=note: print w/replies, xml ) Need Help??

in reply to Re: Issue with Exporter
in thread Issue with Exporter

I tried the code with the 3rd option mentioned. Its working fine when I am using @EXPORT but when I am using
our @EXPORT_OK = qw(method1);

Its not working and the output I am getting is "its herehere"


Replies are listed 'Best First'.
Re^3: Issue with Exporter
by davorg (Chancellor) on Jan 12, 2007 at 11:50 UTC

    Do you understand the difference between @EXPORT and @EXPORT_OK?

    Symbols mentioned in @EXPORT are automatically exported by your module. Symbols mentioned in @EXPORT_OK are made available for export, they are not automatically exported. to export symbols that are in @EXPORT_OK, you need to explicitly name them in the "use" statement for the module.


    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re^3: Issue with Exporter
by ferreira (Chaplain) on Jan 12, 2007 at 11:49 UTC

    @EXPORT hold the symbols that are exported by default when you don't mention explicitly any symbols.

    use one; # will import the symbols in @EXPORT

    while @EXPORT_OK hold the symbols that can be exported on demand.

    use one qw(m1 m2); # m1 and m2 should be in @EXPORT or @EXPORT_OK

    Read more about it in the Exporter documentation.

Re^3: Issue with Exporter
by palette (Scribe) on Jan 12, 2007 at 11:49 UTC

    I just forgot to include the name of the method in the use statement.

    Thankyou very much.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2023-05-31 11:05 GMT
Find Nodes?
    Voting Booth?

    No recent polls found