CTK::TFVals - True & False values conversions
Version 1.02
use CTK::TFVals; # Undef conversions uv2zero( $value ); # Returns 0 if value is undef uv2null( $value ); # Returns "" if value is undef (null/empty/void) # Aliases: uv2empty, uv2void # False conversions fv2undef( $value ); # Returns undef if value is false fv2zero( $value ); # Returns 0 if value is false fv2null( $value ); # Returns "" if value is false (null/empty/void) # Aliases: fv2empty, fv2void # True conversions tv2num( $value ); # Returns 0 unless value ~ ([+-])?\d+ # Aliases: tv2number # Check-function: is_num tv2flt( $value ); # Returns 0 unless value ~ ([+-])?\d+\.?\d* # Aliases: tv2float # Check-function: is_flt tv2int( $value ); # Returns 0 unless value ~ \d{1,11} # Returns 0 unless value >= 0 && < 99999999999 # Check-function: is_int tv2int8( $value ); # Returns 0 unless value >= 0 && < 255 # Check-function: is_int8 tv2int16( $value ); # Returns 0 unless value >= 0 && < 65535 # Check-function: is_int16 tv2int32( $value ); # Returns 0 unless value >= 0 && < 4294967295 # Check-function: is_int32 tv2int64( $value ); # Returns 0 unless value >= 0 && < 2**64 # Check-function: is_int64 tv2intx( $value, $x ); # Returns 0 unless value >= 0 && < 2**$x # Check-function: is_intx
True & False values conversions
This function returns the 0 value if argument is undef.
uv2zero( $value );
This function returns the "" value if argument is undef.
uv2null( $value );
See "uv2null"
This function returns the undev value if argument is false.
fv2undef( $value );
This function returns the 0 value if argument is false.
fv2zero( $value );
This function returns the "" value if argument is false.
fv2null( $value );
See "fv2null"
This function returns the 0 value unless argument ~ ([+-])?\d+
tv2num( $value );
See "tv2num"
This function returns the 0 value unless argument ~ ([+-])?\d+\.?\d*
tv2flt( $value );
See "tv2flt"
This function returns the 0 value unless argument ~ \d{1,11} and argument value > 0 && < 99999999999
tv2int( $value );
This function returns the 0 value unless argument value >= 0 && < 255
tv2int8( $value );
This function returns the 0 value unless argument value >= 0 && < 65535
tv2int16( $value );
This function returns the 0 value unless argument value >= 0 && < 4294967295
tv2int32( $value );
This function returns the 0 value unless argument value >= 0 && < 2**64
tv2int64( $value );
This function returns the 0 value unless argument value >= 0 && < 2**$x
tv2int64( $value, $x );
This function returns true if argument ~ ([+-])?\d+
is_num( $value );
This function returns true if argument ~ ([+-])?\d+\.?\d*
is_flt( $value );
This function returns true if argument ~ \d{1,20} and argument value >= 0 && < 99999999999999999999
is_int( $value );
This function returns true if argument value >= 0 && < 255
is_int8( $value );
This function returns true if argument value >= 0 && < 65535
is_int16( $value );
This function returns true if argument value >= 0 && < 4294967295
is_int32( $value );
This function returns true if argument value >= 0 && < 2**64
is_int64( $value );
This function returns true if argument value >= 0 && < 2**$x
is_intx( $value, $x );
print "Void" if is_void({});
Returns true if the structure contains useful data. Useful data - this data is different from the value undef
print "NOT Void" if isnt_void({foo=>undef});
Returns true if the structure does not contain any nested useful data. Useful data - this data is different from the value undef
Export all subroutines:
"uv2zero", "uv2null", "uv2empty", "uv2void", "fv2undef", "fv2zero", "fv2null", "fv2empty", "fv2void", "tv2num", "tv2number", "is_num", "tv2flt", "tv2float", "is_flt", "tv2int", "is_int", "tv2int8", "is_int8", "tv2int16", "is_int16", "tv2int32", "is_int32", "tv2int64", "is_int64", "tv2intx", "is_intx", "is_void", "isnt_void", "is_not_void"
"uv2zero", "uv2null", "uv2empty", "uv2void", "fv2undef", "fv2zero", "fv2null", "fv2empty", "fv2void", "tv2num", "tv2int", "tv2flt"
"uv2zero", "uv2null", "uv2empty", "uv2void"
"fv2undef", "fv2zero", "fv2null", "fv2empty", "fv2void"
"tv2num", "tv2number", "tv2flt", "tv2float", "tv2int", "tv2int8", "tv2int16", "tv2int32", "tv2int64", "tv2intx"
"is_num", "is_flt", "is_int", "is_int8", "is_int16", "is_int32", "is_int64", "is_intx", "is_void", "isnt_void", "is_not_void"
See Changes file
Changes
See TODO file
TODO
* none noted
Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>
Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE file and https://dev.perl.org/licenses/
LICENSE
To install CTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CTK
CPAN shell
perl -MCPAN -e shell install CTK
For more information on module installation, please visit the detailed CPAN module installation guide.