view release on metacpan or search on metacpan
lib/Acme/Mitey/Cards/Types.pm view on Meta::CPAN
sprintf '%s did not pass type constraint "%s"',
defined( $_[1] ) ? $_[1] : 'Undef',
$_[0]{name};
}
sub validate {
$_[0]{check}->( $_[1] )
? undef
: $_[0]->get_message( $_[1] );
}
lib/Acme/Mitey/Cards/Types.pm view on Meta::CPAN
For any type constraint B<Foo> the following methods are available:
Foo->check( $value ) # boolean
Foo->get_message( $value ) # error message, even if $value is ok
Foo->validate( $value ) # error message, or undef if ok
Foo->assert_valid( $value ) # returns true, dies if error
Foo->assert_return( $value ) # returns $value, or dies if error
Foo->to_TypeTiny # promotes the object to Type::Tiny
Objects overload stringification to return their name and overload
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/t/01_base.t view on Meta::CPAN
has_attribute_ok $moose,'tired', "Can be sleepy" ;
has_method_ok $moose, (qw(feed play nap sacrifice));
check_sugar_removed_ok $moose;
validate_class $moose => (
attributes => [ qw(foodage happiness tired) ],
methods => [ qw(feed play nap sacrifice) ],
isa => [ 'Acme::Moose' ],
# ensures $thing does not do these roles
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/ppport.h view on Meta::CPAN
uvoffuni_to_utf8_flags||5.019004|
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
valid_utf8_to_uvchr||5.015009|
valid_utf8_to_uvuni||5.015009|
validate_proto|||
validate_suid|||
varname|||
vcmp||5.009000|
vcroak||5.006000|
vdeb||5.007003|
vform||5.006000|
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/pms/RayApp.pm view on Meta::CPAN
use RayApp::Request ();
use DBI ();
sub handler {
my ($dsd, $r) = @_;
if (defined $dsd) {
$dsd->validate_parameters($q)
or die $dsd->errstr;
}
my $dbh = DBI->connect('dbi:Oracle:prod',
'scott', 'tiger',
{ RaiseError => 1, AutoCommit => 0 });
my $q = new RayApp::Request($r);
return ($dbh, $q);
}
1;
Here we first validate parameters against DSD (you can optionally
die or just log an error, depending on how strict you want to be),
we connect to the database, so that the applications get connection
to their database backend, and we use B<RayApp::Request> to get
uniform (for mod_perl and CGI) query object. The values B<$dbh> and
B<$q> are returned and will be passed as argument to the application
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
my $fatal = $args{fatal} || 0;
my $p = $self->{properties};
$self->auto_config_requires if $args{auto};
# validate required fields
foreach my $f (qw(dist_name dist_version dist_author dist_abstract license)) {
my $field = $self->$f();
unless ( defined $field and length $field ) {
my $err = "ERROR: Missing required field '$f' for metafile\n";
if ( $fatal ) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/bench-parm-parsers-ci-novalid.pl view on Meta::CPAN
use strict;
use Acme::Sub::Parms qw(:no_validation :normalize);
use Class::ParmList qw (simple_parms parse_parms);
use Params::Validate qw (validate);
use Benchmark qw(cmpthese);
$Params::Validate::NO_VALIDATION = 1;
print "Bench case insensitive parameter parsing without validation\n";
cmpthese(500000, {
'bindparms' => sub { sub_parms_bind_parms( handle => 'Test', 'thing' => 'something')},
examples/bench-parm-parsers-ci-novalid.pl view on Meta::CPAN
# 'one_step_args' => sub { one_step_args( handle => 'Test', 'thing' => 'something')},
'positional_args' => sub { positional_args( 'Test', 'something')},
'null_sub' => sub { null_sub( handle => 'Test', 'thing' => 'something')},
'simple_parms' => sub { simple_parms_args( handle => 'Test', 'thing' => 'something')},
'parse_parms' => sub { parse_parms_no_valid( handle => 'Test', 'thing' => 'something')},
'params_validate' => sub { params_validate( handle => 'Test', 'thing' => 'something')},
}
);
exit;
############################################################################
sub params_validate {
my ($handle, $thing) = @{(validate(@_, { handle => 1, thing => 1 }))}{'handle','thing'};
}
sub sub_parms_bind_parms {
BindParms : (
my $handle : handle;
view all matches for this distribution
view release on metacpan or search on metacpan
uvoffuni_to_utf8_flags||5.019004|
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
valid_utf8_to_uvchr||5.015009|
valid_utf8_to_uvuni||5.015009|
validate_proto|||
validate_suid|||
varname|||
vcmp||5.009000|
vcroak||5.006000|
vdeb||5.007003|
vform||5.006000|
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Tie/Formatted.pm view on Meta::CPAN
local $_;
return join($", map { sprintf($format, $_) } @args);
}
# Stolen directly from Tie::Comma.
# Invalidate all other hash access.
use subs qw(
STORE EXISTS CLEAR FIRSTKEY NEXTKEY );
*STORE = *EXISTS = *CLEAR = *FIRSTKEY = *NEXTKEY =
sub {
croak "You can only use %format by accessing it";
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-ToFromUnicode.t view on Meta::CPAN
undef,
'back_to_ascii() handles undef'
);
my $text = <<'END_FILE';
This is a test. I want to throw in a bogus Unicode character just to validate that it is preserved.
This is line 2
This is a camel: \x{1F42A}
It should stay a camel.
END_FILE
$text = "
This is a test. I want to throw in a bogus Unicode character just to validate that it is preserved.
This is line 2
This is a camel: \x{1F42A}
It should stay a camel.";
write_text($dir . '/infile.txt', $text);
view all matches for this distribution
view release on metacpan or search on metacpan
whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective
as of the date CC0 was applied by Affirmer to the Work. Should any part of
the License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Web20/Validator.pm view on Meta::CPAN
use Text::ASCIITable;
use Acme::Web20::Validator::Rule;
our $VERSION = 0.01;
__PACKAGE__->mk_accessors(qw(ua is_validated ok_count));
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->_init(@_);
lib/Acme/Web20/Validator.pm view on Meta::CPAN
}
sub clear {
my $self = shift;
$self->ok_count(0);
$self->is_validated(0);
}
sub set_all_rules {
shift->add_rule(Acme::Web20::Validator::Rule->new->plugins);
}
lib/Acme/Web20/Validator.pm view on Meta::CPAN
sub rules_size {
my $self = shift;
return scalar @{$self->{_rules}};
}
sub validate {
my $self = shift;
$self->is_validated and return @{$self->{_rules}};
my $response = $self->_get_remote(@_);
for my $rule (@{$self->{_rules}}) {
unless (ref $rule) {
eval "use $rule";
if ($@) {
warn $@;
next;
}
$rule = $rule->new
}
$rule->validate($response);
$self->ok_count($self->ok_count + 1) if $rule->is_ok;
}
$self->is_validated(1);
return @{$self->{_rules}};
}
sub validation_report {
my $self = shift;
my @rules = $self->is_validated ? @{$self->{_rules}} : $self->validate(@_);
my $t = Text::ASCIITable->new;
$t->setCols('Rule', 'Result');
$t->addRow($_->name, $_->is_ok ? 'Yes!' : 'No') for @rules;
return $t->draw;
}
sub _get_remote {
my $self = shift;
my $url = shift or croak 'usage: $validator->validate($url)';
my $response = $self->ua->get($url);
croak "Could'nt get $url " . $response->status_line
unless $response->is_success;
return $response;
}
lib/Acme/Web20/Validator.pm view on Meta::CPAN
## OR
my $v = Acme::Web20::Validator->new;
$v->set_all_rules;
$v->validate('http://web2.0validator.com/');
print $v->validation_report;
## OR
my $v = Acme::Web20::Validator->new;
$v->set_all_rules;
my @rules = $v->validate('http://web2.0validator.com/');
print $_->name . "\t" . $_->is_ok for (@rules);
=head1 DESCRIPTION
Acme::Web20::Validator is a Web 2.0 Validation module for your website.
lib/Acme/Web20/Validator.pm view on Meta::CPAN
use strict;
use warnings;
use base qw (Acme::Web20::Validator::Rule);
__PACKAGE__->name('Your rule's description');
sub validate {
my $self = shift;
my $res = shift; ## HTTP::Response via LWP
...
$self->is_ok(1) if ...;
}
lib/Acme/Web20/Validator.pm view on Meta::CPAN
$v->set_all_rules;
Adds Acme::Web20::Validator::Rule::* to the validator.
=head2 validate
my @rules = $v->validate($url);
print $rules[0]->name;
print $rules[0]->is_ok ? 'Yes!' : 'No';
Validates the website and returns rules which know the result of each
validation and rule's description.
lib/Acme/Web20/Validator.pm view on Meta::CPAN
=head2 validation_report
print $v->validation_report($url)
## OR
$v->validate($url);
print $v->validation_report;
Returns a validation report formatted by Text::ASCIITable.
=head2 rules_size
lib/Acme/Web20/Validator.pm view on Meta::CPAN
$v->validation_report($url[1]);
$v->clear;
...
Clears validation result in the instance for reusing. If you want to
validate for other rules, create a new instance instead of reusing
them.
=head1 SEE ALSO
L<Module::Pluggable>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/YAPC/Okinawa/ppport.h view on Meta::CPAN
uvoffuni_to_utf8_flags||5.019004|
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
valid_utf8_to_uvchr||5.015009|
valid_utf8_to_uvuni||5.015009|
validate_proto|||
validate_suid|||
varname|||
vcmp||5.009000|
vcroak||5.006000|
vdeb||5.007003|
vform||5.006000|
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activator/Config.pm view on Meta::CPAN
configuration files. These files will be deterministically merged into
one hash. You can then pass this to an application or write it to file.
This module is not an options validator. It uses command line options
as overrides to existing keys in configuration files and DOES NOT
validate them. Unrecognized command line options are ignored and
C<@ARGV> is modified to remove recognized options, leaving barewords
and unrecognized options in place and the same order for a real
options validator (like L<Getopt::Long>). If you do use another
options module, make sure you call C<get_config()> BEFORE you call
their processor, so that C<@ARGV> will be in an appropriate state.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activiti/Rest/Client.pm view on Meta::CPAN
package Activiti::Rest::Client;
use Activiti::Sane;
use Carp qw(confess);
use Moo;
use Data::Util qw(:check :validate);
use JSON qw(decode_json encode_json);
use URI::Escape qw(uri_escape);
use Activiti::Rest::Response;
our $VERSION = "0.1259";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Address/PostCode/Australia.pm view on Meta::CPAN
use 5.006;
use JSON;
use Data::Dumper;
use Address::PostCode::UserAgent;
use Address::PostCode::Australia::Place;
use Address::PostCode::Australia::Params qw(validate);
use Moo;
use namespace::autoclean;
extends 'Address::PostCode::UserAgent';
lib/Address/PostCode/Australia.pm view on Meta::CPAN
# PRIVATE METHODS
sub _get_url {
my ($keys, $values) = @_;
validate($keys, $values);
my $url = $BASE_URL;
if (exists $values->{'postcode'}) {
$url .= sprintf("?q=%d", $values->{'postcode'});
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AddressBook/Config.pm view on Meta::CPAN
foreach (keys %{$self->{db2generic}}) {
if (! exists $self->{db}->{$_}->{driver}) {
$self->{db}->{$_}->{driver} = $_;
}
}
$self->validate();
return $self;
}
#----------------------------------------------------------------
sub validate {
my $self=shift;
my $class = ref $self || croak "Not a method call.";
my ($db);
foreach $db (keys %{$self->{db}}) {
next unless ($self->{db}->{$db}->{key_fields});
view all matches for this distribution
view release on metacpan or search on metacpan
# Hide Ado::Control methods and attributes from router.
$routes->hide(
qw(
debug config require_format list_for_json
validate_input
)
);
foreach my $route (@$config_routes) {
my ($pattern, $over, $to, $via, $params) =
view all matches for this distribution
view release on metacpan or search on metacpan
details on what options you may override.
Only the B<L<get_value>> function was truly needed. But the other I<get>
methods were added for a couple of reasons. First to make it clear in your code
what type of value is being returned and provide the ability to do validation of
the B<tag>'s value without having to validate it yourself! Another benifit was
that it drastically reduced the number of exposed I<Get Options> needed for this
module. Making it easier to use.
Finally when these extra methods apply their validation, if the B<tag>'s value
fails the test, it treats it as a I<B<tag> not found> situation as described
view all matches for this distribution
view release on metacpan or search on metacpan
dyncall/ToDo view on Meta::CPAN
1.5:
----
- test atpcs thumb on arm and verify if ellipsis and C++ thiscalls work, if so adapt doc appendix
- test eabi thumb on arm and verify if ellipsis and C++ thiscalls work, if so adapt doc appendix
- new platform matrix
* check dark green cells and validate in general
- test/thunk win/x64 doesn't output anything decent for stack test (neither sigsegv nor output), which can create a problem for test log file as it'll mess with the subsequent test's output)
- remove test/gen-masm alltogether
- test code: add sparc tests for when out of register windows, meaning multiple layers deep in the call stack
- support platforms without shared libraries so they can be built by just typing `./configure;make` (e.g. minix < 3.2.1)
* also make sure minix with shared library support builds and works in general (>= 3.2.1) as well as ELF on Minix (>= 3.2.0) to begin with (as that's the base, and we only test on 3.1.8 so far)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Agent/TCLI/Command.pm view on Meta::CPAN
return (\@aliases);
} # End Aliases
#sub RawCommand {
# my $self = shift;
## my %cmd = validate( @_, {
## help_text => { type => Params::Validate::SCALAR }, #required
## usage => { type => Params::Validate::SCALAR }, #required
## topic => { optional => 1, type => Params::Validate::SCALAR },
## name => { type => Params::Validate::SCALAR }, #required
## command => { type => ( Params::Validate::SCALAR | Params::Validate::CODEREF ) }, #required
lib/Agent/TCLI/Command.pm view on Meta::CPAN
}
=item Validate( <kernel>, <request>, <package> )
Returns a hash keyed on parameter after the arguments have been parsed
by Getopt::Lucid and validated by FormValidator::Simple as per the constraints
specified in the Parameter or Command definitions.
Will respond itself if there is an error and return nothing.
Takes the POE Kernel, the Request, and the Package as args.
lib/Agent/TCLI/Command.pm view on Meta::CPAN
}
=item BuildCommandLine( <param_hash>, <with_cmd> )
Returns a hash keyed on parameter after the arguments have been parsed
by Getopt::Lucid and validated by FormValidator::Simple as per the constraints
specified in the Parameter or Command definitions.
Will respond itself if there is an error and return nothing.
Takes the POE Kernel, the Request, and the Package as args.
view all matches for this distribution
view release on metacpan or search on metacpan
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
view all matches for this distribution
view release on metacpan or search on metacpan
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
view all matches for this distribution
view release on metacpan or search on metacpan
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion.pm view on Meta::CPAN
die "has: $name - isa maybe Aion::Type"
if !UNIVERSAL::isa($isa, 'Aion::Type');
$feature->{isa} = $isa;
$construct->{get} = "\$Aion::META{'$cls'}{feature}{$name}{isa}->validate(do{$construct->{get}}, 'Get feature `$name`')" if ISA =~ /ro|rw/;
$construct->{set} = "\$Aion::META{'$cls'}{feature}{$name}{isa}->validate(\$val, 'Set feature `$name`'); $construct->{set}" if ISA =~ /wo|rw/;
}
# coerce => 1
sub coerce_aspect {
my ($cls, $name, $coerce, $construct, $feature) = @_;
lib/Aion.pm view on Meta::CPAN
$construct->{lazy_trigger} //= "";
$construct->{lazy} = "\$self->{$name} = \$self->${name}__DEFAULT%(lazy_trigger)s if !exists \$self->{$name}; ";
$construct->{get} = "%(lazy)s$construct->{get}";
} else {
$feature->{opt}{isa}->validate($default, $name) if $feature->{opt}{isa};
$feature->{default} = $default;
}
}
sub _trigger_init {
view all matches for this distribution