http://www.perlmonks.org?node_id=680994

adrive has asked for the wisdom of the Perl Monks concerning the following question:

i can't seem to understand how to change strawberry's library path.

Since it doesn't give me an option where to install my strawberry, perl was automatically put under c:/strawberry/perl

the thing is since im using apache 2 and windowsxp, all my existing perl projects shebangs are under #!/usr/bin/perl so i tried moving strawberry perl's bin, lib and site folders into c:/usr folder.

then in my system's environmental variable :

INCLUDE = ;C:\strawberry\c\include;C:\usr\lib\CORE; LIB = ;C:\strawberry\c\lib;C:\usr\bin; PATH = C:\usr\bin; and even added this : PERL5LIB = C:\usr\site\lib;


Then in my C:\usr\lib\config.pm file i changed the last section :

tie %Config, 'Config', { archlibexp => 'C:\\usr\\lib', archname => 'MSWin32-x86-multi-thread', cc => 'gcc', d_readlink => undef, d_symlink => undef, dlsrc => 'dl_win32.xs', dont_use_nlink => undef, exe_ext => '.exe', inc_version_list => '', intsize => '4', ldlibpthname => '', libpth => 'C:\\strawberry\\c\\lib', osname => 'MSWin32', osvers => '5.1', path_sep => ';', privlibexp => 'C:\\usr\\lib', scriptdir => 'C:\\usr\\bin', sitearchexp => 'C:\\usr\\site\\lib', sitelibexp => 'C:\\usr\\site\\lib', useithreads => 'define', usevendorprefix => undef, version => '5.10.0', };


but still..once i installed my module through cpan, my packages were included inside C:\strawberry\perl\site\lib\ instead.

how should i change this so that it'll auto install into C:\usr\lib\ ??

Replies are listed 'Best First'.
Re: strawberry perl library path?
by adrive (Scribe) on Apr 17, 2008 at 03:07 UTC
    here are my cpan outputs with that config :
    cpan> install HTML::Template Running install for module 'HTML::Template' Running make for S/SA/SAMTREGAR/HTML-Template-2.9.tar.gz Checksum for C:\strawberry\cpan\sources\authors\id\S\SA\SAMTREGAR\HTML +-Template- 2.9.tar.gz ok Scanning cache C:\strawberry\cpan\build for sizes ...................................................................... +......DONE CPAN.pm: Going to build S/SA/SAMTREGAR/HTML-Template-2.9.tar.gz Checking if your kit is complete... Looks good Writing Makefile for HTML::Template cp Template.pm blib\lib\HTML\Template.pm SAMTREGAR/HTML-Template-2.9.tar.gz C:\strawberry\c\bin\dmake.EXE -- OK Running make test C:\usr\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'b +lib\lib', 'blib\arch')" t/*.t t/01-bad-args................ok t/01coderefs.................ok t/02-parse...................ok t/02random...................ok t/03-associate...............ok t/03else_else_bug............ok t/04-type-source.............ok t/04default_escape...........ok t/04default_with_escape......ok t/04no_taintmode.............ok t/05-blind-cache.............ok t/05force_untaint............ok t/05nested_global............ok t/06-file-cache-dir..........ok t/07-double-file-cache.......ok t/08-cache-debug.............ok t/09-caching-precluded.......ok t/10-param...................ok t/11-non-file-templates......ok t/99-old-test-pl.............ok All tests successful. Files=20, Tests=457, 4 wallclock secs ( 0.14 usr + 0.13 sys = 0.27 +CPU) Result: PASS SAMTREGAR/HTML-Template-2.9.tar.gz C:\strawberry\c\bin\dmake.EXE test -- OK Running make install Prepending C:\strawberry\cpan\build\HTML-Template-2.9-mPFT7_/blib/arch + C:\strawb erry\cpan\build\HTML-Template-2.9-mPFT7_/blib/lib to PERL5LIB for 'ins +tall' Writing C:\strawberry\perl\site\lib\auto\HTML\Template\.packlist Appending installation info to C:\strawberry\perl\lib/perllocal.pod SAMTREGAR/HTML-Template-2.9.tar.gz C:\strawberry\c\bin\dmake.EXE install UNINST=1 -- OK
Re: strawberry perl library path?
by adrive (Scribe) on Apr 17, 2008 at 03:23 UTC
    but...i can't possibly change all my shebangs of my existing projects just because strawberry is hardcoded to a path. (not sure bout hardcoded..but there should be a way to change the path?)

      For various internal reasons Strawberry Perl's install path is fixed. However Windows pretty much ignores the shebang line so the path given there doesn't matter.

      Probably your best solution is to use the right click 'open with' menu option in the explorer on a .pl file and associate Strawberry Perl's executable path ('C:\strawberry\perl\bin\perl.exe') with the .pl extension.


      Perl is environmentally friendly - it saves trees
        Windows pretty much ignores the shebang line

        But I think apache takes notice of it and expects it to be correct.

        Cheers,
        Rob
      First up, don't worry about the LIB and INCLUDE environment variables. They don't do anything for Strawberry Perl anyway.

      1) Copy everything that's in the C:\strawberry\perl folder to C:\usr. Update: This doesn't mean that you simply copy that "perl" folder into C:\usr - that would result in the wrong directory structure for #!/usr/bin/perl to be pertinent. Instead you copy the folders that are in C:\strawberry\perl (namely bin, site and lib) into the C:\usr folder.
      2) Rename C:\strawberry\perl to C:\strawberry\perl_hide so that it never gets loaded by mistake. You could delete it entirely if you're happy to burn your bridges.
      3) In C:\usr\lib\Config.pm and C:\usr\lib\Config_heavy.pl change every occurrence of C:\strawberry\perl to C:\usr
      4) Amend your path to include C:\usr\bin instead of C:\strawberry\perl\bin.

      Afaik, that should be all you need do ... except that I don't how CPAN is affected. (I still install modules by the older, unautomated procedure, and don't use CPAN.)

      Cheers,
      Rob
        LIB and INCLUDE are needed for installing CPAN modules that include XS. They have no impact otherwise.

        The PATH variable is the only one that matters at run-time.

        Also, instead of installing the strawberry executable, if you are moving things around, you might want to look at the zip archive instead of the installer.
Re: strawberry perl library path?
by adrive (Scribe) on Apr 18, 2008 at 01:40 UTC
    thanks guys, it seems that editing both config.pm and config_heavy.pl 's perl path will work.

    here are the steps in point form in case others need it :
    (below is based on assumption your shebang is #!/usr/bin/perl, and that you want to move perl to another location while retaining strawberry's compilers in strawberry folder)

    1. Move bin, lib and site folder of strawberry/perl/ to c:/usr/
    2. Edit usr/lib/config_heavy.pl and change all reference of strawberry's perl to usr.

    for example :
    archlib='C:\strawberry\perl\lib'

    change to :
    archlib='C:\usr\lib'

    note : but for those that's not related to perl, don't change it unless u plan to move strawberry. Examples are :

    incpath='C:\strawberry\c\include'

    3. Edit usr/lib/config.pm as well.
    *same as point 2.

    4. Make sure the PATH environment is pointing to usr/bin.
    you should then be able to use strawberry perl properly without errors.
      Thanks for info, I always do not like to install something at / on Windows. Seems to be running after adaption. If I run in trouble, I will post it here.
Re: strawberry perl library path?
by Bloodrage (Monk) on Apr 18, 2008 at 10:58 UTC
Re: strawberry perl library path?
by Anonymous Monk on Apr 17, 2008 at 03:19 UTC
    Don't do that then :)