I am loading a new module in CPAN, Net::Netconf, but while installing this module its giving error that Bundle::Expect not found.
I have mentioned all the dependencies of this module in Makefile.PL, but Bundle::Expect is giving error, its saying this module not found.
Is there some other name for this module or I have to mention dependencies in some other file, so that I can be automatically installed by CPAN while installing my module?
Below is my Makefile.PL
use ExtUtils::MakeMaker;
our $VERSION = '0.01';
use 5.006;
WriteMakefile(
NAME => 'Net-Netconf',
AUTHOR => 'Juniper Networks, Inc',
VERSION_FROM => 'Makefile.PL',
PREREQ_PM =>
{ 'XML::LibXML' => '0', 'File::Which' => '0', 'Bundle::Expect' => '0', },
ABSTRACT => 'netconf libraries for perl',
);
Related
I am trying to find CPAN version programmatically, but ends up in failure.
Tried with perl %Config & %ENV, but couldn't find anything there.
my $cpanv = `cpan -v`;
# gives: Loading internal null logger. Install Log::Log4perl for logging messages
My goal is to auto configure cpan programmatically. CPAN config prompt varies by versions.
CPAN asks like[similar]:
1. "Do you want to manually configure?[yes]"
2. "Do you want cpan to configure?[no]"
Any way to find CPAN version or avoiding unattended CPAN configuration?
The cpan command-line program is a wrapper around App::Cpan. As far as I can see, the two files always have the same version number. That means you can do something like this:
use App::Cpan;
my $cpanv = $App::Cpan::VERSION;
Update: There are a few concepts to get straight here.
CPAN.pm is a CPAN exploration module that was added to Perl version 5.004. It includes its own basic shell.
App::Cpan is a wrapper around CPAN.pm which adds an improved command interface. It was added to Perl 5.12.
cpan is a tiny script that uses App::Cpan. It was also added to Perl version 5.12. [Update: that's the current version of cpan - there was also an earlier one that was based on CPAN.pm.]
App::Cpan and cpan share the same version number (currently 1.675). CPAN.pm is older and therefore has a larger version number (currently 2.27).
The version number from App::CPAN is what you get when you run cpan -v - so that's what I've given you in my code.
My goal is to auto configure cpan programmatically.
If you're talking about systems with a known configuration, just create (or modify) ~/.cpan/CPAN/MyConfig.pm. For example, the following is mine:
$CPAN::Config = {
'auto_commit' => q[0],
'build_cache' => q[5],
'build_dir' => q[/home/ikegami/.cpan/build],
'build_requires_install_policy' => q[yes],
'cache_metadata' => q[1],
'check_sigs' => q[0],
'commandnumber_in_prompt' => q[1],
'connect_to_internet_ok' => q[1],
'cpan_home' => q[/home/ikegami/.cpan],
'dontload_hash' => { },
'ftp' => q[/usr/bin/ftp],
'ftp_passive' => q[1],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/bin/gzip],
'halt_on_failure' => q[0],
'histfile' => q[],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/home/ikegami/.cpan/sources],
'load_module_verbosity' => q[none],
'lynx' => q[],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'make_install_make_command' => q[/usr/bin/make],
'makepl_arg' => q[],
'mbuild_arg' => q[],
'mbuild_install_arg' => q[],
'mbuild_install_build_command' => q[./Build],
'mbuildpl_arg' => q[],
'ncftpget' => q[/usr/bin/ncftpget],
'no_proxy' => q[],
'pager' => q[less],
'perl5lib_verbosity' => q[none],
'prefer_external_tar' => q[1],
'prefer_installer' => q[MB],
'prerequisites_policy' => q[follow],
'scan_cache' => q[atstart],
'shell' => q[/bin/bash],
'show_upload_date' => q[0],
'tar' => q[/bin/tar],
'tar_verbosity' => q[none],
'term_is_latin' => q[1],
'term_ornaments' => q[1],
'trust_test_report_history' => q[0],
'unzip' => q[/usr/bin/unzip],
'urllist' => [q[http://ftp.osuosl.org/pub/CPAN/], q[http://mirrors.hub.co/CPAN/], q[http://cpan.arcticnetwork.ca/]],
'use_sqlite' => q[0],
'version_timeout' => q[15],
'wget' => q[/usr/bin/wget],
'yaml_load_code' => q[0],
};
1;
__END__
Optionally, you can force the defaults to be used, and modify what needs to be changed. For example,
cpan <<<'o conf init
yes
o conf prerequisites_policy ask
o conf commit
quit
'
o conf init causes the initalization process to be started. yes accepts the defaults. o conf prerequisites_policy ask is an example of changing a default. o conf commit saves the changes.
Use case
My sysadmin just installed a Perl module via rpm and despite the fact that I can successfully use it in a one-liner, I want to know where the module was installed.
I can obviously comb through each of the path locations in #INC, but is there a way for Perl to tell me where it successfully loaded the module from?
That's what the %INC hash is for. It shows you where a module was loaded from.
$ perl -MDBI -MData::Dumper -E'say Dumper \%INC'
$VAR1 = {
'XSLoader.pm' => '/usr/share/perl5/XSLoader.pm',
'warnings/register.pm' => '/usr/share/perl5/warnings/register.pm',
'List/Util.pm' => '/usr/local/lib64/perl5/List/Util.pm',
'warnings.pm' => '/usr/share/perl5/warnings.pm',
'DBI.pm' => '/usr/lib64/perl5/vendor_perl/DBI.pm',
'overloading.pm' => '/usr/share/perl5/overloading.pm',
'Config.pm' => '/usr/lib64/perl5/Config.pm',
'Carp.pm' => '/usr/share/perl5/vendor_perl/Carp.pm',
'bytes.pm' => '/usr/share/perl5/bytes.pm',
'Exporter/Heavy.pm' => '/usr/share/perl5/vendor_perl/Exporter/Heavy.pm',
'Scalar/Util.pm' => '/usr/local/lib64/perl5/Scalar/Util.pm',
'strict.pm' => '/usr/share/perl5/strict.pm',
'Exporter.pm' => '/usr/share/perl5/vendor_perl/Exporter.pm',
'vars.pm' => '/usr/share/perl5/vars.pm',
'constant.pm' => '/usr/share/perl5/vendor_perl/constant.pm',
'overload.pm' => '/usr/share/perl5/overload.pm',
'DynaLoader.pm' => '/usr/lib64/perl5/DynaLoader.pm',
'Data/Dumper.pm' => '/usr/lib64/perl5/vendor_perl/Data/Dumper.pm',
'feature.pm' => '/usr/share/perl5/feature.pm'
};
Update: Actually, there's an easier method.
$ perldoc -lm Your::Module
I'm trying to package up a Mojolicious App I wrote and have been following the instructions with Mojolicious::Plugin::InstallablePaths.
My Build.PL looks something like this;
use Module::Build::Mojolicious clean_install => 1;
my $builder = Module::Build::Mojolicious->new(
module_name => 'test',
dist_author => 'me,
license => 'perl',
configure_requires => {
'Module::Build::Mojolicious' => 0,
'Module::Build' => 0.38,
},
requires => {
'File::Find::Rule' => 0,
'File::MMagic' => 0,
'Mojolicious' => 0,
'Mojolicious::Plugin::Authorization' => 0,
'Crypt::Blowfish' => 0,
'Experimental' => 0,
},
share_dir => 'lib/Jacaranda/files',
);
$builder->create_build_script;
My question is how do I get the dependencies to run the script, namely Module::Build::Mojolicious installed without having to install them from CPAN manually?
I don't want people who want to install my application to have to install these dependencies manually.
Like any Perl module, you should just be able to tell the cpan client to install the dependencies. I recommend using cpanm, using it is as simple as
$ cpanm --instaldeps .
I want to convert a project from use of ExtUtils::MakeMaker to Module::Build.
As the Makefile.PL is mostly default and Module::Build::Convert did not work for me (see below) I want to convert it manually but did not find the equivalent of INST_SCRIPT to place the executables in Perl's bin/ directory.
My WriteMakefile looks like this.
WriteMakefile(
NAME => 'Project',
AUTHOR => q{Mugen Kenichi <mugen.kenichi#uninets.eu>},
VERSION_FROM => 'lib/Project.pm',
INST_SCRIPT => 'script/',
($ExtUtils::MakeMaker::VERSION >= 6.3002
? ('LICENSE'=> 'perl')
: ()),
PL_FILES => {},
PREREQ_PM => {
'JSON' => 0,
'Log::Log4perl' => 0,
'Proc::Daemon' => 0,
'Term::ANSIColor' => 0,
'MooseX::Declare' => 0.34,
'MooseX::Log::Log4perl' => 0,
'Moose::Util::TypeConstraints' => 0,
'MooseX::Templated::Role' => 0,
'Template' => 0,
# for testing
'Test::More' => 0,
'MooseX::Params::Validate' => 0,
'File::Temp' => 0,
'Sub::Exporter::ForMethods' => 0,
'Data::Section' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Project-*' },
);
I tried to use Module::Build::Convert but make2build throws errors i could not resolve:
Variable "$regex" will not stay shared at (re_eval 32) line 1.
Use of uninitialized value $lines[0] in pattern match (m//) at /home/mak/perl5/lib/perl5/Module/Build/Convert.pm line 1305, <DATA> line 1.
perl version:
perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for x86_64-linux
If that's what your Makefile.PL looks like, leave it like that. Don't switch to Module::Build, which appears to be an abandoneed build system. No one maintains Module::Build anymore, and until Leon Timmermans comes out with the next thing, unless there's some feature in Module::Build you absolutely must have, there's no reason to convert to it.
Having said that though, I create the list of script files and use it as the value for script_files. It's not as nice. See my Build.PL for Unicode::Tussle.
I am developing a library and scripts in perl. For distribution I am using ExtUtils::MakeMaker, I have some configuration and data files in a directory called data in the distribution path, for example the config file is data/config.ini and data files like: data/inv01.stb. A part of the Makefile.PL code follows:
use ExtUtils::MakeMaker;
my $inifile = 'data/config.ini';
my #data = <data/*.stb>;
WriteMakefile(
NAME => 'Mymodule',
VERSION_FROM => 'lib/Mymodule.pm',
PREREQ_PM => {
'Time::HiRes' => 0,
'Storable' => 0,
'File::Path', => 0,
'File::Copy', => 0,
'Digest::CRC', => 0,
'Digest::MD5', => 0,
'Archive::Tar', => 0,
},
EXE_FILES => [ qw(scripts/check_requests.pl scripts/proc_requests.pl scripts/send_requests.pl) ],
'clean' => {FILES => clean_files()},
);
# Delete *~ files
sub clean_files {
return join(" ", "*.out", "*~", "data/test/*");
}
How can I configure the Makefile.PL to copy those files in non standard directory.
thanks for your help
Why not use EXE_FILES? After all, they are not going to be checked for runability.