File-Ignore
view release on metacpan or search on metacpan
lib/File/Ignore.pm view on Meta::CPAN
=head1 BUGS
Please report any bugs or feature requests to C<bug-file-ignore at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Ignore>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc File::Ignore
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Ignore>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/File-Ignore>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/File-Ignore>
=item * Search CPAN
L<http://search.cpan.org/dist/File-Ignore>
=back
=head1 ACKNOWLEDGEMENTS
=head1 COPYRIGHT & LICENSE
Copyright 2007 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
use File::Spec;
sub _make_entry {
local $_ = shift;
my $original = $_;
my $tags = "";
$tags = $1 if s/:(.*)$//;
my $specification = $_;
my @tags = split m/\s*,\s*/, $tags;
my %tag = map { $_ => 1 } @tags;
my $scope = "basename";
$scope = "path" if m/^\//;
my $prune = 0;
$prune = 1 if s/\/$//;
my ($prunere, $pruneqr);
if ($prune) {
$prunere = "(?:^|\\/)$_(?:$|\\/)";
$pruneqr = qr/$prunere/;
}
$_ =~ s/\$/\\\$/g;
$_ =~ s/\./\\./g;
$_ =~ s/\*/\.\*/g;
return { specification => $specification, original => $original, re => $_, qr => qr/$_/, scope => $scope, prune => $prune, prunere => $prunere, pruneqr => $pruneqr, tags => \@tags, tag => \%tag };
}
my @_ignore;
{
no warnings qw/qw/;
push @_ignore, map { _make_entry $_ } (qw(
RCS/:revision,rcs,rsync
SCCS/:revision,sccs,rsync
CVS/:revision,cvs,rsync
CVS.adm:revision,cvs,rsync
RCSLOG:revision,rcs,rsync
cvslog.*:revision,cvs,rsync
tags:etags,ctags,rsync
TAGS:etags,ctags,rsync
.make.state:make,rsync
.nse_depinfo:rsync
*~:rsync
#*:rsync
.#*:rsync
,*:rsync
_$*:rsync
*$:rsync
*.old:backup,rsync
*.bak:backup,rsync
*.BAK:backup,rsync
*.orig:backup,rsync
*.rej:patch,rsync
.del-*:rsync
*.a:object,rsync
*.olb:object,rsync
*.o:object,rsync
*.obj:object,rsync
*.so:object,rsync
.exe:object,rsync
*.Z:rsync
*.elc:rsync
*.ln:rsync
core:core,rsync
.svn/:revision,svn,rsync
.sw[p-z]:vim,swap
));
}
my @_path = grep { $_->{scope} eq "path" } @_ignore;
( run in 0.854 second using v1.01-cache-2.11-cpan-71847e10f99 )