Acme-Sub-Parms
view release on metacpan or search on metacpan
lib/Acme/Sub/Parms.pod view on Meta::CPAN
)
=back
=over 4
=item can=method | can="method1 method2 method3 ..."
The 'can' declaration generates a validation requirement that a passed
value has all of the specified
object methods available. This is useful when you want to verify that a
passed object posesses a method you need. This is considered better than
verifying that a specific class was passed.
Note; This B<does not> verify that anything _was_ passed, only that
B<if> something was passed, it posesses the specified object method.
If only one method is being specified, the quote marks around the names
of the method may be omitted.
The 'can' requirements are cumulative - if you specify two or more they
are B<all> required.
Examples:
lib/Acme/Sub/Parms.pod view on Meta::CPAN
=item isa=classname | isa="classname1 classname2 classname3 ..."
The 'isa' declaration generates a validation requirement that a passed
value 'isa' reference to a class or a subclass of one or more of the
specified classes.
This can also be used for checking Perl's built-in reference types such
as 'HASH', 'ARRAY' or 'CODE'.
Note: This B<does not> verify that anything _was_ passed, only that
B<if> something was passed, it 'isa' instance or subclass of the
specified type.
Examples:
# Optional 'HASH'
BindParms : (
my $data = thing [optional, isa=HASH];
)
lib/Acme/Sub/Parms.pod view on Meta::CPAN
=item type=classname | type="type1 type2 type3 ..."
The 'type' declaration generates a validation requirement that a passed
value is an instance of the specified type. This is an B<exact match>
requirement. It does not check for class inheritance or blessed objects.
If you specify a reference type or a class name it must match B<exactly>.
This can also be used for checking Perl's built-in reference types such
as 'HASH', 'ARRAY' or 'CODE'.
Note: This B<does not> verify that anything _was_ passed, only that
B<if> something was passed, it is of the specified type.
Examples:
# Optional 'HASH'
BindParms : (
my $data = thing [optional, type=HASH];
)
# Required 'Mammal' or 'Bacteria' or 'Virus' object
( run in 0.585 second using v1.01-cache-2.11-cpan-5467b0d2c73 )