NAME
Software::Copyright::Statement - a copyright statement for one owner
VERSION
version 0.014
SYNOPSIS
my
$statement
= Software::Copyright::Statement->new(
'2020,2021, Joe <joe@example.com>'
);
$statement
->name;
# => is "Joe"
$statement
->email;
# => is 'joe@example.com'
$statement
->range;
# => is '2020, 2021'
# merge records
$statement
->merge(Software::Copyright::Statement->new(
'2022, Joe <joe@example.com>'
));
$statement
->range;
# => is '2020-2022'
# update the year range
$statement
->add_years(
'2015, 2016-2019'
)->stringify;
# => is '2015-2022, Joe <joe@example.com>'
# stringification
my
$string
=
"$statement"
;
# => is '2015-2022, Joe <joe@example.com>'
# test if a statement "contains" another one
my
$st_2020
= Software::Copyright::Statement->new(
'2020, Joe <joe@example.com>'
);
$statement
->contains(
$st_2020
);
# => is '1'
DESCRIPTION
This class holds one copyright statement, i.e. year range, name and email of one copyright contributor.
On construction, a cleanup is done to make the statement more standard. Here are some cleanup example:
2002-6
Joe
=> 2002-2006, Joe
2001,2002,2003,2004
Joe
=> 2001-2004, Joe
# found in markdown documents
2002 Joe mailto:joe
@example
.
com
=> 2002, Joe <joe
@example
.com>
CONSTRUCTOR
The constructor can be called without argument or with a string containing:
a year range (optional)
a name (mandatory)
an email address (optional)
E.g:
my
$st
= Software::Copyright::Statement->new();
my
$st
= Software::Copyright::Statement->new(
'2002, Joe <joe@example.com>'
);
Methods
name
Set or get owner's name
Set or get owner's name
owner
Returns a Software::Copyright::Owner object. This object can be used as a string.
merge
Merge 2 statements. Note that the 2 statements must belong to the same owner (the name attributes must be identical).
See the Synopsis for an example.
This method returns $self
add_years
Add a year range to the copyright owner. This method accepts year ranges like "2020", "2018, 2020", "2016-2020,2022". White spaces are ignored.
This method returns $self
stringify
Returns a string containing a year range (if any), a name and email (if any) of the copyright owner.
contains
Return 1 if the other statement is contained in current statement, i.e. owner or record are identical and other year range is contained in current year range.
For instance:
2016, Joe
is contained in2014-2020, Joe
2010, Joe
is not contained in2014-2020, Joe
Operator overload
Operator ""
is overloaded to call stringify
.
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