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/Surf.pm view on Meta::CPAN
Aion::Format::Url::to_url_params $query;
}
my $request = HTTP::Request->new($method => $url);
my $validate_data = sub {
die "surf: data has already been provided!" if defined $data;
die "surf: sended data in $method!" if $method =~ /^(HEAD|GET)\z/;
};
# УÑÑанавливаем даннÑе
my $json = delete $set{json};
$json = $data, undef $data if not defined $json and ref $data eq "HASH";
if(defined $json) {
$validate_data->();
$request->header('Content-Type' => 'application/json; charset=utf-8');
$data = Aion::Format::Json::to_json $json;
utf8::encode($data) if utf8::is_utf8($data);
$request->content($data);
}
my $form = delete $set{form};
$form = $data, undef $data if not defined $form and ref $data eq "ARRAY";
if(defined $form) {
$validate_data->();
$data = 1;
$request->header('Content-Type' => 'application/x-www-form-urlencoded');
$request->content(Aion::Format::Url::to_url_params $form);
}
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/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
has 'mtr_uri' => (is => 'ro', default => MTR_URI);
has 'loc_uri' => (is => 'ro', default => LOC_URI);
has 'baseurl' => (is => 'rw', trigger => \&Akamai::Open::Debug::debugger);
has 'last_error'=> (is => 'rw');
sub validate_base_url {
my $self = shift;
my $base = $self->baseurl();
$self->debug->logger->debug('validating baseurl');
$base =~ s{/$}{} && $self->baseurl($base);
return;
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
foreach my $f (qw/dig mtr locations/) {
before $f => sub {
my $self = shift;
my $param = @_;
$self->validate_base_url();
my $uri = $self->baseurl() . $self->tools_uri();
$self->debug->logger->debug("before hook called for $f") if($self->debug->logger->is_debug());
#XXX create a useful scheme for REST methods
view all matches for this distribution
view release on metacpan or search on metacpan
script/album view on Meta::CPAN
my $self = bless({}, $pkg);
if ( defined($file) ) {
$self->load($file);
if ( ($self->{_version} || 1) != CACHE_VERSION ) {
warn("Incompatible cache version " . $self->version .
" -- invalidated\n") if $verbose;
$self = bless({}, $pkg);
}
}
$self->{_version} = CACHE_VERSION;
$self;
script/album view on Meta::CPAN
$info = undef;
eval {
require $file;
};
if ( $@ ) {
warn("Illegal cache -- invalidated\n") if $verbose;
return;
}
@{$self}{keys(%$info)} = values(%$info);
}
view all matches for this distribution
view release on metacpan or search on metacpan
bin/analogize.pl view on Meta::CPAN
'include_given',
'include_nulls',
'linear',
'help|?',
) or pod2usage(2);
_validate_args(%args);
my @print_methods;
if($args{print}){
@print_methods = split ',', $args{print};
}
bin/analogize.pl view on Meta::CPAN
say "$count out of " . $test->size . " correct";
return;
}
sub _validate_args {
my %args = @_;
if($args{help}){
pod2usage(1);
}
my $errors = '';
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
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
utilize|||
uvchr_to_utf8_flags||5.007003|
uvchr_to_utf8|||
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
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
utilize|||
uvchr_to_utf8_flags||5.007003|
uvchr_to_utf8|||
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
validate_suid|||
varname|||
vcmp||5.009000|
vcroak||5.006000|
vdeb||5.007003|
vdie_common|||
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
use AutoLoader;
use Algorithm::CP::IZ::Int;
use Algorithm::CP::IZ::RefVarArray;
use Algorithm::CP::IZ::RefIntArray;
use Algorithm::CP::IZ::ParamValidator qw(validate);
use Algorithm::CP::IZ::ValueSelector;
use Algorithm::CP::IZ::CriteriaValueSelector;
use Algorithm::CP::IZ::NoGoodSet;
use Algorithm::CP::IZ::SearchNotify;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $self = shift;
my $vars = $self->{_vars};
for my $v (@$vars) {
# we must check existence of variable for global destruction.
$v->_invalidate if (defined $v);
}
Algorithm::CP::IZ::cs_end();
$Instances--;
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub restore_context_until {
my $self = shift;
my $label = shift;
validate([$label], ["I"],
"Usage: restore_context_until(int_label)");
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("restore_context_until: invalid label");
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub forget_save_context_until {
my $self = shift;
my $label = shift;
validate([$label], ["I"],
"Usage: forget_save_context_until(int_label)");
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("forget_save_context_until: invalid label");
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub accept_context_until {
my $self = shift;
my $label = shift;
validate([$label], ["I"],
"Usage: accept_context_until(int_label)");
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("accept_context_until: invalid label");
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub backtrack {
my $self = shift;
my ($var, $index, $handler) = @_;
validate([$var, $index, $handler], ["oV", "I", "C"],
"Usage: backtrack(variable, index, code_ref)");
$var = _safe_var($var) if (defined($var));
my $id = $Backtrack_id++;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
$self->{_backtrack_code_ref});
}
sub _create_int_from_min_max {
my ($self, $min, $max) = @_;
validate([$min, $max], ["I", "I"], "Usage: create_int(min, max), create_int(constant), create_int([domain])");
return Algorithm::CP::IZ::cs_createCSint(int($min), int($max));
}
sub _create_int_from_domain {
my ($self, $int_array) = @_;
validate([$int_array], ["iA1"], "Usage: create_int(min, max), create_int(constant), create_int([domain])");
my $parray = Algorithm::CP::IZ::alloc_int_array([map { int($_) } @$int_array]);
my $ptr = Algorithm::CP::IZ::cs_createCSintFromDomain($parray, scalar @$int_array);
Algorithm::CP::IZ::free_array($parray);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
$self->_register_variable($ret);
return $ret;
}
sub _validate_search_params {
my ($var_array, $params) = @_;
return 1 unless (defined($params));
return 0 unless (ref $params eq 'HASH');
my %checker = (
FindFreeVar => sub {
my $x = shift;
if (ref $x) {
validate([$x], ["C"], "search: FindFreeVar must be a number or a coderef");
}
else {
validate([$x], ["I"], "search: FindFreeVar must be a number or a coderef");
}
},
Criteria => sub {
my $x = shift;
validate([$x], ["C"], "search: Criteria must be a coderef");
return 1;
},
MaxFail => sub {
my $x = shift;
validate([$x], ["I"], "search: MaxFail must be an integer");
},
ValueSelectors => sub {
my $x = shift;
validate([$x], [
sub {
my $vs = shift;
return unless (ref $vs eq 'ARRAY'
&& scalar @$vs == scalar @$var_array);
for my $obj (@$vs) {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
1;
}], "search: ValueSelectos must be a arrayref of Algorithm::CP::IZ::ValueSelector instance for each variables");
},
MaxFailFunc => sub {
my $x = shift;
validate([$x], ["C"], "search: MaxFailFunc must be a coderef");
},
NoGoodSet => sub {
my $x = shift;
validate([$x], [
sub {
my $ngs = shift;
return blessed($ngs) && $ngs->isa("Algorithm::CP::IZ::NoGoodSet");
}], "search: NoGoodSet must be a instance of Algorithm::CP::IZ::NoGoodSet");
},
Notify => sub {
my $x = shift;
validate([$x], [
sub {
my $notify = shift;
return 1 if (ref $notify eq 'HASH');
return 1 if (blessed($notify));
return 0;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub search {
my $self = shift;
my $var_array = shift;
my $params = shift;
validate([$var_array, $params], ["vA0", sub {_validate_search_params($var_array, @_)}],
"Usage: search([variables], {key=>value,...}");
my $array = [map { $$_ } @$var_array];
my $max_fail = -1;
my $find_free_var_id = 0;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
$find_free_var_func,
$max_fail);
}
}
sub _validate_find_all_params {
my $params = shift;
return 1 unless (defined($params));
return 0 unless (ref $params eq 'HASH');
my %checker = (
FindFreeVar => sub {
my $x = shift;
if (ref $x) {
validate([$x], ["C"], "find_all: FindFreeVar must be a number or coderef");
}
else {
validate([$x], ["I"], "search: FindFreeVar must be a number or coderef");
}
},
);
my @keys = sort keys %$params;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $self = shift;
my $var_array = shift;
my $found_func = shift;
my $params = shift;
validate([$var_array, $found_func, $params],
["vA0", "C", \&_validate_find_all_params],
"find_all: usage: find_all([vars], &callback_func, {params})");
my $array = [map { $$_ } @$var_array];
my $find_free_var_id = 0;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub create_no_good_set {
my $self = shift;
my ($var_array, $prefilter, $max_no_good, $ext) = @_;
$max_no_good ||= 0;
validate([$var_array, $prefilter, $max_no_good], ["vA0", "C0", "I"],
"Usage: create_no_good_set([variables], prefilter, max_no_good, ext)");
my $ngsObj = Algorithm::CP::IZ::NoGoodSet->new($var_array, $prefilter, $ext);
my $ptr = Algorithm::CP::IZ::cs_createNoGoodSet($ngsObj->_parray->ptr,
scalar(@$var_array),
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub event_all_known {
my $self = shift;
my ($var_array, $handler, $ext) = @_;
validate([$var_array, $handler], ["vA0", "C"],
"Usage: event_all_known([variables], code_ref, ext)");
my $parray = $self->_create_registered_var_array($var_array);
my $h = sub {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub event_known {
my $self = shift;
my ($var_array, $handler, $ext) = @_;
validate([$var_array, $handler], ["vA0", "C"],
"Usage: event_known([variables], code_ref, ext)");
my $parray = $self->_create_registered_var_array($var_array);
my $h = sub {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub event_new_min {
my $self = shift;
my ($var_array, $handler, $ext) = @_;
validate([$var_array, $handler], ["vA0", "C"],
"Usage: event_new_min([variables], code_ref, ext)");
my $parray = $self->_create_registered_var_array($var_array);
my $h = sub {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub event_new_max {
my $self = shift;
my ($var_array, $handler, $ext) = @_;
validate([$var_array, $handler], ["vA0", "C"],
"Usage: event_new_max([variables], code_ref, ext)");
my $parray = $self->_create_registered_var_array($var_array);
my $h = sub {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub event_neq {
my $self = shift;
my ($var_array, $handler, $ext) = @_;
validate([$var_array, $handler], ["vA0", "C"],
"Usage: event_eq([variables], code_ref, ext)");
my $parray = $self->_create_registered_var_array($var_array);
my $h = sub {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $usage_msg = 'usage: Add(v1, v2, ...)';
if (@params < 1) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
if (@params == 1) {
return $params[0] if (ref $params[0]);
return $self->_const_var(int($params[0]));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $usage_msg = 'usage: Mul(v1, v2, ...)';
if (@params < 1) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
if (@params == 1) {
return $params[0] if (ref $params[0]);
return $self->_const_var(int($params[0]));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $usage_msg = 'usage: Sub(v1, v2, ...)';
if (@params < 1) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
if (@params == 1) {
return $params[0] if (ref $params[0]);
return $self->_const_var(int($params[0]));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $usage_msg = 'usage: Div(v1, v2)';
if (@params != 2) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
if (@params == 1) {
return $params[0] if (ref $params[0]);
return $self->_const_var(int($params[0]));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub ScalProd {
my $self = shift;
my $vars = shift;
my $coeffs = shift;
validate([$vars, $coeffs, 1], ["vA0", "iA0",
sub {
@$coeffs == @$vars
}],
"Usage: ScalProd([variables], [coeffs])");
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub AllNeq {
my $self = shift;
my $var_array = shift;;
validate([$var_array], ["vA0"], "Usage: AllNeq([variables])");
my $parray = $self->_create_registered_var_array($var_array);
return Algorithm::CP::IZ::cs_AllNeq($$parray, scalar(@$var_array));
}
sub Sigma {
my $self = shift;
my $var_array = shift;;
validate([$var_array], ["vA0"], "Usage: Sigma([variables])");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
my $parray = $self->_create_registered_var_array($var_array);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Abs {
my $self = shift;
my @params = @_;
validate([scalar @params, $params[0]],
[sub { shift == 1 }, "V"], "Usage: Abs(v)");
my @v = map { ref $_ ? $_ : $self->_const_var(int($_)) } @params;
my $ptr = Algorithm::CP::IZ::cs_Abs(map { $$_ } @v);
my $ret = Algorithm::CP::IZ::Int->new($ptr);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Min {
my $self = shift;
my $var_array = shift;;
validate([$var_array], ["vA1"],
"Usage: Min([variables])");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
my $parray = $self->_create_registered_var_array($var_array);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Max {
my $self = shift;
my $var_array = shift;;
validate([$var_array], ["vA1"],
"Usage: Max([variables])");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
my $parray = $self->_create_registered_var_array($var_array);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub IfEq {
my $self = shift;
my ($vint1, $vint2, $val1, $val2) = @_;
validate([scalar @_, $vint1, $vint2, $val1, $val2],
[sub { shift == 4 }, "V", "V", "I", "I"],
"Usage: IfEq(vint1, vint2, val1, val2)");
return Algorithm::CP::IZ::cs_IfEq($$vint1, $$vint2,
int($val1), int($val2));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub IfNeq {
my $self = shift;
my ($vint1, $vint2, $val1, $val2) = @_;
validate([scalar @_, $vint1, $vint2, $val1, $val2],
[sub { shift == 4 }, "V", "V", "I", "I"],
"Usage: IfNeq(vint1, vint2, val1, val2)");
return Algorithm::CP::IZ::cs_IfNeq($$vint1, $$vint2,
$val1, $val2);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub OccurDomain {
my $self = shift;
my ($val, $var_array) = @_;
validate([scalar @_, $val, $var_array],
[sub { shift == 2 }, "I", "vA0"],
"Usage: OccurDomain(val, [variables])");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub OccurConstraints {
my $self = shift;
my ($vint, $val, $var_array) = @_;
validate([scalar @_, $vint, $val, $var_array],
[sub { shift == 3 }, "V", "I", "vA0"],
"Usage: OccurConstraints(vint, val, [variables])");
$vint = ref $vint ? $vint : $self->_const_var(int($vint));
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Index {
my $self = shift;
my ($var_array, $val) = @_;
validate([scalar @_, $var_array, $val],
[sub { shift == 2 }, "vA0", "I"],
"Usage: Index([variables], val)");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Element {
my $self = shift;
my ($index, $val_array) = @_;
validate([scalar @_, $index, $val_array],
[sub { shift == 2 }, "V", "iA1"],
"Usage: Element(index_var, [values])");
@$val_array = map { int($_) } @$val_array;
$index = ref $index ? $index : $self->_const_var(int($index));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub VarElement {
my $self = shift;
my ($index, $var_array) = @_;
validate([scalar @_, $index, $var_array],
[sub { shift == 2 }, "V", "vA1"],
"Usage: VarElement(index_var, [value_vars])");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
$index = ref $index ? $index : $self->_const_var(int($index));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub VarElementRange {
my $self = shift;
my ($index, $var_array) = @_;
validate([scalar @_, $index, $var_array],
[sub { shift == 2 }, "V", "vA1"],
"Usage: VarElementRange(index_var, [value_vars])");
@$var_array = map { ref $_ ? $_ : $self->_const_var(int($_)) } @$var_array;
$index = ref $index ? $index : $self->_const_var(int($index));
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Cumulative {
my $self = shift;
my ($starts, $durations, $resources, $limit) = @_;
validate([$starts, $durations, $resources, $limit, 1],
["vA0", "vA0", "vA0", "V", sub {
@$starts == @$durations && @$durations == @$resources
}],
"Usage: Cumulative([starts], [durations], [resources], limit)");
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Disjunctive {
my $self = shift;
my ($starts, $durations) = @_;
validate([$starts, $durations, 1],
["vA0", "vA0", sub {
@$starts == @$durations
}],
"Usage: Disjunctive([starts], [durations])");
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub Regular {
my $self = shift;
my ($x, $d, $q0, $F) = @_;
validate([scalar(@_), $x,
$d,
$q0, $F
],
[sub { shift == 4 }, "vA0",
sub {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $ucn = uc $n;
my $meth = sub {
my $self = shift;
my ($v1, $v2) = @_;
validate([scalar @_, $v1, $v2],
[sub { shift == 2 }, "V", "V"],
"Usage: $meth_name(v1, v2)");
my $ptr;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits/M09_001.pm view on Meta::CPAN
The check digit is the difference between 8 and the number of step 3.
=back
To validate the last digit of the total of the digits of all numbers
inclusive check digit must be 8.
=head2 METHODS
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
utilize|||
uvchr_to_utf8_flags||5.007003|
uvchr_to_utf8|||
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
validate_suid|||
varname|||
vcmp||5.009000|
vcroak||5.006000|
vdeb||5.007003|
vdie_common|||
view all matches for this distribution
view release on metacpan or search on metacpan
uvchr_to_utf8|||
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
valid_utf8_to_uvchr|||
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/Algorithm/CouponCode.pm view on Meta::CPAN
package Algorithm::CouponCode;
$Algorithm::CouponCode::VERSION = '1.005';
=head1 NAME
Algorithm::CouponCode - Generate and validate 'CouponCode' strings
=cut
use 5.010;
use warnings;
lib/Algorithm/CouponCode.pm view on Meta::CPAN
use Exporter qw(import);
use Digest::SHA qw(sha1);
our @EXPORT_OK = qw(cc_generate cc_validate make_bad_regex);
my $sym_str = '0123456789ABCDEFGHJKLMNPQRTUVWXY';
my @sym = split //, $sym_str;
my $urandom_path = '/dev/urandom';
my $have_urandom = -r $urandom_path;
lib/Algorithm/CouponCode.pm view on Meta::CPAN
return join '-', @code;
}
sub cc_validate {
my %arg = @_;
my $code = $arg{code} or return;
my $parts = $arg{parts} // 3;
lib/Algorithm/CouponCode.pm view on Meta::CPAN
=pod
=head1 SYNOPSIS
use Algorithm::CouponCode qw(cc_generate cc_validate);
print cc_generate(parts => 3); # generate a 3-part code
my $valid_code = cc_validate(code => $code, parts => 3) or die "Invalid code";
=head1 DESCRIPTION
A 'Coupon Code' is made up of letters and numbers grouped into 4 character
'parts'. For example, a 3-part code might look like this:
lib/Algorithm/CouponCode.pm view on Meta::CPAN
The Algorithm-CouponCode distribution includes a Javascript implementation of
the validator function, in the form of a jQuery plugin. You can include this
in your web application to do client-side validation and highlighting of
errors.
I<Note> the cc_validate function and the Javascript plugin only validate that
the code is 'well-formed' (i.e.: each part has a valid checkdigit). Checking
whether the code is in fact 'valid' is left up to your application and would
typically involve looking for the code in a database. If you use the
Javascript plugin, you might choose to tweak the CSS to keep the red
highlighting of checksum errors but remove the green highlighting which might
lib/Algorithm/CouponCode.pm view on Meta::CPAN
not appear in generated output. The C<make_bad_regex()> helper function can
be used to turn a list of words into a suitable regular expression.
=back
=head2 cc_validate( options )
Takes a code, cleans it up and validates the checkdigits. Returns the
normalised (and untainted) version of the code on success or undef on error.
The following named parameters may be supplied:
=over 4
=item code
The code to be validated. The parameter is mandatory.
=item parts
The number of parts you expect the code to contain. Default is 3.
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-clustering.t view on Meta::CPAN
BEGIN { chdir 't' if -d 't' }
use_ok( 'Algorithm::DBSCAN' ) || print "Bail out!\n";
sub validate_answer {
my ($dbscan, $results_file) = @_;
my %clusters;
foreach my $id (keys %{$dbscan->{dataset}}) {
t/01-clustering.t view on Meta::CPAN
my $dbscan = Algorithm::DBSCAN->new($dataset, 3.1 * 3.1, 6);
$dbscan->FindClusters();
$dbscan->PrintClustersShort();
my $result = validate_answer($dbscan, 'test_datasets/dbscan_test_dataset_1_result.txt');
ok( $result eq '1', 'Clustering of dataset 1 ok' );
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Dependency/Source.pm view on Meta::CPAN
=over 4
=item Overload the C<new> method.
Assuming your subclass takes some form or argument on creation, you will
need to overload the C<new> method to accept the arguments, validate them,
and store them in the source object.
=item Define the method C<_load_item_list>.
Leaving our parent's C<load> method to take care of conflict, errors, and
view all matches for this distribution
view release on metacpan or search on metacpan
c) You must license the entire work, as a whole, under this 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
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
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/Algorithm/Evolve.pm view on Meta::CPAN
$p->{selection} ||= $p->{replacement};
$p->{replacement} ||= $p->{selection};
$p->{children_per_gen} ||= $p->{parents_per_gen};
$p->_validate_args;
return $p;
}
sub _validate_args {
my $p = shift;
{
no strict 'refs';
croak "Invalid selection/replacement criteria"
lib/Algorithm/Evolve.pm view on Meta::CPAN
sub selection {
my ($p, $method) = @_;
return $p->{selection} unless defined $method;
$p->{selection} = $method;
$p->_validate_args;
return $p->{selection};
}
sub replacement {
my ($p, $method) = @_;
return $p->{replacement} unless defined $method;
$p->{replacement} = $method;
$p->_validate_args;
return $p->{replacement};
}
sub parents_children_per_gen {
my ($p, $parents, $children) = @_;
return unless defined $parents and defined $children;
$p->{parents_per_gen} = $parents;
$p->{children_per_gen} = $children;
$p->_validate_args;
}
####################
sub _initialize {
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
utilize|||
uvchr_to_utf8_flags||5.007003|
uvchr_to_utf8|||
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
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
sub new {
my ($proto, $count_hash) = @_;
my $class = ref($proto) || $proto;
__validate_counting_hash($count_hash);
my $heap = Heap::Fibonacci->new;
my $size = 0;
while (my ($str, $count) = each %$count_hash) {
croak "The count for each character/substring must be a number"
}
return $string;
}
sub __validate_counting_hash {
my $c = shift;
my $error_msg = undef;
defined $c
or croak "Undefined counting hash";
ref($c) eq 'HASH'
view all matches for this distribution
view release on metacpan or search on metacpan
utilize|||
uvchr_to_utf8_flags||5.007003|
uvchr_to_utf8|||
uvuni_to_utf8_flags||5.007003|
uvuni_to_utf8||5.007001|
validate_suid|||
varname|||
vcmp||5.009000|
vcroak||5.006000|
vdeb||5.007003|
vdie_common|||
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
src/liblinear.xs view on Meta::CPAN
return false;
}
}
void
validate_parameter(
pTHX_
struct problem *problem_,
struct parameter *parameter_) {
const char *message = check_parameter(problem_, parameter_);
if (message) {
src/liblinear.xs view on Meta::CPAN
struct model *
ll_train(klass, problem_, parameter_)
struct problem *problem_;
struct parameter *parameter_;
CODE:
validate_parameter(aTHX_ problem_, parameter_);
RETVAL = train(problem_, parameter_);
OUTPUT:
RETVAL
struct model *
src/liblinear.xs view on Meta::CPAN
ll_cross_validation(self, problem_, num_folds)
struct parameter *self;
struct problem *problem_;
int num_folds;
CODE:
validate_parameter(aTHX_ problem_, self);
double *targets;
Newx(targets, problem_->l, double);
cross_validation(problem_, self, num_folds, targets);
RETVAL = newAV();
av_extend(RETVAL, problem_->l - 1);
view all matches for this distribution
view release on metacpan or search on metacpan
uvuni_to_utf8|5.019004||cVu
uvuni_to_utf8_flags|5.007003||dcV
UVxf|5.006000|5.003007|poVn
UVXf|5.007001|5.007001|poVn
VAL_EAGAIN|5.003007|5.003007|Vn
validate_proto|5.019002||xcVi
validate_suid|||iu
valid_utf8_to_uvchr|5.015009||cVn
valid_utf8_to_uvuni|5.015009||dcVu
VAL_O_NONBLOCK|5.003007|5.003007|Vn
variant_byte_number|5.031004||cVnu
variant_under_utf8_count|5.027007||Vni
view all matches for this distribution
view release on metacpan or search on metacpan
6.16 0.744 11.625 138572 0.0000 0.0001 Algorithm::MasterMind::matches
5.06 0.611 10.881 499779 0.0000 0.0000 Algorithm::MasterMind::check_rule
0.58 0.070 0.090 1 0.0699 0.0897 YAML::Type::code::BEGIN
0.50 0.060 0.389 7 0.0085 0.0555 main::BEGIN
0.49 0.059 0.195 40252 0.0000 0.0000 YAML::Base::__ANON__
0.49 0.059 0.059 454 0.0001 0.0001 Params::Validate::_validate
0.33 0.040 0.192 7 0.0057 0.0274 DateTime::Locale::BEGIN
0.31 0.038 0.097 449 0.0001 0.0002 DateTime::Locale::_register
0.30 0.036 0.065 5404 0.0000 0.0000 overload::AddrRef
0.24 0.029 0.029 322 0.0001 0.0001 Params::Validate::_validate_pos
0.22 0.026 0.026 5404 0.0000 0.0000 Scalar::Util::blessed
0.18 0.022 0.029 2335 0.0000 0.0000 YAML::Dumper::_emit_str
0.17 0.021 0.086 2235 0.0000 0.0000 YAML::Dumper::_emit_node
view all matches for this distribution