---
name: "Test::Data::Scalar"
section: "3pm"
platform: "linux"
package: "libtest-data-perl"
version: "1.248-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Test::Data::Scalar"
---

# Test::Data::Scalar(3pm)

## NAME

Test::Data::Scalar -- test functions for scalar variables

## SYNOPSIS

```
        use Test::Data qw(Scalar);
```

## DESCRIPTION

This modules provides a collection of test utilities for scalar variables.  Load the module through Test::Data.

### Functions

- blessed\_ok( SCALAR )

  Ok if the SCALAR is a blessed reference.

- defined\_ok( SCALAR )

  Ok if the SCALAR is defined.

- undef\_ok( SCALAR )

  Ok if the SCALAR is undefined.

- dualvar\_ok( SCALAR )

  Ok if the scalar is a dualvar.

  How do I test this?

- greater\_than( SCALAR, BOUND )

  Ok if the SCALAR is numerically greater than BOUND.

- length\_ok( SCALAR, LENGTH )

  Ok if the length of SCALAR is LENGTH.

- less\_than( SCALAR, BOUND )

  Ok if the SCALAR is numerically less than BOUND.

- maxlength\_ok( SCALAR, LENGTH )

  Ok is the length of SCALAR is less than or equal to LENGTH.

- minlength\_ok( SCALAR, LENGTH )

  Ok is the length of SCALAR is greater than or equal to LENGTH.

- number\_ok( SCALAR )

  Ok if the SCALAR is a number ( or a string that represents a number ).

  At the moment, a number is just a string of digits.  This needs work.

- number\_between\_ok( SCALAR, LOWER, UPPER )

  Ok if the number in SCALAR sorts between the number in LOWER and the number in UPPER, numerically.

  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.

- string\_between\_ok( SCALAR, LOWER, UPPER )

  Ok if the string in SCALAR sorts between the string in LOWER and the string in UPPER, ASCII-betically.

- readonly\_ok( SCALAR )

  Ok is the SCALAR is read-only.

- ref\_ok( SCALAR )

  Ok if the SCALAR is a reference.

- ref\_type\_ok( REF1, REF2 )

  Ok if REF1 is the same reference type as REF2.

- strong\_ok( SCALAR )

  Ok is the SCALAR is not a weak reference.

- tainted\_ok( SCALAR )

  Ok is the SCALAR is tainted.

  (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.)

- untainted\_ok( SCALAR )

  Ok if the SCALAR is not tainted.

- weak\_ok( SCALAR )

  Ok if the SCALAR is a weak reference.

## TO DO

\* add is\_a\_filehandle test

\* add is\_vstring test

## SEE ALSO

Scalar::Util, Test::Data, Test::Data::Array, Test::Data::Function, Test::Data::Hash, Test::Builder

## SOURCE AVAILABILITY

This source is in Github:

```
        https://github.com/briandfoy/test-data
```

## AUTHOR

brian d foy, `"<briandfoy@pobox.com>"`

## COPYRIGHT AND LICENSE

Copyright © 2002-2025, brian d foy \<briandfoy@pobox.com\>. 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.
