NAME

JavaScript::Code - A JavaScript Code Framework

SYNOPSIS

#!/usr/bin/perl

use strict;
use warnings;
use JavaScript::Code;
use JavaScript::Code::Variable;

my $code = JavaScript::Code->new();
my $var  = JavaScript::Code::Variable->new()->name('a')->value("Var!");

$code->add( $var );
$code->add( JavaScript::Code::Variable->new()->name('b')->value(42) );

print $code->output_for_html;

DESCRIPTION

Create javascript-code!

METHODS

$self->add( $element )

Adds a new element.

$self->elements( )

Returns a ref-array of all added elements.

$self->output( )

Returns the javascript-code.

$self->output_for_html( < \%args > )

Returns the javascript-code that can be directly embedded into html-code.

Optimal \%args: Key-value pairs that reprensent attributes that will be associated to the script tag.

print $code->output_for_html( { language => undef } );

SEE ALSO

JavaScript::MochiKit

http://www.perl-community.de

AUTHOR

Sascha Kiefer, esskar@cpan.org

LICENSE

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.