From: Tomas Doran Date: Mon, 12 Nov 2012 15:54:34 +0000 (+0000) Subject: Remove MX::Types X-Git-Tag: 5.90019~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=8c848c3350612cba6e19d8fc4cdf4717760f62ae Remove MX::Types --- diff --git a/Changes b/Changes index ef6876a..ac4f47f 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ # This file documents the revision history for Perl extension Catalyst. - Fix for perl 5.8. RT#61122 + - Remove use of MooseX::Types as MooseX::Types is broken on perl5.8 + RT#77100 & RT#81121 5.90018 - 2012-10-23 20:55:00 - Changed code in test suite so it no longer trips up on recent changes to diff --git a/Makefile.PL b/Makefile.PL index 68a7a1a..58f73ea 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -36,7 +36,6 @@ requires 'Data::OptList'; requires 'Moose' => '1.03'; requires 'MooseX::MethodAttributes::Inheritable' => '0.24'; requires 'MooseX::Role::WithOverloading' => '0.09'; -requires 'MooseX::Types::LoadableClass' => '0.003'; requires 'Carp'; requires 'Class::C3::Adopt::NEXT' => '0.07'; requires 'CGI::Simple::Cookie' => '1.109'; @@ -65,8 +64,6 @@ requires 'Task::Weaken'; requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness requires 'MRO::Compat'; requires 'MooseX::Getopt' => '0.30'; -requires 'MooseX::Types'; -requires 'MooseX::Types::Common::Numeric'; requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace requires 'Plack' => '0.9991'; # IIS6+7 fix middleware requires 'Plack::Middleware::ReverseProxy' => '0.04'; diff --git a/lib/Catalyst/Script/Create.pm b/lib/Catalyst/Script/Create.pm index 529b8c6..1308acd 100644 --- a/lib/Catalyst/Script/Create.pm +++ b/lib/Catalyst/Script/Create.pm @@ -1,6 +1,5 @@ package Catalyst::Script::Create; use Moose; -use MooseX::Types::Moose qw/Bool Str/; use namespace::autoclean; with 'Catalyst::ScriptRole'; @@ -8,7 +7,7 @@ with 'Catalyst::ScriptRole'; has force => ( traits => [qw(Getopt)], cmd_aliases => 'nonew', - isa => Bool, + isa => 'Bool', is => 'ro', documentation => 'Force new scripts', ); @@ -16,7 +15,7 @@ has force => ( has debug => ( traits => [qw(Getopt)], cmd_aliases => 'd', - isa => Bool, + isa => 'Bool', is => 'ro', documentation => 'Force debug mode', ); @@ -24,13 +23,13 @@ has debug => ( has mechanize => ( traits => [qw(Getopt)], cmd_aliases => 'mech', - isa => Bool, + isa => 'Bool', is => 'ro', documentation => 'use WWW::Mechanize', ); has helper_class => ( - isa => Str, + isa => 'Str', is => 'ro', builder => '_build_helper_class', ); diff --git a/lib/Catalyst/Script/FastCGI.pm b/lib/Catalyst/Script/FastCGI.pm index ba6ab9b..1eb7071 100644 --- a/lib/Catalyst/Script/FastCGI.pm +++ b/lib/Catalyst/Script/FastCGI.pm @@ -1,6 +1,5 @@ package Catalyst::Script::FastCGI; use Moose; -use MooseX::Types::Moose qw/Str Bool Int/; use Data::OptList; use namespace::autoclean; @@ -11,7 +10,7 @@ with 'Catalyst::ScriptRole'; has listen => ( traits => [qw(Getopt)], cmd_aliases => 'l', - isa => Str, + isa => 'Str', is => 'ro', documentation => 'Specify a listening port/socket', ); @@ -19,14 +18,14 @@ has listen => ( has pidfile => ( traits => [qw(Getopt)], cmd_aliases => [qw/pid p/], - isa => Str, + isa => 'Str', is => 'ro', documentation => 'Specify a pidfile', ); has daemon => ( traits => [qw(Getopt)], - isa => Bool, + isa => 'Bool', is => 'ro', cmd_aliases => [qw/d detach/], # Eww, detach is here as we fucked it up.. Deliberately not documented documentation => 'Daemonize (go into the background)', @@ -34,7 +33,7 @@ has daemon => ( has manager => ( traits => [qw(Getopt)], - isa => Str, + isa => 'Str', is => 'ro', cmd_aliases => 'M', documentation => 'Use a different FastCGI process manager class', @@ -43,7 +42,7 @@ has manager => ( has keeperr => ( traits => [qw(Getopt)], cmd_aliases => 'e', - isa => Bool, + isa => 'Bool', is => 'ro', documentation => 'Log STDERR', ); @@ -51,14 +50,14 @@ has keeperr => ( has nproc => ( traits => [qw(Getopt)], cmd_aliases => 'n', - isa => Int, + isa => 'Int', is => 'ro', documentation => 'Specify a number of child processes', ); has proc_title => ( traits => [qw(Getopt)], - isa => Str, + isa => 'Str', is => 'ro', lazy => 1, builder => '_build_proc_title', diff --git a/lib/Catalyst/Script/Server.pm b/lib/Catalyst/Script/Server.pm index 799ec43..270490e 100644 --- a/lib/Catalyst/Script/Server.pm +++ b/lib/Catalyst/Script/Server.pm @@ -1,7 +1,5 @@ package Catalyst::Script::Server; use Moose; -use MooseX::Types::Common::Numeric qw/PositiveInt/; -use MooseX::Types::Moose qw/ArrayRef Str Bool Int RegexpRef/; use Catalyst::Utils; use Try::Tiny; use namespace::autoclean; @@ -11,7 +9,7 @@ with 'Catalyst::ScriptRole'; has debug => ( traits => [qw(Getopt)], cmd_aliases => 'd', - isa => Bool, + isa => 'Bool', is => 'ro', documentation => q{Force debug mode}, ); @@ -19,7 +17,7 @@ has debug => ( has host => ( traits => [qw(Getopt)], cmd_aliases => 'h', - isa => Str, + isa => 'Str', is => 'ro', # N.B. undef (the default) means we bind on all interfaces on the host. documentation => 'Specify a hostname or IP on this host for the server to bind to', @@ -28,7 +26,7 @@ has host => ( has fork => ( traits => [qw(Getopt)], cmd_aliases => 'f', - isa => Bool, + isa => 'Bool', is => 'ro', default => 0, documentation => 'Fork the server to be able to serve multiple requests at once', @@ -37,7 +35,7 @@ has fork => ( has port => ( traits => [qw(Getopt)], cmd_aliases => 'p', - isa => PositiveInt, + isa => 'Int', is => 'ro', default => sub { Catalyst::Utils::env_value(shift->application_name, 'port') || 3000 @@ -50,7 +48,7 @@ class_type 'MooseX::Daemonize::Pid::File'; subtype 'Catalyst::Script::Server::Types::Pidfile', as 'MooseX::Daemonize::Pid::File'; -coerce 'Catalyst::Script::Server::Types::Pidfile', from Str, via { +coerce 'Catalyst::Script::Server::Types::Pidfile', from 'Str', via { try { Class::MOP::load_class("MooseX::Daemonize::Pid::File") } catch { warn("Could not load MooseX::Daemonize::Pid::File, needed for --pid option\n"); @@ -91,7 +89,7 @@ sub BUILD { has keepalive => ( traits => [qw(Getopt)], cmd_aliases => 'k', - isa => Bool, + isa => 'Bool', is => 'ro', default => 0, documentation => 'Support keepalive', @@ -100,7 +98,7 @@ has keepalive => ( has background => ( traits => [qw(Getopt)], cmd_aliases => 'bg', - isa => Bool, + isa => 'Bool', is => 'ro', default => 0, documentation => 'Run in the background', @@ -109,7 +107,7 @@ has background => ( has restart => ( traits => [qw(Getopt)], cmd_aliases => 'r', - isa => Bool, + isa => 'Bool', is => 'ro', default => sub { Catalyst::Utils::env_value(shift->application_name, 'reload') || 0; @@ -120,7 +118,7 @@ has restart => ( has restart_directory => ( traits => [qw(Getopt)], cmd_aliases => [ 'rdir', 'restartdirectory' ], - isa => ArrayRef[Str], + isa => 'ArrayRef[Str]', is => 'ro', documentation => 'Restarter directory to watch', predicate => '_has_restart_directory', @@ -129,7 +127,7 @@ has restart_directory => ( has restart_delay => ( traits => [qw(Getopt)], cmd_aliases => 'rd', - isa => Int, + isa => 'Int', is => 'ro', documentation => 'Set a restart delay', predicate => '_has_restart_delay', @@ -138,8 +136,8 @@ has restart_delay => ( { use Moose::Util::TypeConstraints; - my $tc = subtype 'Catalyst::Script::Server::Types::RegexpRef', as RegexpRef; - coerce $tc, from Str, via { qr/$_/ }; + my $tc = subtype 'Catalyst::Script::Server::Types::RegexpRef', as 'RegexpRef'; + coerce $tc, from 'Str', via { qr/$_/ }; MooseX::Getopt::OptionTypeMap->add_option_type_to_map($tc => '=s'); @@ -157,7 +155,7 @@ has restart_delay => ( has follow_symlinks => ( traits => [qw(Getopt)], cmd_aliases => 'sym', - isa => Bool, + isa => 'Bool', is => 'ro', default => 0, documentation => 'Follow symbolic links', @@ -187,7 +185,7 @@ sub _restarter_args { has restarter_class => ( is => 'ro', - isa => Str, + isa => 'Str', lazy => 1, default => sub { my $self = shift; diff --git a/lib/Catalyst/ScriptRole.pm b/lib/Catalyst/ScriptRole.pm index 1874ea7..b1ddc27 100644 --- a/lib/Catalyst/ScriptRole.pm +++ b/lib/Catalyst/ScriptRole.pm @@ -1,12 +1,18 @@ package Catalyst::ScriptRole; use Moose::Role; -use MooseX::Types::Moose qw/Str Bool/; use Pod::Usage; use MooseX::Getopt; use Catalyst::EngineLoader; -use MooseX::Types::LoadableClass qw/LoadableClass/; +use Moose::Util::TypeConstraints; +use Catalyst::Utils qw/ ensure_class_loaded /; use namespace::autoclean; +subtype 'Catalyst::ScriptRole::LoadableClass', + as 'ClassName'; +coerce 'Catalyst::ScriptRole::LoadableClass', + from 'Str', + via { ensure_class_loaded($_); 1 }; + with 'MooseX::Getopt' => { -excludes => [qw/ _getopt_spec_warnings @@ -17,13 +23,13 @@ with 'MooseX::Getopt' => { has application_name => ( traits => ['NoGetopt'], - isa => Str, + isa => 'Str', is => 'ro', required => 1, ); has loader_class => ( - isa => LoadableClass, + isa => 'Catalyst::ScriptRole::LoadableClass', is => 'ro', coerce => 1, default => 'Catalyst::EngineLoader',