| JavaScript-Code documentation | Contained in the JavaScript-Code distribution. |
JavaScript::Code::String - A JavaScript String Type
#!/usr/bin/perl
use strict;
use warnings;
use JavaScript::Code::String;
my $string = JavaScript::Code::String->new()->value("Go for it!");
print $string->output;
See also the JavaScript::Code::Type documentation.
Sascha Kiefer, esskar@cpan.org
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| JavaScript-Code documentation | Contained in the JavaScript-Code distribution. |
package JavaScript::Code::String; use strict; use vars qw[ $VERSION ]; use base qw[ JavaScript::Code::Type ]; $VERSION = '0.08';
sub type { return 'String'; }
sub output { my ($self) = @_; my $value = $self->value; $value =~ s{\"}{\\\"}g; return qq~"$value"~; }
1;