Test::Data::Scalar(3pm) | User Contributed Perl Documentation | Test::Data::Scalar(3pm) |
Test::Data::Scalar -- test functions for scalar variables
use Test::Data qw(Scalar);
This modules provides a collection of test utilities for scalar variables. Load the module through Test::Data.
How do I test this?
sub dualvar_ok ($;$) { my $ok = Scalar::Util::dualvar( $_[0] ); my $name = $_[1] || 'Scalar is a dualvar';
$Test->ok( $ok, $name ); $Test->diag("Expected a dualvar, didn't get it\n") unless $ok; }
At the moment, a number is just a string of digits. This needs work.
If you put something that isn't a number into UPPER or LOWER, Perl will try to make it into a number and you may get unexpected results.
(Tainted values may seem like a not-Ok thing, but remember, when you use taint checking, you want Perl to taint data, so you should have a test to make sure it happens.)
* add is_a_filehandle test
* add is_vstring test
Scalar::Util, Test::Data, Test::Data::Array, Test::Data::Function, Test::Data::Hash, Test::Builder
This source is in Github:
https://github.com/briandfoy/test-data
brian d foy, "<bdfoy@cpan.org>"
Copyright © 2002-2021, brian d foy <bdfoy@cpan.org>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
2021-01-17 | perl v5.32.0 |