[BACK]Return to test_server.pl CVS log [TXT][DIR] Up to [local] / HOPE / Net-OpenAMD / script

Diff for /HOPE/Net-OpenAMD/script/test_server.pl between version 1.2 and 1.4

version 1.2, 2010/06/25 21:20:15 version 1.4, 2010/06/26 17:16:08
Line 11 
Line 11 
     action => sub {      action => sub {
         my ( $self, $action ) = @_;          my ( $self, $action ) = @_;
   
         state $Actions = {          state %Actions;
             location  => { mtime => 0 },  
             speakers  => { mtime => 0 },  
             talks     => { mtime => 0 },  
             interests => { mtime => 0 },  
             users     => { mtime => 0 },  
         };  
         return if !exists $Actions->{$action};  
   
         my $path  = app->home->rel_file( 'data/' . $action );          my $path  = app->home->rel_file( 'data/' . $action );
         my $mtime = ( stat $path )[9];  
   
         if ( $mtime != $Actions->{$action}{mtime} ) {          return if ! -e $path;
           my $mtime = ( stat _ )[9];
   
           $Actions{$action}{mtime} //= 0;
   
           if ( $mtime != $Actions{$action}{mtime} ) {
             open my $fh, $path or die "Couldn't open [$path]: $!";              open my $fh, $path or die "Couldn't open [$path]: $!";
             my $content = do { local $/; <$fh> };              my $content = do { local $/; <$fh> };
             close $fh;              close $fh;
Line 34 
Line 31 
                 die $json->error;                  die $json->error;
             }              }
   
             $Actions->{$action} = {              $Actions{$action} = {
                 mtime => $mtime,                  mtime => $mtime,
                 data  => $data,                  data  => $data,
             };              };
         }          }
   
         return $Actions->{$action}{data};          return $Actions{$action}{data};
     }      }
 );  );
   
Line 66 
Line 63 
   
 @@ index.html.ep  @@ index.html.ep
 % layout 'default';  % layout 'default';
 Please try /api/action  Please try /api/action, or see
   <a href="http://amd.home.net">amd.hope.net</a>.
   
 @@ layouts/default.html.ep  @@ layouts/default.html.ep
 <!doctype html><html>  <!doctype html><html>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>