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


Manual Reference Pages  -  DECLARE::CONSTRAINTS::SIMPLE::LIBRARY::GENERAL (3)

.ds Aq ’

NAME

Declare::Constraints::Simple::Library::General - General Constraints

CONTENTS

SYNOPSIS



  # custom error messages
  my $constraint =
    And( Message( You need to specify a Value, IsDefined ),
         Message( The specified Value is not an Int, IsInt ));

  # build results
  my $valid   = ReturnTrue;
  my $invalid = ReturnFalse(Just because);



DESCRIPTION

This library is meant to contain those constraints and constraint-like elements that apply generally to the whole framework.

CONSTRAINTS

Message($message, CW$constraint)

Overrides the message set on the result object for failures in $constraint. For example:



  my $message = How hard is it to give me a number?;
  my $constraint = Message($message, IsNumber);

  my $result = $constraint->(duh...);
  print $result->message, "\n";



The Message constraint overrides the error message returned by it’s whole subtree, however, the Message specification nearest to the point of failure will win. So while this



  my $constraint = Message( Foo,
                            IsArrayRef( Message( Bar, IsInt )));

  my $result = $constraint->([I am not an Integer]);
  print $result->message;



will print Bar, this



  my $result = $constraint->(I\m not even an ArrayRef);
  print $result->message;



will output Foo.

Scope($name, CW$constraint)

Executes the passed $constraint in a newly generated scope named $name.

SetResult($scope, CW$name, CW$constraint)

Stores the result ov an evaluation of $constraint in $scope under $name.

IsValid($scope, CW$name)

Returns a true result if the result $name, which has to have been stored previously in the scope named $scope, was valid.

ReturnTrue()

Returns a true result.

    ReturnFalse($msg)

Returns a false result containing $msg as error message.

SEE ALSO

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

AUTHOR

Robert ’phaylon’ Sedlacek <phaylon@dunkelheit.at>

LICENSE AND COPYRIGHT

This module is free software, you can redistribute it and/or modify it under the same terms as perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DECLARE::CONSTRAINTS::SIMPLE::LIBRARY::GENERAL (3) 2006-09-14

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