http://www.perlmonks.org?node_id=220566


in reply to creating class base modules

On a similarly simple question regarding using classes.

What are the advantages/disadvantages in using

export= qw( &new &feed )
or export_ok

Do things need to be exported?

thanks

A.A. Update Sorry I realise that this is a bit off topic and should have appeared as an seperate question

Replies are listed 'Best First'.
Re: Re: creating class base modules
by pfaut (Priest) on Dec 17, 2002 at 16:27 UTC

    export forces the listed symbols into the callers namespace. export_ok allows the listed symbols to be pulled into the callers namespace. export_ok is nicer as it gives the user of your module the choice. See Exporter for details.

    Exports pollute the namespace of the module user. If you must export try to use @EXPORT_OK in preference to @EXPORT and avoid short or common symbol names to reduce the risk of name clashes.
    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';