annotate Lib/IMPL/Web/Application.pm @ 57:bf59ee1cd506

Web application main class functionality
author wizard
date Fri, 05 Mar 2010 13:59:29 +0300
parents 15d720913562
children a35b60b16a99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
1 package IMPL::Web::Application;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
5 use base qw(IMPL::Object IMPL::Object::Singleton);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
6 use IMPL::Class::Property;
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
7 use CGI;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
9 BEGIN {
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
10 public property handlerError => prop_all;
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
11 public property factoryAction => prop_all;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
12 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
13
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
14 # custom factory
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
15 sub new {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
16 my ($self,$file) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
17
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
18 return $self->LoadXMLFile($file);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
19 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
20
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
21 sub Run {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
22 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
23
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
24 while (my $request = $this->fetch_request()) {
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
25 my $response = new IMPL::Web::Application::Response(request => $request);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
26 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
27 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
28
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
29 {
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
30 my $hasFetched = 0;
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
31
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
32 sub FetchRequest {
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
33 return undef if $hasFetched;
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
34 $hasFetched = 1;
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
35 return CGI->new();
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
36 }
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
37 }
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
38
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
39 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
40
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
41 __END__
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
42
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
43 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
44
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
45 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
46
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
47 require MyApp;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
48 MyApp->instance('app.config')->Run();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
50 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
51
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
52 Зкземпляр приложения содержит в себе глобальные настройки, реализует контроллер запросов,
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
53 в качестве источника запросов используется CGI или иной совместимый модуль.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
54
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
55 Процесс обработки запроса состоит из следующих частей
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
56
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
57 1. Получение cgi запроса
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
58 2. Вызов модуля для инициализации объекта действия
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
59 3. Инициализация контекста выполнения
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
60 4. Выполнение запроса
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
61 5. Преобразование полученных данных в тело ответа
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
62
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
63
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
64
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
65
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
66 =cut