I have made my own perl modules(pm files),named test.pm
use File::Basename qw(basename dirname);
use Cwd qw(abs_path);
use File::Path qw(make_path);
use FindBin qw($Bin $Script);
our @ISA = qw(Exporter);
our @EXPORT = qw(mkdirOrDie);
our $VERSION = 1.0;
my ($dir) = @_ ;
# timeLog("Directory Created: $dir");
h2xs -AX -n test
Undefined subroutine &main::mkdirOrDie called at /to/my/path/main.pl line 92
It's unclear at which point things started to go wrong for you.
test.pm is a bad name for a Perl module. Perl modules should have names that begin with upper case letters (and
Test.pm is already taken).
You should run
h2xs before writing your code - as it generates a module skeleton for you fill in. I hope it hasn't overwritten your code with an almost empty file! It's also worth noting that most people stopped using
h2xs many years ago. These days we have tools like Module::Starter.
make install (which you need to do with root permissions - so usually with
sudo) is what installs your module into the system libraries. There should be no need to run that
cp command afterwards.
As for why your code doesn't find the module, there are many possible reasons. Are you using Perl 5.10 or do you have other Perl versions installed? What does the code look like that you are trying to use? Does test.pm still include the code you think it does?
Need more information to be much help here.