On 30/01/2011 14:09, a b wrote:
I have a query regarding using lib modules
1) I've some custom modules which uses various default routines like "Net::rsh"
etc
Now, i want to pack all default routines into my lib and use that lib
in my custom modules i.e
package MyModule;
use lib "lib/test";(here i am placing my Rsh.pm etc modules and some of my
custom modules)
use Rsh;
Is this possible???
Please let me know how to go with this approach
My motive is to create a main PM file which will call all small PM
files(custom and defaults)
I'm not clear what you need to do. What is a 'default routine'?
At a guess you want to be able to access Net::Rsh as well as your own
custom modules, in which case you probably don't understand how 'use
lib' works, which is simply to add the path(s) you specify to the end of
the list in @INC where perl will search for the modules you use. That
means that, even after you have done 'use lib "lib/test"' you can still
'use Net::Rsh' and it will be found, as its location is still in @INC.
For instance, something like
use warnings;
use strict;
use lib 'lib/test';
use Net::Rsh;
use SpecialModule;
will find Net/Rsh.pm whereever it is on your machine, as well as
lib/test/SpecialModule.pm
If this isn't what you're looking for then please post again.
HTH,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/