$self=CPANPLUS::Module->new(OPTIONS)
This method returns a "CPANPLUS::Module" object. Normal users should never call this method directly, but
instead use the "CPANPLUS::Backend" to obtain module objects.
This example illustrates a new() call with all required arguments:
CPANPLUS::Module->new(
module => 'Foo',
path => 'authors/id/A/AA/AAA',
package => 'Foo-1.0.tgz',
author => $author_object,
_id => INTERNALS_OBJECT_ID,
);
Every accessor is also a valid option to pass to "new".
Returns a module object on success and false on failure.
$mod->package_name([$package_string])
Returns the name of the package a module is in. For "Acme::Bleach" that might be "Acme-Bleach".
$mod->package_version([$package_string])
Returns the version of the package a module is in. For a module in the package "Acme-Bleach-1.1.tar.gz"
this would be 1.1.
$mod->package_extension([$package_string])
Returns the suffix added by the compression method of a package a certain module is in. For a module in
"Acme-Bleach-1.1.tar.gz", this would be "tar.gz".
$mod->package_is_perl_core
Returns a boolean indicating of the package a particular module is in, is actually a core perl
distribution.
$mod->module_is_supplied_with_perl_core([version=>$]])
Returns a boolean indicating whether "ANY VERSION" of this module was supplied with the current running
perl's core package.
$mod->is_bundle
Returns a boolean indicating if the module you are looking at, is actually a bundle. Bundles are
identified as modules whose name starts with "Bundle::".
$mod->is_autobundle;
Returns a boolean indicating if the module you are looking at, is actually an autobundle as generated by
"$cb->autobundle".
$mod->is_third_party
Returns a boolean indicating whether the package is a known third-party module (i.e. it's not provided by
the standard Perl distribution and is not available on the CPAN, but on a third party software provider).
See Module::ThirdParty for more details.
$mod->third_party_information
Returns a reference to a hash with more information about a third-party module. See the documentation
about module_information() in Module::ThirdParty for more details.
$clone=$self->clone
Clones the current module object for tinkering with. It will have a clean "CPANPLUS::Module::Status"
object, as well as a fake "CPANPLUS::Module::Author" object.
$where=$self->fetch
Fetches the module from a CPAN mirror. Look at CPANPLUS::Internals::Fetch::_fetch() for details on the
options you can pass.
$path=$self->extract
Extracts the fetched module. Look at CPANPLUS::Internals::Extract::_extract() for details on the options
you can pass.
$type=$self->get_installer_type([prefer_makefile=>BOOL])
Gets the installer type for this module. This may either be "build" or "makemaker". If "Module::Build" is
unavailable or no installer type is available, it will fall back to "makemaker". If both are available,
it will pick the one indicated by your config, or by the "prefer_makefile" option you can pass to this
function.
Returns the installer type on success, and false on error.
$dist=$self->dist([target=>'prepare|create',format=>DISTRIBUTION_TYPE,args=>{key=>val}]);
Create a distribution object, ready to be installed. Distribution type defaults to your config settings
The optional "args" hashref is passed on to the specific distribution types' "create" method after being
dereferenced.
Returns a distribution object on success, false on failure.
See "CPANPLUS::Dist" for details.
$bool=$mod->prepare()
Convenience method around install() that prepares a module without actually building it. This is
equivalent to invoking "install" with "target" set to "prepare"
Returns true on success, false on failure.
$bool=$mod->create()
Convenience method around install() that creates a module. This is equivalent to invoking "install" with
"target" set to "create"
Returns true on success, false on failure.
$bool=$mod->test()
Convenience wrapper around install() that tests a module, without installing it. It's the equivalent to
invoking install() with "target" set to "create" and "skiptest" set to 0.
Returns true on success, false on failure.
$bool=$self->install([target=>'init|prepare|create|install',format=>FORMAT_TYPE,extractdir=>DIRECTORY,fetchdir=>DIRECTORY,prefer_bin=>BOOL,force=>BOOL,verbose=>BOOL,.....]);
Installs the current module. This includes fetching it and extracting it, if this hasn't been done yet,
as well as creating a distribution object for it.
This means you can pass it more arguments than described above, which will be passed on to the relevant
methods as they are called.
See "CPANPLUS::Internals::Fetch", "CPANPLUS::Internals::Extract" and "CPANPLUS::Dist" for details.
Returns true on success, false on failure.
@list=$self->bundle_modules()
Returns a list of module objects the Bundle specifies.
This requires you to have extracted the bundle already, using the extract() method.
Returns false on error.
$text=$self->readme
Fetches the readme belonging to this module and stores it under "$obj->status->readme". Returns the
readme as a string on success and returns false on failure.
$version=$self->installed_version()
Returns the currently installed version of this module, if any.
$where=$self->installed_file()
Returns the location of the currently installed file of this module, if any.
$dir=$self->installed_dir()
Returns the directory (or more accurately, the @INC handle) from which this module was loaded, if any.
$bool=$self->is_uptodate([version=>VERSION_NUMBER])
Returns a boolean indicating if this module is uptodate or not.
$href=$self->details()
Returns a hashref with key/value pairs offering more information about a particular module. For example,
for "Time::HiRes" it might look like this:
Author Jarkko Hietaniemi (jhi@iki.fi)
Description High resolution time, sleep, and alarm
Development Stage Released
Installed File /usr/local/perl/lib/Time/Hires.pm
Interface Style plain Functions, no references used
Language Used C and perl, a C compiler will be needed
Package Time-HiRes-1.65.tar.gz
Public License Unknown
Support Level Developer
Version Installed 1.52
Version on CPAN 1.65
@list=$self->contains()
Returns a list of module objects that represent the modules also present in the package of this module.
For example, for "Archive::Tar" this might return:
Archive::Tar
Archive::Tar::Constant
Archive::Tar::File
@list_of_hrefs=$self->fetch_report()
This function queries the CPAN testers database at http://testers.cpan.org/ for test results of specified
module objects, module names or distributions.
Look at CPANPLUS::Internals::Report::_query_report() for details on the options you can pass and the
return value to expect.
$bool=$self->uninstall([type=>[all|man|prog])
This function uninstalls the specified module object.
You can install 2 types of files, either "man" pages or "prog"ram files. Alternately you can specify
"all" to uninstall both (which is the default).
Returns true on success and false on failure.
Do note that this does an uninstall via the so-called ".packlist", so if you used a module installer like
say, "ports" or "apt", you should not use this, but use your package manager instead.
@modobj=$self->distributions()
Returns a list of module objects representing all releases for this module on success, false on failure.
@list=$self->files()
Returns a list of files used by this module, if it is installed.
@list=$self->directory_tree()
Returns a list of directories used by this module.
@list=$self->packlist()
Returns the "ExtUtils::Packlist" object for this module.
@list=$self->validate()
Returns a list of files that are missing for this modules, but are present in the .packlist file.
$bool=$self->add_to_includepath;
Adds the current modules path to @INC and $PERL5LIB. This allows you to add the module from its build dir
to your path.
It also adds the current modules "bin" and/or "script" paths to the PATH.
You can reset $PATH, @INC and $PERL5LIB to their original state when you started the program, by calling:
$self->parent->flush('lib');
$path=$self->best_path_to_module_build();OBSOLETE
If a newer version of Module::Build is found in your path, it will return this "special" path. If the
newest version of "Module::Build" is found in your regular @INC, the method will return false. This
indicates you do not need to add a special directory to your @INC.
Note that this is only relevant if you're building your own "CPANPLUS::Dist::*" plugin -- the built-in
dist types already have this taken care of.