I have installed the Perl v5.10 in /home/admin/localperl location as per the below install commands
./Configure -des -Dprefix=$HOME/localperl
make test
make install
But when I ran the $ perl -v command am still seeing perl, v5.8.8 instead of Perl v5.10
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
I am a windows user and in the windows world I usually change the class path to make it work, but am not sure how this can be done in Ubuntu 8 world, can someone please help?
That's because /bin appears before /home/admin/localperl/bin in your path.
Add the following to your login script:
export PATH="/home/admin/localperl/bin:$PATH"
(Bourne shell syntax provided; adjust as needed.)
Remember, the scripts that should use this Perl should have the following shebang line:
#!/home/admin/localperl/bin/perl
The standard Perl installers will automatically convert #!/bin/perl into the above in scripts they install.
Related
I want to use perlbrew and cpanm on my machine. I installed perlbrew like this
curl -L http://install.perlbrew.pl | bash
and sourced ~/perl5/perlbrew/etc/bashrc in my .bashrc. Next I installed perl v5.21.5 and switched to this version.The which perl command points to my perlbrew installation. The same is true for cpanm.
But when I install a perl module like cpanm Mojo Neither the binaries are installed nor the includes can be located. But all tests pass. I looked under ~/perl5/ and could not find the sources. Does anyone had the same issue before? I may have used cpan on my Ubuntu 14.04 before. May this cause any problems? How can I figure out where cpanm put the module?
BTW: I'm using perlbrew version 0.71
I solved the problem by deleting everything perl-related in my home directory. The folder ~/.cpan had write-proteced files. Only the sudo user could delete them. I assume I used cpan as root in the past. In addition I deleted ~/.cpanm and ~/perl5. After reinstalling perlbrew, perl and mojolicious, everything worked out of the box.
In my case I was just trying to get some perl code running. Many thanks to the #perl channel on irc.freenode.net.
I first used local::lib but may not have fully cleaned up after using it. The modules I needed for the code I was trying to get running would not run with the system perl. It was just too old.
Then I tried perlbrew install perl-5.20.1 and perlbrew install-cpanm. It felt great to start fresh with a known quantity. Yet I found that modules were passing tests and said they were installing but not getting found and used. Dependencies were trying to be continuously reinstalled. Installing the dependencies one at a time didn't even work. It was baffling. Somewhere along the way I read to set PERL_MB_OPT and PERL_MM_OPT though I think I should have also set PERL5LIB with those.
So I started over with perlbrew after rm -rf ~/.cpan ~/.cpanm ~/perl5. Everything just works now. Hurray!
Are you running the cpanm command in a new terminal window by chance, if so it might not use the new perl you brewed.
"perlbrew use" only makes the current shell use the brewed perl whereas "perlbrew switch" makes all new shells of the current user use the selected perl.
You should provide the output of "perl -V" and "perlbrew info"
Here is a tip how you can find where cpanm installed a module:
1) install locate (sudo aptitude install locate)
2) run "sudo updatedb" (creates the index used by locate)
3) run "locate Mojo" to see where the files have been created.
Also interesting would be to know which cpanm binary you are using. "which cpanm"
You can install a perlbrew-wide cpanm with "perlbrew install-cpanm"
[ I'm going to assume you started a fresh shell (e.g. reopened your terminal or executed exec bash) or sourced ~/perl5/perlbrew/etc/bashrc in your current shell after installing perlbrew ]
Which Perl did you use to install cpanm? cpanm will install modules for the Perl that runs it, which will be the one mentioned on the first line of cpanm if you run it as cpanm ....
Options:
Use cpan instead of cpanm.
Install cpanm using your newly installed Perl.
Use perl -S cpanm ... as a workaround.
This is my first time installing a Perl module and I'm having some trouble. I'm trying to install manually In UNIX. These are the steps I am following (Installing DBI module in this case)
Download DBI-1.628.tar.gz tar file,
Uncompress file with
$ tar -zxvf DBI-1.628.tar.gz
So far no problems,
Its the next step that is confusing me... In every tutorial I've seen so far I'm told to locate Makefile.PL then run the following commands:
$ perl Makefile.PL
$ make
$ make test
$ make install
In my case, after locating Makefile.PL and running
$ perl Makefile.PL
...some output follows. I get these messages
Checking if your kit is complete... Looks good & Writing Makefile for DBI
Then I'm back in my user command prompt. Note I still haven't entered these commands
$ make
$ make test
$ make install
From the command prompt if I enter the make command now I get a -bash: make: command not found error.
I'm an absolute beginner at this so please excuse me If I am missing something rudimentary.
If you're using MAC OSX, just fire up a terminal and type 'cpan'. Allow it to configure automatically and do some stuff, then you can install modules by just typing install Your::Module::Name. To get out of cpan just hit ctrl-c or type quit.
You can also install directly from the command line by using cpan -i 'Your::Module::Name'.
NB: You may need to type sudo cpan and put in your password rather than just cpan on it's own depending how your mac is configured.
Simply to get the make command on a mac, you need to go to the app store and install the latest version of XCode, then turn on the 'command line utilities' option. See more on that here: Xcode 4.4 and later install Command Line Tools
The usual way to install perl modules is using cpan, which should be included on your system.
For example:
cpan DBI
The simplest way to get Perl modules installed is to use the CPAN module itself.
Run the Perl CPAN module via command line perl and get it installed in a single line:
sudo perl -MCPAN -e 'install Module::Name'
If you have login as a root user, do not use sudo.
I've recently installed the Perl Packer module to compile my perl scripts into exe packages. I'm running strawberry perl setup on a windows 32-bit machine. When I attempt to run the pp -o command, I get an error stating that Perl is not part of my path. It is, for some reason, looking for perl in F:/Programs/Strawberry Perl/site/bin/perl.exe, when the true path is F:/Programs/Strawberry Perl/bin/perl.exe. Perl itself runs fine from commandline. How can I get Perl Packer to find my perl.exe?
What about calling this way?
perl pp {your options goes here}
regards
I installed perl5.14 via macports.
By typing
which perl
I get
/usr/bin/perl
How do I change the perl to point the macports one.
My .profile is:
# MacPorts Installer addition on 2012-02-02_at_14:42:32: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
Maybe the perl port isn't active? try:
$ sudo port activate perl5
sudo port install perl5 +perl5_14
You need to re-launch terminal for the export to take effect. As a quick but messy workaround you can always invoke perl like this:
/opt/local/bin/perl Remember to put that in your Perl scripts as well. Also, unlike unix I find I always have to use sudo when installing to a local directory.
Macports is great for installing all those non-Perl libraries that aren't installed on the Mac, however it is not so great for installing Perl modules as it is dependant on there being a port of it, you can't really use CPAN to install. perlbrew does work on the Mac and is a much better solution. But if you still want to use Macports to install non-Perl libraries you hit a problem. I solved it with a .profile like this:
source ~/perl5/perlbrew/etc/bashrc
# export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Note the comment. The first line gives me my perlbrew Perl when I open terminal. When I want to use Macports to install libraries I swap the comment around and re-launch terminal and I then have Macports Perl. Of course this means I need two Perls on my machine, and they both need to be the same version but I don't have any problems with this.
Not being on a Mac, I cannot answer your exact question. However, many Perl users/developers now use perlbrew to install newer versions of Perl and manage choosing between them. I am fairly confident that it works on Mac. Read more at the website or CPAN.
As far as I know it is required to run CPAN with sudo on Mac
sudo perl -MCPAN -e shell
to install new modules. Theoretically, a module can be removed by deleting it from the Perl folders.
My question is: Where are Perl modules put when installed from CPAN with 'sudo' and without 'sudo'? I installed BioPerl both ways and it seemed to work. Did I mess anything up by installing it with sudo and without?
Thank you for a little help in the confusing Perl world.
You can see where a module got installed with perldoc -l <module>. That location is entirely dependent on your specific Perl installation, but you can see where the "standard" locations are by examining the #INC lines in the output of perl -V.