#!/usr/bin/env perl use strict; use warnings; use Software::LicenseUtils; use Getopt::Long qw(:config gnu_getopt); GetOptions( "o|output=s" => \(my $output = '-'), ) or die("Error in command line arguments!\n"); my ($authors, @licenses) = @ARGV; my $out; if ($output eq '-') { $out = \*STDOUT; } else { open $out, '>', $output or die "Unable to write to $output: $!\n"; } my %uniq; print { $out } join "\n\n", map { $_->new({holder => $authors})->license } grep { !$uniq{$_}++ } map { Software::LicenseUtils->guess_license_from_meta_key($_, 2) } @licenses;