CGI::ValidOp::Check::text - CGI::ValidOp::Check module to validate text


CGI-ValidOp documentation Contained in the CGI-ValidOp distribution.

Index


Code Index:

NAME

Top

CGI::ValidOp::Check::text - CGI::ValidOp::Check module to validate text

DESCRIPTION

Top

default

Fails if incoming value contains characters other than Perl's character classes \w, \s, and: ! " ' ( ) * , - . / : ; ? @ \

word

Fails if value contains anything other an Perl's "word" character class ([a-zA-Z0-9_]).

words

Like word above, but can contain spaces as well.

liberal

Expands on default allowing $ = ~ +

hippie

Even more permissive than liberal, including # { } [ ] ^ _ $

Still does not allow <tags> to be embedded though...

AUTHOR

Top

Randall Hansen <legless@cpan.org>

COPYRIGHT

Top


CGI-ValidOp documentation Contained in the CGI-ValidOp distribution.

package CGI::ValidOp::Check::text;
use strict;
use warnings;

use base qw/ CGI::ValidOp::Check /;

sub default {
    (
        qr#^[\w\s\(\*\.\\\?,!"'/:;@&%)-]+$#,
        q#Only letters, numbers, and the following punctuation are allowed for $label: ! " ' ( ) * , - .  / : ; ? \ @ & %#,
    )
}

sub word {
    (
        qr/^\w+$/,
        q#Only one word is allowed for $label#,
    )
}

sub words {
    (
        qr/^[\w -]+$/,
        q#Only words are allowed for $label#,
    )
}

sub liberal {
    (
        qr#^[\w\s\(\*\.\\\?,!"'/:;&=%~\+\@\$)\#-]+$#,
        q|Only letters, numbers, and the following punctuation are allowed for $label: ! " ' ( ) * , - . / : ; & = % ~ + ? \ @ $ #|,
    )
}

sub hippie {
    (
        qr{^[\w\s\(\*\.\\\?#,{}^_[\]!"'/:;&=%~\+\@\$)-]+$},
        q{Only letters, numbers, and the following punctuation are allowed for $label: ! " ' ( ) * , - . / : ; & = % ~ + ?  \ @ # { } [ ] ^ _ $},
    )
}

1;

__END__

# $Id: text.pm 75 2005-01-14 05:49:20Z soh $