JavaScript::Code::Number - A JavaScript Number Type


JavaScript-Code documentation Contained in the JavaScript-Code distribution.

Index


Code Index:

NAME

Top

JavaScript::Code::Number - A JavaScript Number Type

SYNOPSIS

Top

    #!/usr/bin/perl

    use strict;
    use warnings;
    use JavaScript::Code::Number;

    my $number = JavaScript::Code::String->new( value => 42 );

    print $number->output;

METHODS

Top

See also the JavaScript::Code::Type documentation.

$self->type( )

$self->output( )

SEE ALSO

Top

JavaScript::Code

AUTHOR

Top

Sascha Kiefer, esskar@cpan.org

LICENSE

Top

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::Number;

use strict;
use vars qw[ $VERSION ];
use base
  qw[ JavaScript::Code::Type JavaScript::Code::Expression::Node::Arithmetic ];

$VERSION = '0.08';

sub type {
    return "Number";
}

sub output {
    my ($self) = @_;

    my $value = $self->value;
    $value += 0;    # make sure it is a number

    return "$value";
}

1;