The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

BSON::Code - JavaScript code data for BSON

VERSION

version 0.16

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

  • minimalist <minimalist@lavabit.com>

  • David Golden <david@mongodb.com>

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