The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Message::Stack::Parser::DataVerifier - Add messages to a Message::Stack from a Data::Verifier results

VERSION

version 0.06

SYNOPSIS

  use Message::Stack::Parser::DataVerifier;

  my $dv = Data::Verifier->new;

  my $dv_results = $dv->verify;

  my $scope = 'login';

  # Pass a Data::Verifier::Results object to parse.
  my $ms = Message::Stack->new;
  Message::Stack::Parser::DataVerifier::parse(
    $ms,
    $scope,
    $dv_results
  );

  # and now $ms has messages based on $dv_results

DESCRIPTION

This class will add a message to the provided Message::Stack for every missing or invalid field in a Data::Verifier::Result.

MAPPING

The fields are mapped from Data::Verifier into a Message in the following way:

Missing Fields

msgid = "missing_$fieldname"
scope = The passed in scope
subject = $fieldname
level = 'error'

Invalid Fields

msgid = "invalid_$fieldname"
scope = The passed in scope
subject = $fieldname
level = 'error'
params = The original value (that provided by the user) for the field.

METHODS

parse ($stack, $scope, $results)

Adds messages from the provided $results to the provided $stack under the $scope that is passed in.

AUTHOR

Cory G Watson <gphat@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Cold Hard Code, LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.