Stefan G. > BSON > BSON::Code

Download:
BSON-0.11.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

BSON::Code - JavaScript code data for BSON

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

AUTHOR ^

minimalist, <minimalist at lavabit.com>

BUGS ^

Bug reports and patches are welcome. Reports which include a failing Test::More style test are helpful and will receive priority.

LICENSE AND COPYRIGHT ^

Copyright 2011 minimalist.

This program is free software; you can redistribute it and/or modify it under the terms as perl itself.

syntax highlighting: