Acrux
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Acrux/RefUtil.pm view on Meta::CPAN
the argument type in void value and return a bool
=over 4
=item 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
=item 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
=back
=head2 FLAG
=over 4
=item 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.
=item 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.
=back
=head1 HISTORY
See C<Changes> file
=head1 TO DO
See C<TODO> file
=head1 SEE ALSO
L<Data::Util::PurePerl>, L<Params::Classify>, L<Ref::Util>, L<CTK::TFVals>, L<CTK::ConfGenUtil>
=head1 AUTHOR
Serż Minus (Sergey Lepenkov) L<https://www.serzik.com> E<lt>abalama@cpan.orgE<gt>
=head1 COPYRIGHT
Copyright (C) 1998-2024 D&D Corporation. All Rights Reserved
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See C<LICENSE> file and L<https://dev.perl.org/licenses/>
=cut
our $VERSION = '0.01';
use base qw/Exporter/;
our @EXPORT = (qw/
is_ref is_undef
is_scalar_ref is_array_ref is_hash_ref is_code_ref
is_glob_ref is_regexp_ref is_regex_ref is_rx
is_value is_string is_number is_integer
is_int8 is_int16 is_int32 is_int64
/);
# Required
our @EXPORT_OK = (qw/
is_void isnt_void
is_true_flag is_false_flag
as_array as_list as_array_ref as_hash as_hash_ref
as_first as_first_val as_last as_last_val as_latest
/, @EXPORT);
# Tags
our %EXPORT_TAGS = (
all => [@EXPORT_OK],
check => [@EXPORT],
void => [qw/
is_void isnt_void
/],
flag => [qw/
is_true_flag is_false_flag
/],
as => [qw/
as_array as_list as_array_ref as_hash as_hash_ref
as_first as_first_val as_last as_last_val as_latest
/],
);
use constant MAX_DEPTH => 32;
# Base functions
sub is_ref { ref($_[0]) ? 1 : 0 }
sub is_undef { !defined($_[0]) }
sub is_scalar_ref { ref($_[0]) eq 'SCALAR' || ref($_[0]) eq 'REF' }
sub is_array_ref { ref($_[0]) eq 'ARRAY' }
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.078 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-9f2165ba459b )