[Catalyst-commits] r12276 - in Catalyst-Runtime/5.80/trunk: lib/Catalyst/Script t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Dec 9 20:21:15 GMT 2009


Author: t0m
Date: 2009-12-09 20:21:13 +0000 (Wed, 09 Dec 2009)
New Revision: 12276

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm
   Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t
Log:
Fixes port environment, RT#52604

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm	2009-12-09 19:57:55 UTC (rev 12275)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm	2009-12-09 20:21:13 UTC (rev 12276)
@@ -8,6 +8,7 @@
 use Moose;
 use MooseX::Types::Common::Numeric qw/PositiveInt/;
 use MooseX::Types::Moose qw/ArrayRef Str Bool Int RegexpRef/;
+use Catalyst::Utils;
 use namespace::autoclean;
 
 with 'Catalyst::ScriptRole';
@@ -45,7 +46,10 @@
     cmd_aliases   => 'p',
     isa           => PositiveInt,
     is            => 'ro',
-    default       => 3000,
+    default       => sub {
+        my $self = shift;
+        $ENV{ Catalyst::Utils::class2env($self->application_name . '_PORT')}||3000
+    },
     documentation => 'Specify a different listening port (to the default port 3000)',
 );
 

Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t	2009-12-09 19:57:55 UTC (rev 12275)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t	2009-12-09 20:21:13 UTC (rev 12276)
@@ -26,6 +26,10 @@
 # port           -p -port --port           -l --listen
 testOption( [ qw/-p 3001/ ], ['3001', undef, opthash()] );
 testOption( [ qw/--port 3001/ ], ['3001', undef, opthash()] );
+{
+    local $ENV{TESTAPPTOTESTSCRIPTS_PORT} = 5000;
+    testOption( [ qw// ], [5000, undef, opthash()] );
+}
 
 # fork           -f -fork --fork           -f --fork
 testOption( [ qw/--fork/ ], ['3000', undef, opthash(fork => 1)] );




More information about the Catalyst-commits mailing list