Commit | Line | Data |
50f63fb1 |
1 | package SQL::Translator::Module::Build; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use File::Find; |
6 | |
7 | use base qw/Module::Build/; |
8 | |
9 | # Copies contents of ./templates into blib/templates. These are then installed |
10 | # based on the install_paths setting given to the constructor. |
11 | # Called by Module::Build due to add_build_element call in Build.PL |
12 | sub process_template_files { |
13 | my $build = shift; |
14 | find({ |
15 | no_chdir => 1, |
16 | wanted => sub { |
17 | return unless -f $_; |
18 | $build->copy_if_modified( from => $_, to_dir => "blib", verbose => 1); |
19 | }, |
20 | },'templates'); |
21 | } |
22 | |
23 | # Install the templates copied into blib above. Uses |
24 | sub ACTION_install { |
25 | my $build = shift; |
26 | $build->SUPER::ACTION_install(@_); |
27 | require ExtUtils::Install; |
28 | my $install_to = $build->config_data( 'template_dir' ); |
29 | ExtUtils::Install::install( |
30 | { 'templates' => $install_to }, 1, 0, $build->{args}{uninst} || 0 ); |
31 | } |
32 | |
33 | 1; |