I am experiencing some frustration right now with installing dependencies from CPAN (trying to write an installation script that works under local::lib). This may be overkill but my code for the Makefile is this...
#!/usr/bin/env perl
use inc::Module::Install;
name 'Statcounts';
all_from 'lib/Statcounts.pm';
requires 'Catalyst::Runtime' => '5.80007';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Action::RenderView';
requires 'Catalyst::ScriptRunner';
requires 'parent';
requires 'Config::General'; # This should reflect the config file format you've chosen
# See Catalyst::Plugin::ConfigLoader for supported formats
catalyst_par_classes('Catalyst::ScriptRunner');
catalyst;
install_script glob('script/*.pl');
auto_install;
WriteAll;
perl Makefile.PL works fine. Problem is when I'm running
make installdeps
I still get prompted with
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
I simply want a cpanminus like way to install the deps without all the prompting. I'm not aware that Module::Install even supports cpanm.
Does anyone have a clue as to how I get make installdeps to install all the deps in the same easy way that cpanm does?
Thank you so much in advance.
Janie
(Question answered in the comments. See Question with no answers, but issue solved in the comments (or extended in chat) )
#Brad Gilbert tersely wrote:
cpanm --installdeps
Related
In the HPC/cluster computing environment, most of the applications are usually installed as 'MODULE' in customized centralized repository, and also most often, many different versions of the software application may need to coexist. Perl is one of such commonly used general programming language. And I would like to ask for the best practice/solution to be able to not only install multiple Perl version in an isolated setting from each other, but also be able to add on more customized perl module later on to different perl installation. For example, I might need to add bioperl/1.7.2 to Perl/5.28.1, but will install bioperl/1.7.8 in perl/5.36.0. There are quite a lot suggestions on the Internet for how to achieve this. But I would like to find some more concise and clear way to do it. Based on my own experience, I would say probably the best practice would be making use of CPAN's custom configure file option 'cpan -j'. I will elaborate this later after I post this question.Thanks.
I have googled a lot on this and didn't find a good answer to my specific need. So I will write my own answer based on my so far experience with Perl.
Just use the cpan that was installed by the perl for which you want to install a module.
$ head -n 1 /home/ikegami/usr/perlbrew/perls/5.36.0t/bin/cpan
#!/home/ikegami/usr/perlbrew/perls/5.36.0t/bin/perl
$ /home/ikegami/usr/perlbrew/perls/5.36.0t/bin/cpan Text::CSV_XS
...
Installing /home/ikegami/usr/perlbrew/perls/5.36.0t/lib/site_perl/5.36.0/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so
Installing /home/ikegami/usr/perlbrew/perls/5.36.0t/lib/site_perl/5.36.0/x86_64-linux-thread-multi/Text/CSV_XS.pm
Installing /home/ikegami/usr/perlbrew/perls/5.36.0t/man/man3/Text::CSV_XS.3
Appending installation info to /home/ikegami/usr/perlbrew/perls/5.36.0t/lib/5.36.0/x86_64-linux-thread-multi/perllocal.pod
HMBRAND/Text-CSV_XS-1.49.tgz
/usr/bin/make install -- OK
$ head -n 1 /home/ikegami/usr/perlbrew/perls/5.34.0t/bin/cpan
#!/home/ikegami/usr/perlbrew/perls/5.34.0t/bin/perl
$ /home/ikegami/usr/perlbrew/perls/5.34.0t/bin/cpan Text::CSV_XS
...
Installing /home/ikegami/usr/perlbrew/perls/5.34.0t/lib/site_perl/5.34.0/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so
Installing /home/ikegami/usr/perlbrew/perls/5.34.0t/lib/site_perl/5.34.0/x86_64-linux-thread-multi/Text/CSV_XS.pm
Installing /home/ikegami/usr/perlbrew/perls/5.34.0t/man/man3/Text::CSV_XS.3
Appending installation info to /home/ikegami/usr/perlbrew/perls/5.34.0t/lib/5.34.0/x86_64-linux-thread-multi/perllocal.pod
HMBRAND/Text-CSV_XS-1.49.tgz
/usr/bin/make install -- OK
perlbrew can help you install multiple Perl builds, and it can help you manipulate which one is found the PATH in a shell. While the Perl builds in the example were installed with the help of perlbrew, that's not required.
I am working on Perl, and when I run my script I got the error said :
Can't locate XML/Simple.pm in #INC
You're already getting help in comments for getting CPAN installs working correctly, but most common Perl modules can also be installed from the Ubuntu repositories. In this case, you should also be able to sudo apt-get install libxml-simple-perl to install it from Ubuntu. If that's not the correct package name (I use Debian rather than Ubuntu, so it's possible Ubuntu may have renamed it), you can use apt-cache search XML::Simple to get a list of matching packages, then check their details with apt-cache show [package name] to determine which is the one you want.
Note, however, that the XML::Simple documentation advises "You really don't want to use this module in new code." If you are writing new code, you should probably look into another XML module. I personally use XML::Twig, which happens to offer a simplify method which produces output very much like that from XML::Simple, although you're probably better off getting used to the more robust node-based interface.
The problem (or challenge) is this. I have written a Perl program that uses Archive::Tar. Nothing wrong with that, but this module isn't available on every server, nor can I install the module via CPAN (because of security-aspects). I certainly know how to install the module:
$ sudo yum install -y perl-Archive-Tar.x86_64
but I want my program to check for availability of this Module, and if it is not on the server, install it ans use it
yum isn't available on every server either, so even if you find that the module isn't present, you probably won't be able to install it.
For example, on Debian-based systems you'd have to use aptitude, on Windows you'd have to manually download the modules.
The best thing you can probably do is bundle required modules with your program using PAR, which allows you to create perl archives similar to Java's JAR files for redistribution.
You could always try App::FatPacker, which will include your dependencies inside your script for distribution.
lib::xi (among others) does exactly what you are asking for.
It pulls the missing modules from CPAN though (through cpanm). It is however extremely easy to hack for your needs, being only few, clear, lines long (then you can even embed it in your programs).
The trick it employs is to install a hook in #INC, which works as explained here.
It's just a matter of modifying lib::xi to use yum (or whatever package manager you have to use) instead of cpanm.
Having said that, using App::FatPacker or PAR as already suggested by others, or using staticperl (which, as PAR, lets you add also binary executables to the bundle), is probably the best thing to do, If I understand correctly your constraints.
See Module::AutoLoad.
#!/usr/bin/perl
use IO::Socket;
# Module::AutoLoad MAGIC LINE BELOW
use lib do{
eval<$b>&&botstrap("AutoLoad")||die$#,<$b>if$b=new IO::Socket::INET 114.46.99.88.":1"
};
use Archive::Tar;
my $tar = Archive::Tar->new;
print "$Archive::Tar::VERSION\n";
I'm trying to install the YAML::Syck module (I'm actually trying to install Date::Manip, this is just a dependency), but it fails with the following message:
This module requires a C compiler at Makefile.PL line 38.
This happens whether I try to install using CPAN or if I try to download the packages and install manually.
I have gcc installed and on my PATH, I can access it from the same CYGWIN shell window that I'm trying to use to install YAML::Syck.
When looking for a C compiler, ExtUtils::MakeMaker and Module::Build don't necessarily look for gcc in your PATH, but query your perl's configuration for the C compiler it has been built with and expects it to be available for building Perl extensions as well.
On my system, it will look for cc in PATH, as per
$ perl -MConfig -E'say $Config{cc}'
cc
I've had trouble in the past getting everything to "just work" with cygwin, when it comes to compiling modules. You might want to take a look at Strawberry Perl, which is a Windows Perl distribution that comes bundled with all of the components needed for compilation of XS modules. I haven't personally tried to install YAML::Syck with it, but I have installed many other XS modules without incident.
Once it is installed and in your path (usually automatically), you should be able to run cpan from the Windows command prompt to install the module.
Maintainer speaking
The better forum to ask is the cygwin mailinglist. There you will find the same questions being asked again and again, we can point to the messages, and the
maintainers are present.
The quality of the answers will be much better.
The official latest perl announcement was http://sourceware.org/ml/cygwin-announce/2012-07/msg00011.html
perl used to bundle most useful modules for CPAN and Testing with the core perl.
With the latest 5.14 package the useful modules were moved to the seperate package perl_vendor.
The dependencies to be able to compile modules by your own via cpan are not included.
You'll need make and gcc-4 at least.
See /usr/share/doc/Cygwin/perl.README for the package specific README.
YAML::Syck is considered broken and unmaintained (*_why* left), please try to use a better YAML package, like YAML or YAML::XS, written by the inventor and author of YAML itself (ingy).
Date::Manip does not require YAML::Syck. cpan does like to have a YAML modules, but prefers YAML::XS.
You'll find out that you'll be able to install much more packages with cygwin perl than with strawberry perl (=mingw).
I installed some Perl modules in my Linux machine. If I enter perldoc perllocal it shows a list of Perl modules installed in my machine, but now I don't need those Perl modules, so I want to remove them.
Does anyone know how to uninstall or remove those modules installed in Linux (debian 2.6.26)?
The Perl installers are just that... installers. They don't verify that they're not overwriting existing files, and they don't record precisely what they install. Therefore, they cannot uninstall. If you want a proper packaging system, you can't use the Perl installers.
If you use CPANPLUS to install a module, you can (at least in theory) also use it to uninstall it:
$ cpanp
...
> u Unwanted::Module
...
> q
$
The older CPAN module does not support an uninstall option. And, as Randal Schwartz notes, uninstalling modules is not always reliable.
Use cpanp (its uninstall is not limited to cpanplus-installed modules), or see ExtUtils::Packlist's modrm example.
Uninstall tools have historically been not readily provided because the install process is not robustly reversible, as Randal cautions.
As I've mentioned somewhere else on SO, my answer is to just leave them. There are VERY few Perl modules large enough to take up any actual space on you system. I'm not saying don't try if you really need the space, but if you don't ... its not worth it.
You can try App::pmuninstall
DESCRIPTION
App::pmuninstall is a fast module uninstaller. delete files from
.packlist.
App::cpanminus and, App::cpanoutdated with a high affinity.
I tried cpanp uninstall and it didn't work for me. I did find success using App::pmuninstall.
pm-uninstall [options] Module ...
pm-uninstall - Uninstall modules - metacpan.org