[Bps-public-commit] r13885 - in Lorzy/trunk: lorzyplate/Lorzy-Plate/lib/Lorzy/Plate/Action

sartak at bestpractical.com sartak at bestpractical.com
Tue Jul 8 16:28:20 EDT 2008


Author: sartak
Date: Tue Jul  8 16:28:19 2008
New Revision: 13885

Modified:
   Lorzy/trunk/   (props changed)
   Lorzy/trunk/lorzyplate/Lorzy-Plate/lib/Lorzy/Plate/Action/RunL.pm

Log:
 r63875 at onn:  sartak | 2008-07-08 16:28:07 -0400
 Perltidy the RunL action.. yikes :)


Modified: Lorzy/trunk/lorzyplate/Lorzy-Plate/lib/Lorzy/Plate/Action/RunL.pm
==============================================================================
--- Lorzy/trunk/lorzyplate/Lorzy-Plate/lib/Lorzy/Plate/Action/RunL.pm	(original)
+++ Lorzy/trunk/lorzyplate/Lorzy-Plate/lib/Lorzy/Plate/Action/RunL.pm	Tue Jul  8 16:28:19 2008
@@ -5,50 +5,51 @@
 use Lorzy::FunctionArgument;
 use Lorzy::Evaluator;
 use JSON;
+
 use Jifty::Param::Schema;
 use Lorzy::Plate::Action schema {
     param struct => type is 'text';
 };
 
-
 sub take_action {
-    my $self = shift;
-    warn $self->argument_value('struct');
-    my $tree = JSON::from_json($self->argument_value('struct'));
-    my $builder = Lorzy::Builder->new();
-    my $eval = Lorzy::Evaluator->new();
-
-
-my $MATCH_REGEX = Lorzy::Lambda::Native->new(
-    body => sub {
-        my $args = shift;
-        my $arg = $args->{'tested-string'};
-        my $regex = $args->{'regexp'};
-
-        return $arg =~ m/$regex/;
-    },
-
-    signature => {
-           'tested-string' =>  Lorzy::FunctionArgument->new( name =>              'tested-string' =>  type => 'Str' ),
-           'regexp'=>  Lorzy::FunctionArgument->new( name =>      'regex', type => 'Str' )
-    }
-
-);
-$eval->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
-
+    my $self    = shift;
+    my $tree    = JSON::from_json($self->argument_value('struct'));
+    my $builder = Lorzy::Builder->new;
+    my $eval    = Lorzy::Evaluator->new;
+
+    my $MATCH_REGEX = Lorzy::Lambda::Native->new(
+        body => sub {
+            my $args = shift;
+            my $arg   = $args->{'tested-string'};
+            my $regex = $args->{'regexp'};
+            return $arg =~ m/$regex/;
+        },
+        signature => {
+           'tested-string' => Lorzy::FunctionArgument->new(
+               name => 'tested-string',
+               type => 'Str'
+           ),
+           'regexp' => Lorzy::FunctionArgument->new(
+               name => 'regex',
+               type => 'Str',
+           ),
+        }
+    );
+
+    $eval->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
+
+    eval {
+        my $script = $builder->defun(ops => $tree, signature => {});
+        $eval->apply_script($script, {});
+    };
 
-    eval { 
-            my $script  = $builder->defun( ops => $tree, signature => {});
-
-            $eval->apply_script($script, {} )};
-    if (my $msg = $@) { 
+    if (my $msg = $@) {
         $self->result->error($msg);
-    }else {
-    warn $eval->result->value, $eval->result->success ;
-
-    $self->result->message($eval->result->value);
-   $eval->result->success ||  $eval->result->error($eval->result->error);
-}
+    } else {
+        warn $eval->result->value, $eval->result->success;
+        $self->result->message($eval->result->value);
+        $eval->result->success || $eval->result->error($eval->result->error);
+    }
 }
 
 1;



More information about the Bps-public-commit mailing list