view release on metacpan or search on metacpan
lib/Module/Starter/Plugin/App/Cmd.pm view on Meta::CPAN
# [ 'name=s' => "Name", {default => \$SUPER::config->{name} || undef} ],
# );
return ();
}
sub validate_args {
my ( \$self, \$opt, \$args ) = \@_;
# Example validation
#
# \$self->usage_message('Your error here') unless (\$some_condition);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cmdline.pm view on Meta::CPAN
}
}
# ----------------------------------------------------------------
# Create (and return) option definitions from wanted option sets
# (given as class names). Also install the validate_args() subroutine
# that will call validate_opts() on all wanted option sets.
# ----------------------------------------------------------------
sub composed_of {
my $self = shift;
my @option_classes = @_; # list of class names with wanted options sets
lib/App/Cmdline.pm view on Meta::CPAN
# install a dispatcher of all validating methods
Sub::Install::reinstall_sub ({
code => sub {
foreach my $set (@option_classes) {
next if ref ($set);
if ($set->can ('validate_opts')) {
$set->validate_opts ($self, @_);
}
}
},
as => 'validate_args',
});
# add the configuration options
return (@opt_spec, { getopt_conf => $self->getopt_conf() } );
}
lib/App/Cmdline.pm view on Meta::CPAN
opt_spec()
=item Methods that you may overwrite
usage_desc()
validate_args()
usage_error()
getopt_conf()
...
=item Methods that you just call
lib/App/Cmdline.pm view on Meta::CPAN
sub usage_desc {
return shift->SUPER::usage_desc() . ' ...and anything else';
}
=head2 B<validate_args>
Originally, this method was meant to check (validate) the command-line
arguments (remember that arguments are whatever remains on the
command-line after options defined in the L<opt_spec|"opt_spec">
method have been processed). The options themselves could be already
validated by various subroutines and attributes given in the option
specifications (as described, sometimes only vaguely, in the
L<Getopt::Long::Descriptive>). But sometimes, it is useful to have all
validation, of options and of arguments, in one place - so we have
this method.
lib/App/Cmdline.pm view on Meta::CPAN
an arrayref containing all remaining arguments on the command-line.
I<Important:> Some predefined sets of options (see the L<"PREDEFINED
SETS OF OPTIONS">) do also some checking (or other actions, like
printing the version and exiting) and this checking is invoked from
the C<App::Cmdline>'s validate_args method. Therefore, it is strongly
recommended that if you overwrite this method, you also call the SUPER:
sub validate_args {
my ($self, $opt, $args) = @_;
$self->SUPER::validate_args ($opt, $args);
if ($opt->number and scalar @$args != $opt->number) {
$self->usage_error ("Option --number does not correspond with the number of arguments");
}
}
lib/App/Cmdline.pm view on Meta::CPAN
return
[ 'h' => "display a short usage message" ],
[ 'version|v' => "display a version" ];
}
=item B<validate_opts>
This method, if exists, will be called from the
L<validate_args|"validate_args"> method. Its purpose is to do
something with the options belonging to (predefined by) this class.
It gets four parameters, C<$app> (the class name of your application),
C<$caller> (who is calling), C<$opts> (an object allowing to access
all options) and C<$args> (an arrayref with the remaining arguments
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cme/Command/check.pm view on Meta::CPAN
use base qw/App::Cme::Common/;
use Config::Model::ObjTreeScanner;
sub validate_args {
my ($self, $opt, $args) = @_;
$self->check_unknown_args($args);
$self->process_args($opt,$args);
return;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Codit/Plugins/Colors.pm view on Meta::CPAN
my $bframe = $fframe->Frame->pack(-fill => 'x');
$bframe->Button(
-text => 'Insert',
-command => sub {
if ($picker->validate($color)) {
$self->cmdExecute('edit_insert', 'insert', $color);
$picker->historyAdd($picker->getHEX);
$picker->historyUpdate;
}
},
)->pack(@padding, -side => 'left', -expand => 1, -fill => 'x');
$bframe->Button(
-text => 'Copy',
-command => sub {
if ($picker->validate($color)) {
$self->clipboardClear;
$self->clipboardAppend($color);
$picker->historyAdd($picker->getHEX);
$picker->historyUpdate;
}
lib/App/Codit/Plugins/Colors.pm view on Meta::CPAN
my @sel = $self->cmdExecute('doc_get_sel');
my $pick = $self->_pick;
if (@sel) {
my $text = $self->cmdExecute('doc_get_text', @sel);
chomp($text);
if ($self->_pick->validate($text)) {
$pick->put($text);
$self->_ent($pick->notationCurrent);
$self->updateEntry;
}
}
lib/App/Codit/Plugins/Colors.pm view on Meta::CPAN
sub updateEntry {
my ($self, $value) = @_;
$value = $self->_ent->get unless defined $value;
my $pick = $self->_pick;
if ($self->_pick->validate($value)) {
$self->_ind($pick->getHEX);
$self->_ent->configure(-foreground => $self->configGet('-foreground'));
$self->_pick($value);
} else {
$self->_ind($self->configGet('-background'));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Config/Chronicle.pm view on Meta::CPAN
my $definitions = shift;
my $containing_section = shift;
$containing_section->meta->make_mutable;
foreach my $definition_key (keys %{$definitions}) {
$self->_validate_key($definition_key, $containing_section);
my $definition = $definitions->{$definition_key};
if ($definition->{isa} eq 'section') {
$self->_create_section($containing_section, $definition_key, $definition);
$self->_create_attributes($definition->{contains}, $containing_section->$definition_key);
} elsif ($definition->{global}) {
lib/App/Config/Chronicle.pm view on Meta::CPAN
$section->$writer($attribute);
return $attribute;
}
sub _validate_key {
my $self = shift;
my $key = shift;
my $section = shift;
if (grep { $key eq $_ } qw(path parent_path name definition version data_set check_for_update save_dynamic refresh_interval)) {
view all matches for this distribution
view release on metacpan or search on metacpan
The first AOP
feature planned is the printing of arguments on entry to a method and
the printing of arguments and return values on exit of a a method.
This is useful
for debugging and the generation of object-message traces to validate
or document the flow of messages through the system.
Detailed Conditions:
* use(001) class does not exist: throw a App::Exception
view all matches for this distribution
view release on metacpan or search on metacpan
script/create-random-file view on Meta::CPAN
You can also put configuration for multiple programs inside a single file, and use filter C<program=NAME> in section names, e.g. C<[program=NAME ...]> or C<[SOMESECTION program=NAME]>. The section will then only be used when the reading program match...
You can also filter a section by environment variable using the filter C<env=CONDITION> in section names. For example if you only want a section to be read if a certain environment variable is true: C<[env=SOMEVAR ...]> or C<[SOMESECTION env=SOMEVAR ...
To load and configure plugins, you can use either the C<-plugins> parameter (e.g. C<< -plugins=DumpArgs >> or C<< -plugins=DumpArgs@before_validate_args >>), or use the C<[plugin=NAME ...]> sections, for example:
[plugin=DumpArgs]
-event=before_validate_args
-prio=99
[plugin=Foo]
-event=after_validate_args
arg1=val1
arg2=val2
which is equivalent to setting C<< -plugins=-DumpArgs@before_validate_args@99,-Foo@after_validate_args,arg1,val1,arg2,val2 >>.
List of available configuration parameters:
format (see --format)
interactive (see --interactive)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Critique/Command.pm view on Meta::CPAN
[ 'debug|d', 'display debugging information', { default => $App::Critique::CONFIG{'DEBUG'}, implies => 'verbose' } ],
[ 'verbose|v', 'display additional information', { default => $App::Critique::CONFIG{'VERBOSE'} } ],
);
}
sub validate_args {
my ($self, $opt, $args) = @_;
$self->usage_error('The git-work-tree does not exist (' . $opt->git_work_tree . ')')
unless -d $opt->git_work_tree;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dazz/Command/contained.pm view on Meta::CPAN
$desc .= ucfirst(abstract) . ".\n";
$desc .= "\tAll operations are running in a tempdir and no intermediate files are kept.\n";
return $desc;
}
sub validate_args {
my ( $self, $opt, $args ) = @_;
if ( @{$args} < 1 ) {
my $message = "This command need one or more input files.\n\tIt found";
$message .= sprintf " [%s]", $_ for @{$args};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dependencio.pm view on Meta::CPAN
);
}
sub validate_args {
my ($self, $opt, $args) = @_;
$self->usage_error("Bad command") if @$args;
$self->usage if $opt->{help};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Deps/Verify/App/VerifyDeps/Command/plinst.pm view on Meta::CPAN
[ "input|i=s\@", "the input files" ],
[ "notest", "speed up installation by skipping the tests" ],
);
}
sub validate_args
{
my ( $self, $opt, $args ) = @_;
# no args allowed but options!
$self->usage_error("No args allowed") if @$args;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Diskd.pm view on Meta::CPAN
#
# The routines used to pack and unpack a list of disks for
# transmission could take any form, really. The key things to consider
# are that (a) arbitrary spoofed data can't result in us introducing
# security issues (so solutions that involve eval'ing the packed data
# are out, unless we validate that the data is in the expected form)
# and (b) we take into consideration quoting issues (such as not using
# spaces as separators, since they may appear in disk labels). As it
# happens, YAML can solve both of these problems for us. It may not
# make best use of space, but at least it's quick and easy to
# implement.
view all matches for this distribution
view release on metacpan or search on metacpan
script/dir2dist view on Meta::CPAN
You can also put configuration for multiple programs inside a single file, and use filter C<program=NAME> in section names, e.g. C<[program=NAME ...]> or C<[SOMESECTION program=NAME]>. The section will then only be used when the reading program match...
You can also filter a section by environment variable using the filter C<env=CONDITION> in section names. For example if you only want a section to be read if a certain environment variable is true: C<[env=SOMEVAR ...]> or C<[SOMESECTION env=SOMEVAR ...
To load and configure plugins, you can use either the C<-plugins> parameter (e.g. C<< -plugins=DumpArgs >> or C<< -plugins=DumpArgs@before_validate_args >>), or use the C<[plugin=NAME ...]> sections, for example:
[plugin=DumpArgs]
-event=before_validate_args
-prio=99
[plugin=Foo]
-event=after_validate_args
arg1=val1
arg2=val2
which is equivalent to setting C<< -plugins=-DumpArgs@before_validate_args@99,-Foo@after_validate_args,arg1,val1,arg2,val2 >>.
List of available configuration parameters:
dirs (see --dirs)
format (see --format)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DocKnot.pm view on Meta::CPAN
use autodie;
use warnings;
use File::BaseDir qw(config_files);
use File::ShareDir qw(module_file);
use Kwalify qw(validate);
use Path::Tiny qw(path);
use YAML::XS ();
##############################################################################
# Helper methods
lib/App/DocKnot.pm view on Meta::CPAN
my $error = lcfirst($@);
chomp($error);
$error =~ s{ \n }{ }xms;
die "$error\n";
}
eval { validate($schema_ref, $data_ref) };
if ($@) {
my $errors = $@;
chomp($errors);
die "schema validation for $path failed:\n$errors\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/CLI/Commands/Interval.pm view on Meta::CPAN
resulting status object.
=cut
sub _interval_new {
my ( $code, $tsrange, $long_desc ) = validate_pos( @_,
{ type => SCALAR },
{ type => SCALAR },
{ type => SCALAR|UNDEF, optional => 1 },
);
lib/App/Dochazka/CLI/Commands/Interval.pm view on Meta::CPAN
=head3 _fillup
=cut
sub _fillup {
my ( %ARGS ) = validate( @_, {
eid => { type => SCALAR },
code => { type => SCALAR, optional => 1 },
date_list => { type => ARRAYREF, optional => 1 },
tsrange => { type => SCALAR, optional => 1 },
dry_run => { type => SCALAR },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
sub make_filter {
# take a list consisting of the names of attributes that the 'filter'
# routine will retain -- these must all be scalars
my ( @attr ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
if ( @_ % 2 ) {
die "Odd number of parameters given to filter routine!";
}
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
sub make_reset {
# take a list consisting of the names of attributes that the 'reset'
# method will accept -- these must all be scalars
my ( @attr ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
# construct the validation specification for the 'reset' routine:
# 1. 'reset' will take named parameters _only_
# 2. only the values from @attr will be accepted as parameters
# 3. all parameters are optional (indicated by 0 value in $val_spec)
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
return sub {
# process arguments
my $self = shift;
#confess "Not an instance method call" unless ref $self;
my %ARGS;
%ARGS = validate( @_, $val_spec ) if @_ and defined $_[0];
# Set attributes to run-time values sent in argument list.
# Attributes that are not in the argument list will get set to undef.
map { $self->{$_} = $ARGS{$_}; } @attr;
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
sub make_accessor {
my ( $subname, $type ) = @_;
$type = $type || { type => SCALAR | UNDEF, optional => 1 };
sub {
my $self = shift;
validate_pos( @_, $type );
$self->{$subname} = shift if @_;
$self->{$subname} = undef unless exists $self->{$subname};
return $self->{$subname};
};
}
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_TO_JSON {
my ( @attr ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my $self = shift;
my $unblessed_copy;
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_compare {
my ( @attr ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my ( $self, $other ) = validate_pos( @_, 1, 1 );
return if ref( $other ) ne ref( $self );
return eq_deeply( $self, $other );
}
}
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_compare_disabled {
my ( @attr ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my ( $self, $other ) = validate_pos( @_, 1, 1 );
return $self->compare( $other) unless grep { $_ eq 'disabled' } @attr;
return if ref( $other ) ne ref( $self );
my $self_disabled = $self->{'disabled'};
delete $self->{'disabled'};
my $other_disabled = $other->{'disabled'};
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_clone {
my ( @attr ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my ( $self ) = @_;
my ( %h, $clone );
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_attrs {
my ( @attrs ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my ( $self ) = @_;
return \@attrs;
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_get {
my ( @attrs ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my ( $self, $attr ) = @_;
if ( grep { $_ eq $attr } @attrs ) {
lib/App/Dochazka/Common/Model.pm view on Meta::CPAN
=cut
sub make_set {
my ( @attrs ) = validate_pos( @_, map { { type => SCALAR }; } @_ );
return sub {
my ( $self, $attr, $value ) = @_;
if ( grep { $_ eq $attr } @attrs ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/REST/ACL.pm view on Meta::CPAN
of C<privlevel>.
=cut
sub check_acl {
my ( %ARGS ) = validate( @_, {
profile => { type => SCALAR, regex => qr/^(passerby)|(inactive)|(active)|(admin)|(forbidden)$/ },
privlevel => { type => SCALAR, regex => qr/^(passerby)|(inactive)|(active)|(admin)$/ },
} );
return exists( $acl_lookup{$ARGS{privlevel}}->{$ARGS{profile}} )
? 1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/WWW/Dispatch.pm view on Meta::CPAN
# two possibilities: login/logout attempt or normal AJAX call
if ( $method =~ m/^LOGIN/i ) {
$log->debug( "Incoming login/logout attempt" );
if ( $path =~ m/^login/i ) {
return $self->validate_user_credentials( $body );
} else {
return $self->_logout( $body );
}
}
lib/App/Dochazka/WWW/Dispatch.pm view on Meta::CPAN
my $hr = $rr->{'hr'};
return $self->_prep_ajax_response( $hr, $rr->{'body'} );
}
=head2 validate_user_credentials
Called either from C<process_post> on login AJAX requests originating from the
JavaScript side (i.e. the login screen in login-dialog.js, via login.js), or
directly from C<is_authorized> if the MFILE_WWW_BYPASS_LOGIN_DIALOG mechanism
is activated.
lib/App/Dochazka/WWW/Dispatch.pm view on Meta::CPAN
Returns a status object - OK means the login was successful; all other statuses
mean unsuccessful.
=cut
sub validate_user_credentials {
my ( $self, $body ) = @_;
$log->debug( "Entering " . __PACKAGE__ . "::validate_user_credentials()" );
my $r = $self->request;
my $session = $self->session;
my $nick = $body->{'nam'};
my $password = $body->{'pwd'};
view all matches for this distribution
view release on metacpan or search on metacpan
script/foremost-download view on Meta::CPAN
You can also put configuration for multiple programs inside a single file, and use filter C<program=NAME> in section names, e.g. C<[program=NAME ...]> or C<[SOMESECTION program=NAME]>. The section will then only be used when the reading program match...
You can also filter a section by environment variable using the filter C<env=CONDITION> in section names. For example if you only want a section to be read if a certain environment variable is true: C<[env=SOMEVAR ...]> or C<[SOMESECTION env=SOMEVAR ...
To load and configure plugins, you can use either the C<-plugins> parameter (e.g. C<< -plugins=DumpArgs >> or C<< -plugins=DumpArgs@before_validate_args >>), or use the C<[plugin=NAME ...]> sections, for example:
[plugin=DumpArgs]
-event=before_validate_args
-prio=99
[plugin=Foo]
-event=after_validate_args
arg1=val1
arg2=val2
which is equivalent to setting C<< -plugins=-DumpArgs@before_validate_args@99,-Foo@after_validate_args,arg1,val1,arg2,val2 >>.
List of available configuration parameters:
all (see --all)
detail (see --detail)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DubiousHTTP/Tests/Compressed.pm view on Meta::CPAN
[ UNCOMMON_VALID,'ce:gzip;gzip;replace:3,1|08;replace:10,0=2000', 'set flag FNAME and add short file name'],
[ UNCOMMON_VALID,'ce:gzip;gzip;replace:3,1|10;replace:10,0=2000', 'set flag FCOMMENT and add short comment'],
[ INVALID,'ce:gzip;gzip;replace:3,1|20', 'set flag reserved bit 5'],
[ INVALID,'ce:gzip;gzip;replace:3,1|40', 'set flag reserved bit 6'],
[ INVALID,'ce:gzip;gzip;replace:3,1|80', 'set flag reserved bit 7'],
[ INVALID,'ce:gzip;gzip;replace:-8,4^ffffffff', 'invalidate final checksum'],
[ INVALID,'ce:gzip;gzip;replace:-4,1^ff', 'invalidate length'],
[ INVALID,'ce:gzip;gzip;replace:-4,4=', 'remove length'],
[ INVALID,'ce:gzip;gzip;replace:-8,8=', 'remove checksum and length'],
[ INVALID,'ce:gzip;gzip;replace:-4,4=;clen+4', 'remove length but set content-length header to original size'],
[ INVALID,'ce:gzip;gzip;replace:-8,8=;clen+8', 'remove checksum and length but set content-length header to original size'],
[ INVALID,'ce:gzip;gzip;replace:-4,4=;noclen', 'remove length and close with eof without sending length'],
lib/App/DubiousHTTP/Tests/Compressed.pm view on Meta::CPAN
[ INVALID,'ce:cr-gzip;gzip;replace:3,1|04;replace:10,0=0000', 'set flag FEXTRA and extra part with XLEN 0 (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:3,1|04;replace:10,0=05004170010000', 'set flag FEXTRA and extra part with XLEN 5 (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:3,1|20', 'set flag reserved bit 5 (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:3,1|40', 'set flag reserved bit 6 (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:3,1|80', 'set flag reserved bit 7 (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:-8,4^ffffffff', 'invalidate final checksum (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:-4,1^ff', 'invalidate length (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:-4,4=', 'remove length (hide gzip with "content-encoding:\r gzip")'],
[ INVALID,'ce:cr-gzip;gzip;replace:-8,8=', 'remove checksum and length (hide gzip with "content-encoding:\r gzip")'],
# same game, but with Content-Encoding<space>: for other firewalls
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|01', 'set flag FTEXT (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|02;replace:10,0=0000', 'set flag FHCRC and add CRC with 0 (hide gzip with "content-encoding : gzip")'],
lib/App/DubiousHTTP/Tests/Compressed.pm view on Meta::CPAN
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|04;replace:10,0=0000', 'set flag FEXTRA and extra part with XLEN 0 (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|04;replace:10,0=05004170010000', 'set flag FEXTRA and extra part with XLEN 5 (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|20', 'set flag reserved bit 5 (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|40', 'set flag reserved bit 6 (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:3,1|80', 'set flag reserved bit 7 (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:-8,4^ffffffff', 'invalidate final checksum (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:-4,1^ff', 'invalidate length (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:-4,4=', 'remove length (hide gzip with "content-encoding : gzip")'],
[ INVALID,'ce-space-colon-gzip;gzip;replace:-8,8=', 'remove checksum and length (hide gzip with "content-encoding : gzip")'],
# and then used with an additional chunked transfer encoding
[ INVALID,'chunked;ce:gzip;gzip;replace:3,1|20', 'set flag reserved bit 5, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:3,1|40', 'set flag reserved bit 6, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:3,1|80', 'set flag reserved bit 7, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-8,4^ffffffff', 'invalidate final checksum, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-4,1^ff', 'invalidate length, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-4,4=', 'remove length, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-8,8=', 'remove checksum and length, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-4,4=;clen+4', 'remove length but set content-length header to original size, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-8,8=;clen+8', 'remove checksum and length but set content-length header to original size, chunked'],
[ INVALID,'chunked;ce:gzip;gzip;replace:-4,4=;noclen', 'remove length and close with eof without sending length, chunked'],
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DuckPAN/Cmd/Test.pm view on Meta::CPAN
if ($ia_type eq 'Fathead') {
my $path = "lib/fathead/$id/output.txt";
if (-f $path) {
$ENV{'DDG_TEST_FATHEAD'} = $id;
push @to_test, "t/validate_fathead.t";
} else {
$self->app->emit_and_exit(1, "Could not find output.txt for $id in $path");
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
script/list-dist-deps view on Meta::CPAN
You can also put configuration for multiple programs inside a single file, and use filter C<program=NAME> in section names, e.g. C<[program=NAME ...]> or C<[SOMESECTION program=NAME]>. The section will then only be used when the reading program match...
You can also filter a section by environment variable using the filter C<env=CONDITION> in section names. For example if you only want a section to be read if a certain environment variable is true: C<[env=SOMEVAR ...]> or C<[SOMESECTION env=SOMEVAR ...
To load and configure plugins, you can use either the C<-plugins> parameter (e.g. C<< -plugins=DumpArgs >> or C<< -plugins=DumpArgs@before_validate_args >>), or use the C<[plugin=NAME ...]> sections, for example:
[plugin=DumpArgs]
-event=before_validate_args
-prio=99
[plugin=Foo]
-event=after_validate_args
arg1=val1
arg2=val2
which is equivalent to setting C<< -plugins=-DumpArgs@before_validate_args@99,-Foo@after_validate_args,arg1,val1,arg2,val2 >>.
List of available configuration parameters:
added_or_updated_since (see --added-or-updated-since)
added_or_updated_since_last_index_update (see --added-or-updated-since-last-index-update)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/EANUtils.pm view on Meta::CPAN
_
args => {
ean8_numbers => {
'x.name.is_plural' => 1,
'x.name.singular' => 'ean8_number',
schema => ['array*', of=>'ean8_unvalidated*'],
req => 1,
pos => 0,
slurpy => 1,
cmdline_src => 'stdin_or_args',
},
lib/App/EANUtils.pm view on Meta::CPAN
_
args => {
ean13_numbers => {
'x.name.is_plural' => 1,
'x.name.singular' => 'ean13_number',
schema => ['array*', of=>'ean13_unvalidated*'],
req => 1,
pos => 0,
slurpy => 1,
cmdline_src => 'stdin_or_args',
},
lib/App/EANUtils.pm view on Meta::CPAN
Arguments ('*' denotes required arguments):
=over 4
=item * B<ean13_numbers>* => I<array[ean13_unvalidated]>
(No description)
=item * B<quiet> => I<bool>
lib/App/EANUtils.pm view on Meta::CPAN
Arguments ('*' denotes required arguments):
=over 4
=item * B<ean8_numbers>* => I<array[ean8_unvalidated]>
(No description)
=item * B<quiet> => I<bool>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Easer/V1.pm view on Meta::CPAN
return lc $o->{environment}
if defined $o->{environment} && $o->{environment} ne '1';
return '~~~';
} ## end sub name_for_option ($o)
sub params_validate ($self, $spec, $args) {
my $validator = $spec->{validate}
// $self->{application}{configuration}{validate} // return;
require Params::Validate;
Params::Validate::validate($self->{configs}[-1]->%*, $validator);
} ## end sub params_validate
sub print_commands ($self, $target) {
my $command = fetch_spec_for($self, $target);
my $fh =
$self->{application}{configuration}{'help-on-stderr'}
lib/App/Easer/V1.pm view on Meta::CPAN
my $command = $self->{trail}[-1][0];
my $spec = fetch_spec_for($self, $command)
or die "no definition for '$command'\n";
$args = collect_options($self, $spec, $args);
validate_configuration($self, $spec, $args);
commit_configuration($self, $spec, $args);
my ($subc, $alias) = fetch_subcommand($self, $spec, $args) or last;
push $self->{trail}->@*, [$subc, $alias];
} ## end while ('necessary')
lib/App/Easer/V1.pm view on Meta::CPAN
+JsonFileFromConfig +JsonFiles
>
]
} ## end sub stock_SourcesWithFiles
sub validate_configuration ($self, $spec, $args) {
my $from_spec = $spec->{validate};
my $from_self = $self->{application}{configuration}{validate};
my $validator;
if (defined $from_spec && 'HASH' ne ref $from_spec) {
$validator = $self->{factory}->($from_spec, 'validate');
}
elsif (defined $from_self && 'HASH' ne ref $from_self) {
$validator = $self->{factory}->($from_self, 'validate');
}
else { # use stock one
$validator = \¶ms_validate;
}
$validator->($self, $spec, $args);
} ## end sub validate_configuration
exit run(
$ENV{APPEASER} // {
commands => {
MAIN => {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/EditorTools/Command/InstallEmacs.pm view on Meta::CPAN
[ "dryrun|n", "Print where the script would be installed" ],
## [ "global|g", "Install the script globally (/usr/share/)" ],
);
}
sub validate_args {
my ( $self, $opt, $args ) = @_;
$self->_confirm_one_opt($opt)
or $self->usage_error(
"Options --local, --global, --dest and --print cannot be combined");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Egaz/Command/blastlink.pm view on Meta::CPAN
MARKDOWN
return $desc;
}
sub validate_args {
my ( $self, $opt, $args ) = @_;
if ( @{$args} != 1 ) {
my $message = "This command need one input file.\n\tIt found";
$message .= sprintf " [%s]", $_ for @{$args};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/ElasticSearch/Utilities.pm view on Meta::CPAN
$options->{command} = $url;
my $index;
if( exists $options->{index} ) {
if( my $index_in = delete $options->{index} ) {
# No need to validate _all
if( $index_in eq '_all') {
$index = $index_in;
}
else {
# Validate each included index
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/App/Env.pm view on Meta::CPAN
}
#-------------------------------------------------------
sub config {
my %default = Params::Validate::validate( @_, \%OptionDefaults );
$OptionDefaults{$_}{default} = $default{$_} for keys %default;
return;
}
#-------------------------------------------------------
lib/App/Env.pm view on Meta::CPAN
#-------------------------------------------------------
sub clone {
my $self = shift;
my %nopt = Params::Validate::validate( @_, \%CloneOptions );
my $clone = Storable::dclone( $self );
delete ${$clone}->{id};
# create new cache id
lib/App/Env.pm view on Meta::CPAN
# are being loaded in one call. Checking caching requires that we generate
# a cacheid from the applications' cacheids.
# if import is called as import( [$app, \%opts], \%shared_opts ),
# this is equivalent to import( $app, { %shared_opts, %opts } ),
# but we still validate %shared_opts as SharedOptions, just to be
# precise.
# if there's a single application passed as a scalar (rather than
# an array containing the app name and options), treat @opts as
# ApplicationOptions, else SharedOptions
my %opts = Params::Validate::validate( @opts, @apps == 1 && !ref( $apps[0] )
? \%ApplicationOptions
: \%SharedOptions );
$opts{Cache} = 0 if $opts{Temp};
lib/App/Env.pm view on Meta::CPAN
}
}
}
# set forced options for apps in multi-app merges, otherwise
# the defaults will be set by the call to validate below.
if ( @apps > 1 ) {
$app_opt{Force} = 1;
$app_opt{Cache} = 0;
}
# validate possible application options and get default
# values. Params::Validate wants a real array
my ( @app_opts ) = %app_opt;
# return an environment object, but don't load it. we need the
# module name to create a cacheid for the merged environment.
# don't load now to prevent unnecessary loading of uncached
# environments if later it turns out this is a cached
# multi-application environment
%app_opt = ( Params::Validate::validate( @app_opts, \%ApplicationOptions ) );
my $appo = App::Env::_app->new(
pid => $self->lobject_id,
app => $app,
NoLoad => 1,
opt => \%app_opt,
lib/App/Env.pm view on Meta::CPAN
sub env {
my $self = shift;
my @opts = ( 'HASH' eq ref $_[-1] ? pop : {} );
# mostly a duplicate of what's in str(). ick.
my %opt = Params::Validate::validate(
@opts,
{
Exclude => {
callbacks => { 'type' => \&App::Env::_Util::exclude_param_check },
default => undef,
lib/App/Env.pm view on Meta::CPAN
# return an env compatible string
sub str {
my $self = shift;
my @opts = ( 'HASH' eq ref $_[-1] ? pop : {} );
# validate type. Params::Validate doesn't do Regexp, so
# this is a bit messy.
my %opt = Params::Validate::validate(
@opts,
{
Exclude => {
callbacks => { 'type' => \&App::Env::_Util::exclude_param_check },
optional => 1,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Environ/Mojo/Pg.pm view on Meta::CPAN
use v5.10;
use utf8;
use App::Environ;
use App::Environ::Config;
use Params::Validate qw(validate_pos);
use URI;
use Mojo::Pg;
my %PG;
App::Environ::Config->register(qw(pg.yml));
sub pg {
my $class = shift;
my ($connector) = validate_pos( @_, 1 );
unless ( defined $PG{$connector} ) {
my $pg_string = $class->pg_string($connector);
$PG{$connector} = Mojo::Pg->new($pg_string);
lib/App/Environ/Mojo/Pg.pm view on Meta::CPAN
}
sub pg_string {
my $class = shift;
my ($connector) = validate_pos( @_, 1 );
my $conf = App::Environ::Config->instance->{pg}{connectors}{$connector};
my $url = URI->new();
view all matches for this distribution