lib/Strehler/FormFu/Validator/FilenameTooLong.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.4% 21 / 22 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Strehler/Element/Article.pm ↑ Summary lib/Strehler/FormFu/Validator/UserUnique.pm »
1 package Strehler::FormFu::Validator::FilenameTooLong;
2 1 $Strehler::FormFu::Validator::FilenameTooLong::VERSION = '1.6.8';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use base 'HTML::FormFu::Validator';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub validate_value {
Subroutine validate_value: called CC=1 SCAR=0.0
Pod undocumented
10 1 my ( $self, $value ) = @_;
11 1 return length $value < 50;
12 }
13  
14 =encoding utf8
15  
16 =head1 NAME
17  
18 Strehler::FormFu::Validator::FilenameTooLong - FormFu Validator for File field in image form.
19  
20 =head1 DESCRIPTION
21  
22 A FormFu Validator to ensure that a user can't load an image with a name longer than 50 characters using the Image entity.
23  
24 Images are not renamed when loaded in Strehler and their names are saved in the database. Database field for image name can't afford names longer than 50 characters.
25  
26 This validator could be loaded using FormFu namespace, but for now I'll keep it in the Strehler distribution.
27  
28 =head1 SYNOPSIS
29  
30 In image form configuration:
31  
32 elements:
33 - type: File
34 name: photo
35 label: Image
36 attributes:
37 class: span5
38 validators:
39 - type: '+Strehler::FormFu::Validator::FilenameTooLong'
40 message: 'Filename is too long'
41  
42 =cut
43  
44  
45 1 1;
« lib/Strehler/Element/Article.pm ↑ Summary lib/Strehler/FormFu/Validator/UserUnique.pm »