Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Transform/QueryToDOM.pm @ 323:b56b1ec33b59
minor changes to support JSON in transformation from a query to an object
| author | sergey |
|---|---|
| date | Thu, 23 May 2013 18:40:26 +0400 |
| parents | c9c2ec29793f |
| children | 34a110d1f06c |
comparison
equal
deleted
inserted
replaced
| 322:cca158327c47 | 323:b56b1ec33b59 |
|---|---|
| 14 | 14 |
| 15 sub CTOR { | 15 sub CTOR { |
| 16 my ($this) = @_; | 16 my ($this) = @_; |
| 17 | 17 |
| 18 $this->templates->{'CGI'} = 'TransformCGI'; | 18 $this->templates->{'CGI'} = 'TransformCGI'; |
| 19 $this->templates->{'IMPL::Web::Application::Action'} = 'TransformAction'; | |
| 19 | 20 |
| 20 $this->delimiter('[.]'); | 21 $this->delimiter('[.]'); |
| 21 $this->prefix(''); | 22 $this->prefix(''); |
| 22 } | 23 } |
| 23 | 24 |
| 39 | 40 |
| 40 #TODO: support a.b[0][1].c[1] | 41 #TODO: support a.b[0][1].c[1] |
| 41 | 42 |
| 42 sub TransformCGI { | 43 sub TransformCGI { |
| 43 my ($this,$query) = @_; | 44 my ($this,$query) = @_; |
| 44 | 45 |
| 45 my $data={}; | 46 my $data={}; |
| 46 | 47 |
| 47 my $prefix = $this->prefix; | 48 my $prefix = $this->prefix; |
| 48 my $delim = $this->delimiter; | 49 my $delim = $this->delimiter; |
| 49 | 50 |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 | 76 |
| 76 return $this->Transform($data); | 77 return $this->Transform($data); |
| 78 } | |
| 79 | |
| 80 sub TransformAction { | |
| 81 my ($this,$action) = @_; | |
| 82 | |
| 83 return $this->Transform($action->isJson ? $action->jsonData : $action->query); | |
| 77 } | 84 } |
| 78 | 85 |
| 79 1; | 86 1; |
| 80 | 87 |
| 81 __END__ | 88 __END__ |
