App-Licensecheck

 view release on metacpan or  search on metacpan

bin/licensecheck  view on Meta::CPAN

regular expression of files to include
when more than one F<PATH> is provided
S<(default value: common source files)>

=item B<-i> I<REGEX>, B<--ignore>=I<REGEX>

I<Since v2.10.10.>

regular expression of files to skip
when more than one F<PATH> is provided
S<(default value: some backup and VCS files)>

=item B<-r>, B<--recursive>

I<Since v2.10.7.>

traverse directories recursively

=back

=cut

push @OPT, qw(
	check|c=s
	ignore|i=s
	recursive|r
);
$OPT{check}  = 'common source files';
$OPT{ignore} = 'some backup and VCS files';

=head2 Parsing contents

=over 16

=item B<-l> I<N>, B<--lines>=I<N>

I<Since v2.10.3.>

number of lines to parse from top of each file;

bin/licensecheck  view on Meta::CPAN

		|m
		|md|markdown
		|tex
		|mli?
		|(c|l)?hs
	)$
!;

# From dpkg-source
my $default_ignore_regex = q!
	# Ignore general backup files
	~$|
	# Ignore emacs recovery files
	(?:^|/)\.#|
	# Ignore vi swap files
	(?:^|/)\..*\.swp$|
	# Ignore baz-style junk files or directories
	(?:^|/),,.*(?:$|/.*$)|
	# File-names that should be ignored (never directories)
	(?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$|
	# File or directory names that should be ignored
	(?:^|/)(?:CVS|RCS|\.pc|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|
	\.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
!;

my $check_regex = $OPT{check};
if ( !$check_regex or $check_regex eq 'common source files' ) {
	$check_regex = qr/$default_check_regex/x;
}
else {
	$check_regex = qr/$check_regex/;
}

my $ignore_regex = $OPT{ignore};
if ( !$ignore_regex or $ignore_regex eq 'some backup and VCS files' ) {
	$ignore_regex = qr/$default_ignore_regex/x;
}
else {
	$ignore_regex = qr/$ignore_regex/;
}

my %patternfiles;
my %patternownerlines;
my %patternlicense;



( run in 0.561 second using v1.01-cache-2.11-cpan-49f99fa48dc )