/[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 482 by dpavlin, Sat Jan 23 18:31:14 2010 UTC revision 483 by dpavlin, Sat Jan 23 18:58:18 2010 UTC
# Line 13  use Data::Structure::Util qw(unbless); Line 13  use Data::Structure::Util qw(unbless);
13  use Scalar::Util qw/blessed/;  use Scalar::Util qw/blessed/;
14  use Storable qw/dclone/;  use Storable qw/dclone/;
15  use Carp qw/carp/;  use Carp qw/carp/;
 use POSIX;  
16    
17  sub new {  sub new {
18          my ($class, $host, $port, $options) = @_;          my ($class, $host, $port, $options) = @_;
# Line 115  sub post { Line 114  sub post {
114    
115  our $audit = __PACKAGE__->new;  our $audit = __PACKAGE__->new;
116    
117  sub audit {  sub _store_audit {
118          my $data = pop @_;          my ( $id, $data ) = @_;
119            $audit->put( "pxelator/$id", $data );
         my $url = join(' ', @_);  
         $url =~ s/\s+-\S+//g;   # remove command line options  
         $url =~ s/\W+/-/g;  
   
         my $time = time();  
   
         my @caller = caller(1); # skip store wrapper  
         $caller[3] = (caller(1))[3];  
         $caller[3] =~ s{^.+::}{}; # stip package name from sub  
         $data->{package} = {  
                 time => $time,  
                 name => $caller[0],  
                 line => $caller[2],  
                 caller  => $caller[3],  
         };  
   
         if ( $ENV{DEBUG} ) {  
   
                 my $caller;  
                 my $depth = 0;  
                 while ( my @c = caller($depth) ) {  
                         push @$caller, [ @c ];  
                         $depth++;  
                 }  
   
                 $data->{caller} = $caller;  
   
         }  
   
 #       carp 'audit ', dump($data);  
   
 #       $time = int($time); # reduce granularity for url  
         $time = strftime("%Y-%m-%d.%H:%M:%S", localtime $time);  
         my $package = $caller[0];  
         $audit->put( "pxelator/$time.$package.$url", $data );  
   
120  }  }
121    
122  1;  1;

Legend:
Removed from v.482  
changed lines
  Added in v.483

  ViewVC Help
Powered by ViewVC 1.1.26