/[pxelator]/lib/PXElator/httpd.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 /lib/PXElator/httpd.pm

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

revision 490 by dpavlin, Sat Jan 23 21:43:00 2010 UTC revision 496 by dpavlin, Sun Jan 31 15:22:34 2010 UTC
# Line 18  use File::Slurp; Line 18  use File::Slurp;
18  #use JSON;  #use JSON;
19  use IO::Socket::INET;  use IO::Socket::INET;
20  use Regexp::Common qw/net/;  use Regexp::Common qw/net/;
21    use POSIX qw(strftime);
22    
23  our $title;  our $title;
24    
# Line 76  qq{ Line 77  qq{
77  <a target=server href=/brctl >brctl</a>  <a target=server href=/brctl >brctl</a>
78  <a target=server href=/ip >ip</a>  <a target=server href=/ip >ip</a>
79  |  |
80  <a target=store href=$store_url >store</a>  <a target=store href=$store_url >MongoDB</a>
81  <a target=store href=/store/query >query</a>  <a target=store href=/store/latest >latest</a>
82  |  |
83  <a target=client href=/nmap >nmap</a>  <a target=client href=/nmap >nmap</a>
84  <a target=client href=/client >client</a>  <a target=client href=/client >client</a>
# Line 269  warn "XXX pids = ", dump( $daemons::pids Line 270  warn "XXX pids = ", dump( $daemons::pids
270                          |                          |
271                          ;                          ;
272    
273          } elsif ( $path =~ m{^/store/query} ) {          } elsif ( $path =~ m{^/store/latest} ) {
274                  print $client ok                  print $client ok
275                          , qq|                          , qq|
276  <style type=text/css>  <style type=text/css>
# Line 290  warn "XXX pids = ", dump( $daemons::pids Line 291  warn "XXX pids = ", dump( $daemons::pids
291                          , qq|<table>|                          , qq|<table>|
292                  ;                  ;
293                  my ( $s1,$s2 ) = ( ' class=z', '' );                  my ( $s1,$s2 ) = ( ' class=z', '' );
294                  store::query( sub {                  my @cols;
295    
296                    my $from_t = $param->{from_t};
297    
298                    store::query( $from_t, sub {
299                          my $o = shift;                          my $o = shift;
300                          my $p = delete( $o->{package} );                          my $p = delete( $o->{package} );
301                          delete( $o->{_id} );                          delete( $o->{_id} );
302    
303                            if ( ! @cols ) {
304                                    #@cols = keys %$p;
305                                    @cols = qw( time name );
306                                    print $client qq|<tr><th>|
307                                            , join(qq|</th><th>|, @cols)
308                                            , qq|</th><th></th></tr>|
309                                    ;
310                            }
311    
312                          # XXX sigh, dump dies if we don't do this                          # XXX sigh, dump dies if we don't do this
313                          delete $o->{$_} foreach ( grep { ! defined $o->{$_} } keys %$o );  #                       delete $o->{$_} foreach ( grep { ! defined $o->{$_} } keys %$o );
314    
315                          print $client qq|<tr$s1><td>|                          print $client qq|<tr$s1>|
316                                  , join(qq|</td><td>|, map { $p->{$_} } keys %$p )                                  , strftime( qq|<td title="%Y-%m-%d">%H:%M:%S</td>|, localtime($p->{time}) )
317                                  , qq|</td><td><pre>|                                  , map { qq|<td>$_<td>| } ( $p->{name} , html::pre_dump($o) )
318                                  , dump( $o )                                  , qq|</tr>\n|
                                 , qq|</pre></td></tr>\n|  
319                          ;                          ;
320                          ( $s1, $s2 ) = ( $s2, $s1 );                          ( $s1, $s2 ) = ( $s2, $s1 );
321                            $from_t = $p->{time};
322                  });                  });
323                  print $client qq|</table>|;                  print $client qq|</table>|,
324                            qq|<a href="/store/latest?from_t=$from_t">more</a>|
325                    ;
326    
327          } elsif ( $path =~ m!^/client(?:/$RE{net}{IPv4}{-keep})?! ) {          } elsif ( $path =~ m!^/client(?:/$RE{net}{IPv4}{-keep})?! ) {
328                  my $ip = $1;                  my $ip = $1;

Legend:
Removed from v.490  
changed lines
  Added in v.496

  ViewVC Help
Powered by ViewVC 1.1.26