File Coverage

blib/lib/Catalyst/Build.pm
Criterion Covered Total %
statement 12 44 27.3
branch 0 10 0.0
condition 0 2 0.0
subroutine 4 10 40.0
pod 4 4 100.0
total 20 70 28.6


line stmt bran cond sub pod time code
1             package Catalyst::Build;
2              
3 1     1   15 use strict;
  1         9  
  1         17  
4 1     1   37 use Module::Build;
  1         11  
  1         21  
5 1     1   20 use Path::Class;
  1         10  
  1         22  
6 1     1   17 use File::Find 'find';
  1         10  
  1         25  
7              
8             our @ISA;
9             eval "require Module::Build";
10             die "Please install Module::Build\n" if $@;
11             push @ISA, 'Module::Build';
12              
13             our @ignore =
14               qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README
15             _build blib lib script t/;
16              
17             our $FAKE;
18             our $ignore = '^(' . join( '|', @ignore ) . ')$';
19              
20             =head1 NAME
21            
22             Catalyst::Build - Module::Build extension for Catalyst
23            
24             =head1 SYNOPSIS
25            
26             See L<Catalyst>
27            
28             =head1 DESCRIPTION
29            
30             L<Module::Build> extension for Catalyst.
31            
32             =head1 DEPRECATION NOTICE
33            
34             This module is deprecated in favor of L<Module::Install::Catalyst>. It's
35             only left here for compability with older applications.
36            
37             =head1 METHODS
38            
39             =over 4
40            
41             =item new
42            
43             =cut
44              
45             sub new {
46 0     0 1       my $class = shift;
47 0               my $self = $class->SUPER::new(@_);
48              
49 0               my $app_name = $self->{properties}{module_name};
50 0               warn <<"EOF";
51            
52             Note:
53            
54             The use of Build.PL for building and distributing Catalyst
55             applications is deprecated in Catalyst 5.58.
56            
57             We recommend using the new Module::Install-based Makefile
58             system. You can generate a new Makefile.PL for your application
59             by running:
60            
61             catalyst.pl -force -makefile $app_name
62            
63             EOF
64              
65 0               return $self;
66             }
67              
68             =item ACTION_install
69            
70             =cut
71              
72             sub ACTION_install {
73 0     0 1       my $self = shift;
74 0               $self->SUPER::ACTION_install;
75 0               $self->ACTION_install_extras;
76             }
77              
78             =item ACTION_fakeinstall
79            
80             =cut
81              
82             sub ACTION_fakeinstall {
83 0     0 1       my $self = shift;
84 0               $self->SUPER::ACTION_fakeinstall;
85 0               local $FAKE = 1;
86 0               $self->ACTION_install_extras;
87             }
88              
89             =item ACTION_install_extras
90            
91             =cut
92              
93             sub ACTION_install_extras {
94 0     0 1       my $self = shift;
95 0   0           my $prefix = $self->{properties}{destdir} || undef;
96 0               my $sitelib = $self->install_destination('lib');
97 0 0             my @path = defined $prefix ? ( $prefix, $sitelib ) : ($sitelib);
98 0               my $path = dir( @path, split( '::', $self->{properties}{module_name} ) );
99 0               my @files = $self->_find_extras;
100 0               print "Installing extras to $path\n";
101 0               for (@files) {
102 0 0                 $FAKE
103                       ? print "$_ -> $path (FAKE)\n"
104                       : $self->copy_if_modified( $_, $path );
105                 }
106             }
107              
108             sub _find_extras {
109 0     0         my $self = shift;
110 0               my @all = glob '*';
111 0               my @files;
112 0               for my $file (@all) {
113 0 0                 next if $file =~ /$ignore/;
114 0 0                 if ( -d $file ) {
115                         find(
116                             sub {
117 0 0   0                         return if -d;
118 0                               push @files, $File::Find::name;
119                             },
120 0                           $file
121                         );
122                     }
123 0                   else { push @files, $file }
124                 }
125 0               return @files;
126             }
127              
128             =back
129            
130             =head1 AUTHOR
131            
132             Sebastian Riedel, C<sri@oook.de>
133            
134             =head1 LICENSE
135            
136             This library is free software, you can redistribute it and/or modify it under
137             the same terms as Perl itself.
138            
139             =cut
140              
141             1;
142