1Declare::Constraints::SUismeprleC:o:nLtirbirbauDrteyec:dl:aOPrOee(r:3l:)CDooncsutmreanitnattsi:o:nSimple::Library::OO(3)
2
3
4
6 Declare::Constraints::Simple::Library::OO - OO Constraints
7
9 # accept objects or classes
10 my $object_or_class = Or( IsObject, IsClass );
11
12 # valid on objects with all methods
13 my $proper_object = And( IsObject,
14 HasMethods( qw(foo bar) ));
15
16 # validate against date objects
17 my $is_date_object = IsA('DateTime');
18
20 This library contains the constraints for validating parameters in an
21 object oriented manner.
22
24 HasMethods(@methods)
25 Returns true if the value is an object or class that "can" all the
26 specified @methods.
27
28 The stack or path part of "HasMethods" looks like "HasMethods[$method]"
29 where $method is the first found missing method.
30
31 IsA(@classes)
32 Is true if the passed object or class is a subclass of one of the
33 classes mentioned in @classes.
34
35 IsClass()
36 Valid if value is a loaded class.
37
38 IsObject()
39 True if the value is blessed.
40
42 Declare::Constraints::Simple, Declare::Constraints::Simple::Library
43
45 Robert 'phaylon' Sedlacek "<phaylon@dunkelheit.at>"
46
48 This module is free software, you can redistribute it and/or modify it
49 under the same terms as perl itself.
50
51
52
53perl v5.32.1 2D0e2c1l-a0r1e-:2:7Constraints::Simple::Library::OO(3)