7 use Time::HiRes qw/time/;
13 my $conn = MongoDB::Connection->new;
14 my $db = $conn->get_database( 'pxelator' );
15 our $audit = $db->get_collection( 'audit' );
21 my $url = join(' ', @_);
22 $url =~ s/\s+-\S+//g; # remove command line options
27 my @caller = caller(0);
28 $caller[3] = (caller(1))[3];
29 $caller[3] =~ s{^.+::}{}; # stip package name from sub
41 while ( my @c = caller($depth) ) {
42 push @$caller, [ @c ];
46 $data->{caller} = $caller;
50 # carp 'audit ', dump($data);
52 # $time = int($time); # reduce granularity for url
53 $time = strftime("%Y-%m-%d.%H:%M:%S", localtime $time);
54 my $package = $caller[0];
56 # CouchDB::_store_audit( "$time.$package.$url" => $data );
58 # $data->{_id} = "$time.$package.$url";
59 $audit->insert( $data );
66 my $cursor = $audit->query->sort({ '$natural' => -1 })->limit( 25 );
67 while( my $o = $cursor->next ) {