The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Software::Copyright::Statement - single copyright statement class

VERSION

version 0.003

SYNOPSIS

 use Software::Copyright::Statement;

 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'

 # stringification
 "$statement"; # => is '2020-2022, Joe <joe@example.com>'

DESCRIPTION

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

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

email

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.

stringify

Returns a string containing a year range (if any), a name and email (if any) of the copyright owner.

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