/[Frey]/trunk/lib/Frey/Server.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/Server.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 190 by dpavlin, Sun Sep 14 00:45:47 2008 UTC revision 220 by dpavlin, Fri Oct 31 23:07:46 2008 UTC
# Line 39  sub run { Line 39  sub run {
39                  path_session => 1,                  path_session => 1,
40                  cookie_session => 'sid',                  cookie_session => 'sid',
41                  callback => \&main,                  callback => \&main,
42                  debug_level => 1,                  debug_level => 2,
43                  staticp => sub { $_[0]->url =~ m/\.(jpg|jpeg|gif|png|css|ico|js|html?|xml|json|ya?ml)(\?.*)?$/ },                  staticp => sub { $_[0]->url =~ m/\.(jpg|jpeg|gif|png|css|ico|js|html?|xml|json|ya?ml)(\?.*)?$/ },
44          );          );
45          $Module::Reload::Debug = 1;          $Module::Reload::Debug = 1; # auto if debug_level > 1
46          Frey::ClassLoader->new->load_all_classes();          Frey::ClassLoader->new->load_all_classes();
47          $server->loop;          $server->loop;
48  }  }
# Line 58  sub main { Line 58  sub main {
58          my ($req) = @_;          my ($req) = @_;
59    
60          my $path = $req->request->url->path;          my $path = $req->request->url->path;
61          warn "REQUEST: $path ",dump( $req->params ),"\n";          #warn "REQUEST: $path ",dump( $req->params );
62    
63          Module::Reload->check if $path =~ m!reload! || $req->param('reload');          Module::Reload->check if $path =~ m!reload! || $req->param('reload');
64    
# Line 75  sub main { Line 75  sub main {
75                          $f = Frey::ObjectBrowser->new( fey_class => $1 );                          $f = Frey::ObjectBrowser->new( fey_class => $1 );
76                  } elsif ( $path =~ m!/od/([^/]+)(.*)! ) {                  } elsif ( $path =~ m!/od/([^/]+)(.*)! ) {
77                          $f = Frey::ObjectDesigner->new( fey_class => $1 );                          $f = Frey::ObjectDesigner->new( fey_class => $1 );
78                  } elsif ( $path =~ m!/(markup|html)/([^/]+)(.*)! ) {                  } elsif ( $path =~ m!/(markup|request)/([^/]+)(.*)! ) {
79                          $f = Frey::Run->new( class => $2 );                          $f = Frey::Run->new( class => $2 );
80                  } else {                  } else {
81                          $f = Frey::ClassBrowser->new;                          $f = Frey::Run->new( class => 'Frey::ClassBrowser' );
82                  }                  }
83                  $f->html( $req ) if $f;                  $f->request( $req ) if $f;
84    
85          };          };
86    
# Line 88  sub main { Line 88  sub main {
88    
89          if ( $@ ) {          if ( $@ ) {
90                  warn $@;                  warn $@;
91                  #$req->conn->send_error( 404 ); # FIXME this should probably be 500, but we can't ship page with it                  $req->conn->send_error( 404 );  # FIXME this should probably be 500, but we can't ship page with it
92                  $req->print( qq{<pre class="error">$@<pre>} );                  $req->print( qq{<pre class="error">$@<pre>} );
93  #               Carp::REPL::repl;  #               Carp::REPL::repl;
94    

Legend:
Removed from v.190  
changed lines
  Added in v.220

  ViewVC Help
Powered by ViewVC 1.1.26