Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Adding user-defined modules under ActiveState

by davies (Parson)
on Oct 14, 2012 at 14:25 UTC ( #998953=perlquestion: print w/replies, xml ) Need Help??
davies has asked for the wisdom of the Perl Monks concerning the following question:

I am running ActiveState 5.12 under Windows XP. I want to put a module I have written where (a) code can use it without poking @INC and (b) where it will do no damage. My understanding is that I can do this by putting it in \Perl\site\lib\. Is this correct? Is there any danger of it being deleted or causing other problems next time I run PPM? What docs are recommended (I couldn't refine my searches enough to get anything helpful)? Is there anything else I should know?


John Davies

  • Comment on Adding user-defined modules under ActiveState

Replies are listed 'Best First'.
Re: Adding user-defined modules under ActiveState
by CountZero (Bishop) on Oct 14, 2012 at 16:05 UTC
    Yes, "Perl/site/lib" is a good place to put your module. Make yourself a private namespace so it is unlikely to interfere with future or existing modules or get clobbered by installing other modules.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: Adding user-defined modules under ActiveState
by kcott (Chancellor) on Oct 14, 2012 at 23:27 UTC

    G'day John,

    You can use the environment variable PERL5LIB to specify a private area for the modules you write - see perlrun - ENVIRONMENT for details.

    The advantage of doing this is that it's independent of any path created by a third-party vendor. I don't currently have any Windows Perls but in the past (using Windows XP) I've had ActiveState and Strawberry Perls installed at the same time - both found the single copy of modules I'd written myself without requiring any additional push @INC ..., use lib ... or similar workarounds.

    -- Ken

Re: Adding user-defined modules under ActiveState
by rpnoble419 (Pilgrim) on Oct 14, 2012 at 21:58 UTC

      Which tutorials would you recommend? I know how to write a module; my problem is not knowing how to make it available without conflicting in some way with PPM (something I use without understanding). The only two that look as though they might be relevant to PPM are Installing CPAN on a Windows system, which doesn't help as I don't want to buy Visual Studio, and HowTo build and distribute a PPMed module for Win32, which is about making packages for PPM. Again, I don't - I just want to avoid conflicts. By the same token, I have no plans to release on CPAN, and am highly nervous of any book that doesn't profess in bold type that all species of U*x will be ignored utterly. I'm very much writing for Excel, and while I accept that Linux is better, I need Messware solutions and have too much experience of documentation that claims to be polyglot but is utterly incompatible with Messware in general and ActiveState in particular.


      John Davies

        my problem is not knowing how to make it available without conflicting in some way with PPM

        It would be a very rare thing for such a conflict to arise. And you would have to go to quite some trouble to create a conflict that could not be resolved trivially. Is there something in particular about your module that's making you wary in this regard ?

        Unless your module overwrites the files that PPM uses internally (all of which reside in your perl installation), I can't see that any such concern is warranted - especially if the module is not going to be installed via PPM, and if there's not even a PPM package for it.

        which doesn't help as I don't want to buy Visual Studio
        Download a copy of Platform SDK, aslong as its as old or newer than your OS. 2003 is fine. Activestate compiles all its XS modules for its PPM tool using a circa 2002-2003 Platform SDK (or a VC 6 with circa 2003 Platform SDK headers for NT 5.1/5.2 compatibility).
Re: Adding user-defined modules under ActiveState
by jmlynesjr (Hermit) on Oct 15, 2012 at 01:35 UTC

    I've just started using use lib '/path/to/module/';


      Yes, that's what I've been using up to now. The problem is that I have the development version on my network, but I also want to run the code on a notebook that may not be connected to the network. Since different machines have different system drives (the one I'm working on uses F:, for example), I'd prefer to avoid paths that would need to be machine specific.


      John Davies

        John, yes, you have a different situation than I have. The environment variable method may work best for you. I just installed Citrus Perl 5.16 and in trying to run a wxPerl screen capture script I found on Perl Monks, a required module couldn't be found in the "standard" @INC paths. After locating the module several levels deeper in the directory structure, I used the use lib to point to it. As I learn more, I may have to change plans also. I'm looking at putting commands into .profile to set things up at login.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://998953]
Approved by marto
Front-paged by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2018-05-27 08:21 GMT
Find Nodes?
    Voting Booth?