The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XAS::Service::Profiles - A class for creating standard validation profiles.

SYNOPSIS

 use XAS::Service::Profiles;
 use XAS::Service::Profiles::Search;

 my $params = {
     start => 0,
     limit => 25,
     sort => qq/[{"field":"server',"direction":"DESC"}]/
 };

 my @fields = [qw(id server queue requestor typeofrequest status startdatetime)];

 my $search  = XAS::Service::Profiles::Search->new(\@fields);
 my $profile = XAS::Service::Profiles->new($search);

 my $results = $profile->check($params, 'pager');

 if ($results->has_invalid) {

     my @invalids = $results->invalid;

     foreach my $invalid (@invalids) {

         printf("%s %s\n", $invalid, $results->msgs->{$invalid});

     }

 }

DESCRIPTION

This module combines multiple validation profiles into one Data::FormValidator validator.

METHODS

new($hash, ...)

This method initilizes the validator by combining multiple profiles.

$hash

A hash of validation profiles, there may be more then one. They are combined such that later profiles may overwrite earlier ones.

OVERRIDES

This module overrides the following methods in Data::FormValidator::Results.

_generate_msgs

For whatever reason, it wouldn't find error messages for constraints. Not sure why. No bugs reports have been filed about this. But it wouldn't work for me as documented, now it does.

_error_msg_fmt

A supporting routine for _generate_msgs(). Allowed it to be referenced from $self.

prefix_hash

A supporting routine for _generate_msgs(). Allowed it to be referenced from $self.

SEE ALSO

Data::FormValidator
XAS::Service
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2016 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.