failed to install my own perl module(pm file) -




i have made own perl modules(pm files),named test.pm

package test; use exporter; use strict; use file::basename qw(basename dirname); use cwd qw(abs_path); use file::path qw(make_path); use findbin qw($bin $script); begin {         our @isa = qw(exporter);         our @export = qw(mkdirordie);         our $version = 1.0; }  sub mkdirordie {     ($dir) = @_ ;     if(!-d $dir){         make_path($dir);         $dir=abs_path($dir); #       timelog("directory created: $dir");     } } 

and tried install module follows,

h2xs -ax -n  test  perl makefile.pl make make install 

there no error,and copy test.pm /usr/lib64/perl5/5.10.0/,but when call sub function using test, error has occurred,

undefined subroutine &main::mkdirordie called @ /to/my/path/main.pl line 92 

is there ignored?

it's unclear @ point things started go wrong you.

firstly, test.pm bad name perl module. perl modules should have names begin upper case letters (and test.pm taken).

you should run h2xs before writing code - generates module skeleton fill in. hope hasn't overwritten code empty file! it's worth noting people stopped using h2xs many years ago. these days have tools module::starter.

then, running, make install (which need root permissions - sudo) installs module system libraries. there should no need run cp command afterwards.

as why code doesn't find module, there many possible reasons. using perl 5.10 or have other perl versions installed? code trying use? test.pm still include code think does?

need more information here.





wiki

Comments

Popular posts from this blog

elasticsearch - what is the equivalent data type for geo_point in hibernate search? -

firebase - How to wait value in Ionic 2 -

Jenkins: find build number for git commit -