Declare::Constraints::Simple::Library::OO(3pm)

Declare::Constraints::Simple::Library::OO3pm

Oo constraints

Usage

  # accept objects or classes
  my $object_or_class = Or( IsObject, IsClass );
  # valid on objects with all methods
  my $proper_object = And( IsObject, 
                           HasMethods( qw(foo bar) ));
  # validate against date objects
  my $is_date_object = IsA('DateTime');

Overview

This library contains the constraints for validating parameters in an object oriented manner.

Constraints

HasMethods(@methods)

Returns true if the value is an object or class that "can" all the specified @methods.

The stack or path part of "HasMethods" looks like "HasMethods[$method]" where $method is the first found missing method.

IsA(@classes)

Is true if the passed object or class is a subclass of one of the classes mentioned in @classes.

IsClass()

Valid if value is a loaded class.

IsObject()

True if the value is blessed.

Releases

4 releases since Debian 10 (Buster); the text changed 1 time.

  1. 10
  2. 11–13

Author

Robert 'phaylon' Sedlacek "<[email protected]>"

From libdeclare-constraints-simple-perl 0.03-1.1 in Debian 13 (Trixie). Parsed by carta from the page's man source.