LibreCat / Catmandu-Store-MongoDB

A searchable store backed by MongoDB
https://metacpan.org/pod/Catmandu::Store::MongoDB
4 stars 2 forks source link

Loading MongoDB and Catmandu in one perl script is not possible #15

Closed phochste closed 3 years ago

phochste commented 5 years ago

With Catmandu 1.2003 and Catmandu-Store-MongoDB 0.0803 I try to load in a script Catmandu and MongoDB (to use extended features of MongoDB). This not possible.

Script:

#!/usr/bin/env perl

use MongoDB;
use Catmandu;

Catmandu->load(':up');

my $store = Catmandu->store('rug01')->bag;

where catmandu.yml

store:
  rug01:
    name: Aleph (books)
    options:
      database_name: rug01
      socket_timeout_ms: -1
    package: MongoDB

running this script dies with:

$ perl test.pl
No such package: Catmandu::Store::MongoDB

Trace begun at /opt/lludss-import/local/lib/perl5/Catmandu/Util.pm line 688
Catmandu::Util::require_package('MongoDB', 'Catmandu::Store') called at /opt/lludss-import/local/lib/perl5/Catmandu/Env.pm line 207
Catmandu::Env::_named_package('Catmandu::Env=HASH(0x4340cb8)', 'store', 'Catmandu::Store', 'default', undef, 'HASH(0x37ced90)', 'rug01') called at /opt/lludss-import/local/lib/perl5/Catmandu/Env.pm line 151
Catmandu::Env::store('Catmandu::Env=HASH(0x4340cb8)', 'rug01') called at /opt/lludss-import/local/lib/perl5/Catmandu.pm line 98
Catmandu::store('Catmandu', 'rug01') called at test.pl line 9

Loading MongoDB after Catmandu has the same effect. Commenting out MongoDB solves the issue (but that is not what I want to do).

nics commented 3 years ago

can't reproduce with