The concept of
.gitignore is great.
For one of my projects I needed something similar and of course there was an implementation on CPAN.
I started out using Parse::Gitignore. Unfortunately it did not really solve my problem. Luckily there was an alternative, which suited my needs better: Text::Gitignore.
If you want to see my implementation using it in action, check my Yak project implementation in Perl.