in reply to use directives
You are doing something with Exporter if you are exporting names from a .pm package module. Package is a name space concept. You don't have to export a name but if you don't, you will have to use the fully qualified package name for it, FOO:some_function_4, etc.
A sort of generic header for a FOO package module in the FOO package name space looks like this...(name this file FOO.pm). It is possible to have multiple "packages" within one Perl file. I strongly recommend against this practice.
The "use FOO"; statement does not imply an inheritance hierarchy. Exporter just puts symbols into a symbol table. The form above is more like a 'C' include statement - not exactly, but similar in concept. To fiddle with OO inheritance, I figure that you need to mess with @ISA. This does inherit from Exporter, but that is what you have to do in order for you to export namesuse strict; use warnings; package FOO; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use Exporter; our $VERSION=1.0; our @ISA = qw(Exporter); our @EXPORT = qw( some_func_name1 some_func_name2 ); our @EXPORT_OK = qw(some_optional_func_name3);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use directives
by dsheroh (Monsignor) on Aug 05, 2009 at 09:11 UTC |