[Moose-commits] r7619 - MooseX-Role-Cmd/lib/MooseX/Role

isillitoe at code2.0beta.co.uk isillitoe at code2.0beta.co.uk
Thu Feb 12 12:50:53 GMT 2009


Author: isillitoe
Date: 2009-02-12 04:50:53 -0800 (Thu, 12 Feb 2009)
New Revision: 7619

Modified:
   MooseX-Role-Cmd/lib/MooseX/Role/Cmd.pm
Log:
Corrected the decision to set environment variables with cmdopt_env - only does so if the attribute is defined 


Modified: MooseX-Role-Cmd/lib/MooseX/Role/Cmd.pm
===================================================================
--- MooseX-Role-Cmd/lib/MooseX/Role/Cmd.pm	2009-02-12 06:02:10 UTC (rev 7618)
+++ MooseX-Role-Cmd/lib/MooseX/Role/Cmd.pm	2009-02-12 12:50:53 UTC (rev 7619)
@@ -229,11 +229,14 @@
     # override defaults with Traits
     if ( $attr->does('MooseX::Role::Cmd::Meta::Attribute::Trait') ) {
         
-        # environment vars not used as params
+        # deal with $ENV
         if ($attr->has_cmdopt_env) {
             my $env_key   = $attr->cmdopt_env;
             my $env_value = $self->$attr_name;
-            $ENV{$env_key} = $env_value;
+            if ( defined $env_value ) {
+                $ENV{$env_key} = $env_value;
+            }
+            # environment vars not used as params
             return;
         }
         




More information about the Moose-commits mailing list