Module::License::Report::Object - Encapsulation of license information


Module-License-Report documentation Contained in the Module-License-Report distribution.

Index


Code Index:

NAME

Top

Module::License::Report::Object - Encapsulation of license information

LICENSE

Top

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

Top

    use Module::License::Report::Object;

    my $license = Module::License::Report::Object->new({...});
    print $license;                     # 'perl'
    print $license->source_file();      # 'META.yml'
    print $license->confidence();       # '100'
    print $license->package_version();  # '0.01'

DESCRIPTION

Top

This module is intended for use with Module::License::Report. You likely will never need to use the new() method, but the others will likely be useful.

FUNCTIONS

Top

$pkg->new({...})

Creates a new license instance. This is intended for internal use by Module::License::Report::CPANPLUSModule.

$license->name()

Returns the name of the license. This name is of the form used by Module::Build. See http://search.cpan.org/~kwilliams/Module-Build/lib/Module/Build/Authoring.pod#license for the full list.

This method is called when $license is used in string context.

$license->confidence()

Returns a confidence in the license as a number between 100 (high) and 0 (low). These confidences are subjective, and reflect how direct the determination of the license was, versus how many heuristics were used. For example, a license specified in META.yml has a very high confidence, while a string like under the same license as Perl itself parsed from README is given lower confidence.

$license->source_file()

Returns the name of the file which specified the license, relative to the distribution folder. This might be undef if the license came from the CPAN DSLIP parameter.

For example: META.yml, README.txt, lib/Foo/Bar.pm.

$license->source_filepath()

Like source_file(), but returns an absolute path.

$license->source_name()

Returns a machine-readable keyword that describes the source of the license. If more than one source was used, they are comma-separated. The list of keywords is: META.yml, DSLIP, Module, POD, and LicenseFile.

$license->source_description()

Returns a human-readable version of source_name().

$license->module_name()

Returns the name of the module that started the license search. So, if the license of package Foo-Bar is perl, this value could be any of Foo::Bar, Foo::Bar::Baz, Foo::Bar::Quux, etc.

$license->package_name()

Returns the CPAN package name for the distribution. For example, Foo-Bar.

$license->package_version()

Returns the version number of the CPAN package that was used to determine the license. For example, 0.12.03_01.

$license->package_dir()

Returns the directory name of the extracted distribution. This is typically a subdirectory of .cpanplus somewhere.

SEE ALSO

Top

Module::License::Report

AUTHOR

Top

Clotho Advanced Media Inc., cpan@clotho.com

Primary developer: Chris Dolan


Module-License-Report documentation Contained in the Module-License-Report distribution.
package Module::License::Report::Object;

use strict;
use warnings;
use overload q{""} => 'name';

our $VERSION = '0.02';

sub new
{
   my $pkg         = shift;
   my $params_hash = shift;

   return bless {%$params_hash}, $pkg;
}

sub name
{
   my $self = shift;
   return $self->{name};
}

sub confidence
{
   my $self = shift;
   return $self->{confidence};
}

sub source_file
{
   my $self = shift;
   return $self->{source_file};
}

sub source_filepath
{
   my $self = shift;
   return if (!defined $self->{source_file});
   return File::Spec->catfile($self->{module}->extract_dir(), $self->{source_file});
}

sub source_name
{
   my $self = shift;
   return $self->{source_name};
}

sub source_description
{
   my $self = shift;
   return $self->{source_desc};
}

sub module_name
{
   my $self = shift;
   return $self->{module}->name();
}

sub package_name
{
   my $self = shift;
   return $self->{module}->package_name();
}

sub package_version
{
   my $self = shift;
   return $self->{module}->package_version();
}

sub package_dir
{
   my $self = shift;
   return $self->{module}->extract_dir();
}

1;
__END__