DBIx::Class::Valiant::Validator::Result - Verify a DBIC related result
package Example::Schema::Result::Person; use base 'Example::Schema::Result'; __PACKAGE__->load_components(qw/ Valiant::Result Core /); __PACKAGE__->table("person"); __PACKAGE__->add_columns( id => { data_type => 'bigint', is_nullable => 0, is_auto_increment => 1 }, username => { data_type => 'varchar', is_nullable => 0, size => 48 }, first_name => { data_type => 'varchar', is_nullable => 0, size => 24 }, last_name => { data_type => 'varchar', is_nullable => 0, size => 48 }, password => { data_type => 'varchar', is_nullable => 0, size => 64, }, ); __PACKAGE__->might_have( profile => 'Example::Schema::Result::Profile', { 'foreign.person_id' => 'self.id' } ); __PACKAGE__->validates(profile => (result=>+{validations=>1}, on=>'profile' ));
Trigger validations on a related result and aggregates any errors as nested errors on the parent class.
This validator supports the following attributes:
Boolean. Default is 0 ('false'). Used to trigger validations on the related result.
Please keep in mind these errors will be localized to the associated object, not on the current object.
String or translation tag of the error when the result is not valid. This will be in addition to any errors nested from the related result.
This validator supports the follow shortcut forms:
validates attribute => ( result => 1, ... );
Which is the same as:
validates attribute => ( result => { validations => 1, } );
Which is a shortcut when you wish to run validations on the related rows
This validator supports all the standard shared parameters: if, unless, message, strict, allow_undef, allow_blank.
if
unless
message
strict
allow_undef
allow_blank
Valiant, Valiant::Validator, Valiant::Validator::Each.
See Valiant
To install Valiant, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Valiant
CPAN shell
perl -MCPAN -e shell install Valiant
For more information on module installation, please visit the detailed CPAN module installation guide.