• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Dancer/Plugin/H03-May-2022-15740

t/H18-Feb-2012-5538

LICENSEH A D18-Feb-201217.9 KiB380292

MANIFESTH A D18-Feb-2012167 1211

META.ymlH A D18-Feb-2012472 1918

Makefile.PLH A D18-Feb-20121 KiB5338

READMEH A D18-Feb-20122.1 KiB8260

dist.iniH A D18-Feb-2012526 2827

README

1NAME
2    Dancer::Plugin::ValidationClass - Centralized Input Validation For
3    Dancer
4
5VERSION
6    version 0.120490
7
8SYNOPSIS
9        use Dancer;
10        use Dancer::Plugin::ValidationClass;
11
12        post '/authenticate/:login' => sub {
13            unless (rules->validate('login', 'password')) {
14                return rules->errors->to_string;
15            }
16        };
17
18        dance;
19
20DESCRIPTION
21    This plugin provides a convenient wrapper around the Validation::Class
22    module for easy, reusable data validation for your Dancer applications.
23    You don't even need to configure it unless your environment isn't a
24    typical one.
25
26ADVANCED SYNOPSIS
27        use Dancer;
28        use Dancer::Plugin::ValidationClass;
29
30        post '/authenticate/:login' => sub {
31
32            # validate everything
33            unless (rules->validate()) {
34                return rules->errors->to_string('<br/>');
35            }
36        };
37
38        dance;
39
40CONFIGURATION
41    Connection details will be optionally grabbed from your Dancer config
42    file. For example:
43
44        plugins:
45          ValidationClass:
46            class: Foo::Bar
47
48        or
49
50        plugins:
51          ValidationClass:
52            class: lib/Foo/Bar.pm
53
54    If no configuration information is given, this plugin will attempt to
55    use the application's name, as set in the configuration file, and assume
56    the class is $AppName::Validation under the lib directory.
57
58METHODS
59  rules
60    This method returns the current Validation::Class instance if one
61    exists.
62
63        1 if rules->validate('login', 'password');
64        1 if rules->validate({
65            login => 'users:login',
66            passw => 'users:password'
67        });
68
69        unless (rules->validate('login', 'password')) {
70            return rules->error; # arrayref of errors
71        }
72
73AUTHOR
74    Al Newkirk <awncorp@cpan.org>
75
76COPYRIGHT AND LICENSE
77    This software is copyright (c) 2010 by awncorp.
78
79    This is free software; you can redistribute it and/or modify it under
80    the same terms as the Perl 5 programming language system itself.
81
82