X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2FPXElator%2FCouchDB.pm;h=1d1401b85d34d1b2d0c4bc849116ad0608364ad4;hb=ed3756a9f10833f22e6070d1bcdf84a8a95519e9;hp=efb15b52f36770e0f48e9abc4e50613eccc81b1e;hpb=ccf9d7b5128473e1a0397936c35bd9f026ca76f3;p=pxelator diff --git a/lib/PXElator/CouchDB.pm b/lib/PXElator/CouchDB.pm index efb15b5..1d1401b 100644 --- a/lib/PXElator/CouchDB.pm +++ b/lib/PXElator/CouchDB.pm @@ -13,7 +13,6 @@ use Data::Structure::Util qw(unbless); use Scalar::Util qw/blessed/; use Storable qw/dclone/; use Carp qw/carp/; -use POSIX; sub new { my ($class, $host, $port, $options) = @_; @@ -115,45 +114,9 @@ sub post { our $audit = __PACKAGE__->new; -sub audit { - my $data = pop @_; - - my $url = join(' ', @_); - $url =~ s/\s+-\S+//g; # remove command line options - $url =~ s/\W+/-/g; - - my $time = time(); - - my @caller = caller(0); - $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 ); - +sub _store_audit { + my ( $id, $data ) = @_; + $audit->put( "pxelator/$id", $data ); } 1;