annotate Lib/IMPL/Web/Handler/TTView.pm @ 200:a9dbe534d236

sync
author sergey
date Tue, 24 Apr 2012 02:34:49 +0400
parents e743a8481327
children 68a59c3358ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
1 package IMPL::Web::Handler::TTView;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
2 use strict;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
3
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
4 use IMPL::lang qw(:declare :constants);
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
5 use IMPL::declare {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
6 base => {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
7 'IMPL::Object' => undef,
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
8 'IMPL::Object::Autofill' => '@_',
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
9 'IMPL::Object::Serializable' => undef
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
10 }
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
11 };
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
12
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
13 BEGIN {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
14 public property contentType => PROP_GET | PROP_OWNERSET;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
15 public property templates => PROP_GET | PROP_OWNERSET;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
16 }
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
17
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
18 sub Invoke {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
19 my ($this,$action,$next) = @_;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
20
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
21 my $result = $next ? $next->($action) : undef;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
22
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
23 my $doc = $this->templates->document(
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
24 'default',
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
25 {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
26 data => $result,
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
27 action => $action,
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
28 app => $action->application
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
29 }
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
30 );
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
31
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
32 my $hout = $action->response->streamBody;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
33
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
34 print $hout $doc->Render();
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
35 }
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
36
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
37 1;
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
38
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
39 __END__
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
40
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
41 =pod
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
42
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
43 =head1 NAME
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
44
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
45 C<IMPL::Web::Handler::TTView> - использует шаблоны для построения представления.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
46
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
47 =head1 SYNOPSIS
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
48
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
49 =begin code xml
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
50
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
51 <view type="HASH">
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
52 <item extname="@My::Data::Product">product/info</item>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
53 <catalog>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
54 <catalog>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
55 </view>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
56
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
57 =end code xml
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
58
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
59 =head1 DESCRIPTION
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
60
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
61 Подбирает шаблон для представления результата, полученного при выполнении следующего обработчика. При
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
62 выборе используется принцип похожий на селекторы C<CSS>, основывающийся на именах ресурсов и их типах
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
63 данных.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
64
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
65 =head1 SELECTORS
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
66
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
67 =begin text
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
68
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
69 [url-template] [class] => template
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
70
200
sergey
parents: 199
diff changeset
71 shoes * => product/list
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
72 {action:*.} @My::Data::Product => product/{action}
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
73
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
74 =end text
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
75
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
76
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
77 =cut
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents:
diff changeset
78