validation::class::backwards(3pm) [debian man page]
Validation::Class::Backwards(3pm) User Contributed Perl Documentation Validation::Class::Backwards(3pm)NAME
Validation::Class::Backwards - Backwards-Compatibility Layer for Validation::Class
VERSION
version 7.70
SYNOPSIS
package SomeClass;
use Validation::Class;
package main;
my $class = SomeClass->new;
...
1;
DESCRIPTION
Validation::Class::Backwards is responsible for providing deprecated functionality to the Validation::Class::Prototype layer whilst clearly
remaining separate via namespacing.
Note: The methods described here will eventually become obsolete and cease to exist. Please review the namespace occasionally and adjust
your code accordingly. Using methods defined here will generate warnings unless you unset the $ENV{'VALIDATION_CLASS_BC_WARNING'}
environment variable.
METHODS
error
DEPRECATING:
The error method is used to set and/or retrieve errors encountered during validation. The error method with no parameters returns the error
message object which is an arrayref of error messages stored at class-level.
# set errors at the class-level
return $self->error('this isnt cool', 'unknown somethingorother');
# set an error at the field-level, using the field ref (not field name)
$self->error($field_object, "i am your error message");
# return all errors encountered/set as an arrayref
my $all_errors = $self->error();
RECOMMENDED:
# see Validation::Class::Errors
# set errors at the class-level
return $self->errors->add(...);
# set an error at the field-level
$self->fields->{$field_name}->{errors}->add(...);
# return all errors encountered
my $list = $self->errors->list;
AUTHOR
Al Newkirk <anewkirk@ana.io>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Al Newkirk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-28 Validation::Class::Backwards(3pm)
Check Out this Related Man Page
Class::ErrorHandler(3pm) User Contributed Perl Documentation Class::ErrorHandler(3pm)NAME
Class::ErrorHandler - Base class for error handling
SYNOPSIS
package Foo;
use base qw( Class::ErrorHandler );
sub class_method {
my $class = shift;
...
return $class->error("Help!")
unless $continue;
}
sub object_method {
my $obj = shift;
...
return $obj->error("I am no more")
unless $continue;
}
package main;
use Foo;
Foo->class_method or die Foo->errstr;
my $foo = Foo->new;
$foo->object_method or die $foo->errstr;
DESCRIPTION
Class::ErrorHandler provides an error-handling mechanism that's generic enough to be used as the base class for a variety of OO classes.
Subclasses inherit its two error-handling methods, error and errstr, to communicate error messages back to the calling program.
On failure (for whatever reason), a subclass should call error and return to the caller; error itself sets the error message internally,
then returns "undef". This has the effect of the method that failed returning "undef" to the caller. The caller should check for errors by
checking for a return value of "undef", and calling errstr to get the value of the error message on an error.
As demonstrated in the SYNOPSIS, error and errstr work as both class methods and object methods.
USAGE
Class->error($message)
$object->error($message)
Sets the error message for either the class Class or the object $object to the message $message. Returns "undef".
Class->errstr
$object->errstr
Accesses the last error message set in the class Class or the object $object, respectively, and returns that error message.
LICENSE
Class::ErrorHandler is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR & COPYRIGHT
Except where otherwise noted, Class::ErrorHandler is Copyright 2004 Benjamin Trott, cpan@stupidfool.org. All rights reserved.
perl v5.8.7 2005-07-20 Class::ErrorHandler(3pm)