report error without nmap output
[pxelator] / lib / PXElator / CouchDB.pm
index 02cfab7..7e9e8fd 100644 (file)
@@ -8,12 +8,10 @@ use warnings;
 use LWP::UserAgent;
 use JSON;
 use Data::Dump qw/dump/;
-use Time::HiRes qw/time/;
 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,41 +113,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 = $data->{time} = time();
-
-       my @caller_name = ( qw/package file line sub/ );
-       my @caller = caller(0);
-       $caller[3] = (caller(1))[3];
-       $caller[3] =~ s{^.+::}{}; # stip package name from sub
-       $data->{ $caller_name[$_] } = $caller[$_] foreach ( 0 .. $#caller_name );
-
-       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;