[Bps-public-commit] r14951 - in Prophet/trunk: . lib/Prophet/CLI

sartak at bestpractical.com sartak at bestpractical.com
Sat Aug 9 14:58:13 EDT 2008


Author: sartak
Date: Sat Aug  9 14:58:13 2008
New Revision: 14951

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI.pm
   Prophet/trunk/lib/Prophet/CLI/Command.pm

Log:
 r69018 at onn:  sartak | 2008-08-09 14:58:01 -0400
 add_to_prop_set now automatically calls set_prop which simplifies some code


Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI.pm	Sat Aug  9 14:58:13 2008
@@ -227,10 +227,6 @@
         if @primary && $primary[-1] =~ /^(?:\d+|[0-9a-f]{8}\-)/i;
 
     my $sep = 0;
-    my @sep_method = (
-        'set_arg',
-        'set_prop',
-    );
 
     $self->primary_commands( \@primary );
     my $cmp_re = $self->cmp_regex;
@@ -278,8 +274,9 @@
                 value => $val,
             });
         }
-        my $setter = $sep_method[$sep] or next;
-        $self->$setter($name => $val);
+        else {
+            $self->set_arg($name => $val);
+        }
     }
 }
 
@@ -430,6 +427,13 @@
     return $ret;
 }
 
+after add_to_prop_set => sub {
+    my $self = shift;
+    my $args = shift;
+
+    $self->set_prop($args->{prop} => $args->{value});
+};
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 

Modified: Prophet/trunk/lib/Prophet/CLI/Command.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command.pm	Sat Aug  9 14:58:13 2008
@@ -9,7 +9,8 @@
         qw/args  set_arg  arg  has_arg  delete_arg  arg_names/,
         qw/props set_prop prop has_prop delete_prop prop_names/,
         qw/app_handle handle resdb_handle config/,
-        'prop_set', 'run_one_command', 'run_another_command',
+        'add_to_prop_set', 'prop_set',
+        'run_one_command', 'run_another_command',
     ],
 );
 



More information about the Bps-public-commit mailing list