P
pgodfrin
Greetings,
I have little module, MyUtil.pm for example, that has utility
functions I use in most of my perl programs. I would like to use one
function from this module in another module - while at the same time
referring to the same module subroutine in the "calling" perl program.
For example
The module (pseudo-code):
package MyNewModule
use strict;
use warnings;
use Carp;
use lib '/home/modules';
use MyUtill qw(mytool);
sub test_it {
mytool();
}
The perl program (psuedo again):
#!/usr/bin/perl
use strict;
use warnings;
use Carp;
use lib '/home/modules';
use MyUtill qw(mytool);
use MyNewModule qw(test_it);
print mytool();
print test_it();
This seems to work. I wonder though - is this bad form? Or does the
internal name space stuff keep it all straight?
thanks,
pg
I have little module, MyUtil.pm for example, that has utility
functions I use in most of my perl programs. I would like to use one
function from this module in another module - while at the same time
referring to the same module subroutine in the "calling" perl program.
For example
The module (pseudo-code):
package MyNewModule
use strict;
use warnings;
use Carp;
use lib '/home/modules';
use MyUtill qw(mytool);
sub test_it {
mytool();
}
The perl program (psuedo again):
#!/usr/bin/perl
use strict;
use warnings;
use Carp;
use lib '/home/modules';
use MyUtill qw(mytool);
use MyNewModule qw(test_it);
print mytool();
print test_it();
This seems to work. I wonder though - is this bad form? Or does the
internal name space stuff keep it all straight?
thanks,
pg