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

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

revision 206 by dpavlin, Wed Aug 12 22:27:57 2009 UTC revision 209 by dpavlin, Thu Aug 13 00:06:48 2009 UTC
# Line 74  sub get { Line 74  sub get {
74    
75  sub put {  sub put {
76          my ($self, $url, $json) = @_;          my ($self, $url, $json) = @_;
         warn "put $url ",dump($json);  
77    
78          if ( ! defined $json->{_rev} ) {          if ( ! defined $json->{_rev} ) {
79                  my $old = eval { $self->get( $url )->{_rev} };                  my $old = eval { $self->get( $url )->{_rev} };
# Line 100  sub audit { Line 99  sub audit {
99          my $data = pop @_;          my $data = pop @_;
100    
101          my $url = join(' ', @_);          my $url = join(' ', @_);
102          $url =~ s/-\S+//g;          $url =~ s/\s+-\S+//g;   # remove command line options
103          $url =~ s/\W+/-/g;          $url =~ s/\W+/-/g;
104    
105          my ( $package, undef, $line, $sub ) = caller(1);          my ( $package, $file, $line, $sub ) = caller(1);
106          ( $package, undef, $line ) = caller(0) if $package eq 'main';          ( $package, undef, $line ) = caller(0) if $package eq 'main';
107    
108          $data->{x_meta} = {          my $time = time();
                 'ident' => [ @_ ],  
                 'time' => time(),  
                 'package' => $package,  
                 'line' => $line,  
                 'sub' => $sub,  
         };  
109    
110          $audit->put( "pxelator/$package.$url", $data );          $data->{$_} = eval '$' . $_ foreach ( qw/time package line sub/ );
111    
112            warn 'audit ', dump($data), "at $file +$line\n";
113    
114            $time = int($time); # reduce granularity
115            $audit->put( "pxelator/$time.$package.$url", $data );
116  }  }
117    
118  1;  1;

Legend:
Removed from v.206  
changed lines
  Added in v.209

  ViewVC Help
Powered by ViewVC 1.1.26