Reputation: 8105
I'm having trouble putting this question to better words, but how might I accomplish something like this:
FileSpecClone.pm
package FileSpecClone;
use File::Spec::Unix;
sub new() {
bless {};
}
CloneScript.pl
use FileSpecClone;
$obj = FileSpecClone->new();
# A FileSpec::Unix subroutine
$obj->catpath('a','b','c');
Upvotes: 1
Views: 81
Reputation: 118595
You must specify that FileSpecClone
should inherit the methods of File::Spec::Unix
by setting the package @ISA
variable.
package FileSpecClone; use File::Spec::Unix; our @ISA = qw(File::Spec::Unix); ...
This is documented in perlobj
.
If you have the parent
module (a core module since v5.10), that will handle the details of setting @ISA
at compile time. (HT: daxim)
use parent 'File::Spec::Unix';
Upvotes: 3