The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Software::License::OrLaterPack - Use GNU license with "or later" clause

VERSION

Version v0.10.2, released on 2016-10-10 22:17 UTC.

WHAT?

Software-License-OrLaterPack (or just OrLaterPack for brevity) is an add-on for Software-License, a set of licenses with "or later" clause (like GPL_3::or_later). It allows Perl developers (who use Dist-Zilla) to release their work under the terms of a License version N or (at user option) any later version.

This is OrLaterPack user manual. Read this if you want to use GNU license with "or later" clause.

If you are going to hack or extend OrLaterPack read module documentation, e. g. Software::License::GPL_3::or_later. General topics like getting source, building, installing, bug reporting and some others are covered in the README file.

SYNOPSIS

DESCRIPTION

All "or later" are just subclasses of corresponding base license classes. For example, Software::License::GPL_3::or_later is a subclass of Software::License::GPL_3, so any "or later" license can be used like any other license. For example, in your dist.ini file:

    license = GPL_3::or_later

However, licenses in the pack introduce few features not found in base classes.

Program Name

Software::License constructor accepts hashref as the only argument:

    $lic = Software::License::GPL_3::or_later->new( {
        holder  => 'John Doe',
        year    => '2010',
    } );

Software::License documents two keys holder and year shown in example. However, Software::License constructor just (re)blesses passed hashref to the package, keeping all the hash keys and values intact, so you can pass more arguments to the constructor.

OrLaterPack licenses use two more keys program and Program:

    $lic = Software::License::GPL_3::or_later->new( {
        holder  => 'John Doe',
        year    => '2010',
        program => 'assa',
        Program => 'Assa',
    } );

These values are used as program name instead of generic "this program" in license notice, for example:

    Assa is free software: you can redistribute it and/or modify it…

program key is used in the middle of sentence, Program is used if program name starts a sentence. You may specify either one or both keys. If only one key specified, it is used in all the occurrences regardless of its position within a sentence.

Note: At time of writing, these keys are used only by licenses from OrLaterPack. You can safely pass them to constructor of any license, it does not hurt but keys will not be used.

When using Dist::Zilla you just specify few options, and Dist::Zilla does all the work on behalf of you:

    name                = Assa
    license             = GPL_3::or_later
    copyright_holder    = John Doe
    copyright_year      = 2010

Program name is specified, but Dist::Zilla does not pass it to license object constructor. Patch for Dist::Zilla submitted but not yet applied. Meanwhile, you can hack it with little help from Hook plugin:

    name                = Assa
    license             = GPL_3::or_later
    copyright_holder    = John Doe
    copyright_year      = 2010
    [Hook::Init]
        . = $dist->license->{ program } = $dist->name;
            ; Voilà: license has `program` key now.
    ...

For accessing these keys, OrLaterPack introduced two methods: program and Program. They are convenient because you should not worry if the key was specified or not: a method returns best available variant of program name. For example, if program key was not passed to the constructor, $self->{ program } will return undef, while $self->program will return value of Program key, if it was specified, or "this program" as the last resort. However, these methods are not defined in base class and can be invoked only on a license from OrLaterPack.

Short License Notice

Standard GNU license notice consists of 3 paragraphs (more than 100 words and 600 characters). It is ok for the program documentation, but it far too long to be printed in the beginning of interactive session. For latter purpose FSF recommends to use short notice like this one:

    Copyright (C) 2010 John Doe
    License GPLv3+: GNU General Public License version 3 or later.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

To get short license notice, pass 'short' argument to the notice method:

    $lic->notice( 'short' );

At time of writing, 'short' argument is respected only by licenses in orLaterPack. Other licenses ignore the arguments and return ordinary license note.

Note: This feature is considered experimental now.

WHY?

Dist-Zilla is a popular tool for building CPAN distributions. Build process is controlled by dist.ini, Dist-Zilla configuration file. A distribution author can specify license covering his work by using license option in dist.ini file:

    license = NAME

where NAME is a name of module from Software::License hierarchy.

Software-License is shipped with a set of popular licenses, from Apache_1_1 to Zlib, including GNU licenses (GPL), including their "Affero" and "Lesser" variants.

So, if a developer wants to release his work under the terms of the GPL version 3, he should write in his dist.ini:

    license = GPL_3

However, Free Software Foundation recommends using clause "license version N or (at your option) any later version". Unfortunately, Software-License distribution does not supply (out of the box) a way to express such clause.

OrLaterPack fulfills the lack. If OrLaterPack is installed, a developer can specify in his dist.ini:

    license = GPL_3::or_later

In dist.ini:

    name             = Foo-Bar
    version          = 0.001
    author           = John Doe <john.doe@example.com>
    license          = GPL_3::or_later
        ; or another license, see the list of provided licenses
    copyright_holder = John Doe
    copyright_year   = 2015
    …

Direct usage:

    use Software::License::GPL_3::or_later;
        # or another license, see the list of provided licenses
    my $lic = Software::License::GPL_3::or_later->new( {
        holder  => 'John Doe',
        year    => '2010',
        program => 'Assa',
    } );
    $lic->abbr;     # returns 'GPLv3+'
    $lic->notice;   # Copyright statement and 3-paragraph GNU license notice
    …

LIST OF PROVIDED LICENSES

Software::License::AGPL_3::or_later
Software::License::GPL_1::or_later
Software::License::GPL_2::or_later
Software::License::GPL_3::or_later
Software::License::LGPL_2_1::or_later
Software::License::LGPL_3_0::or_later

CAVEATS

CPAN::Meta::Spec hardcodes the list of "valid" licenses. In version 2.150001 of the module there are no "upgradable" GNU licenses, so in CPAN the GPLv3+ will look as ordinal GPLv3 (gpl_3), and so on.

SEE ALSO

Dist::Zilla
Dist::Zilla::Plugin::Hook
Software::License
Why should programs say “Version 3 of the GPL or any later version”?

AUTHOR

Van de Bugger <van.de.bugger@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2015 Van de Bugger

License GPLv3+: The GNU General Public License version 3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>.

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.