NAME

Software::Copyright - Copyright class

VERSION

version 0.013

SYNOPSIS

use Software::Copyright;

my $copyright = Software::Copyright->new('2020,2021, Joe <joe@example.com>');

# stringification
my $s = "$copyright"; # => is "2020, 2021, Joe <joe\@example.com>"

# add with merge
$copyright->merge('2018-2020 Averell');

# after addition
$s = "$copyright"; # => is "2020, 2021, Joe <joe\@example.com>\n2018-2020, Averell"

# merge statement which adds email
$copyright->merge('2016, Averell <averell@example.com>');

$s = "$copyright"; # => is "2020, 2021, Joe <joe\@example.com>\n2016, 2018-2020, Averell <averell\@example.com>"

DESCRIPTION

This class holds a copyright statement, i.e. a set of year range, name and email.

CONSTRUCTOR

The constructor is called with a copyright statement string. This string can be spread on several lines. The constructor is also compatible with the string given by Debian's licensecheck, i.e. the statements can be separated by "/".

Methods

statement

Get the Software::Copyright::Statement object of a given user.

statement_list

Returns a list of Software::Copyright::Statement object for all users.

stringify

Returns a string containing a cleaned up copyright statement.

is_valid

Returns true if the copyright contains valid records, i.e. records with names.

owners

Return a list of statement owners. An owner is either a name or a record.

statement

Returns the Software::Copyright::Statement object for the given owner:

my $statement = $copyright->statement('Joe Dalton');

merge

Merge in a statement. This statement is either merged with a existing statement when the owner match or appended to the list of statements.

The statement parameter can either be a string or an Software::Copyright::Statement object.

contains

Return 1 if the other copyright is contained in current copyright, i.e. all other statements are contained in current statements (See "contains" in Copyright::Statement for details on statement containment).

For instance:

  • 2016, Joe copyright is contained in 2014-2020, Joe copyright.

  • 2016, Joe is contained in 2014-2020, Joe / 2019, Jack

  • 2010, Joe is not contained in 2014-2020, Joe

Operator overload

Operator "", eq and ne are overloaded.

See also

Software::Copyright::Statement, Software::Copyright::Owner

AUTHOR

Dominique Dumont

COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by Dominique Dumont <dod@debian.org>.

This is free software, licensed under:

The GNU General Public License, Version 3, June 2007