MongoDB Inc > BSON > BSON::Code

Download:
BSON-0.12.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.12   Source   Latest Release: BSON-0.15-TRIAL

NAME ^

BSON::Code - JavaScript code data for BSON

VERSION ^

version 0.12

SYNOPSIS ^

    use BSON;

    my $code = BSON::Code->new(q[
        function be_weird(a) {
            if ( a > 20 ) {
                alert("It's too big!")
            }
            return function(b){
                alert(b)
            }
        }
    ]);

DESCRIPTION ^

This module is needed for BSON and it manages BSON's code element.

METHODS ^

new

Main constructor which takes two parameters: A string with JavaScript code and an optional hashref with scope.

    my $code = BSON::Code->new($js_code, { a => 6, b => 14 });

code

Returns the JavaScript code.

scope

Returns the scope hashref.

length

Returns the length of the JavaScript code.

SEE ALSO ^

BSON

AUTHORS ^

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004
syntax highlighting: