diff --git a/textarchive/lib/TA/ObjReg.pm b/textarchive/lib/TA/ObjReg.pm index b74c4b5ea2be5b09f60cd7ee902bf24c811a0d75..49ac8f4d26097a97b22f7a484ffcf1fa86b812ac 100644 --- a/textarchive/lib/TA/ObjReg.pm +++ b/textarchive/lib/TA/ObjReg.pm @@ -20,6 +20,7 @@ use strict; use File::Find; use TA::Util; +use Util::MongoDB; my %plugins_loaded= (); @@ -100,7 +101,7 @@ sub get_project elsif ($be eq 'MongoDB') { require MongoDB; - require MongoDB::MongoClient; + # will be included by module "MongoDB" : require MongoDB::MongoClient; } else { @@ -131,6 +132,10 @@ sub get_project my $x= $obj->{'_maint'}->find_one ( { 'an' => 'seq' } ); $obj->{'seq'}= $seq= $x->{'av'}; } + else + { + return undef; + } } # print "seq: [$seq] ", main::Dumper ($seq); @@ -732,6 +737,9 @@ sub connect_MongoDB my $cfg= shift; my $cmm= $cfg->{'MongoDB'}; + +=begin comment + my %cmm_c= map { $_ => $cmm->{$_} } qw(host username password db_name); # print "cmm_c: ", main::Dumper (\%cmm_c); @@ -755,6 +763,19 @@ sub connect_MongoDB return undef; } +=end comment +=cut + + my $db= Util::MongoDB::connect ($cmm); + return undef unless (defined ($db)); + # print "db: ", main::Dumper($db); exit; + + # TODO: streamline ... + my $col0= $db->get_collection($cmm->{'maint'}); + my $col1= $db->get_collection($cmm->{'catalog'}); + my $col2= $db->get_collection($cmm->{'keys'}); + # print "col: [$col0] [$col1] [$col2]\n"; + $obj->{'_mongo'}= $db; $obj->{'_maint'}= $col0; $obj->{'_cat'}= $col1; diff --git a/textarchive/vlib001.pl b/textarchive/vlib001.pl index 286d4459ad298e3790a40e1ce300a19ff0076629..9fb4d320dc8cbc0bc89fa72c41272b1b7abf0ae2 100755 --- a/textarchive/vlib001.pl +++ b/textarchive/vlib001.pl @@ -138,6 +138,7 @@ if ($op_mode eq 'edit') } my $objreg= new TA::ObjReg ('project' => $project, 'store' => $store, 'key' => 'md5'); +# print "objreg: ", Dumper ($objreg); exit; &usage ('no config found') unless (defined ($objreg)); print "objreg: ", Dumper ($objreg) if ($DEBUG || $STOP); exit if ($STOP); @@ -243,7 +244,7 @@ sub usage if ($msg) { print $msg, "\n"; - sleep (10); + sleep (5); } system ('perldoc', $0); exit -1;