-
-
27 Oct 2014 00:19:07 UTC
- Distribution: JE
- Module version: 0.066
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (3)
- Testers (3148 / 31 / 37)
- Kwalitee
Bus factor: 0- 90.35% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (274.99KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Father Chrysostomos
- Dependencies
- Carp
- Date::Parse
- Encode
- Exporter
- List::Util
- POSIX
- Scalar::Util
- Test::More
- Time::Local
- Time::Zone
- constant
- re
- strict
- utf8
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
JE::Number - JavaScript number value
SYNOPSIS
use JE; use JE::Number; $j = JE->new; $js_num = new JE::Number $j, 17; $perl_num = $js_num->value; $js_num->to_object; # returns a new JE::Object::Number
DESCRIPTION
This class implements JavaScript number values for JE. The difference between this and JE::Object::Number is that that module implements number objects, while this module implements the primitive values.
Right now, this module simply uses Perl numbers underneath for storing the JavaScript numbers. It seems that whether Perl numbers are in accord with the IEEE 754 standard that ECMAScript uses is system-dependent. If anyone requires IEEE 754 compliancy, a patch would be welcome. :-)
The
new
method accepts a global (JE) object and a number as its two arguments. If the latter is an object with ato_number
method whose return value isa JE::Number, that object's internal value will be used. Otherwise the arg itself is used. (The precise details of the behaviour ofnew
when the second arg is a object are subject to change.) It is numified Perl-style, so 'nancy' becomes NaN and 'information' becomes Infinity.The
value
method produces a Perl scalar. The0+
numeric operator is overloaded and produces the same.Stringification and boolification are overloaded and produce the same results as in JavaScript
The
typeof
andclass
methods produce the strings 'number' and 'Number', respectively.SEE ALSO
Module Install Instructions
To install JE, copy and paste the appropriate command in to your terminal.
cpanm JE
perl -MCPAN -e shell install JE
For more information on module installation, please visit the detailed CPAN module installation guide.