Annotated CPAN


JPIERCE > Data-JavaScript-1.08 > Data::JavaScript

[ search.cpan.org | Kobes search | report a bug ]

NAME

Data::JavaScript - Perl extension for dumping structures into JavaScript code

New Note §

SYNOPSIS

  use Data::JavaScript;
  B<or>
  use Data::JavaScript {UNDEF=>0};
  
  @code = jsdump('my_array', $array_ref, 0);
  $code = jsdump('my_object', $hash_ref);
  $code = hjsdump('my_stuff', $array_ref B<or> $hash_ref);

New Note §

DESCRIPTION

This module is aimed mainly for CGI programming, when a perl script generates a page with client side JavaScript code that needs access to structures created on the server.

New Note §

It works by creating one line of JavaScript code per datum. Therefore, structures cannot be created anonymously and needed to be assigned to variables. This enables dumping big structures.

New Note §

You may define a default to be substitued in dumping of undef values at compile time by supplying the default value in anonymous hash like so

New Note §
  use Data::JavaScript {UNDEF=>'null'};

New Note §

AUTHOR

Maintained by Jerrad Pierce<[email protected]>

New Note §

Ariel Brosh, [email protected]. Inspired by WDDX.pm JavaScript support.

New Note §

CREDITS

Garick Hamlin [email protected], fixing of quoting bug.

New Note §

SEE ALSO

perl(1), WDDX.

New Note §