Created
April 23, 2009 09:23
-
-
Save bingos/100424 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Module::Pluggable search_path => 'Software::License', sub_name => 'licenses'; | |
use Software::License; | |
use Getopt::Long; | |
my $list; | |
my $license = 'Perl_5'; | |
my $holder; | |
my $year; | |
GetOptions( 'list', \$list, 'license=s', \$license, 'holder=s', \$holder ) or die; | |
my @licenses = sort map { s/^Software::License:://; $_ } licenses(); | |
if ( $list ) { | |
print "Licenses that are available:\n"; | |
print $_, "\n" for @licenses; | |
exit 0; | |
} | |
# Check if we have a holder defined | |
die "You must specify a license holder with --holder option\n" | |
unless $holder; | |
# Check the license that was given is valid | |
die "Invalid --license option specified, try $0 --list for a list\n" | |
unless grep { $license eq $_ } @licenses; | |
my $class = 'Software::License::' . $license; | |
eval "require $class"; | |
my $sl = $class->new( { holder => $holder } ); | |
print $sl->fulltext; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment