Essentially those two functions are in different
name spaces
func_name() is actually
MAIN**
main::func_name and
mod_name::func_name lives in the mod_name name space.
Sometimes its convenient to
use a module without importing any of its subs. When you choose to do this the only way you can access that module's subs is by using the convention
mod_name::func_name.
From the
Exporter module:
How to Export:
The arrays @EXPORT and @EXPORT_OK in a module hold lists of symbols that are going to be exported into the users name space by default, or which they can request to be exported, respectively. The symbols can represent functions, scalars, arrays, hashes, or typeglobs. The symbols must be given by full name with the exception that the ampersand in front of a function is optional, e.g.
@EXPORT = qw(afunc $scalar @array); # afunc is a function
@EXPORT_OK = qw(&bfunc %hash *typeglob); # explicit prefix on &bfunc
Selecting What To Export
Do not export method names!
Do not export anything else by default without a good reason!
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.
Generally anything not exported is still accessible from outside the module using the YourModule::item_name (or $blessed_ref->method) syntax. By convention you can use a leading underscore on names to informally indicate that they are 'internal' and not for public use.
How to Import
In other files which wish to use your module there are three basic ways for them to load your module and import its symbols:
use YourModule;
This imports all the symbols from YourModule's @EXPORT into the namespace of the use statement.
use YourModule ();
This causes perl to load your module but does not import any symbols.
use YourModule qw(...);
This imports only the symbols listed by the caller into their namespace. All listed symbols must be in your @EXPORT or @EXPORT_OK, else an error occurs.
** Update:
Ooops, thanks
rovf