Acme-Licence
view release on metacpan or search on metacpan
lib/Acme/Licence.pm view on Meta::CPAN
my %params = @_;
my $self = {};
if(ref($params{mylicence})) {
my %mylicence = %{$params{mylicence}};
if($mylicence{text} && $mylicence{name}) {
$licence{$mylicence{name}} = $mylicence{text};
$params{licence} = $mylicence{name};
}
}
if($params{licence}) {
if($licence{$params{licence}}) {
$self->{licencename} = $params{licence};
$self->{licencetext} = $licence{$self->{licencename}};
} else {
die("Licence '$params{licence}' is not defined.");
}
}
foreach my $arg (@ARGV) {
if($arg eq '--licence') {
print STDERR "This software is licenced under the ".
$self->{licencename}.
" licence...\n\n".
$self->{licencetext};
last;
}
}
}
1;
=pod
=head1 NAME
Acme::Licence - A module to easily apply a licence to your code
=head1 SYNOPSIS
use Acme::Licence mylicence => {
name => 'Super-funky-skillo licence',
text => 'yeah man, you can, like, do what you want'
};
or ...
use Acme::Licence licence => 'artistic';
=head1 DESCRIPTION
All the code which you release to the outside world needs to have a licence.
This module makes that easy. It has three pre-defined licences, and enables
you to write your own. It also ensures that the licence is always easily
accessible to your users from the command-line of your program, by passing
the C<--licence> parameter.
=head1 CONFIGURATION
To configure the module to use your licence, you pass parameters when you
C<use> the module. Either pass a parameter C<licence>, to use one of the
pre-defined licences (the GPL (C<gpl>), the
Artistic licence (C<artistic>), or put the code in the public domain
(C<null>)),
or pass the C<mylicence> parameter, with a reference to an anonymous hash
which defines the name of your licence and the text of your licence. The
keys for those in the anonymous hash are, predictably, C<name> and C<text>.
=head1 AUTHOR
David Cantrell (david@cantrell.org.uk)
=cut
( run in 3.926 seconds using v1.01-cache-2.11-cpan-c221a9de4ec )