I have perl installed, but many commands (perl utilities) are not available. I thing they should be come along with perl after perl is installed. But there are simply no such commands. And I googled to find where I can download them, but looks like nowhere tells me where to get them.
root#opensolaris:~# which find2perl
which: no find2perl in (/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin)
root#opensolaris:~# which h2ph
which: no h2ph in (/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin)
root#opensolaris:~# perl -v
This is perl, v5.8.4 built for i86pc-solaris-64int
(with 31 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
It might be over at /usr/perl5/5.8.4/bin/h2ph .
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
And i have these perl base modules installed.
perl
perl-base
perl-debug
perl-modules
And it works for me. I even uninstalled perl-debug and it still works. (ubuntu 9.04)
h2ph isn't provided in your Solaris and they tend not to provide the 'extras' or 'utilities' for perl, like 'rename' and 'find2perl' for example.
find /mount/point/here -name 'h2ph" -ls
Its definately not like linux and the layout is odd as well.
Related
I am eager to learn Raku(Perl 6) and its syntax.
I already have Perl 5 installed in my Ubuntu machine.
vinod#ubuntu-s-1vcpu-1gb-nyc1-01:~$ perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)
Copyright 1987-2017, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
I want to install Raku in the same Ubuntu system. I have couple of questions:
How can I install Raku ?
If I install Raku, will Perl 5.26 will be get wipedout/updated? I want Perl 5.26 in my system because couple of scripts are running in Perl 5.
Can I have 2 versions of Perl in single server ?
Once if I install Raku, how can I run the Raku/Perl 5 code in Ubuntu server? Is it like I should mention use Perl 5.26; at the beginning? By default which version of Perl it will take?
How can I run Raku code?
$ sudo apt-get install rakudo
[ ... stuff happens ... ]
$ perl6 -v
This is Rakudo version 2018.03 built on MoarVM version 2018.03
implementing Perl 6.c.
$ perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)
The Raku compiler is in a package called rakudo. That package includes a program called perl6 which is the actual Raku compiler. The Perl compiler and the Raku compiler are two completely separate programs, so there is no problem having them both installed and running code using either of them. They are as separate as Perl and PHP.
Update: In a (now, bizarrely, deleted) comment, you asked
What was the way to open a vi editor and write a code in that
You do it in exactly the same way as you would do it for any programming language where the code is compiled or interpreted on each execution - Perl, Python, Ruby, bash, they all work the same way.
You can write a text file containing Raku code and run it with perl6 your_file_name.
Or you can put the correct shebang line (which is #!/usr/bin/perl6) at the top of the file and make the file executable with chmod +x your_file_name.
There is a community maintained Repository of the most recent build of Rakudo available here : https://nxadm.github.io/rakudo-pkg/
This is generally updated a few days after each official release and is currently on 2019.07.1
Hello StackOverflow Community,
I am trying to install a perl module, IO::All. But every time I use CPAN to install many perl modules (including if I run from within cpan "install Build::CPAN") it fails with
Can't locate strict.pm in #INC (#INC contains:
/dev/null/lib/perl5.8-dist/Linux-2.6c2.5-x86_64-64int
/dev/null/lib/perl5.8-dist
/dev/null/lib/perl5.8-dist/Linux-2.6c2.5-x86_64-64int
/dev/null/lib/perl5.8-dist /dev/null/lib/perl5.8-dist .) at Build.PL
line 2.
This has been baffling me for hours. I've googled around and can't seem to find a solution. Running something like
perl -e 'use strict; print "ok"'
Outputs just fine. And the original file I was trying to run, which asks for IO::All uses strict as well. How is strict even missing? Isn't strict part of perl by default? And where is /dev/null? Isn't that a special location where you can pass in stderr/stdout if you don't care about that? I've been pulling my hair out about this for a while. I must be missing something obvious.
This is running on a Rhel5 Virtual Machine Linux-2.6-x86_64 variant.
Your help is much appreciated. Let me know if I need to provide further information.
Thank you,
-Asaf
I have this issue today. I compiled perl 5.14 and install to my home directory ($HOME/perl5.14/).
Because perl5.14 install some minimum perl5 libraries, you have to include the directory into $PERL5LIB=$HOME/perl5.14/usr/local/lib/perl5/5.14.2
Hope this works for you :)
I also suspect that your cpan script is misconfigured. But perl -MCPAN uses the same config, so won't help you.
Installing an alternative CPAN client might help. I'd recommend cpanminus because it's very easy to install. Just run the following command (preferably while logged in as root):
curl -L http://cpanmin.us | perl - App::cpanminus
Now you should have cpanminus, you can use it to install IO::All:
cpanm -S -v IO::All
I'm a C/C++/Java/Unix geek by trade, but now I have to write a Perl program in Windows. So I've got Cygwin, Eclipse with EPIC installed, and simple test programs run. I do not have a Unix machine available to me that I can run Eclipse on.
But I need to use Net::TCP::Server and I can't figure out how to install it. It doesn't appear to be part of the Cygwin Perl install, and I don't want to spend 5 days learning the world of Perl and CPAN and Perl configuration. I just want to write my program.
Any simple ways of installing a Perl module in Cygwin? I'm thinking something like apt-get install would be nice, but I expect that's too much to hope for.
Thanks
$ perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.
cpan[1]> install Net::TCP::Server
And it's instructive to list the configuration with the o conf command.
Seeing that some of the info here is a bit outdated and too complicated, I'd rather suggest the following. There are a few different Perl package managers in use. They are all installed with cpan (which is already part of the Cygwin Perl installation), like this:
# Install ppm (outdated)
cpan PPM
# Install cpanp (still used)
cpan CPANPLUS
# Install cpanm (most recent)
cpan App::cpanminus
Then you can install any Perl package you like, as for example in the OP, using cpanm:
cpanm Net::TCP::Server
Sometimes (as noted above) Cygwin may fail certain tests. For example, when using IPv6 on a machine only configured with IPv4, or when your windows firewall is blocking some tests, etc. To attempt to install anyway, try to use the force flag; -f.
cpanm -f Net::TCP::Server
I'm a C/C++/java unix geek by trade, but now I have to write a perl program in windows. So I've got cygwin, eclipse with EPIC installed, and simple test programs run. I do not have a unix machine available to me that I can run eclipse on.
You should be able to run Eclipse with EPIC right under Windows without Cygwin. I like Cygwin for many things, but it isn't exactly a very stable platform. Eclipse runs as a Java program, so all you have to do is make sure Java is installed on your PC. There is even a pre-built Eclipse package.
You can also get a decent Perl that runs right under Windows. Either ActivePerl or Strawberry Perl. Either one will work although many Unix heads prefer Strawberry Perl because it comes with the same MIGW environment that Cygwin has and many feel it's more compatible with the Unix Perl brethren. However, ActiveState Perl can use the Perl Package Manager (PPM) that contains pre-built modules. Unfortunately, the module you want isn't available via PPM.
But I need to use Net::TCP::Server and I can't figure out how to install it. It doesn't appear to be part of the cygwin perl install, and I don't want to spend 5 days learning the world of perl and cpan and perl configuration. I just want to write my program.
Installing from CPAN is really quite simple. The first time you run CPAN, it should pretty much configure itself. Then, to do an install, you run cpan install Net::TCP::Server and that should be it. However, I've tried on several Mac, Unix, and Linux machines, and I can't get it to work. So, this isn't a Windows problem as much as a problem with this module. It is fairly old, and might not work well in newer versions of Perl. You might have to force the install over test's objections.
Maybe you can use one of the already installed IO modules that come with Perl instead. That'll save you a boatload of trouble because the required modules are part of Perl's existing package.
Despite Cygwin's "problems," I use it regularly whenever I have to use Windows. I would recommend first installing a separate installation of Perl using perlbrew so that you won't interfere with Cygwin's copy of Perl in case something bad happens since Cygwin does not enforce root-user policy. In cygwin shell, type
\curl -L http://install.perlbrew.pl | bash
This should walk through the installation for perlbrew and set it up in one of your executable path. Next type
perlbrew init
perlbrew install --force stable
perlbrew switch stable
Wait a bit while a mint Perl is compiled. For unknown reason, Perl can only pass 99.23% of the core module tests on Cygwin (at least on my machine),hence the --force flag). My experience is that it mostly have something to do with handling of device files, like ports and pipes. I am unaware of people trying to resolve the issue as it seems like a Cygwin problem. Although it has not presented much problem for me with general system and web programming tasks. The module testing routines will fail if any problem exists so I am not fretting over it.
Next step is to install cpanm (cpanminus), type
perlbrew install-cpanm
From here on out, to install any library from CPAN, just type
cpanm [library::name1] [library::name2]
cpanm makes it trivial to install any Perl modules. You can even install from your local directory instead of CPAN.
Your mileage may vary, but I had a lot of trouble until I realized that Strawberry perl had a lot of bin folders in my PATH, and when I changed my .bashrc to export only a very simple PATH=/bin:/usr/bin:/usr/local/bin, Cygwin's perl installation's cpan started working beautifully. I used local:lib as Cygwin doesn't support sudo. Before it got into a bad loop saying "Press SPACE and ENTER to exit Patch" over and over.
Yesterday I wanted to test some software and in the documentation it said, to install I just needed to type
cpan -i Software
I never used cpan, I just know that it is the perl package manager. (Is it..?) However, it turned out that I needed loads of dependencies, and stupid as I am, I just installed all of them. (First, I had to set up cpan which asked me lots of questions) Long story short, I just want to remove all of it again. I googled a bit, and it seems like cpan does not have an uninstall routine, especially for all the packages at once.
Can I just remove some directory or will I run into troubles?
the cpan command isn't really a package manager like apt-get is. It is more a tool that downloads and installs from CPAN (the site, or one of its mirrors). After it has finished this task it doesn't remember much about what was done before, at least not enough to remove previously installed modules, at least not reliably, cleanly or dependency-safely. (Update: After looking at App::pmuninstall, it can be used to handle dependencies, but it does so by connecting to outside (read: web) sources, which compute these separately, which is fine, but I stand by the previous statement that CPAN.pm doesn't do this.)
I used to worry about removing modules, but now I realize that most Perl modules take up so little room that I just don't worry about having a few extra modules installed that you will never use. So unless you are on a computer with a REALLY small disc, I would just let it be.
On Windows or if you are using a non-system Perl on Linux/Mac you could just remove Perl and reinstall it. I would not recommend this if you are using the system installed Perl on Linux/Mac however as you could break your OS doing this (you might be ok if you were careful, but not worth it to save a few Mb!).
In the future, you can easily install a local version of Perl using perlbrew, there are tutorials all over the web if the docs aren't sufficient (they should be). This also has the bonus of letting you play with the newest and greatest Perl versions, which your system likely doesn't come with yet. Then if you install a mountain of junk, or even break it doing something crazy, remove that version and reinstall/install a different version.
Another nice tool is cpanminus (or cpanm for short) which is a newer, more user friendly cpan tool. All the cool kids are using it.
You can uninstall individual modules with cpanplus (ships with Perl) like this:
cpanp uninstall SQL::Abstract
You can view all modules installed with the cpan script like this:
perldoc perllocal
Putting the two together:
for module in $(perldoc -u perllocal | grep -F 'C<Module> L<' | sed 's/^.*L<\(.*\)|.*>$/\1/') ; do
cpanp uninstall "$module"
done
I'm not sure about removing "all of it". But to remove a single module you can use App::pmuninstall with it's sole script pm-uninstall to uninstall modules. You might then be able to write some kind of script to recursively remove the deps.
If you can't use cpan any more because there are incompatible modules in you path, you can remove all installed modules by hand. For example, I upgraded from Fedora 22 to Fedora 23 and the Perl version changed. All modules installed previously via cpanm into /usr/local/lib64/perl5 did not work any more and prevented me from using cpanm.
$ cpanm --uninstall Apache::DBI
Attempt to reload Scalar/Util.pm aborted.
Compilation failed in require at /usr/share/perl5/vendor_perl/File/Temp.pm line 18.
...
I could solve this by moving that directory:
$ mv /usr/local/lib64/perl5 /root/usr-local-lib64-perl5
The name of that directory may vary on your system.
Carefull: If a module installed files outside of that directory, for example system library files, these files will remain there.
I will change Flimm's answer to use cpanm and optionally uninstall cpanm itself in the end of the script:
#!/usr/bin/env bash
for module in $(perldoc -u perllocal | grep -F 'C<Module> L<' | sed 's/^.*L<\(.*\)|.*>$/\1/' | sort | uniq) ; do
if [[ "$module" =~ "App::cpanminus" ]]; then
continue
fi
echo "Uninstalling $module..."
yes | cpanm --uninstall "$module"
done
cpanm --uninstall App::cpanminus
I think the best option is uninstall Perl and install it again.
I was using PAR::Packer to package my Perl application on Cygwin and then running it on HPUX.
A simple hello world works well, e.g.:
pp -p hello.pl
That results in a.par and then on HPUX:
parl a.par
It works great.
However when package a bigger application with many dependencies with -B bundle switch, no such luck, instead I get the error:
Can't locate loadable object for module Socket in #INC
Any ideas, maybe some problem with Windows/unix networking? Any fixes?
You're hitting this because Socket loads a shared library, and that's not portable across platforms (that is, the Socket shared lib on Windows won't work on Linux won't work on HPUX).
You could try two things:
Identify all the places you need shared libs, and have a native install of them on your target platform. You may also need to exclude those modules from your PAR archive.
Switch to pure-Perl implementations (which are (more) portable). If you're not a whiz at Perl, C, and your target platform, and a pure-Perl version is not already available, you may be out of luck with this.
The advantage of installing an actual perl on your HPUX is that your cygwin app can then run on the hpux perl. PAR packages aren't normally going to work between any two platforms. In my mind, it's not really any different than producing the hello.exe on cygwin and trying to run it on HPUX.
Perl blixtor's advice from comments I am moving the "edit updates" I had in the question to answer my own question here:
Most of the credit here goes to Andrew Barnett, the 2 key issues were the
native C code library
the perl LIB paths
Here were the steps I followed to get the cygwin created par to run on HPUX, I believe steps should be about same on any unix:
Followed Andrew's advice and removed IO::Socket with the pp -X IO::Socket switch, but then running the resulting parl on unix I get slightly modified but still related error:
Can't locate Socket.pm in #INC (#INC contains: CODE(0x406ab018) CODE(0x4055c880) CODE(0x40563978)) at Net/Config.pm line 11
even though running "perl -MCPAN -e shell" on the unix showed Socket should be installed and up to date:
cpan[2]> install IO::Socket
IO::Socket is up to date (1.30_01).
So in addition to excluding Socket with the -X switch abobe, I also had to create a wrapper script on HPUX with just this 1 line in in, wrapper.pl:
use PAR { file => 'bdiff.par', run => 'bdiff.pl' };
then to run this I didn't use parl, instead I would just call it with perl and I had to supply the entire paths to the default lib paths with the -I switch, like this:
perl -I/lib/perl5/lib/5.10.0/PA-RISC2.0 -I/lib/lib/site_perl wrapper.pl allparameters
for some reason when using parl it seems the default lib paths get excluded, hence the full paths above.
FWIW, PAR is not designed to be portable accross different platforms -- don't expect a par package created on cygwin to run on linux/hpux....