Mercurial > pub > Impl
annotate Lib/IMPL/Web/Application.pm @ 234:2530d1bb9638
sync
| author | sergey | 
|---|---|
| date | Thu, 11 Oct 2012 20:11:45 +0400 | 
| parents | 3cebcf6fdb9b | 
| children | fe9d62d9054d | 
| rev | line source | 
|---|---|
| 49 | 1 package IMPL::Web::Application; | 
| 2 use strict; | |
| 3 use warnings; | |
| 4 | |
| 198 | 5 use CGI; | 
| 6 use Carp qw(carp); | |
| 233 | 7 use IMPL::Const qw(:prop); | 
| 58 | 8 | 
| 198 | 9 use IMPL::declare { | 
| 10 require => { | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 11 TAction => 'IMPL::Web::Application::Action', | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 12 HttpResponse => 'IMPL::Web::HttpResponse', | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 13 TFactory => '-IMPL::Object::Factory', | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 14 Exception => 'IMPL::Exception', | 
| 230 | 15 InvalidOperationException => '-IMPL::InvalidOperationException', | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 16 Loader => 'IMPL::Code::Loader' | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 17 }, | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 18 base => [ | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 19 'IMPL::Config' => '@_', | 
| 198 | 20 'IMPL::Object::Singleton' => '@_' | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 21 ], | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 22 props => [ | 
| 233 | 23 actionFactory => PROP_RW, | 
| 24 handlers => PROP_RW | PROP_LIST, | |
| 25 security => PROP_RW, | |
| 26 options => PROP_RW, | |
| 27 fetchRequestMethod => PROP_RW, | |
| 28 output => PROP_RW | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 29 ] | 
| 198 | 30 }; | 
| 49 | 31 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 32 sub CTOR { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 33 my ($this) = @_; | 
| 198 | 34 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 35 die IMPL::InvalidArgumentException->new( "handlers", | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 36 "At least one handler should be supplied" ) | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 37 unless $this->handlers->Count; | 
| 49 | 38 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 39 $this->actionFactory(TAction) unless $this->actionFactory; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 40 $this->fetchRequestMethod( \&defaultFetchRequest ) | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 41 unless $this->fetchRequestMethod; | 
| 62 | 42 } | 
| 43 | |
| 49 | 44 sub Run { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 45 my ($this) = @_; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 46 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 47 my $handler; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 48 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 49 $handler = _ChainHandler( $_, $handler ) foreach $this->handlers; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 50 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 51 while ( my $query = $this->FetchRequest() ) { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 52 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 53 my $action = $this->actionFactory->new( | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 54 query => $query, | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 55 application => $this, | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 56 ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 57 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 58 eval { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 59 my $result = $handler->($action); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 60 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 61 die InvalidOperationException->new( | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 62 "Invalid handlers result. A reference to IMPL::Web::HttpResponse is expexted." | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 63 ) unless eval { $result->isa(HttpResponse) }; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 64 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 65 $result->PrintResponse( $this->output ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 66 }; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 67 if ($@) { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 68 my $e = $@; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 69 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 70 HttpResponse->InternalError( | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 71 type => 'text/plain', | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 72 charset => 'utf-8', | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 73 body => $e | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 74 )->PrintResponse( $this->output ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 75 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 76 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 77 } | 
| 49 | 78 } | 
| 79 | |
| 198 | 80 sub _ChainHandler { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 81 my ( $handler, $next ) = @_; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 82 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 83 if ( ref $handler eq 'CODE' ) { | 
| 198 | 84 return sub { | 
| 85 my ($action) = @_; | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 86 return $handler->( $action, $next ); | 
| 198 | 87 }; | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 88 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 89 elsif ( eval { $handler->can('Invoke') } ) { | 
| 198 | 90 return sub { | 
| 91 my ($action) = @_; | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 92 return $handler->Invoke( $action, $next ); | 
| 198 | 93 }; | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 94 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 95 elsif ( eval { $handler->isa(TFactory) } ) { | 
| 198 | 96 return sub { | 
| 97 my ($action) = @_; | |
| 98 my $inst = $handler->new(); | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 99 return $inst->Invoke( $action, $next ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 100 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 101 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 102 elsif ( $handler | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 103 and not ref $handler | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 104 and $handler =~ m/^(-)?(\w+(?:::\w+)*)$/ ) | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 105 { | 
| 198 | 106 my $class = $2; | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 107 if ( not $1 ) { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 108 Loader->safe->Require($class); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 109 die IMPL::InvalidArgumentException->( | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 110 "An invalid handler supplied", $handler | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 111 ) unless $class->can('Invoke'); | 
| 198 | 112 } | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 113 | 
| 198 | 114 return sub { | 
| 115 my ($action) = @_; | |
| 116 my $inst = $class->new(); | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 117 return $inst->Invoke( $action, $next ); | 
| 198 | 118 }; | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 119 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 120 else { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 121 die new IMPL::InvalidArgumentException( "An invalid handler supplied", | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 122 $handler ); | 
| 198 | 123 } | 
| 124 } | |
| 125 | |
| 97 | 126 sub FetchRequest { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 127 my ($this) = @_; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 128 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 129 if ( ref $this->fetchRequestMethod eq 'CODE' ) { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 130 return $this->fetchRequestMethod->($this); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 131 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 132 else { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 133 die new IMPL::Exception( | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 134 "Unknown fetchRequestMethod type", | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 135 ref $this->fetchRequestMethod | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 136 ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 137 } | 
| 97 | 138 } | 
| 139 | |
| 57 | 140 { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 141 my $hasFetched = 0; | 
| 57 | 142 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 143 sub defaultFetchRequest { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 144 my ($this) = @_; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 145 return undef if $hasFetched; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 146 $hasFetched = 1; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 147 $this->output(*STDOUT); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 148 my $query = CGIWrapper->new(); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 149 return $query; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 150 } | 
| 57 | 151 } | 
| 152 | |
| 213 | 153 sub defaultErrorHandler { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 154 my ( $this, $action, $e ) = @_; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 155 warn $e; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 156 if ( eval { $action->ReinitResponse(); 1; } ) { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 157 $action->response->contentType('text/plain'); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 158 $action->response->charset( $this->responseCharset ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 159 $action->response->status(500); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 160 my $hout = $action->response->streamBody; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 161 print $hout $e; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 162 $action->response->Complete(); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 163 } | 
| 97 | 164 } | 
| 165 | |
| 130 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 166 package CGIWrapper; | 
| 166 | 167 use parent qw(CGI); | 
| 130 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 168 | 
| 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 169 use Encode; | 
| 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 170 | 
| 138 | 171 our $NO_DECODE = 0; | 
| 172 | |
| 130 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 173 sub param { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 174 my $this = shift; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 175 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 176 return $this->SUPER::param(@_) if $NO_DECODE; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 177 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 178 if (wantarray) { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 179 my @result = $this->SUPER::param(@_); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 180 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 181 return map Encode::is_utf8($_) | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 182 ? $_ | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 183 : Encode::decode( $this->charset, $_, Encode::LEAVE_SRC ), @result; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 184 } | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 185 else { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 186 my $result = $this->SUPER::param(@_); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 187 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 188 return Encode::is_utf8($result) | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 189 ? $result | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 190 : Encode::decode( $this->charset, $result, Encode::LEAVE_SRC ); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 191 } | 
| 130 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 192 | 
| 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 193 } | 
| 
06a34c197b05
Added support for utf-8 and old versions of CGI module
 wizard parents: 
129diff
changeset | 194 | 
| 138 | 195 sub upload { | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 196 my $this = shift; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 197 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 198 local $NO_DECODE = 1; | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 199 my $oldCharset = $this->charset(); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 200 $this->charset('ISO-8859-1'); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 201 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 202 my $fh = $this->SUPER::upload(@_); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 203 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 204 $this->charset($oldCharset); | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 205 return $fh; | 
| 138 | 206 } | 
| 207 | |
| 49 | 208 1; | 
| 209 | |
| 52 | 210 __END__ | 
| 211 | |
| 49 | 212 =pod | 
| 213 | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 214 =head1 NAME | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 215 | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 216 C<IMPL::Web::Application> Класс для создания экземпляров приложения | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 217 | 
| 49 | 218 =head1 SYNOPSIS | 
| 219 | |
| 67 | 220 =begin code | 
| 221 | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 222 use IMPL::require { | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 223 App => 'IMPL::Web::Application' | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 224 }; | 
| 67 | 225 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 226 my $instance = App->spawn(); # will use ./IMPL/Web/Application.xml as configuration | 
| 67 | 227 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 228 $instance->Run; | 
| 67 | 229 | 
| 230 =end code | |
| 49 | 231 | 
| 232 =head1 DESCRIPTION | |
| 233 | |
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 234 Создает экземпляр объекта, который получает и обрабатывает C<HTTP> запрос. | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 235 Приложение можно загрузить из C<xml> файла в котором описано состояние свойств, | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 236 для этого используется механизм C<IMPL::Serialization>. | 
| 67 | 237 | 
| 229 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 238 Приложение представлет собой модульную конструкцию, которая состоит из цепочки | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 239 обработчиков. Цепочка обработчиков вызывается снизу вверх, при этом каждый | 
| 
47f77e6409f7
heavily reworked the resource model of the web application:
 sergey parents: 
213diff
changeset | 240 обработчик самостоятельно рекурсивно вызывает следующий (более высокого уровня). | 
| 49 | 241 | 
| 242 =cut | 
