Data-JavaScript-Anon
view release on metacpan or search on metacpan
script_wrap $javascript
The "script_wrap" method is a quick way of wrapping a normal JavaScript
html tag around your JavaScript.
is_a_number $scalar
When generating the javascript, numbers will be printed directly and not
quoted. The "is_a_number" method provides convenient access to the test
that is used to see if something is a number. The test handles just
about everything legal in JavaScript, with the one exception of the
exotics, such as Infinite, -Infinit and NaN.
Returns true is a scalar is numeric, or false otherwise.
You may also access method in using an instantiated object.
new HASH
This will create a Data::JavaScript::Anon object that will allow you to
change some of the default behaviors of some methods.
Options:
lib/Data/JavaScript/Anon.pm view on Meta::CPAN
use Class::Default ();
use vars qw{@ISA $VERSION $errstr $RE_NUMERIC $RE_NUMERIC_HASHKEY %KEYWORD};
BEGIN {
$VERSION = '1.03';
@ISA = 'Class::Default';
$errstr = '';
# Attempt to define a single, all encompasing,
# regex for detecting a legal JavaScript number.
# We do not support the exotic values, such as Infinite and NaN.
my $_sci = qr/[eE](?:\+|\-)?\d+/; # The scientific notation exponent ( e.g. 'e+12' )
my $_dec = qr/\.\d+/; # The decimal section ( e.g. '.0212' )
my $_int = qr/(?:[1-9]\d*|0)/; # The integers section ( e.g. '2312' )
my $real = qr/(?:$_int(?:$_dec)?|$_dec)(?:$_sci)?/; # Merge the integer, decimal and scientific parts
my $_hex = qr/0[xX][0-9a-fA-F]+/; # Hexidecimal notation
my $_oct = qr/0[0-7]+/; # Octal notation
# The final combination of all posibilities for a straight number
# The string to match must have no extra characters
$RE_NUMERIC = qr/^(?:\+|\-)??(?:$real|$_hex|$_oct)\z/;
lib/Data/JavaScript/Anon.pm view on Meta::CPAN
The C<script_wrap> method is a quick way of wrapping a normal JavaScript html
tag around your JavaScript.
=head2 is_a_number $scalar
When generating the javascript, numbers will be printed directly and not
quoted. The C<is_a_number> method provides convenient access to the test
that is used to see if something is a number. The test handles just about
everything legal in JavaScript, with the one exception of the exotics, such
as Infinite, -Infinit and NaN.
Returns true is a scalar is numeric, or false otherwise.
You may also access method in using an instantiated object.
=head2 new HASH
This will create a Data::JavaScript::Anon object that will allow you to change
some of the default behaviors of some methods.
( run in 0.240 second using v1.01-cache-2.11-cpan-4d50c553e7e )