comparison 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
comparison
equal deleted inserted replaced
56:117b6956d5a5 57:bf59ee1cd506
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 4
5 use base qw(IMPL::Object IMPL::Object::Singleton); 5 use base qw(IMPL::Object IMPL::Object::Singleton);
6 use IMPL::Class::Property; 6 use IMPL::Class::Property;
7 use CGI;
7 8
8 BEGIN { 9 BEGIN {
9 public property handlerError => prop_all; 10 public property handlerError => prop_all;
11 public property factoryAction => prop_all;
10 } 12 }
11 13
12 # custom factory 14 # custom factory
13 sub new { 15 sub new {
14 my ($self,$file) = @_; 16 my ($self,$file) = @_;
18 20
19 sub Run { 21 sub Run {
20 my ($this) = @_; 22 my ($this) = @_;
21 23
22 while (my $request = $this->fetch_request()) { 24 while (my $request = $this->fetch_request()) {
23 my $action = $this->prepare_action($request); 25 my $response = new IMPL::Web::Application::Response(request => $request);
24 $action->invoke($request);
25 } 26 }
27 }
28
29 {
30 my $hasFetched = 0;
31
32 sub FetchRequest {
33 return undef if $hasFetched;
34 $hasFetched = 1;
35 return CGI->new();
36 }
26 } 37 }
27 38
28 1; 39 1;
29 40
30 __END__ 41 __END__