Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

CPAN Config question on Win2000

by knexus (Hermit)
on Sep 01, 2003 at 14:37 UTC ( #288138=perlquestion: print w/replies, xml ) Need Help??

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

I am trying to use modules from CPAN but I am having problems getting make to work.

I am using ActivePerl v5.8.0 MSWIN-32 on Win2000. The path to my make util is:

E:\Program Files\Microsoft Visual Studio\VC98\bin\nmake.exe

I guess the problem is with the spaces in the path. I have tried placing it in quotes but that does not help. I suppose one solution would be to move the file to a path spec without spaces but I'd like to make it work as is if that's possible.

Any suggestions?

Replies are listed 'Best First'.
Re: CPAN Config question on Win2000
by PodMaster (Abbot) on Sep 01, 2003 at 15:26 UTC
    Try perl -MWin32 -e"die Win32::GetShortPathName(shift)" "path goes here"

    Also, don't use CPAN, CPANPLUS is better.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: CPAN Config question on Win2000
by PERLscienceman (Curate) on Sep 01, 2003 at 14:55 UTC
    Can you tell us exactly what kind of error you are getting when the CPAN install module tries to access nmake? My first hunch with out any additional info would be that you do not the path to nmake properly defined in your Environment Variables.

    To get to Environment Variables in Windows 2K do this:
    1) Right Click on My Computer (on your Desktop)
    2) Select Properties
    3) Select Enivironment Variables
    4) Highlight/Select/Click On Path
    5) Click Edit
    6) If it isn't already there put in the full path to nmake spaces and all where it says 'Variable Value'
    7) Click OK

    Hope this helps.

      OK, a solution hit me and it works (apparently), although it may seem odd.

      Read more if you are curious...

      I remembered something odd with how windoze handled the long paths in DOS boxes (older versions, as win2K DOS box works normally). When paths had spaces you could enclose it in quotes, when the path was too long it would chop it off at six characters and append ~1 as below:

      E:\Program Files\Microsoft Visual Studio\VC98\bin becomes

      I entered the path in this fashion in the CPAN config for make and make seems to make ;-)

      <Ammendment>If you need to use this approach make sure you see reply by shenme for more information.

      Use dir /x to get the real short name which "may not" have a ~1.

        Yes, that's the way to do it, with one caveat.   It isn't always "~1".   To be sure of what to use go into the directories concerned and run "dir /X" to see the short names.   When the long names overlap sometimes the short names will end up as things like "CREATE~4.SQL" or even "CRC02D~1.SQL".
      Sorry, I should have been more specific on the error:

      cpan> test XML::SemanticDiff
      Running make test 'E:\Program' is not recognized as an internal or external command, operable program or batch file. E:\Program Files\Microsoft Visual Studio\VC98\bin\nmake.exe test -- NOT OK

      I already checked the Environment Vars and they are correct.
      It seems to be a problem with the spaces (at least to me) based on the 'E:\Program' part of the error message.
      I checked the config using: cpan> o conf make
      and I get the correct path and file name.

      <scratch head>

Re: CPAN Config question on Win2000
by demerphq (Chancellor) on Sep 01, 2003 at 22:03 UTC

    You could just use junction and create a symlink to the directory involved and then add that to the path.

    junction E:\VDS\ "E:\Program Files\Microsoft Visual Studio\"

    Then edit your system PATH enviornment variable to include E:\VDS _before_ the real directory and reconfig CPAN which will autodiscover the new location of the nmake. This way CPAN is happy, you are happy, VDS is happy, and you don't have an incomprehensible directory name in your path.

    Plus knowing about junction and sysinternals is probably in general a good thing. :-)

    PS, let this be a lesson for you. Never install VDS into a directory path with spaces in it. In fact, if its for dev purposes or you are doing anything *nixy (ie using cygwin stuff) then you should avoid spaces in file names in general. On my PC the only thing that goes in x:\Program Files is MS office and other pure MS crap. Anything dev or third party goes in a rationally named directory, preferably on a different partition so you can nuke your OS and MS apps without toasting everything else (or at least theres something saveable on the other partition). :-)

    <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

      That's something I'll take a look as I do find using "junk" path names like that a bit offensive.

      Anyhow, thanks for the links. I see that there's lots of other usefull looking things/information there as well.

      <chuckle>re: Advice:
      Actually I used to really hate path names like that and like you refused to use them for much. However, time seems to wear one down eventually and I gave in to it. Additionally, I had become a little gun-shy regarding installing Win progs in directories other than their "defaults", as sometimes things just didn't work easily when I did. So, since it was an install of MS Visual Studio, I just let it rip. Everything I create goes in a "rationally" named path. ;-)

        I had become a little gun-shy regarding installing Win progs in directories other than their "defaults",

        Yep, ive found this is true on occasion as well. More with office than with VDS though. Ive quite happily run VDS off of x:\VDS for a long time. :-)

        . I see that there's lots of other usefull looking things/information there as well.

        I have to admit that was the main reason I pointed you there. Lots of good stuff to fill just this kind of gap. I think of it as the "windowy unix toolkit for windows" (especially pstools) :-) Anyway. Cheers.


        <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://288138]
Approved by edoc
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2021-10-25 16:35 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (89 votes). Check out past polls.