NAME

WWW::Suffit::RefUtil - Pure Perl Utility functions for checking references and data

SYNOPSIS

use WWW::Suffit::RefUtil qw/ :check /;

DESCRIPTION

Pure Perl Utility functions for checking references and data

CHECK

Check functions are introduced by the :check import tag, which check the argument type and return a bool

is_ref

Checks for a any reference

is_scalar_ref

Checks for a SCALAR reference

is_array_ref

Checks for an ARRAY reference

is_hash_ref

Checks for a HASH reference

is_code_ref

Checks for a CODE reference

is_glob_ref

Checks for a GLOB reference

is_regexp_ref, is_regex_ref, is_rx

Checks for a regular expression reference generated by the qr// operator

is_value

Checks whether value is a primitive value, i.e. a defined, non-ref, and non-type-glob value

is_string

Checks whether value is a string with non-zero-length contents, equivalent to is_value($value) && length($value) > 0

is_number

Checks whether value is a number

is_integer, is_int8, is_int16, is_int32, is_int64

Checks whether value is an integer

is_undef

Checks for a undef value

VOID

Void functions are introduced by the :void import tag, which check the argument type in void value and return a bool

is_void
print "Void" if is_void({});

Returns true if the structure contains useful data. Useful data - this data is different from the value undef

isnt_void
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

FLAG

is_false_flag
print "Disabled" if is_false_flag("off");

If specified argument value is set to false then will be normalised to 1.

The following values will be considered as false:

no, off, 0, false, disable

This effect is case-insensitive, i.e. both "No" or "no" will result in 1.

is_true_flag
print "Enabled" if is_true_flag("on");

If specified argument value is set to true then will be normalised to 1.

The following values will be considered as true:

yes, on, 1, true, enable

This effect is case-insensitive, i.e. both "Yes" or "yes" will result in 1.

HISTORY

See Changes file

TO DO

See TODO file

SEE ALSO

Data::Util::PurePerl, Params::Classify, Ref::Util, CTK::TFVals

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2023 D&D Corporation. All Rights Reserved

LICENSE

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/