OPTIONS

Perl Language Center

Installing

Start a MongoDB server instance (mongod) before installing so that the tests will pass. The mongod must be running as a primary for the tests to pass.

Some tests may be skipped, depending on the version of the database you are running.

CPAN

sudo cpan MongoDB

The Perl driver is available through CPAN as the package MongoDB. It should build cleanly on *NIX and Windows (via Strawberry Perl). It is also available as an ActivePerl module.

Manual (Non-CPAN) Installation

If you would like to try the latest code or are contributing to the Perl driver, it is available at GitHub.

The Perl driver requires some libraries available in CPAN. As of September, 2013, these are:

Data::Types
DateTime
DateTime::Tiny
ExtUtils::MakeMaker
File::Slurp
File::Temp
FileHandle
JSON
Test::Exception
Test::Warn
Tie::IxHash
Try::Tiny
boolean
ExtUtils::MakeMaker
Class::Method::Modifiers
DateTime
Digest::MD5
Moose
Tie::IxHash
XSLoader

In order to install the dependencies, first copy the names of the packages into a text file, packages.txt. Then run the following:

sudo cpan App::cpanminus
cat packages.txt | sudo cpanm

Before you are able to build the MongoDB module, you’ll also need Dist::Zilla. Get Dist::Zilla and its dependencies with the following:

sudo cpan Dist::Zilla
dzil authordeps | sudo cpanm

Next, use Dist::Zilla to create a copy of the driver module with the correct version information:

dzil build

This will create a new directory named something like MongoDB-0.702.1. To build and install the driver, change to this directory and run:

perl Makefile.PL
make
make test # make sure mongod is running, first
sudo make install

The tests will not pass without a mongod process running.

Big-Endian Systems

The driver will work on big-endian machines, but the database will not. The tests assume that mongod will be running on localhost unless %ENV{MONGOD} is set. So, to run the tests, start the database on a little-endian machine (at, say, “example.com”) and then run the tests with:

MONGOD=example.com make test

A few tests that require a database server on localhost will be skipped.

Next Steps

There is a tutorial and API documentation on CPAN.

If you are interested in contributing to the Perl driver, see Contribute to the Perl Driver.

MongoDB Perl Tools

BSON

BSON is a pure-Perl BSON implementation. Created by Stefan G.

Entities::Backend::MongoDB

Entities::Backend::MongoDB is a backend for the Entities user management and authorization system. It stores all entities and relations between them in a MongoDB database. Created by Ido Perlmuter.

Mango

Mango is a pure-Perl, non-blocking, asynchronous driver for MongoDB, designed to work with the Mojolicious web framework. Created by Sebastian Riedel.

Meerkat

Meerkat lets you manage MongoDB documents as Moose objects. Your objects represent projections of the document state maintained in the database. Meerkat is designed for atomic operations that keep client-side objects in sync with the database. Created by David Golden.

MojoX::Session::Store::MongoDB

MojoX::Session::Store::MongoDB is a store for MojoX::Session that stores a session in a MongoDB database. Created by Ask Bjørn Hansen.

MongoDB::Admin

MongoDB::Admin is a collection of MongoDB administrative functions. Created by David Burley.

MongoDB::Simple

MongoDB::Simple <https://metacpan.org/module/MongoDB::Simple>`_ is a basic object-to-document mapping system with few dependencies. Created by Ian Kent.

Mongoose

Mongoose is an attempt to bring together the full power of Moose with MongoDB. It provides a full suite of object-to-document mapping facilities. Created by Rodrigo de Oliveira Gonzalez.

MongoDBI

MongoDBI is an Object-Document-Mapper (ODM) for MongoDB. It allows you to create Moose-based classes to interact with MongoDB databases.

MongoDBI allows you to easily model classes while leveraging the power of MongoDB’s schema-less and expeditious document-based design, dynamic queries, and atomic modifier operations. Created by Al Newkirk.

MongoDBx::Class

MongoDBx::Class is an ORM for MongoDB databases. MongoDBx::Class takes advantage of the fact that Perl’s MongoDB driver is Moose-based to extend and tweak the driver’s behavior, instead of wrapping it. This means MongoDBx::Class does not define its own syntax, so you simply use it exactly as you would the MongoDB driver directly. Created by Ido Perlmuter.

MongoDBx::Queue

MongoDBx::Queue is a basic message queue system backed by MongoDB. Created by David Golden.

MongoX

MongoX is light wrapper for MongoDB, providing some nice DSL sugar. Created by Pan Fan.

MooseX::Role::MongoDB

MooseX::Role::MongoDB is a Moose role which provides connection management and automatic fork handling for the MongoDB driver. Created by David Golden.

OOP Perl CMS

OOP Perl CMS is based on Khurt Williams’ Object Oriented Perl methodology and can be used as a basic CMS framework or as a basis for your own CMS system. It uses Apache & mod_perl with MongoDB backend. Created by Waitman Gobble.