rjbs/software-license — pull request #11 by charsbar (2012-11-21 17:22:46+00:00)
Title: look for the header before the license body

Hi. I found Software::LicenseUtils::guess_license_from_pod() may take minutes to guess licenses of some huge modules. This actually may be an issue of perl's regex engine, but anyway, this commit makes guessing reasonably fast.

The following script should reproduce the issue for you:

```perl
use strict;
use warnings;
use lib "lib";
use Test::More;
use Software::LicenseUtils;
use File::Slurp qw/slurp/;

diag "downloading HTML::Dojo";
system(qw/cpanm -L extlib -n HTML::Dojo/);

diag "slurping pod";
my $pod = slurp("extlib/lib/perl5/HTML/Dojo/src.pm");

diag "start guessing";
my @licenses;
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm 30;
@licenses = Software::LicenseUtils->guess_license_from_pod($pod);
alarm 0;
};

ok !$@, "no timeout";
diag $@ if $@;
diag explain \@licenses;

done_testing;

```