Perl语言中心

Installing

Start a MongoDB server instance (mongod) before installing so that the tests will pass. The mongod cannot be running as a slave 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. There is also documentation generated after every commit.

You can see if it is a good time to grab the bleeding edge code by seeing if the build is green.

To build the driver, 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.

The Perl driver requires some libraries available in CPAN. As of April, 2010, these are Any::Moose, Class::Method::Modifiers, Data::Types, DateTime, File::Slurp, Test::Exception, Try::Tiny, boolean, and Module::Install. (Additionally, Tie::IxHash is required for testing.) On Debian or Ubuntu systems, these prerequisites can be easily installed with the following command:

sudo apt-get install libmodule-install-perl libany-moose-perl libclass-method-modifiers-perl libdata-types-perl libdatetime-perl libfile-slurp-perl libtest-exception-perl libtry-tiny-perl libboolean-perl libtie-ixhash-perl

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 贡献到Perl驱动.

MongoDB Perl Tools

BSON

BSON is a pure-Perl BSON implementation.

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, using the MongoDB module. This is a powerful, fast backend that gives you all the features of MongoDB.

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.

Mongoose

Mongoose is an attempt to bring together the full power of Moose with MongoDB. 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.

At-a-glance, most will enjoy MongoDBI for its ability to easily model classes while leveraging the power of MongoDB’s schema-less and expeditious document-based design, dynamic queries, and atomic modifier operations.

Also noteworthy is MongoDBI’s ease-of-use, chainable search facilities (filters), automated indexing, moose-integration (inheritance support, etc), lean document updates via dirty field tracking, and ability for each class to be configured to use a different database and connection, etc.

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. That said, MongoDBx::Class adds some sugar that enhances and simplifies the syntax unobtrusively (either use it or don’t). Thus, it is relatively easy to convert your current MongoDB applications to MongoDBx::Class. A collection in MongoDBx::Class isa(‘MongoDB::Collection’), a database in MongoDBx::Class isa(‘MongoDB::Database’), etc. Created by Ido Perlmuter.

MongoX

MongoX: DSL sugar for MongoDB.

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.