I created two of the bunch of modules I wanted to create. I decided to keep them in a subdirectory and access using Module::Submodule format.
Somehow it is not working for me. I get the error message "Undefined subroutine &main::method1 called at program.pl line 12.
The way I organised this is
Main program: ~/perl/program.pl
The Modules are in the directory "~/perl/lib/Module" directory and have the followinguse strict; use warnings; use lib '/home/my_uname/perl/lib'; use Module::Submodule1; method1 (args); method2 (args);
Submodule1.pm: (Submodule2.pm is similar)
package Submodule1; use strict; use warnings; use Exporter; our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = qw(method1 method2); sub method1 { ... } sub method2 { ... } 1; __END__
It works if I copy the Submodule1.pm and Submodule2.pm files to ~/perl/lib/ directory.
These are not OO Modules -they are just subroutines. I am doing this just to keep all the subroutines of a particular category in a module. And of course all these Submodules are for an application (Module).
Also, I do not have root privileges to keep these modules in the /usr/bin/perl/lib (??) directory
Any help is appreciated
In reply to Creating a module in a directory to accomplish :: by newest_newbie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |