http://qs1969.pair.com?node_id=594355


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"

Thanks

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.

    --
    <http://dave.org.uk>

    "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
    Hi,

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

    Thankyou very much.