Re: custom module and lib
Hi All, I just tweak some of the regular modules under my lib and those who denied made it as pre-reqs I am still fighting for my exact solution On Thu, Feb 3, 2011 at 9:23 PM, Octavian Rasnita orasn...@gmail.com wrote: If you got a solution, it could be helpful for those who will find this thread on the web if you would explain what you did. Octavian -- From: a b testa...@gmail.com Thanks a lot all for your views!! i got my solution Regards, a b On Mon, Jan 31, 2011 at 10:48 PM, Rob Dixon rob.di...@gmx.com wrote: On 31/01/2011 09:27, a b wrote: Making it more clear. I want to make tar ball which contains my perl scripts and no other dependencies required. like Net::Rsh,Net::Telnet etc once user untar it, he should be able to run it from anywhere without any extra perl modules. I am thinking that might be Net::Rsh etc is not available on target m/c With above requirement, i want Net::Rsh like modules to be in my lib. Not sure if i need to modify Rsh module to get rid of scoping Net:: I want to simply use this module as use Rsh; Can some body let me know if i can make these modules to my lib :0 help much appeciated!!! Do you have a special reason for wanting to rename Net::Rsh to Rsh? It is a dangerous thing to do, as there may well be code that relies on the name of the module being unchanged. In particular you will have to edit the Rsh.pm file to say 'package Rsh', and it thereby becomes non-standard and so a maintenance problem. It is worth noting that, by default, the last entry in @INC is '.' - the current directory - so perl will ultimately look in the same directory as the calling program for all modules if they are not found elsewhere. So you can simple bundle Net::Rsh in the same place as your main program and any other modules. HTH, Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: custom module and lib
Thanks a lot all for your views!! i got my solution Regards, a b On Mon, Jan 31, 2011 at 10:48 PM, Rob Dixon rob.di...@gmx.com wrote: On 31/01/2011 09:27, a b wrote: Making it more clear. I want to make tar ball which contains my perl scripts and no other dependencies required. like Net::Rsh,Net::Telnet etc once user untar it, he should be able to run it from anywhere without any extra perl modules. I am thinking that might be Net::Rsh etc is not available on target m/c With above requirement, i want Net::Rsh like modules to be in my lib. Not sure if i need to modify Rsh module to get rid of scoping Net:: I want to simply use this module as use Rsh; Can some body let me know if i can make these modules to my lib :0 help much appeciated!!! Do you have a special reason for wanting to rename Net::Rsh to Rsh? It is a dangerous thing to do, as there may well be code that relies on the name of the module being unchanged. In particular you will have to edit the Rsh.pm file to say 'package Rsh', and it thereby becomes non-standard and so a maintenance problem. It is worth noting that, by default, the last entry in @INC is '.' - the current directory - so perl will ultimately look in the same directory as the calling program for all modules if they are not found elsewhere. So you can simple bundle Net::Rsh in the same place as your main program and any other modules. HTH, Rob
Re: custom module and lib
If you got a solution, it could be helpful for those who will find this thread on the web if you would explain what you did. Octavian -- From: a b testa...@gmail.com Thanks a lot all for your views!! i got my solution Regards, a b On Mon, Jan 31, 2011 at 10:48 PM, Rob Dixon rob.di...@gmx.com wrote: On 31/01/2011 09:27, a b wrote: Making it more clear. I want to make tar ball which contains my perl scripts and no other dependencies required. like Net::Rsh,Net::Telnet etc once user untar it, he should be able to run it from anywhere without any extra perl modules. I am thinking that might be Net::Rsh etc is not available on target m/c With above requirement, i want Net::Rsh like modules to be in my lib. Not sure if i need to modify Rsh module to get rid of scoping Net:: I want to simply use this module as use Rsh; Can some body let me know if i can make these modules to my lib :0 help much appeciated!!! Do you have a special reason for wanting to rename Net::Rsh to Rsh? It is a dangerous thing to do, as there may well be code that relies on the name of the module being unchanged. In particular you will have to edit the Rsh.pm file to say 'package Rsh', and it thereby becomes non-standard and so a maintenance problem. It is worth noting that, by default, the last entry in @INC is '.' - the current directory - so perl will ultimately look in the same directory as the calling program for all modules if they are not found elsewhere. So you can simple bundle Net::Rsh in the same place as your main program and any other modules. HTH, Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: custom module and lib
Thanks much for your response!! Making it more clear. I want to make tar ball which contains my perl scripts and no other dependencies required. like Net::Rsh,Net::Telnet etc once user untar it, he should be able to run it from anywhere without any extra perl modules. I am thinking that might be Net::Rsh etc is not available on target m/c With above requirement, i want Net::Rsh like modules to be in my lib. Not sure if i need to modify Rsh module to get rid of scoping Net:: I want to simply use this module as use Rsh; Can some body let me know if i can make these modules to my lib :0 help much appeciated!!! Regards, a b On Sun, Jan 30, 2011 at 9:07 PM, Rob Dixon rob.di...@gmx.com wrote: 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
Re: custom module and lib
From: a b testa...@gmail.com Thanks much for your response!! Making it more clear. I want to make tar ball which contains my perl scripts and no other dependencies required. like Net::Rsh,Net::Telnet etc once user untar it, he should be able to run it from anywhere without any extra perl modules. I am thinking that might be Net::Rsh etc is not available on target m/c With above requirement, i want Net::Rsh like modules to be in my lib. Not sure if i need to modify Rsh module to get rid of scoping Net:: I want to simply use this module as use Rsh; Can some body let me know if i can make these modules to my lib :0 help much appeciated!!! Regards, a b This is not possible if those dependencies use C code, because they must be compiled differently depending on the platform they are running on. This is the same no matter the programming language you use. If a module needs a .so file, under Windows it should be compiled as a .dll file. If they are pure Perl, then you can bundle them in that tarball as a part of that distribution. If you want to bundle more compiled Perl modules that use C code and use them under a specific platform and you don't need them to be portable, then you might be interested to create/install them as .deb or .rpm packages. I don't know (and maybe others know more about this) if it is possible to compile Perl modules that use C code and then install them on the target platform by just copying them on a custom location. Octavian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
custom module and lib
Hello All, 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) Thanks in Advance!
Re: custom module and lib
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/
Re: custom module and lib
On Sun, Jan 30, 2011 at 03:37:14PM +, Rob Dixon wrote: 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; 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 Well, as long as perl can see where the Net/Rsh.pm module is. Perl won't search your entire disk for the module, but rather it will look in well known places. :-) You'll want to put your SpecialModule in a well known place too if you want perl to find it. Or you can take a look at local::lib on the CPAN which can help you with precisely this. Jeremiah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/