/[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 240 by dpavlin, Mon Aug 17 00:52:51 2009 UTC revision 482 by dpavlin, Sat Jan 23 18:31:14 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/;
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    
         my ( $package, $file, $line, $sub ) = caller(1);  
         ( $package, undef, $line ) = caller(0) if ! $package || $package eq 'main';  
   
125          my $time = time();          my $time = time();
         $sub =~ s{^.+::}{}; # stip package name  
126    
127          $data->{$_} = eval '$' . $_ foreach ( qw/time package line sub/ );          my @caller = caller(1); # skip store wrapper
128            $caller[3] = (caller(1))[3];
129            $caller[3] =~ s{^.+::}{}; # stip package name from sub
130            $data->{package} = {
131                    time => $time,
132                    name => $caller[0],
133                    line => $caller[2],
134                    caller  => $caller[3],
135            };
136    
137            if ( $ENV{DEBUG} ) {
138    
139                    my $caller;
140                    my $depth = 0;
141                    while ( my @c = caller($depth) ) {
142                            push @$caller, [ @c ];
143                            $depth++;
144                    }
145    
146                    $data->{caller} = $caller;
147    
148            }
149    
150  #       carp 'audit ', dump($data);  #       carp 'audit ', dump($data);
151    
152          $time = int($time); # reduce granularity  #       $time = int($time); # reduce granularity for url
153            $time = strftime("%Y-%m-%d.%H:%M:%S", localtime $time);
154            my $package = $caller[0];
155          $audit->put( "pxelator/$time.$package.$url", $data );          $audit->put( "pxelator/$time.$package.$url", $data );
156    
157  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26