NAME
Module::License::Report - Determine the license of a module
LICENSE
Copyright 2005 Clotho Advanced Media, Inc., <cpan@clotho.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SYNOPSIS
use Module::License::Report;
my $reporter = Module::License::Report->new();
my $license = $reporter->license('Module::License::Report');
print $license; # 'perl'
print $license->source_file(); # 'META.yml'
print $license->confidence(); # '100'
print $license->package_version(); # '0.01'
my %lic = $reporter->license_chain('Module::License::Report');
# ( Module-License-Report => 'perl', CPANPLUS => 'perl', ... )
DESCRIPTION
People who redistribute Perl code must be careful that all of the included libraries are compatible with the final distribution license. A large fraction of CPAN packages are licensed as Artistic/GPL
, like Perl itself, but not all. If you are going to package your work in, say, a PAR archive with all of its dependencies it's critical that you inspect the licenses of those dependencies. This module can help.
This module utilizes CPANPLUS to do much of the hard work of locating the requested CPAN distribution, downloading and extracting it. If you've never used CPANPLUS before, there will be a one-time setup step for that module.
FUNCTIONS
- $pkg->new()
- $pkg->new({key => value, ...})
-
Creates a new instance. Optional parameters can be passed in a hash reference. The recognized options are:
- $self->license($module_name)
-
Retrieves a license object for the specified module, or undef if no license could be found. The license object stringifies to the name of the license. See also Module::License::Report::Object.
The
$module_name
argument is usually a package name likeFoo::Bar
. It can also be the distribution name, likeFoo-Bar
. This is useful for distributions like Text-PDF where there is no actual module named Text::PDF, but which has Text::PDF::File instead.This method uses CPANPLUS to download and inspect the source distribution of the module. If you've never used CPANPLUS before, there will be a one-time setup phase to configure that module.
- $self->license_chain($module_name)
-
Returns a hash of
dist_name => license
pairs where thedist_name
keys are the distributions of specified module and all of its dependencies, as reported by Module::Depends. The values are Module::License::Report::Object instances. Perl core modules are omitted, as those are all known to be licensed like Perl itself.
BUGS
No specific bugs known. See rt.cpan.org for more up-to-date information.
The heuristics for guessing the license from files other than META.yml are sketchy. These could always use improvement.
SEE ALSO
Modules used internally
Module::License::Report::Object, Module::License::Report::CPANPLUS, CPANPLUS, Module::Depends
Comparison to other CPAN modules
I am not aware of any other module that performs the function of determining license, except in limited ways (like CPANPLUS determines DSLIP and Module::Build uses Build.PL
).
Other modules that report module/package metadata include: Module::Info, Module::Info::File.
CODING STYLE
This module has over 80% test code coverage in every category and over 90% overall, as reported by Devel::Cover via perl Build testcover
.
This module passes Perl Best Practices guidelines, as enforced by Perl::Critic v0.12_03.
AUTHOR
Clotho Advanced Media Inc., cpan@clotho.com
Primary developer: Chris Dolan
CREDITS
Thanks to module-authors @ perl.org for naming advice.