Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

validation::class::errors(3pm) [debian man page]

Validation::Class::Errors(3pm)				User Contributed Perl Documentation			    Validation::Class::Errors(3pm)

NAME
Validation::Class::Errors - Error Handling Object for Fields and Classes VERSION
version 7.70 SYNOPSIS
package SomeClass; use Validation::Class; package main; my $class = SomeClass->new; ... # errors at the class-level my $errors = $class->errors ; print $errors->to_string; # errors at the field-level my $field_errors = $user->fields->{name}->{errors} ; print $field_errors->to_string; 1; DESCRIPTION
Validation::Class::Errors is responsible for error handling in Validation::Class derived classes on both the class and field levels respectively. METHODS
new my $self = Validation::Class::Errors->new; add $self = $self->add("houston, we have a problem", "this isn't cool"); all my @list = $self->all; clear $self = $self->clear; count my $count = $self->count; each my $list = $self->each(sub{ ucfirst lc shift }); list my $list = $self->list; find my @matches = $self->find(qr/password/); first my $item = $self->first; my $item = $self->first(qr/password/); join my $string = $self->join; # returns "an error, another error" my $string = $self->join($delimiter); to_string The to_string method stringifies the errors using the specified delimiter or ", " (comma-space) by default. my $string = $self->to_string; # returns "an error, another error" my $string = $self->to_string($delimiter, sub { ucfirst lc shift }); 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::Errors(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)
Man Page