GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Dancer::Plugin::ValidationClass(3) User Contributed Perl Documentation Dancer::Plugin::ValidationClass(3)

Dancer::Plugin::ValidationClass - Centralized Input Validation For Dancer

version 0.120490

    use Dancer;
    use Dancer::Plugin::ValidationClass;

    post '/authenticate/:login' => sub {
        unless (rules->validate('login', 'password')) {
            return rules->errors->to_string;
        }
    };

    dance;

This plugin provides a convenient wrapper around the Validation::Class module for easy, reusable data validation for your Dancer applications. You don't even need to configure it unless your environment isn't a typical one.

    use Dancer;
    use Dancer::Plugin::ValidationClass;

    post '/authenticate/:login' => sub {
        
        # validate everything
        unless (rules->validate()) {
            return rules->errors->to_string('<br/>');
        }
    };

    dance;

Connection details will be optionally grabbed from your Dancer config file. For example:

    plugins:
      ValidationClass:
        class: Foo::Bar
        
    or
    
    plugins:
      ValidationClass:
        class: lib/Foo/Bar.pm

If no configuration information is given, this plugin will attempt to use the application's name, as set in the configuration file, and assume the class is $AppName::Validation under the lib directory.

This method returns the current Validation::Class instance if one exists.

    1 if rules->validate('login', 'password');
    1 if rules->validate({
        login => 'users:login',
        passw => 'users:password'
    });

    unless (rules->validate('login', 'password')) {
        return rules->error; # arrayref of errors
    }

Al Newkirk <awncorp@cpan.org>

This software is copyright (c) 2010 by awncorp.

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

2012-02-18 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.