Add 'lazy' to two parameters to let the constructor runs first and set the applicatio...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / Server.pm
index 1848e4a..983a995 100644 (file)
@@ -37,6 +37,7 @@ has port => (
     cmd_aliases   => 'p',
     isa           => 'Int',
     is            => 'ro',
+    lazy          => 1,
     default       => sub {
         Catalyst::Utils::env_value(shift->application_name, 'port') || 3000
     },
@@ -77,7 +78,7 @@ sub BUILD {
         my ($success, $error) = try_load_class("MooseX::Daemonize::Core");
         warn("MooseX::Daemonize is needed for the --background option: $error\n"),
             exit 1 if not $success;
-        my ($success, $error) = try_load_class("POSIX");
+        ($success, $error) = try_load_class("POSIX");
         warn("$error\n"), exit 1 if not $success;
         MooseX::Daemonize::Core->meta->apply($self);
         POSIX::close($_) foreach (0..2);
@@ -107,6 +108,7 @@ has restart => (
     cmd_aliases   => 'r',
     isa           => 'Bool',
     is            => 'ro',
+    lazy          => 1,
     default       => sub {
         Catalyst::Utils::env_value(shift->application_name, 'reload') || 0;
     },