GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Declare::Constraints::Simple::Library::Scalar(3) User Contributed Perl Documentation Declare::Constraints::Simple::Library::Scalar(3)

Declare::Constraints::Simple::Library::Scalar - Scalar Constraints

  # match one of a set of regexes
  my $some_regexes = Matches(qr/foo/, qr/bar/);

  # allow only defined values
  my $is_defined = IsDefined;

  # between 5 and 50 chars
  my $five_to_fifty = HasLength(5, 50);

  # match against a set of values
  my $command_constraint = IsOneOf(qw(create update delete));

  # check for trueness
  my $is_true = IsTrue;

  # simple equality
  my $is_foo = IsEq('foo');

This library contains all constraints to validate scalar values.

  my $c = Matches(qr/foo/, qr/bar/);

If one of the parameters matches the expression, this is true.

True if the value is defined.

Is true if the value has a length above $min (which defaults to 1> and, if supplied, under the value of $max. A simple

  my $c = HasLength;

checks if the value has a length of at least 1.

True if one of the @values equals the passed value. "undef" values work with this too, so

  my $c = IsOneOf(1, 2, undef);

will return true on an undefined value.

True if the value evulates to true in boolean context.

Valid if the value is "eq" the $comparator.

Declare::Constraints::Simple, Declare::Constraints::Simple::Library

Robert 'phaylon' Sedlacek "<phaylon@dunkelheit.at>"

This module is free software, you can redistribute it and/or modify it under the same terms as perl itself.
2006-09-11 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.