From b7fc50594b6ab22117825f8a07b4743844429260 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 21 Jul 2010 15:34:34 +0000 Subject: [PATCH] work without mongodb available --- lib/PXElator/store.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/PXElator/store.pm b/lib/PXElator/store.pm index 30b14da..5585f66 100644 --- a/lib/PXElator/store.pm +++ b/lib/PXElator/store.pm @@ -7,13 +7,16 @@ use POSIX; use Time::HiRes qw/time/; use Data::Dump qw(dump); -#use CouchDB; - use MongoDB; -my $conn = MongoDB::Connection->new; -our $db = $conn->get_database( 'pxelator' ); -our $audit = $db->get_collection( 'audit' ); +our $audit; + +eval { + my $conn = MongoDB::Connection->new; + my $db = $conn->get_database( 'pxelator' ); + $audit = $db->get_collection( 'audit' ); +}; +warn "ERROR: no store for audit: $@" if $@; sub audit { @@ -57,7 +60,12 @@ sub audit { # CouchDB::_store_audit( "$time.$package.$url" => $data ); # $data->{_id} = "$time.$package.$url"; - $audit->insert( $data ); +# + if ( $audit ) { + $audit->insert( $data ); + } else { + warn "AUDIT ",dump($data); + } } -- 2.20.1