Perl Devel::REPL re.pl command not found - perl

Is there any instruction on installing Devel::Repl? I use cpan Devel::REPL command to have it installed but I cannot launch it using the re.pl command (as suggested https://metacpan.org/pod/Devel::REPL)
My cpan command comes from the perl v5.36 installed from homebrew. Is there something I have to do in order to be able to run re.pl? Like adding ~/.cpan to my system $PATH?

I used the cpan Devel::REPL command to have it installed but I cannot launch it using the re.pl command
Is there something I have to do in order to be able to run re.pl ?
Yes, re.pl is installed in the bin directory of the perl installation directory. This directory is not automatically added to the search path by homebrew, so you need to add it manually. Add the following line to your ~/.zshrc file:
export PATH="/opt/homebrew/Cellar/perl/5.36.0/bin${PATH+:$PATH}"
then open a new terminal. You should now be able to type re.pl at the prompt to enter the REPL.

Related

curl: transfer closing when trying to install perlbrew

I'm trying to install perlbrew in my mac OSX and this error keeps popping in my terminal, not really sure what this means
Download the latest perlbrew
curl: (18) transfer closed with ###### bytes remaining to read
I understand vaguely that this error is related to poor network service, am I right?
Can anyone help me how to install perlbrew offline and how to install modules after perlbrew is done!
Your help is appreciated
I'm trying to install perlbrew in my mac OSX
There are lots of OSX versions. Can you narrow it down a bit?
I understand vaguely that this error is related to poor network
service, am I right?
If the command you issued was:
$ \curl -L http://install.perlbrew.pl | bash
then that tells a program called curl to download the file install.perlbrew.pl from the internet, then execute the file with a program called bash. You can view that file by entering the url specified in the command in your browser:
http://install.perlbrew.pl
As you can see, the file is very short.
The error means that for some reason curl couldn't download the entirety of a file it was trying to download. That could be because the server(where the file resides) dropped your connection, or the internet connection on your side was disrupted.
Can anyone help me how to install perlbrew offline
You could go to the url and copy the text and paste it into a local file called, say, install_perlbrew.pl. Then you could execute that file offline like this:
$ bash install_perlbrew.pl
That file is a program and when you execute the program with bash, the program uses curl yet again to retrieve another file, namely perlbrew, from the internet. You could also copy the perlbrew file to your computer and modify the install script to use the local perlbrew file, but then when you execute the perlbrew file, it also uses curl to retrieve even more files from the internet, and so on and so on.
So unless you know bash scripting and you can modify the install script to use all local files, and you have the patience to track down all the files required and copy them to local files, you are not going to be able to install perlbrew offline.
Can anyone help me how to ... install modules after perlbrew is done!
If the module name is File::Monitor, you would install it like this:
$ cpan File::Monitor
If it's your first time using the cpan command, you will see this:
$ cpan File::Monitor
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
Hit return to use the default answer (which is specified in brackets). After cpan automatically configures itself, it will install the module, and if everything went okay with the installation you will see something like this:
...
...
ANDYA/File-Monitor-1.00.tar.gz
./Build install -- OK
$
Response to comments:
Preamble: Your system has perl installed on it, however it is out of date. But, your system needs perl to perform certain tasks, so you should NEVER delete or update the system perl. In fact, you should leave the system perl alone, so that you don't screw it up and render your OS inoperable. perlbrew to the rescue.
In your Applications folder, look for a Utilities folder, and inside the Utilities folder find Terminal.app. Click on Terminal.app to launch a terminal window.
Here are the steps for installing and using perlbrew:
1) Install perlbrew:
~$ \curl -L http://install.perlbrew.pl | bash
2) Install a perl with perlbrew:
~$ perlbrew install perl-5.23.6
Prior to installing a perl, you can see what versions of perl are available by doing this:
~$ perlbrew available
perl-5.23.6
perl-5.22.1
perl-5.20.3
perl-5.18.4
perl-5.16.3
...
...
Pick whatever version of perl you want to install and specify it in the install command above.
3) Tell perlbrew which perl version to use. Because you will only have one version of perl installed at this point, write:
~$ perlbrew switch perl-5.23.6
perlbrew allows you to install multiple versions of perl, so if you have multiple versions of perl installed, and you want to switch to another version, you can do:
~$ perlbrew list
perl-5.23.6
*perl-5.20.2
perl-5.16.3
~$ perlbrew use perl-5.16.3
~$ perlbrew list
perl-5.23.6
perl-5.20.2
*perl-5.16.3
The asterisk lets you know which version of perl you are currently using.
4) Install modules in the current version of perl:
~$ cpan Path::Class !!DO NOT EVER USE SUDO!!
5) To see a list of all the modules installed in the current perl:
~$ perlbrew list-modules
CPAN::Meta
Date::Parse
File::Monitor
HTTP::CookieJar
HTTP::Date
...
...
...
6) perlbrew has a lot of other commands, so if you need to do something else, try searching through the output of:
~$ perlbrew --help

Error locating modules using perlbrew and cpanm

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.

Installing Perl module in Unix

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.

perlbrew command not found

I installed perlbrew on Linux backtrack on my virtual machine. and I have perl 5.10.1 installed on my backtrack. but when I write perlbrew command in the terminal it shows the following message:
perlbrew: command not found
What is wrong with my system?
When you installed perlbrew, you were instructed to add something like
source ~/perl5/perlbrew/etc/bashrc
to your shell startup script (.bashrc). It appears that you did not do this, or that you did not restart your shell after doing this.
The standard sudo apt install perlbrew on a fresh Ubuntu18 install appears to be borken (and Ubuntu20 too if my memory isn't malfunctioning). And has been so for some time. I couldn't get it to work even if I appended source ~/perl5/perlbrew/etc/bashrc to ~/.bash_profile and/or ~/.bashrc and started a new bash. And also did perlbrew init.
What eventually worked for me is curl -L https://install.perlbrew.pl | bash taken from https://perlbrew.pl/ After this which perlbrew shows the correct /home/me/perl5/perlbrew/bin/perlbrew instead of /usr/bin/perlbrew. And now I can see the whole list of available perl5 versions with perlbrew available.

How to change default perl installation to the one installed by macports

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.