Nicholas Perez > MongoDBx-AutoDeref > MongoDBx::AutoDeref::LookMeUp

Download:
MongoDBx-AutoDeref-1.110560.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.110560   Source  

NAME ^

MongoDBx::AutoDeref::LookMeUp - Provides the sieve that replaces DBRefs with deferred scalars.

VERSION ^

version 1.110560

DESCRIPTION ^

This module provides the guts for MongoDBx::AutoDeref. It modifies documents in place to replace DBRefs with actual objects that implement the deferred fetch. This class also will deflate those same objects back into plain hashes.

PUBLIC_ATTRIBUTES ^

mongo_connection

    is: ro, isa: MongoDB::Connection, required: 1

In order to defer fetching the referenced document, a connection object needs to be accessible. This is required for construction of the object.

visitor

    is: ro, isa: Data::Visitor::Callback
    lazy: 1, builder => _build_visitor
    handles: sieve => visit

In order to find the DBRefs within the returned document, Data::Visitor is used to traverse the structure. The raw hashes are replaced with proper objects that implement the lookup via "fetch" in MongoDBx::AutoDeref::DBRef. Upon insert/update, these objects are then deflated back to their raw hash references.

sieve_type

    is: ro, isa: enum(input,output), required: 1

The LookMeUp object can operate in two modes. In the input mode, MongoDBx::AutoDeref::DBRef objects will be deflated to plain hashes. In output mode, plain hashes that pass the DBRef type constraint will be inflated.

PUBLIC_METHODS ^

sieve

    (HashRef)

This method takes the returned document from MongoDB and traverses it to replace DBRefs with defered lookups of the actual document. It does this IN PLACE on the document.

The obverse is true as well. If storing a document the document will be traversed and the DBRef objects will be deflated into plain hashes

AUTHOR ^

Nicholas R. Perez <nperez@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2010 by Nicholas R. Perez <nperez@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: