Commit b8eb912f authored by gregor herrmann's avatar gregor herrmann

Imported Upstream version 0.103009

parent 2b748387
Revision history for Software-License
0.103009 2014-02-20 22:19:45-05:00 America/New_York
- Updated FSF mailing address in license text for GFDL versions 1.2,
GPL versions 1 & 2, and LGPL 2.1
0.103008 2013-11-16 22:37:14 America/New_York
- faster! thanks, charsbar!
- add new_from_short_name to LicenseUtils for spdx.org-style
......
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2013 by Ricardo Signes.
This software is Copyright (c) 2014 by Ricardo Signes.
This is free software, licensed under:
......@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2013 by Ricardo Signes.
This software is Copyright (c) 2014 by Ricardo Signes.
This is free software, licensed under:
......
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.014.
Changes
LICENSE
MANIFEST
......
This diff is collapsed.
This diff is collapsed.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.014.
use strict;
use warnings;
......@@ -35,7 +36,7 @@ my %WriteMakefileArgs = (
"Test::More" => "0.96",
"Try::Tiny" => 0
},
"VERSION" => "0.103008",
"VERSION" => "0.103009",
"test" => {
"TESTS" => "t/*.t"
}
......
This archive contains the distribution Software-License,
version 0.103008:
version 0.103009:
packages that provide templated software licenses
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
This README file was generated by Dist::Zilla::Plugin::Readme v5.014.
......@@ -2,15 +2,31 @@ use strict;
use warnings;
use 5.006; # warnings
package Software::License;
{
$Software::License::VERSION = '0.103008';
}
# ABSTRACT: packages that provide templated software licenses
$Software::License::VERSION = '0.103009';
use Data::Section -setup => { header_re => qr/\A__([^_]+)__\Z/ };
use Sub::Install ();
use Text::Template ();
# =head1 SYNOPSIS
#
# my $license = Software::License::Discordian->new({
# holder => 'Ricardo Signes',
# });
#
# print $output_fh $license->fulltext;
#
# =method new
#
# my $license = $subclass->new(\%arg);
#
# This method returns a new license object for the given license class. Valid
# arguments are:
#
# holder - the holder of the copyright; required
# year - the year of copyright; defaults to current year
#
# =cut
sub new {
my ($class, $arg) = @_;
......@@ -20,22 +36,64 @@ sub new {
bless $arg => $class;
}
# =method year
#
# =method holder
#
# These methods are attribute readers.
#
# =cut
sub year { defined $_[0]->{year} ? $_[0]->{year} : (localtime)[5]+1900 }
sub holder { $_[0]->{holder} }
# =method name
#
# This method returns the name of the license, suitable for shoving in the middle
# of a sentence, generally with a leading capitalized "The."
#
# =method url
#
# This method returns the URL at which a canonical text of the license can be
# found, if one is available. If possible, this will point at plain text, but it
# may point to an HTML resource.
#
# =method notice
#
# This method returns a snippet of text, usually a few lines, indicating the
# copyright holder and year of copyright, as well as an indication of the license
# under which the software is distributed.
#
# =cut
sub notice { shift->_fill_in('NOTICE') }
# =method license
#
# This method returns the full text of the license.
#
# =cut
sub license { shift->_fill_in('LICENSE') }
# =method fulltext
#
# This method returns the complete text of the license, preceded by the copyright
# notice.
#
# =cut
sub fulltext {
my ($self) = @_;
return join "\n", $self->notice, $self->license;
}
# =method version
#
# This method returns the version of the license. If the license is not
# versioned, this method will return false.
#
# =cut
sub version {
my ($self) = @_;
......@@ -47,6 +105,23 @@ sub version {
return join '.', @vparts;
}
# =method meta_name
#
# This method returns the string that should be used for this license in the CPAN
# META.yml file, according to the CPAN Meta spec v1, or undef if there is no
# known string to use.
#
# This method may also be invoked as C<meta_yml_name> for legacy reasons.
#
# =method meta2_name
#
# This method returns the string that should be used for this license in the CPAN
# META.json or META.yml file, according to the CPAN Meta spec v2, or undef if
# there is no known string to use. If this method does not exist, and
# C<meta_name> returns open_source, restricted, unrestricted, or unknown, that
# value will be used.
#
# =cut
# sub meta1_name { return undef; } # sort this out later, should be easy
sub meta_name { return undef; }
......@@ -77,18 +152,63 @@ sub _fill_in {
);
}
# =head1 LOOKING UP LICENSE CLASSES
#
# If you have an entry in a F<META.yml> or F<META.json> file, or similar
# metadata, and want to look up the Software::License class to use, there are
# useful tools in L<Software::LicenseUtils>.
#
# =head1 TODO
#
# =for :list
# * register licenses with aliases to allow $registry->get('gpl', 2);
#
# =head1 SEE ALSO
#
# The specific license:
#
# =for :list
# * L<Software::License::AGPL_3>
# * L<Software::License::Apache_1_1>
# * L<Software::License::Apache_2_0>
# * L<Software::License::Artistic_1_0>
# * L<Software::License::Artistic_2_0>
# * L<Software::License::BSD>
# * L<Software::License::CC0>
# * L<Software::License::FreeBSD>
# * L<Software::License::GFDL_1_2>
# * L<Software::License::GPL_1>
# * L<Software::License::GPL_2>
# * L<Software::License::GPL_3>
# * L<Software::License::LGPL_2_1>
# * L<Software::License::LGPL_3_0>
# * L<Software::License::MIT>
# * L<Software::License::Mozilla_1_0>
# * L<Software::License::Mozilla_1_1>
# * L<Software::License::Mozilla_2_0>
# * L<Software::License::None>
# * L<Software::License::OpenSSL>
# * L<Software::License::Perl_5>
# * L<Software::License::QPL_1_0>
# * L<Software::License::SSLeay>
# * L<Software::License::Sun>
# * L<Software::License::Zlib>
#
# =cut
1;
=pod
=encoding UTF-8
=head1 NAME
Software::License - packages that provide templated software licenses
=head1 VERSION
version 0.103008
version 0.103009
=head1 SYNOPSIS
......@@ -293,7 +413,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::AGPL_3;
{
$Software::License::AGPL_3::VERSION = '0.103008';
}
$Software::License::AGPL_3::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: GNU Affero General Public License, Version 3
......@@ -17,13 +15,15 @@ sub meta2_name { 'agpl_3' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::AGPL_3 - GNU Affero General Public License, Version 3
=head1 VERSION
version 0.103008
version 0.103009
=head1 AUTHOR
......@@ -31,7 +31,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::Apache_1_1;
{
$Software::License::Apache_1_1::VERSION = '0.103008';
}
$Software::License::Apache_1_1::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: The Apache Software License, Version 1.1
......@@ -16,13 +14,15 @@ sub meta2_name { 'apache_1_1' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::Apache_1_1 - The Apache Software License, Version 1.1
=head1 VERSION
version 0.103008
version 0.103009
=head1 AUTHOR
......@@ -30,7 +30,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::Apache_2_0;
{
$Software::License::Apache_2_0::VERSION = '0.103008';
}
$Software::License::Apache_2_0::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: The Apache License, Version 2.0
......@@ -16,13 +14,15 @@ sub meta2_name { 'apache_2_0' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::Apache_2_0 - The Apache License, Version 2.0
=head1 VERSION
version 0.103008
version 0.103009
=head1 AUTHOR
......@@ -30,7 +30,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::Artistic_1_0;
{
$Software::License::Artistic_1_0::VERSION = '0.103008';
}
$Software::License::Artistic_1_0::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: The Artistic License
# =head1 OPTIONS
#
# The Artistic License 1.0 has a sometimes-omitted "aggregation clause" which
# reads:
#
# 8. The name of the Copyright Holder may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# By default, this clause will be included. To disable it, include the following
# pair when instantiating the license:
#
# aggregation_clause => 0
#
# =head1 METHODS
#
# =head2 aggregation_clause
#
# This method returns whether the aggregation clause is allowed on this instance.
# By default this method returns true on instances and dies on the class.
#
# =cut
sub aggregation_clause {
exists $_[0]->{aggregation_clause} ? $_[0]->{aggregation_clause} : 1
......@@ -32,13 +52,15 @@ sub meta2_name { 'artistic_1' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::Artistic_1_0 - The Artistic License
=head1 VERSION
version 0.103008
version 0.103009
=head1 OPTIONS
......@@ -67,7 +89,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::Artistic_2_0;
{
$Software::License::Artistic_2_0::VERSION = '0.103008';
}
$Software::License::Artistic_2_0::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: The Artistic License 2.0
......@@ -16,13 +14,15 @@ sub meta2_name { 'artistic_2' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::Artistic_2_0 - The Artistic License 2.0
=head1 VERSION
version 0.103008
version 0.103009
=head1 AUTHOR
......@@ -30,7 +30,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::BSD;
{
$Software::License::BSD::VERSION = '0.103008';
}
$Software::License::BSD::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: The (three-clause) BSD License
......@@ -16,13 +14,15 @@ sub meta2_name { 'bsd' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::BSD - The (three-clause) BSD License
=head1 VERSION
version 0.103008
version 0.103009
=head1 AUTHOR
......@@ -30,7 +30,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::CC0_1_0;
{
$Software::License::CC0_1_0::VERSION = '0.103008';
}
$Software::License::CC0_1_0::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: the "public domain"-like CC0 license, version 1.0
# =head1 WARNING
#
# B<You should really think hard before using this license.>
#
# This license is provided for those who want to place their software into the
# public domain. Doing this means you have waived any copyright protection as
# much as allowed by law, and that you grant anybody the right to do anything
# with your software. You cannot reverse your decision to dedicate software as
# public property, so use this only if you're quite sure that you mean to do
# it.
#
# =cut
sub name { q(CC0 License) }
sub url { q{http://creativecommons.org/publicdomain/zero/1.0/} }
......@@ -18,13 +28,15 @@ sub meta2_name { 'unrestricted' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::CC0_1_0 - the "public domain"-like CC0 license, version 1.0
=head1 VERSION
version 0.103008
version 0.103009
=head1 WARNING
......@@ -43,7 +55,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::Custom;
{
$Software::License::Custom::VERSION = '0.103008';
}
# ABSTRACT: custom license handler
$Software::License::Custom::VERSION = '0.103009';
use parent 'Software::License';
use Carp;
use Text::Template;
# =head1 DESCRIPTION
#
# This module extends L<Software::License> to give the possibility of specifying
# all aspects related to a software license in a custom file. This allows for
# setting custom dates, notices, etc. while still preserving compatibility with
# all places where L<Software::License> is used, e.g. L<Dist::Zilla>.
#
# In this way, you should be able to customise some aspects of the licensing
# messages that would otherwise be difficult to tinker, e.g. adding a note
# in the notice, setting multiple years for the copyright notice or set multiple
# authors and/or copyright holders.
#
# The license details should be put inside a file that contains different
# sections. Each section has the following format:
#
# =begin :list
#
# = header line
#
# This is a line that begins and ends with two underscores C<__>. The string
# between the begin and the end of the line is first depured of any non-word
# character, then used as the name of the section;
#
# = body
#
# a L<Text::Template> (possibly a plain text file) where items to be
# expanded are enclosed between double braces
#
# =end :list
#
# Each section is terminated by the header of the following section or by
# the end of the file. Example:
#
# __[ NAME ]__
# The Foo-Bar License
# __URL__
# http://www.example.com/foo-bar.txt
# __[ META_NAME ]__
# foo_bar_meta
# __{ META2_NAME }__
# foo_bar_meta2
# __[ NOTICE ]__
# Copyright (C) 2000-2002 by P.R. Evious
# Copyright (C) {{$self->year}} by {{$self->holder}}.
#
# This is free software, licensed under {{$self->name}}.
#
# __[ LICENSE ]__
# The Foo-Bar License
#
# Well... this is only some sample text. Verily... only sample text!!!
#
# Yes, spanning more lines and more paragraphs.
#
# The different formats for specifying the section name in the example
# above are only examples, you're invited to use a consistent approach.
#
# =method new
#
# my $slc = Software::License::Custom->new({filename => 'LEGAL'});
#
# Create a new object. Arguments are passed through an anonymous hash, the
# following keys are allowed:
#
# filename - the file where the custom software license details are stored
#
# =cut
sub new {
my ($class, $arg) = @_;
......@@ -24,6 +88,15 @@ sub new {
return $self;
}
# =method load_sections_from
#
# $slc->load_sections_from('MY-LEGAL-ASPECTS');
#
# Loads the different sections of the license from the provided filename.
#
# Returns the input object.
#
# =cut
sub load_sections_from {
my ($self, $filename) = @_;
......@@ -50,6 +123,15 @@ sub load_sections_from {
return $self;
}
# =method section_data
#
# my $notice_template_reference = $slc->section_data('NOTICE');
#
# Returns a reference to a textual template that can be fed to
# L<Text::Template> (it could be simple text), according to what is
# currently loaded in the object.
#
# =cut
sub section_data {
my ($self, $name) = @_;
......@@ -59,6 +141,26 @@ sub section_data {
return \$section_for->{$name};
}
# =head1 MORE METHODS
#
# The following methods, found in all software license classes, look up and
# render the template with the capitalized form of their name. In other words,
# the C<license> method looks in the C<LICENSE> template.
#
# For now, the C<meta_name> and C<meta2_name> methods return C<custom> if called
# on the class. This may become fatal in the future.
#
# =for :list
# * name
# * url
# * meta_name
# * meta2_name
# * license
# * notice
# * fulltext
# * version
#
# =cut
sub name { shift->_fill_in('NAME') }
sub url { shift->_fill_in('URL') }
......@@ -95,13 +197,15 @@ __END__
=pod
=encoding UTF-8
=head1 NAME
Software::License::Custom - custom license handler
=head1 VERSION
version 0.103008
version 0.103009
=head1 DESCRIPTION
......@@ -238,7 +342,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
use strict;
use warnings;
package Software::License::FreeBSD;
{
$Software::License::FreeBSD::VERSION = '0.103008';
}
$Software::License::FreeBSD::VERSION = '0.103009';
use parent 'Software::License';
# ABSTRACT: The FreeBSD License (aka two-clause BSD)
......@@ -17,13 +15,15 @@ sub meta2_name { 'freebsd' }
=pod
=encoding UTF-8
=head1 NAME
Software::License::FreeBSD - The FreeBSD License (aka two-clause BSD)
=head1 VERSION
version 0.103008
version 0.103009
=head1 AUTHOR
......@@ -31,7 +31,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ricardo Signes.
This software is copyright (c) 2014 by Ricardo Signes.