changeset 235:a4d9126edcbb

code cleaning
author sergey
date Fri, 12 Oct 2012 02:08:51 +0400
parents 2530d1bb9638
children 2904da230022
files Lib/IMPL/DOM/Navigator.pm Lib/IMPL/DOM/Transform/PostToDOM.pm Lib/IMPL/Web/Handler/TTView.pm
diffstat 3 files changed, 34 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Navigator.pm	Thu Oct 11 20:11:45 2012 +0400
+++ b/Lib/IMPL/DOM/Navigator.pm	Fri Oct 12 02:08:51 2012 +0400
@@ -47,7 +47,7 @@
             my @alternatives = $current->selectNodes($query);
             
             unless (@alternatives) {
-                $current = $this->advanceNavigator or return undef;
+                $current = $this->advanceNavigator or return;
                 @alternatives = $current->selectNodes($query);
             }
             
@@ -60,7 +60,7 @@
             
             $node = $alternatives[0];
         } else {
-            return undef;
+            return;
         }
     }
     
@@ -103,13 +103,13 @@
         if ( exists $this->{$_state}{query} ) {
             my $query = $this->{$_state}{query};
   
-            $this->Back or return undef; # that meams the end of the history
+            $this->Back or return; # that meams the end of the history
 
             undef while ( $this->advanceNavigator and not $this->Navigate($query));
 
             return $this->Current;
         }
-        return undef;
+        return;
     }
     
     return $this->Current;
@@ -142,7 +142,7 @@
         }
         $this->Current if defined wantarray;
     } else {
-        return undef;
+        return;
     }
 }
 
@@ -165,7 +165,7 @@
     if (my $state = $this->{$_path} ? $this->{$_path}->[$index] : undef ) {
         return $state->{alternatives}[$state->{current}]
     } else {
-        return undef;
+        return;
     }
 }
 
@@ -220,7 +220,7 @@
     
     if ($@) {
         $this->restoreState();
-        return undef;
+        return;
     } else {
         $this->applyState();
         return $result;
--- a/Lib/IMPL/DOM/Transform/PostToDOM.pm	Thu Oct 11 20:11:45 2012 +0400
+++ b/Lib/IMPL/DOM/Transform/PostToDOM.pm	Fri Oct 12 02:08:51 2012 +0400
@@ -2,28 +2,28 @@
 use strict;
 use warnings;
 
-use IMPL::DOM::Navigator::Builder;
-use IMPL::Class::Property;
-
-use parent qw(IMPL::Transform);
-
-BEGIN {
-    public property documentClass => prop_get | owner_set;
-    public property documentSchema => prop_get | owner_set;
-    public property prefix => prop_get | owner_set;
-    private property _navi => prop_all;
-    public property Errors => prop_all | prop_list;
-    private property _schema => prop_all;
-}
-
-our %CTOR = (
-    'IMPL::Transform' => sub {
-        -plain => \&TransformPlain,
-        HASH => \&TransformContainer,
-        CGI => \&TransformCGI,
-        CGIWrapper => \&TransformCGI
-    }
-);
+use IMPL::Const qw(:prop);
+use IMPL::declare {
+    require => {
+        Builder => 'IMPL::DOM::Navigator::Builder' 
+    },
+    base => [
+        'IMPL::Transform' => sub {
+            -plain => \&TransformPlain,
+            HASH => \&TransformContainer,
+            CGI => \&TransformCGI,
+            CGIWrapper => \&TransformCGI
+        } 
+    ],
+    props => [
+        documentClass => PROP_RO,
+        documentSchema => PROP_RO,
+        prefix => PROP_RO,
+        _navi => PROP_RW,
+        errors => PROP_RW | PROP_LIST,
+        _schema => PROP_RW
+    ]
+};
 
 sub CTOR {
     my ($this,$docClass,$docSchema,$prefix) = @_;
@@ -73,6 +73,7 @@
     my $data={};
     
     my $prefix = $this->prefix;
+    my $delim = $this->delimiter;
     
     foreach my $param (grep index($_,$prefix) >= 0 , $query->param()) {
         length (my $value = $query->param($param)) or next;
@@ -95,8 +96,8 @@
     
     my $doc = $this->Transform($data);
     $doc->nodeProperty( query => $query );
-    $this->Errors->Append( $this->_navi->BuildErrors);
-    $this->Errors->Append( $this->_schema->Validate($doc));
+    $this->errors->Append( $this->_navi->BuildErrors);
+    $this->errors->Append( $this->_schema->Validate($doc));
     return $doc;
 }
 
--- a/Lib/IMPL/Web/Handler/TTView.pm	Thu Oct 11 20:11:45 2012 +0400
+++ b/Lib/IMPL/Web/Handler/TTView.pm	Fri Oct 12 02:08:51 2012 +0400
@@ -38,10 +38,10 @@
     my $result = $next ? $next->($action) : undef;
 
     my $vars = {
-        data        => $result,
+        model       => $result,
         action      => $action,
         app         => $action->application,
-        LoadFactory => sub {
+        ImportClass => sub {
             my $class = shift;
 
             my $module = $class;