NAME
Software::Copyright::Statement - a copyright statement for one owner
VERSION
version 0.015
SYNOPSIS
use Software::Copyright::Statement;my $statement = Software::Copyright::Statement->new('2020,2021, Joe <[email protected]>');$statement->name; # => is "Joe"$statement->email; # => is '[email protected]'$statement->range; # => is '2020, 2021'# merge records$statement->merge(Software::Copyright::Statement->new('2022, Joe <[email protected]>'));$statement->range; # => is '2020-2022'# update the year range$statement->add_years('2015, 2016-2019')->stringify; # => is '2015-2022, Joe <[email protected]>'# stringificationmy $string = "$statement"; # => is '2015-2022, Joe <[email protected]>'# test if a statement "contains" another onemy $st_2020 = Software::Copyright::Statement->new('2020, Joe <[email protected]>');$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, Joe2001,2002,2003,2004 Joe => 2001-2004, Joe# found in markdown documents2002 Joe mailto:[email protected] => 2002, Joe <[email protected]>
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 <[email protected]>');
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 in"2014-2020, Joe"
- •
-
"2010, Joe"is not contained in"2014-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 <[email protected]>.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007