Skip to content

Instantly share code, notes, and snippets.

@fgabolde
Created April 12, 2013 09:38
Show Gist options
  • Save fgabolde/5370854 to your computer and use it in GitHub Desktop.
Save fgabolde/5370854 to your computer and use it in GitHub Desktop.
Skipping SVN junk in a Module::Build share_dir.
use 5.010;
use strict;
use warnings;
use Module::Build;
my $class = Module::Build->subclass(code => q{sub _share_dir_map {
my ($self, $prefix, $list) = @_;
my %files;
for my $dir ( @$list ) {
for my $f ( @{ $self->rscan_dir( $dir, sub {-f and not m/\B.svn/} )} ) {
$f =~ s{\A.*?\Q$dir\E/}{};
$files{"$dir/$f"} = "$prefix/$f";
}
}
return %files;
}});
my $builder = $class->new(
module_name => 'Foo::Bar',
license => 'GPL_3',
dist_author => q{Fabrice Gabolde <fabrice.gabolde@uperto.com>},
dist_version_from => 'lib/Foo/Bar.pm',
dist_abstract => 'Foo from Bar and the other way around too',
configure_requires => { 'Module::Build' => '0.36_14' },
build_requires => {
'Test::More' => 0,
},
requires => {
'perl' => 5.010_001,
},
add_to_cleanup => [ 'Foo::Bar-*' ],
release_status => 'stable',
share_dir => { dist => [ qw/foo/ ] },
);
$builder->create_build_script();
# this is foo/contents-of-foo
# we want this file
curse your inevitable betrayal
# this is foo/.svn/junk
# we do not want this file
mine is an evil laugh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment