need to move the marked lines into one method
[catagits/Catalyst-Devel.git] / Makefile.PL
1 use inc::Module::Install 0.87;
2
3 name     'Catalyst-Devel';
4 all_from 'lib/Catalyst/Devel.pm';
5
6 requires 'File::ShareDir';
7 requires 'Catalyst'    => '5.8000';
8 requires 'Catalyst::Action::RenderView' => '0.04';
9 requires 'Catalyst::Plugin::Static::Simple' => '0.16';
10 requires 'Catalyst::Plugin::ConfigLoader';
11 requires 'Class::Accessor::Fast';
12 requires 'Config::General' => '2.42'; # as of 1.07, we use .conf and not .yaml
13 requires 'File::ChangeNotify' => '0.03';
14 requires 'File::Copy::Recursive';
15 requires 'Module::Install' => '0.64';
16 requires 'parent'; # as of 1.04
17 requires 'Path::Class' => '0.09';
18 requires 'Template'    => '2.14';
19
20 install_share 'share';
21
22 if ( $^O eq 'MSWin32' ) {
23     # Proc::Background needs this on Win32 but doesn't actually
24     # require it, if it's missing it just dies in the Makefile.PL.
25     requires 'Win32::Process' => '0.04';
26     requires 'Proc::Background';
27 }
28
29 if (!$ENV{CATALYST_DEVEL_NO_510_CHECK}) {
30     use Symbol 'gensym';
31     use IPC::Open3;
32     use File::Spec;
33     open NULL, '>', File::Spec->devnull;
34     my $err = gensym;
35     my $pid = open3(gensym, '&>NULL', $err, "$^X -It/lib -MUnknownError -e 1");
36     
37     my $unknown_error = 0;
38
39     while (<$err>) {
40         $unknown_error = 1 if /^Unknown error/;
41     }
42
43     waitpid $pid, 0;
44
45     if ($unknown_error) {
46         warn <<EOE;
47 ############################### WARNING #################################
48 #                                                                       #
49 # You are using perl 5.10.0 with the "Unknown error" bug. This can make #
50 # developing Catalyst applications much more painful, as it will come   # 
51 # up with no details every time you have a syntax error in a Controller.#
52 #                                                                       #
53 # For more information see:                                             #
54 #                                                                       #
55 #  * http://rt.perl.org/rt3/Public/Bug/Display.html?id=49472            #
56 #                                                                       #
57 # It is highly recommended that you use a different version of perl or  #
58 # compile a patched version for Catalyst development.                   #
59 #                                                                       #
60 # To skip this check, set the CATALYST_DEVEL_NO_510_CHECK environment   #
61 # variable.                                                             #
62 #                                                                       #
63 #########################################################################
64
65 EOE
66         my $ans = prompt('Do you want to continue?', 'no');
67         exit 0 unless $ans =~ /^y(es)?\z/i;
68     }
69 }
70
71 # kill warning from older versions of Class::C3
72 if ($] >= 5.009_005 && can_use('Class::C3') && !can_use('Class::C3', 0.20)) {
73     requires 'Class::C3' => '0.20';
74 }
75
76 auto_install;
77
78 WriteAll;
79
80 if ($Module::Install::AUTHOR) {
81     Meta->{values}{resources} = [
82         [ 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst' ],
83         [ 'IRC'         => 'irc://irc.perl.org/#catalyst' ],
84         [ 'license',    => 'http://dev.perl.org/licenses/' ],
85         [ 'homepage',   => 'http://dev.catalyst.perl.org/'],
86         [ 'repository', => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Devel/' ],
87     ];
88
89     Meta->{values}{requires} = [ grep {
90         $_->[0] ne 'Class::C3'
91     } @{ Meta->{values}{requires} } ];
92
93     Meta->write;
94 }