/[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 627 by dpavlin, Sat Nov 29 22:02:08 2008 UTC revision 653 by dpavlin, Sun Nov 30 23:49:32 2008 UTC
# Line 36  documented only in source code. Line 36  documented only in source code.
36    
37  sub print {  sub print {
38          my $self = shift;          my $self = shift;
39          warn "# print ",dump( @_ );          warn "# print ", join(' ', map { length $_ } @_ );
40          $self->{print}->( @_ );          $self->{_print}->( @_ );
41  }  }
42    
43  sub request {  sub request {
# Line 45  sub request { Line 45  sub request {
45    
46          if ( my $ref = ref($url) ) {          if ( my $ref = ref($url) ) {
47                  die "url not URI but ", dump( $url ) unless $ref =~ m{^URI};                  die "url not URI but ", dump( $url ) unless $ref =~ m{^URI};
48            } else {
49                  $url = URI->new($url);                  $url = URI->new($url);
50          }          }
51    
52          my $path = $url->path;          my $path = $url->path;
53    
54  #       eval {          eval {
55          {  #       {
56    
57                  if ( $path =~ m{/reload(.*)} ) {                  if ( $path =~ m{/reload(.*)} ) {
58    
# Line 61  sub request { Line 62  sub request {
62                          if ( system($cmd) == 0 ) {                          if ( system($cmd) == 0 ) {
63                                  my $server = Frey::Server->new;                                  my $server = Frey::Server->new;
64                                  $self->load_config;                                  $self->load_config;
65                                  Module::Reload->check;  #                               Module::Reload->check;
66                                  warn "# reload done";                                  warn "# reload done";
67                                  $self->print( refresh( $1, 1 ) );                                  $self->print( refresh( $1, 0 ) );
68                                  return;                                  return;
69                          } else {                          } else {
70                                  warn "ERROR: $?";                                  warn "ERROR: $?";
# Line 85  sub request { Line 86  sub request {
86                          return $class;                          return $class;
87                  }                  }
88    
   
89                  my $f;                  my $f;
90    
91                  # shared run params                  # shared run params
# Line 113  sub request { Line 113  sub request {
113                          my $class = rest2class $1;                          my $class = rest2class $1;
114                          warn "# run $path -> $class $2";                          warn "# run $path -> $class $2";
115                          $run->{format} = $3 if $3;                          $run->{format} = $3 if $3;
                         $params->{request_url} = $url,  
116                          $run->{$_} = $params->{$_} foreach keys %$params;                          $run->{$_} = $params->{$_} foreach keys %$params;
117                          $f = Frey::Run->new( class => $class, params => $run, run => $2, request_url => $url );                          $f = Frey::Run->new( class => $class, params => $run, run => $2 );
118                  } elsif (                  } elsif (
119                          $path =~ m{/([^/]+)/?$}                          $path =~ m{/([^/]+)/?$}
120                  ) {                  ) {
121                          my $class = rest2class $1;                          my $class = rest2class $1;
122                          warn "# introspect $class";                          warn "# introspect $class";
123                          $run->{class} ||= $class;                          $run->{class} ||= $class;
124                          $f = Frey::Run->new( class => 'Frey::Introspect', params => $run, request_url => $url );                          $f = Frey::Run->new( class => 'Frey::Introspect', params => $run );
125                  } else {                  } else {
126                          $f = Frey::Run->new( class => 'Frey::ClassBrowser', params => $run, request_url => $url );                          $f = Frey::Run->new( class => 'Frey::ClassBrowser', params => $run );
127                  }                  }
128    
129                  if ( $f ) {                  if ( $f ) {
# Line 155  sub request { Line 154  sub request {
154  sub refresh {  sub refresh {
155          my ( $url, $time ) = @_;          my ( $url, $time ) = @_;
156          $url  ||= '/';          $url  ||= '/';
157          $time ||= 1;          $time ||= 0;
158          warn "# refresh $url";          warn "# refresh $url";
159          qq|          qq|
160                  <html>                  <html>

Legend:
Removed from v.627  
changed lines
  Added in v.653

  ViewVC Help
Powered by ViewVC 1.1.26