Need to change shebang for Strawberry Perl?
This isn't so much a "question" as a methodology I found which I believe is working.
MOST servers use the path "/usr/bin/perl" ... but Strawberry perl (strawberryperl.com) use their own unique path of "/strawberry/perl/bin" (!!) (I tried installing into a different directory as allowed by the prompt, but it wouldn't work at all then! I read somewhere that some files within the installation are 'hardcoded' to the above path)
Not looking forward to having to rename all the shebangs of around 400 offline files, and then having to change them all again when uploaded, I sought another solution. I found it in something called a "symbolic link"
Basically, it's an internal Windows redirect. It basically says "If you see the path as 'usr/bin/perl' then instead go to 'strawberry/perl/bin' " There are two ways to set this up.
The first is to open up a command line terminal ("CMD" in Windows search box, then click "cmd.exe") You use "cd.." to get back to the "C:>" prompt, and then enter "/d usrbinperl starwberryperlbinperl.exe" and click enter. This will set up the <==> symbolic link. (Note directions of the slashes) That's OK for a one time use. (It may work without adding ".exe", but to be sure ...)
But I design websites offline, so I need the redirect to be set up each time I boot up. You can do this as well with a batch file.
Using a text file, enter the same data as you did at the prompt, and save it as a ".bat" file to your startup folder, (as found in the left menu when clicking "Start" button lower left) You may well find other icons for programs that also initiate at startup within this folder.
I'm 99% certain this is working, 'cos I went into the 'usr/bin/perl' and renamed the executable files as 'perl_old.exe' and 'perl_5.12.4_old.exe" and "wperl_old.exe" (so that if perl script DID access "usrbinperl" it wouldn't find any program to run) ... and the file still ran when I put URL into browser.
So why the switch from ActiveState. I wanted to install a particular library. Tried it via PPM and told I didn't have authorisation. No, this isn't an "Administrator Rights" issue of Windows, it's the fact that AS now want to charge $999 for access to certain files. "Well, you can still use 'dmake' to create the files downloaded direct from CPAN" Er, no you can't ... 'cos "dmake" is one of the files under lock and key! And without that, you cannot install ANY file from CPAN. (The term "Holding You To Ransom" spring to mind)
Using Strawberry, it's just a case of starting a command line terminal, (CMD) moving back to the root (C:>) and typing "cpan". You now type "install MODULE::name". Boom! All the files for that particular module are downloaded and installed using the "make.pl" associated with that program.
We won't get into the debate of a company CHARGING to access items in the Public Domain; they're a business after all.
I know this might be teaching your Grandmother to such eggs to some of the more advanced users, but there may be other people on the verge of renaming all their files when switching to the Strawberry. Oh, I believe their program suite also include C, C++ and Fortran compilers, (no, I've no idea either!). One downside: Due to all the extra program features they install, the directory is THREE TIMES LARGER than the "AS" installation!
I'm pretty sure your problem with ActiveState perl is that you're using an older version. I've just done:
C:UsersmyaccountDocuments>perl -MCPAN -e shell
It looks like you don't have a C compiler and make utility installed. Trying
to install dmake and the MinGW gcc compiler using the Perl Package Manager.
This may take a a few minutes...
Downloading ActiveState Package Repository dbimage...done
Downloading MinGW-4.6.3...done
Downloading dmake-4.11.20080107...done
Unpacking MinGW-4.6.3...done
Unpacking dmake-4.11.20080107...done
Generating HTML for MinGW-4.6.3...done
Generating HTML for dmake-4.11.20080107...done
Updating files in site area...done
2759 files installed
Please use the `dmake` program to run commands from a Makefile!
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.
cpan>
Using version:
This is perl 5, version 20, subversion 1 (v5.20.1) built for MSWin32-x86-multi-thread-64int
ActiveState have a policy of not keeping fully up to date on older versions, because of the support overhead. You can see - for example - their builds of dmake
here: https://code.activestate.com/ppm/dmake/
From their web page:
Looking for access to older versions of ActivePerl?
Community Edition offers access to the newest versions of ActivePerl. Access to older versions (Perl 5.6, 5.8, 5.10, 5.12, 5.14, 5.16) is available in Business Edition and Enterprise Edition.
Eg to use the version you're currently using ( 5.12
), you'd need to buy support. But you could use 5.18
or 5.20
for free.
I would also note: Windows doesn't use shebang paths anyway, it uses file associations.
链接地址: http://www.djcxy.com/p/47206.html上一篇: 如何在Windows上捕获Perl输出(Strawberry Perl)
下一篇: 需要更改草莓Perl的shebang?