/[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 221 by dpavlin, Sat Aug 15 14:21:55 2009 UTC revision 299 by dpavlin, Wed Aug 26 15:59:19 2009 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/;
16    use POSIX;
17    
18  sub new {  sub new {
19          my ($class, $host, $port, $options) = @_;          my ($class, $host, $port, $options) = @_;
# Line 121  sub audit { Line 122  sub audit {
122          $url =~ s/\s+-\S+//g;   # remove command line options          $url =~ s/\s+-\S+//g;   # remove command line options
123          $url =~ s/\W+/-/g;          $url =~ s/\W+/-/g;
124    
125          my ( $package, $file, $line, $sub ) = caller(1);          my $time = $data->{time} = time();
         ( $package, undef, $line ) = caller(0) if ! $package || $package eq 'main';  
126    
127          my $time = time();          my @caller_name = ( qw/package file line sub/ );
128            my @caller = caller(0);
129            $caller[3] = (caller(1))[3];
130            $caller[3] =~ s{^.+::}{}; # stip package name from sub
131            $data->{ $caller_name[$_] } = $caller[$_] foreach ( 0 .. $#caller_name );
132    
133            if ( $ENV{DEBUG} ) {
134    
135                    my $caller;
136                    my $depth = 0;
137                    while ( my @c = caller($depth) ) {
138                            push @$caller, [ @c ];
139                            $depth++;
140                    }
141    
142                    $data->{caller} = $caller;
143    
144          $data->{$_} = eval '$' . $_ foreach ( qw/time package line sub/ );          }
145    
146  #       carp 'audit ', dump($data);  #       carp 'audit ', dump($data);
147    
148          $time = int($time); # reduce granularity  #       $time = int($time); # reduce granularity for url
149            $time = strftime("%Y-%m-%d.%H:%M:%S", localtime $time);
150            my $package = $caller[0];
151          $audit->put( "pxelator/$time.$package.$url", $data );          $audit->put( "pxelator/$time.$package.$url", $data );
152    
153  }  }

Legend:
Removed from v.221  
changed lines
  Added in v.299

  ViewVC Help
Powered by ViewVC 1.1.26