| 1 | package builder::MyBuilder; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use utf8; | ||
| 5 | use 5.008_001; | ||
| 6 | use parent qw(Module::Build); | ||
| 7 | |||
| 8 | # Module:::Build's share_dir handling is not good for me. | ||
| 9 | # We need to install 'tmpl' directories to '$DIST_DIR/tmpl'. But M::B doesn't support it. | ||
| 10 | sub ACTION_code { | ||
| 11 | my $self = shift; | ||
| 12 | my $share_prefix = File::Spec->catdir($self->blib, qw/lib auto share dist/, '<% $dist %>'); | ||
| 13 | for my $dir (qw(tmpl static)) { | ||
| 14 | next unless -d $dir; | ||
| 15 | for my $src (@{$self->rscan_dir($dir)}) { | ||
| 16 | next if -d $src; | ||
| 17 | $self->copy_if_modified( | ||
| 18 | from => $src, | ||
| 19 | to_dir => File::Spec->catfile( $share_prefix ) | ||
| 20 | ); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | $self->SUPER::ACTION_code(); | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; |