code
stringlengths
2
1.05M
repo_name
stringlengths
5
101
path
stringlengths
4
991
language
stringclasses
3 values
license
stringclasses
5 values
size
int64
2
1.05M
######################################################################## # Bio::KBase::ObjectAPI::KBaseExpression::DB::ExpressionOntologyTerm - This is the moose object corresponding to the KBaseExpression.ExpressionOntologyTerm object # Authors: Christopher Henry, Scott Devoid, Paul Frybarger # Contact email: chenry@mcs.anl.gov # Development location: Mathematics and Computer Science Division, Argonne National Lab ######################################################################## package Bio::KBase::ObjectAPI::KBaseExpression::DB::ExpressionOntologyTerm; use Bio::KBase::ObjectAPI::BaseObject; use Moose; use namespace::autoclean; extends 'Bio::KBase::ObjectAPI::BaseObject'; # PARENT: has parent => (is => 'rw', isa => 'Ref', weak_ref => 1, type => 'parent', metaclass => 'Typed'); # ATTRIBUTES: has uuid => (is => 'rw', lazy => 1, isa => 'Str', type => 'msdata', metaclass => 'Typed',builder => '_build_uuid'); has _reference => (is => 'rw', lazy => 1, isa => 'Str', type => 'msdata', metaclass => 'Typed',builder => '_build_reference'); has expression_ontology_term_id => (is => 'rw', isa => 'Str', printOrder => '-1', type => 'attribute', metaclass => 'Typed'); has expression_ontology_term_name => (is => 'rw', isa => 'Str', printOrder => '-1', type => 'attribute', metaclass => 'Typed'); has expression_ontology_term_definition => (is => 'rw', isa => 'Str', printOrder => '-1', type => 'attribute', metaclass => 'Typed'); # LINKS: # BUILDERS: # CONSTANTS: sub _type { return 'KBaseExpression.ExpressionOntologyTerm'; } sub _module { return 'KBaseExpression'; } sub _class { return 'ExpressionOntologyTerm'; } sub _top { return 0; } my $attributes = [ { 'req' => 0, 'printOrder' => -1, 'name' => 'expression_ontology_term_id', 'type' => 'Str', 'perm' => 'rw' }, { 'req' => 0, 'printOrder' => -1, 'name' => 'expression_ontology_term_name', 'type' => 'Str', 'perm' => 'rw' }, { 'req' => 0, 'printOrder' => -1, 'name' => 'expression_ontology_term_definition', 'type' => 'Str', 'perm' => 'rw' } ]; my $attribute_map = {expression_ontology_term_id => 0, expression_ontology_term_name => 1, expression_ontology_term_definition => 2}; sub _attributes { my ($self, $key) = @_; if (defined($key)) { my $ind = $attribute_map->{$key}; if (defined($ind)) { return $attributes->[$ind]; } else { return; } } else { return $attributes; } } my $links = []; my $link_map = {}; sub _links { my ($self, $key) = @_; if (defined($key)) { my $ind = $link_map->{$key}; if (defined($ind)) { return $links->[$ind]; } else { return; } } else { return $links; } } my $subobjects = []; my $subobject_map = {}; sub _subobjects { my ($self, $key) = @_; if (defined($key)) { my $ind = $subobject_map->{$key}; if (defined($ind)) { return $subobjects->[$ind]; } else { return; } } else { return $subobjects; } } __PACKAGE__->meta->make_immutable; 1;
kbase/KBaseFBAModeling
lib/Bio/KBase/ObjectAPI/KBaseExpression/DB/ExpressionOntologyTerm.pm
Perl
mit
3,217
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # use strict; use warnings; use cproton_perl; package qpid::proton::Messenger; sub new { my ($class) = @_; my ($self) = {}; my $impl = cproton_perl::pn_messenger($_[1]); $self->{_impl} = $impl; bless $self, $class; return $self; } sub DESTROY { my ($self) = @_; cproton_perl::pn_messenger_stop($self->{_impl}); cproton_perl::pn_messenger_free($self->{_impl}); } sub get_name { my ($self) = @_; return cproton_perl::pn_messenger_name($self->{_impl}); } sub set_timeout { my ($self) = @_; my $timeout = $_[1]; $timeout = 0 if !defined($timeout); $timeout = int($timeout); cproton_perl::pn_messenger_set_timeout($self->{_impl}, $timeout); } sub get_timeout { my ($self) = @_; return cproton_perl::pn_messenger_get_timeout($self->{_impl}); } sub set_outgoing_window { my ($self) = @_; my $window = $_[1]; $window = 0 if !defined($window); $window = int($window); qpid::proton::check_for_error(cproton_perl::pn_messenger_set_outgoing_window($self->{_impl}, $window), $self); } sub get_outgoing_window { my ($self) = @_; return cproton_perl::pn_messenger_get_outgoing_window($self->{_impl}); } sub set_incoming_window{ my ($self) = @_; my $window = $_[1]; $window = 0 if !defined($window); $window = int($window); qpid::proton::check_for_error(cproton_perl::pn_messenger_set_incoming_window($self->{_impl}, $window), $self); } sub get_incoming_window { my ($self) = @_; return cproton_perl::pn_messenger_get_incoming_window($self->{_impl}); } sub get_error { my ($self) = @_; return cproton_perl::pn_error_text(cproton_perl::pn_messenger_error($self->{_impl})); } sub get_errno { my ($self) = @_; return cproton_perl::pn_messenger_errno($self->{_impl}); } sub start { my ($self) = @_; qpid::proton::check_for_error(cproton_perl::pn_messenger_start($self->{_impl}), $self); } sub stop { my ($self) = @_; qpid::proton::check_for_error(cproton_perl::pn_messenger_stop($self->{_impl}), $self); } sub subscribe { my ($self) = @_; cproton_perl::pn_messenger_subscribe($self->{_impl}, $_[1]); } sub set_certificate { my ($self) = @_; cproton_perl::pn_messenger_set_certificate($self->{_impl}, $_[1]); } sub get_certificate { my ($self) = @_; return cproton_perl::pn_messenger_get_certificate($self->{_impl}); } sub set_private_key { my ($self) = @_; cproton_perl::pn_messenger_set_private_key($self->{_impl}, $_[1]); } sub get_private_key { my ($self) = @_; return cproton_perl::pn_messenger_get_private_key($self->{_impl}); } sub set_password { my ($self) = @_; qpid::proton::check_for_error(cproton_perl::pn_messenger_set_password($self->{_impl}, $_[1]), $self); } sub get_password { my ($self) = @_; return cproton_perl::pn_messenger_get_password($self->{_impl}); } sub set_trusted_certificates { my ($self) = @_; cproton_perl::pn_messenger_set_trusted_certificates($self->{_impl}, $_[1]); } sub get_trusted_certificates { my ($self) = @_; return cproton_perl::pn_messenger_get_trusted_certificates($self->{_impl}); } sub put { my ($self) = @_; my $impl = $self->{_impl}; my $message = $_[1]; $message->preencode(); my $msgimpl = $message->get_impl(); qpid::proton::check_for_error(cproton_perl::pn_messenger_put($impl, $msgimpl), $self); my $tracker = $self->get_outgoing_tracker(); return $tracker; } sub get_outgoing_tracker { my ($self) = @_; my $impl = $self->{_impl}; my $tracker = cproton_perl::pn_messenger_outgoing_tracker($impl); if ($tracker != -1) { return qpid::proton::Tracker->new($tracker); } else { return undef; } } sub send { my ($self) = @_; my $n = $_[1]; $n = -1 if !defined $n; qpid::proton::check_for_error(cproton_perl::pn_messenger_send($self->{_impl}, $n), $self); } sub get { my ($self) = @_; my $impl = $self->{_impl}; my $message = $_[1] || new proton::Message(); qpid::proton::check_for_error(cproton_perl::pn_messenger_get($impl, $message->get_impl()), $self); $message->postdecode(); my $tracker = $self->get_incoming_tracker(); return $tracker; } sub get_incoming_tracker { my ($self) = @_; my $impl = $self->{_impl}; my $tracker = cproton_perl::pn_messenger_incoming_tracker($impl); if ($tracker != -1) { return qpid::proton::Tracker->new($tracker); } else { return undef; } } sub receive { my ($self) = @_; my $n = $_[1]; $n = -1 if !defined $n; qpid::proton::check_for_error(cproton_perl::pn_messenger_recv($self->{_impl}, $n), $self); } sub interrupt { my ($self) = @_; qpid::proton::check_for_error(cproton_perl::pn_messenger_interrupt($self->{_impl}), $self); } sub outgoing { my ($self) = @_; return cproton_perl::pn_messenger_outgoing($self->{_impl}); } sub incoming { my ($self) = @_; return cproton_perl::pn_messenger_incoming($self->{_impl}); } sub route { my ($self) = @_; my $impl = $self->{_impl}; my $pattern = $_[1]; my $address = $_[2]; qpid::proton::check_for_error(cproton_perl::pn_messenger_route($impl, $pattern, $address)); } sub rewrite { my ($self) = @_; my $impl = $self->{_impl}; my $pattern = $_[1]; my $address = $_[2]; qpid::proton::check_for_error(cproton_perl::pn_messenger_rewrite($impl, $pattern, $address)); } sub accept { my ($self) = @_; my $tracker = $_[1]; my $flags = 0; if (!defined $tracker) { $tracker = cproton_perl::pn_messenger_incoming_tracker($self->{_impl}); $flags = $cproton_perl::PN_CUMULATIVE; } qpid::proton::check_for_error(cproton_perl::pn_messenger_accept($self->{_impl}, $tracker, $flags), $self); } sub reject { my ($self) = @_; my $tracker = $_[1]; my $flags = 0; if (!defined $tracker) { $tracker = cproton_perl::pn_messenger_incoming_tracker($self->{_impl}); $flags = $cproton_perl::PN_CUMULATIVE; } qpid::proton::check_for_error(cproton_perl::pn_messenger_reject($self->{_impl}, $tracker, $flags), $self); } sub status { my ($self) = @_; my $tracker = $_[1]; return cproton_perl::pn_messenger_status($self->{_impl}, $tracker); } 1;
mbroadst/debian-qpid-cpp-old
proton-c/bindings/perl/lib/qpid/proton/Messenger.pm
Perl
apache-2.0
7,122
package CPANPLUS::Dist::Build; use if $] > 5.017, 'deprecate'; use strict; use warnings; use vars qw[@ISA $STATUS $VERSION]; @ISA = qw[CPANPLUS::Dist]; use CPANPLUS::Internals::Constants; ### these constants were exported by CPANPLUS::Internals::Constants ### in previous versions.. they do the same though. If we want to have ### a normal 'use' here, up the dependency to CPANPLUS 0.056 or higher BEGIN { require CPANPLUS::Dist::Build::Constants; CPANPLUS::Dist::Build::Constants->import() if not __PACKAGE__->can('BUILD') && __PACKAGE__->can('BUILD_DIR'); } use CPANPLUS::Error; use Config; use FileHandle; use Cwd; use version; use IPC::Cmd qw[run]; use Params::Check qw[check]; use Module::Load::Conditional qw[can_load check_install]; use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; local $Params::Check::VERBOSE = 1; $VERSION = '0.70'; =pod =head1 NAME CPANPLUS::Dist::Build - CPANPLUS plugin to install packages that use Build.PL =head1 SYNOPSIS my $build = CPANPLUS::Dist->new( format => 'CPANPLUS::Dist::Build', module => $modobj, ); $build->prepare; # runs Build.PL $build->create; # runs build && build test $build->install; # runs build install =head1 DESCRIPTION C<CPANPLUS::Dist::Build> is a distribution class for C<Module::Build> related modules. Using this package, you can create, install and uninstall perl modules. It inherits from C<CPANPLUS::Dist>. Normal users won't have to worry about the interface to this module, as it functions transparently as a plug-in to C<CPANPLUS> and will just C<Do The Right Thing> when it's loaded. =head1 ACCESSORS =over 4 =item C<parent()> Returns the C<CPANPLUS::Module> object that parented this object. =item C<status()> Returns the C<Object::Accessor> object that keeps the status for this module. =back =head1 STATUS ACCESSORS All accessors can be accessed as follows: $build->status->ACCESSOR =over 4 =item C<build_pl ()> Location of the Build file. Set to 0 explicitly if something went wrong. =item C<build ()> BOOL indicating if the C<Build> command was successful. =item C<test ()> BOOL indicating if the C<Build test> command was successful. =item C<prepared ()> BOOL indicating if the C<prepare> call exited successfully This gets set after C<perl Build.PL> =item C<distdir ()> Full path to the directory in which the C<prepare> call took place, set after a call to C<prepare>. =item C<created ()> BOOL indicating if the C<create> call exited successfully. This gets set after C<Build> and C<Build test>. =item C<installed ()> BOOL indicating if the module was installed. This gets set after C<Build install> exits successfully. =item uninstalled () BOOL indicating if the module was uninstalled properly. =item C<_create_args ()> Storage of the arguments passed to C<create> for this object. Used for recursive calls when satisfying prerequisites. =item C<_install_args ()> Storage of the arguments passed to C<install> for this object. Used for recursive calls when satisfying prerequisites. =back =cut =head1 METHODS =head2 $bool = CPANPLUS::Dist::Build->format_available(); Returns a boolean indicating whether or not you can use this package to create and install modules in your environment. =cut ### check if the format is available ### sub format_available { my $mod = 'Module::Build'; unless( can_load( modules => { $mod => '0.2611' }, nocache => 1 ) ) { error( loc( "You do not have '%1' -- '%2' not available", $mod, __PACKAGE__ ) ); return; } return 1; } =head2 $bool = $dist->init(); Sets up the C<CPANPLUS::Dist::Build> object for use. Effectively creates all the needed status accessors. Called automatically whenever you create a new C<CPANPLUS::Dist> object. =cut sub init { my $dist = shift; my $status = $dist->status; $status->mk_accessors(qw[build_pl build test created installed uninstalled _create_args _install_args _prepare_args _mb_object _buildflags ]); ### just in case 'format_available' didn't get called require Module::Build; return 1; } =pod =head2 $bool = $dist->prepare([perl => '/path/to/perl', buildflags => 'EXTRA=FLAGS', force => BOOL, verbose => BOOL]) C<prepare> prepares a distribution, running C<Build.PL> and establishing any prerequisites this distribution has. The variable C<PERL5_CPANPLUS_IS_EXECUTING> will be set to the full path of the C<Build.PL> that is being executed. This enables any code inside the C<Build.PL> to know that it is being installed via CPANPLUS. After a successful C<prepare> you may call C<create> to create the distribution, followed by C<install> to actually install it. Returns true on success and false on failure. =cut sub prepare { ### just in case you already did a create call for this module object ### just via a different dist object my $dist = shift; my $self = $dist->parent; ### we're also the cpan_dist, since we don't need to have anything ### prepared from another installer $dist = $self->status->dist_cpan if $self->status->dist_cpan; $self->status->dist_cpan( $dist ) unless $self->status->dist_cpan; my $cb = $self->parent; my $conf = $cb->configure_object; my %hash = @_; my $dir; unless( $dir = $self->status->extract ) { error( loc( "No dir found to operate on!" ) ); return; } my $args; my( $force, $verbose, $buildflags, $perl, $prereq_target, $prereq_format, $prereq_build ); { local $Params::Check::ALLOW_UNKNOWN = 1; my $tmpl = { force => { default => $conf->get_conf('force'), store => \$force }, verbose => { default => $conf->get_conf('verbose'), store => \$verbose }, perl => { default => $^X, store => \$perl }, buildflags => { default => $conf->get_conf('buildflags'), store => \$buildflags }, prereq_target => { default => '', store => \$prereq_target }, prereq_format => { default => '', store => \$prereq_format }, prereq_build => { default => 0, store => \$prereq_build }, }; $args = check( $tmpl, \%hash ) or return; } return 1 if $dist->status->prepared && !$force; $dist->status->_prepare_args( $args ); ### chdir to work directory ### my $orig = cwd(); unless( $cb->_chdir( dir => $dir ) ) { error( loc( "Could not chdir to build directory '%1'", $dir ) ); return; } ### by now we've loaded module::build, and we're using the API, so ### it's safe to remove CPANPLUS::inc from our inc path, especially ### because it can trip up tests run under taint (just like EU::MM). ### turn off our PERL5OPT so no modules from CPANPLUS::inc get ### included in make test -- it should build without. ### also, modules that run in taint mode break if we leave ### our code ref in perl5opt ### XXX we've removed the ENV settings from cp::inc, so only need ### to reset the @INC #local $ENV{PERL5OPT} = CPANPLUS::inc->original_perl5opt; #local $ENV{PERL5LIB} = CPANPLUS::inc->original_perl5lib; #local @INC = CPANPLUS::inc->original_inc; ### this will generate warnings under anything lower than M::B 0.2606 my @buildflags = $dist->_buildflags_as_list( $buildflags ); $dist->status->_buildflags( $buildflags ); my $fail; my $prereq_fail; my $status = { }; RUN: { # 0.85_01 ### we resolve 'configure requires' here, so we can run the 'perl ### Makefile.PL' command ### XXX for tests: mock f_c_r to something that *can* resolve and ### something that *doesn't* resolve. Check the error log for ok ### on this step or failure ### XXX make a separate tarball to test for this scenario: simply ### containing a makefile.pl/build.pl for test purposes? my $safe_ver = version->new('0.85_01'); if ( version->new($CPANPLUS::Internals::VERSION) >= $safe_ver ) { my $configure_requires = $dist->find_configure_requires; my $ok = $dist->_resolve_prereqs( format => $prereq_format, verbose => $verbose, prereqs => $configure_requires, target => $prereq_target, force => $force, prereq_build => $prereq_build, ); unless( $ok ) { #### use $dist->flush to reset the cache ### error( loc( "Unable to satisfy '%1' for '%2' " . "-- aborting install", 'configure_requires', $self->module ) ); $dist->status->prepared(0); $prereq_fail++; $fail++; last RUN; } ### end of prereq resolving ### } # Wrap the exception that may be thrown here (should likely be # done at a much higher level). my $prep_output; my $env = ENV_CPANPLUS_IS_EXECUTING; local $ENV{$env} = BUILD_PL->( $dir ); my @run_perl = ( '-e', CPDB_PERL_WRAPPER ); my $cmd = [$perl, @run_perl, BUILD_PL->($dir), @buildflags]; unless ( scalar run( command => $cmd, buffer => \$prep_output, verbose => $verbose ) ) { error( loc( "Build.PL failed: %1", $prep_output ) ); if ( $conf->get_conf('cpantest') ) { $status->{stage} = 'prepare'; $status->{capture} = $prep_output; } $fail++; last RUN; } unless ( BUILD->( $dir ) ) { error( loc( "Build.PL failed to generate a Build script: %1", $prep_output ) ); if ( $conf->get_conf('cpantest') ) { $status->{stage} = 'prepare'; $status->{capture} = $prep_output; } $fail++; last RUN; } msg( $prep_output, 0 ); my $prereqs = $self->status->prereqs; $prereqs ||= $dist->_find_prereqs( verbose => $verbose, dir => $dir, perl => $perl, buildflags => $buildflags ); } ### send out test report? ### if( $fail and $conf->get_conf('cpantest') and not $prereq_fail ) { $cb->_send_report( module => $self, failed => $fail, buffer => CPANPLUS::Error->stack_as_string, status => $status, verbose => $verbose, force => $force, ) or error(loc("Failed to send test report for '%1'", $self->module ) ); } unless( $cb->_chdir( dir => $orig ) ) { error( loc( "Could not chdir back to start dir '%1'", $orig ) ); } ### save where we wrote this stuff -- same as extract dir in normal ### installer circumstances $dist->status->distdir( $self->status->extract ); return $dist->status->prepared( $fail ? 0 : 1 ); } sub _find_prereqs { my $dist = shift; my $self = $dist->parent; my $cb = $self->parent; my $conf = $cb->configure_object; my %hash = @_; my ($verbose, $dir, $buildflags, $perl); my $tmpl = { verbose => { default => $conf->get_conf('verbose'), store => \$verbose }, dir => { default => $self->status->extract, store => \$dir }, perl => { default => $^X, store => \$perl }, buildflags => { default => $conf->get_conf('buildflags'), store => \$buildflags }, }; my $args = check( $tmpl, \%hash ) or return; my $prereqs = {}; $prereqs = $dist->find_mymeta_requires() if $dist->can('find_mymeta_requires'); if ( keys %$prereqs ) { # Ugly hack } else { my $safe_ver = version->new('0.31_03'); my $content; PREREQS: { if ( version->new( $Module::Build::VERSION ) >= $safe_ver and IPC::Cmd->can_capture_buffer ) { my @buildflags = $dist->_buildflags_as_list( $buildflags ); # Use the new Build action 'prereq_data' my @run_perl = ( '-e', CPDB_PERL_WRAPPER ); unless ( scalar run( command => [$perl, @run_perl, BUILD->($dir), 'prereq_data', @buildflags], buffer => \$content, verbose => 0 ) ) { error( loc( "Build 'prereq_data' failed: %1 %2", $!, $content ) ); #return; } else { last PREREQS; } } my $file = File::Spec->catfile( $dir, '_build', 'prereqs' ); return unless -f $file; my $fh = FileHandle->new(); unless( $fh->open( $file ) ) { error( loc( "Cannot open '%1': %2", $file, $! ) ); return; } $content = do { local $/; <$fh> }; } return unless $content; my $bphash = eval $content; return unless $bphash and ref $bphash eq 'HASH'; foreach my $type ('requires', 'build_requires') { next unless $bphash->{$type} and ref $bphash->{$type} eq 'HASH'; $prereqs->{$_} = $bphash->{$type}->{$_} for keys %{ $bphash->{$type} }; } } { delete $prereqs->{'perl'} unless version->new($CPANPLUS::Internals::VERSION) >= version->new('0.9102'); } ### allows for a user defined callback to filter the prerequisite ### list as they see fit, to remove (or add) any prereqs they see ### fit. The default installed callback will return the hashref in ### an unmodified form ### this callback got added after cpanplus 0.0562, so use a 'can' ### to find out if it's supported. For older versions, we'll just ### return the hashref as is ourselves. my $href = $cb->_callbacks->can('filter_prereqs') ? $cb->_callbacks->filter_prereqs->( $cb, $prereqs ) : $prereqs; $self->status->prereqs( $href ); ### make sure it's not the same ref return { %$href }; } =pod =head2 $dist->create([perl => '/path/to/perl', buildflags => 'EXTRA=FLAGS', prereq_target => TARGET, force => BOOL, verbose => BOOL, skiptest => BOOL]) C<create> preps a distribution for installation. This means it will run C<Build> and C<Build test>. This will also satisfy any prerequisites the module may have. If you set C<skiptest> to true, it will skip the C<Build test> stage. If you set C<force> to true, it will go over all the stages of the C<Build> process again, ignoring any previously cached results. It will also ignore a bad return value from C<Build test> and still allow the operation to return true. Returns true on success and false on failure. You may then call C<< $dist->install >> on the object to actually install it. =cut sub create { ### just in case you already did a create call for this module object ### just via a different dist object my $dist = shift; my $self = $dist->parent; ### we're also the cpan_dist, since we don't need to have anything ### prepared from another installer $dist = $self->status->dist_cpan if $self->status->dist_cpan; $self->status->dist_cpan( $dist ) unless $self->status->dist_cpan; my $cb = $self->parent; my $conf = $cb->configure_object; my %hash = @_; my $dir; unless( $dir = $self->status->extract ) { error( loc( "No dir found to operate on!" ) ); return; } my $args; my( $force, $verbose, $buildflags, $skiptest, $prereq_target, $perl, $prereq_format, $prereq_build); { local $Params::Check::ALLOW_UNKNOWN = 1; my $tmpl = { force => { default => $conf->get_conf('force'), store => \$force }, verbose => { default => $conf->get_conf('verbose'), store => \$verbose }, perl => { default => $^X, store => \$perl }, buildflags => { default => $conf->get_conf('buildflags'), store => \$buildflags }, skiptest => { default => $conf->get_conf('skiptest'), store => \$skiptest }, prereq_target => { default => '', store => \$prereq_target }, ### don't set the default format to 'build' -- that is wrong! prereq_format => { #default => $self->status->installer_type, default => '', store => \$prereq_format }, prereq_build => { default => 0, store => \$prereq_build }, }; $args = check( $tmpl, \%hash ) or return; } # restore the state as we have created this already. if ( $dist->status->created && !$force ) { ### add this directory to your lib ### $self->add_to_includepath(); return 1; } $dist->status->_create_args( $args ); ### is this dist prepared? unless( $dist->status->prepared ) { error( loc( "You have not successfully prepared a '%2' distribution ". "yet -- cannot create yet", __PACKAGE__ ) ); return; } ### chdir to work directory ### my $orig = cwd(); unless( $cb->_chdir( dir => $dir ) ) { error( loc( "Could not chdir to build directory '%1'", $dir ) ); return; } ### by now we've loaded module::build, and we're using the API, so ### it's safe to remove CPANPLUS::inc from our inc path, especially ### because it can trip up tests run under taint (just like EU::MM). ### turn off our PERL5OPT so no modules from CPANPLUS::inc get ### included in make test -- it should build without. ### also, modules that run in taint mode break if we leave ### our code ref in perl5opt ### XXX we've removed the ENV settings from cp::inc, so only need ### to reset the @INC #local $ENV{PERL5OPT} = CPANPLUS::inc->original_perl5opt; #local $ENV{PERL5LIB} = CPANPLUS::inc->original_perl5lib; #local @INC = CPANPLUS::inc->original_inc; ### but do it *before* the new_from_context, as M::B seems ### to be actually running the file... ### an unshift in the block seems to be ignored.. somehow... #{ my $lib = $self->best_path_to_module_build; # unshift @INC, $lib if $lib; #} unshift @INC, $self->best_path_to_module_build if $self->best_path_to_module_build; ### this will generate warnings under anything lower than M::B 0.2606 my @buildflags = $dist->_buildflags_as_list( $buildflags ); $dist->status->_buildflags( $buildflags ); my $fail; my $prereq_fail; my $test_fail; my $status = { }; RUN: { my @run_perl = ( '-e', CPDB_PERL_WRAPPER ); ### this will set the directory back to the start ### dir, so we must chdir /again/ my $ok = $dist->_resolve_prereqs( force => $force, format => $prereq_format, verbose => $verbose, prereqs => $self->status->prereqs, target => $prereq_target, prereq_build => $prereq_build, ); unless( $cb->_chdir( dir => $dir ) ) { error( loc( "Could not chdir to build directory '%1'", $dir ) ); return; } unless( $ok ) { #### use $dist->flush to reset the cache ### error( loc( "Unable to satisfy prerequisites for '%1' " . "-- aborting install", $self->module ) ); $dist->status->build(0); $fail++; $prereq_fail++; last RUN; } my ($captured, $cmd); if ( ON_VMS ) { $cmd = [$perl, BUILD->($dir), @buildflags]; } else { $cmd = [$perl, @run_perl, BUILD->($dir), @buildflags]; } unless ( scalar run( command => $cmd, buffer => \$captured, verbose => $verbose ) ) { error( loc( "MAKE failed:\n%1", $captured ) ); $dist->status->build(0); if ( $conf->get_conf('cpantest') ) { $status->{stage} = 'build'; $status->{capture} = $captured; } $fail++; last RUN; } msg( $captured, 0 ); $dist->status->build(1); ### add this directory to your lib ### $self->add_to_includepath(); ### this buffer will not include what tests failed due to a ### M::B/Test::Harness bug. Reported as #9793 with patch ### against 0.2607 on 26/1/2005 unless( $skiptest ) { my $test_output; if ( ON_VMS ) { $cmd = [$perl, BUILD->($dir), "test", @buildflags]; } else { $cmd = [$perl, @run_perl, BUILD->($dir), "test", @buildflags]; } unless ( scalar run( command => $cmd, buffer => \$test_output, verbose => $verbose ) ) { error( loc( "MAKE TEST failed:\n%1 ", $test_output ), ( $verbose ? 0 : 1 ) ); ### mark specifically *test* failure.. so we dont ### send success on force... $test_fail++; if( !$force and !$cb->_callbacks->proceed_on_test_failure->( $self, $@ ) ) { $dist->status->test(0); if ( $conf->get_conf('cpantest') ) { $status->{stage} = 'test'; $status->{capture} = $test_output; } $fail++; last RUN; } } else { msg( loc( "MAKE TEST passed:\n%1", $test_output ), 0 ); $dist->status->test(1); if ( $conf->get_conf('cpantest') ) { $status->{stage} = 'test'; $status->{capture} = $test_output; } } } else { msg(loc("Tests skipped"), $verbose); } } unless( $cb->_chdir( dir => $orig ) ) { error( loc( "Could not chdir back to start dir '%1'", $orig ) ); } ### send out test report? ### if( $conf->get_conf('cpantest') and not $prereq_fail ) { $cb->_send_report( module => $self, failed => $test_fail || $fail, buffer => CPANPLUS::Error->stack_as_string, status => $status, verbose => $verbose, force => $force, tests_skipped => $skiptest, ) or error(loc("Failed to send test report for '%1'", $self->module ) ); } return $dist->status->created( $fail ? 0 : 1 ); } =head2 $dist->install([verbose => BOOL, perl => /path/to/perl]) Actually installs the created dist. Returns true on success and false on failure. =cut sub install { ### just in case you already did a create call for this module object ### just via a different dist object my $dist = shift; my $self = $dist->parent; ### we're also the cpan_dist, since we don't need to have anything ### prepared from another installer $dist = $self->status->dist_cpan if $self->status->dist_cpan; my $cb = $self->parent; my $conf = $cb->configure_object; my %hash = @_; my $verbose; my $perl; my $force; my $buildflags; { local $Params::Check::ALLOW_UNKNOWN = 1; my $tmpl = { verbose => { default => $conf->get_conf('verbose'), store => \$verbose }, force => { default => $conf->get_conf('force'), store => \$force }, buildflags => { default => $conf->get_conf('buildflags'), store => \$buildflags }, perl => { default => $^X, store => \$perl }, }; my $args = check( $tmpl, \%hash ) or return; $dist->status->_install_args( $args ); } my $dir; unless( $dir = $self->status->extract ) { error( loc( "No dir found to operate on!" ) ); return; } my $orig = cwd(); unless( $cb->_chdir( dir => $dir ) ) { error( loc( "Could not chdir to build directory '%1'", $dir ) ); return; } ### value set and false -- means failure ### if( defined $self->status->installed && !$self->status->installed && !$force ) { error( loc( "Module '%1' has failed to install before this session " . "-- aborting install", $self->module ) ); return; } my $fail; my @buildflags = $dist->_buildflags_as_list( $buildflags ); my @run_perl = ( '-e', CPDB_PERL_WRAPPER ); ### hmm, how is this going to deal with sudo? ### for now, check effective uid, if it's not root, ### shell out, otherwise use the method if( $> ) { ### don't worry about loading the right version of M::B anymore ### the 'new_from_context' already added the 'right' path to ### M::B at the top of the build.pl my $cmd; if ( ON_VMS ) { $cmd = [$perl, BUILD->($dir), "install", @buildflags]; } else { $cmd = [$perl, @run_perl, BUILD->($dir), "install", @buildflags]; } ### Detect local::lib type behaviour. Do not use 'sudo' in these cases my $sudo = $conf->get_program('sudo'); SUDO: { ### Actual local::lib in use last SUDO if defined $ENV{PERL_MB_OPT} and $ENV{PERL_MB_OPT} =~ m!install_base!; ### 'buildflags' is configured with '--install_base' last SUDO if scalar grep { m!install_base! } @buildflags; ### oh well 'sudo make me a sandwich' unshift @$cmd, $sudo; } my $buffer; unless( scalar run( command => $cmd, buffer => \$buffer, verbose => $verbose ) ) { error(loc("Could not run '%1': %2", 'Build install', $buffer)); $fail++; } } else { my ($install_output, $cmd); if ( ON_VMS ) { $cmd = [$perl, BUILD->($dir), "install", @buildflags]; } else { $cmd = [$perl, @run_perl, BUILD->($dir), "install", @buildflags]; } unless( scalar run( command => $cmd, buffer => \$install_output, verbose => $verbose ) ) { error(loc("Could not run '%1': %2", 'Build install', $install_output)); $fail++; } else { msg( $install_output, 0 ); } } unless( $cb->_chdir( dir => $orig ) ) { error( loc( "Could not chdir back to start dir '%1'", $orig ) ); } return $dist->status->installed( $fail ? 0 : 1 ); } ### returns the string 'foo=bar --zot quux' ### as the list 'foo=bar', '--zot', 'qux' sub _buildflags_as_list { my $self = shift; my $flags = shift or return; return Module::Build->split_like_shell($flags); } =head1 AUTHOR Originally by Jos Boumans E<lt>kane@cpan.orgE<gt>. Brought to working condition by Ken Williams E<lt>kwilliams@cpan.orgE<gt>. Other hackery and currently maintained by Chris C<BinGOs> Williams ( no relation ). E<lt>bingos@cpan.orgE<gt>. =head1 LICENSE The CPAN++ interface (of which this module is a part of) is copyright (c) 2001, 2002, 2003, 2004, 2005 Jos Boumans E<lt>kane@cpan.orgE<gt>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. =cut qq[Putting the Module::Build into CPANPLUS]; # Local variables: # c-indentation-style: bsd # c-basic-offset: 4 # indent-tabs-mode: nil # End: # vim: expandtab shiftwidth=4:
liuyangning/WX_web
xampp/perl/lib/CPANPLUS/Dist/Build.pm
Perl
mit
29,024
#!/usr/bin/perl use Data::Dumper; use strict; use File::Basename; ### ### This 'ugly' perl script creates the wiki page for JsUpload ### It inspects the java classes looking for comments and put them in the wiki page. ### my $author = "[http://manolocarrasco.blogspot.com/ Manuel Carrasco Moñino]"; # Folder with source java files my $path = "src/main/java/jsupload/client/"; # Java classes to inspect my @classes = ('Upload', 'PreloadImage'); # Class with static constants my $constants = 'Const'; # Html file with javascript sample code my $htmlsample = "src/main/java/jsupload/public/JsUpload.html"; # Cgi-bin script my $cgifile = "src/main/java/jsupload/public/jsupload.cgi.pl"; # Php script my $phpfile = "src/main/java/jsupload/public/jsupload.php"; # Location of the sample aplication my $sample_location = "http://gwtupload.alcala.org/gupld/jsupload/JsUpload.html"; # Wiki template with library description my $wikitpl = "src/main/java/jsupload/public/JsUpload.wiki.txt"; # Output wiki page my $wikiout = "target/gwtupload.wiki/JsUpload_Documentation.wiki"; ######## MAIN my %const = processConst($constants); my $txt = docheader(); $txt .= "= Library API =\n"; $txt .= printConst("Const"); foreach my $cl (@classes) { $txt .= printClass($cl, processFile($cl)); } $txt .= doccgi($cgifile); $txt .= doccgi($phpfile); $txt .= docsample(); $txt .= "*Author:* _" . $author. "_\n\n"; my $date = `date`; $date =~ s/[\r\n]+//g; $txt .= "*Date:* _${date}_\n\n"; $txt .= "This documentation has been generated automatically parsing comments in java files, if you realise any error, please report it\n\n"; $txt =~ s/,(\s*\/\/[^\n]*\n\s*\})/$1/sg; $txt =~ s/,(\s*\n\s*\})/$1/sg; open(O, "> $wikiout") || die $!; print O $txt; close(O); print "Generated: $wikiout file\n"; exit; ######## sub processConst { my $class = shift; my %c; $c{class} = $class; my $file=$path . $class . ".java"; open(F, "$file") || die $!; my $on = 0; my $com = ""; while(<F>) { if (/\s*\/\*\*/) { $on = 1; $com = ""; } if ($on && /\s*\*\s+(.*)$/) { $com .= $1 . "\n"; } $on = 0 if (/\s*\*\//); if (/^\s*public\s+class\s+$class/) { $c{desc} = $com; $com = ""; } if ( /(protected|private)\s+.*String.*\s+(T[XI]T_[A-Z]+).*\s+=\s+"([^\"]+).*$/ ) { my ($nam, $def) = ($3); if ($com eq '' && /\/\/\s*\((.+)\)\s*\[(.+)\]\s*(.*)\s*$/) { $def = $2; $com = $3; my $c = $1; foreach (split(/[ ,]+/, $c)) { $com = "// $com" if ($com ne ''); $c{const}{$_}{regional} .= " $nam: $def, $com\n"; } } $com = ""; } elsif (/^\s*(public|protected)\s+.*static\s+.*\s+([A-Z_]+)\s*=/) { my ($type, $const, $nam, $def) = ($1, $2, "", ""); if ( /\s*=\s*\"([^"]+)/ ) { $nam = $1; } if ($com eq '' && /^.*\/\/(.+)$/){ $com=$1; } $com =~ s/^[\s\r\n]+//g; $com =~ s/[\s\r\n]+$//g; if ($com =~ /^ *\[(.+)\] *(.+)/s){ $com=$2; $def=$1; $com =~ s/\n/\n \/\/ /sg; } next if ($com =~ /\@not/); $c{const}{$const}{nam}=$nam; $c{const}{$const}{def}=$def; $c{const}{$const}{com}=$com; $c{const}{$const}{type}=$type; $com=""; } } close(F); return %c; } sub processFile { my $class = shift; my %c; my $file=$path . $class . ".java"; open(F, "$file") || die $!; my $on = 0; my $com = ""; while(<F>) { if ($on && /\s*\*\s+(.*)$/ && !/\@author/) { $com .= $1 . "\n"; } if (/\s*\/\*\*/) { $on = 1; $com = ""; } $on = 0 if (/\s*\*\//); if (/^\s*public\s+class\s+$class\s*/) { $c{desc} = $com; $com = ""; } if (/^\s*public\s$class\s*\(\s*JavaScriptObject/) { $c{hasconstructor} = 1; $c{desc} = $com if (! $c{desc}); $com = ""; } elsif (/\s*public\s+(.+)\s+(\w+)\s*\((.*)\)/) { my ($ret, $func, $arg) = ($1, $2, $3); my $set = ($ret =~ s/static\s+// ) ? "static" : "public"; next if ($com =~ /\@not/); next if ($func =~ /^(onChange|onClick|run)$/); my $idx = "$func . $arg"; $c{$set}{$idx}{func} = $func; $c{$set}{$idx}{ret} = $ret; $c{$set}{$idx}{arg} = $arg; $com =~ s/[\r\n]+$//; $com =~ s/^[\r\n]+//; $c{$set}{$idx}{com} = $com; $com=""; } #public static native String if (/Const\.([A-Z_]+)/) { next if (defined $c{const} && $c{const} =~ / $1 /); #$c{const} .= " " if (defined $c{const}); $c{const} .= " $1 "; } } close(F); return %c; } sub printConst { my ($class) = @_; my $ret = ""; my $tmp = $const{const}; foreach (keys %$tmp) { if ($const{const}{$_}{type} eq 'public') { $ret .= "jsc.$class.$_ //" . $const{const}{$_}{com} . "\n"; } } return ($ret ne '') ? "\n== $class ==\n_$const{desc}_\n * Public static constants\n{{{\n$ret}}}\n" : ""; } sub printClass { my ($name, %c) = @_; my $desc = $c{desc}; $desc =~ s/^[\r\n]+//g; $desc =~ s/[\r\n]+/\n /g; my $ret = unc("\n== $name ==\n_${desc}_\n"); $ret .= printConstructor($name, %c) if ($c{hasconstructor}); my $a = $c{public}; my $t = ""; foreach my $idx (keys %$a) { $t .= printMethod(1, $name, $idx, %c); } $ret .= " * Instance methods\n{{{\n$t}}}\n" if ($t ne ''); $a = $c{static}; $t = ""; foreach my $idx (keys %$a) { $t .= printMethod(0, $name, $idx, %c); } $ret .= " * Static methods\n{{{\n$t}}}\n" if ($t ne ''); return $ret; } sub printConstructor { my ($name, %c) = @_; my $var = lc($name); my $ret = ""; $ret .= " * Constructor\n"; $ret .= "{{{\nvar $var = new jsc.$name ({\n"; foreach (split(/\s+/, $c{const})) { my $d = $_; next if ($d eq '' || $d =~ /^\s+$/); if ($d =~ /regional/i) { $ret .= " " . $const{const}{$d}{nam} . ": { // " . $const{const}{$d}{com} . "\n" . $const{const}{$name}{regional} . " },\n" } elsif ($const{const}{$d}{nam}) { $ret .= " " . $const{const}{$d}{nam} . ": " . $const{const}{$d}{def} . ", // " . $const{const}{$d}{com} . "\n"; } } $ret .= "});\n}}}\n"; return $ret; } sub unc { my $w = shift; $w =~ s/([a-z])([A-Z])/"$1 ".uc($2)/eg; return $w } sub printMethod { my ($public, $name, $idx, %c) = @_; my $var = $public ? lc($name) : "jsc.$name"; my $set = $public ? "public": "static"; my $func = $c{$set}{$idx}{func}; my $ret = $c{$set}{$idx}{ret}; my $arg = $c{$set}{$idx}{arg}; my $com = $c{$set}{$idx}{com}; my $args = ""; if ($arg && $arg ne '') { foreach my $a (split(/\s*,\s*/, $arg)) { if ($a =~ /^\w+\s+(.+)$/) { $args .= "$1, "; } } $args =~ s/[, ]+$//; } $ret =~ s/^.*\s+(\w+)\s*$/$1/g; my $rets = ""; if ($ret ne 'void') { my $vname = lc($ret); $vname = "date" if ($vname eq 'javascriptobject' && $func !~ /data/i); $rets = "var a_" . $vname . " = "; } if ($com =~ /\n/) { $com = "/* $com */" } else { $com = "/* $com */" } return "\n$com\n$rets$var.$func($args);\n"; } sub docheader { my $ret = ""; open(W, $wikitpl) || die $! . " $wikitpl"; while(<W>){ $ret .= $_; } close(W); return $ret; } sub docsample { my $ret = ""; open(F, $htmlsample) || die $! . " $htmlsample" ; my $on = 0; while(<F>) { $on = 0 if (/<\/script/); $ret .= $_ if ($on); $on = 1 if (/<script\s+id='jsexample'>/); } close(F); $ret = "= Sample Code =\nYou can view this in action in the example [$sample_location here]\n{{{\n$ret\n}}}\n"; return $ret; } sub doccgi { my $file = shift; my $ret = ""; my $in = 0; open(F, $file) || die $! . " $file" ; while(<F>) { if (/^## \*(\s*.*)\s*$/) { my $l = $1; $in = 1 if ($l =~ /{{{$/); $ret .= "\n" if ($ret =~ /[\.\:]$/ ); $ret .= "\n " if ($l =~ /^[#\*] /); $l = "\n$l\n" if ($in); $ret .= "$l"; $in = 0 if ($l =~ /}}}$/); } } close(F); $ret =~ s/\n+/\n/g; my $name = basename($file); $ret = "= Server script ($name) =\n$ret\n"; return $ret; } exit;
cyrilmhansen/gwtupload
jsupload/gjslib.pl
Perl
apache-2.0
8,386
package CPANPLUS::Module::Author::Fake; use CPANPLUS::Module::Author; use CPANPLUS::Internals; use CPANPLUS::Error; use strict; use vars qw[@ISA]; use Params::Check qw[check]; @ISA = qw[CPANPLUS::Module::Author]; $Params::Check::VERBOSE = 1; =pod =head1 NAME CPANPLUS::Module::Author::Fake - dummy author object for CPANPLUS =head1 SYNOPSIS my $auth = CPANPLUS::Module::Author::Fake->new( author => 'Foo Bar', email => 'luser@foo.com', cpanid => 'FOO', _id => $cpan->id, ); =head1 DESCRIPTION A class for creating fake author objects, for shortcut use internally by CPANPLUS. Inherits from C<CPANPLUS::Module::Author>. =head1 METHODS =head2 new( _id => DIGIT ) Creates a dummy author object. It can take the same options as C<< CPANPLUS::Module::Author->new >>, but will fill in default ones if none are provided. Only the _id key is required. =cut sub new { my $class = shift; my %hash = @_; my $tmpl = { author => { default => 'CPANPLUS Internals' }, email => { default => 'cpanplus-info@lists.sf.net' }, cpanid => { default => 'CPANPLUS' }, _id => { default => CPANPLUS::Internals->_last_id }, }; my $args = check( $tmpl, \%hash ) or return; my $obj = CPANPLUS::Module::Author->new( %$args ) or return; unless( $obj->_id ) { error(loc("No '%1' specified -- No CPANPLUS object associated!",'_id')); return; } ### rebless object ### return bless $obj, $class; } 1; # Local variables: # c-indentation-style: bsd # c-basic-offset: 4 # indent-tabs-mode: nil # End: # vim: expandtab shiftwidth=4:
leighpauls/k2cro4
third_party/perl/perl/lib/CPANPLUS/Module/Author/Fake.pm
Perl
bsd-3-clause
1,738
package DDG::Goodie::VIN; # ABSTRACT: extract information about vehicle identification numbers use strict; use DDG::Goodie; zci is_cached => 1; zci answer_type => "vin"; triggers query_lc => qr/([\d+a-z]{17})| (^\d+$) /x; # Regex for VIN. my $vin_qr = qr/v(?:ehicle|)i(?:dentification|)n(?:umber|)/oi; my $tracking_qr = qr/package|track(?:ing|)|num(?:ber|)|\#/i; # Checksum for VIN. my %vin_checksum = ( 'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 'X', 'J' => 1, 'K' => 2, 'L' => 3, 'M' => 4, 'N' => 5, 'O' => 'X', 'P' => 7, 'Q' => 'X', 'R' => 9, 'S' => 2, 'T' => 3, 'U' => 4, 'V' => 5, 'W' => 6, 'X' => 7, 'Y' => 8, 'Z' => 9, ); my %vin_checksum_weight = ( '1' => 8, '2' => 7, '3' => 6, '4' => 5, '5' => 4, '6' => 3, '7' => 2, '8' => 10, '9' => 0, '10' => 9, '11' => 8, '12' => 7, '13' => 6, '14' => 5, '15' => 4, '16' => 3, '17' => 2, ); # VIN numbers. # 2008.07.29 force some letters because # "Alvin and the Chipmunks songs" passes checksum. # See http://en.wikipedia.org/wiki/Vehicle_identification_number#Check_digit_calculation # 2012.03.22 remove ^ and $ from 2nd regex term to also allow # 'vin <vin>, etc' -- a regular vin just triggers w.js? handle query_nowhitespace_nodash => sub { my ($query) = @_; # If a VIN number (2 for exclusively). my $is_vin = 0; # VIN number. my $vin_number = ''; # Exclsuive trigger. if ($query =~ /^$vin_qr.*?([A-Z\d]{17,})$/i || $query =~ /^([A-Z\d]{17,}).*?$vin_qr$/i) { $vin_number = uc $1; $is_vin = 2; # No exclusive trigger, do checksum. # Since the vin numbers are just numbers, # we are more strict in regex (e.g. than UPS). } elsif($query =~ /^(?:$tracking_qr|$vin_qr|)*([A-Z\d]{17})(?:$tracking_qr|$vin_qr|)*$/io || $query =~ /^(?:$tracking_qr|$vin_qr|)*([A-Z\d]{17})(?:$tracking_qr|$vin_qr|)*$/io) { $vin_number = uc $1; my $checksum = 0; my @chars = split( //, $vin_number ); my $length = scalar(@chars); my $char_count = 0; my $sum = 0; my $letter_count = 0; foreach my $char (@chars) { $char_count++; $letter_count++ if $char =~ /[A-Z]/; # Grab number. my $char_num = $char; $char_num = $vin_checksum{$char} if exists $vin_checksum{$char}; # Make sure number. if ( $char_num eq 'X' ) { $checksum = -1; last; } # Use weight. $sum += $char_num * $vin_checksum_weight{$char_count}; } $checksum = $sum % 11; $checksum = 'X' if $checksum == 10; if ($checksum eq $chars[8] && $letter_count > 3) { $is_vin = 1; } } return unless $is_vin; my $moreUrl = 'http://www.decodethis.com/VIN-Decoded/vin/' . $vin_number; return "Decode VIN ($vin_number) at Decode This: $moreUrl", structured_answer => { data => { title => "Vehicle Identification Number: $vin_number", href => $moreUrl }, templates => { group => 'text', options => { subtitle_content => 'DDH.vin.subtitle' } } }; return; }; 1;
Midhun-Jo-Antony/zeroclickinfo-goodies
lib/DDG/Goodie/VIN.pm
Perl
apache-2.0
3,506
#!/usr/bin/perl -w use strict; #### DEBUG my $DEBUG = 0; #$DEBUG = 1; =head2 NAME dumpDb PURPOSE DUMP ALL THE TABLES IN A DATABASE TO .TSV FILES INPUT 1. DATABASE NAME 2. LOCATION TO PRINT .TSV FILES OUTPUT 1. ONE .TSV FILE FOR EACH TABLE IN DATABASE USAGE ./dumpDb.pl <--db String> <--outputdir String> [-h] --db : Name of database --outputdir : Location of output directory --help : print this help message < option > denotes REQUIRED argument [ option ] denotes OPTIONAL argument EXAMPLE perl dumpDb.pl --db agua --outputdir /agua/0.6/bin/sql/dump =cut #### TIME my $time = time(); #### USE LIBS use FindBin qw($Bin); use lib "$Bin/../../lib"; #### INTERNAL MODULES use Agua::Configure; use Agua::DBaseFactory; use Timer; use Util; use Conf::Agua; #### EXTERNAL MODULES use Data::Dumper; use File::Path; use File::Copy; use Getopt::Long; #### GET OPTIONS my $db; my $dumpfile; my $outputdir; my $help; GetOptions ( 'db=s' => \$db, 'dumpfile=s' => \$dumpfile, 'outputdir=s' => \$outputdir, 'help' => \$help) or die "No options specified. Try '--help'\n"; if ( defined $help ) { usage(); } #### FLUSH BUFFER $| =1; #### CHECK INPUTS die "Database not defined (option --db)\n" if not defined $db; die "Output directory not defined (option --outputdir)\n" if not defined $outputdir; die "File with same name as output directory already exists: $outputdir\n" if -f $outputdir; #### CREATE OUTPUT DIRECTORY File::Path::mkpath($outputdir) if not -d $outputdir; die "Can't create output directory: $outputdir\n" if not -d $outputdir; #### SET LOG my $logfile = "/tmp/dumpdb.log"; my $SHOWLOG = 2; my $PRINTLOG = 5; #### GET CONF my $configfile = "$Bin/../../conf/default.conf"; my $conf = Conf::Agua->new({ inputfile => $configfile, logfile => $logfile, SHOWLOG => 2, PRINTLOG => 5 }); #### GET DATABASE INFO my $dbtype = $conf->getKey("database", 'DBTYPE'); my $database = $conf->getKey("database", 'DATABASE'); my $user = $conf->getKey("database", 'USER'); my $password = $conf->getKey("database", 'PASSWORD'); print "dumpDb.pl dbtype: $dbtype\n" if $DEBUG; print "dumpDb.pl user: $user\n" if $DEBUG; print "dumpDb.pl password: $password\n" if $DEBUG; print "dumpDb.pl database: $database\n" if $DEBUG; #### CREATE OUTPUT DIRECTORY File::Path::mkpath($outputdir) if not -d $outputdir; die "Can't create output directory: $outputdir\n" if not -d $outputdir; my $object = Agua::Configure->new({ conf => $conf, database => $db, configfile => $configfile, logfile => $logfile, SHOWLOG => $SHOWLOG, PRINTLOG => $PRINTLOG }); $object->setDbh(); my $dbobject = $object->dbobject(); my $timestamp = $object->_getTimestamp($database, $user, $password); $dumpfile = "$outputdir/$db.$timestamp.dump" if not defined $dumpfile; $object->_dumpDb($database, $user, $password, $dumpfile); print "dumpfile:\n\n$dumpfile\n\n"; #### PRINT RUN TIME my $runtime = Timer::runtime( $time, time() ); print "\n"; print "dumpDb.pl Run time: $runtime\n"; print "dumpDb.pl Completed $0\n"; print Util::datetime(), "\n"; print "dumpDb.pl ****************************************\n\n\n"; exit; #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # SUBROUTINES #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: sub usage { print `perldoc $0`; exit; }
agua/aguadev
bin/scripts/dumpDb.pl
Perl
mit
3,457
#!/usr/local/bin/perl -w =head1 NAME load_clones_from_fpc.pl - Populates a core Ensembl DB with FPC clone data =head1 SYNOPSIS perl load_clones_from_fpc.pl [options] fpc_file Options: -h --help -m --man -r --registry_file -s --species -f --fasta_file -c --cb_to_bp -n --no_insert =head1 OPTIONS Reads the B<fpc_file>, and uses its clone data to load feature tables (dna_align_feature at the moment). Should be run after the fpc assembly has been loaded using the load_assembly_from_fpc.pl script. B<-h --help> Print a brief help message and exits. B<-m --man> Print man page and exit B<-r --registry_file> Use this Ensembl registry file for database connection info. Default is <ENSEMBLHOME>/conf/ensembl.registry B<-s --species> Use this species entry from the registry file [REQUIRED]. B<-f --fasta_file> Fasta file (GenBank dump) containing sequences for all accessioned clones [REQUIRED]. TODO: Get sqeuences from GenBank at runtime using Entrez? B<-c --cb_to_bp> Conversion factor to convert native (cb) fpc coordinated into basepairs. Calculated by hand by comparison with coordinates shown on AGI browser. Default: 4096. B<-n --no_insert> Do not insert anything into the database. I.e. read-only mode. Useful for debug. =head1 DESCRIPTION B<This program> Populates a core Ensembl DB with FPC clone mappings. Could do with additional description! A good place to look for clone sequences is; /usr/local/data/fpc/<species>/<species>.fpc Maintained by Will Spooner <whs@ebi.ac.uk> =cut use strict; use warnings; use Getopt::Long; use Pod::Usage; use Data::Dumper qw(Dumper); # For debug use DBI; use FindBin qw( $Bin ); use File::Basename qw( dirname ); use vars qw( $BASEDIR ); BEGIN{ # Set the perl libraries $BASEDIR = dirname($Bin); unshift @INC, $BASEDIR.'/ensembl-live/ensembl/modules'; unshift @INC, $BASEDIR.'/bioperl-live'; } use Bio::EnsEMBL::Registry; use Bio::EnsEMBL::MiscFeature; use Bio::EnsEMBL::MiscSet; use Bio::EnsEMBL::Attribute; use Bio::EnsEMBL::SimpleFeature; use Bio::EnsEMBL::Analysis; use Bio::MapIO; use Bio::SeqIO; use Bio::EnsEMBL::Map::Marker; use Bio::EnsEMBL::Map::MarkerSynonym; use Bio::EnsEMBL::Map::MarkerFeature; use vars qw( $I $ENS_DBA $FPC_MAP $SCALING_FACTOR $SEQ_IO ); BEGIN{ #Argument Processing my $help=0; my $man=0; my( $species, $file, $cb_to_bp, $fasta_file, $no_insert ); GetOptions ( "help|?" => \$help, "man" => \$man, "species=s" => \$species, "registry_file=s" => \$file, "fasta_file=s" => \$fasta_file, "cb_to_bp=s" => \$cb_to_bp, "no_insert" => \$no_insert, ) or pod2usage(2); pod2usage(-verbose => 2) if $man; pod2usage(1) if $help; $I = $no_insert ? 0 : 1; # Put stuff in the database? # CB to BP scaling foctor. Calculated from AGI site. # Can we get this programatically? $SCALING_FACTOR = $cb_to_bp || 4096; # Validate file paths $file ||= $BASEDIR.'/conf/ensembl.registry'; my $fpc_file = shift @ARGV; $fpc_file || ( warn( "Need the path to an FPC file\n" ) && pod2usage(1)); $fasta_file || ( warn( "Need a --fasta_file" ) && pod2usage(1)); map{ -e $_ || ( warn( "File $_ does not exist\n" ) && pod2usage(1) ); -r $_ || ( warn( "Cannot read $_\n" ) && pod2usage(1) ); -f $_ || ( warn( "File $_ is not plain-text\n" ) && pod2usage(1) ); -s $_ || ( warn( "File $_ is empty\n" ) && pod2usage(1) ); } $file, $fpc_file, $fasta_file; # Set the FASTA_FILE warn( "Found a FASTA file: $fasta_file. Loading...\n" ); $SEQ_IO = Bio::SeqIO->new(-file=>$fasta_file, -format=>'fasta'); # Load the ensembl file $species || ( warn( "Need a --species\n" ) && pod2usage(1) ); Bio::EnsEMBL::Registry->load_all( $file ); $ENS_DBA = Bio::EnsEMBL::Registry->get_DBAdaptor( $species, 'core' ); $ENS_DBA || ( warn( "No core DB for $species set in $file\n" ) && pod2usage(1) ); # Load the FPC file warn( "Found an FPC file: $fpc_file. Loading...\n" ); my $mapio = new Bio::MapIO(-format => "fpc", -file => "$fpc_file", -readcor => 0, -verbose => 0); $FPC_MAP = $mapio->next_map(); # Single map per FPC file } #warn Dumper( $fpcmap ); #&list_contigs_by_chromosome($fpcmap); my $meta = $ENS_DBA->get_MetaContainer(); my $species = $meta->get_Species || die( "Cannot find the species in the meta table of the DB" ); my $common_name = $species->common_name || die( "Cannot find the species common name in the meta table of the DB" ); $common_name = ucfirst( $common_name ); ########### # Prepare some Ensembl adaptors #my $analysis = &fetch_analysis( $common_name."_BAC_FPC" ); my $marker_analysis = &fetch_analysis( $common_name."_marker" ); my $sl_adapt = $ENS_DBA->get_adaptor('Slice'); my $f_adapt = $ENS_DBA->get_adaptor('SimpleFeature'); my $mf_adapt = $ENS_DBA->get_adaptor('MiscFeature'); ########### # Process the BAC sequence file from GenBank to map clone names to # accessions my %accessions_by_name; my %accessioned_length; my %all_accessions; # Keep tally for reporting warn( "Processing fasta file containing accessioned clones" ); while ( my $seq = $SEQ_IO->next_seq() ) { my $name = $seq->display_name; my $description = $seq->description; my( $accession, $version, $clone_name ); if( $name =~ m/^gi\|\d+\|gb\|(\w+)\.(\d+)\|.*$/ ){ # Parse genbank header $accession = $1; $version = $2; $all_accessions{$accession} = 0; $accessioned_length{$accession} = $seq->length; $accessions_by_name{$accession} = $accession; $accessions_by_name{$version} = $accession; } else { warn( "Cannot determine accession from $name" ); next; } foreach my $clone ( $description =~ /clone ([A-Z]+(\w+))/ ){ # Clone names can be prefixed with library. Try both with and without $accessions_by_name{$1} = $accession; $accessions_by_name{$2} = $accession; } } ########### # Establish the different classes of feature. Similar to analysis my $misc_set_fpc = Bio::EnsEMBL::MiscSet->new (-code => 'superctgs', # Must conform to Ensembl for display -name => 'FPC Contig', -description => '', -longest_feature => 8000000 ); my $misc_set_bac = Bio::EnsEMBL::MiscSet->new (-code => 'bac_map', # Must conform to Ensembl for display -name => 'BAC map', -description => 'Full list of FPC BAC clones', -longest_feature => 250000 ); my $misc_set_accbac = Bio::EnsEMBL::MiscSet->new (-code => 'acc_bac_map', # Must conform to Ensembl for display -name => 'Accessioned BAC map', -description => 'List of mapped and accessioned BAC clones', -longest_feature => 250000 ); ########### # Loop through each FPC contig foreach my $ctgid( sort $FPC_MAP->each_contigid ){ $ctgid || next; # Skip ctg 0 # last; # Create a slice from the FPC contig my $ctg_name = "ctg$ctgid"; my $ctg_slice = $sl_adapt->fetch_by_region(undef,$ctg_name); $ctg_slice || die( "FPC Contig $ctg_name was not found in the Ensembl DB" ); warn( "Processing $ctg_name at ",$ctg_slice->name ); # Load the FPC as a misc feature my $fpc_feature = Bio::EnsEMBL::MiscFeature->new ( -start => $ctg_slice->start, -end => $ctg_slice->end, -strand => 1, -slice => $ctg_slice, ); my $fpcname_attrib = Bio::EnsEMBL::Attribute->new ( -VALUE => $ctg_slice->seq_region_name, -CODE => 'name', -NAME => 'name' ); $fpc_feature->add_MiscSet($misc_set_fpc); $fpc_feature->add_Attribute($fpcname_attrib); $fpc_feature = $fpc_feature->transform('chromosome'); $mf_adapt->store( $fpc_feature ) if $I; # Process each clone on FPC my $ctg = $FPC_MAP->get_contigobj( $ctgid ); my @clones = $ctg->each_cloneid; warn( " Num clones on $ctg_name: ",scalar(@clones) ); foreach my $cloneid( sort $ctg->each_cloneid ){ my $clone = $FPC_MAP->get_cloneobj( $cloneid ); #my $clone_tmpl = " Clone %s at Ctg %s:%s-%s\n"; #printf( $clone_tmpl, $clone->name, $clone->contigid, # $clone->range->start, $clone->range->end ); my $start = $SCALING_FACTOR * $clone->range->start; my $end = $SCALING_FACTOR * $clone->range->end; my $clone_name = $clone->name; my $feature = Bio::EnsEMBL::MiscFeature->new ( -start => $start, -end => $end, -strand => 1, -slice => $ctg_slice, ); # Populate the feature with a variety of attributes $feature->add_MiscSet($misc_set_bac); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -VALUE => $clone_name, -CODE => 'name', -NAME => 'name' ) ); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -VALUE => $ctg_name, -CODE => 'superctg', -NAME => 'FPC contig name' ) ); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -VALUE => $start, -CODE => 'inner_start', -NAME => 'Max start value' ) ); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -VALUE => $end, -CODE => 'inner_end', -NAME => 'Min end value' ) ); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -VALUE => $end-$start+1, -CODE => 'fp_size', -NAME => 'FP size' ) ); if( my $acc = $accessions_by_name{$clone_name} ){ # This is an accessioned clone $all_accessions{$acc} ++; $feature->add_MiscSet($misc_set_accbac); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -CODE => 'state', -NAME => 'Current state of clone', -VALUE => '12:Accessioned' ) ); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -CODE => 'embl_acc', -NAME => 'Accession number', -VALUE => "$acc" ) ); $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -CODE => 'seq_len', -NAME => 'Accession length', -VALUE => $accessioned_length{$acc} ) ); } else { # This is a free-state clone $feature->add_Attribute( Bio::EnsEMBL::Attribute->new ( -CODE => 'state', -NAME => 'Current state of clone', -VALUE => '06:Free' ) ); } # Store $feature = $feature->transform('chromosome'); $mf_adapt->store( $feature ) if $I; } } ########### # Loop through each marker. my $marker_feature_adaptor = $ENS_DBA->get_adaptor('MarkerFeature'); my $marker_adaptor = $ENS_DBA->get_adaptor('Marker'); my @markers = $FPC_MAP->each_markerid(); warn( " Num markers: ",scalar(@markers) ); foreach my $marker( @markers ){ # last; my $markerobj = $FPC_MAP->get_markerobj($marker); my $type = $markerobj->type; # STS, eMRK, Probe, OVERGO my $ensmarker = Bio::EnsEMBL::Map::Marker->new(); $ensmarker->display_MarkerSynonym ( Bio::EnsEMBL::Map::MarkerSynonym->new(undef,$type,$marker) ); $ensmarker->priority(100); #Ensure marker displays # get all the contigs where this marker hit my @contigs = $markerobj->each_contigid(); foreach my $ctgid( @contigs ) { $ctgid || next; # Skip empty contig # Create a slice from the FPC contig my $ctg_name = "ctg$ctgid"; my $ctg_slice = $sl_adapt->fetch_by_region(undef,$ctg_name); $ctg_slice || die( "FPC $ctg_name was not found in the Ensembl DB" ); # Create the marker feature my $maploc = $markerobj->position($ctgid); my $marker_feature = Bio::EnsEMBL::Map::MarkerFeature->new ( undef, #DBid undef, #MarkerFeatureAdaptor $maploc * $SCALING_FACTOR, # Start ($maploc+1) * $SCALING_FACTOR, # End - assume length=SCALING_FACTOR $ctg_slice, # Slice $marker_analysis, # Analysis undef, # Marker ID? scalar( @contigs ), # map weight $ensmarker, # Ensembl Marker ); $marker_feature = $marker_feature->transform('chromosome') || ( warn("No chr mapping for $marker!") && next ); $marker_feature_adaptor->store( $marker_feature ) if $I; } } warn( "Found ", scalar( grep{$_} values %all_accessions ), " accessioned clones in FPC\n" ); warn( "Lost ", scalar( grep{! $_} values %all_accessions ), " accessioned clones from FPC\n" ); exit; #====================================================================== sub list_contigs_by_chromosome{ my $FPC_MAP = shift; my %chr_data; my %lengths; my $scaler = $SCALING_FACTOR || 4096; foreach my $ctgname( $FPC_MAP->each_contigid ){ $ctgname || next; # Skip empty my $ctgobj = $FPC_MAP->get_contigobj($ctgname); my $ctgpos = $ctgobj->position+0 || 0; my $ctgstart = $ctgobj->range->start || 0; my $ctgend = $ctgobj->range->end || 0; my $ctgbasepair = $ctgend * $scaler; my $chr = $ctgobj->group || ''; $chr_data{$chr} ||= []; push @{$chr_data{$chr}}, [ $ctgname, sprintf( "%.2f", $ctgpos ), #$ctgstart, $ctgend , $ctgbasepair, ]; my $l_n = length($ctgname); my $l_p = length($ctgpos); my $l_s = length($ctgstart); my $l_e = length($ctgend); my $l_b = length($ctgbasepair); if( $l_n > ($lengths{name} ||0) ){ $lengths{name} = $l_n } if( $l_p > ($lengths{pos} ||0) ){ $lengths{pos} = $l_p } if( $l_s > ($lengths{start}||0) ){ $lengths{start}= $l_s } if( $l_e > ($lengths{end} ||0) ){ $lengths{end} = $l_e } if( $l_b > ($lengths{bp} ||0) ){ $lengths{bp} = $l_b } } my $num_per_line = 3; $lengths{name} += 3; # Allow for ctg prefix my $entry_t = join( " ", "|", "%-${lengths{name}}s", "%${lengths{pos}}s", #"%${lengths{start}}s", "%${lengths{end}}s", "%${lengths{bp}}s", "|" ); my $tmpl = " ". ( $entry_t x $num_per_line ) . "\n"; # Loop through each chromosome and print FPC data foreach my $chr( sort{$a<=>$b} keys %chr_data ){ my @ctgs = sort{$a->[0]<=>$b->[0]} @{$chr_data{$chr}}; map{ $_->[0] = "Ctg".$_->[0] } @ctgs; my $total_length = 0; map{ $total_length += $_->[3] } @ctgs; my $num_ctgs = scalar( @ctgs ); print( "Chr: $chr ($num_ctgs FPCs, $total_length bp)\n" ); while( my @entries = splice( @ctgs, 0, $num_per_line ) ){ my @data = ( map{defined($_) ? $_ : ''} map{@{$entries[$_-1]||[]}[0..3]} (1..$num_per_line) ); #warn Dumper( @data ); printf( $tmpl, @data ); } } } #====================================================================== # Returns an Analysis object; either fetched from the DB if one exists, # or created fresh, in which case it is stored to the DB. sub fetch_analysis{ my $logic_name = shift || die("Need a logic_name" ); my $db_file = shift || ''; my $adaptor = $ENS_DBA->get_adaptor('Analysis'); my %args = ( -logic_name=>$logic_name, $db_file ? (-db_file=>$db_file) : () ); # Hard-coded nastyness to make analyses correspond to Ensembl # None needed for now if( $logic_name eq 'MyAnalysis' ){ $args{-logic_name} = 'MyLogic'; $args{-db} = 'MyDB'; $args{-program} = 'MyProgram'; } my $analysis; if( $analysis = $adaptor->fetch_by_logic_name($args{-logic_name}) ){ # Analysis found in database already; use this. return $analysis; } # No analysis - create one from scratch $analysis = Bio::EnsEMBL::Analysis->new(%args); $adaptor->store($analysis) if $I; return $analysis; } #====================================================================== 1;
warelab/gramene-ensembl
maize/load-scripts/load_clones_from_fpc.pl
Perl
mit
16,626
package WorldCup::Command::teams; # ABSTRACT: Returns the teams in the World Cup. use strict; use warnings; use WorldCup -command; use JSON; use LWP::UserAgent; use File::Basename; use Term::ANSIColor; use List::Util qw(max); sub opt_spec { return ( [ "outfile|o=s", "A file to place a listing of the teams" ], ); } sub validate_args { my ($self, $opt, $args) = @_; my $command = __FILE__; if ($self->app->global_options->{man}) { system([0..5], "perldoc $command"); } else { $self->usage_error("Too many arguments.") if @$args; } } sub execute { my ($self, $opt, $args) = @_; exit(0) if $self->app->global_options->{man}; my $outfile = $opt->{outfile}; my $result = _fetch_teams($outfile); } sub _fetch_teams { my ($outfile) = @_; my $out; if ($outfile) { open $out, '>', $outfile or die "\nERROR: Could not open file: $!\n"; } else { $out = \*STDOUT; } my $ua = LWP::UserAgent->new; my $urlbase = 'http://worldcup.sfg.io/teams'; my $response = $ua->get($urlbase); unless ($response->is_success) { die "Can't get url $urlbase -- ", $response->status_line; } my $matches = decode_json($response->content); my @teamlens; my %grouph; my %groups_seen; my $group_map = { '1' => 'A', '2' => 'B', '3' => 'C', '4' => 'D', '5' => 'E', '6' => 'F', '7' => 'G', '8' => 'H' }; for my $group ( sort { $a->{group_id} <=> $b->{group_id} } @{$matches} ) { if (exists $group_map->{$group->{group_id}}) { push @{$grouph{$group_map->{$group->{group_id}}}}, join "|", $group->{fifa_code}, $group->{country}; push @teamlens, length($group->{country}); } else { $grouph{$group_map->{$group->{group_id}}} = join "|", $group->{fifa_code}, $group->{country}; push @teamlens, length($group->{country}); } } my $namelen = max(@teamlens); my $len = $namelen + 2; for my $groupid (sort keys %grouph) { my $header = pack("A$len A*", "Group $groupid", "FIFA Code"); if ($outfile) { print $out $header, "\n"; } else { print $out colored($header, 'bold underline'), "\n"; } for my $team (@{$grouph{$groupid}}) { my ($code, $country) = split /\|/, $team; print $out pack("A$len A*", $country, $code), "\n"; } print "\n"; } close $out; } 1; __END__ =pod =head1 NAME worldcup teams - Get the team name, with 3-letter FIFA code, listed by group =head1 SYNOPSIS worldcup teams -o wcteams =head1 DESCRIPTION Print a table showing all teams in the World Cup, displayed by the group, along with the 3-letter FIFA code for each team. The 3-letter FIFA code can be used for getting metainformation about team results in the tournament. =head1 AUTHOR S. Evan Staton, C<< <statonse at gmail.com> >> =head1 REQUIRED ARGUMENTS =over 2 =item -o, --outfile A file to place the World Cup team information =back =head1 OPTIONS =over 2 =item -h, --help Print a usage statement. =item -m, --man Print the full documentation. =back =cut
sestaton/WorldCupStats
lib/WorldCup/Command/teams.pm
Perl
mit
3,201
use strict; use Data::Dumper; use Carp; # # This is a SAS Component # =head1 NAME roles_to_complexes =head1 SYNOPSIS roles_to_complexes [arguments] < input > output =head1 DESCRIPTION roles_to_complexes allows a user to connect Roles to Complexes, from there, the connection exists to Reactions (although in the actual ER-model model, the connection from Complex to Reaction goes through ReactionComplex). Since Roles also connect to fids, the connection between fids and Reactions is induced. Example: roles_to_complexes [arguments] < input > output The standard input should be a tab-separated table (i.e., each line is a tab-separated set of fields). Normally, the last field in each line would contain the identifer. If another column contains the identifier use -c N where N is the column (from 1) that contains the subsystem. This is a pipe command. The input is taken from the standard input, and the output is to the standard output. For each line of input there may be multiple lines of output, one per complex associated with the role. Two columns are appended to the input line, the optional flag, and the complex id. =head1 COMMAND-LINE OPTIONS Usage: roles_to_complexes [arguments] < input > output -c num Select the identifier from column num -i filename Use filename rather than stdin for input =head1 AUTHORS L<The SEED Project|http://www.theseed.org> =cut our $usage = "usage: roles_to_complexes [-c column] < input > output"; use Bio::KBase::CDMI::CDMIClient; use Bio::KBase::Utilities::ScriptThing; my $column; my $input_file; my $kbO = Bio::KBase::CDMI::CDMIClient->new_for_script('c=i' => \$column, 'i=s' => \$input_file); if (! $kbO) { print STDERR $usage; exit } my $ih; if ($input_file) { open $ih, "<", $input_file or die "Cannot open input file $input_file: $!"; } else { $ih = \*STDIN; } while (my @tuples = Bio::KBase::Utilities::ScriptThing::GetBatch($ih, undef, $column)) { my @h = map { $_->[0] } @tuples; my $h = $kbO->roles_to_complexes(\@h); for my $tuple (@tuples) { # # Process output here and print. # my ($id, $line) = @$tuple; my $v = $h->{$id}; if (! defined($v)) { print STDERR $line,"\n"; } else { foreach $_ (@$v) { my($complex,$optional) = @$_; print "$line\t$optional\t$complex\n"; } } } } __DATA__
kbase/kb_seed
scripts/roles_to_complexes.pl
Perl
mit
2,489
#!/usr/bin/perl $usage = qq{ rnaseqIds.pl <rnaseq-data> <rnaseq-data> e.g. Ctr1_Lt_0h.txt or AAAAAA.txt }; die "$usage" unless @ARGV == 1; $file = $ARGV[0]; $med4 = 0; $phm2 = 0; open (FILE, $file) or die "No likey the file $file!"; @data = <FILE>; close FILE; foreach $line (@data) { chomp $line; @fields = split(/\t/,$line); if ($fields[0] eq "MED4") { $med4 += 1; if ($med4 < 10) { $fields[0] = "MED4-000$med4"; } elsif ($med4 < 100) { $fields[0] = "MED4-00$med4"; } elsif ($med4 < 1000) { $fields[0] = "MED4-0$med4"; } else { $fields[0] = "MED4-$med4"; } $newline = join("\t",@fields); print "$newline\n"; } if ($fields[0] eq "PHM2") { $phm2 += 1; if ($phm2 < 10) { $fields[0] = "PHM2-00$phm2"; } elsif ($phm2 < 100) { $fields[0] = "PHM2-0$phm2"; } else { $fields[0] = "PHM2-$phm2"; } $newline = join("\t",@fields); print "$newline\n"; } } exit;
cuttlefishh/papers
cyanophage-light-dark-transcriptomics/code/rnaseqIds.pl
Perl
mit
947
package NullSock; use strict; use warnings; sub new { bless {}, shift } sub send { } 1;
bpa/cyborg-rally
lib/NullSock.pm
Perl
mit
92
#!/usr/bin/env perl6 use v6.c; class Node { has Str $.id; has Int $.x; has Int $.y; has Int $.size; has Int $.used is rw; has Int $.avail is rw; method new(Int() :$x, Int() :$y, Int() :$size, Int() :$used, Int() :$avail) { return self.bless(:$x, :$y, :$size, :$used, :$avail, :id("($x,$y)")); } method clear_ids() { $!id = "" } method gist() { "\{$!x,$!y\} $!id" } method changed() { $!id ne "($!x,$!y)" } method add_ids($ids) { my @ids = $!id.comb(/\S+/); @ids.append: $ids.comb(/\S+/); $!id = join " ", @ids.sort.grep: { /\S/ } } } class Cluster { has $.rows = 0; has $.cols = 0; has @.node-array; has @.moves; method clone() { my $clone = self.new(:rows($!rows), :cols($!cols), :moves(@!moves)); for ^$!rows X, ^$!cols -> [$x, $y] { $clone.node-array[$y;$x] = @!node-array[$y;$x].clone; } return $clone; } method id() { self.nodes.grep({ .changed })».gist.join(";") } multi method at(Node $node --> Node) is pure { @!node-array[$node.y;$node.x] } multi method at(Int $x, Int $y --> Node) is pure { @!node-array[$y;$x] } method add(Node $node) { $!rows = $node.y + 1 if $node.y >= $!rows; $!cols = $node.x + 1 if $node.x >= $!cols; @!node-array[$node.y;$node.x] = $node; return self; } method clone-move(Node $a, Node $b) { my $clone = self.clone; $clone.move($clone.at($a), $clone.at($b)); return $clone; } method move(Node $a, Node $b) { @!moves.append: "($a.x(),$a.y()) -> ($b.x(),$b.y())"; $b.used += $a.used; $b.avail = $b.size - $b.used; $b.add_ids($a.id); $a.used = 0; $a.avail = $a.size; $a.clear_ids(); return self; } method nodes() { gather for @!node-array -> @row { for @row { take $_ if .defined } } } method viable-pairs() { gather for self.nodes.combinations(2) -> [ $a, $b ] { take ($a, $b) if $a.used > 0 and $a.used <= $b.avail; take ($b, $a) if $b.used > 0 and $b.used <= $a.avail; } } multi method viable-moves(Node $node) { self.viable-moves($node.x, $node.y) } multi method viable-moves($x, $y) { my $node = self.at($x, $y); gather for self.neighbors($x, $y) -> $b { take ($node, $b) if $node.used > 0 and $node.used <= $b.avail; } } multi method neighbors(Node $node) is pure { self.neighbors($node.x, $node.y) } multi method neighbors(Int $x, Int $y) is pure { gather { take @!node-array[$y-1;$x] if $y > 0 and @!node-array[$y-1;$x]; take @!node-array[$y+1;$x] if @!node-array[$y+1;$x]; take @!node-array[$y;$x-1] if $x > 0 and @!node-array[$y;$x-1]; take @!node-array[$y;$x+1] if @!node-array[$y;$x+1]; } } } sub load($file) { my $cluster = Cluster.new; for $file.IO.lines { when / ^ "#" / { 1; } when / "node-x" $<x>=(\d+) "-y" $<y>=(\d+) <ws> $<size>=(\d+)T <ws> $<used>=(\d+)T <ws> $<avail>=(\d+)T / { $cluster.add( Node.new(|$/.hash) ); } default { die "Can't parse $_" } } return $cluster; } sub MAIN(IO() $file="22.in", :$wanted = "(32,0)") { my @todo = load($file); my %seen; while @todo { my $cluster = @todo.shift; next if %seen{$cluster.id}++; if $cluster.at(0,0).id.contains($wanted) { .say for $cluster.moves; say "Finish in { $cluster.moves.elems } moves"; exit; } for $cluster.nodes -> $node { for $cluster.viable-moves($node) -> [ $a, $b ] { @todo.append: $cluster.clone-move($a, $b); } } say "TODO: ", @todo.elems; } }
duelafn/advent-of-code-2016-in-perl6
2016/advent-of-code/22.pl
Perl
mit
3,936
#!/usr/bin/perl # ----------------------------------------------------------------- # # The HMM-Based Speech Synthesis System (HTS) # # developed by HTS Working Group # # http://hts.sp.nitech.ac.jp/ # # ----------------------------------------------------------------- # # # # Copyright (c) 2001-2012 Nagoya Institute of Technology # # Department of Computer Science # # # # 2001-2008 Tokyo Institute of Technology # # Interdisciplinary Graduate School of # # Science and Engineering # # # # All rights reserved. # # # # Redistribution and use in source and binary forms, with or # # without modification, are permitted provided that the following # # conditions are met: # # # # - Redistributions of source code must retain the above copyright # # notice, this list of conditions and the following disclaimer. # # - Redistributions in binary form must reproduce the above # # copyright notice, this list of conditions and the following # # disclaimer in the documentation and/or other materials provided # # with the distribution. # # - Neither the name of the HTS working group nor the names of its # # contributors may be used to endorse or promote products derived # # from this software without specific prior written permission. # # # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND # # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, # # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS # # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED # # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # # POSSIBILITY OF SUCH DAMAGE. # # ----------------------------------------------------------------- # if ( @ARGV < 3 ) { print "window.pl dimensionality infile winfile1 winfile2 ... \n"; exit(0); } $ignorevalue = -1.0e+10; # dimensionality of input vector $dim = $ARGV[0]; # open infile as a sequence of static coefficients open( INPUT, "$ARGV[1]" ) || die "cannot open file : $ARGV[1]"; @STAT = stat(INPUT); read( INPUT, $data, $STAT[7] ); close(INPUT); $nwin = @ARGV - 2; $n = $STAT[7] / 4; # number of data $T = $n / $dim; # number of frames of original data # load original data @original = unpack( "f$n", $data ); # original data must be stored in float, natural endian # apply window for ( $i = 1 ; $i <= $nwin ; $i++ ) { # load $i-th window coefficients open( INPUT, "$ARGV[$i+1]" ) || die "cannot open file : $ARGV[$i+1]"; $data = <INPUT>; @win = split( ' ', $data ); $size = $win[0]; # size of this window # check boundary falgs @chkbound = (); for ( $j = 0 ; $j <= $size ; $j++ ) { $chkbound[$j] = 1; } for ( $j = 1 ; $j <= $size ; $j++ ) { last if ($win[$j] != 0.0); $chkbound[$j] = 0; } for ( $j = $size ; $j >= 1 ; $j-- ) { last if ($win[$j] != 0.0); $chkbound[$j] = 0; } if ( $size % 2 != 1 ) { die "Size of window must be 2*n + 1 and float"; } $nlr = ( $size - 1 ) / 2; # calcurate $i-th coefficients for ( $t = 0 ; $t < $T ; $t++ ) { for ( $j = 0 ; $j < $dim ; $j++ ) { # check space boundary (ex. voiced/unvoiced boundary) $boundary = 0; for ( $k = -$nlr ; $k <= $nlr ; $k++ ) { if ( $chkbound[ $k + $nlr + 1 ] == 1 ) { if ( $t + $k < 0 ) { $l = 0; } elsif ( $t + $k >= $T ) { $l = $T - 1; } else { $l = $t + $k; } if ( $original[ $l * $dim + $j ] == $ignorevalue ) { $boundary = 1; } } } if ( $boundary == 0 ) { $transformed[ $t * $nwin * $dim + $dim * ( $i - 1 ) + $j ] = 0.0; for ( $k = -$nlr ; $k <= $nlr ; $k++ ) { if ( $t + $k < 0 ) { $transformed[ $t * $nwin * $dim + $dim * ( $i - 1 ) + $j ] += $win[ $k + $nlr + 1 ] * $original[$j]; } elsif ( $t + $k >= $T ) { $transformed[ $t * $nwin * $dim + $dim * ( $i - 1 ) + $j ] += $win[ $k + $nlr + 1 ] * $original[ ( $T - 1 ) * $dim + $j ]; } else { $transformed[ $t * $nwin * $dim + $dim * ( $i - 1 ) + $j ] += $win[ $k + $nlr + 1 ] * $original[ ( $t + $k ) * $dim + $j ]; } } } else { $transformed[ $t * $nwin * $dim + $dim * ( $i - 1 ) + $j ] = $ignorevalue; } } } } $n = $n * $nwin; $data = pack( "f$n", @transformed ); print $data;
yutarochan/JavaOpenJtalk
util/HTS-demo_NIT-ATR503-M001/data/scripts/window.pl
Perl
mit
5,970
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package storage::netapp::ontap::restapi::mode::snapmirrors; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); sub custom_status_output { my ($self, %options) = @_; return sprintf( 'healthy: %s [state: %s] [transfer state: %s]', $self->{result_values}->{healthy}, $self->{result_values}->{state}, $self->{result_values}->{transfer_state} ); } sub prefix_snapmirror_output { my ($self, %options) = @_; return "Snapmirror '" . $options{instance_value}->{display} . "' "; } sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'snapmirrors', type => 1, cb_prefix_output => 'prefix_snapmirror_output', message_multiple => 'All snapmirrors are ok' } ]; $self->{maps_counters}->{snapmirrors} = [ { label => 'status', type => 2, critical_default => '%{healthy} ne "true" or %{state} eq "broken_off"', set => { key_values => [ { name => 'healthy' }, { name => 'state' }, { name => 'transfer_state' }, { name => 'display' } ], closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold_ng } } ]; } sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); bless $self, $class; $options{options}->add_options(arguments => { 'filter-name:s' => { name => 'filter_name' } }); return $self; } sub manage_selection { my ($self, %options) = @_; my $snapmirrors = $options{custom}->request_api(endpoint => '/api/snapmirror/relationships?fields=*'); $self->{snapmirrors} = {}; foreach (@{$snapmirrors->{records}}) { my $name = $_->{source}->{path} . '-' . $_->{destination}->{path}; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { $self->{output}->output_add(long_msg => "skipping snapmirror '" . $name . "': no matching filter.", debug => 1); next; } $self->{snapmirrors}->{$name} = { display => $name, healthy => $_->{healthy} =~ /true|1/i ? 'true' : 'false', state => $_->{state}, transfer_state => defined($_->{transfer}->{state}) ? $_->{transfer}->{state} : 'n/a' }; } if (scalar(keys %{$self->{snapmirrors}}) <= 0) { $self->{output}->add_option_msg(short_msg => "No snapmirror found"); $self->{output}->option_exit(); } } 1; __END__ =head1 MODE Check snapmirrors. =over 8 =item B<--filter-name> Filter snapmirror name (can be a regexp). =item B<--unknown-status> Set unknown threshold for status. Can used special variables like: %{healthy}, %{state}, %{transfer_state}, %{display} =item B<--warning-status> Set warning threshold for status. Can used special variables like: %{healthy}, %{state}, %{transfer_state}, %{display} =item B<--critical-status> Set critical threshold for status (Default: '%{healthy} ne "true" or %{state} eq "broken_off"'). Can used special variables like: %{healthy}, %{state}, %{transfer_state}, %{display} =back =cut
centreon/centreon-plugins
storage/netapp/ontap/restapi/mode/snapmirrors.pm
Perl
apache-2.0
4,254
package Paws::ElastiCache::Event; use Moose; has Date => (is => 'ro', isa => 'Str'); has Message => (is => 'ro', isa => 'Str'); has SourceIdentifier => (is => 'ro', isa => 'Str'); has SourceType => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::ElastiCache::Event =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::ElastiCache::Event object: $service_obj->Method(Att1 => { Date => $value, ..., SourceType => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::ElastiCache::Event object: $result = $service_obj->Method(...); $result->Att1->Date =head1 DESCRIPTION Represents a single occurrence of something interesting within the system. Some examples of events are creating a cache cluster, adding or removing a cache node, or rebooting a node. =head1 ATTRIBUTES =head2 Date => Str The date and time when the event occurred. =head2 Message => Str The text of the event. =head2 SourceIdentifier => Str The identifier for the source of the event. For example, if the event occurred at the cache cluster level, the identifier would be the name of the cache cluster. =head2 SourceType => Str Specifies the origin of this event - a cache cluster, a parameter group, a security group, etc. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::ElastiCache> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/ElastiCache/Event.pm
Perl
apache-2.0
1,917
#!/usr/bin/env perl # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. =head1 NAME backup_master.pl =head1 DESCRIPTION This script is a wrapper around sudo and mysqldump to dump the master database, taking its location from a production_reg_conf file. =head1 SYNOPSIS perl backup_master.pl --reg_conf $COMPARA_REG_PATH perl backup_master.pl $COMPARA_REG compara_master --label "pre100" =head1 ARGUMENTS =head2 DATABASE SETUP =over =item B<[--url mysql://user[:passwd]@host[:port]/dbname]> URL of the database to dump. =item B<[--reg_conf registry_configuration_file]> The Bio::EnsEMBL::Registry configuration file. Must be given to refer to the database by registry name (alias) instead of a URL. =item B<[--reg_type reg_type]> The "type" or "group" under which the database is to be found in the Registry. Defaults to "compara". =item B<[--reg_alias|--reg_name name]> The name or "species" under which the database is to be found in the Registry. Defaults to "compara_master". =back =head2 DUMP SETUP =over =item B<[--dump_path /path/to_dumps]> Where to store the dumps. Defaults to the shared warehouse directory. =item B<[--username username]> Name of the user used to create the dumps. Defaults to "compara_ensembl". Set this to an empty string to create the backup as yourself. =item B<[--label str]> Label to append to the dump file name. =back =cut use strict; use warnings; use Getopt::Long; use POSIX qw(strftime); use Bio::EnsEMBL::Registry; use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor; use Bio::EnsEMBL::Compara::Utils::Registry; my ($url, $reg_conf, $reg_type, $reg_alias); my ($dump_path, $username, $label); # Arguments parsing GetOptions( 'url=s' => \$url, 'reg_conf|regfile|reg_file=s' => \$reg_conf, 'reg_type=s' => \$reg_type, 'reg_alias|regname|reg_name=s' => \$reg_alias, 'dump_path=s' => \$dump_path, 'username=s' => \$username, 'label=s' => \$label, ) or die "Error in command line arguments\n"; if (@ARGV) { die "ERROR: There are invalid arguments on the command-line: ". join(" ", @ARGV). "\n"; } unless ($url or $reg_conf) { print "\nERROR: Neither --url nor --reg_conf are defined. Some of those are needed to refer to the database being dumped\n\n"; exit 1; } if ($url and $reg_alias) { print "\nERROR: Both --url and --reg_alias are defined. Don't know which one to use\n\n"; exit 1; } if ($reg_conf) { Bio::EnsEMBL::Registry->load_all($reg_conf); } my $dba = $url ? Bio::EnsEMBL::Compara::DBSQL::DBAdaptor->new( -URL => $url ) : Bio::EnsEMBL::Registry->get_DBAdaptor( $reg_alias || 'compara_master', $reg_type || 'compara' ); my $division = $dba->get_division; my @params = ( '--host' => $dba->dbc->host, '--port' => $dba->dbc->port, '--user' => 'ensro', ); $dump_path //= $ENV{'COMPARA_WAREHOUSE'} . '/master_db_dumps'; $username //= 'compara_ensembl'; my $date = strftime '%Y%m%d', localtime; my $dump_name = "ensembl_compara_master_${division}.${date}" . ($label ? ".$label" : ''). ".sql"; my $cmd = join(' ', 'mysqldump', @params, $dba->dbc->dbname, '>', "$dump_path/$dump_name"); if ($username) { print "Executing as $username: $cmd\n\n"; exec('sudo', -u => $username, '/bin/bash', -c => $cmd); } else { print "Executing: $cmd\n\n"; exec('/bin/bash', -c => $cmd); }
Ensembl/ensembl-compara
scripts/production/backup_master.pl
Perl
apache-2.0
4,062
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package database::oracle::mode::tnsping; use base qw(centreon::plugins::mode); use strict; use warnings; use Time::HiRes; use POSIX; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $options{options}->add_options(arguments => { "warning:s" => { name => 'warning', }, "critical:s" => { name => 'critical', }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); $self->{output}->option_exit(); } } sub run { my ($self, %options) = @_; # $options{sql} = sqlmode object $self->{sql} = $options{sql}; my ($exit, $msg_error) = $self->{sql}->connect(dontquit => 1); if (defined($msg_error) && $msg_error !~ /(ORA-01017|ORA-01004)/i) { $self->{output}->output_add(severity => 'CRITICAL', short_msg => $msg_error); } else { my ($sid) = $self->{sql}->{data_source} =~ /(?:sid|service_name)=(\S+)/; $self->{output}->output_add(severity => 'OK', short_msg => sprintf("Connection established to listener '%s'.", $sid)); } $self->{sql}->disconnect(); $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check Oracle listener status. =over 8 =back =cut
centreon/centreon-plugins
database/oracle/mode/tnsping.pm
Perl
apache-2.0
2,832
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =cut # # Ensembl module for Bio::EnsEMBL::Variation::DBSQL::IndividualGenotypeFeatureAdaptor # # =head1 NAME Bio::EnsEMBL::Variation::DBSQL::IndividualGenotypeFeatureAdaptor =head1 SYNOPSIS $reg = 'Bio::EnsEMBL::Registry'; $reg->load_registry_from_db(-host => 'ensembldb.ensembl.org',-user => 'anonymous'); $iga = $reg->get_adaptor("human","variation","individualgenotype"); #returns all genotypes in a certain Slice $genotypes = $iga->fetch_by_Slice($slice); =head1 DESCRIPTION This adaptor provides database connectivity for IndividualGenotypeFeature objects. IndividualGenotypeFeatures may be retrieved from the Ensembl variation database by several means using this module. =head1 METHODS =cut package Bio::EnsEMBL::Variation::DBSQL::IndividualGenotypeFeatureAdaptor; use strict; use warnings; use vars qw(@ISA); use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor; use Bio::EnsEMBL::Variation::DBSQL::BaseGenotypeAdaptor; use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning); use Bio::EnsEMBL::Variation::IndividualGenotypeFeature; @ISA = qw(Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor Bio::EnsEMBL::Variation::DBSQL::BaseGenotypeAdaptor); =head2 fetch_all_by_Variation Arg [1] : Bio::EnsEMBL::Variation $variation Example : my $var = $variation_adaptor->fetch_by_name( "rs1121" ) $igtypes = $igtype_adaptor->fetch_all_by_Variation( $var ) Description: Retrieves a list of individual genotypes for the given Variation. If none are available an empty listref is returned. Returntype : listref Bio::EnsEMBL::Variation::IndividualGenotype Exceptions : none Caller : general Status : Stable =cut sub fetch_all_by_Variation { deprecate("Please use Bio::EnsEMBL::Variation::SampleGenotypeFeatureAdaptor::fetch_all_by_Variation.\n"); } =head2 fetch_all_by_Slice Arg [1] : Bio::EnsEMBL:Slice $slice Arg [2] : (optional) Bio::EnsEMBL::Variation::Individual $individual Example : my @IndividualGenotypesFeatures = @{$ca->fetch_all_by_Slice($slice)}; Description: Retrieves all IndividualGenotypeFeature features for a given slice for a certain individual (if provided). Returntype : reference to list Bio::EnsEMBL::Variation::IndividualGenotype Exceptions : throw on bad argument Caller : general Status : Stable =cut sub fetch_all_by_Slice{ deprecate("Please use Bio::EnsEMBL::Variation::SampleGenotypeFeatureAdaptor::fetch_all_by_Slice.\n"); } 1;
willmclaren/ensembl-variation
modules/Bio/EnsEMBL/Variation/DBSQL/IndividualGenotypeFeatureAdaptor.pm
Perl
apache-2.0
3,505
package Paws::AutoScaling::DescribeAutoScalingNotificationTypes; use Moose; use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'DescribeAutoScalingNotificationTypes'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::AutoScaling::DescribeAutoScalingNotificationTypesAnswer'); class_has _result_key => (isa => 'Str', is => 'ro', default => 'DescribeAutoScalingNotificationTypesResult'); 1; ### main pod documentation begin ### =head1 NAME Paws::AutoScaling::DescribeAutoScalingNotificationTypes - Arguments for method DescribeAutoScalingNotificationTypes on Paws::AutoScaling =head1 DESCRIPTION This class represents the parameters used for calling the method DescribeAutoScalingNotificationTypes on the Auto Scaling service. Use the attributes of this class as arguments to method DescribeAutoScalingNotificationTypes. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to DescribeAutoScalingNotificationTypes. As an example: $service_obj->DescribeAutoScalingNotificationTypes(Att1 => $value1, Att2 => $value2, ...); Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. =head1 ATTRIBUTES =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method DescribeAutoScalingNotificationTypes in L<Paws::AutoScaling> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/AutoScaling/DescribeAutoScalingNotificationTypes.pm
Perl
apache-2.0
1,747
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2020] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =cut =head1 NAME Bio::EnsEMBL::Operon - Object representing an operon =head1 SYNOPSIS my $operon = Bio::EnsEMBL::Operon->new( -START => 123, -END => 1045, -STRAND => 1, -SLICE => $slice, -DISPLAY_LABEL => $name ); # print operon information print("operon start:end:strand is " . join( ":", map { $operon->$_ } qw(start end strand) ) . "\n" ); =head1 DESCRIPTION A representation of an Operon within the Ensembl system. An operon is a collection of one or more polycistronic transcripts which contain one or more genes. =head1 METHODS =cut package Bio::EnsEMBL::Operon; use strict; use warnings; use Bio::EnsEMBL::Feature; use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::Utils::Scalar qw(assert_ref); use vars qw(@ISA); @ISA = qw(Bio::EnsEMBL::Feature); =head2 new Arg [-START] : int - start postion of the operon Arg [-END] : int - end position of the operon Arg [-STRAND] : int - 1,-1 the strand the operon is on Arg [-SLICE] : Bio::EnsEMBL::Slice - the slice the operon is on Arg [-STABLE_ID] : string - the stable identifier of this operon Arg [-VERSION] : int - the version of the stable identifier of this operon Arg [-DISPLAY_LABEL]: A name/label for this operon Arg [-CREATED_DATE]: string - the date the operon was created Arg [-MODIFIED_DATE]: string - the date the operon was last modified Example : $gene = Bio::EnsEMBL::Operon->new(...); Description: Creates a new operon object Returntype : Bio::EnsEMBL::Operon Exceptions : none Caller : general Status : Stable =cut sub new { my $caller = shift; my $class = ref($caller) || $caller; my $self = $class->SUPER::new(@_); my ( $stable_id, $version, $created_date, $modified_date,$display_label) = rearrange( [ 'STABLE_ID', 'VERSION', 'CREATED_DATE', 'MODIFIED_DATE', 'DISPLAY_LABEL' ], @_ ); $self->stable_id($stable_id); $self->version($version); $self->{'created_date'} = $created_date; $self->{'modified_date'} = $modified_date; $self->display_label($display_label); return $self; } =head2 created_date Arg [1] : (optional) String - created date to set (as a UNIX time int) Example : $gene->created_date('1141948800'); Description: Getter/setter for attribute created_date Returntype : String Exceptions : none Caller : general Status : Stable =cut sub created_date { my $self = shift; $self->{'created_date'} = shift if ( @_ ); return $self->{'created_date'}; } =head2 modified_date Arg [1] : (optional) String - modified date to set (as a UNIX time int) Example : $gene->modified_date('1141948800'); Description: Getter/setter for attribute modified_date Returntype : String Exceptions : none Caller : general Status : Stable =cut sub modified_date { my $self = shift; $self->{'modified_date'} = shift if ( @_ ); return $self->{'modified_date'}; } =head2 display_label Arg [1] : (optional) String - the name/label to set Example : $operon->name('accBCD'); Description: Getter/setter for attribute name. Returntype : String or undef Exceptions : none Caller : general Status : Stable =cut sub display_label { my $self = shift; $self->{'display_label'} = shift if (@_); return $self->{'display_label'}; } =head2 stable_id Arg [1] : (optional) String - the stable ID to set Example : $operon->stable_id("accR2"); Description: Getter/setter for stable id for this operon. Returntype : String Exceptions : none Caller : general Status : Stable =cut sub stable_id { my $self = shift; $self->{'stable_id'} = shift if (@_); return $self->{'stable_id'}; } =head2 version Arg [1] : (optional) Int - the stable ID version to set Example : $operon->version(1); Description: Getter/setter for stable id version for this operon. Returntype : Int Exceptions : none Caller : general Status : Stable =cut sub version { my $self = shift; $self->{'version'} = shift if(@_); return $self->{'version'}; } =head2 stable_id_version Arg [1] : (optional) String - the stable ID with version to set Example : $operon->stable_id("accR2.3"); Description: Getter/setter for stable id with version for this operon. Returntype : String Exceptions : none Caller : general Status : Stable =cut sub stable_id_version { my $self = shift; if(my $stable_id = shift) { # See if there's an embedded period, assume that's a # version, might not work for some species but you # should use ->stable_id() and version() if you're worried # about ambiguity my $vindex = rindex($stable_id, '.'); # Set the stable_id and version pair depending on if # we found a version delimiter in the stable_id ($self->{stable_id}, $self->{version}) = ($vindex > 0 ? (substr($stable_id,0,$vindex), substr($stable_id,$vindex+1)) : $stable_id, undef); } return $self->{stable_id} . ($self->{version} ? ".$self->{version}" : ''); } =head2 get_all_OperonTranscripts Example : my $ots = $operon->get_all_OperonTranscripts(); Description: Retrieve all operon transcripts belonging to this operon Returntype : Arrayref of Bio::EnsEMBL::OperonTranscript Exceptions : none Caller : general Status : Stable =cut sub get_all_OperonTranscripts { my $self = shift; if ( !exists $self->{'_operon_transcript_array'} ) { if ( defined $self->adaptor() ) { my $ta = $self->adaptor()->db()->get_OperonTranscriptAdaptor(); my $transcripts = $ta->fetch_all_by_Operon($self); $self->{'_operon_transcript_array'} = $transcripts; } } return $self->{'_operon_transcript_array'}; } =head2 add_OperonTranscript Arg [1] : Bio::EnsEMBL::OperonTranscript - operon transcript to attach to this operon Example : $operon->add_OperonTranscript($ot); Description: Attach a polycistronic operon transcript to this operon Exceptions : if argument is not Bio::EnsEMBL::OperonTranscript Caller : general Status : Stable =cut sub add_OperonTranscript { my ( $self, $trans ) = @_; assert_ref($trans,"Bio::EnsEMBL::OperonTranscript"); $self->{'_operon_transcript_array'} ||= []; push( @{ $self->{'_operon_transcript_array'} }, $trans ); #$self->recalculate_coordinates(); return; } =head2 add_DBEntry Arg [1] : Bio::EnsEMBL::DBEntry $dbe The dbEntry to be added Example : my $dbe = Bio::EnsEMBL::DBEntery->new(...); $operon->add_DBEntry($dbe); Description: Associates a DBEntry with this operon. Note that adding DBEntries will prevent future lazy-loading of DBEntries for this operon (see get_all_DBEntries). Returntype : none Exceptions : thrown on incorrect argument type Caller : general Status : Stable =cut sub add_DBEntry { my $self = shift; my $dbe = shift; unless($dbe && ref($dbe) && $dbe->isa('Bio::EnsEMBL::DBEntry')) { throw('Expected DBEntry argument'); } $self->{'dbentries'} ||= []; push @{$self->{'dbentries'}}, $dbe; } =head2 get_all_Attributes Arg [1] : (optional) String $attrib_code The code of the attribute type to retrieve values for Example : my ($author) = @{ $operon->get_all_Attributes('author') }; my @operon_attributes = @{ $operon->get_all_Attributes }; Description: Gets a list of Attributes of this operon. Optionally just get Attributes for given code. Returntype : Listref of Bio::EnsEMBL::Attribute Exceptions : warning if gene does not have attached adaptor and attempts lazy load. Caller : general Status : Stable =cut sub get_all_Attributes { my $self = shift; my $attrib_code = shift; if ( !exists $self->{'attributes'} ) { if ( !$self->adaptor() ) { return []; } my $attribute_adaptor = $self->adaptor->db->get_AttributeAdaptor(); $self->{'attributes'} = $attribute_adaptor->fetch_all_by_Operon($self); } if ( defined $attrib_code ) { my @results = grep { uc( $_->code() ) eq uc($attrib_code) } @{ $self->{'attributes'} }; return \@results; } else { return $self->{'attributes'}; } } =head2 get_all_DBEntries Arg [1] : (optional) String, external database name Arg [2] : (optional) String, external_db type Example : @dbentries = @{ $gene->get_all_DBEntries() }; Description: Retrieves DBEntries (xrefs) for this operon. This does *not* include DBEntries that are associated with the transcripts and corresponding translations of this gene (see get_all_DBLinks()). This method will attempt to lazy-load DBEntries from a database if an adaptor is available and no DBEntries are present on the gene (i.e. they have not already been added or loaded). Return type: Listref of Bio::EnsEMBL::DBEntry objects Exceptions : none Caller : get_all_DBLinks, OperonAdaptor::store Status : Stable =cut sub get_all_DBEntries { my ( $self, $db_name_exp, $ex_db_type ) = @_; my $cache_name = 'dbentries'; if ( defined($db_name_exp) ) { $cache_name .= $db_name_exp; } if ( defined($ex_db_type) ) { $cache_name .= $ex_db_type; } # if not cached, retrieve all of the xrefs for this gene if ( !defined( $self->{$cache_name} ) && defined( $self->adaptor() ) ) { $self->{$cache_name} = $self->adaptor()->db()->get_DBEntryAdaptor() ->fetch_all_by_Operon( $self, $db_name_exp, $ex_db_type ); } $self->{$cache_name} ||= []; return $self->{$cache_name}; } 1;
james-monkeyshines/ensembl
modules/Bio/EnsEMBL/Operon.pm
Perl
apache-2.0
10,752
#!/usr/bin/env perl # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute # Copyright [2016-2021] EMBL-European Bioinformatics Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =cut use strict; use warnings; use Getopt::Long; use DBH; use FindBin qw( $Bin ); use Bio::EnsEMBL::Mapper::RangeRegistry; use Bio::EnsEMBL::DBSQL::DBAdaptor; use ImportUtils qw(debug load); my ($TMP_DIR, $TMP_FILE); #global variables for the tmp files and folder my ($vhost, $vport, $vdbname, $vuser, $vpass, $chost, $cport, $cdbname, $cuser, $cpass, $species, $read_dir, $max_level, $ind_file, $bsub_wait_status); GetOptions(#'chost=s' => \$chost, #'cuser=s' => \$cuser, #'cpass=s' => \$cpass, #'cport=i' => \$cport, #'cdbname=s' => \$cdbname, #'vhost=s' => \$vhost, 'vuser=s' => \$vuser, #'vpass=s' => \$vpass, #'vport=i' => \$vport, #'vdbname=s' => \$vdbname, 'species=s' => \$species, 'tmpdir=s' => \$ImportUtils::TMP_DIR, 'tmpfile=s' => \$ImportUtils::TMP_FILE, 'maxlevel=i' => \$max_level, 'readdir=s' => \$read_dir, 'indfile=s' => \$ind_file, 'bsubwaitstatus=s' => \$bsub_wait_status); warn("Make sure you have a updated ensembl.registry file!\n"); my $registry_file ||= $Bin . "/ensembl.registry"; Bio::EnsEMBL::Registry->load_all( $registry_file ); my $cdba = Bio::EnsEMBL::Registry->get_DBAdaptor($species,'core'); my $vdba = Bio::EnsEMBL::Registry->get_DBAdaptor($species,'variation'); my $dbVar = $vdba->dbc->db_handle; my $dbCore = $cdba; #added default options $chost = $cdba->dbc->host; $cuser ||= 'ensro'; $cport = $cdba->dbc->port ; $cdbname = $cdba->dbc->dbname; $vhost = $vdba->dbc->host; $vport = $vdba->dbc->port; $vuser ||= 'ensadmin'; $vdbname = $vdba->dbc->dbname; $vpass = $vdba->dbc->password; $TMP_DIR = $ImportUtils::TMP_DIR; $TMP_FILE = $ImportUtils::TMP_FILE; $bsub_wait_status ||= 'done'; my $call; my $i = 0; foreach my $read_file (glob("$read_dir/*.mapped")){ $call = "bsub -J read_coverage_job_$i -o $TMP_DIR/output_reads_$i.txt -q research /sw/arch/bin/env perl read_coverage.pl -chost $chost -cuser $cuser -cport $cport -cdbname $cdbname -vhost $vhost -vuser $vuser -vpass $vpass -vport $vport -vdbname $vdbname -tmpdir $TMP_DIR -tmpfile read_coverage_$i.txt -maxlevel $max_level -readfile $read_file"; if ($ind_file) { $call .= " -indfile $ind_file"; } system($call); $i++; } debug("Waiting for read_coverage jobs to finish"); $call = "bsub -K -w '$bsub_wait_status(read_coverage_job_*)' -J waiting_process sleep 1"; #waits until all reads have succesfully finished system($call); debug("Ready to import coverage data"); $call = "cat $TMP_DIR/read_coverage_* > $TMP_DIR/$TMP_FILE"; #concat all files system($call); load($dbVar,"read_coverage","seq_region_id","seq_region_start","seq_region_end","level","sample_id"); #load table with information unlink(<$TMP_DIR/read_coverage_*>); #and delete the files with the data update_meta_coord($dbCore,$dbVar,'read_coverage'); # # Updates the meta coord table # sub update_meta_coord { my $dbCore = shift; my $dbVar = shift; my $table_name = shift; my $csname = shift || 'chromosome'; my $csa = $dbCore->get_CoordSystemAdaptor(); my $cs = $csa->fetch_by_name($csname); my $max_length_ref = $dbVar->selectall_arrayref(qq{SELECT max(seq_region_end - seq_region_start+1) from read_coverage}); my $max_length = $max_length_ref->[0][0]; my $sth = $dbVar->prepare ('INSERT INTO meta_coord set table_name = ?, coord_system_id = ?, max_length = ?'); $sth->execute($table_name, $cs->dbID(), $max_length); $sth->finish(); return; } sub usage { my $msg = shift; print STDERR <<EOF; usage: perl read_coverage.pl <options> options: -chost <hostname> hostname of core Ensembl MySQL database (default = ecs2) -cuser <user> username of core Ensembl MySQL database (default = ensro) -cpass <pass> password of core Ensembl MySQL database -cport <port> TCP port of core Ensembl MySQL database (default = 3364) -cdbname <dbname> dbname of core Ensembl MySQL database -vhost <hostname> hostname of variation MySQL database to write to -vuser <user> username of variation MySQL database to write to (default = ensadmin) -vpass <pass> password of variation MySQL database to write to -vport <port> TCP port of variation MySQL database to write to (default = 3306) -vdbname <dbname> dbname of variation MySQL database to write to -tmpdir <dir> temp directory to use (with lots of space!) -tmpfile <filename> name of temp file to use -readdir <dirname> name of dir with read information EOF die("\n$msg\n\n"); }
Ensembl/ensembl-variation
scripts/import/parallel_read_coverage.pl
Perl
apache-2.0
5,728
#!/usr/bin/perl use subs; use strict; use warnings; use IO::Handle; use Time::HiRes qw(tv_interval gettimeofday); # test.pl # # runs a test and check its output sub run($$$) { my ($input, $options, $output) = @_; my $extraopts = $ENV{'ESBMC_TEST_EXTRA_ARGS'}; $extraopts = "" unless defined($extraopts); my $cmd = "esbmc $extraopts $options $input >$output 2>&1"; print LOG "Running $cmd\n"; my $tv = [gettimeofday()]; system $cmd; my $elapsed = tv_interval($tv); my $exit_value = $? >> 8; my $signal_num = $? & 127; my $dumped_core = $? & 128; my $failed = 0; print LOG " Exit: $exit_value\n"; print LOG " Signal: $signal_num\n"; print LOG " Core: $dumped_core\n"; if($signal_num != 0) { $failed = 1; print "Killed by signal $signal_num"; if($dumped_core) { print " (code dumped)"; } } if ($signal_num == 2) { # Interrupted by ^C: we should exit too print "Halting tests on interrupt"; exit 1; } system "echo EXIT=$exit_value >>$output"; system "echo SIGNAL=$signal_num >>$output"; return ($failed, $elapsed); } sub load($) { my ($fname) = @_; open FILE, "<$fname"; my @data = <FILE>; close FILE; chomp @data; return @data; } sub test($$) { my ($name, $test) = @_; my ($input, $options, @results) = load($test); my $output = $input; $output =~ s/\.cu$/.out/; $output =~ s/\.cpp$/.out/; if($output eq $input) { print("Error in test file -- $test\n"); return 1; } print LOG "Test '$name'\n"; print LOG " Input: $input\n"; print LOG " Output: $output\n"; print LOG " Options: $options\n"; print LOG " Results:\n"; foreach my $result (@results) { print LOG " $result\n"; } my ($failed, $elapsed); ($failed, $elapsed) = run($input, $options, $output); if(!$failed) { print LOG "Execution [OK]\n"; my $included = 1; foreach my $result (@results) { if($result eq "--") { $included = !$included; } else { my $r; system "grep '$result' '$output' >/dev/null"; $r = ($included ? $? != 0 : $? == 0); if($r) { print LOG "$result [FAILED]\n"; $failed = 1; } else { print LOG "$result [OK]\n"; } } } } else { print LOG "Execution [FAILED]\n"; } print LOG "\n"; return ($failed, $elapsed, $output, @results); } sub dirs() { my @list; opendir CWD, "."; @list = grep { !/^\./ && -d "$_" && !/CVS/ } readdir CWD; closedir CWD; @list = sort @list; return @list; } if(@ARGV != 0) { print "Usage:\n"; print " test.pl\n"; exit 1; } open LOG,">tests.log"; print "Loading\n"; my @tests = dirs(); my $count = @tests; if($count == 1) { print " $count test found\n"; } else { print " $count tests found\n"; } print "\n"; my $failures = 0; my $xmloutput = ""; my $timeaccuml = 0.0; print "Running tests\n"; foreach my $test (@tests) { print " Running $test"; chdir $test; my ($failed, $elapsed, $outputfile, @resultrexps) = test($test, "test.desc"); $timeaccuml += $elapsed; chdir ".."; $xmloutput = $xmloutput . "<testcase name=\"$test\" time=\"$elapsed\""; if($failed) { $failures++; print " [FAILED]\n"; $xmloutput = $xmloutput . ">\n"; $xmloutput = $xmloutput . " <failure message=\"Test regexes \'@resultrexps\' failed\" type=\"nodescript failure\">\n"; open(LOGFILE, "<$test/$outputfile") or die "Can't open outputfile $test/$outputfile"; while (<LOGFILE>) { my $lump; $lump = $_; $lump =~ s/\&/\&amp;/gm; $lump =~ s/"/\&quot;/gm; $lump =~ s/</\&lt;/gm; $lump =~ s/>/\&gt;/gm; $xmloutput = $xmloutput . $lump; } close(LOGFILE); $xmloutput = $xmloutput . "</failure>\n</testcase>"; } else { print " [OK]\n"; $xmloutput = $xmloutput . "/>\n"; } } print "\n"; my $io = IO::Handle->new(); if ($io->fdopen(3, "w")) { print $io "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<testsuite failures=\"$failures\" hostname=\"pony.ecs.soton.ac.uk\" name=\"ESBMC single threaded regression tests\" tests=\"$count\" time=\"$timeaccuml\">\n"; print $io $xmloutput; print $io "</testsuite>"; } if($failures == 0) { print "All tests were successful\n"; } else { print "Tests failed\n"; if($failures == 1) { print " $failures of $count test failed\n"; } else { print " $failures of $count tests failed\n"; } } close LOG; exit $failures;
ssvlab/esbmc-gpu
regression/cuda/gpu_verify/structs/test.pl
Perl
apache-2.0
4,401
package VMOMI::VmDasBeingResetEvent; use parent 'VMOMI::VmEvent'; use strict; use warnings; our @class_ancestors = ( 'VmEvent', 'Event', 'DynamicData', ); our @class_members = ( ['reason', undef, 0, 1], ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
stumpr/p5-vmomi
lib/VMOMI/VmDasBeingResetEvent.pm
Perl
apache-2.0
444
package Mojo::Webqq::Friend; use strict; use Mojo::Webqq::Base 'Mojo::Webqq::Model::Base'; has [qw( flag id category name face markname is_vip vip_level state client_type _flag )]; has uid => sub{ my $self = shift; return $self->{uid} if defined $self->{uid}; return $self->client->get_qq_from_id($self->id); }; sub qq {$_[0]->uid} sub nick {$_[0]->name} sub displayname { my $self = shift; return defined $self->markname?$self->markname:$self->name; } sub update{ my $self = shift; my $hash = shift; for(grep {substr($_,0,1) ne "_"} keys %$hash){ if(exists $hash->{$_}){ if(defined $hash->{$_} and defined $self->{$_}){ if($hash->{$_} ne $self->{$_}){ my $old_property = $self->{$_}; my $new_property = $hash->{$_}; $self->{$_} = $hash->{$_}; $self->client->emit("friend_property_change"=>$self,$_,$old_property,$new_property); } } elsif( ! (!defined $hash->{$_} and !defined $self->{$_}) ){ my $old_property = $self->{$_}; my $new_property = $hash->{$_}; $self->{$_} = $hash->{$_}; $self->client->emit("friend_property_change"=>$self,$_,$old_property,$new_property); } } } $self; } sub send { my $self = shift; $self->client->send_friend_message($self,@_); } 1;
sjdy521/Mojo-Webqq
lib/Mojo/Webqq/Friend.pm
Perl
bsd-2-clause
1,519
#!/usr/bin/env perl # # ==================================================================== # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL # project. The module is, however, dual licensed under OpenSSL and # CRYPTOGAMS licenses depending on where you obtain it. For further # details see http://www.openssl.org/~appro/cryptogams/. # ==================================================================== # # July 2004 # # 2.22x RC4 tune-up:-) It should be noted though that my hand [as in # "hand-coded assembler"] doesn't stand for the whole improvement # coefficient. It turned out that eliminating RC4_CHAR from config # line results in ~40% improvement (yes, even for C implementation). # Presumably it has everything to do with AMD cache architecture and # RAW or whatever penalties. Once again! The module *requires* config # line *without* RC4_CHAR! As for coding "secret," I bet on partial # register arithmetics. For example instead of 'inc %r8; and $255,%r8' # I simply 'inc %r8b'. Even though optimization manual discourages # to operate on partial registers, it turned out to be the best bet. # At least for AMD... How IA32E would perform remains to be seen... # November 2004 # # As was shown by Marc Bevand reordering of couple of load operations # results in even higher performance gain of 3.3x:-) At least on # Opteron... For reference, 1x in this case is RC4_CHAR C-code # compiled with gcc 3.3.2, which performs at ~54MBps per 1GHz clock. # Latter means that if you want to *estimate* what to expect from # *your* Opteron, then multiply 54 by 3.3 and clock frequency in GHz. # November 2004 # # Intel P4 EM64T core was found to run the AMD64 code really slow... # The only way to achieve comparable performance on P4 was to keep # RC4_CHAR. Kind of ironic, huh? As it's apparently impossible to # compose blended code, which would perform even within 30% marginal # on either AMD and Intel platforms, I implement both cases. See # rc4_skey.c for further details... # April 2005 # # P4 EM64T core appears to be "allergic" to 64-bit inc/dec. Replacing # those with add/sub results in 50% performance improvement of folded # loop... # May 2005 # # As was shown by Zou Nanhai loop unrolling can improve Intel EM64T # performance by >30% [unlike P4 32-bit case that is]. But this is # provided that loads are reordered even more aggressively! Both code # pathes, AMD64 and EM64T, reorder loads in essentially same manner # as my IA-64 implementation. On Opteron this resulted in modest 5% # improvement [I had to test it], while final Intel P4 performance # achieves respectful 432MBps on 2.8GHz processor now. For reference. # If executed on Xeon, current RC4_CHAR code-path is 2.7x faster than # RC4_INT code-path. While if executed on Opteron, it's only 25% # slower than the RC4_INT one [meaning that if CPU µ-arch detection # is not implemented, then this final RC4_CHAR code-path should be # preferred, as it provides better *all-round* performance]. # March 2007 # # Intel Core2 was observed to perform poorly on both code paths:-( It # apparently suffers from some kind of partial register stall, which # occurs in 64-bit mode only [as virtually identical 32-bit loop was # observed to outperform 64-bit one by almost 50%]. Adding two movzb to # cloop1 boosts its performance by 80%! This loop appears to be optimal # fit for Core2 and therefore the code was modified to skip cloop8 on # this CPU. # May 2010 # # Intel Westmere was observed to perform suboptimally. Adding yet # another movzb to cloop1 improved performance by almost 50%! Core2 # performance is improved too, but nominally... # May 2011 # # The only code path that was not modified is P4-specific one. Non-P4 # Intel code path optimization is heavily based on submission by Maxim # Perminov, Maxim Locktyukhin and Jim Guilford of Intel. I've used # some of the ideas even in attempt to optmize the original RC4_INT # code path... Current performance in cycles per processed byte (less # is better) and improvement coefficients relative to previous # version of this module are: # # Opteron 5.3/+0%(*) # P4 6.5 # Core2 6.2/+15%(**) # Westmere 4.2/+60% # Sandy Bridge 4.2/+120% # Atom 9.3/+80% # # (*) But corresponding loop has less instructions, which should have # positive effect on upcoming Bulldozer, which has one less ALU. # For reference, Intel code runs at 6.8 cpb rate on Opteron. # (**) Note that Core2 result is ~15% lower than corresponding result # for 32-bit code, meaning that it's possible to improve it, # but more than likely at the cost of the others (see rc4-586.pl # to get the idea)... $flavour = shift; $output = shift; if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or die "can't locate x86_64-xlate.pl"; open OUT,"| \"$^X\" $xlate $flavour $output"; *STDOUT=*OUT; $dat="%rdi"; # arg1 $len="%rsi"; # arg2 $inp="%rdx"; # arg3 $out="%rcx"; # arg4 { $code=<<___; .text .extern OPENSSL_ia32cap_P .globl RC4 .type RC4,\@function,4 .align 16 RC4: or $len,$len jne .Lentry ret .Lentry: push %rbx push %r12 push %r13 .Lprologue: mov $len,%r11 mov $inp,%r12 mov $out,%r13 ___ my $len="%r11"; # reassign input arguments my $inp="%r12"; my $out="%r13"; my @XX=("%r10","%rsi"); my @TX=("%rax","%rbx"); my $YY="%rcx"; my $TY="%rdx"; $code.=<<___; xor $XX[0],$XX[0] xor $YY,$YY lea 8($dat),$dat mov -8($dat),$XX[0]#b mov -4($dat),$YY#b cmpl \$-1,256($dat) je .LRC4_CHAR mov OPENSSL_ia32cap_P(%rip),%r8d xor $TX[1],$TX[1] inc $XX[0]#b sub $XX[0],$TX[1] sub $inp,$out movl ($dat,$XX[0],4),$TX[0]#d test \$-16,$len jz .Lloop1 bt \$30,%r8d # Intel CPU? jc .Lintel and \$7,$TX[1] lea 1($XX[0]),$XX[1] jz .Loop8 sub $TX[1],$len .Loop8_warmup: add $TX[0]#b,$YY#b movl ($dat,$YY,4),$TY#d movl $TX[0]#d,($dat,$YY,4) movl $TY#d,($dat,$XX[0],4) add $TY#b,$TX[0]#b inc $XX[0]#b movl ($dat,$TX[0],4),$TY#d movl ($dat,$XX[0],4),$TX[0]#d xorb ($inp),$TY#b movb $TY#b,($out,$inp) lea 1($inp),$inp dec $TX[1] jnz .Loop8_warmup lea 1($XX[0]),$XX[1] jmp .Loop8 .align 16 .Loop8: ___ for ($i=0;$i<8;$i++) { $code.=<<___ if ($i==7); add \$8,$XX[1]#b ___ $code.=<<___; add $TX[0]#b,$YY#b movl ($dat,$YY,4),$TY#d movl $TX[0]#d,($dat,$YY,4) movl `4*($i==7?-1:$i)`($dat,$XX[1],4),$TX[1]#d ror \$8,%r8 # ror is redundant when $i=0 movl $TY#d,4*$i($dat,$XX[0],4) add $TX[0]#b,$TY#b movb ($dat,$TY,4),%r8b ___ push(@TX,shift(@TX)); #push(@XX,shift(@XX)); # "rotate" registers } $code.=<<___; add \$8,$XX[0]#b ror \$8,%r8 sub \$8,$len xor ($inp),%r8 mov %r8,($out,$inp) lea 8($inp),$inp test \$-8,$len jnz .Loop8 cmp \$0,$len jne .Lloop1 jmp .Lexit .align 16 .Lintel: test \$-32,$len jz .Lloop1 and \$15,$TX[1] jz .Loop16_is_hot sub $TX[1],$len .Loop16_warmup: add $TX[0]#b,$YY#b movl ($dat,$YY,4),$TY#d movl $TX[0]#d,($dat,$YY,4) movl $TY#d,($dat,$XX[0],4) add $TY#b,$TX[0]#b inc $XX[0]#b movl ($dat,$TX[0],4),$TY#d movl ($dat,$XX[0],4),$TX[0]#d xorb ($inp),$TY#b movb $TY#b,($out,$inp) lea 1($inp),$inp dec $TX[1] jnz .Loop16_warmup mov $YY,$TX[1] xor $YY,$YY mov $TX[1]#b,$YY#b .Loop16_is_hot: lea ($dat,$XX[0],4),$XX[1] ___ sub RC4_loop { my $i=shift; my $j=$i<0?0:$i; my $xmm="%xmm".($j&1); $code.=" add \$16,$XX[0]#b\n" if ($i==15); $code.=" movdqu ($inp),%xmm2\n" if ($i==15); $code.=" add $TX[0]#b,$YY#b\n" if ($i<=0); $code.=" movl ($dat,$YY,4),$TY#d\n"; $code.=" pxor %xmm0,%xmm2\n" if ($i==0); $code.=" psllq \$8,%xmm1\n" if ($i==0); $code.=" pxor $xmm,$xmm\n" if ($i<=1); $code.=" movl $TX[0]#d,($dat,$YY,4)\n"; $code.=" add $TY#b,$TX[0]#b\n"; $code.=" movl `4*($j+1)`($XX[1]),$TX[1]#d\n" if ($i<15); $code.=" movz $TX[0]#b,$TX[0]#d\n"; $code.=" movl $TY#d,4*$j($XX[1])\n"; $code.=" pxor %xmm1,%xmm2\n" if ($i==0); $code.=" lea ($dat,$XX[0],4),$XX[1]\n" if ($i==15); $code.=" add $TX[1]#b,$YY#b\n" if ($i<15); $code.=" pinsrw \$`($j>>1)&7`,($dat,$TX[0],4),$xmm\n"; $code.=" movdqu %xmm2,($out,$inp)\n" if ($i==0); $code.=" lea 16($inp),$inp\n" if ($i==0); $code.=" movl ($XX[1]),$TX[1]#d\n" if ($i==15); } RC4_loop(-1); $code.=<<___; jmp .Loop16_enter .align 16 .Loop16: ___ for ($i=0;$i<16;$i++) { $code.=".Loop16_enter:\n" if ($i==1); RC4_loop($i); push(@TX,shift(@TX)); # "rotate" registers } $code.=<<___; mov $YY,$TX[1] xor $YY,$YY # keyword to partial register sub \$16,$len mov $TX[1]#b,$YY#b test \$-16,$len jnz .Loop16 psllq \$8,%xmm1 pxor %xmm0,%xmm2 pxor %xmm1,%xmm2 movdqu %xmm2,($out,$inp) lea 16($inp),$inp cmp \$0,$len jne .Lloop1 jmp .Lexit .align 16 .Lloop1: add $TX[0]#b,$YY#b movl ($dat,$YY,4),$TY#d movl $TX[0]#d,($dat,$YY,4) movl $TY#d,($dat,$XX[0],4) add $TY#b,$TX[0]#b inc $XX[0]#b movl ($dat,$TX[0],4),$TY#d movl ($dat,$XX[0],4),$TX[0]#d xorb ($inp),$TY#b movb $TY#b,($out,$inp) lea 1($inp),$inp dec $len jnz .Lloop1 jmp .Lexit .align 16 .LRC4_CHAR: add \$1,$XX[0]#b movzb ($dat,$XX[0]),$TX[0]#d test \$-8,$len jz .Lcloop1 jmp .Lcloop8 .align 16 .Lcloop8: mov ($inp),%r8d mov 4($inp),%r9d ___ # unroll 2x4-wise, because 64-bit rotates kill Intel P4... for ($i=0;$i<4;$i++) { $code.=<<___; add $TX[0]#b,$YY#b lea 1($XX[0]),$XX[1] movzb ($dat,$YY),$TY#d movzb $XX[1]#b,$XX[1]#d movzb ($dat,$XX[1]),$TX[1]#d movb $TX[0]#b,($dat,$YY) cmp $XX[1],$YY movb $TY#b,($dat,$XX[0]) jne .Lcmov$i # Intel cmov is sloooow... mov $TX[0],$TX[1] .Lcmov$i: add $TX[0]#b,$TY#b xor ($dat,$TY),%r8b ror \$8,%r8d ___ push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers } for ($i=4;$i<8;$i++) { $code.=<<___; add $TX[0]#b,$YY#b lea 1($XX[0]),$XX[1] movzb ($dat,$YY),$TY#d movzb $XX[1]#b,$XX[1]#d movzb ($dat,$XX[1]),$TX[1]#d movb $TX[0]#b,($dat,$YY) cmp $XX[1],$YY movb $TY#b,($dat,$XX[0]) jne .Lcmov$i # Intel cmov is sloooow... mov $TX[0],$TX[1] .Lcmov$i: add $TX[0]#b,$TY#b xor ($dat,$TY),%r9b ror \$8,%r9d ___ push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers } $code.=<<___; lea -8($len),$len mov %r8d,($out) lea 8($inp),$inp mov %r9d,4($out) lea 8($out),$out test \$-8,$len jnz .Lcloop8 cmp \$0,$len jne .Lcloop1 jmp .Lexit ___ $code.=<<___; .align 16 .Lcloop1: add $TX[0]#b,$YY#b movzb $YY#b,$YY#d movzb ($dat,$YY),$TY#d movb $TX[0]#b,($dat,$YY) movb $TY#b,($dat,$XX[0]) add $TX[0]#b,$TY#b add \$1,$XX[0]#b movzb $TY#b,$TY#d movzb $XX[0]#b,$XX[0]#d movzb ($dat,$TY),$TY#d movzb ($dat,$XX[0]),$TX[0]#d xorb ($inp),$TY#b lea 1($inp),$inp movb $TY#b,($out) lea 1($out),$out sub \$1,$len jnz .Lcloop1 jmp .Lexit .align 16 .Lexit: sub \$1,$XX[0]#b movl $XX[0]#d,-8($dat) movl $YY#d,-4($dat) mov (%rsp),%r13 mov 8(%rsp),%r12 mov 16(%rsp),%rbx add \$24,%rsp .Lepilogue: ret .size RC4,.-RC4 ___ } $idx="%r8"; $ido="%r9"; $code.=<<___; .globl private_RC4_set_key .type private_RC4_set_key,\@function,3 .align 16 private_RC4_set_key: lea 8($dat),$dat lea ($inp,$len),$inp neg $len mov $len,%rcx xor %eax,%eax xor $ido,$ido xor %r10,%r10 xor %r11,%r11 mov OPENSSL_ia32cap_P(%rip),$idx#d bt \$20,$idx#d # RC4_CHAR? jc .Lc1stloop jmp .Lw1stloop .align 16 .Lw1stloop: mov %eax,($dat,%rax,4) add \$1,%al jnc .Lw1stloop xor $ido,$ido xor $idx,$idx .align 16 .Lw2ndloop: mov ($dat,$ido,4),%r10d add ($inp,$len,1),$idx#b add %r10b,$idx#b add \$1,$len mov ($dat,$idx,4),%r11d cmovz %rcx,$len mov %r10d,($dat,$idx,4) mov %r11d,($dat,$ido,4) add \$1,$ido#b jnc .Lw2ndloop jmp .Lexit_key .align 16 .Lc1stloop: mov %al,($dat,%rax) add \$1,%al jnc .Lc1stloop xor $ido,$ido xor $idx,$idx .align 16 .Lc2ndloop: mov ($dat,$ido),%r10b add ($inp,$len),$idx#b add %r10b,$idx#b add \$1,$len mov ($dat,$idx),%r11b jnz .Lcnowrap mov %rcx,$len .Lcnowrap: mov %r10b,($dat,$idx) mov %r11b,($dat,$ido) add \$1,$ido#b jnc .Lc2ndloop movl \$-1,256($dat) .align 16 .Lexit_key: xor %eax,%eax mov %eax,-8($dat) mov %eax,-4($dat) ret .size private_RC4_set_key,.-private_RC4_set_key .globl RC4_options .type RC4_options,\@abi-omnipotent .align 16 RC4_options: lea .Lopts(%rip),%rax mov OPENSSL_ia32cap_P(%rip),%edx bt \$20,%edx jc .L8xchar bt \$30,%edx jnc .Ldone add \$25,%rax ret .L8xchar: add \$12,%rax .Ldone: ret .align 64 .Lopts: .asciz "rc4(8x,int)" .asciz "rc4(8x,char)" .asciz "rc4(16x,int)" .asciz "RC4 for x86_64, CRYPTOGAMS by <appro\@openssl.org>" .align 64 .size RC4_options,.-RC4_options ___ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, # CONTEXT *context,DISPATCHER_CONTEXT *disp) if ($win64) { $rec="%rcx"; $frame="%rdx"; $context="%r8"; $disp="%r9"; $code.=<<___; .extern __imp_RtlVirtualUnwind .type stream_se_handler,\@abi-omnipotent .align 16 stream_se_handler: push %rsi push %rdi push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 pushfq sub \$64,%rsp mov 120($context),%rax # pull context->Rax mov 248($context),%rbx # pull context->Rip lea .Lprologue(%rip),%r10 cmp %r10,%rbx # context->Rip<prologue label jb .Lin_prologue mov 152($context),%rax # pull context->Rsp lea .Lepilogue(%rip),%r10 cmp %r10,%rbx # context->Rip>=epilogue label jae .Lin_prologue lea 24(%rax),%rax mov -8(%rax),%rbx mov -16(%rax),%r12 mov -24(%rax),%r13 mov %rbx,144($context) # restore context->Rbx mov %r12,216($context) # restore context->R12 mov %r13,224($context) # restore context->R13 .Lin_prologue: mov 8(%rax),%rdi mov 16(%rax),%rsi mov %rax,152($context) # restore context->Rsp mov %rsi,168($context) # restore context->Rsi mov %rdi,176($context) # restore context->Rdi jmp .Lcommon_seh_exit .size stream_se_handler,.-stream_se_handler .type key_se_handler,\@abi-omnipotent .align 16 key_se_handler: push %rsi push %rdi push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 pushfq sub \$64,%rsp mov 152($context),%rax # pull context->Rsp mov 8(%rax),%rdi mov 16(%rax),%rsi mov %rsi,168($context) # restore context->Rsi mov %rdi,176($context) # restore context->Rdi .Lcommon_seh_exit: mov 40($disp),%rdi # disp->ContextRecord mov $context,%rsi # context mov \$154,%ecx # sizeof(CONTEXT) .long 0xa548f3fc # cld; rep movsq mov $disp,%rsi xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER mov 8(%rsi),%rdx # arg2, disp->ImageBase mov 0(%rsi),%r8 # arg3, disp->ControlPc mov 16(%rsi),%r9 # arg4, disp->FunctionEntry mov 40(%rsi),%r10 # disp->ContextRecord lea 56(%rsi),%r11 # &disp->HandlerData lea 24(%rsi),%r12 # &disp->EstablisherFrame mov %r10,32(%rsp) # arg5 mov %r11,40(%rsp) # arg6 mov %r12,48(%rsp) # arg7 mov %rcx,56(%rsp) # arg8, (NULL) call *__imp_RtlVirtualUnwind(%rip) mov \$1,%eax # ExceptionContinueSearch add \$64,%rsp popfq pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx pop %rdi pop %rsi ret .size key_se_handler,.-key_se_handler .section .pdata .align 4 .rva .LSEH_begin_RC4 .rva .LSEH_end_RC4 .rva .LSEH_info_RC4 .rva .LSEH_begin_private_RC4_set_key .rva .LSEH_end_private_RC4_set_key .rva .LSEH_info_private_RC4_set_key .section .xdata .align 8 .LSEH_info_RC4: .byte 9,0,0,0 .rva stream_se_handler .LSEH_info_private_RC4_set_key: .byte 9,0,0,0 .rva key_se_handler ___ } sub reg_part { my ($reg,$conv)=@_; if ($reg =~ /%r[0-9]+/) { $reg .= $conv; } elsif ($conv eq "b") { $reg =~ s/%[er]([^x]+)x?/%$1l/; } elsif ($conv eq "w") { $reg =~ s/%[er](.+)/%$1/; } elsif ($conv eq "d") { $reg =~ s/%[er](.+)/%e$1/; } return $reg; } $code =~ s/(%[a-z0-9]+)#([bwd])/reg_part($1,$2)/gem; $code =~ s/\`([^\`]*)\`/eval $1/gem; print $code; close STDOUT;
caidongyun/nginx-openresty-windows
nginx/objs/lib/openssl-1.0.1g/crypto/rc4/asm/rc4-x86_64.pl
Perl
bsd-2-clause
16,490
=pod =head1 NAME CMS_verify, CMS_get0_signers - verify a CMS SignedData structure =head1 SYNOPSIS #include <openssl/cms.h> int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, unsigned int flags); STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); =head1 DESCRIPTION CMS_verify() verifies a CMS SignedData structure. B<cms> is the CMS_ContentInfo structure to verify. B<certs> is a set of certificates in which to search for the signing certificate(s). B<store> is a trusted certificate store used for chain verification. B<indata> is the detached content if the content is not present in B<cms>. The content is written to B<out> if it is not NULL. B<flags> is an optional set of flags, which can be used to modify the verify operation. CMS_get0_signers() retrieves the signing certificate(s) from B<cms>, it may only be called after a successful CMS_verify() operation. =head1 VERIFY PROCESS Normally the verify process proceeds as follows. Initially some sanity checks are performed on B<cms>. The type of B<cms> must be SignedData. There must be at least one signature on the data and if the content is detached B<indata> cannot be B<NULL>. An attempt is made to locate all the signing certificate(s), first looking in the B<certs> parameter (if it is not NULL) and then looking in any certificates contained in the B<cms> structure itself. If any signing certificate cannot be located the operation fails. Each signing certificate is chain verified using the B<smimesign> purpose and the supplied trusted certificate store. Any internal certificates in the message are used as untrusted CAs. If CRL checking is enabled in B<store> any internal CRLs are used in addition to attempting to look them up in B<store>. If any chain verify fails an error code is returned. Finally the signed content is read (and written to B<out> if it is not NULL) and the signature's checked. If all signature's verify correctly then the function is successful. Any of the following flags (ored together) can be passed in the B<flags> parameter to change the default verify behaviour. If B<CMS_NOINTERN> is set the certificates in the message itself are not searched when locating the signing certificate(s). This means that all the signing certificates must be in the B<certs> parameter. If B<CMS_NOCRL> is set and CRL checking is enabled in B<store> then any CRLs in the message itself are ignored. If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted from the content. If the content is not of type B<text/plain> then an error is returned. If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not verified, unless CMS_CADES flag is also set. If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not verified, unless CMS_CADES flag is also set. If B<CMS_CADES> is set, each signer certificate is checked against the ESS signingCertificate or ESS signingCertificateV2 extension that is required in the signed attributes of the signature. If B<CMS_NO_CONTENT_VERIFY> is set then the content digest is not checked. =head1 NOTES One application of B<CMS_NOINTERN> is to only accept messages signed by a small number of certificates. The acceptable certificates would be passed in the B<certs> parameter. In this case if the signer is not one of the certificates supplied in B<certs> then the verify will fail because the signer cannot be found. In some cases the standard techniques for looking up and validating certificates are not appropriate: for example an application may wish to lookup certificates in a database or perform customised verification. This can be achieved by setting and verifying the signers certificates manually using the signed data utility functions. Care should be taken when modifying the default verify behaviour, for example setting B<CMS_NO_CONTENT_VERIFY> will totally disable all content verification and any modified content will be considered valid. This combination is however useful if one merely wishes to write the content to B<out> and its validity is not considered important. Chain verification should arguably be performed using the signing time rather than the current time. However, since the signing time is supplied by the signer it cannot be trusted without additional evidence (such as a trusted timestamp). =head1 RETURN VALUES CMS_verify() returns 1 for a successful verification and zero if an error occurred. CMS_get0_signers() returns all signers or NULL if an error occurred. The error can be obtained from L<ERR_get_error(3)> =head1 BUGS The trusted certificate store is not searched for the signing certificate, this is primarily due to the inadequacies of the current B<X509_STORE> functionality. The lack of single pass processing means that the signed content must all be held in memory if it is not detached. =head1 SEE ALSO L<OSSL_ESS_check_signing_certs(3)>, L<ERR_get_error(3)>, L<CMS_sign(3)> =head1 COPYRIGHT Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
openssl/openssl
doc/man3/CMS_verify.pod
Perl
apache-2.0
5,347
#!/usr/bin/perl use URI::Escape; my $string = "Hello world!"; my $encode = uri_escape($string); print "Original string: $string\n"; print "URL Encoded string: $encode\n";
mishin/presentation
my_scripts/test_enc.pl
Perl
apache-2.0
176
# this module provides custom postp logic. package EC::POSTP; use strict; use warnings; use XML::Simple; use ElectricCommander; use Data::Dumper; our $VERSION = 0.1; #***************************************************************************** our $PATTERNS = [{ start => qr/^\[(INFO|ERROR|WARNING|TRACE)\]/, cut => qr/^\[(INFO|ERROR|WARNING|TRACE)\]\s*/, end => qr/^\s*$/, }, { start => qr/^\[OUT\]\[(INFO|ERROR|WARNING|DEBUG|TRACE)\]:/, cut => qr/^\[OUT\]\[(INFO|ERROR|WARNING|TRACE)\]:\s+/, end => qr/\s+:\[(INFO|ERROR|WARNING|TRACE)\]\[OUT\]$/, } ]; #***************************************************************************** # Postp module should have run method, which will be invoked. sub run { my ($class, $argv) = @_; my $file_name = get_file_name(); my $ec = ElectricCommander->new(); $ec->setProperty("diagFile", $file_name); my $current_line = 1; my $starting_line = 0; my $counter = 0; my $d = DiagReport->new(); my $buf = ''; my $matcher = ''; my $state = 'seek'; my $terminator = undef; my $cutter = undef; while (<>) { my $line = $_; # we're looking for our patterns. # Once pattern is found, SM is swithching to accumulate mode. if ($state eq 'seek') { ($terminator, $cutter, $matcher) = try_to_switch_mode($line); if ($terminator && $cutter) { print "Switching to accumulate\n"; $starting_line = $current_line; $state = 'accumulate'; $line =~ s/$cutter//s; $buf = ''; # $counter++; } } # Here we're accumulating logs until terminator. # If terminator sequence is detected, switching to flush mode. if ($state eq 'accumulate') { if ($line =~ m/$terminator/s) { $line =~ s/$terminator//s; if ($line) { $buf .= $line; } $state = 'flush'; } else { $buf .= $line; } $counter++; } # This mode appends event and switches to seek. if ($state eq 'flush') { $d->add_row({ type => $matcher, matcher => $matcher, firstLine => $starting_line, numLines => $counter, message => $buf, } ); open(my $fh, '>', $file_name); print $fh $d->render(); close $fh; $counter = 0; $state = 'seek'; } $current_line++; } ## end while (<>) open(my $fh, '>', $file_name); print $fh $d->render(); close $fh; } ## end sub run #***************************************************************************** sub try_to_switch_mode { my ($line) = @_; my $terminator = undef; my $cutter = undef; my $matcher = undef; for my $pat (@$PATTERNS) { if ($line =~ m/$pat->{start}/s) { if ($1) { $matcher = lc($1); } $terminator = $pat->{end}; $cutter = $pat->{cut}; last; } } return ($terminator, $cutter, $matcher); } #***************************************************************************** sub get_file_name { my $step_id = $ENV{COMMANDER_JOBSTEPID}; return 'diag-' . $step_id . '.xml'; } #***************************************************************************** package DiagReport; use strict; use warnings; use XML::Simple; use Carp; #***************************************************************************** sub new { my ($class) = @_; my $self = {_data => {diagnostics => {diagnostic => []}}}; bless $self, $class; return $self; } #***************************************************************************** sub add_row { my ($self, $opts) = @_; my $diag_row = { type => '', matcher => '', name => '', firstLine => '', numLines => '', message => '' }; for my $attr (qw/type message firstLine/) { if (!exists $opts->{$attr}) { croak "$attr attribute is mandatory for postp\n"; } } $diag_row->{type} = $opts->{type}; $diag_row->{message} = $opts->{message}; $diag_row->{firstLine} = $opts->{firstLine}; $diag_row->{numLines} = $opts->{numLines}; $diag_row->{matcher} = $opts->{matcher}; if (!$opts->{matcher}) { $diag_row->{matcher} = $diag_row->{type}; } if (!$opts->{numLines}) { $diag_row->{numLines} = 1; } if ($opts->{name}) { $diag_row->{name} = $opts->{name} } else { delete $diag_row->{name}; } push @{$self->{_data}->{diagnostics}->{diagnostic}}, $diag_row; return $self; } ## end sub add_row #***************************************************************************** sub render { my ($self) = @_; my $header = qq|<?xml version="1.0" encoding="UTF-8"?>\n|; my $xml = $header . XMLout($self->{_data}, KeepRoot => 1, NoAttr => 1, SuppressEmpty => 1); return $xml; } #***************************************************************************** 1;
electric-cloud/EC-WebLogic
src/main/resources/project/lib/EC/POSTP.pm
Perl
apache-2.0
5,468
package # Date::Manip::TZ::afbiss00; # Copyright (c) 2008-2014 Sullivan Beck. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # This file was automatically generated. Any changes to this file will # be lost the next time 'tzdata' is run. # Generated on: Fri Nov 21 10:41:36 EST 2014 # Data version: tzdata2014j # Code version: tzcode2014j # This module contains data from the zoneinfo time zone database. The original # data was obtained from the URL: # ftp://ftp.iana.org/tz use strict; use warnings; require 5.010000; our (%Dates,%LastRule); END { undef %Dates; undef %LastRule; } our ($VERSION); $VERSION='6.48'; END { undef $VERSION; } %Dates = ( 1 => [ [ [1,1,2,0,0,0],[1,1,1,22,57,40],'-01:02:20',[-1,-2,-20], 'LMT',0,[1912,1,1,1,2,19],[1911,12,31,23,59,59], '0001010200:00:00','0001010122:57:40','1912010101:02:19','1911123123:59:59' ], ], 1912 => [ [ [1912,1,1,1,2,20],[1912,1,1,0,2,20],'-01:00:00',[-1,0,0], 'WAT',0,[1975,1,1,0,59,59],[1974,12,31,23,59,59], '1912010101:02:20','1912010100:02:20','1975010100:59:59','1974123123:59:59' ], ], 1975 => [ [ [1975,1,1,1,0,0],[1975,1,1,1,0,0],'+00:00:00',[0,0,0], 'GMT',0,[9999,12,31,0,0,0],[9999,12,31,0,0,0], '1975010101:00:00','1975010101:00:00','9999123100:00:00','9999123100:00:00' ], ], ); %LastRule = ( ); 1;
nriley/Pester
Source/Manip/TZ/afbiss00.pm
Perl
bsd-2-clause
1,522
#!/usr/bin/env perl use strict; my $libPath = $0; $libPath =~ s/[^\/]+$//; $libPath .= "lib"; print STDERR "libpath: $libPath\n"; my $cmd = "java -Xmx300M -cp $libPath JsyntenyView @ARGV"; exec $cmd; die "ERROR, couldn't exec $cmd\n";
asherkhb/coge
bin/dagchainer/DAGCHAINER/Java_XY_plotter/run_XYplot.pl
Perl
bsd-2-clause
243
=pod Placeholder - real PDD will appear after consultation =cut
autarch/perlweb
docs/dev/perl6/pdd/pdd13_bytecode.pod
Perl
apache-2.0
66
package BinaryStatic; use Mojo::Base 'Mojolicious'; use Mojo::Util qw/slurp/; use JSON; use Template; sub startup { my $self = shift; $self->config(decode_json(slurp $self->home->rel_dir('../config.json'))); $self->plugin(charset => {charset => 'utf-8'}); $self->plugin('DefaultHelpers'); $self->plugin('TagHelpers'); $self->plugin('BinaryStatic::Helpers'); # fix paths $self->renderer->paths([ $self->home->rel_dir('../src/templates/haml'), $self->home->rel_dir('../src/templates/toolkit') ]); $self->static->paths([ $self->home->rel_dir('../src') ]); $self->plugin('haml_renderer', { cache => 0, format => 'html5' }); $self->plugin('tt_renderer' => { template_options => { ENCODING => 'utf8', INTERPOLATE => 1, PRE_CHOMP => $Template::CHOMP_GREEDY, POST_CHOMP => $Template::CHOMP_GREEDY, TRIM => 1, } }); $self->renderer->default_handler( 'haml' ); $self->defaults(layout => 'default'); # translation $self->plugin('I18N', { default => 'en' }); $self->hook(before_dispatch => sub { my $c = shift; ## language if (my $lang = $c->req->param('l')) { $c->languages(lc $lang); # I18N $c->session(__lang => lc $lang); } $c->stash(language => uc($c->session('__lang') || 'en')); # other common variables $c->stash(website_name => $c->config->{website_name}); }); # Router my $r = $self->routes; $r->get('/')->to('page#haml')->name('home'); $r->get('/home')->to('page#haml'); $r->get('/promo/:promo')->to('page#open_account_with_promocode'); $r->get('/ticker')->to('page#haml'); $r->get('/timestamp')->to('page#timestamp'); $r->get('/country')->to('page#country'); $r->get('/why-us')->to('page#haml')->name('why-us'); #CRO - Matjaz $r->get('/home5')->to('page#haml')->name('home5'); # Routing for this rather than adding the file to public/ as everything # in public/ will be served by our CDN. We want this served by Mojo. $r->get('/robots.txt')->to('page#robots_txt'); $r->get('/tour')->to('page#haml')->name('tour'); $r->get('/responsible-trading')->to('page#haml')->name('responsible-trading'); $r->get('/careers')->to('page#haml')->name('careers'); $r->get('/group-history')->to('page#haml')->name('group-history'); $r->get('/smart-indices')->to('page#haml')->name('smart-indices'); $r->get('/open-source-projects')->to('page#haml')->name('open-source-projects'); $r->get('/resources')->to('page#haml')->name('resources'); $r->get('/charting')->to('page#haml')->name('charting'); $r->get('/about-us')->to('page#haml')->name('about-us'); $r->get('/contact')->to('page#haml')->name('contact'); # Display to clients from AppCache when they are offline. $r->get('/offline')->to('page#offline')->name('offline'); $r->get('/styles')->to('page#haml')->name('styles'); my $get_started = $r->get('/get-started')->name('get-started'); $get_started->get('/')->to('page#haml'); $get_started->get('/what-is-binary-trading')->to('page#haml')->name('what-is-binary-trading'); $get_started->get('/binary-options-basics')->to('page#haml')->name('binary-options-basics'); $get_started->get('/benefits-of-trading-binaries')->to('page#haml')->name('benefits-of-trading-binaries'); $get_started->get('/how-to-trade-binaries')->to('page#haml')->name('how-to-trade-binaries'); $get_started->get('/types-of-trades')->to('page#haml')->name('types-of-trades'); $get_started->get('/beginners-faq')->to('page#haml')->name('beginners-faq'); $get_started->get('/glossary')->to('page#haml')->name('glossary'); $get_started->get('/random-markets')->to('page#haml')->name('random-markets'); ## login $r->get('/login')->to('page#haml')->name('login'); $r->post('/login')->to('page#login'); $r->get('/logout')->to('page#logout'); $r->get('/user/open_account')->to('page#toolkit'); $r->get('/affiliate/signup')->to('page#toolkit')->name('affiliate-signup'); $r->get('/resources/pricing_table')->to('page#toolkit'); $r->get('/charting/application')->to('page#toolkit')->name('charting-application'); $r->get('/charting/livechart')->to('page#toolkit')->name('charting-livechart'); $r->get('/resources/rise_fall_table')->to('page#toolkit'); $r->get('/terms-and-conditions')->to('page#toolkit')->name('terms-and-conditions'); $r->route('/exception')->to('page#exception'); $r->route('/*')->to('page#not_found'); } 1;
massihx/binary-static
mojo/lib/BinaryStatic.pm
Perl
apache-2.0
4,676
package Class::MOP::Object; BEGIN { $Class::MOP::Object::AUTHORITY = 'cpan:STEVAN'; } { $Class::MOP::Object::VERSION = '2.0602'; } use strict; use warnings; use Carp qw(confess); use Scalar::Util 'blessed'; # introspection sub meta { require Class::MOP::Class; Class::MOP::Class->initialize(blessed($_[0]) || $_[0]); } sub _new { Class::MOP::class_of(shift)->new_object(@_); } # RANT: # Cmon, how many times have you written # the following code while debugging: # # use Data::Dumper; # warn Dumper $obj; # # It can get seriously annoying, so why # not just do this ... sub dump { my $self = shift; require Data::Dumper; local $Data::Dumper::Maxdepth = shift || 1; Data::Dumper::Dumper $self; } sub _real_ref_name { my $self = shift; return blessed($self); } sub _is_compatible_with { my $self = shift; my ($other_name) = @_; return $self->isa($other_name); } sub _can_be_made_compatible_with { my $self = shift; return !$self->_is_compatible_with(@_) && defined($self->_get_compatible_metaclass(@_)); } sub _make_compatible_with { my $self = shift; my ($other_name) = @_; my $new_metaclass = $self->_get_compatible_metaclass($other_name); confess "Can't make $self compatible with metaclass $other_name" unless defined $new_metaclass; # can't use rebless_instance here, because it might not be an actual # subclass in the case of, e.g. moose role reconciliation $new_metaclass->meta->_force_rebless_instance($self) if blessed($self) ne $new_metaclass; return $self; } sub _get_compatible_metaclass { my $self = shift; my ($other_name) = @_; return $self->_get_compatible_metaclass_by_subclassing($other_name); } sub _get_compatible_metaclass_by_subclassing { my $self = shift; my ($other_name) = @_; my $meta_name = blessed($self) ? $self->_real_ref_name : $self; if ($meta_name->isa($other_name)) { return $meta_name; } elsif ($other_name->isa($meta_name)) { return $other_name; } return; } 1; # ABSTRACT: Base class for metaclasses =pod =head1 NAME Class::MOP::Object - Base class for metaclasses =head1 VERSION version 2.0602 =head1 DESCRIPTION This class is a very minimal base class for metaclasses. =head1 METHODS This class provides a few methods which are useful in all metaclasses. =over 4 =item B<< Class::MOP::???->meta >> This returns a L<Class::MOP::Class> object. =item B<< $metaobject->dump($max_depth) >> This method uses L<Data::Dumper> to dump the object. You can pass an optional maximum depth, which will set C<$Data::Dumper::Maxdepth>. The default maximum depth is 1. =back =head1 AUTHOR Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__
leighpauls/k2cro4
third_party/perl/perl/vendor/lib/Class/MOP/Object.pm
Perl
bsd-3-clause
3,121
# Generated by Pod::WikiDoc version 0.15 =pod =head1 NAME Tee - Pure Perl emulation of GNU tee =head1 VERSION This documentation refers to version 0.13 =head1 SYNOPSIS # from Perl use Tee; tee( $command, @files ); # from the command line $ cat README.txt | ptee COPY.txt =head1 DESCRIPTION The C<<< Tee >>> distribution provides the L<ptee> program, a pure Perl emulation of the standard GNU tool C<<< tee >>>. It is designed to be a platform-independent replacement for operating systems without a native C<<< tee >>> program. As with C<<< tee >>>, it passes input received on STDIN through to STDOUT while also writing a copy of the input to one or more files. By default, files will be overwritten. Unlike C<<< tee >>>, C<<< ptee >>> does not support ignoring interrupts, as signal handling is not sufficiently portable. The C<<< Tee >>> module provides a convenience function that may be used in place of C<<< system() >>> to redirect commands through C<<< ptee >>>. =head1 USAGE =head2 C<<< tee() >>> tee( $command, @filenames ); tee( $command, \%options, @filenames ); Executes the given command via C<<< system() >>>, but pipes it through L<ptee> to copy output to the list of files. Unlike with C<<< system() >>>, the command must be a string as the command shell is used for redirection and piping. The return value of C<<< system() >>> is passed through, but reflects the success of the C<<< ptee >>> command, which isn't very useful. The second argument may be a hash-reference of options. Recognized options include: =over =item * stderr -- redirects STDERR to STDOUT before piping to L<ptee> (default: false) =item * append -- passes the C<<< -a >>> flag to L<ptee> to append instead of overwriting (default: false) =back =head1 LIMITATIONS Because of the way that C<<< Tee >>> uses pipes, it is limited to capturing a single input stream, either STDOUT alone or both STDOUT and STDERR combined. A good, portable alternative for capturing these streams from a command separately is L<IPC::Run3>, though it does not allow passing it through to a terminal at the same time. =head1 SEE ALSO =over =item * L<ptee> =item * IPC::Run3 =item * IO::Tee =back =head1 BUGS Please report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted by email to C<<< bug-Tee@rt.cpan.org >>> or through the web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=Tee> When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR David A. Golden (DAGOLDEN) dagolden@cpan.org http:E<sol>E<sol>www.dagolden.orgE<sol> =head1 COPYRIGHT AND LICENSE Copyright (c) 2006 by David A. Golden This program is free software; you can redistribute it andE<sol>or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS ANDE<sol>OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY ANDE<sol>OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
leighpauls/k2cro4
third_party/cygwin/lib/perl5/vendor_perl/5.10/Tee.pod
Perl
bsd-3-clause
4,253
# Implicit Func to InstMethod, zero or one args ## perl[func] -> ruby[ $_.func] ## perl[func VALUE] -> ruby[ VALUE.func] sub ImpFuncToInstMeth { my ($rubyfunc) = @_; my %arghash = @arglist; $arghash{'min'} //= 0; $arghash{'max'} //= 1; $arghash{'default'} //= '$_'; my @allowed = qw(min max default); foreach my $key (keys(%arghash)) { die "bad key $key" unless (grep {/$key/} @allowed); } print "VALUE.$rubyfunc $arghash{min} $arghash{max}\n"; } # Implicit Func to ClassMethod, zero or one args ## perl[func] -> ruby[ func $_] ## perl[func VALUE] -> ruby[ func VALUE] # ImpFuncToClassMeth01 sub ImpFuncToClassMeth { my ($rubyfunc,@arglist) = @_; my %arghash = @arglist; $arghash{'min'} //= 0; $arghash{'max'} //= 1; $arghash{'default'} //= '$_'; my @allowed = qw(min max default); foreach my $key (keys(%arghash)) { unless (grep {/$key/} @allowed) { warn "CM $key\n"; } } print "$rubyfunc $arghash{min} $arghash{max}\n"; } ## direct-map args sub ArgMap { my ($rubyfunc,@arglist) = @_; my %arghash = @arglist; $arghash{'min'} //= $arghash{'args'} // 0; $arghash{'max'} //= $arghash{'args'}; my @allowed = qw(min max args); foreach my $key (keys(%arghash)) { unless (grep {/$key/} @allowed) { warn "ARG $key\n"; } } print "$rubyfunc $arghash{min} $arghash{max}\n"; } sub ListOrScalarFunc { my ($rubyfunc,@arglist) = @_;# } ## perl to ruby map local $FUNCMAP = { # Functions for SCALARs or strings # chomp, chop, chr, crypt, fc, hex, index, lc, lcfirst, length, oct, ord, # pack, q//, qq//, reverse, rindex, sprintf, substr, tr///, uc, ucfirst, y/// 'chomp' => ImpFuncToInstMeth('chomp!'), 'chop' => ImpFuncToInstMeth('chop!'), 'crypt VALUE, REST' => 'VALUE.crypt REST', 'chr' => ImpFuncToInstMeth("chr"), 'lc' => ImpFuncToInstMeth('downcase'), 'lcfirst' => ImpFuncToInstMeth('capitalize.swapcase'), 'length' => ImpFuncToInstMeth('length'), 'ord' => ImpFuncToInstMeth("ord"), 'rindex VALUE, REST' => ImpFuncToInstMeth("rindex", "min" => 2), #sprintf is the same ## we need special handling for substr # 'substr' => { "2 arg: substr(value,idx)" => "VALUE[idx..-1]", # "3 arg: substr(value,idx,len)" => "VALUE[idx,len]", # "4 arg: substr(value,idx,len,replaceval)" => undef, #unsupported! # }, 'uc' => ImpFuncToInstMeth('upcase'), 'ucfirst' => ImpFuncToInstMeth('capitalize'), # Regular expressions and pattern matching # m//, pos, qr//, quotemeta, s///, split, study 'split PATTERN, EXPR|$_, REST' => 'EXPR.split PATTERN, REST', # Numeric functions # abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt, srand 'abs' => ImpFuncToInstMeth("abs"), "atan2" => ArgMap( "Math.atan2", 'args' => 2), "cos" => ImpFuncToClassMeth("Math.cos"), "exp" => ImpFuncToClassMeth("Math.exp"), "log" => ImpFuncToClassMeth("Math.log"), "sin" => ImpFuncToClassMeth("Math.sin"), "sqrt" => ImpFuncToClassMeth("Math.sqrt"), 'int' => ImpFuncToInstMeth("to_i"), 'hex' => ImpFuncToInstMeth("hex"), 'oct' => ImpFuncToInstMeth("oct"), 'rand' => ImpFuncToClassMeth( "Random.rand", "default"=>'1'), 'srand' => ArgMap( "Random.srand", 'min'=> 0, 'max'=>1), # Functions for real @ARRAYs # each, keys, pop, push, shift, splice, unshift, values # Functions for list data # grep, join, map, qw//, reverse, sort, unpack #currently unsupported 'reverse' => ListOrScalarFunc("ARGS", "reverse", $_), # Functions for real %HASHes # delete, each, exists, keys, values # PERL delete $hash{$key} ==> RUBY hash.delete key # PERL each - no good analogy here, might be able to be done with ruby # enumerators, but doubtful that it's the 'right' thing. # PERL exists $hash{$key} ==> RUBY hash.has_key? key (is this close enough??) 'keys' => ImpFuncToInstMeth("keys", 'min'=>1), 'values' => ImpFuncToInstMeth("values", 'min'=>1), # Input and output functions # binmode, close, closedir, dbmclose, dbmopen, die, eof, fileno, flock, format, # getc, print, printf, read, readdir, readline rewinddir, say, seek, seekdir, # select, syscall, sysread, sysseek, syswrite, tell, telldir, truncate, warn, write 'binmode' => ImpFuncToInstMeth("binmode", 'min'=>1, 'max'=>2), 'close' => ImpFuncToInstMeth("close", 'min'=>1), 'closedir' => ImpFuncToInstMeth("close", 'min'=>1), 'die' => ArgMap("abort"), 'print' => ArgMap('print'), 'printf' => ArgMap('printf'), 'say' => ArgMap('puts'), 'warn' => ArgMap("warn"), 'sysseek' => ImpFuncToInstMeth("sysseek", 'min'=>3, 'max'=>3), # 'sysread' # bad params? # Functions for fixed-length data or records # pack, read, syscall, sysread, sysseek, syswrite, unpack, vec # Functions for filehandles, files, or directories # -X, chdir, chmod, chown, chroot, fcntl, glob, ioctl, link, lstat, mkdir, # open, opendir, readlink, rename, rmdir, stat, symlink, sysopen, umask, unlink, utime 'chdir' => ImpFuncToClassMeth('Dir.chdir', 'default' => 'ENV[\'HOME\']||ENV[\'LOGDIR\']'), 'chmod' => ArgMap('File.chmod'), 'chown' => ArgMap('File.chown'), 'link' => ArgMap('File.link'), 'lstat' => ImpFuncToClassMeth('File.lstat'), 'mkdir' => ImpFuncToClassMeth('Dir.mkdir', 'default' => '$_', 'default2' => "0777", 'max'=>2), 'open' => ArgMap('File.open'), 'opendir' => ArgMap('Dir.open', 'args'=>2), 'readlink' => ImpFuncToClassMeth('File.readlink'), 'rename' => ArgMap('File.rename', 'args' =>2), 'rmdir' => ImpFuncToClassMeth('Dir.rmdir'), 'stat' => ImpFuncToClassMeth('File.stat'), 'symlink' => ArgMap('File.symlink', 'args' =>2), 'sysopen' => ArgMap('IO.sysopen', 'min'=>3, 'max'=>4), 'umask' => ArgMap('File.umask', 'min'=>0, 'max'=>1), 'unlink' => ImpFuncToClassMeth('File.unlink', 'default'=>'$_', 'max'=> 1e3), 'utime' => ImpFuncToClassMeth('File.utime','max'=> 1e3), # Fetching user and group info # endgrent, endhostent, endnetent, endpwent, getgrent, getgrgid, # getgrnam, getlogin, getpwent, getpwnam, getpwuid, setgrent, setpwent 'endgrent' => ArgMap('Etc.endgrent','args'=>0), 'endpwent' => ArgMap('Etc.endpwent','args'=>0), 'getgrent' => ArgMap('Etc.getgrent','args'=>0), 'getgrgid' => ArgMap('Etc.getgrgid','args'=>1), 'getgrnam' => ArgMap('Etc.getgrnam','args'=>2), 'getlogin' => ArgMap('Etc.getlogin','args'=>0), 'getpwent' => ArgMap('Etc.getpwent','args'=>0), 'getpwnam' => ArgMap('Etc.getpwnam','args'=>1), 'getpwuid' => ArgMap('Etc.getpwuid','args'=>1), 'setgrent' => ArgMap('Etc.setgrent','args'=>0), 'setpwent' => ArgMap('Etc.setpwent','args'=>0), #NORUBY 'endhostent' => ?? #NORUBY 'endnetent' => ?? # Fetching network info # endprotoent, endservent, gethostbyaddr, gethostbyname, gethostent, getnetbyaddr, # getnetbyname, getnetent, getprotobyname, getprotobynumber, getprotoent, getservbyname, # getservbyport, getservent, sethostent, setnetent, setprotoent, setservent #NORUBY for any.. # Time-related functions # gmtime, localtime, time, times 'time' => ArgMap('Time.now'), 'gmtime' => ImpFuncToInstMeth('gmtime'), 'localtime' => ImpFuncToInstMeth('localtime'), #NORUBY 'times' => ?? }; 1;
nanobowers/perl5-to-ruby
lib/perl/P2R/FunctionMap.pm
Perl
mit
7,429
#!/usr/local/bin/perl #------------------------------------- # Cleanup TempDir, # (C)1997-2000 Harvard University # # W. S. Lane/C. M. Wendl # # v3.1a # # licensed to Finnigan #------------------------------------- ################################################ # find and read in standard include file { my $path = $0; $path =~ s!\\!/!g; $path =~ s!^(.*)/[^/]+/.*$!$1/etc!; unshift (@INC, "$path"); require "microchem_include.pl"; } ################################################ $DEFAULT_DAYS = 2; $cmdline = grep /^-c/, @ARGV; if ($cmdline) { @days = grep /^-d/, @ARGV; $days = (@days ? substr($days[0],2) : $DEFAULT_DAYS); &do_delete; exit 0; } else { &cgi_receive; &output_form if (!defined $FORM{"days"}); $days = $FORM{"days"}; &do_delete; MS_pages_header("Cleanup TempDir", "FF3300"); print <<EOF; <P><HR><P> <a href="$webtempdir">$tempdir</a> has been cleaned. </body></html> EOF exit 0; } sub do_delete { chdir "$tempdir"; opendir(TEMP,"."); while($file = readdir(TEMP)) { foreach $ext (@extensions_to_delete) { unlink $file if ( ($file =~ /\.$ext$/) && ((-A "$file") > $days) ); } } close(TEMP); open(STAMP,">stamp"); close(STAMP); open(LOG,">>cleanup.log"); print LOG localtime() . ": tempdir cleaned\n"; close(LOG); } sub output_form { MS_pages_header("Cleanup TempDir", "FF3300"); @exts = @extensions_to_delete; foreach $ext (@exts) { $ext =~ tr/a-z/A-Z/; } $last = pop(@exts); $exts = $last; $exts = join(", ",@exts) . " and " . $exts if (@exts); print <<EOF; <P><HR><P> <div> <FORM ACTION="$ourname" METHOD=get> Delete all $exts files in <a href="$webtempdir">$tempdir</a> older than <INPUT NAME="days" VALUE="$DEFAULT_DAYS" SIZE=2 MAXLENGTH=2> days? <P> <INPUT TYPE=submit CLASS=button VALUE="Proceed"></FORM> </div> </body></html> EOF exit 0; } sub error { MS_pages_header("Cleanup TempDir", "FF3300"); print <<EOF; <P><HR><P> <H2>Error:</H2> <div> @_ </div> </body></html> EOF exit 0; }
wangchulab/CIMAGE
cravatt_web/cgi-bin/flicka/cleanup_tempdir.pl
Perl
mit
1,991
#! /usr/bin/env perl local $, = ' '; local $\ = "\n"; print "'("; while (<>) { chomp; @fields = split /,/; print "(@fields)"; } print ")";
qlkzy/project-euler-cl
listify.pl
Perl
mit
153
#!/usr/bin/env perl use warnings; use strict; use Data::Dumper; use Getopt::Long; use Spreadsheet::ParseExcel; use Spreadsheet::XLSX; use Bio::KBase::Transform::ScriptHelpers qw( parse_excel ); my $In_File = ""; my $Help = 0; GetOptions("input|i=s" => \$In_File, "help|h" => \$Help); if($Help || !$In_File){ print($0." --input/-i <Input Excel File>"); exit(0); } if(!-f $In_File){ die("Cannot find $In_File"); } my $sheets = parse_excel($In_File); if(!exists($sheets->{Media}) && !exists($sheets->{media})){ die("$In_File does not contain a worksheet for media which should be named 'Media'"); } foreach my $sheet (keys %$sheets){ system("rm ".$sheets->{$sheet}); } __END__ Logging: Log output format Datetime in UTC - name of script - log level: log message <YYYY-MM-DDTHH:mm:SS> - <script_name> - <level>: <message> e.g., 2014-12-10T00:00:00Z - trns_transform_KBaseGenomes.GBK-to-KBaseGenomes.Genome - INFO: Validating input file sample.gbff #1 How many <level> do you plan to support? #2 What?s the failure report LEVEL? FATAL, FAIL, ??? #3 Do you have any recommended library to use to dump the above format?
realmarcin/transform
scripts/trns_validate_KBaseBiochem.Excel.pl
Perl
mit
1,182
############################################################################### # # FileUtil.pm # # Helper class for files # ############################################################################### package plsearch::FileUtil; use strict; use warnings; # use XML::Simple; use Data::Dumper; use File::Basename; use plsearch::common; my @DOT_DIRS = ('.', '..'); sub get_extension { my ($file) = @_; my $f = basename($file); my $idx = rindex($f, '.'); if ($idx > 0 && $idx < length($f) - 1) { return lc(substr($f, $idx+1)); } return ''; } sub get_file_handle { my ($file) = @_; open(FILE, "<$file") || die "File I/O error: $file: $!\n"; return \*FILE; } sub get_file_contents { my ($file) = @_; my $fh = get_file_handle($file); local $/; my $delim = undef $/; my $contents = <$fh>; close($fh); $/ = $delim; return $contents; } sub get_file_lines { my ($file) = @_; my $fh = get_file_handle($file); my @lines = <$fh>; close($fh); return \@lines; } sub is_dot_dir { my ($dir) = @_; if (grep {$_ eq $dir} @DOT_DIRS) { return 1; } return 0; } sub is_hidden { my ($file) = @_; my $f = basename($file); if (length($f) > 1 && substr($f, 0, 1) eq '.' && !is_dot_dir($f)) { return 1; } return 0; } 1; __END__
clarkcb/xsearch
perl/plsearch/lib/plsearch/FileUtil.pm
Perl
mit
1,363
# This file is auto-generated by the Perl DateTime Suite time zone # code generator (0.07) This code generator comes with the # DateTime::TimeZone module distribution in the tools/ directory # # Generated from debian/tzdata/africa. Olson data version 2008c # # Do not edit this file directly. # package DateTime::TimeZone::Africa::Asmara; use strict; use Class::Singleton; use DateTime::TimeZone; use DateTime::TimeZone::OlsonDB; @DateTime::TimeZone::Africa::Asmara::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' ); my $spans = [ [ DateTime::TimeZone::NEG_INFINITY, 58980000268, DateTime::TimeZone::NEG_INFINITY, 58980009600, 9332, 0, 'LMT' ], [ 58980000268, 59611152268, 58980009600, 59611161600, 9332, 0, 'AMT' ], [ 59611152268, 61073472280, 59611161588, 61073481600, 9320, 0, 'ADMT' ], [ 61073472280, DateTime::TimeZone::INFINITY, 61073483080, DateTime::TimeZone::INFINITY, 10800, 0, 'EAT' ], ]; sub olson_version { '2008c' } sub has_dst_changes { 0 } sub _max_year { 2018 } sub _new_instance { return shift->_init( @_, spans => $spans ); } 1;
carlgao/lenga
images/lenny64-peon/usr/share/perl5/DateTime/TimeZone/Africa/Asmara.pm
Perl
mit
1,100
#! /usr/bin/env perl # Create charts based on daily_summary use Getopt::Long; use POSIX strftime; use IO::File; use Socket6; use Data::Dumper; use JSON; use RRDs; use DBI; use strict; $| = 1; my ( $MirrorConfig, $PrivateConfig, $dbh, %blacklisted, $midnight ); # %blacklisted is not implemented at the moment. $ENV{"TZ"} = "UTC"; ################################################################ # getopt # ################################################################ my ( $usage, %argv, %input ) = ""; %input = ( "rescan=i" => "rescan this many days (3)", "config=s" => "config.js file (REQUIRED)", "private=s" => "private.js file (default: same place as config.js)", "v|verbose" => "spew extra data to the screen", "h|help" => "show option help" ); my $result = GetOptions( \%argv, keys %input ); $argv{"rescan"} ||= 3; if ( ( $argv{"config"} ) && ( !$argv{"private"} ) ) { $argv{"private"} = $argv{"config"}; $argv{"private"} =~ s#[^/]+$#private.js#; } if ( ( !$result ) || ( !$argv{"config"} ) || ( $argv{h} ) ) { &showOptionsHelp; exit 0; } ################################################################ # configs # ################################################################ sub get_file { my ($file) = @_; my $handle = new IO::File "<$file" or die "Could not open $file : $!"; my $buffer; read $handle, $buffer, -s $file; close $handle; return $buffer; } sub get_config { my ( $file, $varname ) = @_; my $got = get_file($file); # Remove varname $got =~ s#^\s*$varname\s*=\s*##ms; # Remove comments like /* and */ and // $got =~ s#(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|([\s\t](//).*)##mg; # And trailing commas $got =~ s/,\s*([\]}])/$1/mg; my $ref = decode_json($got); if ( !$ref ) { die "Could not json parse $file\n"; } return $ref; } sub validate_private_config { my ($ref) = @_; die "Missing private.js: db password" unless ( $ref->{db}{password} ); die "Missing private.js: db db" unless ( $ref->{db}{db} ); die "Missing private.js: db username" unless ( $ref->{db}{username} ); die "Missing private.js: db host" unless ( $ref->{db}{host} ); die "Missing private.js: paths rrd" unless ( $ref->{paths}{rrd} ); die "Missing private.js: paths png" unless ( $ref->{paths}{png} ); } ################################################################ # utilities # ################################################################ sub get_db_handle { my ($dbref) = @_; my $dsn = sprintf( "DBI:mysql:database=%s;host=%s", $dbref->{db}, $dbref->{host} ); my $dbh = DBI->connect( $dsn, $dbref->{username}, $dbref->{password} ); die "Failed to connect to mysql" unless ($dbh); return $dbh; } my %my_mkdir; sub my_mkdir { my ($dir) = @_; return if ( $my_mkdir{$dir}++ ); return if ( -d $dir ); system( "mkdir", "-p", $dir ); return if ( -d $dir ); die "Unable to create $dir\: $!"; } sub showOptionsHelp { my ( $left, $right, $a, $b, $key ); my (@array); print "Usage: $0 [options] $usage\n"; print "where options can be:\n"; foreach $key ( sort keys(%input) ) { ( $left, $right ) = split( /[=:]/, $key ); ( $a, $b ) = split( /\|/, $left ); if ($b) { $left = "-$a --$b"; } else { $left = " --$a"; } $left = substr( "$left" . ( ' ' x 20 ), 0, 20 ); push( @array, "$left $input{$key}\n" ); } print sort @array; } ################################################################ # Prep daily and monthly summaries in the database # ################################################################ sub update_daily_summary { my ($rescan) = @_; my $unix = $midnight - $rescan * 86400; while ( $unix <= $midnight ) { my $day = strftime( '%Y-%m-%d', localtime $unix ); my $start = "$day 00:00:00"; my $stop = "$day 23:59:59"; print "Process: $start to $stop\n" if ( $argv{"v"} ); $unix += 86400; my %byvalues; { my $sql_template = "select status_a,status_aaaa,status_ds4,status_ds6,ip6,ip6,cookie,tokens from survey where timestamp >= ? and timestamp <= ? order by timestamp;"; my $sth = $dbh->prepare($sql_template); $sth->execute( $start, $stop ) or die $sth->errstr; while ( my $ref = $sth->fetchrow_hashref() ) { print "." if ( $argv{"v"} ); my $cookie = ${$ref}{"cookie"}; my $tokens = ${$ref}{"tokens"}; my $ip4 = ${$ref}{"ip4"}; my $ip6 = ${$ref}{"ip6"}; my $status_a = ${$ref}{"status_a"}; my $status_aaaa = ${$ref}{"status_aaaa"}; my $status_ds4 = ${$ref}{"status_ds4"}; my $status_ds6 = ${$ref}{"status_ds6"}; next if ( exists $blacklisted{$ip4} ); next if ( exists $blacklisted{$ip6} ); if ($ip6) { my $p = prefix( $ip6, 64 ); next if ( exists $blacklisted{$p} ); } $tokens = check_results($ref); # Ignore prior state. Re-evaluate. $byvalues{$cookie} = $tokens; } ## end while ( my $ref = $sth->fetchrow_hashref() ) $sth->finish(); print "\n" if ( $argv{"v"} ); } # Now do something with %bycookie; # invert my %bystatus; foreach my $key ( keys %byvalues ) { $bystatus{ $byvalues{$key} }++; } # Delete the previous count for this date, in preparation to update it. { my $sql_template = "delete from daily_summary where datestamp = ?;"; my $sth = $dbh->prepare($sql_template); $sth->execute($day) or die $sth->errstr; $sth->finish(); } # Insert new records { my $sql_template = "insert into daily_summary (datestamp,total,tokens) values (?,?,?);"; my $sth = $dbh->prepare($sql_template); foreach my $tokens ( keys %bystatus ) { my $count = $bystatus{$tokens}; $sth->execute( $day, $count, $tokens ) or die $sth->errstr; print "$sql_template ($day, $count, $tokens)\n" if ( $argv{"v"} ); } $sth->finish(); } } ## end while ( $unix <= $midnight ) } ## end sub update_daily_summary sub update_monthly_summary { my ($rescan) = @_; my $unix = $midnight - $rescan * 86400; my %did_month; while ( $unix <= $midnight + 86400 ) { my $month = strftime( '%Y-%m', localtime $unix ); $unix += 86400; next if ( $did_month{$month}++ ); # Don't want the repeat business. my $start = "$month-01"; my $stop; { my $sql_template = "SELECT LAST_DAY(?);"; my $sth = $dbh->prepare($sql_template); $sth->execute($start) or die $sth->errstr; ($stop) = $sth->fetchrow_array; $sth->finish(); } print "Process: $start to $stop\n" if ( $argv{"v"} ); my %bystatus; { my $sql_template = "select total,tokens from daily_summary where datestamp >= ? and datestamp <= ?;"; my $sth = $dbh->prepare($sql_template); $sth->execute( $start, $stop ) or die $sth->errstr; while ( my $ref = $sth->fetchrow_hashref() ) { my $tokens = ${$ref}{tokens}; my $total = ${$ref}{total}; $bystatus{$tokens} += $total; } $sth->finish(); } # Delete the previous count for this date, in preparation to update it. { my $sql_template = "delete from monthly_summary where datestamp = ?;"; my $sth = $dbh->prepare($sql_template); $sth->execute($stop) or die $sth->errstr; $sth->execute($start) or die $sth->errstr; $sth->finish(); } # Insert new records { my $sql_template = "insert into monthly_summary (datestamp,total,tokens) values (?,?,?);"; my $sth = $dbh->prepare($sql_template); foreach my $tokens ( keys %bystatus ) { my $count = $bystatus{$tokens}; $sth->execute( $stop, $count, $tokens ) or die $sth->errstr; } $sth->finish(); } } ## end while ( $unix <= $midnight + 86400 ) } ## end sub update_monthly_summary ################################################################ # Check results # ################################################################ my %states = ( "a aaaa ds4 ds6" => "status", "oooo" => "Confused", "ooob" => "Dual Stack - IPv4 Preferred", "oobo" => "Dual Stack - IPv6 Preferred", "oobb" => "Broken DS", "oboo" => "Confused", "obob" => "IPv4 only", "obbo" => "Dual Stack - IPv6 Preferred", # Whoa. What's with that one? "obbb" => "Broken DS", "booo" => "Confused", "boob" => "Dual Stack - IPv4 Preferred", # Whoa. What's with that one? "bobo" => "IPv6 only", "bobb" => "Broken DS", "bboo" => "Web Filter", "bbob" => "Web Filter", "bbbo" => "Web Filter", "bbbb" => "Web Filter", ); sub check_results { my $ref = shift @_; my $status_a = ${$ref}{"status_a"}; my $status_aaaa = ${$ref}{"status_aaaa"}; my $status_ds4 = ${$ref}{"status_ds4"}; my $status_ds6 = ${$ref}{"status_ds6"}; my $lookup = substr( $status_a, 0, 1 ) . substr( $status_aaaa, 0, 1 ) . substr( $status_ds4, 0, 1 ) . substr( $status_ds6, 0, 1 ); $lookup =~ s/s/o/g; # Slow? treat as OK for this $lookup =~ s/t/b/g; # Timeout? treat as bad for this my $token = $states{$lookup}; # print "$lookup $token\n" if ($argv{"v"}); if ( !$token ) { $token ||= "Missing"; # print join( "\t", $lookup, $status_a, $status_aaaa, $status_ds4, $status_ds6, $token ) . "\n"; } return $token; } ## end sub check_results sub prefix { my ( $ip6, $bits ) = @_; my $p; my $i; die "prefix(ipv6,bits) - error, bits must be even multiple of 8" if ( $bits % 8 ); my $bytes = $bits / 8; eval { my $i = inet_pton AF_INET6(), $ip6; $i = substr( substr( $i, 0, $bytes ) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 0, 16 ); $p = inet_ntop( AF_INET6(), $i ); }; return $p; } ################################################################ # rrd-generate-db # ################################################################ sub generate_rrd_db { my ($rescan) = @_; my $start_date = strftime( '%Y-%m-%d', gmtime( $midnight - $rescan * 86400 ) ); my $stop_date = strftime( '%Y-%m-%d', gmtime( $midnight + 1 * 86400 ) ); my $dir = $PrivateConfig->{paths}{rrd}; my_mkdir($dir); if ( ( ( $start_date cmp "2010-05-01" ) < 0 ) ) { $start_date = "2010-05-01"; } my %buckets; my %dates; { my $sql_template = "select unix_timestamp(datestamp) as unixtime, tokens, total from daily_summary where datestamp >= ? and datestamp <= ? order by unixtime;"; my $sth = $dbh->prepare($sql_template); $sth->execute( $start_date, $stop_date ) or die $sth->errstr; while ( my $ref = $sth->fetchrow_hashref() ) { my $unixtime = ${$ref}{"unixtime"}; my $total = ${$ref}{"total"}; my $bucket = ${$ref}{"tokens"}; next if ( $bucket eq "skip" ); next if ( $bucket eq "Missing" ); if ( $argv{"v"} ) { # print STDERR "Unclear: ${$ref}{tokens}\n" if ( $bucket =~ /unclear/i ); } $buckets{$bucket} += $total; $buckets{"total"} += $total; $dates{$unixtime}{$bucket} += $total; $dates{$unixtime}{"total"} += $total; } $sth->finish(); } my @dates = sort keys %dates; my @buckets = sort keys %buckets; # Make sure these are each created. foreach ( "Broken DS", "Confused", "Dual Stack - IPv4 Preferred", "Dual Stack - IPv6 Preferred", "IPv4 only", "IPv6 only", "Missing", "Web Filter", "total" ) { $buckets{$_} ||= 0; } foreach my $bucket ( keys %buckets ) { create_db( $dir, $bucket, $rescan ); foreach my $date (@dates) { my $d = strftime( '%Y-%m-%d', gmtime $date ); next if ( $d =~ m/2010-03-31/ ); update_db( $dir, $bucket, $date, $dates{$date}{$bucket} ); } } } ## end sub generate_rrd_db sub create_db { my ( $dir, $bucket, $rescan ) = @_; # dir = where to put the rrd file # bucket = how to name the rrd file my $filename = "$dir/$bucket.rrd"; print "creating $filename\n" if ( -t STDOUT ); my (@DS); my (@RRA); my ($start) = time - ( $rescan + 1 ) * 86400; $start = int( $start / 86400 ) * 86400; # Start on a midnight boundary. my (@DS) = ("DS:count:GAUGE:86400:0:U"); my (@RRA) = ( "RRA:LAST:0:1:5000", "RRA:LAST:0:7:5000" ); # Daily and Weekly, 5000 values each. RRDs::create( $filename, "-s", "86400", "-b", "$start", @DS, @RRA ); my $error = RRDs::error; die $error if $error; } ## end sub create_db sub update_db { my ( $dir, $bucket, $date, $value ) = @_; my $filename = "$dir/$bucket.rrd"; $value ||= 0; my $value2 = "$date\:$value"; # Convert $date to a unix time stamp # print "update $filename $date $value\n" if ( $argv{"v"}); RRDs::update( $filename, $value2 ); my $error = RRDs::error; if ($error) { if ( $error =~ m#No such file# ) { create_db( $dir, $bucket ); RRDs::update( $filename, $value2 ); $error = RRDs::error; } if ($error) { print STDERR "ERROR: while attempting RRDs::update(\"$filename\",\"$value2\"): $error\n"; } } } ## end sub update_db ################################################################ # generate-rrd-images # ################################################################ my ( @RRD_BASE_OPTS, @RRD_BASE_DEFS, %COLORS ); sub gen_graphs { my ( $short, $long ) = @_; base_setup(); _generate_summary_area( "summary_area_days.png", $short ); _generate_summary_area( "summary_area_year.png", $long ); _generate_summary_line( "summary_line_days.png", $short ); _generate_summary_line( "summary_line_year.png", $long ); _generate_summary_pct( "summary_pct_days.png", $short ); _generate_summary_pct( "summary_pct_year.png", $long ); _generate_broken_pct( "summary_broken_days.png", $short ); _generate_broken_pct( "summary_broken_year.png", $long ); } sub base_setup { # Baseline stuff - every image will have this as the starting point. my $DBDIR = $PrivateConfig->{paths}{rrd}; @RRD_BASE_OPTS = ( "-a", "PNG", "-h", "200", "-w", "800" ); @RRD_BASE_DEFS = grep( /./, split( /\n/, <<"EOF") ); DEF:Dual_Stack_pref_IPv4_raw=$DBDIR/Dual Stack - IPv4 Preferred.rrd:count:LAST DEF:Dual_Stack_pref_IPv6_raw=$DBDIR/Dual Stack - IPv6 Preferred.rrd:count:LAST DEF:IPv4_raw=$DBDIR/IPv4 only.rrd:count:LAST DEF:IPv6_raw=$DBDIR/IPv6 only.rrd:count:LAST DEF:Broken_raw=$DBDIR/Broken DS.rrd:count:LAST DEF:Confused_raw=$DBDIR/Confused.rrd:count:LAST DEF:WebFilter_raw=$DBDIR/Web Filter.rrd:count:LAST DEF:Total_raw=$DBDIR/total.rrd:count:LAST EOF foreach my $x (qw( Dual_Stack_pref_IPv4 Dual_Stack_pref_IPv6 IPv4 IPv6 Broken Confused WebFilter Total)) { push( @RRD_BASE_DEFS, "CDEF:${x}=${x}_raw,UN,0,${x}_raw,IF" ); } push( @RRD_BASE_DEFS, grep( /./, split( /\n/, <<"EOF") ) ); CDEF:Dual_Stack=Dual_Stack_pref_IPv4,Dual_Stack_pref_IPv6,+ CDEF:untestable=Confused,WebFilter,+ CDEF:BrokenPercent=Broken,Total,/,100,* CDEF:Zero=Total,UN,0,* EOF foreach my $x ( qw( Dual_Stack_pref_IPv4 Dual_Stack_pref_IPv6 IPv4 IPv6 Broken Confused WebFilter Total Dual_Stack untestable BrokenPercent Zero ) ) { push( @RRD_BASE_DEFS, "CDEF:${x}_pct=${x},Total,/,100,*" ); push( @RRD_BASE_DEFS, "VDEF:${x}_min=${x},MINIMUM" ); push( @RRD_BASE_DEFS, "VDEF:${x}_max=${x},MAXIMUM" ); push( @RRD_BASE_DEFS, "VDEF:${x}_avg=${x},AVERAGE" ); push( @RRD_BASE_DEFS, "VDEF:${x}_pct_min=${x}_pct,MINIMUM" ); push( @RRD_BASE_DEFS, "VDEF:${x}_pct_max=${x}_pct,MAXIMUM" ); push( @RRD_BASE_DEFS, "VDEF:${x}_pct_avg=${x}_pct,AVERAGE" ); } %COLORS = ( Dual_Stack_pref_IPv4 => "00FFFF", Dual_Stack_pref_IPv6 => "00FF00", Dual_Stack => "00FF00", IPv6 => "FFFF00", IPv4 => "8888FF", Broken => "FF8888", Confused => "aaaaaa", WebFilter => "666666", untestable => "888888", Total => "000000", BrokenPercent => "FF0000", Zero => "000000" ); } ## end sub base_setup sub GenImage { my ( $name, @args ) = @_; my $IMGDIR = $PrivateConfig->{paths}{png}; my_mkdir($IMGDIR); my ($ref) = RRDs::graph( "$IMGDIR/$name", @args ); my $error = RRDs::error; if ($error) { print "error: $error\n"; if ( -t STDOUT ) { print "$_\n" foreach (@args); print "\n"; } } # print Dump($ref); } sub GenData { my ( $type, $cdef, $comment ) = @_; my $vdef = $cdef; $vdef =~ s/_raw$//; my $colordef = $cdef; $colordef =~ s/_raw$//; $colordef =~ s/_pct$//; if ( !exists $COLORS{$colordef} ) { die "Need \$COLORS{$colordef} defined\n"; } my $STACK = ""; $STACK = "STACK" if ( $type =~ /AREA/ ); return ( grep( /./, split( /\n/, <<"EOF") ) ); COMMENT:$comment ${type}:${cdef}#$COLORS{$colordef}:$STACK GPRINT:${vdef}_min:% 10.2lf GPRINT:${vdef}_avg:% 10.2lf GPRINT:${vdef}_max:% 10.2lf\\r EOF } ## end sub GenData sub GenLine { return GenData( "LINE2", @_ ); } sub GenArea { return GenData( "AREA", @_ ); } sub time_range { my ( $start, $stop ) = @_; $start = strftime( '%d/%b/%Y', localtime $start ); $stop = strftime( '%d/%b/%Y', localtime $stop ); return ("COMMENT:Time range\\: $start to $stop UTC\\r"); } sub _generate_summary_area { my ( $filename, $days ) = @_; my $start = $midnight - $days * 86400; my $stop = $midnight - 86400; my $domain = $MirrorConfig->{"site"}{"name"}; my @RRD_EXTRA_OPTS = ( "-s", $start, "-e", $stop ); my @RRD_COMMANDS; push( @RRD_EXTRA_OPTS, "--title", "Summary of test results / $domain" ); push( @RRD_EXTRA_OPTS, "--vertical-label", "Per day" ); push( @RRD_COMMANDS, time_range( $start, $stop ) ); push( @RRD_COMMANDS, "COMMENT:Minimum Average Maximum\\r" ); push( @RRD_COMMANDS, "LINE:Zero#000000" ); push( @RRD_COMMANDS, GenArea( "IPv4_raw", "IPv4 only" ) ); push( @RRD_COMMANDS, GenArea( "Dual_Stack_pref_IPv4", "IPv4 and IPv6 (prefer IPv4)" ) ) ; # Not using "raw" for this one push( @RRD_COMMANDS, GenArea( "Dual_Stack_pref_IPv6", "IPv4 and IPv6 (prefer IPv6)" ) ) ; # Not using "raw" for this one push( @RRD_COMMANDS, GenArea( "IPv6_raw", "IPv6 only" ) ); push( @RRD_COMMANDS, GenArea( "Broken_raw", "Detected Broken DS" ) ); push( @RRD_COMMANDS, GenArea( "Confused_raw", "Unrecognizable symptoms" ) ); push( @RRD_COMMANDS, GenArea( "WebFilter_raw", "Browser filter blocked test" ) ); push( @RRD_COMMANDS, "COMMENT: \\l" ); push( @RRD_COMMANDS, "COMMENT: This is a 'stacked' graph; the top of the graph indicates test volume\\l" ); push( @RRD_COMMANDS, "COMMENT: Graph is courtesy of http\\://$domain\\l" ); GenImage( $filename, @RRD_BASE_OPTS, @RRD_EXTRA_OPTS, @RRD_BASE_DEFS, @RRD_COMMANDS ); } ## end sub _generate_summary_area sub _generate_summary_line { my ( $filename, $days ) = @_; my $start = $midnight - $days * 86400; my $stop = $midnight - 86400; my $domain = $MirrorConfig->{"site"}{"name"}; my @RRD_EXTRA_OPTS = ( "-s", $start, "-e", $stop ); my @RRD_COMMANDS; push( @RRD_EXTRA_OPTS, "--title", "Summary of test results / $domain" ); push( @RRD_EXTRA_OPTS, "--vertical-label", "Per day" ); push( @RRD_COMMANDS, time_range( $start, $stop ) ); push( @RRD_COMMANDS, "COMMENT:Minimum Average Maximum\\r" ); push( @RRD_COMMANDS, "LINE:Zero#000000" ); push( @RRD_COMMANDS, GenLine( "IPv4_raw", "IPv4 only" ) ); push( @RRD_COMMANDS, GenLine( "Dual_Stack_pref_IPv4", "IPv4 and IPv6 (prefer IPv4)" ) ) ; # Not using "raw" for this one push( @RRD_COMMANDS, GenLine( "Dual_Stack_pref_IPv6", "IPv4 and IPv6 (prefer IPv6)" ) ) ; # Not using "raw" for this one push( @RRD_COMMANDS, GenLine( "IPv6_raw", "IPv6 only" ) ); push( @RRD_COMMANDS, GenLine( "Broken_raw", "Detected Broken DS" ) ); push( @RRD_COMMANDS, GenLine( "Confused_raw", "Unrecognizable symptoms" ) ); push( @RRD_COMMANDS, GenLine( "WebFilter_raw", "Browser filter blocked test" ) ); push( @RRD_COMMANDS, "COMMENT: \\l" ); push( @RRD_COMMANDS, "COMMENT: Graph is courtesy of http\\://$domain\\l" ); GenImage( $filename, @RRD_BASE_OPTS, @RRD_EXTRA_OPTS, @RRD_BASE_DEFS, @RRD_COMMANDS ); } ## end sub _generate_summary_line sub _generate_summary_pct { my ( $filename, $days ) = @_; my $start = $midnight - $days * 86400; my $stop = $midnight - 86400; my $domain = $MirrorConfig->{"site"}{"name"}; my @RRD_EXTRA_OPTS = ( "-s", $start, "-e", $stop, "--upper-limit", 100, "--lower-limit", 0, "--rigid" ); my @RRD_COMMANDS; push( @RRD_EXTRA_OPTS, "--title", "Summary of test results / $domain" ); push( @RRD_EXTRA_OPTS, "--vertical-label", "Per day" ); push( @RRD_COMMANDS, time_range( $start, $stop ) ); push( @RRD_COMMANDS, "COMMENT:Minimum Average Maximum\\r" ); push( @RRD_COMMANDS, "LINE:Zero#000000" ); push( @RRD_COMMANDS, GenArea( "IPv4_pct", "IPv4 only" ) ); push( @RRD_COMMANDS, GenArea( "Dual_Stack_pref_IPv4_pct", "IPv4 and IPv6 (prefer IPv4)" ) ) ; # Not using "raw" for this one push( @RRD_COMMANDS, GenArea( "Dual_Stack_pref_IPv6_pct", "IPv4 and IPv6 (prefer IPv6)" ) ) ; # Not using "raw" for this one push( @RRD_COMMANDS, GenArea( "Broken_pct", "Detected Broken DS" ) ); push( @RRD_COMMANDS, GenArea( "Confused_pct", "Unrecognizable symptoms" ) ); push( @RRD_COMMANDS, GenArea( "WebFilter_pct", "Browser filter blocked test" ) ); push( @RRD_COMMANDS, "COMMENT: \\l" ); push( @RRD_COMMANDS, "COMMENT: This graph shows relative percentages of the total daily traffic\\l" ); push( @RRD_COMMANDS, "COMMENT: Graph is courtesy of http\\://$domain\\l" ); GenImage( $filename, @RRD_BASE_OPTS, @RRD_EXTRA_OPTS, @RRD_BASE_DEFS, @RRD_COMMANDS ); } ## end sub _generate_summary_pct sub _generate_broken_pct { my ( $filename, $days ) = @_; my $start = $midnight - $days * 86400; my $stop = $midnight - 86400; my $domain = $MirrorConfig->{"site"}{"name"}; my @RRD_EXTRA_OPTS = ( "-s", $start, "-e", $stop ); my @RRD_COMMANDS; push( @RRD_EXTRA_OPTS, "--title", "Broken users as percentage of all tested / $domain" ); push( @RRD_EXTRA_OPTS, "--vertical-label", "Per day" ); push( @RRD_COMMANDS, time_range( $start, $stop ) ); push( @RRD_COMMANDS, "COMMENT:Minimum Average Maximum\\r" ); push( @RRD_COMMANDS, "LINE:Zero#000000" ); push( @RRD_COMMANDS, GenArea( "Broken_pct", "Detected Broken (pct)" ) ); push( @RRD_COMMANDS, "COMMENT: \\l" ); push( @RRD_COMMANDS, "COMMENT: Broken means browser times out trying to reach an IPv4+IPv6 site\\l" ); push( @RRD_COMMANDS, "COMMENT: Graph is courtesy of http\\://$domain\\l" ); GenImage( $filename, @RRD_BASE_OPTS, @RRD_EXTRA_OPTS, @RRD_BASE_DEFS, @RRD_COMMANDS ); } ## end sub _generate_broken_pct ################################################################ # main # ################################################################ $midnight = int( time / 86400 ) * 86400; $MirrorConfig = get_config( $argv{"config"}, "MirrorConfig" ); $PrivateConfig = get_config( $argv{"private"}, "PrivateConfig" ); validate_private_config($PrivateConfig); $dbh = get_db_handle( $PrivateConfig->{db} ); update_daily_summary( $argv{"rescan"} ); update_monthly_summary( $argv{"rescan"} ); generate_rrd_db(600); base_setup(); gen_graphs( 60, 600 );
falling-sky/extras
falling-sky-chart.pl
Perl
mit
25,948
#!/usr/bin/perl $n = <STDIN>; chomp $n; $arr_temp = <STDIN>; @arr = split / /,$arr_temp; chomp @arr; $r = pickupPlusMinus(@arr); printf("%.6f\n%.6f\n%.6f\n",$r->[2],$r->[1],$r->[0]); sub pickupPlusMinus{ my @a=@_; my $r=[0,0,0]; foreach my $i(@a){ if ($i<0){ $r->[1]++; }elsif ($i>0){ $r->[2]++; }else{ $r->[0]++; } } $r->[0]=$r->[0]/scalar(@a); $r->[1]=$r->[1]/scalar(@a); $r->[2]=$r->[2]/scalar(@a); return $r; }
MarsBighead/mustang
Perl/plus-minus.pl
Perl
mit
494
#!/usr/bin/env perl use strict; use warnings; use Getopt::Long; use Data::Dumper; use Bio::KBase::KBaseTrees::Client; use Bio::KBase::KBaseTrees::Util qw(get_tree_client); my $DESCRIPTION = " NAME tree-find-tree-ids -- search KBase for the tree IDs that match the input options SYNOPSIS tree-find-tree-ids [OPTIONS] [FEATURE_ID|PROTEIN_ID|SOURCE_ID_PATTERN] DESCRIPTION This method retrieves a list of trees that match the provided options. If a feature ID is provided, all trees that are built from protein sequences of the feature are returned. If a protein ID is provided, then all trees that are built from the exact sequence is returned. If a source id pattern is provided, then all trees with a source ID that match the pattern is returned. Note that source IDs are generally defined by the gene family model which was used to identifiy the sequences to be included in the tree. Therefore, matching a source ID is a convenient way to find trees for a specific set of gene families. By default, if the type of argument is not specified with one of the options below, then this method assumes that the input is feature IDs. If an ID is to be passed in as an argument, then only a single ID or pattern can be used. If you wish to call this method on multiple feature/sequence IDs, then you must pass in the list through standard-in or a text file, with one ID per line. -f, --feature indicate that the IDs provided are feature IDs; matches of feature IDs are exact -p, --protein-sequence indicate that the IDs provided are protein_sequence_ids (MD5s); matches of protein sequence IDs are exact -s, --source-id-pattern Indicate that the input is a pattern used to match the source-id field of the Tree entity. The pattern is very simple and includes only two special characters, wildcard character, '*', and a match-once character, '.' The wildcard character matches any number (including 0) of any character, the '.' matches exactly one of any character. These special characters can be escaped with a backslash. To match a blackslash literally, you must also escape it. When the source-id-pattern option is provided, then this method returns a two column list, where the first column is the tree ID, and the second column is the source-id that was matched. Note that source IDs are generally defined by the gene family model which was used to identifiy the sequences to be included in the tree. Therefore, matching a source ID is a convenient way to find trees for a specific set of gene families. -i, --input specify input file to read from; each id or pattern must be on a separate line in this file --url [URL] set the KBaseTrees service url (optional) -h, --help diplay this help message, ignore all arguments EXAMPLES Retrieve tree ids based on a feature id > tree-find-tree-ids -f 'kb|g.0.peg.2173' Retrieve tree ids based on a set of protein_sequence_ids piped through standard in > echo cf9e9e74e06748fb161d07c8420e1097 | tree-find-tree-ids -p Retrieve tree ids based on a pattern used to match the source-id field > tree-find-tree-ids -s '*COG.11' Get the number of leaf nodes for trees with a source id field in the range COG10-COG11. First, we find tree ids, extract out only the tree IDs using 'cut', then pipe the results to 'tree-get-tree' to get meta information about each tree, and grep to extract the results we want. > tree-find-tree-ids -s 'COG1.' | cut -f 1 | \ tree-get-tree -m | grep 'tree_id\|source_id\|leaf_count' AUTHORS Michael Sneddon (mwsneddon\@lbl.gov) Matt Henderson (mhenderson\@lbl.gov) "; # declare variables that come from user input my $help = ''; my $usingFeature = ""; my $usingSequence = ""; my $inputFile = ""; my $usingFamily = ""; my $showSourceId = ""; my $treeurl; # first parse command line options my $opt = GetOptions ( "help" => \$help, "feature" => \$usingFeature, "protein-sequence" => \$usingSequence, "source-id-pattern" => \$usingFamily, "input=s" => \$inputFile, "url=s" => \$treeurl ); if ($help) { print $DESCRIPTION; exit 0; } my $n_args = $#ARGV + 1; my $id_list=[]; # if we have specified an input file, then read the file if($inputFile) { my $inputFileHandle; open($inputFileHandle, "<", $inputFile); if(!$inputFileHandle) { print "FAILURE - cannot open '$inputFile' \n$!\n"; exit 1; } eval { while (my $line = <$inputFileHandle>) { chomp($line); push @$id_list,$line; } close $inputFileHandle; }; } # if we have a single argument, then accept it as the treeString elsif($n_args==1) { my $id = $ARGV[0]; chomp($id); push @$id_list,$id; } # if we have no arguments, then read the tree from standard-in elsif($n_args == 0) { while(my $line = <STDIN>) { chomp($line); push @$id_list,$line; } } else { print "Invalid number of arguments. Run with --help for usage.\n"; exit 1; } #create client my $treeClient; eval{ $treeClient = get_tree_client($treeurl); }; my $client_error = $@; if ($client_error) { print Dumper($client_error); print "FAILURE - unable to create tree service client. Is you tree URL correct? see tree-url.\n"; exit 1; } # if we have some ids, we can continue; if(scalar(@$id_list)>0) { if($usingFamily) { foreach my $pattern (@$id_list) { my $tree_ids; eval { $tree_ids = $treeClient->get_tree_ids_by_source_id_pattern($pattern); }; $client_error = $@; if ($client_error) { print Dumper($client_error); print "FAILURE - error calling Tree service.\n"; exit 1; } foreach my $t (@$tree_ids) { print $t->[0]."\t".$t->[1]."\n"; } } } elsif($usingSequence) { my $tree_ids; eval { $tree_ids = $treeClient->get_tree_ids_by_protein_sequence($id_list); }; $client_error = $@; if ($client_error) { print Dumper($client_error); print "FAILURE - error calling Tree service.\n"; exit 1; } foreach my $t (@$tree_ids) { print $t."\n"; } } else { my $tree_ids; eval { $tree_ids = $treeClient->get_tree_ids_by_feature($id_list); }; $client_error = $@; if ($client_error) { print Dumper($client_error); print "FAILURE - error calling Tree service.\n"; exit 1; } foreach my $t (@$tree_ids) { print $t."\n"; } } exit 0; } else { print "FAILURE - no ids provided. Run with --help for usage.\n"; exit 1; }
kbase/trees
scripts/tree-find-tree-ids.pl
Perl
mit
7,823
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use lib qw(..); use JSON qw( ); use GD; print "file: $ARGV[0]\n"; print "x: $ARGV[1]\n"; print "y: $ARGV[2]\n"; print "width: $ARGV[3]\n"; print "height: $ARGV[4]\n"; print "url: $ARGV[5]\n"; print "name: $ARGV[6]\n"; print "counter id: $ARGV[7]\n"; #open (my $dir, "<", "directory.json") || die "file not found"; #my $directory = <$dir>; #close ($dir); my $json_text = do { open(my $json_fh, "<:encoding(UTF-8)", "directory.json") or die("Can't open \$filename\": $!\n"); local $/; <$json_fh> }; my $json = JSON->new; my $data = $json->decode($json_text); print $json->encode($data); print "\n"; my $fields = $json->encode( $data->{fields} ); my @data2 = $json->decode($fields); my $urg = pop( @data2 ); my $last = pop( $urg ); push( $urg, $last ); my $usuallyBlankH = ""; my $usuallyBlankV = ""; if ( $ARGV[1] < 10 ) { $usuallyBlankH = "0"; } if ( $ARGV[2] < 10 ) { $usuallyBlankV = "0"; } my $wantadd = { xy => $usuallyBlankH . $ARGV[1] . $usuallyBlankV . $ARGV[2], width => $ARGV[3], height => $ARGV[4], url => $ARGV[5], name => $ARGV[6], counter => $ARGV[7], hits => 1, tare => 1, time => time, }; my $dupe; for my $record (@$urg ) { my $isMatch = 0; for my $key (keys(%$record )) { my $val = $record->{$key}; # print "XX:\n"; # print $key; # print " .. "; # print $val; # print "\n"; my $xy = $usuallyBlankH . $ARGV[1] . $usuallyBlankV . $ARGV[2]; print $xy; if ( $key eq "xy" && $val eq $xy ) { $isMatch = 1; # print "MATCHa\n"; } } if ( $isMatch == 0 ) { push( @$dupe, $record ); } } push( @$dupe, $wantadd ); push( @data2, $dupe ); my $fleshedout = { fields => @data2 }; print $json->encode($fleshedout)."\n"; print "\n\n"; open my $fh, ">", "directory.json"; print $fh $json->encode($fleshedout); close $fh; print "\n"; my $srcImage = GD::Image->newFromPng($ARGV[0],1); for (my $i=0; $i < $ARGV[3]; $i++ ) { for (my $j=0; $j < $ARGV[4]; $j++ ) { my $myImage = GD::Image->new(10,10,1); $myImage->copy($srcImage,0,0,10*$i,10*$j,10,10); my $pngData = $myImage->png; my $firstterm = $ARGV[1] + $i; my $secondterm = $ARGV[2] + $j; if ( $firstterm < 10 ) { $firstterm = "0" . $firstterm; } if ( $secondterm < 10 ) { $secondterm = "0" . $secondterm; } my $outname = "images/" . $firstterm . $secondterm . ".png"; open (PICTURE, ">", $outname); binmode PICTURE; print PICTURE $myImage->png; # print $outx $myImage->png; close PICTURE; } } system "git add ."; system "git commit * -m \"AUTO: Replaced Graphic\""; system "git push";
mdapp/mdapp.github.io
replace.pl
Perl
mit
2,642
use MooseX::Declare; class Test::File::Tools extends File::Tools { use Data::Dumper; use Test::More; # Ints has 'workflowpid' => ( isa => 'Int|Undef', is => 'rw', required => 0 ); has 'workflownumber'=> ( isa => 'Str', is => 'rw' ); has 'start' => ( isa => 'Int', is => 'rw' ); has 'submit' => ( isa => 'Int', is => 'rw' ); # Strings has 'fileroot' => ( isa => 'Str|Undef', is => 'rw', default => '' ); has 'qstat' => ( isa => 'Str|Undef', is => 'rw', default => '' ); has 'queue' => ( isa => 'Str|Undef', is => 'rw', default => 'default' ); has 'cluster' => ( isa => 'Str|Undef', is => 'rw' ); has 'username' => ( isa => 'Str', is => 'rw' ); has 'workflow' => ( isa => 'Str', is => 'rw' ); has 'project' => ( isa => 'Str', is => 'rw' ); # Objects has 'json' => ( isa => 'HashRef', is => 'rw', required => 0 ); has 'db' => ( isa => 'Agua::DBase::MySQL', is => 'rw', required => 0 ); has 'stages' => ( isa => 'ArrayRef', is => 'rw', required => 0 ); has 'stageobjects' => ( isa => 'ArrayRef', is => 'rw', required => 0 ); has 'monitor' => ( isa => 'Maybe|Undef', is => 'rw', required => 0 ); has 'conf' => ( is => 'rw', 'isa' => 'Conf::Yaml', default => sub { Conf::Yaml->new( backup => 1 ); } ); method BUILD ($hash) { $self->initialise(); } method initialise () { my $logfile = $self->logfile(); $self->logDebug("logfile", $logfile); $self->conf()->logfile($logfile); } method testSetMonitor { $self->logDebug(""); $self->logDebug("self->conf", $self->conf()); my $clustertype = $self->conf()->getKey('agua', 'CLUSTERTYPE'); my $classfile = "Agua/Monitor/" . uc($clustertype) . ".pm"; my $module = "Agua::Monitor::$clustertype"; $self->logDebug("Doing require $classfile"); require $classfile; my $monitor = $module->new( { 'pid' => $$, 'conf' => $self->conf(), 'db' => $self->db() } ); return $monitor; } } #### Test::Agua::File::Tools
aguadev/aguadev
t/unit/lib/Test/Monitor/Tools.pm
Perl
mit
1,921
package Fsq2mixi::Controller::Docs; use utf8; use Mojo::Base 'Mojolicious::Controller'; sub about { my $self = shift; $self->render(); } sub privacy { my $self = shift; $self->render(); } 1;
mugifly/Fsq2mixi
lib/Fsq2mixi/Controller/Docs.pm
Perl
mit
197
package App::KADR::AniDB::Content::File; # ABSTRACT: AniDB's file information use App::KADR::AniDB::Content; use aliased 'App::KADR::AniDB::EpisodeNumber'; use constant { STATUS_CRCOK => 0x01, STATUS_CRCERR => 0x02, STATUS_ISV2 => 0x04, STATUS_ISV3 => 0x08, STATUS_ISV4 => 0x10, STATUS_ISV5 => 0x20, STATUS_UNC => 0x40, STATUS_CEN => 0x80, }; field [qw(fid aid eid gid)]; field 'lid', isa => MaybeID, coerce => 1; field [qw( other_episodes is_deprecated status size ed2k md5 sha1 crc32 quality source audio_codec audio_bitrate video_codec video_bitrate video_resolution file_type dub_language sub_language length description air_date )]; field 'episode_number', isa => EpisodeNumber; field [qw( episode_english_name episode_romaji_name episode_kanji_name episode_rating episode_vote_count group_name group_short_name )]; refer anime => 'aid'; refer anime_mylist => 'aid', client_method => 'mylist_anime'; refer group => 'gid'; refer mylist => [ 'lid', 'fid' ], client_method => 'mylist_file'; sub crc_is_checked { my $status = $_[0]->status; !(($status & STATUS_CRCOK) || ($status & STATUS_CRCERR)); } sub crc_is_bad { $_[0]->status & STATUS_CRCERR } sub crc_is_ok { $_[0]->status & STATUS_CRCOK } for ( [ is_unlocated => 'eps_with_state_unknown' ], [ is_on_hdd => 'eps_with_state_on_hdd' ], [ is_on_cd => 'eps_with_state_on_cd' ], [ is_deleted => 'eps_with_state_deleted' ], [ watched => 'watched_eps' ], ) { my ($suffix, $mylist_attr) = @$_; __PACKAGE__->meta->add_method("episode_$suffix", method { # Note: Mylist anime data is broken server-side, # only the min is provided. return unless my $ml = $self->anime_mylist; $self->episode_number->in_ignore_max($ml->$mylist_attr); }); } method episode_number_padded { my $anime = $self->anime; my $epcount = $anime->episode_count || $anime->highest_episode_number; $self->episode_number->padded({ '' => length $epcount }); } method episode_english_name_trimmed { my $name = $self->episode_english_name; $name =~ s/(.{0,50}).*/$1/; $name =~ s/[\?]//; $name } sub is_censored { $_[0]->status & STATUS_CEN } sub is_uncensored { $_[0]->status & STATUS_UNC } method is_primary_episode { my $anime = $self->anime; # This is the only episode. $anime->episode_count == 1 && $self->episode_number eq 1 # And this file contains the entire episode. # XXX: Handle files that span all episodes. && !$self->other_episodes # And it has a generic episode name. # Usually equal to the anime_type except for movies where multiple # episodes may exist for split releases. && do { my $epname = $self->episode_english_name; $epname eq $anime->type || $epname eq 'Complete Movie'; }; } sub parse { my $file = shift->App::KADR::AniDB::Role::Content::parse(@_); # XXX: Do this properly somewhere. $file->{video_codec} =~ s/H264\/AVC/H.264/g; $file->{audio_codec} =~ s/Vorbis \(Ogg Vorbis\)/Vorbis/g; $file->{video_codec} =~ s/\//_/g; $file->{episode_english_name} =~ s/\//_/g; $file; } sub version { my $status = $_[0]->status; $status & STATUS_ISV2 ? 2 : $status & STATUS_ISV3 ? 3 : $status & STATUS_ISV4 ? 4 : $status & STATUS_ISV5 ? 5 : 1; } =head1 METHODS =head2 C<crc_is_bad> Check if the CRC32 does not match the official source. =head2 C<crc_is_checked> Check if the CRC32 has been checked against the official source. =head2 C<crc_is_ok> Check if the CRC32 matches the official source. =head2 C<episode_is_deleted> Check if this file's episodes are deleted. =head2 C<episode_is_external> Check if this file's episodes are on external storage (CD, USB memory, etc). =head2 C<episode_is_internal> Check if this file's episodes are on internal storage (HDD, SSD, etc). =head2 C<episode_watched> Check if this file's episodes are watched. =head2 C<episode_is_unlocated> Check if this file's episodes' storage is unknown. =head2 C<episode_number_padded> File's episode number, with the numbers of normal episodes padded to match length with the last episode. =head2 C<is_censored> Check if this file is censored. =head2 C<is_primary_episode> Check if this is the primary episode of the anime. An entire movie, or one-shot OVA, for example. =head2 C<is_uncensored> Check if this episode was originally censored, but had decensoring applied. =head2 C<version> File version number. =head1 REFERENCES =head2 C<anime> =head2 C<anime_mylist> =head2 C<group> =head2 C<mylist> =head1 SEE ALSO L<http://wiki.anidb.info/w/UDP_API_Definition>
privatesmith/KADR
lib/App/KADR/AniDB/Content/File.pm
Perl
mit
4,560
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! # This file is machine-generated by lib/unicore/mktables from the Unicode # database, Version 12.1.0. Any changes made here will be lost! # !!!!!!! INTERNAL PERL USE ONLY !!!!!!! # This file is for internal use by core Perl only. The format and even the # name or existence of this file are subject to change without notice. Don't # use it directly. Use Unicode::UCD to access the Unicode character data # base. return <<'END'; V798 44032 44033 44060 44061 44088 44089 44116 44117 44144 44145 44172 44173 44200 44201 44228 44229 44256 44257 44284 44285 44312 44313 44340 44341 44368 44369 44396 44397 44424 44425 44452 44453 44480 44481 44508 44509 44536 44537 44564 44565 44592 44593 44620 44621 44648 44649 44676 44677 44704 44705 44732 44733 44760 44761 44788 44789 44816 44817 44844 44845 44872 44873 44900 44901 44928 44929 44956 44957 44984 44985 45012 45013 45040 45041 45068 45069 45096 45097 45124 45125 45152 45153 45180 45181 45208 45209 45236 45237 45264 45265 45292 45293 45320 45321 45348 45349 45376 45377 45404 45405 45432 45433 45460 45461 45488 45489 45516 45517 45544 45545 45572 45573 45600 45601 45628 45629 45656 45657 45684 45685 45712 45713 45740 45741 45768 45769 45796 45797 45824 45825 45852 45853 45880 45881 45908 45909 45936 45937 45964 45965 45992 45993 46020 46021 46048 46049 46076 46077 46104 46105 46132 46133 46160 46161 46188 46189 46216 46217 46244 46245 46272 46273 46300 46301 46328 46329 46356 46357 46384 46385 46412 46413 46440 46441 46468 46469 46496 46497 46524 46525 46552 46553 46580 46581 46608 46609 46636 46637 46664 46665 46692 46693 46720 46721 46748 46749 46776 46777 46804 46805 46832 46833 46860 46861 46888 46889 46916 46917 46944 46945 46972 46973 47000 47001 47028 47029 47056 47057 47084 47085 47112 47113 47140 47141 47168 47169 47196 47197 47224 47225 47252 47253 47280 47281 47308 47309 47336 47337 47364 47365 47392 47393 47420 47421 47448 47449 47476 47477 47504 47505 47532 47533 47560 47561 47588 47589 47616 47617 47644 47645 47672 47673 47700 47701 47728 47729 47756 47757 47784 47785 47812 47813 47840 47841 47868 47869 47896 47897 47924 47925 47952 47953 47980 47981 48008 48009 48036 48037 48064 48065 48092 48093 48120 48121 48148 48149 48176 48177 48204 48205 48232 48233 48260 48261 48288 48289 48316 48317 48344 48345 48372 48373 48400 48401 48428 48429 48456 48457 48484 48485 48512 48513 48540 48541 48568 48569 48596 48597 48624 48625 48652 48653 48680 48681 48708 48709 48736 48737 48764 48765 48792 48793 48820 48821 48848 48849 48876 48877 48904 48905 48932 48933 48960 48961 48988 48989 49016 49017 49044 49045 49072 49073 49100 49101 49128 49129 49156 49157 49184 49185 49212 49213 49240 49241 49268 49269 49296 49297 49324 49325 49352 49353 49380 49381 49408 49409 49436 49437 49464 49465 49492 49493 49520 49521 49548 49549 49576 49577 49604 49605 49632 49633 49660 49661 49688 49689 49716 49717 49744 49745 49772 49773 49800 49801 49828 49829 49856 49857 49884 49885 49912 49913 49940 49941 49968 49969 49996 49997 50024 50025 50052 50053 50080 50081 50108 50109 50136 50137 50164 50165 50192 50193 50220 50221 50248 50249 50276 50277 50304 50305 50332 50333 50360 50361 50388 50389 50416 50417 50444 50445 50472 50473 50500 50501 50528 50529 50556 50557 50584 50585 50612 50613 50640 50641 50668 50669 50696 50697 50724 50725 50752 50753 50780 50781 50808 50809 50836 50837 50864 50865 50892 50893 50920 50921 50948 50949 50976 50977 51004 51005 51032 51033 51060 51061 51088 51089 51116 51117 51144 51145 51172 51173 51200 51201 51228 51229 51256 51257 51284 51285 51312 51313 51340 51341 51368 51369 51396 51397 51424 51425 51452 51453 51480 51481 51508 51509 51536 51537 51564 51565 51592 51593 51620 51621 51648 51649 51676 51677 51704 51705 51732 51733 51760 51761 51788 51789 51816 51817 51844 51845 51872 51873 51900 51901 51928 51929 51956 51957 51984 51985 52012 52013 52040 52041 52068 52069 52096 52097 52124 52125 52152 52153 52180 52181 52208 52209 52236 52237 52264 52265 52292 52293 52320 52321 52348 52349 52376 52377 52404 52405 52432 52433 52460 52461 52488 52489 52516 52517 52544 52545 52572 52573 52600 52601 52628 52629 52656 52657 52684 52685 52712 52713 52740 52741 52768 52769 52796 52797 52824 52825 52852 52853 52880 52881 52908 52909 52936 52937 52964 52965 52992 52993 53020 53021 53048 53049 53076 53077 53104 53105 53132 53133 53160 53161 53188 53189 53216 53217 53244 53245 53272 53273 53300 53301 53328 53329 53356 53357 53384 53385 53412 53413 53440 53441 53468 53469 53496 53497 53524 53525 53552 53553 53580 53581 53608 53609 53636 53637 53664 53665 53692 53693 53720 53721 53748 53749 53776 53777 53804 53805 53832 53833 53860 53861 53888 53889 53916 53917 53944 53945 53972 53973 54000 54001 54028 54029 54056 54057 54084 54085 54112 54113 54140 54141 54168 54169 54196 54197 54224 54225 54252 54253 54280 54281 54308 54309 54336 54337 54364 54365 54392 54393 54420 54421 54448 54449 54476 54477 54504 54505 54532 54533 54560 54561 54588 54589 54616 54617 54644 54645 54672 54673 54700 54701 54728 54729 54756 54757 54784 54785 54812 54813 54840 54841 54868 54869 54896 54897 54924 54925 54952 54953 54980 54981 55008 55009 55036 55037 55064 55065 55092 55093 55120 55121 55148 55149 55176 55177 END
operepo/ope
client_tools/svc/rc/usr/share/perl5/core_perl/unicore/lib/GCB/LV.pl
Perl
mit
5,280
# Adds an extended command to show the time since the last prayer and a rough # estimate of prayer safety. # The plugin notes crowning, but also provides an extended command to toggle # crowning manually. # This only really works when InterHack has seen your last prayer # # joc my $praytime = 0; my $crowned = 0; my $law_crown = "I crown thee... The Hand of Elbereth!"; my $neu_crown = "Thou shalt be my Envoy of Balance!"; my $cha_crown = "Thou art chosen to (?:take lives)|(?:steal souls) for My Glory!"; each_match "You begin praying to" => sub { $praytime = $turncount; }; each_match qr/$law_crown|$neu_crown|$cha_crown/ => sub { $crowned = 1; }; extended_command "crown" => sub { $crowned = !$crowned; "Crowned now " . ($crowned ? "ON" : "OFF") }; extended_command "praytime" => sub { my $timeout = $turncount - $praytime; my $confidence_threshold = $crowned ? 3980 : 1229; my $safe_msg = "$colormap{green} 95% safe assuming normal timeout\e[0m"; my $unsafe_msg = "$colormap{brown} confidence < 95%\e[0m"; my $response = "The last prayer was $timeout turns ago."; if ($timeout >= $confidence_threshold) { $response .= $safe_msg; } else { $response .= $unsafe_msg; } return $response }
TAEB/Interhack
plugins/praytime.pl
Perl
mit
1,238
#diff two files and returns an boolean result package Diff; use warnings; use strict; our $version = 1; ############################################################# sub diff{ my($class, $file1, $file2) = @_; my $output = $class->fullDiff($file1, $file2); $output ne ""; #files are different } ############################################################# sub fullDiff{ my($class, $file1, $file2) = @_; open(DIFF, "/usr/bin/diff $file1 $file2 |") or die("Cant run diff for $file1 & $file2 : $!"); my $output = ""; while(my $line = <DIFF>){ $output .= $line; } close(DIFF); return $output; } ############################################################################### 1;
thedumbterminal/ServerSetup
lib/Diff.pm
Perl
mit
686
#!env perl use strict; use warnings; my $annot = '../../annotation/Hw2.maker_genes.functional.gff3.gz'; my $clusters = '7clustered_FPKM_compiled.tsv.gz'; open(my $fh => "zcat $annot |") || die $!; my %genes; while(<$fh>) { next if /^\#/; chomp; my @row = split(/\t/,$_); my %grp = map { split(/=/,$_) } split (/;/,pop @row); if( $row[2] eq 'gene' ) { $genes{$grp{'ID'}} = [ $row[0],(sort { $a<=>$b} ($row[3],$row[4])), $row[6] ]; } } open($fh => "zcat $clusters |") || die "cannot open $clusters: $!"; my %clusters; while(<$fh>) { next if /^\#/; chomp; my ($gene,$clusterid,$altid,$desc,$rna_0,$rna_10,$rna_20) = split(/\t/,$_); push @{ $clusters{$clusterid} }, [$gene,$desc,$rna_0,$rna_10,$rna_20]; } for my $cluster ( keys %clusters ) { open(my $ofh => ">CLUSTER$cluster.locs.dat") || die $!; my @cluster_set; for my $genecl ( @{$clusters{$cluster}} ) { # maybe re-sort this by chromosome? my ($geneid,$genedesc,$rna0,$rna10,$rna20) = @$genecl; push @cluster_set, [ $geneid,@{$genes{$geneid}}, $rna0,$rna10,$rna20,$genedesc]; } print $ofh "#",join("\t", qw(GENEID CHROM START END STRAND RPKM0 RPKM10 RPKM20 GENEDESC)),"\n"; for my $genedat ( sort { $a->[1] cmp $b->[1] || $a->[2] <=> $b->[2] } @cluster_set) { print $ofh join("\t", @$genedat), "\n"; } }
stajichlab/Hortaea_werneckii
Nucleosome/Clustered/clusters2genelocations.pl
Perl
cc0-1.0
1,355
=head1 LICENSE Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =cut package Bio::EnsEMBL::Variation::RegulatoryFeatureVariation; use strict; use warnings; use Bio::EnsEMBL::Variation::RegulatoryFeatureVariationAllele; use Bio::EnsEMBL::Variation::Utils::VariationEffect qw(overlap); use base qw(Bio::EnsEMBL::Variation::RegulationVariation); sub new { my $class = shift; my %args = @_; # swap a '-regulatory_feature' argument for a '-feature' one for the superclass for my $arg (keys %args) { if (lc($arg) eq '-regulatory_feature') { $args{'-feature'} = delete $args{$arg}; } } # call the superclass constructor my $self = $class->SUPER::new(%args) || return undef; # rebless the alleles from vfoas to rfvas map { bless $_, 'Bio::EnsEMBL::Variation::RegulatoryFeatureVariationAllele' } @{ $self->get_all_RegulatoryFeatureVariationAlleles }; return $self; } sub regulatory_feature_stable_id { my $self = shift; return $self->SUPER::_feature_stable_id(@_); } sub regulatory_feature { my ($self, $rf) = @_; return $self->SUPER::feature($rf, 'RegulatoryFeature'); } sub add_RegulatoryFeatureVariationAllele { my $self = shift; return $self->SUPER::add_VariationFeatureOverlapAllele(@_); } sub get_reference_RegulatoryFeatureVariationAllele { my $self = shift; return $self->SUPER::get_reference_VariationFeatureOverlapAllele(@_); } sub get_all_alternate_RegulatoryFeatureVariationAlleles { my $self = shift; return $self->SUPER::get_all_alternate_VariationFeatureOverlapAlleles(@_); } sub get_all_RegulatoryFeatureVariationAlleles { my $self = shift; return $self->SUPER::get_all_VariationFeatureOverlapAlleles(@_); } 1;
dbolser-ebi/ensembl-variation
modules/Bio/EnsEMBL/Variation/RegulatoryFeatureVariation.pm
Perl
apache-2.0
2,600
# # Copyright 2019 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package cloud::aws::s3::plugin; use strict; use warnings; use base qw(centreon::plugins::script_custom); sub new { my ( $class, %options ) = @_; my $self = $class->SUPER::new( package => __PACKAGE__, %options ); bless $self, $class; $self->{version} = '0.1'; %{ $self->{modes} } = ( 'bucket-size' => 'cloud::aws::s3::mode::bucketsize', 'objects' => 'cloud::aws::s3::mode::objects', 'requests' => 'cloud::aws::s3::mode::requests', ); $self->{custom_modes}{paws} = 'cloud::aws::custom::paws'; $self->{custom_modes}{awscli} = 'cloud::aws::custom::awscli'; return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check Amazon Simple Storage Service (Amazon S3). =cut
Sims24/centreon-plugins
cloud/aws/s3/plugin.pm
Perl
apache-2.0
1,538
# # Copyright 2018 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package database::oracle::mode::datacachehitratio; use base qw(centreon::plugins::mode); use strict; use warnings; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '1.0'; $options{options}->add_options(arguments => { "warning:s" => { name => 'warning', }, "critical:s" => { name => 'critical', }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); $self->{output}->option_exit(); } } sub run { my ($self, %options) = @_; # $options{sql} = sqlmode object $self->{sql} = $options{sql}; $self->{sql}->connect(); $self->{sql}->query(query => q{ SELECT SUM(DECODE(name, 'physical reads', value, 0)), SUM(DECODE(name, 'physical reads direct', value, 0)), SUM(DECODE(name, 'physical reads direct (lob)', value, 0)), SUM(DECODE(name, 'session logical reads', value, 0)) FROM sys.v_$sysstat }); my $result = $self->{sql}->fetchall_arrayref(); my $physical_reads = @$result[0]->[0]; my $physical_reads_direct = @$result[0]->[1]; my $physical_reads_direct_lob = @$result[0]->[2]; my $session_logical_reads = @$result[0]->[3]; my $hitratio = 100 - 100 * (($physical_reads - $physical_reads_direct - $physical_reads_direct_lob) / $session_logical_reads); my $exit_code = $self->{perfdata}->threshold_check(value => $hitratio, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); $self->{output}->output_add(severity => $exit_code, short_msg => sprintf("Buffer cache hit ratio is %.2f%%", $hitratio)); $self->{output}->perfdata_add(label => 'sga_data_buffer_hit_ratio', value => sprintf("%d",$hitratio), unit => '%', warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), min => 0, max => 100); $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check Oracle buffer cache hit ratio. =over 8 =item B<--warning> Threshold warning. =item B<--critical> Threshold critical. =back =cut
wilfriedcomte/centreon-plugins
database/oracle/mode/datacachehitratio.pm
Perl
apache-2.0
4,003
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package network::f5::bigip::snmp::mode::listvirtualservers; use base qw(centreon::plugins::mode); use strict; use warnings; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $options{options}->add_options(arguments => { 'filter-name:s' => { name => 'filter_name' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); } my %map_vs_status = ( 0 => 'none', 1 => 'green', 2 => 'yellow', 3 => 'red', 4 => 'blue', # unknown 5 => 'gray', ); my %map_vs_enabled = ( 0 => 'none', 1 => 'enabled', 2 => 'disabled', 3 => 'disabledbyparent', ); my $mapping = { new => { AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.10.13.2.1.2', map => \%map_vs_status }, EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.10.13.2.1.3', map => \%map_vs_enabled }, }, old => { AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.10.1.2.1.22', map => \%map_vs_status }, EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.10.1.2.1.23', map => \%map_vs_enabled }, }, }; my $oid_ltmVsStatusEntry = '.1.3.6.1.4.1.3375.2.2.10.13.2.1'; # new my $oid_ltmVirtualServEntry = '.1.3.6.1.4.1.3375.2.2.10.1.2.1'; # old sub manage_selection { my ($self, %options) = @_; my $snmp_result = $options{snmp}->get_multiple_table( oids => [ { oid => $oid_ltmVirtualServEntry, start => $mapping->{old}->{AvailState}->{oid}, end => $mapping->{old}->{EnabledState}->{oid} }, { oid => $oid_ltmVsStatusEntry, start => $mapping->{new}->{AvailState}->{oid}, end => $mapping->{new}->{EnabledState}->{oid} }, ], nothing_quit => 1 ); my ($branch, $map) = ($oid_ltmVsStatusEntry, 'new'); if (!defined($snmp_result->{$oid_ltmVsStatusEntry}) || scalar(keys %{$snmp_result->{$oid_ltmVsStatusEntry}}) == 0) { ($branch, $map) = ($oid_ltmVirtualServEntry, 'old'); } my $results = {}; foreach my $oid (keys %{$snmp_result->{$branch}}) { next if ($oid !~ /^$mapping->{$map}->{AvailState}->{oid}\.(.*?)\.(.*)$/); my ($num, $index) = ($1, $2); my $result = $options{snmp}->map_instance(mapping => $mapping->{$map}, results => $snmp_result->{$branch}, instance => $num . '.' . $index); my $name = $self->{output}->decode(join('', map(chr($_), split(/\./, $index)))); if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { $self->{output}->output_add(long_msg => "skipping virtual server '" . $name . "'.", debug => 1); next; } $results->{$name} = { status => $result->{AvailState}, state => $result->{EnabledState}, }; } return $results; } sub run { my ($self, %options) = @_; my $results = $self->manage_selection(snmp => $options{snmp}); foreach my $name (sort keys %$results) { $self->{output}->output_add( long_msg => sprintf( '[name: %s] [status: %s] [state: %s]', $name, $results->{$name}->{status}, $results->{$name}->{state}, ) ); } $self->{output}->output_add(severity => 'OK', short_msg => 'List virtual servers:'); $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); $self->{output}->exit(); } sub disco_format { my ($self, %options) = @_; $self->{output}->add_disco_format(elements => ['name', 'status', 'state']); } sub disco_show { my ($self, %options) = @_; my $results = $self->manage_selection(snmp => $options{snmp}); foreach my $name (sort keys %$results) { $self->{output}->add_disco_entry( name => $name, status => $results->{$name}->{status}, state => $results->{$name}->{state} ); } } 1; __END__ =head1 MODE List F-5 Virtual Servers. =over 8 =item B<--filter-name> Filter by virtual server name. =back =cut
centreon/centreon-plugins
network/f5/bigip/snmp/mode/listvirtualservers.pm
Perl
apache-2.0
5,028
# Copyright 2020, Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package Google::Ads::GoogleAds::V8::Services::MediaFileService::MediaFileOperation; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = {create => $args->{create}}; # Delete the unassigned fields in this object for a more concise JSON payload remove_unassigned_fields($self, $args); bless $self, $class; return $self; } 1;
googleads/google-ads-perl
lib/Google/Ads/GoogleAds/V8/Services/MediaFileService/MediaFileOperation.pm
Perl
apache-2.0
1,038
#!/usr/bin/perl use strict; use warnings; use HTTP::Request; use HTTP::Response; use LWP::UserAgent; use HTML::TreeBuilder; # This code is used to obtain the key and the notes for a given song. This can be used as # a prerequisite for other code # The scale of the songs my $scale = undef; # The key used in the song my $key = undef; # The song is characterized by the note stream, or the stream of notes my @noteStream; # The song's lyrics is categorized by a single vector my @lyricsOfSong; my $ROBOT_NAME = 'NoteStreamReader/1.0'; my $ROBOT_MAIL = 'asanyal4@jhu.edu'; my $ua = new LWP::UserAgent; # create an new LWP::UserAgent $ua->agent( $ROBOT_NAME ); # identify who we are $ua->from ( $ROBOT_MAIL ); # and give an email address in case anyone would # like to complain # A hash map of note corresponding to the set of notes in western classical my %note_map; # Defines the notes and sharps $note_map{'a'} = 1; $note_map{'a#'} = 1; $note_map{'b'} = 1; $note_map{'c'} = 1; $note_map{'c#'} = 1; $note_map{'d'} = 1; $note_map{'d#'} = 1; $note_map{'e'} = 1; $note_map{'f'} = 1; $note_map{'f#'} = 1; $note_map{'g'} = 1; $note_map{'g#'} = 1; # Defines the flats as well, to maintain harmonic equivalency $note_map{'ab'} = 1; $note_map{'bb'} = 1; $note_map{'db'} = 1; $note_map{'eb'} = 1; $note_map{'gb'} = 1; # Some phrases and words that are parsed by the crawler which are not part of the lyrics of a song my %metaDataWordHashMap; my @metaDataWords = ("Keyless", "Online", "Home", "This", "work", "is", "licensed", "under", "a", "Creative", "Commons", "Attribution-NonCommercial-ShareAlike", "2.5", "License.", "About", "Us", "Contact", "|", "Transpose:-3", "See", "Legend", "details)Band", "version", "(notes", "prelude/interludes", "bar-by-bar", "chords", "License", "Yahoo", "Group", "External", "Links", "Pallavi", "Music", "GroupSankara", "Eye", "FoundationSankara", "NethralayaUdavum", "KarangalChords", "names", "symbols", "Enter", "search", "termsSubmit", "form", "News", "Language", "Attribution", "NonCommercial", "ShareAlike", "NotesTamilHindiTeluguKannadaMalayalamKids", "CornerCarnaticMiscDevotionalEnglish", "Request", "SongLegendFAQKEYLESS", "(SeeLegendfor", "details)Meter", ":", "version(notes", "bar", "chords)PallaviAaj"); # Initialize the word for a fast lookup when constructing lyrics foreach my $word (@metaDataWords) { $metaDataWordHashMap{$word} = 1; } # Reads the songSources.txt file one by one and get the notestreams my $fileNumber = 0; open(FILE, "song_sources.txt") or die ("Cant open the song listings"); print "Reading lyrics and notes from contents song_sources.txt \n"; while(<FILE>){ my $link = $_; chomp $link; print "Processing link ", $link, "\n"; my $request = new HTTP::Request 'GET' => $link; my $response = $ua->request( $request ); my $html_tree = new HTML::TreeBuilder; # Make tree $html_tree->parse($response->content); # Elementify the tree $html_tree->elementify(); # Extract the body element from the elementified tree my @body = $html_tree->look_down("_tag", "body"); # The body Contents variable my $bodyContents = ""; # Fetch the body contents, removes the tags foreach my $elem (@body) { $bodyContents.= $elem->as_trimmed_text(); } # Removes all the non ASCII Chars from the text $bodyContents =~ tr/\x80-\xFF//d; my @bodyElements = split /[-<>.,~\s+]/, $bodyContents; my @bodyElementsScaleRef = split /\s+/, $bodyContents; my $line_number = 0; my $scale_key_info_linenumber = 0; # One pass to get the scale foreach (@bodyElementsScaleRef) { my $elem = $_; chomp $elem; if ($elem =~ "Scale") { # According to the nature of the inputs, the scale resides in the next line $scale_key_info_linenumber = $line_number + 1; } $line_number += 1; } # Reset line number for second pass $line_number = 0; # Second pass for parsing notestream and lyrics stream foreach (@bodyElements) { my $elem = $_; chomp $elem; if (length($elem) == 1 and $elem =~ m/[a-zA-Z]/ and exists $note_map{lc($elem)}){ push @noteStream, lc($elem); } elsif (length($elem) == 2 and $elem =~ m/[a-zA-Z]#/ and exists $note_map{lcfirst($elem)}) { push @noteStream, lcfirst($elem); } elsif (length($elem) == 2 and $elem =~ m/[a-zA-Z]b/) { push @noteStream, lcfirst($elem); } elsif ($elem =~ "Scale") { # This is done in pass 1 so continue $line_number += 1; next; } elsif(!exists $metaDataWordHashMap{$elem}) { # If its a component of the lyrics then just add that to the lyrics of the song if (length($elem) > 0 and $elem !~ m/[0-9]/) { # At this point we do some corruption checks, not every note has # been correctly acquired and some have been Erroneously concatenated if ($elem =~ "#") { my @uncorruptedNotes = split /(?<=\#)/, $elem; foreach (@uncorruptedNotes) { my $note = $_; if (exists $note_map{lc($elem)}) { push @noteStream, lcfirst($_); } } next; } elsif (length($elem) == 2 and substr($elem, 1, 1) =~ "m") { # Ignore chords, analysis is only on melody lines next } push @lyricsOfSong, $elem; } } $line_number += 1; } my $scaleKeyInfo = $bodyElementsScaleRef[$scale_key_info_linenumber]; $key = lc(substr($scaleKeyInfo, 0, 1)); my $scaleLetter = substr($scaleKeyInfo, 1, 1); # As of this moment i am only supporting minor and major scales if ($scaleLetter eq "m") { $scale = "MINOR"; } elsif ($scaleLetter eq "M") { $scale = "MAJOR"; } else { # Heuristic: Most songs are in minor scale $scale = "MINOR"; } open(my $notesFile, ">", "NotesOf".$fileNumber.".nsf"); print "Creating notestream file:", "NotesOf".$fileNumber.".nsf", "\n"; print $notesFile "Scale:".$scale."\n"; print $notesFile "Key:".$key."\n"; foreach (@noteStream) { print $notesFile $_." "; } close($notesFile); print "Creating lyrics file:", "LyricsOf".$fileNumber.".lyrics", "\n"; open(my $lyricsFile, ">", "LyricsOf".$fileNumber.".lyrics"); foreach (@lyricsOfSong) { print $lyricsFile $_." "; } close($lyricsFile); $fileNumber += 1; } close FILE; #close the file.
Khalian/Modulo7POC
perl/music_score_crawler.pm
Perl
apache-2.0
7,271
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package storage::netapp::ontap::oncommandapi::mode::listsvm; use base qw(centreon::plugins::mode); use strict; use warnings; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $options{options}->add_options(arguments => {}); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); } sub manage_selection { my ($self, %options) = @_; my $svms = $options{custom}->get(path => '/storage-vms'); my $results = []; foreach (@$svms) { push @$results, { key => $_->{key}, name => $_->{name}, state => defined($_->{state}) ? $_->{state} : 'none', type => $_->{type} } } return $results; } sub run { my ($self, %options) = @_; my $results = $self->manage_selection(%options); foreach (@$results) { $self->{output}->output_add( long_msg => sprintf( "[key: %s] [name: %s] [state: %s] [type: %s]", $_->{key}, $_->{name}, $_->{state}, $_->{type} ) ); } $self->{output}->output_add( severity => 'OK', short_msg => 'List storage virtual machines:' ); $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); $self->{output}->exit(); } sub disco_format { my ($self, %options) = @_; $self->{output}->add_disco_format(elements => ['key', 'name', 'state', 'type']); } sub disco_show { my ($self, %options) = @_; my $results = $self->manage_selection(%options); foreach (@$results) { $self->{output}->add_disco_entry(%$_); } } 1; __END__ =head1 MODE List storage virtual machines. =over 8 =back =cut
centreon/centreon-plugins
storage/netapp/ontap/oncommandapi/mode/listsvm.pm
Perl
apache-2.0
2,650
###########################################$ # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"). You may not # use this file except in compliance with the License. # A copy of the License is located at # # http://aws.amazon.com/apache2.0 # # or in the "license" file accompanying this file. This file is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express # or implied. See the License for the specific language governing permissions # and limitations under the License. ###########################################$ # __ _ _ ___ # ( )( \/\/ )/ __) # /__\ \ / \__ \ # (_)(_) \/\/ (___/ # # Amazon EC2 Perl Library # API Version: 2010-06-15 # Generated: Wed Jul 21 13:37:54 PDT 2010 # package Amazon::EC2::Model::CreateVolumeResponse; use base qw (Amazon::EC2::Model); # # Amazon::EC2::Model::CreateVolumeResponse # # Properties: # # # CreateVolumeResult: Amazon::EC2::Model::CreateVolumeResult # ResponseMetadata: Amazon::EC2::Model::ResponseMetadata # # # sub new { my ($class, $data) = @_; my $self = {}; $self->{_fields} = { CreateVolumeResult => {FieldValue => undef, FieldType => "Amazon::EC2::Model::CreateVolumeResult"}, ResponseMetadata => {FieldValue => undef, FieldType => "Amazon::EC2::Model::ResponseMetadata"}, }; bless ($self, $class); if (defined $data) { $self->_fromHashRef($data); } return $self; } # # Construct Amazon::EC2::Model::CreateVolumeResponse from XML string # sub fromXML { my ($self, $xml) = @_; eval "use XML::Simple"; my $tree = XML::Simple::XMLin ($xml); # TODO: check valid XML (is this a response XML?) return new Amazon::EC2::Model::CreateVolumeResponse($tree); } sub getCreateVolumeResult { return shift->{_fields}->{CreateVolumeResult}->{FieldValue}; } sub setCreateVolumeResult { my ($self, $value) = @_; $self->{_fields}->{CreateVolumeResult}->{FieldValue} = $value; } sub withCreateVolumeResult { my ($self, $value) = @_; $self->setCreateVolumeResult($value); return $self; } sub isSetCreateVolumeResult { return defined (shift->{_fields}->{CreateVolumeResult}->{FieldValue}); } sub getResponseMetadata { return shift->{_fields}->{ResponseMetadata}->{FieldValue}; } sub setResponseMetadata { my ($self, $value) = @_; $self->{_fields}->{ResponseMetadata}->{FieldValue} = $value; } sub withResponseMetadata { my ($self, $value) = @_; $self->setResponseMetadata($value); return $self; } sub isSetResponseMetadata { return defined (shift->{_fields}->{ResponseMetadata}->{FieldValue}); } # # XML Representation for this object # # Returns string XML for this object # sub toXML { my $self = shift; my $xml = ""; $xml .= "<CreateVolumeResponse xmlns=\"http://ec2.amazonaws.com/doc/2010-06-15/\">"; $xml .= $self->_toXMLFragment(); $xml .= "</CreateVolumeResponse>"; return $xml; } 1;
electric-cloud/EC-EC2
src/main/resources/project/lib/Amazon/EC2/Model/CreateVolumeResponse.pm
Perl
apache-2.0
3,460
#!/usr/bin/env perl use warnings; use strict; die "Usage: perl $0 <fasta> <split number> <outprefix>\n" if(@ARGV ne 3); open FA, $ARGV[0] or die $!; $/ = "\n>"; my @fa; while(<FA>) { chomp; s/^>//; push @fa, $_; } my $n = int(@fa / $ARGV[1]); for(my $i = 0; $i < $ARGV[1]; $i ++) { open OUT, "> $ARGV[2].$i.fasta" or die $!; for(my $j = 0; $j < $n; $j ++) { my $a = shift @fa; print OUT ">$a\n"; } } foreach(@fa) { print OUT ">$_\n"; }
BaconKwan/Perl_programme
utility/split_fasta.pl
Perl
apache-2.0
451
:- module(db_client_types, [ socketname/1, dbname/1, user/1, passwd/1, answertableterm/1, tuple/1, answertupleterm/1, sqlstring/1 ],[assertions,regtypes,basicmodes]). % ---------------------------------------------------------------------------- :- comment(title,"Types for the Low-level interface to SQL databases"). :- comment(author,"D. Cabeza, M. Carro, I. Caballero, and M. Hermenegildo."). :- comment(module,"This module implement the types for the low level interface to SQL databases"). % ---------------------------------------------------------------------------- :- regtype socketname(IPP) # "@var{IPP} is a structure describing a complete TCP/IP port address.". socketname( IPAddress : PortNumber ) :- atm(IPAddress), int(PortNumber). :- comment(socketname/1,"@includedef{socketname/1}"). % ---------------------------------------------------------------------------- :- regtype dbname(DBId) # "@var{DBId} is the identifier of an database.". dbname(DBId) :- atm(DBId). :- comment(dbname/1,"@includedef{dbname/1}"). :- regtype user(User) # "@var{User} is a user name in the database.". user(User) :- atm(User). :- comment(user/1,"@includedef{user/1}"). :- regtype passwd(Passwd) # "@var{Passwd} is the password for the user name in the database.". passwd(Passwd) :- atm(Passwd). :- comment(passwd/1,"@includedef{passwd/1}"). % ---------------------------------------------------------------------------- :- regtype answertupleterm(X) # "@var{X} is a predicate containing a tuple.". answertupleterm([]). answertupleterm(tup(T)) :- tuple(T). :- comment(answertupleterm/1,"@includedef{answertupleterm/1}"). % ---------------------------------------------------------------------------- :- regtype sqlstring(S) # "@var{S} is a string of SQL code.". sqlstring( S ) :- string(S). :- comment(sqlstring/1,"@includedef{sqlstring/1}"). :- comment(answertableterm/1,"Represents the types of responses that will be returned from the database interface. These can be a set of answer tuples, or the atom @tt{ok} in case of a successful addition or deletion."). :- regtype answertableterm(AT) # "@var{AT} is a response from the database interface.". answertableterm(ok). answertableterm(t(Answers)) :- list(Answers,tuple). answertableterm(err(Answer)) :- term(Answer). :- comment(answertableterm/1,"@includedef{answertableterm/1}"). :- regtype tuple(T) # "@var{T} is a tuple of values from the database interface.". tuple(T) :- list(T,atm). :- comment(tuple/1,"@includedef{tuple/1}").
leuschel/ecce
www/CiaoDE/ciao/library/persdb_mysql/db_client_types.pl
Perl
apache-2.0
2,597
=pod =head1 NAME ossl_provider_find, ossl_provider_new, ossl_provider_up_ref, ossl_provider_free, ossl_provider_set_module_path, ossl_provider_add_parameter, ossl_provider_set_child, ossl_provider_get_parent, ossl_provider_up_ref_parent, ossl_provider_free_parent, ossl_provider_default_props_update, ossl_provider_get0_dispatch, ossl_provider_init_as_child, ossl_provider_deinit_child, ossl_provider_activate, ossl_provider_deactivate, ossl_provider_add_to_store, ossl_provider_ctx, ossl_provider_doall_activated, ossl_provider_name, ossl_provider_dso, ossl_provider_module_name, ossl_provider_module_path, ossl_provider_libctx, ossl_provider_teardown, ossl_provider_gettable_params, ossl_provider_get_params, ossl_provider_clear_all_operation_bits, ossl_provider_query_operation, ossl_provider_unquery_operation, ossl_provider_set_operation_bit, ossl_provider_test_operation_bit, ossl_provider_get_capabilities - internal provider routines =head1 SYNOPSIS #include "internal/provider.h" OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name, int noconfig); OSSL_PROVIDER *ossl_provider_new(OSSL_LIB_CTX *libctx, const char *name, ossl_provider_init_fn *init_function int noconfig); int ossl_provider_up_ref(OSSL_PROVIDER *prov); void ossl_provider_free(OSSL_PROVIDER *prov); /* Setters */ int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *path); int ossl_provider_add_parameter(OSSL_PROVIDER *prov, const char *name, const char *value); /* Child Providers */ int ossl_provider_set_child(OSSL_PROVIDER *prov, const OSSL_CORE_HANDLE *handle); const OSSL_CORE_HANDLE *ossl_provider_get_parent(OSSL_PROVIDER *prov); int ossl_provider_up_ref_parent(OSSL_PROVIDER *prov, int activate); int ossl_provider_free_parent(OSSL_PROVIDER *prov, int deactivate); int ossl_provider_default_props_update(OSSL_LIB_CTX *libctx, const char *props); /* * Activate the Provider * If the Provider is a module, the module will be loaded */ int ossl_provider_activate(OSSL_PROVIDER *prov, int upcalls, int aschild); int ossl_provider_deactivate(OSSL_PROVIDER *prov, int removechildren); int ossl_provider_add_to_store(OSSL_PROVIDER *prov, OSSL_PROVIDER **actualprov, int retain_fallbacks); /* Return pointer to the provider's context */ void *ossl_provider_ctx(const OSSL_PROVIDER *prov); const OSSL_DISPATCH *ossl_provider_get0_dispatch(const OSSL_PROVIDER *prov); /* Iterate over all loaded providers */ int ossl_provider_doall_activated(OSSL_LIB_CTX *, int (*cb)(OSSL_PROVIDER *provider, void *cbdata), void *cbdata); /* Getters for other library functions */ const char *ossl_provider_name(OSSL_PROVIDER *prov); const DSO *ossl_provider_dso(OSSL_PROVIDER *prov); const char *ossl_provider_module_name(OSSL_PROVIDER *prov); const char *ossl_provider_module_path(OSSL_PROVIDER *prov); OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov); /* Thin wrappers around calls to the provider */ void ossl_provider_teardown(const OSSL_PROVIDER *prov); const OSSL_PARAM *ossl_provider_gettable_params(const OSSL_PROVIDER *prov); int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]); int ossl_provider_get_capabilities(const OSSL_PROVIDER *prov, const char *capability, OSSL_CALLBACK *cb, void *arg); const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov, int operation_id, int *no_cache); void ossl_provider_unquery_operation(const OSSL_PROVIDER *prov, int operation_id, const OSSL_ALGORITHM *algs); int ossl_provider_set_operation_bit(OSSL_PROVIDER *provider, size_t bitnum); int ossl_provider_test_operation_bit(OSSL_PROVIDER *provider, size_t bitnum, int *result); int ossl_provider_clear_all_operation_bits(OSSL_LIB_CTX *libctx); int ossl_provider_init_as_child(OSSL_LIB_CTX *ctx, const OSSL_CORE_HANDLE *handle, const OSSL_DISPATCH *in); void ossl_provider_deinit_child(OSSL_LIB_CTX *ctx); =head1 DESCRIPTION I<OSSL_PROVIDER> is a type that holds all the necessary information to handle a provider, regardless of if it's built in to the application or the OpenSSL libraries, or if it's a loadable provider module. Instances of this type are commonly referred to as "provider objects". A provider object is always stored in a set of provider objects in the library context. Provider objects are reference counted. Provider objects are initially inactive, i.e. they are only recorded in the store, but are not used. They are activated with the first call to ossl_provider_activate(), and are deactivated with the last call to ossl_provider_deactivate(). Activation affects a separate counter. =head2 Functions ossl_provider_find() finds an existing provider object in the provider object store by I<name>. The config file will be automatically loaded unless I<noconfig> is set. Typically I<noconfig> should be 0. We set I<noconfig> to 1 only when calling these functions while processing a config file in order to avoid recursively attempting to load the file. The provider object it finds has its reference count incremented. ossl_provider_new() creates a new provider object named I<name> and stores it in the provider object store, unless there already is one there with the same name. If there already is one with the same name, it's returned with its reference count incremented. The config file will be automatically loaded unless I<noconfig> is set. Typically I<noconfig> should be 0. We set I<noconfig> to 1 only when calling these functions while processing a config file in order to avoid recursively attempting to load the file. The reference count of a newly created provider object will always be 2; one for being added to the store, and one for the returned reference. If I<init_function> is NULL, the provider is assumed to be a dynamically loadable module, with the symbol B<OSSL_provider_init> as its initialisation function. If I<init_function> isn't NULL, the provider is assumed to be built in, with I<init_function> being the pointer to its initialisation function. For further description of the initialisation function, see the description of ossl_provider_activate() below. ossl_provider_up_ref() increments the provider object I<prov>'s reference count. ossl_provider_free() decrements the provider object I<prov>'s reference count; when it drops to zero, the provider object is assumed to have fallen out of use and will be deinitialized (its I<teardown> function is called), and the associated module will be unloaded if one was loaded, and I<prov> itself will be freed. ossl_provider_set_module_path() sets the module path to load the provider module given the provider object I<prov>. This will be used in preference to automatically trying to figure out the path from the provider name and the default module directory (more on this in L</NOTES>). ossl_provider_libctx() returns the library context the given provider I<prov> is registered in. ossl_provider_add_parameter() adds a global parameter for the provider to retrieve as it sees fit. The parameters are a combination of I<name> and I<value>, and the provider will use the name to find the value it wants. Only text parameters can be given, and it's up to the provider to interpret them. ossl_provider_set_child() marks this provider as a child of a provider in the parent library context. I<handle> is the B<OSSL_CORE_HANDLE> object passed to the provider's B<OSSL_provider_init> function. ossl_provider_get_parent() obtains the handle on the parent provider. ossl_provider_up_ref_parent() increases the reference count on the parent provider. If I<activate> is nonzero then the parent provider is also activated. ossl_provider_free_parent() decreases the reference count on the parent provider. If I<deactivate> is nonzero then the parent provider is also deactivated. ossl_provider_default_props_update() is responsible for informing any child providers of an update to the default properties. The new properties are supplied in the I<props> string. ossl_provider_activate() "activates" the provider for the given provider object I<prov> by incrementing its activation count, flagging it as activated, and initializing it if it isn't already initialized. Initializing means one of the following: =over 4 =item * If an initialization function was given with ossl_provider_new(), that function will get called. =item * If no initialization function was given with ossl_provider_new(), a loadable module with the I<name> that was given to ossl_provider_new() will be located and loaded, then the symbol B<OSSL_provider_init> will be located in that module, and called. =back If I<upcalls> is nonzero then, if this is a child provider, upcalls to the parent libctx will be made to inform it of an up-ref. If I<aschild> is nonzero then the provider will only be activated if it is a child provider. Otherwise no action is taken and ossl_provider_activate() returns success. ossl_provider_deactivate() "deactivates" the provider for the given provider object I<prov> by decrementing its activation count. When that count reaches zero, the activation flag is cleared. If the I<removechildren> parameter is 0 then no attempt is made to remove any associated child providers. ossl_provider_add_to_store() adds the provider I<prov> to the provider store and makes it available to other threads. This will prevent future automatic loading of fallback providers, unless I<retain_fallbacks> is true. If a provider of the same name already exists in the store then it is not added but this function still returns success. On success the I<actualprov> value is populated with a pointer to the provider of the given name that is now in the store. The reference passed in the I<prov> argument is consumed by this function. A reference to the provider that should be used is passed back in the I<actualprov> argument. ossl_provider_ctx() returns a context created by the provider. Outside of the provider, it's completely opaque, but it needs to be passed back to some of the provider functions. ossl_provider_get0_dispatch() returns the dispatch table that the provider initially returned in the I<out> parameter of its B<OSSL_provider_init> function. ossl_provider_doall_activated() iterates over all the currently "activated" providers, and calls I<cb> for each of them. If no providers have been "activated" yet, it tries to activate all available fallback providers before iterating over them. ossl_provider_name() returns the name that was given with ossl_provider_new(). ossl_provider_dso() returns a reference to the module, for providers that come in the form of loadable modules. ossl_provider_module_name() returns the filename of the module, for providers that come in the form of loadable modules. ossl_provider_module_path() returns the full path of the module file, for providers that come in the form of loadable modules. ossl_provider_teardown() calls the provider's I<teardown> function, if the provider has one. ossl_provider_gettable_params() calls the provider's I<gettable_params> function, if the provider has one. It should return an array of I<OSSL_PARAM> to describe all the parameters that the provider has for the provider object. ossl_provider_get_params() calls the provider's parameter request responder. It should treat the given I<OSSL_PARAM> array as described in L<OSSL_PARAM(3)>. ossl_provider_get_capabilities() calls the provider's I<get_capabilities> function, if the provider has one. It provides the name of the I<capability> and a callback I<cb> parameter to call for each capability that has a matching name in the provider. The callback gets passed OSSL_PARAM details about the capability as well as the caller supplied argument I<arg>. ossl_provider_query_operation() calls the provider's I<query_operation> function, if the provider has one. It should return an array of I<OSSL_ALGORITHM> for the given I<operation_id>. ossl_provider_unquery_operation() informs the provider that the result of ossl_provider_query_operation() is no longer going to be directly accessed and that all relevant information has been copied. ossl_provider_set_operation_bit() registers a 1 for operation I<bitnum> in a bitstring that's internal to I<provider>. ossl_provider_test_operation_bit() checks if the bit operation I<bitnum> is set (1) or not (0) in the internal I<provider> bitstring, and sets I<*result> to 1 or 0 accorddingly. ossl_provider_clear_all_operation_bits() clears all of the operation bits to (0) for all providers in the library context I<libctx>. ossl_provider_init_as_child() stores in the library context I<ctx> references to the necessary upcalls for managing child providers. The I<handle> and I<in> parameters are the B<OSSL_CORE_HANDLE> and B<OSSL_DISPATCH> pointers that were passed to the provider's B<OSSL_provider_init> function. ossl_provider_deinit_child() deregisters callbacks from the parent library context about provider creation or removal events for the child library context I<ctx>. Must only be called if I<ctx> is a child library context. =head1 NOTES Locating a provider module happens as follows: =over 4 =item 1. If a path was given with ossl_provider_set_module_path(), use that as module path. Otherwise, use the provider object's name as module path, with platform specific standard extensions added. =item 2. If the environment variable B<OPENSSL_MODULES> is defined, assume its value is a directory specification and merge it with the module path. Otherwise, merge the value of the OpenSSL built in macro B<MODULESDIR> with the module path. =back When this process is done, the result is used when trying to load the provider module. The command C<openssl version -m> can be used to find out the value of the built in macro B<MODULESDIR>. =head1 RETURN VALUES ossl_provider_find() and ossl_provider_new() return a pointer to a provider object (I<OSSL_PROVIDER>) on success, or NULL on error. ossl_provider_up_ref() returns the value of the reference count after it has been incremented. ossl_provider_free() doesn't return any value. ossl_provider_doall_activated() returns 1 if the callback was called for all activated providers. A return value of 0 means that the callback was not called for any activated providers. ossl_provider_set_module_path(), ossl_provider_activate(), ossl_provider_activate_leave_fallbacks() and ossl_provider_deactivate(), ossl_provider_add_to_store(), ossl_provider_default_props_update() return 1 on success, or 0 on error. ossl_provider_name(), ossl_provider_dso(), ossl_provider_module_name(), and ossl_provider_module_path() return a pointer to their respective data if it's available, otherwise NULL is returned. ossl_provider_libctx() return a pointer to the library context. This may be NULL, and is perfectly valid, as it denotes the default global library context. ossl_provider_teardown() doesn't return any value. ossl_provider_gettable_params() returns a pointer to a constant I<OSSL_PARAM> array if this function is available in the provider, otherwise NULL. ossl_provider_get_params() returns 1 on success, or 0 on error. If this function isn't available in the provider, 0 is returned. ossl_provider_set_operation_bit() and ossl_provider_test_operation_bit() return 1 on success, or 0 on error. ossl_provider_clear_all_operation_bits() returns 1 on success, or 0 on error. ossl_provider_get_capabilities() returns 1 on success, or 0 on error. If this function isn't available in the provider or the provider does not support the requested capability then 0 is returned. =head1 SEE ALSO L<OSSL_PROVIDER(3)>, L<provider(7)>, L<openssl(1)> =head1 HISTORY The functions described here were all added in OpenSSL 3.0. =head1 COPYRIGHT Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
openssl/openssl
doc/internal/man3/ossl_provider_new.pod
Perl
apache-2.0
16,797
package Paws::ServiceCatalog::UsageInstruction; use Moose; has Type => (is => 'ro', isa => 'Str'); has Value => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::ServiceCatalog::UsageInstruction =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::ServiceCatalog::UsageInstruction object: $service_obj->Method(Att1 => { Type => $value, ..., Value => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::ServiceCatalog::UsageInstruction object: $result = $service_obj->Method(...); $result->Att1->Type =head1 DESCRIPTION Additional information provided by the administrator. =head1 ATTRIBUTES =head2 Type => Str The usage instruction type for the value. =head2 Value => Str The usage instruction value for this type. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::ServiceCatalog> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/ServiceCatalog/UsageInstruction.pm
Perl
apache-2.0
1,431
/**** Be careful when changing code, to not break auto distribution generation ****/ :- module(http, [ fetch_url/3 ], ['pillow/ops',assertions,isomodes,dcg]). :- use_module(library(strings), [string/3]). :- use_module(library(lists), [select/3]). :- use_module(library('pillow/pillow_aux')). :- use_module(library('pillow/pillow_types')). :- use_module(library('pillow/http_ll')). pillow_version("1.1"). :- comment(title, "HTTP conectivity"). :- comment(author, "Daniel Cabeza"). :- comment(module, "This module implements the @concept{HTTP} protocol, which allows retrieving data from HTTP servers."). :- comment(fetch_url(URL, Request, Response), "Fetches the document pointed to by @var{URL} from Internet, using request parameters @var{Request}, and unifies @var{Response} with the parameters of the response. Fails on timeout. Note that redirections are not handled automatically, that is, if @var{Response} contains terms of the form @tt{status(redirection,301,_)} and @tt{location(NewURL)}, the program should in most cases access location @tt{NewURL}."). :- true pred fetch_url(URL, Request, Response) : (url_term(URL), list(Request, http_request_param)) => list(Response, http_response_param). fetch_url(http(Host, Port, Document), Request, Response) :- timeout_option(Request, Timeout, Request1), http_request(Document, Request1, RequestChars, []), !, http_transaction(Host, Port, RequestChars, Timeout, ResponseChars), http_response(Response, ResponseChars, []). :- pred timeout_option(+Options, -Timeout, -RestOptions) # "Returns timeout option, by default 5 min. (300s).". timeout_option(Options, Timeout, RestOptions) :- select(timeout(Timeout), Options, RestOptions), !. timeout_option(Options, 300, Options). :- pred http_request(+Document, +Request, -RequestChars, -RequestCharsTail) # "Generate an HTTP request from a list of parameters, conforming to the RFC 1945 guidelines. Does not use the headers: current date, pragma, referer, and entity body (this will have to change if the implementation extends beyond the GET and HEAD methods. cf RFC1945 section 7.2)". http_request(Document,Options) --> http_request_method(Options,Options1), " ", string(Document), " HTTP/1.0", http_crlf, http_req(Options1), !. http_request_method(Options,Options1) --> { select(head, Options, Options1) }, !, "HEAD". http_request_method(Options, Options) --> "GET". http_req([]) --> http_crlf. http_req([Option|Options]) --> http_request_option(Option), !, http_req(Options). http_request_option(user_agent(A)) --> !, { atom_codes(A,AStr), pillow_version(Ver) }, "User-Agent: ", string(AStr), " PiLLoW/", string(Ver), http_crlf. http_request_option(if_modified_since(date(WkDay,Day,Month,Year,Time))) --> !, "If-Modified-Since: ", http_internet_date(WkDay,Day,Month,Year,Time), http_crlf. http_request_option(authorization(Scheme, Params)) --> !, "Authorization: ", http_credentials(Scheme, Params), http_crlf. http_request_option(O) --> { functor(O,F,1), atom_codes(F,FS), arg(1,O,A), atom_codes(A,AS) }, !, string(FS), ": ", string(AS), http_crlf. http_request_option(O) --> "", {warning(['Invalid http_request_param ',O])}. http_credentials(basic, Cookie) --> !, "Basic ", string(Cookie). http_credentials(Scheme,Params) --> !, { atom_codes(Scheme, S) }, string(S), " ", http_credential_params(Params). http_credential_params([]) --> "". http_credential_params([P|Ps]) --> http_credential_param(P), http_credential_params_rest(Ps). http_credential_params_rest([]) --> "". http_credential_params_rest([P|Ps]) --> ", ", http_credential_param(P), http_credential_params_rest(Ps). http_credential_param(P=V) --> { atom_codes(P,PS) }, string(PS), "=""", string(V), """". % ============================================================================ % PROLOG BNF GRAMMAR FOR HTTP RESPONSES % Based on RFC 1945 % % ============================================================================ http_response(R) --> http_full_response(R), !. http_response(R) --> http_simple_response(R). http_full_response([Status|Head_Body]) --> http_status_line(Status), http_response_headers(Head_Body,Body), http_crlf, http_entity_body(Body). http_simple_response(Body) --> http_entity_body(Body). http_response_headers([H|Hs], Hs_) --> http_response_header(H), !, http_response_headers(Hs, Hs_). http_response_headers(Hs, Hs) --> "". http_entity_body([content(B)],B,[]). % ---------------------------------------------------------------------------- http_status_line(status(Ty,SC,RP)) --> "HTTP/", parse_integer(_Major), ".", parse_integer(_Minor), http_sp, http_status_code(Ty,SC), http_sp, http_line(RP), !. http_status_code(Ty,SC) --> [X,Y,Z], { type_of_status_code(X,Ty), !, number_codes(SC,[X,Y,Z]) }. type_of_status_code(0'1, informational) :- !. type_of_status_code(0'2, success) :- !. type_of_status_code(0'3, redirection) :- !. type_of_status_code(0'4, request_error) :- !. type_of_status_code(0'5, server_error) :- !. type_of_status_code(_, extension_code). % ---------------------------------------------------------------------------- % General header http_response_header(P) --> http_pragma(P), !. http_response_header(D) --> http_message_date(D), !. % Response header http_response_header(L) --> http_location(L), !. http_response_header(S) --> http_server(S), !. http_response_header(A) --> http_authenticate(A), !. % Entity header http_response_header(A) --> http_allow(A), !. http_response_header(E) --> http_content_encoding(E), !. http_response_header(L) --> http_content_length(L), !. http_response_header(T) --> http_content_type(T), !. http_response_header(X) --> http_expires(X), !. http_response_header(M) --> http_last_modified(M), !. http_response_header(E) --> http_extension_header(E), !. % ---------------------------------------------------------------------------- http_pragma(pragma(P)) --> http_field("pragma"), http_line(P). http_message_date(message_date(D)) --> http_field("date"), http_date(D), http_crlf. http_location(location(URL)) --> http_field("location"), http_line(URLStr), { atom_codes(URL,URLStr) }. http_server(http_server(S)) --> http_field("server"), http_line(S). http_authenticate(authenticate(C)) --> http_field("www-authenticate"), http_challenges(C). http_allow(allow(Methods)) --> http_field("allow"), http_token_list(Methods), http_crlf. http_content_encoding(content_encoding(E)) --> http_field("content-encoding"), http_lo_up_token(E), http_lws0, http_crlf. http_content_length(content_length(L)) --> http_field("content-length"), parse_integer(L), http_lws0, http_crlf. http_content_type(content_type(Type,SubType,Params)) --> http_field("content-type"), http_media_type(Type,SubType,Params), http_crlf. http_expires(expires(D)) --> http_field("expires"), http_date(D), http_crlf. http_last_modified(last_modified(D)) --> http_field("last-modified"), http_date(D), http_crlf. http_extension_header(T) --> http_field(F), http_line(A), { atom_codes(Fu,F), functor(T,Fu,1), arg(1,T,A) }. % ---------------------------------------------------------------------------- http_date(date(WeekDay,Day,Month,Year,Time)) --> http_internet_date(WeekDay,Day,Month,Year,Time), ! ; http_asctime_date(WeekDay,Day,Month,Year,Time). http_internet_date(WeekDay,Day,Month,Year,Time) --> http_weekday(WeekDay), ",", http_sp, http_day(Day), http_sp_or_minus, http_month(Month), http_sp_or_minus, http_year(Year), http_sp, http_time(Time), http_sp, "GMT". http_sp_or_minus --> "-", !. http_sp_or_minus --> http_sp. http_asctime_date(WeekDay,Day,Month,Year,Time) --> http_weekday(WeekDay), http_sp, http_month(Month), http_sp, http_day(Day), http_sp, http_time(Time), http_sp, http_year(Year). http_weekday('Monday') --> "Monday", !. http_weekday('Tuesday') --> "Tuesday", !. http_weekday('Wednesday') --> "Wednesday", !. http_weekday('Thursday') --> "Thursday", !. http_weekday('Friday') --> "Friday", !. http_weekday('Saturday') --> "Saturday", !. http_weekday('Sunday') --> "Sunday", !. http_weekday('Monday') --> "Mon", !. http_weekday('Tuesday') --> "Tue", !. http_weekday('Wednesday') --> "Wed", !. http_weekday('Thursday') --> "Thu", !. http_weekday('Friday') --> "Fri", !. http_weekday('Saturday') --> "Sat", !. http_weekday('Sunday') --> "Sun", !. http_day(Day) --> [D1,D2], { number_codes(Day,[D1,D2]) }, !. http_day(Day) --> http_sp, [D], { number_codes(Day,[D]) }. http_month('January') --> "Jan". http_month('February') --> "Feb". http_month('March') --> "Mar". http_month('April') --> "Apr". http_month('May') --> "May". http_month('June') --> "Jun". http_month('July') --> "Jul". http_month('August') --> "Aug". http_month('September') --> "Sep". http_month('October') --> "Oct". http_month('November') --> "Nov". http_month('December') --> "Dec". % Assumes Year > 999 http_year(Year) --> [Y1,Y2,Y3,Y4], { number_codes(Year,[Y1,Y2,Y3,Y4]) }, !. http_year(Year) --> [Y1,Y2], { number_codes(Y,[Y1,Y2]), ( Y >= 90 -> Year is 1900+Y ; Year is 2000+Y ) }. http_time(Time) --> [H1,H2,0':,M1,M2,0':,S1,S2], { atom_codes(Time,[H1,H2,0':,M1,M2,0':,S1,S2]) }. % ---------------------------------------------------------------------------- http_challenges([C|CS]) --> http_maybe_commas, http_challenge(C), http_more_challenges(CS). http_more_challenges([C|CS]) --> http_commas, http_challenge(C), http_more_challenges(CS). http_more_challenges([]) --> http_lws0, http_crlf. http_challenge(challenge(Scheme,Realm,Params)) --> http_lo_up_token(Scheme), http_sp, http_lo_up_token(realm), "=", http_quoted_string(Realm), http_lws0, http_auth_params(Params). http_auth_params([P|Ps]) --> ",", http_lws0, http_auth_param(P), http_lws0, http_auth_params(Ps). http_auth_params([]) --> "". http_auth_param(P=V) --> http_lo_up_token(P), "=", http_quoted_string(V). % ---------------------------------------------------------------------------- http_token_list([T|Ts]) --> http_maybe_commas, http_token(T), http_token_list0(Ts). http_token_list0([T|Ts]) --> http_commas, http_token(T), http_token_list0(Ts). http_token_list0([]) --> http_maybe_commas. http_commas --> http_lws0,",",http_lws0, http_maybe_commas. http_maybe_commas --> ",", !, http_lws0, http_maybe_commas. http_maybe_commas --> "". % ---------------------------------------------------------------------------- http_field([C|Cs]) --> http_lo_up_token_char(C), http_lo_up_token_rest(Cs), ":", http_lws.
leuschel/ecce
www/CiaoDE/ciao/library/pillow/http.pl
Perl
apache-2.0
12,061
package VMOMI::ServiceLocatorCredential; use parent 'VMOMI::DynamicData'; use strict; use warnings; our @class_ancestors = ( 'DynamicData', ); our @class_members = ( ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
stumpr/p5-vmomi
lib/VMOMI/ServiceLocatorCredential.pm
Perl
apache-2.0
394
package VMOMI::SwapPlacementOverrideNotSupported; use parent 'VMOMI::InvalidVmConfig'; use strict; use warnings; our @class_ancestors = ( 'InvalidVmConfig', 'VmConfigFault', 'VimFault', 'MethodFault', ); our @class_members = ( ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
stumpr/p5-vmomi
lib/VMOMI/SwapPlacementOverrideNotSupported.pm
Perl
apache-2.0
467
package Zonemaster::Constants; use strict; use warnings; use parent 'Exporter'; use Net::IP::XS; use Readonly; our @EXPORT_OK = qw[ $ALGO_STATUS_DEPRECATED $ALGO_STATUS_PRIVATE $ALGO_STATUS_RESERVED $ALGO_STATUS_UNASSIGNED $ALGO_STATUS_VALID $DURATION_12_HOURS_IN_SECONDS $DURATION_180_DAYS_IN_SECONDS $FQDN_MAX_LENGTH $LABEL_MAX_LENGTH $IP_VERSION_4 $IP_VERSION_6 $MAX_SERIAL_VARIATION $MINIMUM_NUMBER_OF_NAMESERVERS $SOA_DEFAULT_TTL_MAXIMUM_VALUE $SOA_DEFAULT_TTL_MINIMUM_VALUE $SOA_EXPIRE_MINIMUM_VALUE $SOA_REFRESH_MINIMUM_VALUE $SOA_RETRY_MINIMUM_VALUE $UDP_PAYLOAD_LIMIT @IPV4_SPECIAL_ADDRESSES @IPV6_SPECIAL_ADDRESSES ]; our %EXPORT_TAGS = ( all => \@EXPORT_OK, algo => [ qw($ALGO_STATUS_DEPRECATED $ALGO_STATUS_PRIVATE $ALGO_STATUS_RESERVED $ALGO_STATUS_UNASSIGNED $ALGO_STATUS_VALID) ], name => [qw($FQDN_MAX_LENGTH $LABEL_MAX_LENGTH)], ip => [qw($IP_VERSION_4 $IP_VERSION_6)], soa => [ qw($SOA_DEFAULT_TTL_MAXIMUM_VALUE $SOA_DEFAULT_TTL_MINIMUM_VALUE $SOA_EXPIRE_MINIMUM_VALUE $SOA_REFRESH_MINIMUM_VALUE $SOA_RETRY_MINIMUM_VALUE $DURATION_12_HOURS_IN_SECONDS $DURATION_180_DAYS_IN_SECONDS $MAX_SERIAL_VARIATION) ], misc => [qw($UDP_PAYLOAD_LIMIT $MINIMUM_NUMBER_OF_NAMESERVERS)], addresses => [qw(@IPV4_SPECIAL_ADDRESSES @IPV6_SPECIAL_ADDRESSES)], ); Readonly our $ALGO_STATUS_DEPRECATED => 1; Readonly our $ALGO_STATUS_PRIVATE => 4; Readonly our $ALGO_STATUS_RESERVED => 2; Readonly our $ALGO_STATUS_UNASSIGNED => 3; Readonly our $ALGO_STATUS_VALID => 5; Readonly our $DURATION_12_HOURS_IN_SECONDS => 12 * 60 * 60; Readonly our $DURATION_180_DAYS_IN_SECONDS => 180 * 24 * 60 * 60; # Maximum length of ASCII version of a domain name, with trailing dot. Readonly our $FQDN_MAX_LENGTH => 254; Readonly our $LABEL_MAX_LENGTH => 63; Readonly our $IP_VERSION_4 => 4; Readonly our $IP_VERSION_6 => 6; Readonly our $MAX_SERIAL_VARIATION => 0; Readonly our $MINIMUM_NUMBER_OF_NAMESERVERS => 2; Readonly our $SOA_DEFAULT_TTL_MAXIMUM_VALUE => 86_400; # 1 day Readonly our $SOA_DEFAULT_TTL_MINIMUM_VALUE => 300; # 5 minutes Readonly our $SOA_EXPIRE_MINIMUM_VALUE => 604_800; # 1 week Readonly our $SOA_REFRESH_MINIMUM_VALUE => 14_400; # 4 hours Readonly our $SOA_RETRY_MINIMUM_VALUE => 3_600; # 1 hour Readonly our $UDP_PAYLOAD_LIMIT => 512; Readonly::Array our @IPV4_SPECIAL_ADDRESSES => ( { ip => Net::IP::XS->new( q{0.0.0.0/8} ), name => q{This host on this network}, reference => q{RFC 1122} }, { ip => Net::IP::XS->new( q{10.0.0.0/8} ), name => q{Private-Use}, reference => q{RFC 1918} }, { ip => Net::IP::XS->new( q{192.168.0.0/16} ), name => q{Private-Use}, reference => q{RFC 1918} }, { ip => Net::IP::XS->new( q{172.16.0.0/12} ), name => q{Private-Use}, reference => q{RFC 1918} }, { ip => Net::IP::XS->new( q{100.64.0.0/10} ), name => q{Shared Address Space}, reference => q{RFC 6598} }, { ip => Net::IP::XS->new( q{127.0.0.0/8} ), name => q{Loopback}, reference => q{RFC 1122} }, { ip => Net::IP::XS->new( q{169.254.0.0/16} ), name => q{Link Local}, reference => q{RFC 3927} }, { ip => Net::IP::XS->new( q{192.0.0.0/24} ), name => q{IETF Protocol Assignments}, reference => q{RFC 6890} }, { ip => Net::IP::XS->new( q{192.0.0.0/29} ), name => q{DS Lite}, reference => q{RFC 6333} }, { ip => Net::IP::XS->new( q{192.0.0.170/32} ), name => q{NAT64/DNS64 Discovery}, reference => q{RFC 7050} }, { ip => Net::IP::XS->new( q{192.0.0.171/32} ), name => q{NAT64/DNS64 Discovery}, reference => q{RFC 7050} }, { ip => Net::IP::XS->new( q{192.0.2.0/24} ), name => q{Documentation}, reference => q{RFC 5737} }, { ip => Net::IP::XS->new( q{198.51.100.0/24} ), name => q{Documentation}, reference => q{RFC 5737} }, { ip => Net::IP::XS->new( q{203.0.113.0/24} ), name => q{Documentation}, reference => q{RFC 5737} }, { ip => Net::IP::XS->new( q{192.88.99.0/24} ), name => q{6to4 Relay Anycast}, reference => q{RFC 3068} }, { ip => Net::IP::XS->new( q{198.18.0.0/15} ), name => q{Benchmarking}, reference => q{RFC 2544} }, { ip => Net::IP::XS->new( q{240.0.0.0/4} ), name => q{Reserved}, reference => q{RFC 1112} }, { ip => Net::IP::XS->new( q{255.255.255.255/32} ), name => q{Limited Broadcast}, reference => q{RFC 919} }, { ip => Net::IP::XS->new( q{224.0.0.0/4} ), name => q{IPv4 multicast addresses}, reference => q{RFC 5771} }, ); Readonly::Array our @IPV6_SPECIAL_ADDRESSES => ( { ip => Net::IP::XS->new( q{::1/128} ), name => q{Loopback Address}, reference => q{RFC 4291} }, { ip => Net::IP::XS->new( q{::/128} ), name => q{Unspecified Address}, reference => q{RFC 4291} }, { ip => Net::IP::XS->new( q{::ffff:0:0/96} ), name => q{IPv4-mapped Address}, reference => q{RFC 4291} }, { ip => Net::IP::XS->new( q{64:ff9b::/96} ), name => q{IPv4-IPv6 Translation}, reference => q{RFC 6052} }, { ip => Net::IP::XS->new( q{100::/64} ), name => q{Discard-Only Address Block}, reference => q{RFC 6666} }, { ip => Net::IP::XS->new( q{2001::/23} ), name => q{IETF Protocol Assignments}, reference => q{RFC 2928} }, { ip => Net::IP::XS->new( q{2001::/32} ), name => q{TEREDO}, reference => q{RFC 4380} }, { ip => Net::IP::XS->new( q{2001:2::/48} ), name => q{Benchmarking}, reference => q{RFC 5180} }, { ip => Net::IP::XS->new( q{2001:db8::/32} ), name => q{Documentation}, reference => q{RFC 3849} }, { ip => Net::IP::XS->new( q{2001:10::/28} ), name => q{Deprecated (ORCHID)}, reference => q{RFC 4843} }, { ip => Net::IP::XS->new( q{2002::/16} ), name => q{6to4}, reference => q{RFC 3056} }, { ip => Net::IP::XS->new( q{fc00::/7} ), name => q{Unique-Local}, reference => q{RFC 4193} }, { ip => Net::IP::XS->new( q{fe80::/10} ), name => q{Linked-Scoped Unicast}, reference => q{RFC 4291} }, { ip => Net::IP::XS->new( q{::/96} ), name => q{Deprecated (IPv4-compatible Address)}, reference => q{RFC 4291} }, { ip => Net::IP::XS->new( q{5f00::/8} ), name => q{unallocated (ex 6bone)}, reference => q{RFC 3701} }, { ip => Net::IP::XS->new( q{3ffe::/16} ), name => q{unallocated (ex 6bone)}, reference => q{RFC 3701} }, { ip => Net::IP::XS->new( q{ff00::/8} ), name => q{IPv6 multicast addresses}, reference => q{RFC 4291} }, ); 1; =head1 NAME Zonemaster::Constants - module holding constants used in test modules =head1 SYNOPSIS use Zonemaster::Constants ':all'; =head1 EXPORTED GROUPS =over =item all All exportable names. =item algo DNSSEC algorithms. =item asn Constants used by the ASN test module. =item name Label and name lengths. =item ip IP version constants. =item soa SOA value limits. =item misc UDP payload limit and minimum number of nameservers per zone. =item addresses Address classes for IPv4 and IPv6. =back =head1 EXPORTED NAMES =over =item * C<$ALGO_STATUS_DEPRECATED> =item * C<$ALGO_STATUS_PRIVATE> =item * C<$ALGO_STATUS_RESERVED> =item * C<$ALGO_STATUS_UNASSIGNED> =item * C<$ALGO_STATUS_VALID> =item * C<$ASN_CHECKING_ROUTE_VIEWS_SERVICE_NAME> =item * C<$ASN_CHECKING_SERVICE_USED> =item * C<$ASN_CHECKING_ZONEMASTER_SERVICE_NAME> =item * C<$ASN_IPV4_CHECKING_SERVICE_ROUTE_VIEWS_DOMAIN> =item * C<$ASN_IPV4_CHECKING_SERVICE_ZONEMASTER_DOMAIN> =item * C<$ASN_IPV6_CHECKING_SERVICE_ROUTE_VIEWS_DOMAIN> =item * C<$ASN_IPV6_CHECKING_SERVICE_ZONEMASTER_DOMAIN> =item * C<$ASN_UNASSIGNED_UNANNOUNCED_ADDRESS_SPACE_VALUE> =item * C<$DURATION_12_HOURS_IN_SECONDS> =item * C<$DURATION_180_DAYS_IN_SECONDS> =item * C<$FQDN_MAX_LENGTH> =item * C<$LABEL_MAX_LENGTH> =item * C<$IP_VERSION_4> =item * C<$IP_VERSION_6> =item * C<$MAX_SERIAL_VARIATION> =item * C<$MINIMUM_NUMBER_OF_NAMESERVERS> =item * C<$SOA_DEFAULT_TTL_MAXIMUM_VALUE> =item * C<$SOA_DEFAULT_TTL_MINIMUM_VALUE> =item * C<$SOA_EXPIRE_MINIMUM_VALUE> =item * C<$SOA_REFRESH_MINIMUM_VALUE> =item * C<$SOA_RETRY_MINIMUM_VALUE> =item * C<$UDP_PAYLOAD_LIMIT> =item * C<@IPV4_SPECIAL_ADDRESSES> =item * C<@IPV6_SPECIAL_ADDRESSES> =back
mtoma/zonemaster
Zonemaster/lib/Zonemaster/Constants.pm
Perl
bsd-2-clause
8,584
package Tapper::Reports::Web::Util::Filter::Report; =head1 NAME Tapper::Reports::Web::Util::Filter::Report - Filter utilities for report listing =head1 SYNOPSIS use Tapper::Reports::Web::Util::Filter::Report; my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c); my $filter_args = ['host','bullock','days','3']; my $allowed_filter_keys = ['host','days']; my $searchoptions = $filter->parse_filters($filter_args, $allowed_filter_keys); =cut use Moose; use Hash::Merge::Simple 'merge'; use Set::Intersection 'get_intersection'; use Tapper::Model 'model'; extends 'Tapper::Reports::Web::Util::Filter'; sub BUILD{ my $self = shift; my $args = shift; $self->dispatch( merge($self->dispatch, {host => \&host, suite => \&suite, success => \&success, owner => \&owner, }) ); } =head2 host Add host filters to early filters. @param hash ref - current version of filters @param string - host name @return hash ref - updated filters =cut sub host { my ($self, $filter_condition, $host) = @_; my @hosts; @hosts = @{$filter_condition->{early}->{machine_name}->{in}} if $filter_condition->{early}->{machine_name}; push @hosts, $host; $filter_condition->{early}->{machine_name} = {'in' => \@hosts}; return $filter_condition; } =head2 suite Add test suite to early filters. @param hash ref - current version of filters @param string - suite name or id @return hash ref - updated filters =cut sub suite { my ($self, $filter_condition, $suite) = @_; my $suite_id; if ($suite =~/^\d+$/) { $suite_id = $suite; } else { my $suite_rs = $self->context->model('ReportsDB')->resultset('Suite')->search({name => $suite}); $suite_id = $suite_rs->first->id if $suite_rs->count; } my @suites; @suites = @{$filter_condition->{early}->{suite_id}->{in}} if $filter_condition->{suite_id}; push @suites, $suite_id; $filter_condition->{early}->{suite_id} = {'in' => \@suites}; return $filter_condition; } =head2 success Add success filters to early filters. Valid values are pass, fail and a ratio in percent. @param hash ref - current version of filters @param string - success grade @return hash ref - updated filters =cut sub success { my ($self, $filter_condition, $success) = @_; if ($success =~/^\d+$/) { $filter_condition->{early}->{success_ratio} = int($success); } else { $filter_condition->{early}->{successgrade} = uc($success); } return $filter_condition; } =head2 owner Adds filters for owner. Currently, owners are only determind by testruns. @param hash ref - current version of filters @param string - owner name @return hash ref - updated filters =cut sub owner { my ($self, $filter_condition, $owner) = @_; push @{$filter_condition->{late}}, { '-or' => [ {'reportgrouparbitrary.owner' => $owner}, {'reportgrouptestrun.owner' => $owner}, ]}; return $filter_condition; } 1;
renormalist/Tapper-Reports-Web
lib/Tapper/Reports/Web/Util/Filter/Report.pm
Perl
bsd-2-clause
3,433
package R::Model::Type::Msg; # текстовое поле, преобразует текст в html. # выделяются линки и переводы строк заменяются на br # заменяются последовательности пробелов и знаки табуляции # ненормативная лексика заменяется на *** use common::sense; use R::App; #use overload "" => \&stringify; # # конструктор # sub new { # my ($cls) = @_; # bless {}, ref $cls || $cls; # } # возвращает тип колумна в базе sub typeCol { my ($field, $length) = @_; $field->input("area"); $app->meta->getTextType($length // ((1 << 16) - 1)); } # конструктор - возвращает новый объект из базы sub fromCol { my ($field, $html) = @_; bless { html => $html }, $field->{class}; } # преобразует из объекта в представление базы sub toCol { my ($self) = @_; $self->{html} } # рендерит в шаблоне sub render { my ($self) = @_; my $html = $self->{html}; # почему на этом этапе, а не сохраняем в базу? # да потому, что текст может понадобиться для изменения коммертария в textarea # так же потому что в случае дополнения этого модуля старые записи будут отредактированы одинаково # конвертируем $html = $app->html->escape($html); $html =~ s{ (?P<br> \n) | #(?P<space> [\ \t]+ ) | (?P<link> \b([a-z]+://|www\.) (?: \S+ (?P<unlink> [\.!\?] (?:\s|$)) | \S+ ) ) }{ &_convert; }gxei; bless [$html], "R::Html"; } # конвертирует текст в html sub _convert { my ($html) = @_; exists $+{br}? "<br>": exists $+{link}? do { my $unlink = $+{unlink}; my $link = $app->html->escape($+{link}); $link = substr $link, 0, -length $unlink if defined $unlink; my $real_link = $link; $link = "http://$link" if $link !~ /^\w+:/; my $gen_link = sub { "<a href=\"$link\" target=_blank>$real_link</a>" }; my $text_link; if($real_link =~ /\.(?:gif|png|jpeg|jpe|jpg)(?:\?|#|$)/i) { $text_link = "<a href=\"$link\" target=_blank><img src='$link'></a>"; } elsif($real_link =~ m![\./]youtube\.com/.*?([^/]+)(?:\?|#|$)!i) { $text_link = "<iframe src=\"//youtube.com/embed/$1\" frameborder=0 allowfullscreen style='max-width:100%' width=540 height=480></iframe>" . $gen_link->(); } elsif($real_link =~ m![\./](?:vk\.com|vkontakte\.ru)/video(\d+)_(\d+)!i) { $text_link = "<iframe src=\"//vk.com/video_ext.php?oid=$1&id=$2\" frameborder=0 allowfullscreen style='max-width:100%' width=540 height=480></iframe>" . $gen_link->(); } else { $text_link = $gen_link->(); } # elsif($real_link =~ m![\./]rutube\.ru/video/([^/]+)/!i) { # $text_link = "<iframe src=\"//rutube.ru/play/embed/$1\" frameborder=0 allowfullscreen style='max-width:100%' width=540 height=480></iframe>"; # } #<iframe width="500" height="281" src="//rutube.ru/play/embed/7431068" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe> #http://vk.com/video2290682_456239053 #<iframe src="//vk.com/video_ext.php?oid=2290682&id=456239053&hash=da24778609e1852d&hd=2" width="853" height="480" frameborder="0"></iframe> $text_link . $unlink }: die "что-то неопределённое `$&`"; } 1;
darviarush/rubin-forms
lib/R/Model/Type/Msg.pm
Perl
bsd-2-clause
3,543
#ExStart:1 use lib 'lib'; use strict; use warnings; use utf8; use File::Slurp; # From CPAN use JSON; use AsposeStorageCloud::StorageApi; use AsposeStorageCloud::ApiClient; use AsposeStorageCloud::Configuration; use AsposeWordsCloud::WordsApi; use AsposeWordsCloud::ApiClient; use AsposeWordsCloud::Configuration; my $configFile = '../Config/config.json'; my $configPropsText = read_file($configFile); my $configProps = decode_json($configPropsText); my $data_path = '../../../Data/'; my $out_path = $configProps->{'out_folder'}; $AsposeWordsCloud::Configuration::app_sid = $configProps->{'app_sid'}; $AsposeWordsCloud::Configuration::api_key = $configProps->{'api_key'}; $AsposeWordsCloud::Configuration::debug = 1; $AsposeStorageCloud::Configuration::app_sid = $configProps->{'app_sid'}; $AsposeStorageCloud::Configuration::api_key = $configProps->{'api_key'}; # Instantiate Aspose.Storage and Aspose.Words API SDK my $storageApi = AsposeStorageCloud::StorageApi->new(); my $wordsApi = AsposeWordsCloud::WordsApi->new(); # Set input file name my $name = "SampleWordDocument.docx"; my $objectIndex = 1; # Upload file to aspose cloud storage my $response = $storageApi->PutCreate(Path => $name, file => $data_path.$name); # Invoke Aspose.Words Cloud SDK API to get drawing object by index present in a word document $response = $wordsApi->GetDocumentDrawingObjectImageData(name=> $name, objectIndex=>$objectIndex); if($response->{'Status'} eq 'OK'){ # Download output document from response my $destfilename = $out_path. "DrawingObject_" . $objectIndex . ".png"; write_file($destfilename, { binmode => ":raw" }, $response->{'Content'}); } #ExEnd:1
aspose-words/Aspose.Words-for-Cloud
Examples/Perl/Drawing/ReadingImageData.pl
Perl
mit
1,657
# please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*- package TestAPI::custom_response; # custom_response() doesn't alter the response code, but is used to # replace the standard response body use strict; use warnings FATAL => 'all'; use Apache2::Response (); use Apache2::Const -compile => qw(FORBIDDEN); sub handler { my $r = shift; my $how = $r->args || ''; # warn "$how"; # could be text or url $r->custom_response(Apache2::Const::FORBIDDEN, $how); return Apache2::Const::FORBIDDEN; } 1; __END__ <NoAutoConfig> <Location /TestAPI__custom_response> AuthName dummy AuthType none PerlAccessHandler TestAPI::custom_response </Location> </NoAutoConfig>
dreamhost/dpkg-ndn-perl-mod-perl
t/response/TestAPI/custom_response.pm
Perl
apache-2.0
788
package Google::Ads::AdWords::v201406::BudgetReturnValue; use strict; use warnings; __PACKAGE__->_set_element_form_qualified(1); sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201406' }; our $XML_ATTRIBUTE_CLASS; undef $XML_ATTRIBUTE_CLASS; sub __get_attr_class { return $XML_ATTRIBUTE_CLASS; } use base qw(Google::Ads::AdWords::v201406::ListReturnValue); # Variety: sequence use Class::Std::Fast::Storable constructor => 'none'; use base qw(Google::Ads::SOAP::Typelib::ComplexType); { # BLOCK to scope variables my %ListReturnValue__Type_of :ATTR(:get<ListReturnValue__Type>); my %value_of :ATTR(:get<value>); my %partialFailureErrors_of :ATTR(:get<partialFailureErrors>); __PACKAGE__->_factory( [ qw( ListReturnValue__Type value partialFailureErrors ) ], { 'ListReturnValue__Type' => \%ListReturnValue__Type_of, 'value' => \%value_of, 'partialFailureErrors' => \%partialFailureErrors_of, }, { 'ListReturnValue__Type' => 'SOAP::WSDL::XSD::Typelib::Builtin::string', 'value' => 'Google::Ads::AdWords::v201406::Budget', 'partialFailureErrors' => 'Google::Ads::AdWords::v201406::ApiError', }, { 'ListReturnValue__Type' => 'ListReturnValue.Type', 'value' => 'value', 'partialFailureErrors' => 'partialFailureErrors', } ); } # end BLOCK 1; =pod =head1 NAME Google::Ads::AdWords::v201406::BudgetReturnValue =head1 DESCRIPTION Perl data type class for the XML Schema defined complexType BudgetReturnValue from the namespace https://adwords.google.com/api/adwords/cm/v201406. A container for return values from the {@link BudgetService#mutate} call. =head2 PROPERTIES The following properties may be accessed using get_PROPERTY / set_PROPERTY methods: =over =item * value =item * partialFailureErrors =back =head1 METHODS =head2 new Constructor. The following data structure may be passed to new(): =head1 AUTHOR Generated by SOAP::WSDL =cut
gitpan/GOOGLE-ADWORDS-PERL-CLIENT
lib/Google/Ads/AdWords/v201406/BudgetReturnValue.pm
Perl
apache-2.0
2,033
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut package XrefParser::DirectParser; use strict; use warnings; use Carp; use base qw( XrefParser::BaseParser ); # This parser will read Direct Xrefs from a simple tab-delimited file. # The columns of the file should be the following: # # 1) Accession ID # 2) Ensembl ID # 3) Type (one of 'transcript', 'gene', or 'translation', # will default to 'gene') # 4) Display label (will default to the Accession ID in column 1) # 5) Description (will default to the empty string) # 6) Version (will default to '1') # # Columns 1 and 2 are obligatory. sub run { my ($self, $ref_arg) = @_; my $source_id = $ref_arg->{source_id}; my $species_id = $ref_arg->{species_id}; my $filename = $ref_arg->{file}; my $verbose = $ref_arg->{verbose}; if((!defined $source_id) or (!defined $species_id) or (!defined $filename) ){ croak "Need to pass source_id, species_id and file as pairs"; } $verbose |=0; my $file_io = $self->get_filehandle($filename); if ( !defined($file_io) ) { return 1; } my $parsed_count = 0; printf( STDERR "source = %d\t species = %d\n", $source_id, $species_id ); while ( defined( my $line = $file_io->getline() ) ) { chomp $line; my ( $accession, $ensembl_id, $type, $label, $description, $version ) = split( /\t/, $line ); if ( !defined($accession) || !defined($ensembl_id) ) { print {*STDERR} "Line $parsed_count contains has less than two columns.\n"; print {*STDERR} ("The parsing failed\n"); return 1; } $type ||= 'gene'; $label ||= $accession; $description ||= ''; $version ||= '1'; ++$parsed_count; my $xref_id = $self->get_xref( $accession, $source_id, $species_id ); if ( !defined($xref_id) || $xref_id eq '' ) { $xref_id = $self->add_xref({ acc => $accession, version => $version, label => $label, desc => $description, source_id => $source_id, species_id => $species_id, info_type => "DIRECT"} ); } $self->add_direct_xref( $xref_id, $ensembl_id, $type, $accession ); } ## end while ( defined( my $line... printf( "%d direct xrefs succesfully parsed\n", $parsed_count ) if($verbose); $file_io->close(); print "Done\n" if($verbose);; return 0; } ## end sub run 1;
mjg17/ensembl
misc-scripts/xref_mapping/XrefParser/DirectParser.pm
Perl
apache-2.0
3,002
package Bio::Phylo::TreeBASE::Result::RightchangesetCharstate; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE use strict; use warnings; use base 'DBIx::Class::Core'; =head1 NAME Bio::Phylo::TreeBASE::Result::RightchangesetCharstate =cut __PACKAGE__->table("rightchangeset_charstate"); =head1 ACCESSORS =head2 statechangeset_id data_type: 'bigint' is_foreign_key: 1 is_nullable: 0 =head2 discretecharstate_id data_type: 'bigint' is_foreign_key: 1 is_nullable: 0 =cut __PACKAGE__->add_columns( "statechangeset_id", { data_type => "bigint", is_foreign_key => 1, is_nullable => 0 }, "discretecharstate_id", { data_type => "bigint", is_foreign_key => 1, is_nullable => 0 }, ); =head1 RELATIONS =head2 discretecharstate Type: belongs_to Related object: L<Bio::Phylo::TreeBASE::Result::Discretecharstate> =cut __PACKAGE__->belongs_to( "discretecharstate", "Bio::Phylo::TreeBASE::Result::Discretecharstate", { discretecharstate_id => "discretecharstate_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); =head2 statechangeset Type: belongs_to Related object: L<Bio::Phylo::TreeBASE::Result::Statechangeset> =cut __PACKAGE__->belongs_to( "statechangeset", "Bio::Phylo::TreeBASE::Result::Statechangeset", { statechangeset_id => "statechangeset_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); # Created by DBIx::Class::Schema::Loader v0.07002 @ 2010-11-13 19:19:22 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1STyvMDeNV6N7ZEHdATHNw # You can replace this text with custom content, and it will be preserved on regeneration 1;
TreeBASE/treebase
treebase-core/src/main/perl/lib/Bio/Phylo/TreeBASE/Result/RightchangesetCharstate.pm
Perl
bsd-3-clause
1,686
#----------------------------------------------------------- # winrar_tln.pl # Get WinRAR\ArcHistory entries # # History # 20120829 - updated to TLN # 20080819 - created (winrar.pl) # # # copyright 2008 H. Carvey, keydet89@yahoo.com #----------------------------------------------------------- package winrar_tln; use strict; my %config = (hive => "NTUSER\.DAT", osmask => 22, hasShortDescr => 1, hasDescr => 0, hasRefs => 0, version => 20120829); sub getConfig{return %config} sub getShortDescr { return "Get WinRAR\\ArcHistory entries (TLN)"; } sub getDescr{} sub getRefs {} sub getHive {return $config{hive};} sub getVersion {return $config{version};} my $VERSION = getVersion(); sub pluginmain { my $class = shift; my $hive = shift; ::logMsg("Launching winrar v.".$VERSION); my $reg = Parse::Win32Registry->new($hive); my $root_key = $reg->get_root_key; my $key_path = "Software\\WinRAR\\ArcHistory"; my $key; if ($key = $root_key->get_subkey($key_path)) { # ::rptMsg("WinRAR"); # ::rptMsg($key_path); # ::rptMsg("LastWrite Time ".gmtime($key->get_timestamp())." (UTC)"); # ::rptMsg(""); my $lw = $key->get_timestamp(); my %arc; my @vals = $key->get_list_of_values(); if (scalar(@vals) > 0) { my $last; eval { $last = $key->get_value("0")->get_data(); ::rptMsg($lw."|REG|||WinRAR/ArcHistory - ".$last); }; } else { # ::rptMsg($key_path." has no values."); } } else { # ::rptMsg($key_path." not found."); } } 1;
kefir-/autopsy
RecentActivity/release/rr-full/plugins/winrar_tln.pl
Perl
apache-2.0
1,644
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut # init_pipeline.pl exonNTSpeciesTree_conf package Bio::EnsEMBL::Compara::PipeConfig::exonNTSpeciesTree_conf; use strict; use base ('Bio::EnsEMBL::Compara::PipeConfig::ComparaGeneric_conf'); sub default_options { my ($self) = @_; return { %{$self->SUPER::default_options}, 'pipeline_name' => 'MakeNTSpeciesTree2', 'db_suffix' => '_new_ExonSpeciesTree_', # previous release db with alignments 'previous_release_version' => '74', 'core_db_version' => 74, # method_link_species_set_id(s) for the multiple sequence alignments to generate the trees 'msa_mlssid_csv_string' => join(',', qw(651 664 667 660)), # and a hash with assoiciated reference species 'msa_mlssid_and_reference_species' => { 651 => 90, 664 => 142, 667 => 37, 660 => 90, }, # coord system name to find genes (applies to all the species) 'coord_system_name' => 'chromosome', 'phylofit_exe' => '/software/ensembl/compara/phast/phyloFit', 'species_tree_bl' => '~/src/ensembl-compara/scripts/pipeline/species_tree_blength.nh', # dummy mlss and mlss_id value for the stored species_tree_blength.nh 'dummy_mlss_value' => 1000000, 'pipeline_db' => { # the production database itself (will be created) -driver => 'mysql', -host => 'compara4', -port => 3306, -user => 'ensadmin', -pass => $self->o('password'), -dbname => $self->o('ENV', 'USER').$self->o('db_suffix').$self->o('rel_with_suffix'), }, 'core_dbs' => [ { -driver => 'mysql', -user => 'anonymous', -port => 5306, -host => 'ensembldb.ensembl.org', -dbname => '', -db_version => $self->o('core_db_version'), }, # { # -driver => 'mysql', # -user => 'ensro', # -port => 3306, # -host => 'ens-staging2', # -dbname => '', # -db_version => $self->o('core_db_version'), # }, ], # compara db with the alignments (usually the previous release db) 'previous_compara_db' => { -driver => 'mysql', -host => 'compara3', -species => 'Multi', -port => '3306', -user => 'ensro', -dbname => 'mp12_ensembl_compara_74', }, }; } sub pipeline_wide_parameters { my $self = shift @_; return { %{$self->SUPER::pipeline_wide_parameters}, 'previous_compara_db' => $self->o('previous_compara_db'), 'msa_mlssid_and_reference_species' => $self->o('msa_mlssid_and_reference_species'), 'msa_mlssid_csv_string' => $self->o('msa_mlssid_csv_string'), 'dummy_mlss_value' => $self->o('dummy_mlss_value'), 'core_dbs' => $self->o('core_dbs'), 'coord_system_name' => $self->o('coord_system_name'), }; } sub resource_classes { my ($self) = @_; return { %{$self->SUPER::resource_classes}, # inherit 'default' from the parent class 'mem3600' => {'LSF' => '-C0 -M3600 -R"select[mem>3600] rusage[mem=3600]"' }, 'mem5600' => {'LSF' => '-C0 -M5600 -R"select[mem>5600] rusage[mem=5600]"' }, }; } sub pipeline_analyses { my ($self) = @_; print "pipeline_analyses\n"; return [ { -logic_name => 'table_list_to_copy', -module => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory', -input_ids => [{}], -parameters => { 'inputlist' => [ 'genome_db', 'species_set', 'method_link', 'method_link_species_set', 'species_tree_node', 'species_tree_root', 'ncbi_taxa_name', 'ncbi_taxa_node' ], 'column_names' => [ 'table' ], }, -flow_into => { '2->A' => [ 'copy_tables' ], 'A->1' => [ 'modify_copied_tables' ], }, }, { -logic_name => 'copy_tables', -module => 'Bio::EnsEMBL::Hive::RunnableDB::MySQLTransfer', -parameters => { 'src_db_conn' => $self->o('previous_compara_db'), 'mode' => 'overwrite', 'filter_cmd' => 'sed "s/ENGINE=MyISAM/ENGINE=InnoDB/"', }, }, { -logic_name => 'modify_copied_tables', -module => 'Bio::EnsEMBL::Hive::RunnableDB::SqlCmd', -parameters => { 'sql' => [ 'DELETE str.*, stn.* FROM species_tree_root str INNER JOIN species_tree_node stn ON str.root_id = stn.root_id '. 'WHERE str.method_link_species_set_id NOT IN (#msa_mlssid_csv_string#)', 'DELETE mlss.* FROM method_link_species_set mlss WHERE mlss.method_link_species_set_id NOT IN (#msa_mlssid_csv_string#)', 'DELETE ss.* FROM species_set ss LEFT OUTER JOIN method_link_species_set mlss ON mlss.species_set_id = ss.species_set_id '. 'WHERE mlss.species_set_id IS NULL', 'DELETE ml.* FROM method_link ml LEFT OUTER JOIN method_link_species_set mlss ON mlss.method_link_id = ml.method_link_id '. 'WHERE mlss.method_link_id IS NULL', # we need a mlssid for the full compara species tree 'INSERT INTO species_set (SELECT 1, genome_db_id FROM genome_db WHERE taxon_id)', 'INSERT INTO method_link VALUES(1000000, "ORIGINAL_TREE", "GenomicAlignTree.tree_alignment")', 'REPLACE INTO method_link_species_set (SELECT '.$self->o('dummy_mlss_value').','.$self->o('dummy_mlss_value').', species_set_id, "ORIGINAL_TREE", "OT", "OT"'. 'FROM species_set WHERE species_set_id = 1)', 'DELETE gdb.* FROM genome_db gdb LEFT OUTER JOIN species_set ss ON ss.genome_db_id = gdb.genome_db_id '. 'WHERE ss.genome_db_id IS NULL', ], }, -flow_into => { '2->A' => [ 'mlss_factory' ], 'A->1' => [ 'merge_msa_trees' ], }, }, { -logic_name => 'mlss_factory', -parameters => { 'inputlist' => '#expr([ eval #msa_mlssid_csv_string#])expr#', 'column_names' => [ 'msa_mlssid' ], }, -module => 'Bio::EnsEMBL::Hive::RunnableDB::JobFactory', -flow_into => { 2 => [ 'slice_factory' ], }, -meadow_type=> 'LOCAL', }, { -logic_name => 'slice_factory', -parameters => {}, -module => 'Bio::EnsEMBL::Compara::RunnableDB::MakeNTSpeciesTree::SliceFactory', -flow_into => { 2 => [ 'gene_factory' ], }, }, { -logic_name => 'gene_factory', -parameters => {}, -module => 'Bio::EnsEMBL::Compara::RunnableDB::MakeNTSpeciesTree::GeneFactory', -flow_into => { 2 => [ 'exon_phylofit_factory' ] }, }, { -logic_name => 'exon_phylofit_factory', -module => 'Bio::EnsEMBL::Compara::RunnableDB::MakeNTSpeciesTree::ExonPhylofitFactory', -parameters => { 'previous_compara_db' => $self->o('previous_compara_db'), 'phylofit_exe' => $self->o('phylofit_exe'), }, -hive_capacity => 20, -batch_size => 10, -max_retry_count => 1, -rc_name => 'mem3600', }, { -logic_name => 'merge_msa_trees', -module => 'Bio::EnsEMBL::Compara::RunnableDB::MakeNTSpeciesTree::MergeEMSAtrees', -parameters => {'species_tree_bl' => $self->o('species_tree_bl'),}, -max_retry_count => 1, }, ]; } 1;
ckongEbi/ensembl-compara
modules/Bio/EnsEMBL/Compara/PipeConfig/exonNTSpeciesTree_conf.pm
Perl
apache-2.0
7,458
% Frame number: 31 happensAt( walking( id0 ), 1240 ). holdsAt( coord( id0 )=( 75, 62 ), 1240 ). % Frame number: 32 happensAt( walking( id0 ), 1280 ). holdsAt( coord( id0 )=( 76, 62 ), 1280 ). % Frame number: 33 happensAt( walking( id0 ), 1320 ). holdsAt( coord( id0 )=( 76, 62 ), 1320 ). % Frame number: 34 happensAt( walking( id0 ), 1360 ). holdsAt( coord( id0 )=( 78, 63 ), 1360 ). % Frame number: 35 happensAt( walking( id0 ), 1400 ). holdsAt( coord( id0 )=( 78, 63 ), 1400 ). % Frame number: 36 happensAt( walking( id0 ), 1440 ). holdsAt( coord( id0 )=( 78, 64 ), 1440 ). % Frame number: 37 happensAt( walking( id0 ), 1480 ). holdsAt( coord( id0 )=( 79, 64 ), 1480 ). % Frame number: 38 happensAt( walking( id0 ), 1520 ). holdsAt( coord( id0 )=( 78, 65 ), 1520 ). % Frame number: 39 happensAt( walking( id0 ), 1560 ). holdsAt( coord( id0 )=( 78, 66 ), 1560 ). % Frame number: 40 happensAt( walking( id0 ), 1600 ). holdsAt( coord( id0 )=( 78, 67 ), 1600 ). happensAt( walking( id1 ), 1600 ). holdsAt( coord( id1 )=( 83, 66 ), 1600 ). % Frame number: 41 happensAt( walking( id0 ), 1640 ). holdsAt( coord( id0 )=( 78, 68 ), 1640 ). happensAt( walking( id1 ), 1640 ). holdsAt( coord( id1 )=( 83, 66 ), 1640 ). % Frame number: 42 happensAt( walking( id0 ), 1680 ). holdsAt( coord( id0 )=( 78, 70 ), 1680 ). happensAt( walking( id1 ), 1680 ). holdsAt( coord( id1 )=( 83, 66 ), 1680 ). % Frame number: 43 happensAt( walking( id0 ), 1720 ). holdsAt( coord( id0 )=( 78, 70 ), 1720 ). happensAt( walking( id1 ), 1720 ). holdsAt( coord( id1 )=( 83, 66 ), 1720 ). % Frame number: 44 happensAt( walking( id0 ), 1760 ). holdsAt( coord( id0 )=( 78, 71 ), 1760 ). happensAt( walking( id1 ), 1760 ). holdsAt( coord( id1 )=( 83, 67 ), 1760 ). % Frame number: 45 happensAt( walking( id0 ), 1800 ). holdsAt( coord( id0 )=( 78, 71 ), 1800 ). happensAt( walking( id1 ), 1800 ). holdsAt( coord( id1 )=( 83, 68 ), 1800 ). % Frame number: 46 happensAt( walking( id0 ), 1840 ). holdsAt( coord( id0 )=( 77, 72 ), 1840 ). happensAt( walking( id1 ), 1840 ). holdsAt( coord( id1 )=( 83, 69 ), 1840 ). % Frame number: 47 happensAt( walking( id0 ), 1880 ). holdsAt( coord( id0 )=( 77, 72 ), 1880 ). happensAt( walking( id1 ), 1880 ). holdsAt( coord( id1 )=( 83, 71 ), 1880 ). % Frame number: 48 happensAt( walking( id0 ), 1920 ). holdsAt( coord( id0 )=( 77, 72 ), 1920 ). happensAt( walking( id1 ), 1920 ). holdsAt( coord( id1 )=( 83, 72 ), 1920 ). % Frame number: 49 happensAt( walking( id0 ), 1960 ). holdsAt( coord( id0 )=( 77, 72 ), 1960 ). happensAt( walking( id1 ), 1960 ). holdsAt( coord( id1 )=( 83, 72 ), 1960 ). % Frame number: 50 happensAt( walking( id0 ), 2000 ). holdsAt( coord( id0 )=( 77, 73 ), 2000 ). happensAt( walking( id1 ), 2000 ). holdsAt( coord( id1 )=( 82, 73 ), 2000 ). % Frame number: 51 happensAt( walking( id0 ), 2040 ). holdsAt( coord( id0 )=( 77, 73 ), 2040 ). happensAt( walking( id1 ), 2040 ). holdsAt( coord( id1 )=( 82, 73 ), 2040 ). % Frame number: 52 happensAt( walking( id0 ), 2080 ). holdsAt( coord( id0 )=( 77, 73 ), 2080 ). happensAt( walking( id1 ), 2080 ). holdsAt( coord( id1 )=( 82, 73 ), 2080 ). % Frame number: 53 happensAt( walking( id0 ), 2120 ). holdsAt( coord( id0 )=( 76, 74 ), 2120 ). happensAt( walking( id1 ), 2120 ). holdsAt( coord( id1 )=( 82, 74 ), 2120 ). % Frame number: 54 happensAt( walking( id0 ), 2160 ). holdsAt( coord( id0 )=( 75, 76 ), 2160 ). happensAt( walking( id1 ), 2160 ). holdsAt( coord( id1 )=( 81, 74 ), 2160 ). % Frame number: 55 happensAt( walking( id0 ), 2200 ). holdsAt( coord( id0 )=( 75, 76 ), 2200 ). happensAt( walking( id1 ), 2200 ). holdsAt( coord( id1 )=( 81, 74 ), 2200 ). % Frame number: 56 happensAt( walking( id0 ), 2240 ). holdsAt( coord( id0 )=( 75, 78 ), 2240 ). happensAt( walking( id1 ), 2240 ). holdsAt( coord( id1 )=( 81, 74 ), 2240 ). % Frame number: 57 happensAt( walking( id0 ), 2280 ). holdsAt( coord( id0 )=( 75, 78 ), 2280 ). happensAt( walking( id1 ), 2280 ). holdsAt( coord( id1 )=( 81, 75 ), 2280 ). % Frame number: 58 happensAt( walking( id0 ), 2320 ). holdsAt( coord( id0 )=( 75, 79 ), 2320 ). happensAt( walking( id1 ), 2320 ). holdsAt( coord( id1 )=( 81, 74 ), 2320 ). % Frame number: 59 happensAt( walking( id0 ), 2360 ). holdsAt( coord( id0 )=( 75, 79 ), 2360 ). happensAt( walking( id1 ), 2360 ). holdsAt( coord( id1 )=( 81, 75 ), 2360 ). % Frame number: 60 happensAt( walking( id0 ), 2400 ). holdsAt( coord( id0 )=( 75, 80 ), 2400 ). happensAt( walking( id1 ), 2400 ). holdsAt( coord( id1 )=( 81, 75 ), 2400 ). % Frame number: 61 happensAt( walking( id0 ), 2440 ). holdsAt( coord( id0 )=( 75, 80 ), 2440 ). happensAt( walking( id1 ), 2440 ). holdsAt( coord( id1 )=( 81, 76 ), 2440 ). % Frame number: 62 happensAt( walking( id0 ), 2480 ). holdsAt( coord( id0 )=( 75, 80 ), 2480 ). happensAt( walking( id1 ), 2480 ). holdsAt( coord( id1 )=( 82, 76 ), 2480 ). % Frame number: 63 happensAt( walking( id0 ), 2520 ). holdsAt( coord( id0 )=( 75, 81 ), 2520 ). happensAt( walking( id1 ), 2520 ). holdsAt( coord( id1 )=( 82, 77 ), 2520 ). % Frame number: 64 happensAt( walking( id0 ), 2560 ). holdsAt( coord( id0 )=( 75, 81 ), 2560 ). happensAt( walking( id1 ), 2560 ). holdsAt( coord( id1 )=( 82, 77 ), 2560 ). % Frame number: 65 happensAt( walking( id0 ), 2600 ). holdsAt( coord( id0 )=( 74, 81 ), 2600 ). happensAt( walking( id1 ), 2600 ). holdsAt( coord( id1 )=( 82, 78 ), 2600 ). % Frame number: 66 happensAt( walking( id0 ), 2640 ). holdsAt( coord( id0 )=( 75, 81 ), 2640 ). happensAt( walking( id1 ), 2640 ). holdsAt( coord( id1 )=( 82, 78 ), 2640 ). % Frame number: 67 happensAt( walking( id0 ), 2680 ). holdsAt( coord( id0 )=( 75, 81 ), 2680 ). happensAt( walking( id1 ), 2680 ). holdsAt( coord( id1 )=( 83, 79 ), 2680 ). % Frame number: 68 happensAt( walking( id0 ), 2720 ). holdsAt( coord( id0 )=( 75, 82 ), 2720 ). happensAt( walking( id1 ), 2720 ). holdsAt( coord( id1 )=( 83, 79 ), 2720 ). % Frame number: 69 happensAt( walking( id0 ), 2760 ). holdsAt( coord( id0 )=( 79, 96 ), 2760 ). happensAt( walking( id1 ), 2760 ). holdsAt( coord( id1 )=( 94, 83 ), 2760 ). happensAt( walking( id2 ), 2760 ). holdsAt( coord( id2 )=( 78, 65 ), 2760 ). % Frame number: 70 happensAt( walking( id0 ), 2800 ). holdsAt( coord( id0 )=( 79, 96 ), 2800 ). happensAt( walking( id1 ), 2800 ). holdsAt( coord( id1 )=( 94, 83 ), 2800 ). happensAt( walking( id2 ), 2800 ). holdsAt( coord( id2 )=( 78, 65 ), 2800 ). % Frame number: 71 happensAt( walking( id0 ), 2840 ). holdsAt( coord( id0 )=( 79, 96 ), 2840 ). happensAt( walking( id1 ), 2840 ). holdsAt( coord( id1 )=( 94, 83 ), 2840 ). happensAt( walking( id2 ), 2840 ). holdsAt( coord( id2 )=( 78, 65 ), 2840 ). % Frame number: 72 happensAt( walking( id0 ), 2880 ). holdsAt( coord( id0 )=( 79, 96 ), 2880 ). happensAt( walking( id1 ), 2880 ). holdsAt( coord( id1 )=( 94, 83 ), 2880 ). happensAt( walking( id2 ), 2880 ). holdsAt( coord( id2 )=( 78, 65 ), 2880 ). % Frame number: 73 happensAt( walking( id0 ), 2920 ). holdsAt( coord( id0 )=( 79, 96 ), 2920 ). happensAt( walking( id1 ), 2920 ). holdsAt( coord( id1 )=( 94, 83 ), 2920 ). happensAt( walking( id2 ), 2920 ). holdsAt( coord( id2 )=( 78, 65 ), 2920 ). % Frame number: 74 happensAt( walking( id0 ), 2960 ). holdsAt( coord( id0 )=( 79, 96 ), 2960 ). happensAt( walking( id1 ), 2960 ). holdsAt( coord( id1 )=( 94, 83 ), 2960 ). happensAt( walking( id2 ), 2960 ). holdsAt( coord( id2 )=( 78, 65 ), 2960 ). % Frame number: 75 happensAt( walking( id0 ), 3000 ). holdsAt( coord( id0 )=( 79, 96 ), 3000 ). happensAt( walking( id1 ), 3000 ). holdsAt( coord( id1 )=( 94, 83 ), 3000 ). happensAt( walking( id2 ), 3000 ). holdsAt( coord( id2 )=( 78, 65 ), 3000 ). % Frame number: 76 happensAt( walking( id0 ), 3040 ). holdsAt( coord( id0 )=( 79, 96 ), 3040 ). happensAt( walking( id1 ), 3040 ). holdsAt( coord( id1 )=( 94, 83 ), 3040 ). happensAt( walking( id2 ), 3040 ). holdsAt( coord( id2 )=( 78, 65 ), 3040 ). % Frame number: 77 happensAt( walking( id0 ), 3080 ). holdsAt( coord( id0 )=( 79, 96 ), 3080 ). happensAt( walking( id1 ), 3080 ). holdsAt( coord( id1 )=( 94, 83 ), 3080 ). happensAt( walking( id2 ), 3080 ). holdsAt( coord( id2 )=( 78, 65 ), 3080 ). % Frame number: 78 happensAt( walking( id0 ), 3120 ). holdsAt( coord( id0 )=( 79, 96 ), 3120 ). happensAt( walking( id1 ), 3120 ). holdsAt( coord( id1 )=( 94, 83 ), 3120 ). happensAt( walking( id2 ), 3120 ). holdsAt( coord( id2 )=( 78, 65 ), 3120 ). % Frame number: 79 happensAt( walking( id0 ), 3160 ). holdsAt( coord( id0 )=( 79, 96 ), 3160 ). happensAt( walking( id1 ), 3160 ). holdsAt( coord( id1 )=( 94, 83 ), 3160 ). happensAt( walking( id2 ), 3160 ). holdsAt( coord( id2 )=( 78, 65 ), 3160 ). % Frame number: 80 happensAt( walking( id0 ), 3200 ). holdsAt( coord( id0 )=( 79, 96 ), 3200 ). happensAt( walking( id1 ), 3200 ). holdsAt( coord( id1 )=( 94, 83 ), 3200 ). happensAt( walking( id2 ), 3200 ). holdsAt( coord( id2 )=( 78, 65 ), 3200 ). % Frame number: 81 happensAt( walking( id0 ), 3240 ). holdsAt( coord( id0 )=( 79, 96 ), 3240 ). happensAt( walking( id1 ), 3240 ). holdsAt( coord( id1 )=( 94, 83 ), 3240 ). happensAt( walking( id2 ), 3240 ). holdsAt( coord( id2 )=( 78, 65 ), 3240 ). % Frame number: 82 happensAt( walking( id0 ), 3280 ). holdsAt( coord( id0 )=( 79, 96 ), 3280 ). happensAt( walking( id1 ), 3280 ). holdsAt( coord( id1 )=( 94, 83 ), 3280 ). happensAt( walking( id2 ), 3280 ). holdsAt( coord( id2 )=( 78, 65 ), 3280 ). % Frame number: 83 happensAt( walking( id0 ), 3320 ). holdsAt( coord( id0 )=( 79, 96 ), 3320 ). happensAt( walking( id1 ), 3320 ). holdsAt( coord( id1 )=( 94, 83 ), 3320 ). happensAt( walking( id2 ), 3320 ). holdsAt( coord( id2 )=( 78, 65 ), 3320 ). % Frame number: 84 happensAt( walking( id0 ), 3360 ). holdsAt( coord( id0 )=( 79, 96 ), 3360 ). happensAt( walking( id1 ), 3360 ). holdsAt( coord( id1 )=( 94, 83 ), 3360 ). happensAt( walking( id2 ), 3360 ). holdsAt( coord( id2 )=( 78, 65 ), 3360 ). % Frame number: 85 happensAt( walking( id0 ), 3400 ). holdsAt( coord( id0 )=( 79, 96 ), 3400 ). happensAt( walking( id1 ), 3400 ). holdsAt( coord( id1 )=( 94, 83 ), 3400 ). happensAt( walking( id2 ), 3400 ). holdsAt( coord( id2 )=( 78, 65 ), 3400 ). % Frame number: 86 happensAt( walking( id0 ), 3440 ). holdsAt( coord( id0 )=( 79, 96 ), 3440 ). happensAt( walking( id1 ), 3440 ). holdsAt( coord( id1 )=( 94, 83 ), 3440 ). happensAt( walking( id2 ), 3440 ). holdsAt( coord( id2 )=( 78, 65 ), 3440 ). % Frame number: 87 happensAt( walking( id0 ), 3480 ). holdsAt( coord( id0 )=( 79, 96 ), 3480 ). happensAt( walking( id1 ), 3480 ). holdsAt( coord( id1 )=( 94, 83 ), 3480 ). happensAt( walking( id2 ), 3480 ). holdsAt( coord( id2 )=( 78, 65 ), 3480 ). % Frame number: 88 happensAt( walking( id0 ), 3520 ). holdsAt( coord( id0 )=( 79, 96 ), 3520 ). happensAt( walking( id1 ), 3520 ). holdsAt( coord( id1 )=( 94, 83 ), 3520 ). happensAt( walking( id2 ), 3520 ). holdsAt( coord( id2 )=( 78, 65 ), 3520 ). % Frame number: 89 happensAt( walking( id0 ), 3560 ). holdsAt( coord( id0 )=( 79, 96 ), 3560 ). happensAt( walking( id1 ), 3560 ). holdsAt( coord( id1 )=( 94, 83 ), 3560 ). happensAt( walking( id2 ), 3560 ). holdsAt( coord( id2 )=( 78, 65 ), 3560 ). % Frame number: 90 happensAt( walking( id0 ), 3600 ). holdsAt( coord( id0 )=( 79, 96 ), 3600 ). happensAt( walking( id1 ), 3600 ). holdsAt( coord( id1 )=( 94, 83 ), 3600 ). happensAt( walking( id2 ), 3600 ). holdsAt( coord( id2 )=( 78, 65 ), 3600 ). % Frame number: 91 happensAt( walking( id0 ), 3640 ). holdsAt( coord( id0 )=( 79, 96 ), 3640 ). happensAt( walking( id1 ), 3640 ). holdsAt( coord( id1 )=( 94, 83 ), 3640 ). happensAt( walking( id2 ), 3640 ). holdsAt( coord( id2 )=( 78, 65 ), 3640 ). % Frame number: 92 happensAt( walking( id0 ), 3680 ). holdsAt( coord( id0 )=( 79, 96 ), 3680 ). happensAt( walking( id1 ), 3680 ). holdsAt( coord( id1 )=( 94, 83 ), 3680 ). happensAt( walking( id2 ), 3680 ). holdsAt( coord( id2 )=( 78, 65 ), 3680 ). % Frame number: 93 happensAt( walking( id0 ), 3720 ). holdsAt( coord( id0 )=( 79, 96 ), 3720 ). happensAt( walking( id1 ), 3720 ). holdsAt( coord( id1 )=( 94, 83 ), 3720 ). happensAt( walking( id2 ), 3720 ). holdsAt( coord( id2 )=( 78, 65 ), 3720 ). % Frame number: 94 happensAt( walking( id0 ), 3760 ). holdsAt( coord( id0 )=( 79, 96 ), 3760 ). happensAt( walking( id1 ), 3760 ). holdsAt( coord( id1 )=( 94, 83 ), 3760 ). happensAt( walking( id2 ), 3760 ). holdsAt( coord( id2 )=( 78, 65 ), 3760 ). % Frame number: 95 happensAt( walking( id0 ), 3800 ). holdsAt( coord( id0 )=( 79, 96 ), 3800 ). happensAt( walking( id1 ), 3800 ). holdsAt( coord( id1 )=( 94, 83 ), 3800 ). happensAt( walking( id2 ), 3800 ). holdsAt( coord( id2 )=( 78, 65 ), 3800 ). % Frame number: 96 happensAt( walking( id0 ), 3840 ). holdsAt( coord( id0 )=( 79, 96 ), 3840 ). happensAt( walking( id1 ), 3840 ). holdsAt( coord( id1 )=( 94, 83 ), 3840 ). happensAt( walking( id2 ), 3840 ). holdsAt( coord( id2 )=( 78, 65 ), 3840 ). % Frame number: 97 happensAt( walking( id0 ), 3880 ). holdsAt( coord( id0 )=( 79, 96 ), 3880 ). happensAt( walking( id1 ), 3880 ). holdsAt( coord( id1 )=( 94, 83 ), 3880 ). happensAt( walking( id2 ), 3880 ). holdsAt( coord( id2 )=( 78, 65 ), 3880 ). % Frame number: 98 happensAt( walking( id0 ), 3920 ). holdsAt( coord( id0 )=( 79, 96 ), 3920 ). happensAt( walking( id1 ), 3920 ). holdsAt( coord( id1 )=( 94, 83 ), 3920 ). happensAt( walking( id2 ), 3920 ). holdsAt( coord( id2 )=( 78, 65 ), 3920 ). % Frame number: 99 happensAt( walking( id0 ), 3960 ). holdsAt( coord( id0 )=( 79, 96 ), 3960 ). happensAt( walking( id1 ), 3960 ). holdsAt( coord( id1 )=( 94, 83 ), 3960 ). happensAt( walking( id2 ), 3960 ). holdsAt( coord( id2 )=( 78, 65 ), 3960 ). % Frame number: 100 happensAt( walking( id0 ), 4000 ). holdsAt( coord( id0 )=( 79, 96 ), 4000 ). happensAt( walking( id1 ), 4000 ). holdsAt( coord( id1 )=( 94, 83 ), 4000 ). happensAt( walking( id2 ), 4000 ). holdsAt( coord( id2 )=( 78, 65 ), 4000 ). % Frame number: 101 happensAt( walking( id0 ), 4040 ). holdsAt( coord( id0 )=( 79, 97 ), 4040 ). happensAt( walking( id1 ), 4040 ). holdsAt( coord( id1 )=( 94, 83 ), 4040 ). happensAt( walking( id2 ), 4040 ). holdsAt( coord( id2 )=( 77, 66 ), 4040 ). % Frame number: 102 happensAt( walking( id0 ), 4080 ). holdsAt( coord( id0 )=( 79, 97 ), 4080 ). happensAt( walking( id1 ), 4080 ). holdsAt( coord( id1 )=( 95, 82 ), 4080 ). happensAt( walking( id2 ), 4080 ). holdsAt( coord( id2 )=( 77, 66 ), 4080 ). % Frame number: 103 happensAt( walking( id0 ), 4120 ). holdsAt( coord( id0 )=( 79, 97 ), 4120 ). happensAt( walking( id1 ), 4120 ). holdsAt( coord( id1 )=( 95, 82 ), 4120 ). happensAt( walking( id2 ), 4120 ). holdsAt( coord( id2 )=( 77, 67 ), 4120 ). % Frame number: 104 happensAt( walking( id0 ), 4160 ). holdsAt( coord( id0 )=( 80, 97 ), 4160 ). happensAt( walking( id1 ), 4160 ). holdsAt( coord( id1 )=( 95, 82 ), 4160 ). happensAt( walking( id2 ), 4160 ). holdsAt( coord( id2 )=( 76, 67 ), 4160 ). % Frame number: 105 happensAt( walking( id0 ), 4200 ). holdsAt( coord( id0 )=( 80, 97 ), 4200 ). happensAt( walking( id1 ), 4200 ). holdsAt( coord( id1 )=( 95, 82 ), 4200 ). happensAt( walking( id2 ), 4200 ). holdsAt( coord( id2 )=( 76, 68 ), 4200 ). % Frame number: 106 happensAt( walking( id0 ), 4240 ). holdsAt( coord( id0 )=( 80, 98 ), 4240 ). happensAt( walking( id1 ), 4240 ). holdsAt( coord( id1 )=( 95, 82 ), 4240 ). happensAt( walking( id2 ), 4240 ). holdsAt( coord( id2 )=( 76, 72 ), 4240 ). % Frame number: 107 happensAt( walking( id0 ), 4280 ). holdsAt( coord( id0 )=( 80, 99 ), 4280 ). happensAt( walking( id1 ), 4280 ). holdsAt( coord( id1 )=( 95, 82 ), 4280 ). happensAt( walking( id2 ), 4280 ). holdsAt( coord( id2 )=( 76, 73 ), 4280 ). % Frame number: 108 happensAt( walking( id0 ), 4320 ). holdsAt( coord( id0 )=( 80, 99 ), 4320 ). happensAt( walking( id1 ), 4320 ). holdsAt( coord( id1 )=( 97, 82 ), 4320 ). happensAt( walking( id2 ), 4320 ). holdsAt( coord( id2 )=( 76, 73 ), 4320 ). happensAt( walking( id3 ), 4320 ). holdsAt( coord( id3 )=( 83, 65 ), 4320 ). % Frame number: 109 happensAt( walking( id0 ), 4360 ). holdsAt( coord( id0 )=( 81, 100 ), 4360 ). happensAt( walking( id1 ), 4360 ). holdsAt( coord( id1 )=( 98, 82 ), 4360 ). happensAt( walking( id2 ), 4360 ). holdsAt( coord( id2 )=( 76, 74 ), 4360 ). happensAt( walking( id3 ), 4360 ). holdsAt( coord( id3 )=( 79, 65 ), 4360 ). % Frame number: 110 happensAt( walking( id0 ), 4400 ). holdsAt( coord( id0 )=( 81, 101 ), 4400 ). happensAt( walking( id1 ), 4400 ). holdsAt( coord( id1 )=( 99, 82 ), 4400 ). happensAt( walking( id2 ), 4400 ). holdsAt( coord( id2 )=( 76, 74 ), 4400 ). happensAt( walking( id3 ), 4400 ). holdsAt( coord( id3 )=( 79, 66 ), 4400 ). % Frame number: 111 happensAt( walking( id0 ), 4440 ). holdsAt( coord( id0 )=( 82, 101 ), 4440 ). happensAt( walking( id1 ), 4440 ). holdsAt( coord( id1 )=( 100, 82 ), 4440 ). happensAt( walking( id2 ), 4440 ). holdsAt( coord( id2 )=( 77, 74 ), 4440 ). happensAt( walking( id3 ), 4440 ). holdsAt( coord( id3 )=( 80, 66 ), 4440 ). % Frame number: 112 happensAt( walking( id0 ), 4480 ). holdsAt( coord( id0 )=( 82, 101 ), 4480 ). happensAt( walking( id1 ), 4480 ). holdsAt( coord( id1 )=( 100, 82 ), 4480 ). happensAt( walking( id2 ), 4480 ). holdsAt( coord( id2 )=( 77, 75 ), 4480 ). happensAt( walking( id3 ), 4480 ). holdsAt( coord( id3 )=( 79, 67 ), 4480 ). % Frame number: 113 happensAt( walking( id0 ), 4520 ). holdsAt( coord( id0 )=( 82, 101 ), 4520 ). happensAt( walking( id1 ), 4520 ). holdsAt( coord( id1 )=( 101, 82 ), 4520 ). happensAt( walking( id2 ), 4520 ). holdsAt( coord( id2 )=( 76, 75 ), 4520 ). happensAt( walking( id3 ), 4520 ). holdsAt( coord( id3 )=( 79, 67 ), 4520 ). % Frame number: 114 happensAt( walking( id0 ), 4560 ). holdsAt( coord( id0 )=( 82, 101 ), 4560 ). happensAt( walking( id1 ), 4560 ). holdsAt( coord( id1 )=( 102, 82 ), 4560 ). happensAt( walking( id2 ), 4560 ). holdsAt( coord( id2 )=( 76, 76 ), 4560 ). happensAt( walking( id3 ), 4560 ). holdsAt( coord( id3 )=( 80, 67 ), 4560 ). % Frame number: 115 happensAt( walking( id0 ), 4600 ). holdsAt( coord( id0 )=( 82, 101 ), 4600 ). happensAt( walking( id1 ), 4600 ). holdsAt( coord( id1 )=( 102, 82 ), 4600 ). happensAt( walking( id2 ), 4600 ). holdsAt( coord( id2 )=( 76, 77 ), 4600 ). happensAt( walking( id3 ), 4600 ). holdsAt( coord( id3 )=( 79, 67 ), 4600 ). % Frame number: 116 happensAt( walking( id0 ), 4640 ). holdsAt( coord( id0 )=( 82, 101 ), 4640 ). happensAt( walking( id1 ), 4640 ). holdsAt( coord( id1 )=( 102, 82 ), 4640 ). happensAt( walking( id2 ), 4640 ). holdsAt( coord( id2 )=( 77, 78 ), 4640 ). happensAt( walking( id3 ), 4640 ). holdsAt( coord( id3 )=( 80, 68 ), 4640 ). % Frame number: 117 happensAt( walking( id0 ), 4680 ). holdsAt( coord( id0 )=( 82, 101 ), 4680 ). happensAt( walking( id1 ), 4680 ). holdsAt( coord( id1 )=( 102, 82 ), 4680 ). happensAt( walking( id2 ), 4680 ). holdsAt( coord( id2 )=( 77, 78 ), 4680 ). happensAt( walking( id3 ), 4680 ). holdsAt( coord( id3 )=( 80, 69 ), 4680 ). % Frame number: 118 happensAt( walking( id0 ), 4720 ). holdsAt( coord( id0 )=( 83, 102 ), 4720 ). happensAt( walking( id1 ), 4720 ). holdsAt( coord( id1 )=( 102, 82 ), 4720 ). happensAt( walking( id2 ), 4720 ). holdsAt( coord( id2 )=( 77, 79 ), 4720 ). happensAt( walking( id3 ), 4720 ). holdsAt( coord( id3 )=( 80, 70 ), 4720 ). % Frame number: 119 happensAt( walking( id0 ), 4760 ). holdsAt( coord( id0 )=( 83, 102 ), 4760 ). happensAt( walking( id1 ), 4760 ). holdsAt( coord( id1 )=( 102, 82 ), 4760 ). happensAt( walking( id2 ), 4760 ). holdsAt( coord( id2 )=( 77, 79 ), 4760 ). happensAt( walking( id3 ), 4760 ). holdsAt( coord( id3 )=( 81, 71 ), 4760 ). % Frame number: 120 happensAt( walking( id0 ), 4800 ). holdsAt( coord( id0 )=( 84, 102 ), 4800 ). happensAt( walking( id1 ), 4800 ). holdsAt( coord( id1 )=( 103, 82 ), 4800 ). happensAt( walking( id2 ), 4800 ). holdsAt( coord( id2 )=( 77, 79 ), 4800 ). happensAt( walking( id3 ), 4800 ). holdsAt( coord( id3 )=( 80, 71 ), 4800 ). % Frame number: 121 happensAt( walking( id0 ), 4840 ). holdsAt( coord( id0 )=( 85, 102 ), 4840 ). happensAt( walking( id1 ), 4840 ). holdsAt( coord( id1 )=( 103, 82 ), 4840 ). happensAt( walking( id2 ), 4840 ). holdsAt( coord( id2 )=( 77, 80 ), 4840 ). happensAt( walking( id3 ), 4840 ). holdsAt( coord( id3 )=( 81, 71 ), 4840 ). % Frame number: 122 happensAt( walking( id0 ), 4880 ). holdsAt( coord( id0 )=( 86, 102 ), 4880 ). happensAt( walking( id1 ), 4880 ). holdsAt( coord( id1 )=( 105, 82 ), 4880 ). happensAt( walking( id2 ), 4880 ). holdsAt( coord( id2 )=( 77, 80 ), 4880 ). happensAt( walking( id3 ), 4880 ). holdsAt( coord( id3 )=( 83, 73 ), 4880 ). % Frame number: 123 happensAt( walking( id0 ), 4920 ). holdsAt( coord( id0 )=( 87, 102 ), 4920 ). happensAt( walking( id1 ), 4920 ). holdsAt( coord( id1 )=( 106, 82 ), 4920 ). happensAt( walking( id2 ), 4920 ). holdsAt( coord( id2 )=( 77, 81 ), 4920 ). happensAt( walking( id3 ), 4920 ). holdsAt( coord( id3 )=( 83, 73 ), 4920 ). % Frame number: 124 happensAt( walking( id0 ), 4960 ). holdsAt( coord( id0 )=( 87, 102 ), 4960 ). happensAt( walking( id1 ), 4960 ). holdsAt( coord( id1 )=( 107, 82 ), 4960 ). happensAt( walking( id2 ), 4960 ). holdsAt( coord( id2 )=( 77, 83 ), 4960 ). happensAt( walking( id3 ), 4960 ). holdsAt( coord( id3 )=( 83, 73 ), 4960 ). % Frame number: 125 happensAt( walking( id0 ), 5000 ). holdsAt( coord( id0 )=( 87, 102 ), 5000 ). happensAt( walking( id1 ), 5000 ). holdsAt( coord( id1 )=( 108, 82 ), 5000 ). happensAt( walking( id2 ), 5000 ). holdsAt( coord( id2 )=( 76, 85 ), 5000 ). happensAt( walking( id3 ), 5000 ). holdsAt( coord( id3 )=( 83, 73 ), 5000 ). % Frame number: 126 happensAt( walking( id0 ), 5040 ). holdsAt( coord( id0 )=( 88, 103 ), 5040 ). happensAt( walking( id1 ), 5040 ). holdsAt( coord( id1 )=( 109, 82 ), 5040 ). happensAt( walking( id2 ), 5040 ). holdsAt( coord( id2 )=( 76, 86 ), 5040 ). happensAt( walking( id3 ), 5040 ). holdsAt( coord( id3 )=( 84, 74 ), 5040 ). % Frame number: 127 happensAt( walking( id0 ), 5080 ). holdsAt( coord( id0 )=( 89, 103 ), 5080 ). happensAt( walking( id1 ), 5080 ). holdsAt( coord( id1 )=( 110, 82 ), 5080 ). happensAt( walking( id2 ), 5080 ). holdsAt( coord( id2 )=( 76, 86 ), 5080 ). happensAt( walking( id3 ), 5080 ). holdsAt( coord( id3 )=( 84, 74 ), 5080 ). % Frame number: 128 happensAt( walking( id0 ), 5120 ). holdsAt( coord( id0 )=( 89, 103 ), 5120 ). happensAt( walking( id1 ), 5120 ). holdsAt( coord( id1 )=( 110, 82 ), 5120 ). happensAt( walking( id2 ), 5120 ). holdsAt( coord( id2 )=( 76, 87 ), 5120 ). happensAt( walking( id3 ), 5120 ). holdsAt( coord( id3 )=( 84, 74 ), 5120 ). % Frame number: 129 happensAt( walking( id0 ), 5160 ). holdsAt( coord( id0 )=( 89, 103 ), 5160 ). happensAt( walking( id1 ), 5160 ). holdsAt( coord( id1 )=( 110, 82 ), 5160 ). happensAt( walking( id2 ), 5160 ). holdsAt( coord( id2 )=( 76, 87 ), 5160 ). happensAt( walking( id3 ), 5160 ). holdsAt( coord( id3 )=( 84, 75 ), 5160 ). % Frame number: 130 happensAt( walking( id0 ), 5200 ). holdsAt( coord( id0 )=( 89, 103 ), 5200 ). happensAt( walking( id1 ), 5200 ). holdsAt( coord( id1 )=( 111, 82 ), 5200 ). happensAt( walking( id2 ), 5200 ). holdsAt( coord( id2 )=( 76, 88 ), 5200 ). happensAt( walking( id3 ), 5200 ). holdsAt( coord( id3 )=( 85, 76 ), 5200 ). % Frame number: 131 happensAt( walking( id0 ), 5240 ). holdsAt( coord( id0 )=( 89, 104 ), 5240 ). happensAt( walking( id1 ), 5240 ). holdsAt( coord( id1 )=( 111, 81 ), 5240 ). happensAt( walking( id2 ), 5240 ). holdsAt( coord( id2 )=( 76, 88 ), 5240 ). happensAt( walking( id3 ), 5240 ). holdsAt( coord( id3 )=( 85, 77 ), 5240 ). % Frame number: 132 happensAt( walking( id0 ), 5280 ). holdsAt( coord( id0 )=( 89, 104 ), 5280 ). happensAt( walking( id1 ), 5280 ). holdsAt( coord( id1 )=( 112, 81 ), 5280 ). happensAt( walking( id2 ), 5280 ). holdsAt( coord( id2 )=( 76, 88 ), 5280 ). happensAt( walking( id3 ), 5280 ). holdsAt( coord( id3 )=( 86, 77 ), 5280 ). % Frame number: 133 happensAt( walking( id0 ), 5320 ). holdsAt( coord( id0 )=( 90, 105 ), 5320 ). happensAt( walking( id1 ), 5320 ). holdsAt( coord( id1 )=( 112, 81 ), 5320 ). happensAt( walking( id2 ), 5320 ). holdsAt( coord( id2 )=( 76, 89 ), 5320 ). happensAt( walking( id3 ), 5320 ). holdsAt( coord( id3 )=( 87, 79 ), 5320 ). % Frame number: 134 happensAt( walking( id0 ), 5360 ). holdsAt( coord( id0 )=( 90, 105 ), 5360 ). happensAt( walking( id1 ), 5360 ). holdsAt( coord( id1 )=( 112, 81 ), 5360 ). happensAt( walking( id2 ), 5360 ). holdsAt( coord( id2 )=( 76, 89 ), 5360 ). happensAt( walking( id3 ), 5360 ). holdsAt( coord( id3 )=( 89, 79 ), 5360 ). % Frame number: 135 happensAt( walking( id0 ), 5400 ). holdsAt( coord( id0 )=( 91, 106 ), 5400 ). happensAt( walking( id1 ), 5400 ). holdsAt( coord( id1 )=( 113, 81 ), 5400 ). happensAt( walking( id2 ), 5400 ). holdsAt( coord( id2 )=( 76, 90 ), 5400 ). happensAt( walking( id3 ), 5400 ). holdsAt( coord( id3 )=( 89, 78 ), 5400 ). % Frame number: 136 happensAt( walking( id0 ), 5440 ). holdsAt( coord( id0 )=( 92, 106 ), 5440 ). happensAt( walking( id1 ), 5440 ). holdsAt( coord( id1 )=( 113, 81 ), 5440 ). happensAt( walking( id2 ), 5440 ). holdsAt( coord( id2 )=( 76, 90 ), 5440 ). happensAt( walking( id3 ), 5440 ). holdsAt( coord( id3 )=( 89, 78 ), 5440 ). % Frame number: 137 happensAt( walking( id0 ), 5480 ). holdsAt( coord( id0 )=( 93, 106 ), 5480 ). happensAt( walking( id1 ), 5480 ). holdsAt( coord( id1 )=( 113, 81 ), 5480 ). happensAt( walking( id2 ), 5480 ). holdsAt( coord( id2 )=( 77, 90 ), 5480 ). happensAt( walking( id3 ), 5480 ). holdsAt( coord( id3 )=( 90, 78 ), 5480 ). % Frame number: 138 happensAt( walking( id0 ), 5520 ). holdsAt( coord( id0 )=( 94, 106 ), 5520 ). happensAt( walking( id1 ), 5520 ). holdsAt( coord( id1 )=( 114, 82 ), 5520 ). happensAt( walking( id2 ), 5520 ). holdsAt( coord( id2 )=( 77, 91 ), 5520 ). happensAt( walking( id3 ), 5520 ). holdsAt( coord( id3 )=( 91, 79 ), 5520 ). % Frame number: 139 happensAt( walking( id0 ), 5560 ). holdsAt( coord( id0 )=( 95, 106 ), 5560 ). happensAt( walking( id1 ), 5560 ). holdsAt( coord( id1 )=( 116, 82 ), 5560 ). happensAt( walking( id2 ), 5560 ). holdsAt( coord( id2 )=( 77, 92 ), 5560 ). happensAt( walking( id3 ), 5560 ). holdsAt( coord( id3 )=( 91, 79 ), 5560 ). % Frame number: 140 happensAt( walking( id0 ), 5600 ). holdsAt( coord( id0 )=( 95, 106 ), 5600 ). happensAt( walking( id1 ), 5600 ). holdsAt( coord( id1 )=( 116, 82 ), 5600 ). happensAt( walking( id2 ), 5600 ). holdsAt( coord( id2 )=( 76, 92 ), 5600 ). happensAt( walking( id3 ), 5600 ). holdsAt( coord( id3 )=( 91, 79 ), 5600 ). % Frame number: 141 happensAt( walking( id0 ), 5640 ). holdsAt( coord( id0 )=( 95, 106 ), 5640 ). happensAt( walking( id1 ), 5640 ). holdsAt( coord( id1 )=( 117, 82 ), 5640 ). happensAt( walking( id2 ), 5640 ). holdsAt( coord( id2 )=( 75, 93 ), 5640 ). happensAt( walking( id3 ), 5640 ). holdsAt( coord( id3 )=( 91, 79 ), 5640 ). % Frame number: 142 happensAt( walking( id0 ), 5680 ). holdsAt( coord( id0 )=( 95, 106 ), 5680 ). happensAt( walking( id1 ), 5680 ). holdsAt( coord( id1 )=( 118, 83 ), 5680 ). happensAt( walking( id2 ), 5680 ). holdsAt( coord( id2 )=( 75, 94 ), 5680 ). happensAt( walking( id3 ), 5680 ). holdsAt( coord( id3 )=( 91, 79 ), 5680 ). % Frame number: 143 happensAt( walking( id0 ), 5720 ). holdsAt( coord( id0 )=( 95, 106 ), 5720 ). happensAt( walking( id1 ), 5720 ). holdsAt( coord( id1 )=( 118, 83 ), 5720 ). happensAt( walking( id2 ), 5720 ). holdsAt( coord( id2 )=( 73, 95 ), 5720 ). happensAt( walking( id3 ), 5720 ). holdsAt( coord( id3 )=( 91, 79 ), 5720 ). % Frame number: 144 happensAt( walking( id0 ), 5760 ). holdsAt( coord( id0 )=( 95, 106 ), 5760 ). happensAt( walking( id1 ), 5760 ). holdsAt( coord( id1 )=( 119, 83 ), 5760 ). happensAt( walking( id2 ), 5760 ). holdsAt( coord( id2 )=( 73, 95 ), 5760 ). happensAt( walking( id3 ), 5760 ). holdsAt( coord( id3 )=( 91, 79 ), 5760 ). % Frame number: 145 happensAt( walking( id0 ), 5800 ). holdsAt( coord( id0 )=( 95, 107 ), 5800 ). happensAt( walking( id1 ), 5800 ). holdsAt( coord( id1 )=( 119, 83 ), 5800 ). happensAt( walking( id2 ), 5800 ). holdsAt( coord( id2 )=( 74, 95 ), 5800 ). happensAt( walking( id3 ), 5800 ). holdsAt( coord( id3 )=( 92, 79 ), 5800 ). % Frame number: 146 happensAt( walking( id0 ), 5840 ). holdsAt( coord( id0 )=( 96, 107 ), 5840 ). happensAt( walking( id1 ), 5840 ). holdsAt( coord( id1 )=( 119, 83 ), 5840 ). happensAt( walking( id2 ), 5840 ). holdsAt( coord( id2 )=( 74, 95 ), 5840 ). happensAt( walking( id3 ), 5840 ). holdsAt( coord( id3 )=( 94, 79 ), 5840 ). % Frame number: 147 happensAt( walking( id0 ), 5880 ). holdsAt( coord( id0 )=( 98, 106 ), 5880 ). happensAt( walking( id1 ), 5880 ). holdsAt( coord( id1 )=( 120, 83 ), 5880 ). happensAt( walking( id2 ), 5880 ). holdsAt( coord( id2 )=( 74, 96 ), 5880 ). happensAt( walking( id3 ), 5880 ). holdsAt( coord( id3 )=( 95, 79 ), 5880 ). % Frame number: 148 happensAt( walking( id0 ), 5920 ). holdsAt( coord( id0 )=( 100, 107 ), 5920 ). happensAt( walking( id1 ), 5920 ). holdsAt( coord( id1 )=( 120, 83 ), 5920 ). happensAt( walking( id2 ), 5920 ). holdsAt( coord( id2 )=( 75, 96 ), 5920 ). happensAt( walking( id3 ), 5920 ). holdsAt( coord( id3 )=( 95, 79 ), 5920 ). % Frame number: 149 happensAt( walking( id0 ), 5960 ). holdsAt( coord( id0 )=( 101, 107 ), 5960 ). happensAt( walking( id1 ), 5960 ). holdsAt( coord( id1 )=( 120, 83 ), 5960 ). happensAt( walking( id2 ), 5960 ). holdsAt( coord( id2 )=( 75, 98 ), 5960 ). happensAt( walking( id3 ), 5960 ). holdsAt( coord( id3 )=( 96, 79 ), 5960 ). % Frame number: 150 happensAt( walking( id0 ), 6000 ). holdsAt( coord( id0 )=( 101, 107 ), 6000 ). happensAt( walking( id1 ), 6000 ). holdsAt( coord( id1 )=( 120, 83 ), 6000 ). happensAt( walking( id2 ), 6000 ). holdsAt( coord( id2 )=( 78, 101 ), 6000 ). happensAt( walking( id3 ), 6000 ). holdsAt( coord( id3 )=( 96, 79 ), 6000 ). % Frame number: 151 happensAt( walking( id0 ), 6040 ). holdsAt( coord( id0 )=( 102, 107 ), 6040 ). happensAt( walking( id1 ), 6040 ). holdsAt( coord( id1 )=( 121, 83 ), 6040 ). happensAt( walking( id2 ), 6040 ). holdsAt( coord( id2 )=( 78, 102 ), 6040 ). happensAt( walking( id3 ), 6040 ). holdsAt( coord( id3 )=( 97, 79 ), 6040 ). % Frame number: 152 happensAt( walking( id0 ), 6080 ). holdsAt( coord( id0 )=( 103, 107 ), 6080 ). happensAt( walking( id1 ), 6080 ). holdsAt( coord( id1 )=( 123, 83 ), 6080 ). happensAt( walking( id2 ), 6080 ). holdsAt( coord( id2 )=( 79, 103 ), 6080 ). happensAt( walking( id3 ), 6080 ). holdsAt( coord( id3 )=( 98, 79 ), 6080 ). % Frame number: 153 happensAt( walking( id0 ), 6120 ). holdsAt( coord( id0 )=( 104, 107 ), 6120 ). happensAt( walking( id1 ), 6120 ). holdsAt( coord( id1 )=( 124, 83 ), 6120 ). happensAt( walking( id2 ), 6120 ). holdsAt( coord( id2 )=( 79, 104 ), 6120 ). happensAt( walking( id3 ), 6120 ). holdsAt( coord( id3 )=( 98, 79 ), 6120 ). % Frame number: 154 happensAt( walking( id0 ), 6160 ). holdsAt( coord( id0 )=( 104, 107 ), 6160 ). happensAt( walking( id1 ), 6160 ). holdsAt( coord( id1 )=( 126, 83 ), 6160 ). happensAt( walking( id2 ), 6160 ). holdsAt( coord( id2 )=( 80, 105 ), 6160 ). happensAt( walking( id3 ), 6160 ). holdsAt( coord( id3 )=( 99, 79 ), 6160 ). % Frame number: 155 happensAt( walking( id0 ), 6200 ). holdsAt( coord( id0 )=( 104, 107 ), 6200 ). happensAt( walking( id1 ), 6200 ). holdsAt( coord( id1 )=( 127, 83 ), 6200 ). happensAt( walking( id2 ), 6200 ). holdsAt( coord( id2 )=( 80, 105 ), 6200 ). happensAt( walking( id3 ), 6200 ). holdsAt( coord( id3 )=( 99, 79 ), 6200 ). % Frame number: 156 happensAt( walking( id0 ), 6240 ). holdsAt( coord( id0 )=( 104, 107 ), 6240 ). happensAt( walking( id1 ), 6240 ). holdsAt( coord( id1 )=( 128, 83 ), 6240 ). happensAt( walking( id2 ), 6240 ). holdsAt( coord( id2 )=( 80, 105 ), 6240 ). happensAt( walking( id3 ), 6240 ). holdsAt( coord( id3 )=( 99, 80 ), 6240 ). % Frame number: 157 happensAt( walking( id0 ), 6280 ). holdsAt( coord( id0 )=( 104, 107 ), 6280 ). happensAt( walking( id1 ), 6280 ). holdsAt( coord( id1 )=( 129, 83 ), 6280 ). happensAt( walking( id2 ), 6280 ). holdsAt( coord( id2 )=( 80, 105 ), 6280 ). happensAt( walking( id3 ), 6280 ). holdsAt( coord( id3 )=( 99, 81 ), 6280 ). % Frame number: 158 happensAt( walking( id0 ), 6320 ). holdsAt( coord( id0 )=( 104, 108 ), 6320 ). happensAt( walking( id1 ), 6320 ). holdsAt( coord( id1 )=( 130, 84 ), 6320 ). happensAt( walking( id2 ), 6320 ). holdsAt( coord( id2 )=( 80, 106 ), 6320 ). happensAt( walking( id3 ), 6320 ). holdsAt( coord( id3 )=( 99, 81 ), 6320 ). % Frame number: 159 happensAt( walking( id0 ), 6360 ). holdsAt( coord( id0 )=( 105, 108 ), 6360 ). happensAt( walking( id1 ), 6360 ). holdsAt( coord( id1 )=( 130, 84 ), 6360 ). happensAt( walking( id2 ), 6360 ). holdsAt( coord( id2 )=( 80, 106 ), 6360 ). happensAt( walking( id3 ), 6360 ). holdsAt( coord( id3 )=( 100, 81 ), 6360 ). % Frame number: 160 happensAt( walking( id0 ), 6400 ). holdsAt( coord( id0 )=( 106, 109 ), 6400 ). happensAt( walking( id1 ), 6400 ). holdsAt( coord( id1 )=( 130, 84 ), 6400 ). happensAt( walking( id2 ), 6400 ). holdsAt( coord( id2 )=( 80, 106 ), 6400 ). happensAt( walking( id3 ), 6400 ). holdsAt( coord( id3 )=( 101, 81 ), 6400 ). % Frame number: 161 happensAt( walking( id0 ), 6440 ). holdsAt( coord( id0 )=( 107, 109 ), 6440 ). happensAt( walking( id1 ), 6440 ). holdsAt( coord( id1 )=( 131, 84 ), 6440 ). happensAt( walking( id2 ), 6440 ). holdsAt( coord( id2 )=( 81, 106 ), 6440 ). happensAt( walking( id3 ), 6440 ). holdsAt( coord( id3 )=( 102, 81 ), 6440 ). % Frame number: 162 happensAt( walking( id0 ), 6480 ). holdsAt( coord( id0 )=( 108, 109 ), 6480 ). happensAt( walking( id1 ), 6480 ). holdsAt( coord( id1 )=( 131, 84 ), 6480 ). happensAt( walking( id2 ), 6480 ). holdsAt( coord( id2 )=( 81, 106 ), 6480 ). happensAt( walking( id3 ), 6480 ). holdsAt( coord( id3 )=( 103, 81 ), 6480 ). % Frame number: 163 happensAt( walking( id0 ), 6520 ). holdsAt( coord( id0 )=( 109, 110 ), 6520 ). happensAt( walking( id1 ), 6520 ). holdsAt( coord( id1 )=( 131, 84 ), 6520 ). happensAt( walking( id2 ), 6520 ). holdsAt( coord( id2 )=( 82, 107 ), 6520 ). happensAt( walking( id3 ), 6520 ). holdsAt( coord( id3 )=( 104, 81 ), 6520 ). % Frame number: 164 happensAt( walking( id0 ), 6560 ). holdsAt( coord( id0 )=( 110, 110 ), 6560 ). happensAt( walking( id1 ), 6560 ). holdsAt( coord( id1 )=( 131, 84 ), 6560 ). happensAt( walking( id2 ), 6560 ). holdsAt( coord( id2 )=( 83, 107 ), 6560 ). happensAt( walking( id3 ), 6560 ). holdsAt( coord( id3 )=( 104, 81 ), 6560 ). % Frame number: 165 happensAt( walking( id0 ), 6600 ). holdsAt( coord( id0 )=( 111, 110 ), 6600 ). happensAt( walking( id1 ), 6600 ). holdsAt( coord( id1 )=( 131, 85 ), 6600 ). happensAt( walking( id2 ), 6600 ). holdsAt( coord( id2 )=( 84, 107 ), 6600 ). happensAt( walking( id3 ), 6600 ). holdsAt( coord( id3 )=( 105, 81 ), 6600 ). % Frame number: 166 happensAt( walking( id0 ), 6640 ). holdsAt( coord( id0 )=( 111, 110 ), 6640 ). happensAt( walking( id1 ), 6640 ). holdsAt( coord( id1 )=( 131, 86 ), 6640 ). happensAt( walking( id2 ), 6640 ). holdsAt( coord( id2 )=( 85, 107 ), 6640 ). happensAt( walking( id3 ), 6640 ). holdsAt( coord( id3 )=( 105, 81 ), 6640 ). % Frame number: 167 happensAt( walking( id0 ), 6680 ). holdsAt( coord( id0 )=( 111, 110 ), 6680 ). happensAt( walking( id1 ), 6680 ). holdsAt( coord( id1 )=( 132, 86 ), 6680 ). happensAt( walking( id2 ), 6680 ). holdsAt( coord( id2 )=( 86, 108 ), 6680 ). happensAt( walking( id3 ), 6680 ). holdsAt( coord( id3 )=( 105, 81 ), 6680 ). % Frame number: 168 happensAt( walking( id0 ), 6720 ). holdsAt( coord( id0 )=( 111, 110 ), 6720 ). happensAt( walking( id1 ), 6720 ). holdsAt( coord( id1 )=( 133, 87 ), 6720 ). happensAt( walking( id2 ), 6720 ). holdsAt( coord( id2 )=( 87, 108 ), 6720 ). happensAt( walking( id3 ), 6720 ). holdsAt( coord( id3 )=( 105, 81 ), 6720 ). % Frame number: 169 happensAt( walking( id0 ), 6760 ). holdsAt( coord( id0 )=( 111, 110 ), 6760 ). happensAt( walking( id1 ), 6760 ). holdsAt( coord( id1 )=( 134, 87 ), 6760 ). happensAt( walking( id2 ), 6760 ). holdsAt( coord( id2 )=( 87, 108 ), 6760 ). happensAt( walking( id3 ), 6760 ). holdsAt( coord( id3 )=( 105, 81 ), 6760 ). % Frame number: 170 happensAt( walking( id0 ), 6800 ). holdsAt( coord( id0 )=( 112, 110 ), 6800 ). happensAt( walking( id1 ), 6800 ). holdsAt( coord( id1 )=( 136, 88 ), 6800 ). happensAt( walking( id2 ), 6800 ). holdsAt( coord( id2 )=( 87, 109 ), 6800 ). happensAt( walking( id3 ), 6800 ). holdsAt( coord( id3 )=( 105, 81 ), 6800 ). % Frame number: 171 happensAt( walking( id0 ), 6840 ). holdsAt( coord( id0 )=( 112, 110 ), 6840 ). happensAt( walking( id1 ), 6840 ). holdsAt( coord( id1 )=( 137, 89 ), 6840 ). happensAt( walking( id2 ), 6840 ). holdsAt( coord( id2 )=( 87, 109 ), 6840 ). happensAt( walking( id3 ), 6840 ). holdsAt( coord( id3 )=( 106, 81 ), 6840 ). % Frame number: 172 happensAt( walking( id0 ), 6880 ). holdsAt( coord( id0 )=( 113, 110 ), 6880 ). happensAt( walking( id1 ), 6880 ). holdsAt( coord( id1 )=( 138, 90 ), 6880 ). happensAt( walking( id2 ), 6880 ). holdsAt( coord( id2 )=( 87, 109 ), 6880 ). happensAt( walking( id3 ), 6880 ). holdsAt( coord( id3 )=( 107, 81 ), 6880 ). % Frame number: 173 happensAt( walking( id0 ), 6920 ). holdsAt( coord( id0 )=( 114, 110 ), 6920 ). happensAt( walking( id1 ), 6920 ). holdsAt( coord( id1 )=( 138, 90 ), 6920 ). happensAt( walking( id2 ), 6920 ). holdsAt( coord( id2 )=( 87, 109 ), 6920 ). happensAt( walking( id3 ), 6920 ). holdsAt( coord( id3 )=( 108, 81 ), 6920 ). % Frame number: 174 happensAt( walking( id0 ), 6960 ). holdsAt( coord( id0 )=( 116, 110 ), 6960 ). happensAt( walking( id1 ), 6960 ). holdsAt( coord( id1 )=( 138, 90 ), 6960 ). happensAt( walking( id2 ), 6960 ). holdsAt( coord( id2 )=( 87, 109 ), 6960 ). happensAt( walking( id3 ), 6960 ). holdsAt( coord( id3 )=( 109, 81 ), 6960 ). % Frame number: 175 happensAt( walking( id0 ), 7000 ). holdsAt( coord( id0 )=( 118, 111 ), 7000 ). happensAt( walking( id1 ), 7000 ). holdsAt( coord( id1 )=( 139, 90 ), 7000 ). happensAt( walking( id2 ), 7000 ). holdsAt( coord( id2 )=( 88, 110 ), 7000 ). happensAt( walking( id3 ), 7000 ). holdsAt( coord( id3 )=( 110, 81 ), 7000 ). % Frame number: 176 happensAt( walking( id0 ), 7040 ). holdsAt( coord( id0 )=( 119, 111 ), 7040 ). happensAt( walking( id1 ), 7040 ). holdsAt( coord( id1 )=( 139, 90 ), 7040 ). happensAt( walking( id2 ), 7040 ). holdsAt( coord( id2 )=( 88, 111 ), 7040 ). happensAt( walking( id3 ), 7040 ). holdsAt( coord( id3 )=( 112, 81 ), 7040 ). % Frame number: 177 happensAt( walking( id0 ), 7080 ). holdsAt( coord( id0 )=( 120, 111 ), 7080 ). happensAt( walking( id1 ), 7080 ). holdsAt( coord( id1 )=( 139, 91 ), 7080 ). happensAt( walking( id2 ), 7080 ). holdsAt( coord( id2 )=( 88, 113 ), 7080 ). happensAt( walking( id3 ), 7080 ). holdsAt( coord( id3 )=( 112, 81 ), 7080 ). % Frame number: 178 happensAt( walking( id0 ), 7120 ). holdsAt( coord( id0 )=( 121, 111 ), 7120 ). happensAt( walking( id1 ), 7120 ). holdsAt( coord( id1 )=( 139, 91 ), 7120 ). happensAt( walking( id2 ), 7120 ). holdsAt( coord( id2 )=( 89, 114 ), 7120 ). happensAt( walking( id3 ), 7120 ). holdsAt( coord( id3 )=( 112, 81 ), 7120 ). % Frame number: 179 happensAt( walking( id0 ), 7160 ). holdsAt( coord( id0 )=( 121, 111 ), 7160 ). happensAt( walking( id1 ), 7160 ). holdsAt( coord( id1 )=( 140, 91 ), 7160 ). happensAt( walking( id2 ), 7160 ). holdsAt( coord( id2 )=( 90, 114 ), 7160 ). happensAt( walking( id3 ), 7160 ). holdsAt( coord( id3 )=( 113, 81 ), 7160 ). % Frame number: 180 happensAt( walking( id0 ), 7200 ). holdsAt( coord( id0 )=( 122, 111 ), 7200 ). happensAt( walking( id1 ), 7200 ). holdsAt( coord( id1 )=( 140, 91 ), 7200 ). happensAt( walking( id2 ), 7200 ). holdsAt( coord( id2 )=( 91, 114 ), 7200 ). happensAt( walking( id3 ), 7200 ). holdsAt( coord( id3 )=( 113, 81 ), 7200 ). % Frame number: 181 happensAt( walking( id0 ), 7240 ). holdsAt( coord( id0 )=( 122, 111 ), 7240 ). happensAt( walking( id1 ), 7240 ). holdsAt( coord( id1 )=( 140, 92 ), 7240 ). happensAt( walking( id2 ), 7240 ). holdsAt( coord( id2 )=( 92, 114 ), 7240 ). happensAt( walking( id3 ), 7240 ). holdsAt( coord( id3 )=( 113, 82 ), 7240 ). % Frame number: 182 happensAt( walking( id0 ), 7280 ). holdsAt( coord( id0 )=( 122, 111 ), 7280 ). happensAt( walking( id1 ), 7280 ). holdsAt( coord( id1 )=( 142, 92 ), 7280 ). happensAt( walking( id2 ), 7280 ). holdsAt( coord( id2 )=( 92, 114 ), 7280 ). happensAt( walking( id3 ), 7280 ). holdsAt( coord( id3 )=( 114, 82 ), 7280 ). % Frame number: 183 happensAt( walking( id0 ), 7320 ). holdsAt( coord( id0 )=( 122, 112 ), 7320 ). happensAt( walking( id1 ), 7320 ). holdsAt( coord( id1 )=( 144, 92 ), 7320 ). happensAt( walking( id2 ), 7320 ). holdsAt( coord( id2 )=( 92, 115 ), 7320 ). happensAt( walking( id3 ), 7320 ). holdsAt( coord( id3 )=( 114, 82 ), 7320 ). % Frame number: 184 happensAt( walking( id0 ), 7360 ). holdsAt( coord( id0 )=( 123, 112 ), 7360 ). happensAt( walking( id1 ), 7360 ). holdsAt( coord( id1 )=( 146, 92 ), 7360 ). happensAt( walking( id2 ), 7360 ). holdsAt( coord( id2 )=( 92, 115 ), 7360 ). happensAt( walking( id3 ), 7360 ). holdsAt( coord( id3 )=( 115, 84 ), 7360 ). % Frame number: 185 happensAt( walking( id0 ), 7400 ). holdsAt( coord( id0 )=( 123, 113 ), 7400 ). happensAt( walking( id1 ), 7400 ). holdsAt( coord( id1 )=( 147, 94 ), 7400 ). happensAt( walking( id2 ), 7400 ). holdsAt( coord( id2 )=( 92, 115 ), 7400 ). happensAt( walking( id3 ), 7400 ). holdsAt( coord( id3 )=( 115, 84 ), 7400 ). % Frame number: 186 happensAt( walking( id0 ), 7440 ). holdsAt( coord( id0 )=( 123, 114 ), 7440 ). happensAt( walking( id1 ), 7440 ). holdsAt( coord( id1 )=( 148, 94 ), 7440 ). happensAt( walking( id2 ), 7440 ). holdsAt( coord( id2 )=( 93, 115 ), 7440 ). happensAt( walking( id3 ), 7440 ). holdsAt( coord( id3 )=( 117, 84 ), 7440 ). % Frame number: 187 happensAt( walking( id0 ), 7480 ). holdsAt( coord( id0 )=( 124, 114 ), 7480 ). happensAt( walking( id1 ), 7480 ). holdsAt( coord( id1 )=( 149, 95 ), 7480 ). happensAt( walking( id2 ), 7480 ). holdsAt( coord( id2 )=( 93, 115 ), 7480 ). happensAt( walking( id3 ), 7480 ). holdsAt( coord( id3 )=( 119, 85 ), 7480 ). % Frame number: 188 happensAt( walking( id0 ), 7520 ). holdsAt( coord( id0 )=( 126, 115 ), 7520 ). happensAt( walking( id1 ), 7520 ). holdsAt( coord( id1 )=( 150, 96 ), 7520 ). happensAt( walking( id2 ), 7520 ). holdsAt( coord( id2 )=( 93, 115 ), 7520 ). happensAt( walking( id3 ), 7520 ). holdsAt( coord( id3 )=( 119, 83 ), 7520 ). % Frame number: 189 happensAt( walking( id0 ), 7560 ). holdsAt( coord( id0 )=( 127, 115 ), 7560 ). happensAt( walking( id1 ), 7560 ). holdsAt( coord( id1 )=( 151, 96 ), 7560 ). happensAt( walking( id2 ), 7560 ). holdsAt( coord( id2 )=( 95, 115 ), 7560 ). happensAt( walking( id3 ), 7560 ). holdsAt( coord( id3 )=( 118, 84 ), 7560 ). % Frame number: 190 happensAt( walking( id0 ), 7600 ). holdsAt( coord( id0 )=( 128, 116 ), 7600 ). happensAt( walking( id1 ), 7600 ). holdsAt( coord( id1 )=( 151, 97 ), 7600 ). happensAt( walking( id2 ), 7600 ). holdsAt( coord( id2 )=( 97, 115 ), 7600 ). happensAt( walking( id3 ), 7600 ). holdsAt( coord( id3 )=( 117, 82 ), 7600 ). % Frame number: 191 happensAt( walking( id0 ), 7640 ). holdsAt( coord( id0 )=( 129, 116 ), 7640 ). happensAt( walking( id1 ), 7640 ). holdsAt( coord( id1 )=( 152, 97 ), 7640 ). happensAt( walking( id2 ), 7640 ). holdsAt( coord( id2 )=( 98, 116 ), 7640 ). happensAt( walking( id3 ), 7640 ). holdsAt( coord( id3 )=( 118, 82 ), 7640 ). % Frame number: 192 happensAt( walking( id0 ), 7680 ). holdsAt( coord( id0 )=( 130, 116 ), 7680 ). happensAt( walking( id1 ), 7680 ). holdsAt( coord( id1 )=( 152, 97 ), 7680 ). happensAt( walking( id2 ), 7680 ). holdsAt( coord( id2 )=( 99, 116 ), 7680 ). happensAt( walking( id3 ), 7680 ). holdsAt( coord( id3 )=( 118, 82 ), 7680 ). % Frame number: 193 happensAt( walking( id0 ), 7720 ). holdsAt( coord( id0 )=( 130, 117 ), 7720 ). happensAt( walking( id1 ), 7720 ). holdsAt( coord( id1 )=( 152, 97 ), 7720 ). happensAt( walking( id2 ), 7720 ). holdsAt( coord( id2 )=( 100, 116 ), 7720 ). happensAt( walking( id3 ), 7720 ). holdsAt( coord( id3 )=( 118, 82 ), 7720 ). % Frame number: 194 happensAt( walking( id0 ), 7760 ). holdsAt( coord( id0 )=( 130, 117 ), 7760 ). happensAt( walking( id1 ), 7760 ). holdsAt( coord( id1 )=( 152, 97 ), 7760 ). happensAt( walking( id2 ), 7760 ). holdsAt( coord( id2 )=( 101, 117 ), 7760 ). happensAt( walking( id3 ), 7760 ). holdsAt( coord( id3 )=( 119, 82 ), 7760 ). % Frame number: 195 happensAt( walking( id0 ), 7800 ). holdsAt( coord( id0 )=( 131, 117 ), 7800 ). happensAt( walking( id1 ), 7800 ). holdsAt( coord( id1 )=( 152, 97 ), 7800 ). happensAt( walking( id2 ), 7800 ). holdsAt( coord( id2 )=( 101, 117 ), 7800 ). happensAt( walking( id3 ), 7800 ). holdsAt( coord( id3 )=( 120, 82 ), 7800 ). % Frame number: 196 happensAt( walking( id0 ), 7840 ). holdsAt( coord( id0 )=( 131, 117 ), 7840 ). happensAt( walking( id1 ), 7840 ). holdsAt( coord( id1 )=( 153, 98 ), 7840 ). happensAt( walking( id2 ), 7840 ). holdsAt( coord( id2 )=( 102, 117 ), 7840 ). happensAt( walking( id3 ), 7840 ). holdsAt( coord( id3 )=( 120, 82 ), 7840 ). % Frame number: 197 happensAt( walking( id0 ), 7880 ). holdsAt( coord( id0 )=( 131, 117 ), 7880 ). happensAt( walking( id1 ), 7880 ). holdsAt( coord( id1 )=( 153, 100 ), 7880 ). happensAt( walking( id2 ), 7880 ). holdsAt( coord( id2 )=( 102, 117 ), 7880 ). happensAt( walking( id3 ), 7880 ). holdsAt( coord( id3 )=( 121, 82 ), 7880 ). % Frame number: 198 happensAt( walking( id0 ), 7920 ). holdsAt( coord( id0 )=( 131, 117 ), 7920 ). happensAt( walking( id1 ), 7920 ). holdsAt( coord( id1 )=( 154, 101 ), 7920 ). happensAt( walking( id2 ), 7920 ). holdsAt( coord( id2 )=( 102, 117 ), 7920 ). happensAt( walking( id3 ), 7920 ). holdsAt( coord( id3 )=( 122, 82 ), 7920 ). % Frame number: 199 happensAt( walking( id0 ), 7960 ). holdsAt( coord( id0 )=( 132, 117 ), 7960 ). happensAt( walking( id1 ), 7960 ). holdsAt( coord( id1 )=( 155, 103 ), 7960 ). happensAt( walking( id2 ), 7960 ). holdsAt( coord( id2 )=( 102, 117 ), 7960 ). happensAt( walking( id3 ), 7960 ). holdsAt( coord( id3 )=( 123, 82 ), 7960 ). % Frame number: 200 happensAt( walking( id0 ), 8000 ). holdsAt( coord( id0 )=( 134, 117 ), 8000 ). happensAt( walking( id1 ), 8000 ). holdsAt( coord( id1 )=( 157, 105 ), 8000 ). happensAt( walking( id2 ), 8000 ). holdsAt( coord( id2 )=( 103, 118 ), 8000 ). happensAt( walking( id3 ), 8000 ). holdsAt( coord( id3 )=( 126, 83 ), 8000 ). % Frame number: 201 happensAt( walking( id0 ), 8040 ). holdsAt( coord( id0 )=( 136, 118 ), 8040 ). happensAt( walking( id1 ), 8040 ). holdsAt( coord( id1 )=( 159, 106 ), 8040 ). happensAt( walking( id2 ), 8040 ). holdsAt( coord( id2 )=( 103, 118 ), 8040 ). happensAt( walking( id3 ), 8040 ). holdsAt( coord( id3 )=( 127, 83 ), 8040 ). % Frame number: 202 happensAt( walking( id0 ), 8080 ). holdsAt( coord( id0 )=( 138, 118 ), 8080 ). happensAt( walking( id1 ), 8080 ). holdsAt( coord( id1 )=( 160, 107 ), 8080 ). happensAt( walking( id2 ), 8080 ). holdsAt( coord( id2 )=( 103, 119 ), 8080 ). happensAt( walking( id3 ), 8080 ). holdsAt( coord( id3 )=( 129, 83 ), 8080 ). % Frame number: 203 happensAt( walking( id0 ), 8120 ). holdsAt( coord( id0 )=( 139, 118 ), 8120 ). happensAt( walking( id1 ), 8120 ). holdsAt( coord( id1 )=( 161, 108 ), 8120 ). happensAt( walking( id2 ), 8120 ). holdsAt( coord( id2 )=( 104, 120 ), 8120 ). happensAt( walking( id3 ), 8120 ). holdsAt( coord( id3 )=( 131, 83 ), 8120 ). % Frame number: 204 happensAt( walking( id0 ), 8160 ). holdsAt( coord( id0 )=( 140, 118 ), 8160 ). happensAt( walking( id1 ), 8160 ). holdsAt( coord( id1 )=( 161, 109 ), 8160 ). happensAt( walking( id2 ), 8160 ). holdsAt( coord( id2 )=( 106, 121 ), 8160 ). happensAt( walking( id3 ), 8160 ). holdsAt( coord( id3 )=( 133, 84 ), 8160 ). % Frame number: 205 happensAt( walking( id0 ), 8200 ). holdsAt( coord( id0 )=( 141, 119 ), 8200 ). happensAt( walking( id1 ), 8200 ). holdsAt( coord( id1 )=( 162, 109 ), 8200 ). happensAt( walking( id2 ), 8200 ). holdsAt( coord( id2 )=( 106, 122 ), 8200 ). happensAt( walking( id3 ), 8200 ). holdsAt( coord( id3 )=( 134, 84 ), 8200 ). % Frame number: 206 happensAt( walking( id0 ), 8240 ). holdsAt( coord( id0 )=( 141, 119 ), 8240 ). happensAt( walking( id1 ), 8240 ). holdsAt( coord( id1 )=( 162, 110 ), 8240 ). happensAt( walking( id2 ), 8240 ). holdsAt( coord( id2 )=( 108, 122 ), 8240 ). happensAt( walking( id3 ), 8240 ). holdsAt( coord( id3 )=( 136, 84 ), 8240 ). % Frame number: 207 happensAt( walking( id0 ), 8280 ). holdsAt( coord( id0 )=( 142, 119 ), 8280 ). happensAt( walking( id1 ), 8280 ). holdsAt( coord( id1 )=( 162, 110 ), 8280 ). happensAt( walking( id2 ), 8280 ). holdsAt( coord( id2 )=( 109, 123 ), 8280 ). happensAt( walking( id3 ), 8280 ). holdsAt( coord( id3 )=( 137, 82 ), 8280 ). % Frame number: 208 happensAt( walking( id0 ), 8320 ). holdsAt( coord( id0 )=( 142, 119 ), 8320 ). happensAt( walking( id1 ), 8320 ). holdsAt( coord( id1 )=( 162, 110 ), 8320 ). happensAt( walking( id2 ), 8320 ). holdsAt( coord( id2 )=( 109, 123 ), 8320 ). happensAt( walking( id3 ), 8320 ). holdsAt( coord( id3 )=( 138, 82 ), 8320 ). % Frame number: 209 happensAt( walking( id0 ), 8360 ). holdsAt( coord( id0 )=( 142, 119 ), 8360 ). happensAt( walking( id1 ), 8360 ). holdsAt( coord( id1 )=( 163, 111 ), 8360 ). happensAt( walking( id2 ), 8360 ). holdsAt( coord( id2 )=( 110, 124 ), 8360 ). happensAt( walking( id3 ), 8360 ). holdsAt( coord( id3 )=( 138, 83 ), 8360 ). % Frame number: 210 happensAt( walking( id0 ), 8400 ). holdsAt( coord( id0 )=( 143, 119 ), 8400 ). happensAt( walking( id1 ), 8400 ). holdsAt( coord( id1 )=( 163, 111 ), 8400 ). happensAt( walking( id2 ), 8400 ). holdsAt( coord( id2 )=( 110, 124 ), 8400 ). happensAt( walking( id3 ), 8400 ). holdsAt( coord( id3 )=( 139, 83 ), 8400 ). % Frame number: 211 happensAt( walking( id0 ), 8440 ). holdsAt( coord( id0 )=( 143, 120 ), 8440 ). happensAt( walking( id1 ), 8440 ). holdsAt( coord( id1 )=( 163, 111 ), 8440 ). happensAt( walking( id2 ), 8440 ). holdsAt( coord( id2 )=( 110, 124 ), 8440 ). happensAt( walking( id3 ), 8440 ). holdsAt( coord( id3 )=( 141, 83 ), 8440 ). % Frame number: 212 happensAt( walking( id0 ), 8480 ). holdsAt( coord( id0 )=( 143, 121 ), 8480 ). happensAt( walking( id1 ), 8480 ). holdsAt( coord( id1 )=( 164, 112 ), 8480 ). happensAt( walking( id2 ), 8480 ). holdsAt( coord( id2 )=( 111, 124 ), 8480 ). happensAt( walking( id3 ), 8480 ). holdsAt( coord( id3 )=( 142, 83 ), 8480 ). % Frame number: 213 happensAt( walking( id0 ), 8520 ). holdsAt( coord( id0 )=( 144, 122 ), 8520 ). happensAt( walking( id1 ), 8520 ). holdsAt( coord( id1 )=( 167, 112 ), 8520 ). happensAt( walking( id2 ), 8520 ). holdsAt( coord( id2 )=( 111, 125 ), 8520 ). happensAt( walking( id3 ), 8520 ). holdsAt( coord( id3 )=( 142, 83 ), 8520 ). % Frame number: 214 happensAt( walking( id0 ), 8560 ). holdsAt( coord( id0 )=( 144, 123 ), 8560 ). happensAt( walking( id1 ), 8560 ). holdsAt( coord( id1 )=( 169, 113 ), 8560 ). happensAt( walking( id2 ), 8560 ). holdsAt( coord( id2 )=( 111, 125 ), 8560 ). happensAt( walking( id3 ), 8560 ). holdsAt( coord( id3 )=( 143, 83 ), 8560 ). % Frame number: 215 happensAt( walking( id0 ), 8600 ). holdsAt( coord( id0 )=( 146, 125 ), 8600 ). happensAt( walking( id1 ), 8600 ). holdsAt( coord( id1 )=( 171, 114 ), 8600 ). happensAt( walking( id2 ), 8600 ). holdsAt( coord( id2 )=( 113, 125 ), 8600 ). happensAt( walking( id3 ), 8600 ). holdsAt( coord( id3 )=( 144, 84 ), 8600 ). % Frame number: 216 happensAt( walking( id0 ), 8640 ). holdsAt( coord( id0 )=( 147, 126 ), 8640 ). happensAt( walking( id1 ), 8640 ). holdsAt( coord( id1 )=( 173, 115 ), 8640 ). happensAt( walking( id2 ), 8640 ). holdsAt( coord( id2 )=( 115, 125 ), 8640 ). happensAt( walking( id3 ), 8640 ). holdsAt( coord( id3 )=( 145, 84 ), 8640 ). % Frame number: 217 happensAt( walking( id0 ), 8680 ). holdsAt( coord( id0 )=( 149, 126 ), 8680 ). happensAt( walking( id1 ), 8680 ). holdsAt( coord( id1 )=( 174, 116 ), 8680 ). happensAt( walking( id2 ), 8680 ). holdsAt( coord( id2 )=( 116, 125 ), 8680 ). happensAt( walking( id3 ), 8680 ). holdsAt( coord( id3 )=( 148, 85 ), 8680 ). % Frame number: 218 happensAt( walking( id0 ), 8720 ). holdsAt( coord( id0 )=( 150, 127 ), 8720 ). happensAt( walking( id1 ), 8720 ). holdsAt( coord( id1 )=( 175, 117 ), 8720 ). happensAt( walking( id2 ), 8720 ). holdsAt( coord( id2 )=( 117, 125 ), 8720 ). happensAt( walking( id3 ), 8720 ). holdsAt( coord( id3 )=( 151, 86 ), 8720 ). % Frame number: 219 happensAt( walking( id0 ), 8760 ). holdsAt( coord( id0 )=( 151, 128 ), 8760 ). happensAt( walking( id1 ), 8760 ). holdsAt( coord( id1 )=( 176, 118 ), 8760 ). happensAt( walking( id2 ), 8760 ). holdsAt( coord( id2 )=( 119, 126 ), 8760 ). happensAt( walking( id3 ), 8760 ). holdsAt( coord( id3 )=( 153, 87 ), 8760 ). % Frame number: 220 happensAt( walking( id0 ), 8800 ). holdsAt( coord( id0 )=( 151, 128 ), 8800 ). happensAt( walking( id1 ), 8800 ). holdsAt( coord( id1 )=( 177, 119 ), 8800 ). happensAt( walking( id2 ), 8800 ). holdsAt( coord( id2 )=( 119, 126 ), 8800 ). happensAt( walking( id3 ), 8800 ). holdsAt( coord( id3 )=( 154, 87 ), 8800 ). % Frame number: 221 happensAt( walking( id0 ), 8840 ). holdsAt( coord( id0 )=( 152, 128 ), 8840 ). happensAt( walking( id1 ), 8840 ). holdsAt( coord( id1 )=( 178, 119 ), 8840 ). happensAt( walking( id2 ), 8840 ). holdsAt( coord( id2 )=( 121, 127 ), 8840 ). happensAt( walking( id3 ), 8840 ). holdsAt( coord( id3 )=( 154, 87 ), 8840 ). % Frame number: 222 happensAt( walking( id0 ), 8880 ). holdsAt( coord( id0 )=( 152, 129 ), 8880 ). happensAt( walking( id1 ), 8880 ). holdsAt( coord( id1 )=( 178, 120 ), 8880 ). happensAt( walking( id2 ), 8880 ). holdsAt( coord( id2 )=( 121, 127 ), 8880 ). happensAt( walking( id3 ), 8880 ). holdsAt( coord( id3 )=( 154, 87 ), 8880 ). % Frame number: 223 happensAt( walking( id0 ), 8920 ). holdsAt( coord( id0 )=( 153, 129 ), 8920 ). happensAt( walking( id1 ), 8920 ). holdsAt( coord( id1 )=( 178, 120 ), 8920 ). happensAt( walking( id2 ), 8920 ). holdsAt( coord( id2 )=( 122, 127 ), 8920 ). happensAt( walking( id3 ), 8920 ). holdsAt( coord( id3 )=( 155, 88 ), 8920 ). % Frame number: 224 happensAt( walking( id0 ), 8960 ). holdsAt( coord( id0 )=( 153, 130 ), 8960 ). happensAt( walking( id1 ), 8960 ). holdsAt( coord( id1 )=( 179, 120 ), 8960 ). happensAt( walking( id2 ), 8960 ). holdsAt( coord( id2 )=( 122, 127 ), 8960 ). happensAt( walking( id3 ), 8960 ). holdsAt( coord( id3 )=( 155, 88 ), 8960 ). % Frame number: 225 happensAt( walking( id0 ), 9000 ). holdsAt( coord( id0 )=( 153, 130 ), 9000 ). happensAt( walking( id1 ), 9000 ). holdsAt( coord( id1 )=( 179, 121 ), 9000 ). happensAt( walking( id2 ), 9000 ). holdsAt( coord( id2 )=( 123, 127 ), 9000 ). happensAt( walking( id3 ), 9000 ). holdsAt( coord( id3 )=( 157, 88 ), 9000 ). % Frame number: 226 happensAt( walking( id0 ), 9040 ). holdsAt( coord( id0 )=( 154, 130 ), 9040 ). happensAt( walking( id1 ), 9040 ). holdsAt( coord( id1 )=( 179, 121 ), 9040 ). happensAt( walking( id2 ), 9040 ). holdsAt( coord( id2 )=( 123, 127 ), 9040 ). happensAt( walking( id3 ), 9040 ). holdsAt( coord( id3 )=( 160, 88 ), 9040 ). % Frame number: 227 happensAt( walking( id0 ), 9080 ). holdsAt( coord( id0 )=( 155, 131 ), 9080 ). happensAt( walking( id1 ), 9080 ). holdsAt( coord( id1 )=( 179, 123 ), 9080 ). happensAt( walking( id2 ), 9080 ). holdsAt( coord( id2 )=( 123, 127 ), 9080 ). happensAt( walking( id3 ), 9080 ). holdsAt( coord( id3 )=( 163, 88 ), 9080 ). % Frame number: 228 happensAt( walking( id0 ), 9120 ). holdsAt( coord( id0 )=( 157, 131 ), 9120 ). happensAt( walking( id1 ), 9120 ). holdsAt( coord( id1 )=( 179, 126 ), 9120 ). happensAt( walking( id2 ), 9120 ). holdsAt( coord( id2 )=( 123, 129 ), 9120 ). happensAt( walking( id3 ), 9120 ). holdsAt( coord( id3 )=( 165, 88 ), 9120 ). % Frame number: 229 happensAt( walking( id0 ), 9160 ). holdsAt( coord( id0 )=( 159, 132 ), 9160 ). happensAt( walking( id1 ), 9160 ). holdsAt( coord( id1 )=( 181, 129 ), 9160 ). happensAt( walking( id2 ), 9160 ). holdsAt( coord( id2 )=( 124, 130 ), 9160 ). happensAt( walking( id3 ), 9160 ). holdsAt( coord( id3 )=( 167, 88 ), 9160 ). % Frame number: 230 happensAt( walking( id0 ), 9200 ). holdsAt( coord( id0 )=( 160, 133 ), 9200 ). happensAt( walking( id1 ), 9200 ). holdsAt( coord( id1 )=( 183, 131 ), 9200 ). happensAt( walking( id2 ), 9200 ). holdsAt( coord( id2 )=( 125, 131 ), 9200 ). happensAt( walking( id3 ), 9200 ). holdsAt( coord( id3 )=( 169, 88 ), 9200 ). % Frame number: 231 happensAt( walking( id0 ), 9240 ). holdsAt( coord( id0 )=( 161, 133 ), 9240 ). happensAt( walking( id1 ), 9240 ). holdsAt( coord( id1 )=( 184, 133 ), 9240 ). happensAt( walking( id2 ), 9240 ). holdsAt( coord( id2 )=( 127, 132 ), 9240 ). happensAt( walking( id3 ), 9240 ). holdsAt( coord( id3 )=( 171, 88 ), 9240 ). % Frame number: 232 happensAt( walking( id0 ), 9280 ). holdsAt( coord( id0 )=( 162, 135 ), 9280 ). happensAt( walking( id1 ), 9280 ). holdsAt( coord( id1 )=( 185, 135 ), 9280 ). happensAt( walking( id2 ), 9280 ). holdsAt( coord( id2 )=( 129, 133 ), 9280 ). happensAt( walking( id3 ), 9280 ). holdsAt( coord( id3 )=( 172, 88 ), 9280 ). % Frame number: 233 happensAt( walking( id0 ), 9320 ). holdsAt( coord( id0 )=( 163, 136 ), 9320 ). happensAt( walking( id1 ), 9320 ). holdsAt( coord( id1 )=( 186, 137 ), 9320 ). happensAt( walking( id2 ), 9320 ). holdsAt( coord( id2 )=( 130, 134 ), 9320 ). happensAt( walking( id3 ), 9320 ). holdsAt( coord( id3 )=( 173, 88 ), 9320 ). % Frame number: 234 happensAt( walking( id0 ), 9360 ). holdsAt( coord( id0 )=( 164, 137 ), 9360 ). happensAt( walking( id1 ), 9360 ). holdsAt( coord( id1 )=( 187, 137 ), 9360 ). happensAt( walking( id2 ), 9360 ). holdsAt( coord( id2 )=( 131, 134 ), 9360 ). happensAt( walking( id3 ), 9360 ). holdsAt( coord( id3 )=( 173, 88 ), 9360 ). % Frame number: 235 happensAt( walking( id0 ), 9400 ). holdsAt( coord( id0 )=( 165, 138 ), 9400 ). happensAt( walking( id1 ), 9400 ). holdsAt( coord( id1 )=( 188, 138 ), 9400 ). happensAt( walking( id2 ), 9400 ). holdsAt( coord( id2 )=( 131, 135 ), 9400 ). happensAt( walking( id3 ), 9400 ). holdsAt( coord( id3 )=( 174, 89 ), 9400 ). % Frame number: 236 happensAt( walking( id0 ), 9440 ). holdsAt( coord( id0 )=( 165, 138 ), 9440 ). happensAt( walking( id1 ), 9440 ). holdsAt( coord( id1 )=( 189, 139 ), 9440 ). happensAt( walking( id2 ), 9440 ). holdsAt( coord( id2 )=( 131, 135 ), 9440 ). happensAt( walking( id3 ), 9440 ). holdsAt( coord( id3 )=( 174, 89 ), 9440 ). % Frame number: 237 happensAt( walking( id0 ), 9480 ). holdsAt( coord( id0 )=( 166, 139 ), 9480 ). happensAt( walking( id1 ), 9480 ). holdsAt( coord( id1 )=( 189, 140 ), 9480 ). happensAt( walking( id2 ), 9480 ). holdsAt( coord( id2 )=( 132, 135 ), 9480 ). happensAt( walking( id3 ), 9480 ). holdsAt( coord( id3 )=( 175, 90 ), 9480 ). % Frame number: 238 happensAt( walking( id0 ), 9520 ). holdsAt( coord( id0 )=( 166, 139 ), 9520 ). happensAt( walking( id1 ), 9520 ). holdsAt( coord( id1 )=( 190, 141 ), 9520 ). happensAt( walking( id2 ), 9520 ). holdsAt( coord( id2 )=( 132, 136 ), 9520 ). happensAt( walking( id3 ), 9520 ). holdsAt( coord( id3 )=( 176, 92 ), 9520 ). % Frame number: 239 happensAt( walking( id0 ), 9560 ). holdsAt( coord( id0 )=( 166, 140 ), 9560 ). happensAt( walking( id1 ), 9560 ). holdsAt( coord( id1 )=( 190, 141 ), 9560 ). happensAt( walking( id2 ), 9560 ). holdsAt( coord( id2 )=( 132, 136 ), 9560 ). happensAt( walking( id3 ), 9560 ). holdsAt( coord( id3 )=( 178, 93 ), 9560 ). % Frame number: 240 happensAt( walking( id0 ), 9600 ). holdsAt( coord( id0 )=( 166, 140 ), 9600 ). happensAt( walking( id1 ), 9600 ). holdsAt( coord( id1 )=( 190, 142 ), 9600 ). happensAt( walking( id2 ), 9600 ). holdsAt( coord( id2 )=( 133, 137 ), 9600 ). happensAt( walking( id3 ), 9600 ). holdsAt( coord( id3 )=( 181, 94 ), 9600 ). % Frame number: 241 happensAt( walking( id0 ), 9640 ). holdsAt( coord( id0 )=( 167, 143 ), 9640 ). happensAt( walking( id1 ), 9640 ). holdsAt( coord( id1 )=( 191, 142 ), 9640 ). happensAt( walking( id2 ), 9640 ). holdsAt( coord( id2 )=( 133, 137 ), 9640 ). happensAt( walking( id3 ), 9640 ). holdsAt( coord( id3 )=( 183, 95 ), 9640 ). % Frame number: 242 happensAt( walking( id0 ), 9680 ). holdsAt( coord( id0 )=( 167, 146 ), 9680 ). happensAt( walking( id1 ), 9680 ). holdsAt( coord( id1 )=( 192, 143 ), 9680 ). happensAt( walking( id2 ), 9680 ). holdsAt( coord( id2 )=( 133, 137 ), 9680 ). happensAt( walking( id3 ), 9680 ). holdsAt( coord( id3 )=( 185, 95 ), 9680 ). % Frame number: 243 happensAt( walking( id0 ), 9720 ). holdsAt( coord( id0 )=( 167, 149 ), 9720 ). happensAt( walking( id1 ), 9720 ). holdsAt( coord( id1 )=( 194, 144 ), 9720 ). happensAt( walking( id2 ), 9720 ). holdsAt( coord( id2 )=( 134, 137 ), 9720 ). happensAt( walking( id3 ), 9720 ). holdsAt( coord( id3 )=( 187, 96 ), 9720 ). % Frame number: 244 happensAt( walking( id0 ), 9760 ). holdsAt( coord( id0 )=( 168, 151 ), 9760 ). happensAt( walking( id1 ), 9760 ). holdsAt( coord( id1 )=( 197, 145 ), 9760 ). happensAt( walking( id2 ), 9760 ). holdsAt( coord( id2 )=( 134, 138 ), 9760 ). happensAt( walking( id3 ), 9760 ). holdsAt( coord( id3 )=( 188, 97 ), 9760 ). % Frame number: 245 happensAt( walking( id0 ), 9800 ). holdsAt( coord( id0 )=( 169, 152 ), 9800 ). happensAt( walking( id1 ), 9800 ). holdsAt( coord( id1 )=( 198, 149 ), 9800 ). happensAt( walking( id2 ), 9800 ). holdsAt( coord( id2 )=( 135, 138 ), 9800 ). happensAt( walking( id3 ), 9800 ). holdsAt( coord( id3 )=( 189, 97 ), 9800 ). % Frame number: 246 happensAt( walking( id0 ), 9840 ). holdsAt( coord( id0 )=( 170, 153 ), 9840 ). happensAt( walking( id1 ), 9840 ). holdsAt( coord( id1 )=( 200, 151 ), 9840 ). happensAt( walking( id2 ), 9840 ). holdsAt( coord( id2 )=( 135, 139 ), 9840 ). happensAt( walking( id3 ), 9840 ). holdsAt( coord( id3 )=( 190, 97 ), 9840 ). % Frame number: 247 happensAt( walking( id0 ), 9880 ). holdsAt( coord( id0 )=( 171, 155 ), 9880 ). happensAt( walking( id1 ), 9880 ). holdsAt( coord( id1 )=( 201, 154 ), 9880 ). happensAt( walking( id2 ), 9880 ). holdsAt( coord( id2 )=( 136, 139 ), 9880 ). happensAt( walking( id3 ), 9880 ). holdsAt( coord( id3 )=( 190, 98 ), 9880 ). % Frame number: 248 happensAt( walking( id0 ), 9920 ). holdsAt( coord( id0 )=( 171, 156 ), 9920 ). happensAt( walking( id1 ), 9920 ). holdsAt( coord( id1 )=( 202, 155 ), 9920 ). happensAt( walking( id2 ), 9920 ). holdsAt( coord( id2 )=( 137, 140 ), 9920 ). happensAt( walking( id3 ), 9920 ). holdsAt( coord( id3 )=( 191, 98 ), 9920 ). % Frame number: 249 happensAt( walking( id0 ), 9960 ). holdsAt( coord( id0 )=( 171, 156 ), 9960 ). happensAt( walking( id1 ), 9960 ). holdsAt( coord( id1 )=( 203, 157 ), 9960 ). happensAt( walking( id2 ), 9960 ). holdsAt( coord( id2 )=( 137, 140 ), 9960 ). happensAt( walking( id3 ), 9960 ). holdsAt( coord( id3 )=( 191, 98 ), 9960 ). % Frame number: 250 happensAt( walking( id0 ), 10000 ). holdsAt( coord( id0 )=( 171, 157 ), 10000 ). happensAt( walking( id1 ), 10000 ). holdsAt( coord( id1 )=( 204, 158 ), 10000 ). happensAt( walking( id2 ), 10000 ). holdsAt( coord( id2 )=( 138, 142 ), 10000 ). happensAt( walking( id3 ), 10000 ). holdsAt( coord( id3 )=( 192, 98 ), 10000 ). % Frame number: 251 happensAt( walking( id0 ), 10040 ). holdsAt( coord( id0 )=( 171, 157 ), 10040 ). happensAt( walking( id1 ), 10040 ). holdsAt( coord( id1 )=( 205, 159 ), 10040 ). happensAt( walking( id2 ), 10040 ). holdsAt( coord( id2 )=( 138, 142 ), 10040 ). happensAt( walking( id3 ), 10040 ). holdsAt( coord( id3 )=( 195, 98 ), 10040 ). % Frame number: 252 happensAt( walking( id0 ), 10080 ). holdsAt( coord( id0 )=( 172, 158 ), 10080 ). happensAt( walking( id1 ), 10080 ). holdsAt( coord( id1 )=( 205, 159 ), 10080 ). happensAt( walking( id2 ), 10080 ). holdsAt( coord( id2 )=( 139, 142 ), 10080 ). happensAt( walking( id3 ), 10080 ). holdsAt( coord( id3 )=( 199, 99 ), 10080 ). % Frame number: 253 happensAt( walking( id0 ), 10120 ). holdsAt( coord( id0 )=( 173, 159 ), 10120 ). happensAt( walking( id1 ), 10120 ). holdsAt( coord( id1 )=( 206, 160 ), 10120 ). happensAt( walking( id2 ), 10120 ). holdsAt( coord( id2 )=( 141, 142 ), 10120 ). happensAt( walking( id3 ), 10120 ). holdsAt( coord( id3 )=( 202, 99 ), 10120 ). % Frame number: 254 happensAt( walking( id0 ), 10160 ). holdsAt( coord( id0 )=( 173, 159 ), 10160 ). happensAt( walking( id1 ), 10160 ). holdsAt( coord( id1 )=( 206, 161 ), 10160 ). happensAt( walking( id2 ), 10160 ). holdsAt( coord( id2 )=( 142, 144 ), 10160 ). happensAt( walking( id3 ), 10160 ). holdsAt( coord( id3 )=( 204, 101 ), 10160 ). % Frame number: 255 happensAt( walking( id0 ), 10200 ). holdsAt( coord( id0 )=( 175, 161 ), 10200 ). happensAt( walking( id1 ), 10200 ). holdsAt( coord( id1 )=( 206, 162 ), 10200 ). happensAt( walking( id2 ), 10200 ). holdsAt( coord( id2 )=( 143, 143 ), 10200 ). happensAt( walking( id3 ), 10200 ). holdsAt( coord( id3 )=( 206, 102 ), 10200 ). % Frame number: 256 happensAt( walking( id0 ), 10240 ). holdsAt( coord( id0 )=( 176, 162 ), 10240 ). happensAt( walking( id1 ), 10240 ). holdsAt( coord( id1 )=( 206, 163 ), 10240 ). happensAt( walking( id2 ), 10240 ). holdsAt( coord( id2 )=( 144, 144 ), 10240 ). happensAt( walking( id3 ), 10240 ). holdsAt( coord( id3 )=( 208, 104 ), 10240 ). % Frame number: 257 happensAt( walking( id0 ), 10280 ). holdsAt( coord( id0 )=( 178, 165 ), 10280 ). happensAt( walking( id1 ), 10280 ). holdsAt( coord( id1 )=( 206, 163 ), 10280 ). happensAt( walking( id2 ), 10280 ). holdsAt( coord( id2 )=( 145, 145 ), 10280 ). happensAt( walking( id3 ), 10280 ). holdsAt( coord( id3 )=( 210, 104 ), 10280 ). % Frame number: 258 happensAt( walking( id0 ), 10320 ). holdsAt( coord( id0 )=( 178, 167 ), 10320 ). happensAt( walking( id1 ), 10320 ). holdsAt( coord( id1 )=( 207, 166 ), 10320 ). happensAt( walking( id2 ), 10320 ). holdsAt( coord( id2 )=( 148, 145 ), 10320 ). happensAt( walking( id3 ), 10320 ). holdsAt( coord( id3 )=( 211, 105 ), 10320 ). % Frame number: 259 happensAt( walking( id0 ), 10360 ). holdsAt( coord( id0 )=( 179, 169 ), 10360 ). happensAt( walking( id1 ), 10360 ). holdsAt( coord( id1 )=( 207, 170 ), 10360 ). happensAt( walking( id2 ), 10360 ). holdsAt( coord( id2 )=( 149, 146 ), 10360 ). happensAt( walking( id3 ), 10360 ). holdsAt( coord( id3 )=( 213, 106 ), 10360 ). % Frame number: 260 happensAt( walking( id0 ), 10400 ). holdsAt( coord( id0 )=( 181, 172 ), 10400 ). happensAt( walking( id1 ), 10400 ). holdsAt( coord( id1 )=( 207, 174 ), 10400 ). happensAt( walking( id2 ), 10400 ). holdsAt( coord( id2 )=( 149, 146 ), 10400 ). happensAt( walking( id3 ), 10400 ). holdsAt( coord( id3 )=( 213, 106 ), 10400 ). % Frame number: 261 happensAt( walking( id0 ), 10440 ). holdsAt( coord( id0 )=( 181, 173 ), 10440 ). happensAt( walking( id1 ), 10440 ). holdsAt( coord( id1 )=( 207, 178 ), 10440 ). happensAt( walking( id2 ), 10440 ). holdsAt( coord( id2 )=( 150, 147 ), 10440 ). happensAt( walking( id3 ), 10440 ). holdsAt( coord( id3 )=( 214, 107 ), 10440 ). % Frame number: 262 happensAt( walking( id0 ), 10480 ). holdsAt( coord( id0 )=( 181, 173 ), 10480 ). happensAt( walking( id1 ), 10480 ). holdsAt( coord( id1 )=( 208, 181 ), 10480 ). happensAt( walking( id2 ), 10480 ). holdsAt( coord( id2 )=( 151, 148 ), 10480 ). happensAt( walking( id3 ), 10480 ). holdsAt( coord( id3 )=( 215, 107 ), 10480 ). % Frame number: 263 happensAt( walking( id0 ), 10520 ). holdsAt( coord( id0 )=( 182, 174 ), 10520 ). happensAt( walking( id1 ), 10520 ). holdsAt( coord( id1 )=( 208, 183 ), 10520 ). happensAt( walking( id2 ), 10520 ). holdsAt( coord( id2 )=( 155, 150 ), 10520 ). happensAt( walking( id3 ), 10520 ). holdsAt( coord( id3 )=( 216, 108 ), 10520 ). % Frame number: 264 happensAt( walking( id0 ), 10560 ). holdsAt( coord( id0 )=( 182, 175 ), 10560 ). happensAt( walking( id1 ), 10560 ). holdsAt( coord( id1 )=( 209, 185 ), 10560 ). happensAt( walking( id2 ), 10560 ). holdsAt( coord( id2 )=( 156, 151 ), 10560 ). happensAt( walking( id3 ), 10560 ). holdsAt( coord( id3 )=( 217, 111 ), 10560 ). % Frame number: 265 happensAt( walking( id0 ), 10600 ). holdsAt( coord( id0 )=( 182, 176 ), 10600 ). happensAt( walking( id1 ), 10600 ). holdsAt( coord( id1 )=( 209, 186 ), 10600 ). happensAt( walking( id2 ), 10600 ). holdsAt( coord( id2 )=( 157, 152 ), 10600 ). happensAt( walking( id3 ), 10600 ). holdsAt( coord( id3 )=( 217, 114 ), 10600 ). % Frame number: 266 happensAt( walking( id0 ), 10640 ). holdsAt( coord( id0 )=( 182, 177 ), 10640 ). happensAt( walking( id1 ), 10640 ). holdsAt( coord( id1 )=( 209, 186 ), 10640 ). happensAt( walking( id2 ), 10640 ). holdsAt( coord( id2 )=( 157, 153 ), 10640 ). happensAt( walking( id3 ), 10640 ). holdsAt( coord( id3 )=( 220, 117 ), 10640 ). % Frame number: 267 happensAt( walking( id0 ), 10680 ). holdsAt( coord( id0 )=( 182, 178 ), 10680 ). happensAt( walking( id1 ), 10680 ). holdsAt( coord( id1 )=( 209, 186 ), 10680 ). happensAt( walking( id2 ), 10680 ). holdsAt( coord( id2 )=( 157, 154 ), 10680 ). happensAt( walking( id3 ), 10680 ). holdsAt( coord( id3 )=( 223, 119 ), 10680 ). % Frame number: 268 happensAt( walking( id0 ), 10720 ). holdsAt( coord( id0 )=( 182, 179 ), 10720 ). happensAt( walking( id1 ), 10720 ). holdsAt( coord( id1 )=( 209, 187 ), 10720 ). happensAt( walking( id2 ), 10720 ). holdsAt( coord( id2 )=( 158, 155 ), 10720 ). happensAt( walking( id3 ), 10720 ). holdsAt( coord( id3 )=( 226, 121 ), 10720 ). % Frame number: 269 happensAt( walking( id0 ), 10760 ). holdsAt( coord( id0 )=( 182, 182 ), 10760 ). happensAt( walking( id1 ), 10760 ). holdsAt( coord( id1 )=( 209, 189 ), 10760 ). happensAt( walking( id2 ), 10760 ). holdsAt( coord( id2 )=( 158, 155 ), 10760 ). happensAt( walking( id3 ), 10760 ). holdsAt( coord( id3 )=( 228, 123 ), 10760 ). % Frame number: 270 happensAt( walking( id0 ), 10800 ). holdsAt( coord( id0 )=( 183, 185 ), 10800 ). happensAt( walking( id1 ), 10800 ). holdsAt( coord( id1 )=( 210, 190 ), 10800 ). happensAt( walking( id2 ), 10800 ). holdsAt( coord( id2 )=( 160, 156 ), 10800 ). happensAt( walking( id3 ), 10800 ). holdsAt( coord( id3 )=( 230, 124 ), 10800 ). % Frame number: 271 happensAt( walking( id0 ), 10840 ). holdsAt( coord( id0 )=( 183, 188 ), 10840 ). happensAt( walking( id1 ), 10840 ). holdsAt( coord( id1 )=( 211, 192 ), 10840 ). happensAt( walking( id2 ), 10840 ). holdsAt( coord( id2 )=( 164, 156 ), 10840 ). happensAt( walking( id3 ), 10840 ). holdsAt( coord( id3 )=( 231, 125 ), 10840 ). % Frame number: 272 happensAt( walking( id0 ), 10880 ). holdsAt( coord( id0 )=( 184, 191 ), 10880 ). happensAt( walking( id1 ), 10880 ). holdsAt( coord( id1 )=( 212, 193 ), 10880 ). happensAt( walking( id2 ), 10880 ). holdsAt( coord( id2 )=( 166, 157 ), 10880 ). happensAt( walking( id3 ), 10880 ). holdsAt( coord( id3 )=( 232, 126 ), 10880 ). % Frame number: 273 happensAt( walking( id0 ), 10920 ). holdsAt( coord( id0 )=( 184, 192 ), 10920 ). happensAt( walking( id1 ), 10920 ). holdsAt( coord( id1 )=( 213, 194 ), 10920 ). happensAt( walking( id2 ), 10920 ). holdsAt( coord( id2 )=( 169, 159 ), 10920 ). happensAt( walking( id3 ), 10920 ). holdsAt( coord( id3 )=( 233, 126 ), 10920 ). % Frame number: 274 happensAt( walking( id0 ), 10960 ). holdsAt( coord( id0 )=( 185, 194 ), 10960 ). happensAt( walking( id1 ), 10960 ). holdsAt( coord( id1 )=( 214, 196 ), 10960 ). happensAt( walking( id2 ), 10960 ). holdsAt( coord( id2 )=( 171, 159 ), 10960 ). happensAt( walking( id3 ), 10960 ). holdsAt( coord( id3 )=( 234, 127 ), 10960 ). % Frame number: 275 happensAt( walking( id0 ), 11000 ). holdsAt( coord( id0 )=( 186, 195 ), 11000 ). happensAt( walking( id1 ), 11000 ). holdsAt( coord( id1 )=( 215, 200 ), 11000 ). happensAt( walking( id2 ), 11000 ). holdsAt( coord( id2 )=( 172, 161 ), 11000 ). happensAt( walking( id3 ), 11000 ). holdsAt( coord( id3 )=( 234, 128 ), 11000 ). % Frame number: 276 happensAt( walking( id0 ), 11040 ). holdsAt( coord( id0 )=( 186, 195 ), 11040 ). happensAt( walking( id1 ), 11040 ). holdsAt( coord( id1 )=( 217, 204 ), 11040 ). happensAt( walking( id2 ), 11040 ). holdsAt( coord( id2 )=( 174, 162 ), 11040 ). happensAt( walking( id3 ), 11040 ). holdsAt( coord( id3 )=( 235, 128 ), 11040 ). % Frame number: 277 happensAt( walking( id0 ), 11080 ). holdsAt( coord( id0 )=( 186, 196 ), 11080 ). happensAt( walking( id1 ), 11080 ). holdsAt( coord( id1 )=( 218, 208 ), 11080 ). happensAt( walking( id2 ), 11080 ). holdsAt( coord( id2 )=( 176, 162 ), 11080 ). happensAt( walking( id3 ), 11080 ). holdsAt( coord( id3 )=( 237, 129 ), 11080 ). % Frame number: 278 happensAt( walking( id0 ), 11120 ). holdsAt( coord( id0 )=( 186, 196 ), 11120 ). happensAt( walking( id1 ), 11120 ). holdsAt( coord( id1 )=( 218, 210 ), 11120 ). happensAt( walking( id2 ), 11120 ). holdsAt( coord( id2 )=( 176, 163 ), 11120 ). happensAt( walking( id3 ), 11120 ). holdsAt( coord( id3 )=( 241, 130 ), 11120 ). % Frame number: 279 happensAt( walking( id0 ), 11160 ). holdsAt( coord( id0 )=( 186, 198 ), 11160 ). happensAt( walking( id1 ), 11160 ). holdsAt( coord( id1 )=( 219, 211 ), 11160 ). happensAt( walking( id2 ), 11160 ). holdsAt( coord( id2 )=( 177, 164 ), 11160 ). happensAt( walking( id3 ), 11160 ). holdsAt( coord( id3 )=( 245, 130 ), 11160 ). % Frame number: 280 happensAt( walking( id0 ), 11200 ). holdsAt( coord( id0 )=( 186, 199 ), 11200 ). happensAt( walking( id1 ), 11200 ). holdsAt( coord( id1 )=( 219, 211 ), 11200 ). happensAt( walking( id2 ), 11200 ). holdsAt( coord( id2 )=( 177, 164 ), 11200 ). happensAt( walking( id3 ), 11200 ). holdsAt( coord( id3 )=( 249, 133 ), 11200 ). % Frame number: 281 happensAt( walking( id0 ), 11240 ). holdsAt( coord( id0 )=( 187, 202 ), 11240 ). happensAt( walking( id1 ), 11240 ). holdsAt( coord( id1 )=( 220, 211 ), 11240 ). happensAt( walking( id2 ), 11240 ). holdsAt( coord( id2 )=( 178, 164 ), 11240 ). happensAt( walking( id3 ), 11240 ). holdsAt( coord( id3 )=( 252, 136 ), 11240 ). % Frame number: 282 happensAt( walking( id0 ), 11280 ). holdsAt( coord( id0 )=( 189, 204 ), 11280 ). happensAt( walking( id1 ), 11280 ). holdsAt( coord( id1 )=( 221, 211 ), 11280 ). happensAt( walking( id2 ), 11280 ). holdsAt( coord( id2 )=( 178, 165 ), 11280 ). happensAt( walking( id3 ), 11280 ). holdsAt( coord( id3 )=( 255, 139 ), 11280 ). % Frame number: 283 happensAt( walking( id0 ), 11320 ). holdsAt( coord( id0 )=( 190, 205 ), 11320 ). happensAt( walking( id1 ), 11320 ). holdsAt( coord( id1 )=( 221, 212 ), 11320 ). happensAt( walking( id2 ), 11320 ). holdsAt( coord( id2 )=( 179, 166 ), 11320 ). happensAt( walking( id3 ), 11320 ). holdsAt( coord( id3 )=( 257, 140 ), 11320 ). % Frame number: 284 happensAt( walking( id0 ), 11360 ). holdsAt( coord( id0 )=( 190, 207 ), 11360 ). happensAt( walking( id1 ), 11360 ). holdsAt( coord( id1 )=( 222, 213 ), 11360 ). happensAt( walking( id2 ), 11360 ). holdsAt( coord( id2 )=( 180, 168 ), 11360 ). happensAt( walking( id3 ), 11360 ). holdsAt( coord( id3 )=( 259, 142 ), 11360 ). % Frame number: 285 happensAt( walking( id0 ), 11400 ). holdsAt( coord( id0 )=( 189, 209 ), 11400 ). happensAt( walking( id1 ), 11400 ). holdsAt( coord( id1 )=( 222, 215 ), 11400 ). happensAt( walking( id2 ), 11400 ). holdsAt( coord( id2 )=( 180, 170 ), 11400 ). happensAt( walking( id3 ), 11400 ). holdsAt( coord( id3 )=( 260, 143 ), 11400 ). % Frame number: 286 happensAt( walking( id0 ), 11440 ). holdsAt( coord( id0 )=( 189, 209 ), 11440 ). happensAt( walking( id1 ), 11440 ). holdsAt( coord( id1 )=( 222, 218 ), 11440 ). happensAt( walking( id2 ), 11440 ). holdsAt( coord( id2 )=( 183, 173 ), 11440 ). happensAt( walking( id3 ), 11440 ). holdsAt( coord( id3 )=( 261, 144 ), 11440 ). % Frame number: 287 happensAt( walking( id0 ), 11480 ). holdsAt( coord( id0 )=( 190, 212 ), 11480 ). happensAt( walking( id1 ), 11480 ). holdsAt( coord( id1 )=( 222, 221 ), 11480 ). happensAt( walking( id2 ), 11480 ). holdsAt( coord( id2 )=( 185, 176 ), 11480 ). happensAt( walking( id3 ), 11480 ). holdsAt( coord( id3 )=( 262, 145 ), 11480 ). % Frame number: 288 happensAt( walking( id0 ), 11520 ). holdsAt( coord( id0 )=( 191, 213 ), 11520 ). happensAt( walking( id1 ), 11520 ). holdsAt( coord( id1 )=( 222, 225 ), 11520 ). happensAt( walking( id2 ), 11520 ). holdsAt( coord( id2 )=( 187, 178 ), 11520 ). happensAt( walking( id3 ), 11520 ). holdsAt( coord( id3 )=( 263, 146 ), 11520 ). % Frame number: 289 happensAt( walking( id0 ), 11560 ). holdsAt( coord( id0 )=( 191, 214 ), 11560 ). happensAt( walking( id1 ), 11560 ). holdsAt( coord( id1 )=( 222, 228 ), 11560 ). happensAt( walking( id2 ), 11560 ). holdsAt( coord( id2 )=( 188, 179 ), 11560 ). happensAt( walking( id3 ), 11560 ). holdsAt( coord( id3 )=( 264, 148 ), 11560 ). % Frame number: 290 happensAt( walking( id0 ), 11600 ). holdsAt( coord( id0 )=( 195, 216 ), 11600 ). happensAt( walking( id1 ), 11600 ). holdsAt( coord( id1 )=( 222, 230 ), 11600 ). happensAt( walking( id2 ), 11600 ). holdsAt( coord( id2 )=( 190, 180 ), 11600 ). happensAt( walking( id3 ), 11600 ). holdsAt( coord( id3 )=( 264, 150 ), 11600 ). % Frame number: 291 happensAt( walking( id0 ), 11640 ). holdsAt( coord( id0 )=( 196, 217 ), 11640 ). happensAt( walking( id1 ), 11640 ). holdsAt( coord( id1 )=( 222, 232 ), 11640 ). happensAt( walking( id2 ), 11640 ). holdsAt( coord( id2 )=( 191, 182 ), 11640 ). happensAt( walking( id3 ), 11640 ). holdsAt( coord( id3 )=( 265, 153 ), 11640 ). % Frame number: 292 happensAt( walking( id0 ), 11680 ). holdsAt( coord( id0 )=( 197, 218 ), 11680 ). happensAt( walking( id1 ), 11680 ). holdsAt( coord( id1 )=( 222, 235 ), 11680 ). happensAt( walking( id2 ), 11680 ). holdsAt( coord( id2 )=( 191, 182 ), 11680 ). happensAt( walking( id3 ), 11680 ). holdsAt( coord( id3 )=( 269, 158 ), 11680 ). % Frame number: 293 happensAt( walking( id0 ), 11720 ). holdsAt( coord( id0 )=( 197, 219 ), 11720 ). happensAt( walking( id1 ), 11720 ). holdsAt( coord( id1 )=( 222, 237 ), 11720 ). happensAt( walking( id2 ), 11720 ). holdsAt( coord( id2 )=( 192, 183 ), 11720 ). happensAt( walking( id3 ), 11720 ). holdsAt( coord( id3 )=( 271, 162 ), 11720 ). % Frame number: 294 happensAt( walking( id0 ), 11760 ). holdsAt( coord( id0 )=( 198, 220 ), 11760 ). happensAt( walking( id1 ), 11760 ). holdsAt( coord( id1 )=( 222, 239 ), 11760 ). happensAt( walking( id2 ), 11760 ). holdsAt( coord( id2 )=( 192, 184 ), 11760 ). happensAt( walking( id3 ), 11760 ). holdsAt( coord( id3 )=( 274, 166 ), 11760 ). % Frame number: 295 happensAt( walking( id0 ), 11800 ). holdsAt( coord( id0 )=( 199, 221 ), 11800 ). happensAt( walking( id1 ), 11800 ). holdsAt( coord( id1 )=( 222, 239 ), 11800 ). happensAt( walking( id2 ), 11800 ). holdsAt( coord( id2 )=( 192, 184 ), 11800 ). happensAt( walking( id3 ), 11800 ). holdsAt( coord( id3 )=( 276, 169 ), 11800 ). % Frame number: 296 happensAt( walking( id0 ), 11840 ). holdsAt( coord( id0 )=( 199, 223 ), 11840 ). happensAt( walking( id1 ), 11840 ). holdsAt( coord( id1 )=( 222, 240 ), 11840 ). happensAt( walking( id2 ), 11840 ). holdsAt( coord( id2 )=( 193, 185 ), 11840 ). happensAt( walking( id3 ), 11840 ). holdsAt( coord( id3 )=( 278, 172 ), 11840 ). % Frame number: 297 happensAt( walking( id0 ), 11880 ). holdsAt( coord( id0 )=( 199, 224 ), 11880 ). happensAt( walking( id1 ), 11880 ). holdsAt( coord( id1 )=( 222, 240 ), 11880 ). happensAt( walking( id2 ), 11880 ). holdsAt( coord( id2 )=( 194, 187 ), 11880 ). happensAt( walking( id3 ), 11880 ). holdsAt( coord( id3 )=( 280, 174 ), 11880 ). % Frame number: 298 happensAt( walking( id0 ), 11920 ). holdsAt( coord( id0 )=( 199, 225 ), 11920 ). happensAt( walking( id1 ), 11920 ). holdsAt( coord( id1 )=( 222, 241 ), 11920 ). happensAt( walking( id2 ), 11920 ). holdsAt( coord( id2 )=( 196, 188 ), 11920 ). happensAt( walking( id3 ), 11920 ). holdsAt( coord( id3 )=( 281, 176 ), 11920 ). % Frame number: 299 happensAt( walking( id0 ), 11960 ). holdsAt( coord( id0 )=( 199, 229 ), 11960 ). happensAt( walking( id1 ), 11960 ). holdsAt( coord( id1 )=( 222, 243 ), 11960 ). happensAt( walking( id2 ), 11960 ). holdsAt( coord( id2 )=( 200, 190 ), 11960 ). happensAt( walking( id3 ), 11960 ). holdsAt( coord( id3 )=( 283, 176 ), 11960 ). % Frame number: 300 happensAt( walking( id0 ), 12000 ). holdsAt( coord( id0 )=( 199, 231 ), 12000 ). happensAt( walking( id1 ), 12000 ). holdsAt( coord( id1 )=( 222, 245 ), 12000 ). happensAt( walking( id2 ), 12000 ). holdsAt( coord( id2 )=( 202, 192 ), 12000 ). happensAt( walking( id3 ), 12000 ). holdsAt( coord( id3 )=( 283, 177 ), 12000 ). % Frame number: 301 happensAt( walking( id0 ), 12040 ). holdsAt( coord( id0 )=( 200, 231 ), 12040 ). happensAt( walking( id1 ), 12040 ). holdsAt( coord( id1 )=( 223, 248 ), 12040 ). happensAt( walking( id2 ), 12040 ). holdsAt( coord( id2 )=( 205, 193 ), 12040 ). happensAt( walking( id3 ), 12040 ). holdsAt( coord( id3 )=( 284, 179 ), 12040 ). % Frame number: 302 happensAt( walking( id0 ), 12080 ). holdsAt( coord( id0 )=( 200, 232 ), 12080 ). happensAt( walking( id1 ), 12080 ). holdsAt( coord( id1 )=( 223, 252 ), 12080 ). happensAt( walking( id2 ), 12080 ). holdsAt( coord( id2 )=( 207, 195 ), 12080 ). happensAt( walking( id3 ), 12080 ). holdsAt( coord( id3 )=( 285, 181 ), 12080 ). % Frame number: 303 happensAt( walking( id0 ), 12120 ). holdsAt( coord( id0 )=( 201, 233 ), 12120 ). happensAt( walking( id1 ), 12120 ). holdsAt( coord( id1 )=( 223, 255 ), 12120 ). happensAt( walking( id2 ), 12120 ). holdsAt( coord( id2 )=( 208, 196 ), 12120 ). happensAt( walking( id3 ), 12120 ). holdsAt( coord( id3 )=( 286, 182 ), 12120 ). % Frame number: 304 happensAt( walking( id0 ), 12160 ). holdsAt( coord( id0 )=( 202, 233 ), 12160 ). happensAt( walking( id1 ), 12160 ). holdsAt( coord( id1 )=( 224, 259 ), 12160 ). happensAt( walking( id2 ), 12160 ). holdsAt( coord( id2 )=( 211, 197 ), 12160 ). happensAt( walking( id3 ), 12160 ). holdsAt( coord( id3 )=( 287, 184 ), 12160 ). % Frame number: 305 happensAt( walking( id0 ), 12200 ). holdsAt( coord( id0 )=( 202, 234 ), 12200 ). happensAt( walking( id1 ), 12200 ). holdsAt( coord( id1 )=( 224, 262 ), 12200 ). happensAt( walking( id2 ), 12200 ). holdsAt( coord( id2 )=( 211, 199 ), 12200 ). happensAt( walking( id3 ), 12200 ). holdsAt( coord( id3 )=( 287, 185 ), 12200 ). % Frame number: 306 happensAt( walking( id0 ), 12240 ). holdsAt( coord( id0 )=( 202, 234 ), 12240 ). happensAt( walking( id1 ), 12240 ). holdsAt( coord( id1 )=( 224, 263 ), 12240 ). happensAt( walking( id2 ), 12240 ). holdsAt( coord( id2 )=( 212, 200 ), 12240 ). happensAt( walking( id3 ), 12240 ). holdsAt( coord( id3 )=( 291, 188 ), 12240 ). % Frame number: 307 happensAt( walking( id0 ), 12280 ). holdsAt( coord( id0 )=( 201, 235 ), 12280 ). happensAt( walking( id1 ), 12280 ). holdsAt( coord( id1 )=( 225, 264 ), 12280 ). happensAt( walking( id2 ), 12280 ). holdsAt( coord( id2 )=( 213, 200 ), 12280 ). happensAt( walking( id3 ), 12280 ). holdsAt( coord( id3 )=( 293, 192 ), 12280 ). % Frame number: 308 happensAt( walking( id0 ), 12320 ). holdsAt( coord( id0 )=( 201, 237 ), 12320 ). happensAt( walking( id1 ), 12320 ). holdsAt( coord( id1 )=( 226, 265 ), 12320 ). happensAt( walking( id2 ), 12320 ). holdsAt( coord( id2 )=( 213, 202 ), 12320 ). happensAt( walking( id3 ), 12320 ). holdsAt( coord( id3 )=( 294, 196 ), 12320 ). % Frame number: 309 happensAt( walking( id0 ), 12360 ). holdsAt( coord( id0 )=( 202, 238 ), 12360 ). happensAt( walking( id1 ), 12360 ). holdsAt( coord( id1 )=( 226, 267 ), 12360 ). happensAt( walking( id2 ), 12360 ). holdsAt( coord( id2 )=( 214, 203 ), 12360 ). happensAt( walking( id3 ), 12360 ). holdsAt( coord( id3 )=( 297, 199 ), 12360 ). % Frame number: 310 happensAt( walking( id0 ), 12400 ). holdsAt( coord( id0 )=( 202, 242 ), 12400 ). happensAt( walking( id1 ), 12400 ). holdsAt( coord( id1 )=( 227, 267 ), 12400 ). happensAt( walking( id2 ), 12400 ). holdsAt( coord( id2 )=( 214, 204 ), 12400 ). happensAt( walking( id3 ), 12400 ). holdsAt( coord( id3 )=( 298, 201 ), 12400 ). % Frame number: 311 happensAt( walking( id0 ), 12440 ). holdsAt( coord( id0 )=( 204, 244 ), 12440 ). happensAt( walking( id1 ), 12440 ). holdsAt( coord( id1 )=( 227, 267 ), 12440 ). happensAt( walking( id2 ), 12440 ). holdsAt( coord( id2 )=( 215, 206 ), 12440 ). happensAt( walking( id3 ), 12440 ). holdsAt( coord( id3 )=( 299, 203 ), 12440 ). % Frame number: 312 happensAt( walking( id0 ), 12480 ). holdsAt( coord( id0 )=( 206, 247 ), 12480 ). happensAt( walking( id1 ), 12480 ). holdsAt( coord( id1 )=( 227, 267 ), 12480 ). happensAt( walking( id2 ), 12480 ). holdsAt( coord( id2 )=( 217, 208 ), 12480 ). happensAt( walking( id3 ), 12480 ). holdsAt( coord( id3 )=( 300, 204 ), 12480 ). % Frame number: 313 happensAt( walking( id0 ), 12520 ). holdsAt( coord( id0 )=( 208, 249 ), 12520 ). happensAt( walking( id1 ), 12520 ). holdsAt( coord( id1 )=( 228, 268 ), 12520 ). happensAt( walking( id2 ), 12520 ). holdsAt( coord( id2 )=( 217, 211 ), 12520 ). happensAt( walking( id3 ), 12520 ). holdsAt( coord( id3 )=( 301, 206 ), 12520 ). % Frame number: 314 happensAt( walking( id0 ), 12560 ). holdsAt( coord( id0 )=( 209, 251 ), 12560 ). happensAt( walking( id1 ), 12560 ). holdsAt( coord( id1 )=( 228, 269 ), 12560 ). happensAt( walking( id2 ), 12560 ). holdsAt( coord( id2 )=( 218, 214 ), 12560 ). happensAt( walking( id3 ), 12560 ). holdsAt( coord( id3 )=( 301, 208 ), 12560 ). % Frame number: 315 happensAt( walking( id0 ), 12600 ). holdsAt( coord( id0 )=( 209, 252 ), 12600 ). happensAt( walking( id1 ), 12600 ). holdsAt( coord( id1 )=( 228, 270 ), 12600 ). happensAt( walking( id2 ), 12600 ). holdsAt( coord( id2 )=( 219, 218 ), 12600 ). happensAt( walking( id3 ), 12600 ). holdsAt( coord( id3 )=( 302, 210 ), 12600 ). % Frame number: 316 happensAt( walking( id0 ), 12640 ). holdsAt( coord( id0 )=( 210, 253 ), 12640 ). happensAt( walking( id1 ), 12640 ). holdsAt( coord( id1 )=( 228, 272 ), 12640 ). happensAt( walking( id2 ), 12640 ). holdsAt( coord( id2 )=( 221, 220 ), 12640 ). happensAt( walking( id3 ), 12640 ). holdsAt( coord( id3 )=( 305, 215 ), 12640 ). % Frame number: 317 happensAt( walking( id0 ), 12680 ). holdsAt( coord( id0 )=( 211, 254 ), 12680 ). happensAt( walking( id1 ), 12680 ). holdsAt( coord( id1 )=( 228, 275 ), 12680 ). happensAt( walking( id2 ), 12680 ). holdsAt( coord( id2 )=( 222, 221 ), 12680 ). happensAt( walking( id3 ), 12680 ). holdsAt( coord( id3 )=( 306, 219 ), 12680 ). % Frame number: 318 happensAt( walking( id0 ), 12720 ). holdsAt( coord( id0 )=( 211, 255 ), 12720 ). happensAt( walking( id1 ), 12720 ). holdsAt( coord( id1 )=( 229, 277 ), 12720 ). happensAt( walking( id2 ), 12720 ). holdsAt( coord( id2 )=( 223, 222 ), 12720 ). happensAt( walking( id3 ), 12720 ). holdsAt( coord( id3 )=( 307, 223 ), 12720 ). % Frame number: 319 happensAt( walking( id0 ), 12760 ). holdsAt( coord( id0 )=( 212, 255 ), 12760 ). happensAt( walking( id1 ), 12760 ). holdsAt( coord( id1 )=( 232, 279 ), 12760 ). happensAt( walking( id2 ), 12760 ). holdsAt( coord( id2 )=( 224, 223 ), 12760 ). happensAt( walking( id3 ), 12760 ). holdsAt( coord( id3 )=( 308, 225 ), 12760 ). % Frame number: 320 happensAt( walking( id0 ), 12800 ). holdsAt( coord( id0 )=( 213, 255 ), 12800 ). happensAt( walking( id1 ), 12800 ). holdsAt( coord( id1 )=( 235, 280 ), 12800 ). happensAt( walking( id2 ), 12800 ). holdsAt( coord( id2 )=( 224, 223 ), 12800 ). happensAt( walking( id3 ), 12800 ). holdsAt( coord( id3 )=( 309, 228 ), 12800 ). % Frame number: 321 happensAt( walking( id0 ), 12840 ). holdsAt( coord( id0 )=( 213, 257 ), 12840 ). happensAt( walking( id1 ), 12840 ). holdsAt( coord( id1 )=( 236, 280 ), 12840 ). happensAt( walking( id2 ), 12840 ). holdsAt( coord( id2 )=( 225, 224 ), 12840 ). happensAt( walking( id3 ), 12840 ). holdsAt( coord( id3 )=( 310, 231 ), 12840 ). % Frame number: 322 happensAt( walking( id0 ), 12880 ). holdsAt( coord( id0 )=( 213, 258 ), 12880 ). happensAt( walking( id1 ), 12880 ). holdsAt( coord( id1 )=( 243, 280 ), 12880 ). happensAt( walking( id2 ), 12880 ). holdsAt( coord( id2 )=( 225, 225 ), 12880 ). happensAt( walking( id3 ), 12880 ). holdsAt( coord( id3 )=( 310, 234 ), 12880 ). % Frame number: 323 happensAt( walking( id0 ), 12920 ). holdsAt( coord( id0 )=( 213, 260 ), 12920 ). happensAt( walking( id1 ), 12920 ). holdsAt( coord( id1 )=( 243, 280 ), 12920 ). happensAt( walking( id2 ), 12920 ). holdsAt( coord( id2 )=( 226, 226 ), 12920 ). happensAt( walking( id3 ), 12920 ). holdsAt( coord( id3 )=( 310, 235 ), 12920 ). % Frame number: 324 happensAt( walking( id0 ), 12960 ). holdsAt( coord( id0 )=( 213, 263 ), 12960 ). happensAt( walking( id1 ), 12960 ). holdsAt( coord( id1 )=( 243, 280 ), 12960 ). happensAt( walking( id2 ), 12960 ). holdsAt( coord( id2 )=( 226, 230 ), 12960 ). happensAt( walking( id3 ), 12960 ). holdsAt( coord( id3 )=( 311, 236 ), 12960 ). % Frame number: 325 happensAt( walking( id0 ), 13000 ). holdsAt( coord( id0 )=( 213, 266 ), 13000 ). happensAt( walking( id1 ), 13000 ). holdsAt( coord( id1 )=( 243, 280 ), 13000 ). happensAt( walking( id2 ), 13000 ). holdsAt( coord( id2 )=( 229, 233 ), 13000 ). happensAt( walking( id3 ), 13000 ). holdsAt( coord( id3 )=( 311, 236 ), 13000 ). % Frame number: 326 happensAt( walking( id0 ), 13040 ). holdsAt( coord( id0 )=( 213, 267 ), 13040 ). happensAt( walking( id1 ), 13040 ). holdsAt( coord( id1 )=( 243, 280 ), 13040 ). happensAt( walking( id2 ), 13040 ). holdsAt( coord( id2 )=( 230, 235 ), 13040 ). happensAt( walking( id3 ), 13040 ). holdsAt( coord( id3 )=( 312, 239 ), 13040 ). % Frame number: 327 happensAt( walking( id0 ), 13080 ). holdsAt( coord( id0 )=( 213, 268 ), 13080 ). happensAt( walking( id1 ), 13080 ). holdsAt( coord( id1 )=( 243, 280 ), 13080 ). happensAt( walking( id2 ), 13080 ). holdsAt( coord( id2 )=( 233, 238 ), 13080 ). happensAt( walking( id3 ), 13080 ). holdsAt( coord( id3 )=( 312, 241 ), 13080 ). % Frame number: 328 happensAt( walking( id0 ), 13120 ). holdsAt( coord( id0 )=( 214, 269 ), 13120 ). happensAt( walking( id1 ), 13120 ). holdsAt( coord( id1 )=( 244, 282 ), 13120 ). happensAt( walking( id2 ), 13120 ). holdsAt( coord( id2 )=( 236, 240 ), 13120 ). happensAt( walking( id3 ), 13120 ). holdsAt( coord( id3 )=( 312, 244 ), 13120 ). % Frame number: 329 happensAt( walking( id0 ), 13160 ). holdsAt( coord( id0 )=( 214, 269 ), 13160 ). happensAt( walking( id1 ), 13160 ). holdsAt( coord( id1 )=( 245, 282 ), 13160 ). happensAt( walking( id2 ), 13160 ). holdsAt( coord( id2 )=( 238, 241 ), 13160 ). happensAt( walking( id3 ), 13160 ). holdsAt( coord( id3 )=( 312, 248 ), 13160 ). % Frame number: 330 happensAt( walking( id0 ), 13200 ). holdsAt( coord( id0 )=( 214, 270 ), 13200 ). happensAt( walking( id1 ), 13200 ). holdsAt( coord( id1 )=( 245, 284 ), 13200 ). happensAt( walking( id2 ), 13200 ). holdsAt( coord( id2 )=( 240, 243 ), 13200 ). happensAt( walking( id3 ), 13200 ). holdsAt( coord( id3 )=( 312, 252 ), 13200 ). % Frame number: 331 happensAt( walking( id0 ), 13240 ). holdsAt( coord( id0 )=( 214, 272 ), 13240 ). happensAt( walking( id2 ), 13240 ). holdsAt( coord( id2 )=( 242, 244 ), 13240 ). happensAt( walking( id3 ), 13240 ). holdsAt( coord( id3 )=( 313, 256 ), 13240 ). % Frame number: 332 happensAt( walking( id0 ), 13280 ). holdsAt( coord( id0 )=( 214, 272 ), 13280 ). happensAt( walking( id2 ), 13280 ). holdsAt( coord( id2 )=( 243, 245 ), 13280 ). happensAt( walking( id3 ), 13280 ). holdsAt( coord( id3 )=( 313, 261 ), 13280 ). % Frame number: 333 happensAt( walking( id0 ), 13320 ). holdsAt( coord( id0 )=( 214, 272 ), 13320 ). happensAt( walking( id2 ), 13320 ). holdsAt( coord( id2 )=( 244, 245 ), 13320 ). happensAt( walking( id3 ), 13320 ). holdsAt( coord( id3 )=( 313, 264 ), 13320 ). % Frame number: 334 happensAt( walking( id0 ), 13360 ). holdsAt( coord( id0 )=( 214, 272 ), 13360 ). happensAt( walking( id2 ), 13360 ). holdsAt( coord( id2 )=( 244, 245 ), 13360 ). happensAt( walking( id3 ), 13360 ). holdsAt( coord( id3 )=( 313, 265 ), 13360 ). % Frame number: 335 happensAt( walking( id0 ), 13400 ). holdsAt( coord( id0 )=( 214, 272 ), 13400 ). happensAt( walking( id2 ), 13400 ). holdsAt( coord( id2 )=( 245, 246 ), 13400 ). happensAt( walking( id3 ), 13400 ). holdsAt( coord( id3 )=( 313, 266 ), 13400 ). % Frame number: 336 happensAt( walking( id0 ), 13440 ). holdsAt( coord( id0 )=( 214, 273 ), 13440 ). happensAt( walking( id2 ), 13440 ). holdsAt( coord( id2 )=( 245, 247 ), 13440 ). happensAt( walking( id3 ), 13440 ). holdsAt( coord( id3 )=( 312, 266 ), 13440 ). % Frame number: 337 happensAt( walking( id0 ), 13480 ). holdsAt( coord( id0 )=( 214, 274 ), 13480 ). happensAt( walking( id2 ), 13480 ). holdsAt( coord( id2 )=( 246, 248 ), 13480 ). happensAt( walking( id3 ), 13480 ). holdsAt( coord( id3 )=( 312, 266 ), 13480 ). % Frame number: 338 happensAt( walking( id0 ), 13520 ). holdsAt( coord( id0 )=( 216, 275 ), 13520 ). happensAt( walking( id2 ), 13520 ). holdsAt( coord( id2 )=( 247, 250 ), 13520 ). happensAt( walking( id3 ), 13520 ). holdsAt( coord( id3 )=( 311, 266 ), 13520 ). % Frame number: 339 happensAt( walking( id0 ), 13560 ). holdsAt( coord( id0 )=( 216, 276 ), 13560 ). happensAt( walking( id2 ), 13560 ). holdsAt( coord( id2 )=( 247, 253 ), 13560 ). happensAt( walking( id3 ), 13560 ). holdsAt( coord( id3 )=( 311, 266 ), 13560 ). % Frame number: 340 happensAt( walking( id0 ), 13600 ). holdsAt( coord( id0 )=( 217, 278 ), 13600 ). happensAt( walking( id2 ), 13600 ). holdsAt( coord( id2 )=( 247, 254 ), 13600 ). happensAt( walking( id3 ), 13600 ). holdsAt( coord( id3 )=( 311, 267 ), 13600 ). % Frame number: 341 happensAt( walking( id0 ), 13640 ). holdsAt( coord( id0 )=( 218, 280 ), 13640 ). happensAt( walking( id2 ), 13640 ). holdsAt( coord( id2 )=( 247, 258 ), 13640 ). happensAt( walking( id3 ), 13640 ). holdsAt( coord( id3 )=( 311, 270 ), 13640 ). % Frame number: 342 happensAt( walking( id0 ), 13680 ). holdsAt( coord( id0 )=( 219, 281 ), 13680 ). happensAt( walking( id2 ), 13680 ). holdsAt( coord( id2 )=( 247, 258 ), 13680 ). happensAt( walking( id3 ), 13680 ). holdsAt( coord( id3 )=( 311, 272 ), 13680 ). % Frame number: 343 happensAt( walking( id0 ), 13720 ). holdsAt( coord( id0 )=( 221, 281 ), 13720 ). happensAt( walking( id2 ), 13720 ). holdsAt( coord( id2 )=( 248, 259 ), 13720 ). happensAt( walking( id3 ), 13720 ). holdsAt( coord( id3 )=( 311, 275 ), 13720 ). % Frame number: 344 happensAt( walking( id0 ), 13760 ). holdsAt( coord( id0 )=( 221, 281 ), 13760 ). happensAt( walking( id2 ), 13760 ). holdsAt( coord( id2 )=( 248, 260 ), 13760 ). happensAt( walking( id3 ), 13760 ). holdsAt( coord( id3 )=( 312, 278 ), 13760 ). % Frame number: 345 happensAt( walking( id0 ), 13800 ). holdsAt( coord( id0 )=( 220, 281 ), 13800 ). happensAt( walking( id2 ), 13800 ). holdsAt( coord( id2 )=( 249, 262 ), 13800 ). happensAt( walking( id3 ), 13800 ). holdsAt( coord( id3 )=( 314, 281 ), 13800 ). % Frame number: 346 happensAt( walking( id0 ), 13840 ). holdsAt( coord( id0 )=( 221, 281 ), 13840 ). happensAt( walking( id2 ), 13840 ). holdsAt( coord( id2 )=( 250, 263 ), 13840 ). happensAt( walking( id3 ), 13840 ). holdsAt( coord( id3 )=( 315, 282 ), 13840 ). % Frame number: 347 happensAt( walking( id0 ), 13880 ). holdsAt( coord( id0 )=( 221, 281 ), 13880 ). happensAt( walking( id2 ), 13880 ). holdsAt( coord( id2 )=( 250, 263 ), 13880 ). happensAt( walking( id3 ), 13880 ). holdsAt( coord( id3 )=( 316, 282 ), 13880 ). % Frame number: 348 happensAt( walking( id0 ), 13920 ). holdsAt( coord( id0 )=( 223, 281 ), 13920 ). happensAt( walking( id2 ), 13920 ). holdsAt( coord( id2 )=( 250, 264 ), 13920 ). happensAt( walking( id3 ), 13920 ). holdsAt( coord( id3 )=( 316, 283 ), 13920 ). % Frame number: 349 happensAt( walking( id0 ), 13960 ). holdsAt( coord( id0 )=( 226, 281 ), 13960 ). happensAt( walking( id2 ), 13960 ). holdsAt( coord( id2 )=( 250, 265 ), 13960 ). happensAt( walking( id3 ), 13960 ). holdsAt( coord( id3 )=( 314, 283 ), 13960 ). % Frame number: 350 happensAt( walking( id0 ), 14000 ). holdsAt( coord( id0 )=( 227, 281 ), 14000 ). happensAt( walking( id2 ), 14000 ). holdsAt( coord( id2 )=( 250, 266 ), 14000 ). happensAt( walking( id3 ), 14000 ). holdsAt( coord( id3 )=( 313, 284 ), 14000 ). % Frame number: 351 happensAt( walking( id0 ), 14040 ). holdsAt( coord( id0 )=( 227, 281 ), 14040 ). happensAt( walking( id2 ), 14040 ). holdsAt( coord( id2 )=( 250, 267 ), 14040 ). % Frame number: 352 happensAt( walking( id0 ), 14080 ). holdsAt( coord( id0 )=( 227, 284 ), 14080 ). happensAt( walking( id2 ), 14080 ). holdsAt( coord( id2 )=( 250, 268 ), 14080 ). % Frame number: 353 happensAt( walking( id2 ), 14120 ). holdsAt( coord( id2 )=( 250, 269 ), 14120 ). % Frame number: 354 happensAt( walking( id2 ), 14160 ). holdsAt( coord( id2 )=( 250, 270 ), 14160 ). % Frame number: 355 happensAt( walking( id2 ), 14200 ). holdsAt( coord( id2 )=( 251, 271 ), 14200 ). % Frame number: 356 happensAt( walking( id2 ), 14240 ). holdsAt( coord( id2 )=( 252, 272 ), 14240 ). % Frame number: 357 happensAt( walking( id2 ), 14280 ). holdsAt( coord( id2 )=( 253, 274 ), 14280 ). % Frame number: 358 happensAt( walking( id2 ), 14320 ). holdsAt( coord( id2 )=( 254, 276 ), 14320 ). % Frame number: 359 happensAt( walking( id2 ), 14360 ). holdsAt( coord( id2 )=( 254, 277 ), 14360 ). % Frame number: 360 happensAt( walking( id2 ), 14400 ). holdsAt( coord( id2 )=( 255, 277 ), 14400 ). % Frame number: 361 happensAt( walking( id2 ), 14440 ). holdsAt( coord( id2 )=( 255, 277 ), 14440 ). % Frame number: 362 happensAt( walking( id2 ), 14480 ). holdsAt( coord( id2 )=( 256, 277 ), 14480 ). % Frame number: 363 happensAt( walking( id2 ), 14520 ). holdsAt( coord( id2 )=( 256, 277 ), 14520 ). % Frame number: 364 happensAt( walking( id2 ), 14560 ). holdsAt( coord( id2 )=( 258, 277 ), 14560 ). % Frame number: 365 happensAt( walking( id2 ), 14600 ). holdsAt( coord( id2 )=( 258, 277 ), 14600 ). % Frame number: 366 happensAt( walking( id2 ), 14640 ). holdsAt( coord( id2 )=( 257, 277 ), 14640 ). % Frame number: 367 happensAt( walking( id2 ), 14680 ). holdsAt( coord( id2 )=( 257, 277 ), 14680 ). % Frame number: 368 happensAt( walking( id2 ), 14720 ). holdsAt( coord( id2 )=( 257, 277 ), 14720 ). % Frame number: 369 happensAt( walking( id2 ), 14760 ). holdsAt( coord( id2 )=( 259, 277 ), 14760 ). % Frame number: 370 happensAt( walking( id2 ), 14800 ). holdsAt( coord( id2 )=( 262, 277 ), 14800 ). % Frame number: 371 happensAt( walking( id2 ), 14840 ). holdsAt( coord( id2 )=( 262, 278 ), 14840 ). % Frame number: 372 happensAt( walking( id2 ), 14880 ). holdsAt( coord( id2 )=( 262, 279 ), 14880 ). % Frame number: 373 happensAt( walking( id2 ), 14920 ). holdsAt( coord( id2 )=( 262, 280 ), 14920 ). % Frame number: 374 happensAt( walking( id2 ), 14960 ). holdsAt( coord( id2 )=( 261, 281 ), 14960 ). % Frame number: 375 happensAt( walking( id2 ), 15000 ). holdsAt( coord( id2 )=( 261, 282 ), 15000 ). % Frame number: 376 happensAt( walking( id2 ), 15040 ). holdsAt( coord( id2 )=( 264, 283 ), 15040 ).
JasonFil/Prob-EC
dataset/strong-noise/23-Meet_Crowd/mc1gtMovementIndv.pl
Perl
bsd-3-clause
99,154
#line 1 package Module::Install::Include; use Module::Install::Base; @ISA = qw(Module::Install::Base); $VERSION = '0.61'; use strict; sub include { shift()->admin->include(@_); } sub include_deps { shift()->admin->include_deps(@_); } sub auto_include { shift()->admin->auto_include(@_); } sub auto_include_deps { shift()->admin->auto_include_deps(@_); } sub auto_include_dependent_dists { shift()->admin->auto_include_dependent_dists(@_); } 1;
dineshkummarc/gitak-1.0
server/selenium-remote-control-1.0.3/selenium-perl-client-driver-1.0.1/inc/Module/Install/Include.pm
Perl
apache-2.0
458
package ExtUtils::MM_Win95; use strict; our $VERSION = '6.64'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); use ExtUtils::MakeMaker::Config; =head1 NAME ExtUtils::MM_Win95 - method to customize MakeMaker for Win9X =head1 SYNOPSIS You should not be using this module directly. =head1 DESCRIPTION This is a subclass of ExtUtils::MM_Win32 containing changes necessary to get MakeMaker playing nice with command.com and other Win9Xisms. =head2 Overridden methods Most of these make up for limitations in the Win9x/nmake command shell. Mostly its lack of &&. =over 4 =item xs_c The && problem. =cut sub xs_c { my($self) = shift; return '' unless $self->needs_linking(); ' .xs.c: $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c ' } =item xs_cpp The && problem =cut sub xs_cpp { my($self) = shift; return '' unless $self->needs_linking(); ' .xs.cpp: $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp '; } =item xs_o The && problem. =cut sub xs_o { my($self) = shift; return '' unless $self->needs_linking(); ' .xs$(OBJ_EXT): $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c '; } =item max_exec_len Win98 chokes on things like Encode if we set the max length to nmake's max of 2K. So we go for a more conservative value of 1K. =cut sub max_exec_len { my $self = shift; return $self->{_MAX_EXEC_LEN} ||= 1024; } =item os_flavor Win95 and Win98 and WinME are collectively Win9x and Win32 =cut sub os_flavor { my $self = shift; return ($self->SUPER::os_flavor, 'Win9x'); } =back =head1 AUTHOR Code originally inside MM_Win32. Original author unknown. Currently maintained by Michael G Schwern C<schwern@pobox.com>. Send patches and ideas to C<makemaker@perl.org>. See http://www.makemaker.org. =cut 1;
liuyangning/WX_web
xampp/perl/lib/ExtUtils/MM_Win95.pm
Perl
mit
1,892
# Itanium optimized Crypto code which was released by HP Labs at # http://www.hpl.hp.com/research/linux/crypto/. # # Copyright (c) 2005 Hewlett-Packard Development Company, L.P. # # Permission is hereby granted, free of charge, to any person obtaining # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION $code=<<___; .ident \"rc4-ia64.s, version 3.0\" .ident \"Copyright (c) 2005 Hewlett-Packard Development Company, L.P.\" #define LCSave r8
retrography/scancode-toolkit
tests/cluecode/data/ics/openssl-crypto-rc4-asm/rc4-ia64.pl
Perl
apache-2.0
1,035
package ExtUtils::CBuilder::Platform::darwin; use strict; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); $VERSION = '0.21'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub compile { my $self = shift; my $cf = $self->{config}; # -flat_namespace isn't a compile flag, it's a linker flag. But # it's mistakenly in Config.pm as both. Make the correction here. local $cf->{ccflags} = $cf->{ccflags}; $cf->{ccflags} =~ s/-flat_namespace//; $self->SUPER::compile(@_); } 1;
leighpauls/k2cro4
third_party/cygwin/lib/perl5/5.10/ExtUtils/CBuilder/Platform/darwin.pm
Perl
bsd-3-clause
512
/* Part of SWI-Prolog Author: Marcus Uneson E-mail: marcus.uneson@ling.lu.se WWW: http://person.sol.lu.se/MarcusUneson/ Copyright (c) 2011-2015, Marcus Uneson All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ :- module(optparse, [ opt_parse/5, %+OptsSpec, +CLArgs, -Opts, -PositionalArgs,-ParseOptions opt_parse/4, %+OptsSpec, +CLArgs, -Opts, -PositionalArgs, opt_arguments/3, %+OptsSpec, -Opts, -PositionalArgs opt_help/2 %+OptsSpec, -Help ]). :- autoload(library(apply),[maplist/3]). :- autoload(library(debug),[assertion/1]). :- autoload(library(error),[must_be/2]). :- autoload(library(lists),[member/2,max_list/2,reverse/2,append/3]). :- autoload(library(option),[merge_options/3,option/3]). :- set_prolog_flag(double_quotes, codes). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EXPORTS /** <module> command line parsing This module helps in building a command-line interface to an application. In particular, it provides functions that take an option specification and a list of atoms, probably given to the program on the command line, and return a parsed representation (a list of the customary Key(Val) by default; or optionally, a list of Func(Key, Val) terms in the style of current_prolog_flag/2). It can also synthesize a simple help text from the options specification. The terminology in the following is partly borrowed from python, see http://docs.python.org/library/optparse.html#terminology . Very briefly, _arguments_ is what you provide on the command line and for many prologs show up as a list of atoms =|Args|= in =|current_prolog_flag(argv, Args)|=. For a typical prolog incantation, they can be divided into * _|runtime arguments|_, which controls the prolog runtime; conventionally, they are ended by '--'; * _options_, which are key-value pairs (with a boolean value possibly implicit) intended to control your program in one way or another; and * _|positional arguments|_, which is what remains after all runtime arguments and options have been removed (with implicit arguments -- true/false for booleans -- filled in). Positional arguments are in particular used for mandatory arguments without which your program won't work and for which there are no sensible defaults (e.g,, input file names). Options, by contrast, offer flexibility by letting you change a default setting. Options are optional not only by etymology: this library has no notion of mandatory or required options (see the python docs for other rationales than laziness). The command-line arguments enter your program as a list of atoms, but the programs perhaps expects booleans, integers, floats or even prolog terms. You tell the parser so by providing an _|options specification|_. This is just a list of individual option specifications. One of those, in turn, is a list of ground prolog terms in the customary Name(Value) format. The following terms are recognized (any others raise error). * opt(Key) Key is what the option later will be accessed by, just like for current_prolog_flag(Key, Value). This term is mandatory (an error is thrown if missing). * shortflags(ListOfFlags) ListOfFlags denotes any single-dashed, single letter args specifying the current option (=|-s , -K|=, etc). Uppercase letters must be quoted. Usually ListOfFlags will be a singleton list, but sometimes aliased flags may be convenient. * longflags(ListOfFlags) ListOfFlags denotes any double-dashed arguments specifying the current option (=|--verbose, --no-debug|=, etc). They are basically a more readable alternative to short flags, except 1. long flags can be specified as =|--flag value|= or =|--flag=value|= (but not as =|--flagvalue|=); short flags as =|-f val|= or =|-fval|= (but not =|-f=val|=) 2. boolean long flags can be specified as =|--bool-flag|= or =|--bool-flag=true|= or =|--bool-flag true|=; and they can be negated as =|--no-bool-flag|= or =|--bool-flag=false|= or =|--bool-flag false|=. Except that shortflags must be single characters, the distinction between long and short is in calling convention, not in namespaces. Thus, if you have shortflags([v]), you can use it as =|-v2|= or =|-v 2|= or =|--v=2|= or =|--v 2|= (but not =|-v=2|= or =|--v2|=). Shortflags and longflags both default to =|[]|=. It can be useful to have flagless options -- see example below. * meta(Meta) Meta is optional and only relevant for the synthesized usage message and is the name (an atom) of the metasyntactic variable (possibly) appearing in it together with type and default value (e.g, =|x:integer=3|=, =|interest:float=0.11|=). It may be useful to have named variables (=|x|=, =|interest|=) in case you wish to mention them again in the help text. If not given the =|Meta:|= part is suppressed -- see example below. * type(Type) Type is one of =|boolean, atom, integer, float, term|=. The corresponding argument will be parsed appropriately. This term is optional; if not given, defaults to =|term|=. * default(Default) Default value. This term is optional; if not given, or if given the special value '_', an uninstantiated variable is created (and any type declaration is ignored). * help(Help) Help is (usually) an atom of text describing the option in the help text. This term is optional (but obviously strongly recommended for all options which have flags). Long lines are subject to basic word wrapping -- split on white space, reindent, rejoin. However, you can get more control by supplying the line breaking yourself: rather than a single line of text, you can provide a list of lines (as atoms). If you do, they will be joined with the appropriate indent but otherwise left untouched (see the option =mode= in the example below). Absence of mandatory option specs or the presence of more than one for a particular option throws an error, as do unknown or incompatible types. As a concrete example from a fictive application, suppose we want the following options to be read from the command line (long flag(s), short flag(s), meta:type=default, help) == --mode -m atom=SCAN data gathering mode, one of SCAN: do this READ: do that MAKE: make numbers WAIT: do nothing --rebuild-cache -r boolean=true rebuild cache in each iteration --heisenberg-threshold -t,-h float=0.1 heisenberg threshold --depths, --iters -i,-d K:integer=3 stop after K iterations --distances term=[1,2,3,5] initial prolog term --output-file -o FILE:atom=_ write output to FILE --label -l atom=REPORT report label --verbosity -v V:integer=2 verbosity level, 1 <= V <= 3 == We may also have some configuration parameters which we currently think not needs to be controlled from the command line, say path('/some/file/path'). This interface is described by the following options specification (order between the specifications of a particular option is irrelevant). == ExampleOptsSpec = [ [opt(mode ), type(atom), default('SCAN'), shortflags([m]), longflags(['mode'] ), help([ 'data gathering mode, one of' , ' SCAN: do this' , ' READ: do that' , ' MAKE: fabricate some numbers' , ' WAIT: don''t do anything'])] , [opt(cache), type(boolean), default(true), shortflags([r]), longflags(['rebuild-cache']), help('rebuild cache in each iteration')] , [opt(threshold), type(float), default(0.1), shortflags([t,h]), longflags(['heisenberg-threshold']), help('heisenberg threshold')] , [opt(depth), meta('K'), type(integer), default(3), shortflags([i,d]),longflags([depths,iters]), help('stop after K iterations')] , [opt(distances), default([1,2,3,5]), longflags([distances]), help('initial prolog term')] , [opt(outfile), meta('FILE'), type(atom), shortflags([o]), longflags(['output-file']), help('write output to FILE')] , [opt(label), type(atom), default('REPORT'), shortflags([l]), longflags([label]), help('report label')] , [opt(verbose), meta('V'), type(integer), default(2), shortflags([v]), longflags([verbosity]), help('verbosity level, 1 <= V <= 3')] , [opt(path), default('/some/file/path/')] ]. == The help text above was accessed by =|opt_help(ExamplesOptsSpec, HelpText)|=. The options appear in the same order as in the OptsSpec. Given =|ExampleOptsSpec|=, a command line (somewhat syntactically inconsistent, in order to demonstrate different calling conventions) may look as follows == ExampleArgs = [ '-d5' , '--heisenberg-threshold', '0.14' , '--distances=[1,1,2,3,5,8]' , '--iters', '7' , '-ooutput.txt' , '--rebuild-cache', 'true' , 'input.txt' , '--verbosity=2' ]. == opt_parse(ExampleOptsSpec, ExampleArgs, Opts, PositionalArgs) would then succeed with == Opts = [ mode('SCAN') , label('REPORT') , path('/some/file/path') , threshold(0.14) , distances([1,1,2,3,5,8]) , depth(7) , outfile('output.txt') , cache(true) , verbose(2) ], PositionalArgs = ['input.txt']. == Note that path('/some/file/path') showing up in Opts has a default value (of the implicit type 'term'), but no corresponding flags in OptsSpec. Thus it can't be set from the command line. The rest of your program doesn't need to know that, of course. This provides an alternative to the common practice of asserting such hard-coded parameters under a single predicate (for instance setting(path, '/some/file/path')), with the advantage that you may seamlessly upgrade them to command-line options, should you one day find this a good idea. Just add an appropriate flag or two and a line of help text. Similarly, suppressing an option in a cluttered interface amounts to commenting out the flags. opt_parse/5 allows more control through an additional argument list as shown in the example below. == ?- opt_parse(ExampleOptsSpec, ExampleArgs, Opts, PositionalArgs, [ output_functor(appl_config) ]). Opts = [ appl_config(verbose, 2), , appl_config(label, 'REPORT') ... ] == This representation may be preferable with the empty-flag configuration parameter style above (perhaps with asserting appl_config/2). ## Notes and tips {#optparse-notes} * In the example we were mostly explicit about the types. Since the default is =|term|=, which subsumes =|integer, float, atom|=, it may be possible to get away cheaper (e.g., by only giving booleans). However, it is recommended practice to always specify types: parsing becomes more reliable and error messages will be easier to interpret. * Note that =|-sbar|= is taken to mean =|-s bar|=, not =|-s -b -a -r|=, that is, there is no clustering of flags. * =|-s=foo|= is disallowed. The rationale is that although some command-line parsers will silently interpret this as =|-s =foo|=, this is very seldom what you want. To have an option argument start with '=' (very un-recommended), say so explicitly. * The example specifies the option =|depth|= twice: once as =|-d5|= and once as =|--iters 7|=. The default when encountering duplicated flags is to =|keeplast|= (this behaviour can be controlled, by ParseOption duplicated_flags). * The order of the options returned by the parsing functions is the same as given on the command line, with non-overridden defaults prepended and duplicates removed as in previous item. You should not rely on this, however. * Unknown flags (not appearing in OptsSpec) will throw errors. This is usually a Good Thing. Sometimes, however, you may wish to pass along flags to an external program (say, one called by shell/2), and it means duplicated effort and a maintenance headache to have to specify all possible flags for the external program explicitly (if it even can be done). On the other hand, simply taking all unknown flags as valid makes error checking much less efficient and identification of positional arguments uncertain. A better solution is to collect all arguments intended for passing along to an indirectly called program as a single argument, probably as an atom (if you don't need to inspect them first) or as a prolog term (if you do). @author Marcus Uneson @version 0.20 (2011-04-27) @tbd: validation? e.g, numbers; file path existence; one-out-of-a-set-of-atoms */ :- predicate_options(opt_parse/5, 5, [ allow_empty_flag_spec(boolean), duplicated_flags(oneof([keepfirst,keeplast,keepall])), output_functor(atom), suppress_empty_meta(boolean) ]). :- multifile error:has_type/2, parse_type/3. %% opt_arguments(+OptsSpec, -Opts, -PositionalArgs) is det % % Extract commandline options according to a specification. % Convenience predicate, assuming that command-line arguments can be % accessed by current_prolog_flag/2 (as in swi-prolog). For other % access mechanisms and/or more control, get the args and pass them % as a list of atoms to opt_parse/4 or opt_parse/5 instead. % % Opts is a list of parsed options in the form Key(Value). Dashed % args not in OptsSpec are not permitted and will raise error (see % tip on how to pass unknown flags in the module description). % PositionalArgs are the remaining non-dashed args after each flag % has taken its argument (filling in =true= or =false= for booleans). % There are no restrictions on non-dashed arguments and they may go % anywhere (although it is good practice to put them last). Any % leading arguments for the runtime (up to and including '--') are % discarded. opt_arguments(OptsSpec, Opts, PositionalArgs) :- current_prolog_flag(argv, Argv), opt_parse(OptsSpec, Argv, Opts, PositionalArgs). %% opt_parse(+OptsSpec, +ApplArgs, -Opts, -PositionalArgs) is det % % Equivalent to opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, []). opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs) :- opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, []). %% opt_parse(+OptsSpec, +ApplArgs, -Opts, -PositionalArgs, +ParseOptions) is det % % Parse the arguments Args (as list of atoms) according to OptsSpec. % Any runtime arguments (typically terminated by '--') are assumed to % be removed already. % % Opts is a list of parsed options in the form Key(Value), or (with % the option functor(Func) given) in the form Func(Key, Value). % Dashed args not in OptsSpec are not permitted and will raise error % (see tip on how to pass unknown flags in the module description). % PositionalArgs are the remaining non-dashed args after each flag % has taken its argument (filling in =true= or =false= for booleans). % There are no restrictions on non-dashed arguments and they may go % anywhere (although it is good practice to put them last). % ParseOptions are % % * output_functor(Func) % Set the functor Func of the returned options Func(Key,Value). % Default is the special value 'OPTION' (upper-case), which makes % the returned options have form Key(Value). % % * duplicated_flags(Keep) % Controls how to handle options given more than once on the commad line. % Keep is one of =|keepfirst, keeplast, keepall|= with the obvious meaning. % Default is =|keeplast|=. % % * allow_empty_flag_spec(Bool) % If true (default), a flag specification is not required (it is allowed % that both shortflags and longflags be either [] or absent). % Flagless options cannot be manipulated from the command line % and will not show up in the generated help. This is useful when you % have (also) general configuration parameters in % your OptsSpec, especially if you think they one day might need to be % controlled externally. See example in the module overview. % allow_empty_flag_spec(false) gives the more customary behaviour of % raising error on empty flags. opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, ParseOptions) :- opt_parse_(OptsSpec, ApplArgs, Opts, PositionalArgs, ParseOptions). %% opt_help(+OptsSpec, -Help:atom) is det % % True when Help is a help string synthesized from OptsSpec. opt_help(OptsSpec, Help) :- opt_help(OptsSpec, Help, []). % semi-arbitrary default format settings go here; % if someone needs more control one day, opt_help/3 could be exported opt_help(OptsSpec, Help, HelpOptions0) :- Defaults = [ line_width(80) , min_help_width(40) , break_long_flags(false) , suppress_empty_meta(true) ], merge_options(HelpOptions0, Defaults, HelpOptions), opt_help_(OptsSpec, Help, HelpOptions). %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OPT_PARSE opt_parse_(OptsSpec0, Args0, Opts, PositionalArgs, ParseOptions) :- must_be(list(atom), Args0), check_opts_spec(OptsSpec0, ParseOptions, OptsSpec), maplist(atom_codes, Args0, Args1), parse_options(OptsSpec, Args1, Args2, PositionalArgs), add_default_opts(OptsSpec, Args2, Args3), option(duplicated_flags(Keep), ParseOptions, keeplast), remove_duplicates(Keep, Args3, Args4), option(output_functor(Func), ParseOptions, 'OPTION'), refunctor_opts(Func, Args4, Opts). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MAKE HELP opt_help_(OptsSpec0, Help, HelpOptions) :- check_opts_spec(OptsSpec0, HelpOptions, OptsSpec1), include_in_help(OptsSpec1, OptsSpec2), format_help_fields(OptsSpec2, OptsSpec3), col_widths(OptsSpec3, [shortflags, metatypedef], CWs), long_flag_col_width(OptsSpec3, LongestFlagWidth), maplist(format_opt(LongestFlagWidth, CWs, HelpOptions), OptsSpec3, Lines), atomic_list_concat(Lines, Help). include_in_help([], []). include_in_help([OptSpec|OptsSpec], Result) :- ( flags(OptSpec, [_|_]) -> Result = [OptSpec|Rest] ; Result = Rest ), include_in_help(OptsSpec, Rest). format_help_fields(OptsSpec0, OptsSpec) :- maplist(embellish_flag(short), OptsSpec0, OptsSpec1), maplist(embellish_flag(long), OptsSpec1, OptsSpec2), maplist(merge_meta_type_def, OptsSpec2, OptsSpec). merge_meta_type_def(OptSpecIn, [metatypedef(MTD)|OptSpecIn]) :- memberchk(meta(Meta), OptSpecIn), memberchk(type(Type), OptSpecIn), memberchk(default(Def), OptSpecIn), atom_length(Meta, N), ( N > 0 -> format(atom(MTD), '~w:~w=~w', [Meta, Type, Def]) ; format(atom(MTD), '~w=~w', [Type, Def]) ). embellish_flag(short, OptSpecIn, OptSpecOut) :- memberchk(shortflags(FlagsIn), OptSpecIn), maplist(atom_concat('-'), FlagsIn, FlagsOut0), atomic_list_concat(FlagsOut0, ',', FlagsOut), merge_options([shortflags(FlagsOut)], OptSpecIn, OptSpecOut). embellish_flag(long, OptSpecIn, OptSpecOut) :- memberchk(longflags(FlagsIn), OptSpecIn), maplist(atom_concat('--'), FlagsIn, FlagsOut), merge_options([longflags(FlagsOut)], OptSpecIn, OptSpecOut). col_widths(OptsSpec, Functors, ColWidths) :- maplist(col_width(OptsSpec), Functors, ColWidths). col_width(OptsSpec, Functor, ColWidth) :- findall(N, ( member(OptSpec, OptsSpec), M =.. [Functor, Arg], member(M, OptSpec), format(atom(Atom), '~w', [Arg]), atom_length(Atom, N0), N is N0 + 2 %separate cols with two spaces ), Ns), max_list([0|Ns], ColWidth). long_flag_col_width(OptsSpec, ColWidth) :- findall(FlagLength, ( member(OptSpec, OptsSpec), memberchk(longflags(LFlags), OptSpec), member(LFlag, LFlags), atom_length(LFlag, FlagLength) ), FlagLengths), max_list([0|FlagLengths], ColWidth). format_opt(LongestFlagWidth, [SFlagsCW, MTDCW], HelpOptions, Opt, Line) :- memberchk(shortflags(SFlags), Opt), memberchk(longflags(LFlags0), Opt), group_length(LongestFlagWidth, LFlags0, LFlags1), LFlagsCW is LongestFlagWidth + 2, %separate with comma and space option(break_long_flags(BLF), HelpOptions, true), ( BLF -> maplist(atomic_list_concat_(',\n'), LFlags1, LFlags2) ; maplist(atomic_list_concat_(', '), LFlags1, LFlags2) ), atomic_list_concat(LFlags2, ',\n', LFlags), memberchk(metatypedef(MetaTypeDef), Opt), memberchk(help(Help), Opt), HelpIndent is LFlagsCW + SFlagsCW + MTDCW + 2, option(line_width(LW), HelpOptions, 80), option(min_help_width(MHW), HelpOptions, 40), HelpWidth is max(MHW, LW - HelpIndent), ( atom(Help) -> line_breaks(Help, HelpWidth, HelpIndent, BrokenHelp) ; assertion(is_list_of_atoms(Help)) -> indent_lines(Help, HelpIndent, BrokenHelp) ), format(atom(Line), '~w~t~*+~w~t~*+~w~t~*+~w~n', [LFlags, LFlagsCW, SFlags, SFlagsCW, MetaTypeDef, MTDCW, BrokenHelp]). line_breaks(TextLine, LineLength, Indent, TextLines) :- atomic_list_concat(Words, ' ', TextLine), group_length(LineLength, Words, Groups0), maplist(atomic_list_concat_(' '), Groups0, Groups), indent_lines(Groups, Indent, TextLines). indent_lines(Lines, Indent, TextLines) :- format(atom(Separator), '~n~*|', [Indent]), atomic_list_concat(Lines, Separator, TextLines). atomic_list_concat_(Separator, List, Atom) :- atomic_list_concat(List, Separator, Atom). %group_length(10, % [here, are, some, words, you, see], % [[here are], [some words], [you see]]) %each group >= 10F group_length(LineLength, Words, Groups) :- group_length_(Words, LineLength, LineLength, [], [], Groups). group_length_([], _, _, ThisLine, GroupsAcc, Groups) :- maplist(reverse, [ThisLine|GroupsAcc], GroupsAcc1), reverse(GroupsAcc1, Groups). group_length_([Word|Words], LineLength, Remains, ThisLine, Groups, GroupsAcc) :- atom_length(Word, K), ( (Remains >= K; ThisLine = []) %Word fits on ThisLine, or too long too fit -> Remains1 is Remains - K - 1, %even on a new line group_length_(Words, LineLength, Remains1, [Word|ThisLine], Groups, GroupsAcc) %Word doesn't fit on ThisLine (non-empty) ; group_length_([Word|Words], LineLength, LineLength, [], [ThisLine|Groups], GroupsAcc) ). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OPTSSPEC DEFAULTS add_default_defaults(OptsSpec0, OptsSpec, Options) :- option(suppress_empty_meta(SEM), Options, true), maplist(default_defaults(SEM), OptsSpec0, OptsSpec). default_defaults(SuppressEmptyMeta, OptSpec0, OptSpec) :- ( SuppressEmptyMeta -> Meta = '' ; memberchk(type(Type), OptSpec0) -> meta_placeholder(Type, Meta) ; Meta = 'T' ), Defaults = [ help('') , type(term) , shortflags([]) , longflags([]) , default('_') , meta(Meta) ], merge_options(OptSpec0, Defaults, OptSpec). %merge_options(+New, +Old, -Merged) meta_placeholder(boolean, 'B'). meta_placeholder(atom, 'A'). meta_placeholder(float, 'F'). meta_placeholder(integer, 'I'). meta_placeholder(term, 'T'). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OPTSSPEC VALIDATION %this is a bit paranoid, but OTOH efficiency is no issue check_opts_spec(OptsSpec0, Options, OptsSpec) :- validate_opts_spec(OptsSpec0, Options), add_default_defaults(OptsSpec0, OptsSpec, Options), validate_opts_spec(OptsSpec, Options). validate_opts_spec(OptsSpec, ParseOptions) :- \+ invalidate_opts_spec(OptsSpec, ParseOptions). invalidate_opts_spec(OptsSpec, _ParseOptions) :- %invalid if not ground -- must go first for \+ to be sound ( \+ ground(OptsSpec) -> throw(error(instantiation_error, context(validate_opts_spec/1, 'option spec must be ground'))) %invalid if conflicting flags ; ( member(O1, OptsSpec), flags(O1, Flags1), member(F, Flags1), member(O2, OptsSpec), flags(O2, Flags2), member(F, Flags2), O1 \= O2) -> throw(error(domain_error(unique_atom, F), context(validate_opts_spec/1, 'ambiguous flag'))) %invalid if unknown opt spec ; ( member(OptSpec, OptsSpec), member(Spec, OptSpec), functor(Spec, F, _), \+ member(F, [opt, shortflags, longflags, type, help, default, meta]) ) -> throw(error(domain_error(opt_spec, F), context(validate_opts_spec/1, 'unknown opt spec'))) %invalid if mandatory option spec opt(ID) is not unique in the entire Spec ; ( member(O1, OptsSpec), member(opt(Name), O1), member(O2, OptsSpec), member(opt(Name), O2), O1 \= O2) -> throw(error(domain_error(unique_atom, Name), context(validate_opts_spec/1, 'ambiguous id'))) ). invalidate_opts_spec(OptsSpec, _ParseOptions) :- member(OptSpec, OptsSpec), \+ member(opt(_Name), OptSpec), %invalid if mandatory option spec opt(ID) is absent throw(error(domain_error(unique_atom, OptSpec), context(validate_opts_spec/1, 'opt(id) missing'))). invalidate_opts_spec(OptsSpec, ParseOptions) :- member(OptSpec, OptsSpec), %if we got here, OptSpec has a single unique Name member(opt(Name), OptSpec), option(allow_empty_flag_spec(AllowEmpty), ParseOptions, true), %invalid if allow_empty_flag_spec(false) and no flag is given ( (\+ AllowEmpty, \+ flags(OptSpec, [_|_])) -> format(atom(Msg), 'no flag specified for option ''~w''', [Name]), throw(error(domain_error(unique_atom, _), context(validate_opts_spec/1, Msg))) %invalid if any short flag is not actually single-letter ; ( memberchk(shortflags(Flags), OptSpec), member(F, Flags), atom_length(F, L), L > 1) -> format(atom(Msg), 'option ''~w'': flag too long to be short', [Name]), throw(error(domain_error(short_flag, F), context(validate_opts_spec/1, Msg))) %invalid if any option spec is given more than once ; duplicate_optspec(OptSpec, [type,opt,default,help,shortflags,longflags,meta]) -> format(atom(Msg), 'duplicate spec in option ''~w''', [Name]), throw(error(domain_error(unique_functor, _), context(validate_opts_spec/1, Msg))) %invalid if unknown type ; ( memberchk(type(Type), OptSpec), Type \== term, \+ clause(error:has_type(Type,_), _) ) -> format(atom(Msg), 'unknown type ''~w'' in option ''~w''', [Type, Name]), throw(error(type_error(flag_value, Type), context(validate_opts_spec/1, Msg))) %invalid if type does not match default %note1: reverse logic: we are trying to _in_validate OptSpec %note2: 'term' approves of any syntactically valid prolog term, since %if syntactically invalid, OptsSpec wouldn't have parsed %note3: the special placeholder '_' creates a new variable, so no typecheck ; (memberchk(type(Type), OptSpec), Type \= term, memberchk(default(Default), OptSpec), Default \= '_' -> \+ must_be(Type, Default)) %invalidation failed, i.e., optspec is OK ; fail ). duplicate_optspec(_, []) :- !, fail. duplicate_optspec(OptSpec, [Func|Funcs]) :- functor(F, Func, 1), findall(F, member(F, OptSpec), Xs), (Xs = [_,_|_] -> true ; duplicate_optspec(OptSpec, Funcs) ). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PARSE OPTIONS % NOTE: % -sbar could be interpreted in two ways: as short for -s bar, and % as short ('clustered') for -s -b -a -r. Here, the former interpretation % is chosen. % Cf http://perldoc.perl.org/Getopt/Long.html (no clustering by default) parse_options(OptsSpec, Args0, Options, PosArgs) :- append(Args0, [""], Args1), parse_args_(Args1, OptsSpec, Args2), partition_args_(Args2, Options, PosArgs). %{{{ PARSE ARGS %if arg is boolean flag given as --no-my-arg, expand to my-arg, false, re-call parse_args_([Arg,Arg2|Args], OptsSpec, [opt(KID, false)|Result]) :- flag_name_long_neg(Dashed, NonDashed, Arg, []), flag_id_type(OptsSpec, NonDashed, KID, boolean), !, parse_args_([Dashed, "false", Arg2|Args], OptsSpec, Result). %if arg is ordinary boolean flag, fill in implicit true if arg absent; re-call parse_args_([Arg,Arg2|Args], OptsSpec, Result) :- flag_name(K, Arg, []), flag_id_type(OptsSpec, K, _KID, boolean), \+ member(Arg2, ["true", "false"]), !, parse_args_([Arg, "true", Arg2 | Args], OptsSpec, Result). % separate short or long flag run together with its value and parse parse_args_([Arg|Args], OptsSpec, [opt(KID, Val)|Result]) :- flag_name_value(Arg1, Arg2, Arg, []), \+ short_flag_w_equals(Arg1, Arg2), flag_name(K, Arg1, []), !, parse_option(OptsSpec, K, Arg2, opt(KID, Val)), parse_args_(Args, OptsSpec, Result). %from here, unparsed args have form % PosArg1,Flag1,Val1,PosArg2,PosArg3,Flag2,Val2, PosArg4... %i.e., positional args may go anywhere except between FlagN and ValueN %(of course, good programming style says they should go last, but it is poor %programming style to assume that) parse_args_([Arg1,Arg2|Args], OptsSpec, [opt(KID, Val)|Result]) :- flag_name(K, Arg1, []), !, parse_option(OptsSpec, K, Arg2, opt(KID, Val)), parse_args_(Args, OptsSpec, Result). parse_args_([Arg1,Arg2|Args], OptsSpec, [pos(At)|Result]) :- \+ flag_name(_, Arg1, []), !, atom_codes(At, Arg1), parse_args_([Arg2|Args], OptsSpec, Result). parse_args_([""], _, []) :- !. %placeholder, but useful for error messages parse_args_([], _, []) :- !. short_flag_w_equals([0'-,_C], [0'=|_]) :- throw(error(syntax_error('disallowed: <shortflag>=<value>'),_)). flag_id_type(OptsSpec, FlagCodes, ID, Type) :- atom_codes(Flag, FlagCodes), member(OptSpec, OptsSpec), flags(OptSpec, Flags), member(Flag, Flags), member(type(Type), OptSpec), member(opt(ID), OptSpec). %{{{ FLAG DCG %DCG non-terminals: % flag_name(NonDashed) %c, flag-name, x % flag_name_short(Dashed, NonDashed) %c, x % flag_name_long(Dashed, NonDashed) %flag-name % flag_name_long_neg(Dashed, NonDashed) %no-flag-name % flag_value(Val) %non-empty string % flag_value0(Val) %any string, also empty % flag_name_value(Dashed, Val) %pair of flag_name, flag_value flag_name(NonDashed) --> flag_name_long(_, NonDashed). flag_name(NonDashed) --> flag_name_short(_, NonDashed). flag_name(NonDashed) --> flag_name_long_neg(_, NonDashed). flag_name_long_neg([0'-,0'-|Cs], Cs) --> "--no-", name_long(Cs). flag_name_long([0'-,0'-|Cs], Cs) --> "--", name_long(Cs). flag_name_short([0'-|C], C) --> "-", name_1st(C). flag_value([C|Cs]) --> [C], flag_value0(Cs). flag_value0([]) --> []. flag_value0([C|Cs]) --> [C], flag_value0(Cs). flag_name_value(Dashed, Val) --> flag_name_long(Dashed, _), "=", flag_value0(Val). flag_name_value(Dashed, Val) --> flag_name_short(Dashed, _), flag_value(Val). name_long([C|Cs]) --> name_1st([C]), name_rest(Cs). name_1st([C]) --> [C], {name_1st(C)}. name_rest([]) --> []. name_rest([C|Cs]) --> [C], {name_char(C)}, name_rest(Cs). name_1st(C) :- char_type(C, alpha). name_char(C) :- char_type(C, alpha). name_char( 0'_ ). name_char( 0'- ). %}}} %{{{ PARSE OPTION parse_option(OptsSpec, Arg1, Arg2, opt(KID, Val)) :- ( flag_id_type(OptsSpec, Arg1, KID, Type) -> parse_val(Arg1, Type, Arg2, Val) ; format(atom(Msg), '~s', [Arg1]), opt_help(OptsSpec, Help), %unknown flag: dump usage on stderr nl(user_error), write(user_error, Help), throw(error(domain_error(flag_value, Msg),context(_, 'unknown flag'))) ). parse_val(Opt, Type, Cs, Val) :- catch( parse_loc(Type, Cs, Val), E, ( format('~nERROR: flag ''~s'': expected atom parsable as ~w, found ''~s'' ~n', [Opt, Type, Cs]), throw(E)) ). %parse_loc(+Type, +ListOfCodes, -Result). parse_loc(Type, _LOC, _) :- var(Type), !, throw(error(instantiation_error, _)). parse_loc(_Type, LOC, _) :- var(LOC), !, throw(error(instantiation_error, _)). parse_loc(boolean, Cs, true) :- atom_codes(true, Cs), !. parse_loc(boolean, Cs, false) :- atom_codes(false, Cs), !. parse_loc(atom, Cs, Result) :- atom_codes(Result, Cs), !. parse_loc(integer, Cs, Result) :- number_codes(Result, Cs), integer(Result), !. parse_loc(float, Cs, Result) :- number_codes(Result, Cs), float(Result), !. parse_loc(term, Cs, Result) :- atom_codes(A, Cs), term_to_atom(Result, A), !. parse_loc(Type, Cs, Result) :- parse_type(Type, Cs, Result), !. parse_loc(Type, _Cs, _) :- %could not parse Cs as Type throw(error(type_error(flag_value, Type), _)), !. %}}} %}}} %% parse_type(+Type, +Codes:list(code), -Result) is semidet. % % Hook to parse option text Codes to an object of type Type. partition_args_([], [], []). partition_args_([opt(K,V)|Rest], [opt(K,V)|RestOpts], RestPos) :- !, partition_args_(Rest, RestOpts, RestPos). partition_args_([pos(Arg)|Rest], RestOpts, [Arg|RestPos]) :- !, partition_args_(Rest, RestOpts, RestPos). %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ADD DEFAULTS add_default_opts([], Opts, Opts). add_default_opts([OptSpec|OptsSpec], OptsIn, Result) :- memberchk(opt(OptName), OptSpec), ( memberchk(opt(OptName, _Val), OptsIn) -> Result = OptsOut %value given on cl, ignore default ; %value not given on cl: memberchk(default('_'), OptSpec) % no default in OptsSpec (or 'VAR'): -> Result = [opt(OptName, _) | OptsOut] % create uninstantiated variable ; memberchk(default(Def), OptSpec), % default given in OptsSpec % memberchk(type(Type), OptSpec), % already typechecked % assertion(must_be(Type, Def)), Result = [opt(OptName, Def) | OptsOut] ), add_default_opts(OptsSpec, OptsIn, OptsOut). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% REMOVE DUPLICATES remove_duplicates(_, [], []) :- !. remove_duplicates(keeplast, [opt(OptName, Val) | Opts], Result) :- !, ( memberchk(opt(OptName, _), Opts) -> Result = RestOpts ; Result = [opt(OptName, Val) | RestOpts] ), remove_duplicates(keeplast, Opts, RestOpts). remove_duplicates(keepfirst, OptsIn, OptsOut) :- !, reverse(OptsIn, OptsInRev), remove_duplicates(keeplast, OptsInRev, OptsOutRev), reverse(OptsOutRev, OptsOut). remove_duplicates(keepall, OptsIn, OptsIn) :- !. remove_duplicates(K, [_|_], _) :- !, throw(error(domain_error(keep_flag, K), _)). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% REFUNCTOR refunctor_opts(Fnct, OptsIn, OptsOut) :- maplist(refunctor_opt(Fnct), OptsIn, OptsOut). refunctor_opt('OPTION', opt(OptName, OptVal), Result) :- !, Result =.. [OptName, OptVal]. refunctor_opt(F, opt(OptName, OptVal), Result) :- Result =.. [F, OptName, OptVal]. %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ACCESSORS flags(OptSpec, Flags) :- memberchk(shortflags(Flags), OptSpec). flags(OptSpec, Flags) :- memberchk(longflags(Flags), OptSpec). %}}} %{{{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UTILS is_list_of_atoms([]). is_list_of_atoms([X|Xs]) :- atom(X), is_list_of_atoms(Xs). %}}}
TeamSPoon/logicmoo_workspace
docker/rootfs/usr/local/lib/swipl/library/optparse.pl
Perl
mit
38,274
package Package::DeprecationManager; BEGIN { $Package::DeprecationManager::VERSION = '0.11'; } use strict; use warnings; use Carp qw( croak ); use List::MoreUtils qw( any ); use Params::Util qw( _HASH0 ); use Sub::Install; sub import { shift; my %args = @_; croak 'You must provide a hash reference -deprecations parameter when importing Package::DeprecationManager' unless $args{-deprecations} && _HASH0( $args{-deprecations} ); my %registry; my $import = _build_import( \%registry ); my $warn = _build_warn( \%registry, $args{-deprecations}, $args{-ignore} ); my $caller = caller(); Sub::Install::install_sub( { code => $import, into => $caller, as => 'import', } ); Sub::Install::install_sub( { code => $warn, into => $caller, as => 'deprecated', } ); return; } sub _build_import { my $registry = shift; return sub { my $class = shift; my %args = @_; $args{-api_version} ||= delete $args{-compatible}; $registry->{ caller() } = $args{-api_version} if $args{-api_version}; return; }; } sub _build_warn { my $registry = shift; my $deprecated_at = shift; my $ignore = shift; my %ignore = map { $_ => 1 } grep { !ref } @{ $ignore || [] }; my @ignore_res = grep {ref} @{ $ignore || [] }; my %warned; return sub { my %args = @_ < 2 ? ( message => shift ) : @_; my ( $package, undef, undef, $sub ) = caller(1); my $skipped = 1; if ( @ignore_res || keys %ignore ) { while ( defined $package && ( $ignore{$package} || any { $package =~ $_ } @ignore_res ) ) { $package = caller( $skipped++ ); } } $package = 'unknown package' unless defined $package; unless ( defined $args{feature} ) { $args{feature} = $sub; } my $compat_version = $registry->{$package}; my $deprecated_at = $deprecated_at->{ $args{feature} }; return if defined $compat_version && defined $deprecated_at && $compat_version lt $deprecated_at; my $msg; if ( defined $args{message} ) { $msg = $args{message}; } else { $msg = "$args{feature} has been deprecated"; $msg .= " since version $deprecated_at" if defined $deprecated_at; } return if $warned{$package}{ $args{feature} }{$msg}; $warned{$package}{ $args{feature} }{$msg} = 1; # We skip at least two levels. One for this anon sub, and one for the # sub calling it. local $Carp::CarpLevel = $Carp::CarpLevel + $skipped; Carp::cluck($msg); }; } 1; # ABSTRACT: Manage deprecation warnings for your distribution =pod =head1 NAME Package::DeprecationManager - Manage deprecation warnings for your distribution =head1 VERSION version 0.11 =head1 SYNOPSIS package My::Class; use Package::DeprecationManager -deprecations => { 'My::Class::foo' => '0.02', 'My::Class::bar' => '0.05', 'feature-X' => '0.07', }; sub foo { deprecated( 'Do not call foo!' ); ... } sub bar { deprecated(); ... } sub baz { my %args = @_; if ( $args{foo} ) { deprecated( message => ..., feature => 'feature-X', ); } } package Other::Class; use My::Class -api_version => '0.04'; My::Class->new()->foo(); # warns My::Class->new()->bar(); # does not warn My::Class->new()->far(); # does not warn again =head1 DESCRIPTION This module allows you to manage a set of deprecations for one or more modules. When you import C<Package::DeprecationManager>, you must provide a set of C<-deprecations> as a hash ref. The keys are "feature" names, and the values are the version when that feature was deprecated. In many cases, you can simply use the fully qualified name of a subroutine or method as the feature name. This works for cases where the whole subroutine is deprecated. However, the feature names can be any string. This is useful if you don't want to deprecate an entire subroutine, just a certain usage. You can also provide an optional array reference in the C<-ignore> parameter. The values to be ignored can be package names or regular expressions (made with C<qr//>). Use this to ignore packages in your distribution that can appear on the call stack when a deprecated feature is used. As part of the import process, C<Package::DeprecationManager> will export two subroutines into its caller. It provides an C<import()> sub for the caller and a C<deprecated()> sub. The C<import()> sub allows callers of I<your> class to specify an C<-api_version> parameter. If this is supplied, then deprecation warnings are only issued for deprecations for api versions earlier than the one specified. You must call the C<deprecated()> sub in each deprecated subroutine. When called, it will issue a warning using C<Carp::cluck()>. The C<deprecated()> sub can be called in several ways. If you do not pass any arguments, it will generate an appropriate warning message. If you pass a single argument, this is used as the warning message. Finally, you can call it with named arguments. Currently, the only allowed names are C<message> and C<feature>. The C<feature> argument should correspond to the feature name passed in the C<-deprecations> hash. If you don't explicitly specify a feature, the C<deprecated()> sub uses C<caller()> to identify its caller, using its fully qualified subroutine name. A given deprecation warning is only issued once for a given package. This module tracks this based on both the feature name I<and> the error message itself. This means that if you provide severaldifferent error messages for the same feature, all of those errors will appear. =head1 BUGS Please report any bugs or feature requests to C<bug-package-deprecationmanager@rt.cpan.org>, or through the web interface at L<http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 DONATIONS If you'd like to thank me for the work I've done on this module, please consider making a "donation" to me via PayPal. I spend a lot of free time creating free software, and would appreciate any support you'd care to offer. Please note that B<I am not suggesting that you must do this> in order for me to continue working on this particular software. I will continue to do so, inasmuch as I have in the past, for as long as it interests me. Similarly, a donation made in this way will probably not make me work on this software much more, unless I get so many donations that I can consider working on free software full time, which seems unlikely at best. To donate, log into PayPal and send money to autarch@urth.org or use the button on this page: L<http://www.urth.org/~autarch/fs-donation.html> =head1 CREDITS The idea for this functionality and some of its implementation was originally created as L<Class::MOP::Deprecated> by Goro Fuji. =head1 AUTHOR Dave Rolsky <autarch@urth.org> =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2011 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) =cut __END__
amidoimidazol/bio_info
Beginning Perl for Bioinformatics/lib/Package/DeprecationManager.pm
Perl
mit
7,559
package Geography::Countries; # # $Id: Countries.pm,v 1.4 2003/01/26 18:19:07 abigail Exp $ # # $Log: Countries.pm,v $ # Revision 1.4 2003/01/26 18:19:07 abigail # Changed license, email address. Added installation section. # # Revision 1.3 2003/01/26 18:12:10 abigail # Removed INIT{} from initializing code, as the INIT{} isn't run # when doing 'require'. # # Revision 1.2 2000/09/05 18:22:01 abigail # Changed typo in "Federal Republic of Germany" (Dan Allen) # Changed layout of test.pl # # Revision 1.1 1999/09/15 07:27:22 abigail # Initial revision # # use strict; use Exporter; use vars qw /@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION/; @ISA = qw /Exporter/; @EXPORT = qw /country/; @EXPORT_OK = qw /code2 code3 numcode countries CNT_I_CODE2 CNT_I_CODE3 CNT_I_NUMCODE CNT_I_COUNTRY CNT_I_FLAG CNT_F_REGULAR CNT_F_OLD CNT_F_REGION CNT_F_ANY/; %EXPORT_TAGS = (LISTS => [qw /code2 code3 numcode countries/], INDICES => [qw /CNT_I_CODE2 CNT_I_CODE3 CNT_I_NUMCODE CNT_I_COUNTRY CNT_I_FLAG/], FLAGS => [qw /CNT_F_REGULAR CNT_F_OLD CNT_F_REGION CNT_F_ANY/],); ($VERSION) = '$Revision: 1.4 $' =~ /([\d.]+)/; use constant CNT_I_CODE2 => 0; use constant CNT_I_CODE3 => 1; use constant CNT_I_NUMCODE => 2; use constant CNT_I_COUNTRY => 3; use constant CNT_I_FLAG => 4; use constant CNT_F_REGULAR => 0x01; use constant CNT_F_OLD => 0x02; use constant CNT_F_REGION => 0x04; use constant CNT_F_ANY => CNT_F_REGULAR | CNT_F_OLD | CNT_F_REGION; my (%info, @code2, @code3, @numcode, @countries); sub norm ($) { my $query = shift; die "Illegal argument to norm\n" unless defined $query; return sprintf "%03d" => $query unless $query =~ /\D/; $query = lc $query; $query =~ s/\s+//g; $query; } my $flag; my %flags = ( Regular => CNT_F_REGULAR, Old => CNT_F_OLD, Region => CNT_F_REGION, ); while (<DATA>) { chomp; last if $_ eq '__END__'; s/#.*//; next unless /\S/; if (/^%%\s*(\S.*\S)\s*%%$/) { $flag = $flags {$1} or die "Found illegal flag ``$1'' while parsing __DATA__\n"; next; } my $code2 = substr $_, 0, 2; $code2 = undef if $code2 =~ /\s/; my $code3 = substr $_, 3, 3; $code3 = undef if $code3 =~ /\s/; my $numcode = substr $_, 7, 3; $numcode = undef if $numcode =~ /\s/; my $country = substr $_, 11; push @code2 => $code2 if defined $code2; push @code3 => $code3 if defined $code3; push @numcode => $numcode if defined $numcode; push @countries => $country; my $info = [$code2, $code3, $numcode, $country, $flag]; $info {norm $code2} = $info if defined $code2 ; $info {norm $code3} = $info if defined $code3 ; $info {$numcode} = $info if defined $numcode; $info {norm $country} = $info; } @code2 = sort @code2; @code3 = sort @code3; @numcode = sort @numcode; @countries = sort @countries; sub code2 {@code2} sub code3 {@code3} sub numcode {@numcode} sub countries {@countries} sub country ($;$) { my $sub = (caller (0)) [3]; die "No arguments for $sub.\n" unless @_; die "Too many arguments for $sub.\n" unless @_ <= 2; my ($query, $flags) = @_; die "Undefined argument for $sub.\n" unless defined $query; $flags ||= CNT_F_REGULAR; die "Illegal second argument to $sub.\n" if $flags =~ /\D/; my $info = $info {norm $query} or return; return unless $info -> [CNT_I_FLAG] & $flags; wantarray ? @$info : $info -> [CNT_I_COUNTRY]; } <<'=cut' =pod =head1 NAME Geography::Countries -- 2-letter, 3-letter, and numerical codes for countries. =head1 SYNOPSIS use Geography::Countries; $country = country 'DE'; # 'Germany' @list = country 666; # ('PM', 'SPM', 666, # 'Saint Pierre and Miquelon', 1) =head1 DESCRIPTION This module maps country names, and their 2-letter, 3-letter and numerical codes, as defined by the ISO-3166 maintenance agency [1], and defined by the UNSD. =head2 The C<country> subroutine. This subroutine is exported by default. It takes a 2-letter, 3-letter or numerical code, or a country name as argument. In scalar context, it will return the country name, in list context, it will return a list consisting of the 2-letter code, the 3-letter code, the numerical code, the country name, and a flag, which is explained below. Note that not all countries have all 3 codes; if a code is unknown, the undefined value is returned. There are 3 categories of countries. The largest category are the current countries. Then there is a small set of countries that no longer exist. The final set consists of areas consisting of multiple countries, like I<Africa>. No 2-letter or 3-letter codes are available for the second two sets. (ISO 3166-3 [3] defines 4 letter codes for the set of countries that no longer exist, but the author of this module was unable to get her hands on that standard.) By default, C<country> only returns countries from the first set, but this can be changed by giving C<country> an optional second argument. The module optionally exports the constants C<CNT_F_REGULAR>, C<CNT_F_OLD>, C<CNT_F_REGION> and C<CNT_F_ANY>. These constants can also be important all at once by using the tag C<:FLAGS>. C<CNT_F_ANY> is just the binary or of the three other flags. The second argument of C<country> should be the binary or of a subset of the flags C<CNT_F_REGULAR>, C<CNT_F_OLD>, and C<CNT_F_REGION> - if no, or a false, second argument is given, C<CNT_F_REGULAR> is assumed. If C<CNT_F_REGULAR> is set, regular (current) countries will be returned; if C<CNT_F_OLD> is set, old, no longer existing, countries will be returned, while C<CNT_F_REGION> is used in case a region (not necessarely) a country might be returned. If C<country> is used in list context, the fifth returned element is one of C<CNT_F_REGULAR>, C<CNT_F_OLD> and C<CNT_F_REGION>, indicating whether the result is a regular country, an old country, or a region. In list context, C<country> returns a 5 element list. To avoid having to remember which element is in which index, the constants C<CNT_I_CODE2>, C<CNT_I_CODE3>, C<CNT_I_NUMCODE>, C<CNT_I_COUNTRY> and C<CNT_I_FLAG> can be imported. Those constants contain the indices of the 2-letter code, the 3-letter code, the numerical code, the country, and the flag explained above, respectively. All index constants can be imported by using the C<:INDICES> tag. =head2 The C<code2>, C<code3>, C<numcode> and C<countries> routines. All known 2-letter codes, 3-letter codes, numerical codes and country names can be returned by the routines C<code2>, C<code3>, C<numcode> and C<countries>. None of these methods is exported by default; all need to be imported if one wants to use them. The tag C<:LISTS> imports them all. In scalar context, the number of known codes or countries is returned. =head1 REFERENCES The 2-letter codes come from the ISO 3166-1:1997 standard [2]. ISO 3166 bases its list of country names on the list of names published by the United Nations. This list is published by the Statistical Division of the United Nations [4]. The UNSD uses 3-letter codes, and numerical codes [5]. The information about old countries [6] and regions [7] also comes from the United Nations. In a few cases, there was a conflict between the way how the United Nations spelled a name, and how ISO 3166 spells it. In most cases, is was word order (for instance whether I<The republic of> should preceed the name, or come after the name. A few cases had minor spelling variations. In all such cases, the method in which the UN spelled the name was choosen; ISO 3166 claims to take the names from the UN, so we consider the UN authoritative. =over 4 =item [1] ISO Maintenance Agency (ISO 3166/MA) I<http://www.din.de/gremien/nas/nabd/iso3166ma/index.html>. =item [2] I<Country codes>, I<http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1.html>, 7 September 1999. =item [3] ISO 3166-3, I<Code for formerly used country names>. I<http://www.din.de/gremien/nas/nabd/iso3166ma/info_pt3.html>. =item [4] United Nations, Statistics Division. I<http://www.un.org/Depts/unsd/statdiv.htm>. =item [5] I<Country or area codes in alphabetical order>. I<http://www.un.org/Depts/unsd/methods/m49alpha.htm>, 26 August 1999. =item [6] I<Codes added or changed>. I<http://www.un.org/Depts/unsd/methods/m49chang.htm>, 26 August 1999. =item [7] I<Geographical regions>. I<http://www.un.org/Depts/unsd/methods/m49regin.htm>, 26 August 1999. =back =head1 BUGS Looking up information using country names is far from perfect. Except for case and the amount of white space, the exact name as it appears on the list has to be given. I<USA> will not return anything, but I<United States> will. =head1 HISTORY $Log: Countries.pm,v $ Revision 1.4 2003/01/26 18:19:07 abigail Changed license, email address. Added installation section. Revision 1.3 2003/01/26 18:12:10 abigail Removed INIT{} from initializing code, as the INIT{} isn't run when doing 'require'. Revision 1.2 2000/09/05 18:22:01 abigail Changed typo in "Federal Republic of Germany" (Dan Allen) Changed layout of test.pl Revision 1.1 1999/09/15 07:27:22 abigail Initial revision =head1 AUTHOR This package was written by Abigail, I<geometry-countries@abigail.nl> =head1 COPYRIGHT AND LICENSE This package is copyright 1999-2003 by Abigail. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =head1 INSTALLATION To install this module type the following: perl Makefile.PL make make test make install =cut __DATA__ %% Regular %% AF AFG 004 Afghanistan AL ALB 008 Albania DZ DZA 012 Algeria AS ASM 016 American Samoa AD AND 020 Andorra AO AGO 024 Angola AI AIA 660 Anguilla AQ Antarctica AG ATG 028 Antigua and Barbuda 896 Areas not elsewhere specified 898 Areas not specified AR ARG 032 Argentina AM ARM 051 Armenia AW ABW 533 Aruba AU AUS 036 Australia AT AUT 040 Austria AZ AZE 031 Azerbaijan BS BHS 044 Bahamas BH BHR 048 Bahrain BD BGD 050 Bangladesh BB BRB 052 Barbados BY BLR 112 Belarus BE BEL 056 Belgium BZ BLZ 084 Belize BJ BEN 204 Benin BM BMU 060 Bermuda BT BTN 064 Bhutan BO BOL 068 Bolivia BA BIH 070 Bosnia and Herzegovina BW BWA 072 Botswana BV Bouvet Island BR BRA 076 Brazil IO British Indian Ocean Territory VG VGB 092 British Virgin Islands BN BRN 096 Brunei Darussalam BG BGR 100 Bulgaria BF BFA 854 Burkina Faso BI BDI 108 Burundi KH KHM 116 Cambodia CM CMR 120 Cameroon CA CAN 124 Canada CV CPV 132 Cape Verde KY CYM 136 Cayman Islands CF CAF 140 Central African Republic TD TCD 148 Chad 830 Channel Islands CL CHL 152 Chile CN CHN 156 China CX Christmas Island CC Cocos (keeling) Islands CO COL 170 Colombia KM COM 174 Comoros CG COG 178 Congo CK COK 184 Cook Islands CR CRI 188 Costa Rica CI CIV 384 Côte d'Ivoire HR HRV 191 Croatia CU CUB 192 Cuba CY CYP 196 Cyprus CZ CZE 203 Czech Republic KP PRK 408 Democratic People's Republic of Korea CD COD 180 Democratic Republic of the Congo DK DNK 208 Denmark DJ DJI 262 Djibouti DM DMA 212 Dominica DO DOM 214 Dominican Republic TP TMP 626 East Timor EC ECU 218 Ecuador EG EGY 818 Egypt SV SLV 222 El Salvador GQ GNQ 226 Equatorial Guinea ER ERI 232 Eritrea EE EST 233 Estonia ET ETH 231 Ethiopia FO FRO 234 Faeroe Islands FK FLK 238 Falkland Islands (Malvinas) FM FSM 583 Micronesia, Federated States of FJ FJI 242 Fiji FI FIN 246 Finland MK MKD 807 The former Yugoslav Republic of Macedonia FR FRA 250 France GF GUF 254 French Guiana PF PYF 258 French Polynesia TF French Southern Territories GA GAB 266 Gabon GM GMB 270 Gambia GE GEO 268 Georgia DE DEU 276 Germany GH GHA 288 Ghana GI GIB 292 Gibraltar GR GRC 300 Greece GL GRL 304 Greenland GD GRD 308 Grenada GP GLP 312 Guadeloupe GU GUM 316 Guam GT GTM 320 Guatemala GN GIN 324 Guinea GW GNB 624 Guinea-Bissau GY GUY 328 Guyana HT HTI 332 Haiti HM Heard Island And Mcdonald Islands VA VAT 336 Holy See HN HND 340 Honduras HK HKG 344 Hong Kong Special Administrative Region of China HU HUN 348 Hungary IS ISL 352 Iceland IN IND 356 India ID IDN 360 Indonesia IR IRN 364 Iran (Islamic Republic of) IQ IRQ 368 Iraq IE IRL 372 Ireland IMY 833 Isle of Man IL ISR 376 Israel IT ITA 380 Italy JM JAM 388 Jamaica JP JPN 392 Japan JO JOR 400 Jordan KZ KAZ 398 Kazakhstan KE KEN 404 Kenya KI KIR 296 Kiribati KW KWT 414 Kuwait KG KGZ 417 Kyrgyzstan LA LAO 418 Lao People's Democratic Republic LV LVA 428 Latvia LB LBN 422 Lebanon LS LSO 426 Lesotho LR LBR 430 Liberia LY LBY 434 Libyan Arab Jamahiriya LI LIE 438 Liechtenstein LT LTU 440 Lithuania LU LUX 442 Luxembourg MO MAC 446 Macau MG MDG 450 Madagascar MW MWI 454 Malawi MY MYS 458 Malaysia MV MDV 462 Maldives ML MLI 466 Mali MT MLT 470 Malta MH MHL 584 Marshall Islands MQ MTQ 474 Martinique MR MRT 478 Mauritania MU MUS 480 Mauritius YT Mayotte MX MEX 484 Mexico MC MCO 492 Monaco MN MNG 496 Mongolia MS MSR 500 Montserrat MA MAR 504 Morocco MZ MOZ 508 Mozambique MM MMR 104 Myanmar NA NAM 516 Namibia NR NRU 520 Nauru NP NPL 524 Nepal NL NLD 528 Netherlands AN ANT 530 Netherlands Antilles NC NCL 540 New Caledonia NZ NZL 554 New Zealand NI NIC 558 Nicaragua NE NER 562 Niger NG NGA 566 Nigeria NU NIU 570 Niue NF NFK 574 Norfolk Island MP MNP 580 Northern Mariana Islands NO NOR 578 Norway PSE 275 Occupied Palestinian Territory OM OMN 512 Oman PK PAK 586 Pakistan PW PLW 585 Palau PA PAN 591 Panama PG PNG 598 Papua New Guinea PY PRY 600 Paraguay PE PER 604 Peru PH PHL 608 Philippines PN PCN 612 Pitcairn PL POL 616 Poland PT PRT 620 Portugal PR PRI 630 Puerto Rico QA QAT 634 Qatar KR KOR 410 Republic of Korea MD MDA 498 Republic of Moldova RO ROM 642 Romania RE REU 638 Réunion RU RUS 643 Russian Federation RW RWA 646 Rwanda SH SHN 654 Saint Helena KN KNA 659 Saint Kitts and Nevis LC LCA 662 Saint Lucia PM SPM 666 Saint Pierre and Miquelon VC VCT 670 Saint Vincent and the Grenadines WS WSM 882 Samoa SM SMR 674 San Marino ST STP 678 Sao Tome and Principe SA SAU 682 Saudi Arabia SN SEN 686 Senegal SC SYC 690 Seychelles SL SLE 694 Sierra Leone SG SGP 702 Singapore SK SVK 703 Slovakia SI SVN 705 Slovenia SB SLB 090 Solomon Islands SO SOM 706 Somalia ZA ZAF 710 South Africa GS South Georgia And The South Sandwich Islands ES ESP 724 Spain LK LKA 144 Sri Lanka SD SDN 736 Sudan SR SUR 740 Suriname SJ SJM 744 Svalbard and Jan Mayen Islands SZ SWZ 748 Swaziland SE SWE 752 Sweden CH CHE 756 Switzerland SY SYR 760 Syrian Arab Republic TW TWN 158 Taiwan Province of China TJ TJK 762 Tajikistan TH THA 764 Thailand TG TGO 768 Togo TK TKL 772 Tokelau TO TON 776 Tonga TT TTO 780 Trinidad and Tobago TN TUN 788 Tunisia TR TUR 792 Turkey TM TKM 795 Turkmenistan TC TCA 796 Turks and Caicos Islands TV TUV 798 Tuvalu UG UGA 800 Uganda UA UKR 804 Ukraine AE ARE 784 United Arab Emirates GB GBR 826 United Kingdom TZ TZA 834 United Republic of Tanzania US USA 840 United States UM United States Minor Outlying Islands VI VIR 850 United States Virgin Islands UY URY 858 Uruguay UZ UZB 860 Uzbekistan VU VUT 548 Vanuatu VE VEN 862 Venezuela VN VNM 704 Viet Nam WF WLF 876 Wallis and Futuna Islands EH ESH 732 Western Sahara YE YEM 887 Yemen YU YUG 891 Yugoslavia ZM ZMB 894 Zambia ZW ZWE 716 Zimbabwe %% Old %% 810 Union of Soviet Socialist Republics 532 Netherlands Antilles 890 Socialist Federal Republic of Yugoslavia 200 Czechoslovakia 278 German Democratic Republic 280 Federal Republic of Germany 582 Pacific Islands (Trust Territory) 720 Democratic Yemen 886 Yemen 230 Ethiopia 104 Burma 116 Democratic Kampuchea 180 Zaire 384 Ivory Coast 854 Upper Volta %% Region %% 002 Africa 014 Eastern Africa 017 Middle Africa 015 Northern Africa 018 Southern Africa 011 Western Africa 019 Americas 419 Latin America and the Caribbean 029 Caribbean 013 Central America 005 South America 021 Northern America 142 Asia 030 Eastern Asia 062 South-central Asia 035 South-eastern Asia 145 Western Asia 150 Europe 151 Eastern Europe 154 Northern Europe 039 Southern Europe 155 Western Europe 009 Oceania 053 Australia and New Zealand 054 Melanesia 055 Micronesia-Polynesia 057 Micronesia 061 Polynesia __END__
jywarren/armsflow
scripts/CAIDA/Countries.pm
Perl
mit
17,743
while(<>) { if(/^\s*#define\s+(SV_\S+)\s+/) { print "$1\n"; } }
sptim/legacy-sputils
scripts/extract_sysval_conv1.pl
Perl
mit
68
#!/usr/bin/env perl use 5.010; use strict; use warnings; use autodie qw(open); use File::Basename; use Getopt::Long; my $infile; my $outfile; my $genus; my $species; my $help; GetOptions( 'i|infile=s' => \$infile, 'o|outfile=s' => \$outfile, 'g|genus=s' => \$genus, 's|species=s' => \$species, 'h|help' => \$help, ); usage() and exit(0) if $help; if (!$infile || !$outfile || !$genus || !$species) { say "\n[ERROR]: Command line not parsed correctly. Check input and refer to the usage. Exiting.\n"; usage(); exit(1); } my ($seq, $seqid, @seqparts); open my $in, '<', $infile; open my $out, '>', $outfile; { local $/ = '>'; while (my $line = <$in>) { chomp $line; ($seqid, @seqparts) = split /\n/, $line; $seq = join '', @seqparts; next unless defined $seqid && defined $seq; # format ID my ($id, $type, @epithet) = split /\s+/, $seqid; next unless defined $type && @epithet; my ($gen, $sp) = @epithet; next unless defined $gen && defined $sp; if (lc($gen) eq lc($genus) && lc($sp) eq lc($species)) { # format sequence $seq =~ s/.{60}\K/\n/g; say $out join "\n", ">".$seqid, $seq; } } } close $in; close $out; exit; ## methods sub usage { my $script = basename($0); print STDERR <<END USAGE: $script [-i] [-o] [-g] [-s] [-h] Required: -i|infile : A Fasta file of repeats to be formatted for Transposome. -o|outfile : A name for the selected sequences. -g|genus : The source genus of the sequences. -s|species : The source species of the sequences. Options: -h|help : Print a usage statement. END }
sestaton/transposome-scripts
select_database_species.pl
Perl
mit
1,755
use 5.022; { package Worker; use Moose; use threads; use threads::shared; use namespace::autoclean; my $job_in_progress :shared = 0; my $var :shared = 0; sub do_job { my $self = shift; my $thr1 = threads->create(\&job); $thr1->join; say $var; } sub job_begin { my $self = shift; if ($job_in_progress) { return; } return($job_in_progress = 1); } sub job_end { my $self = shift; $job_in_progress = 0; } sub job { if (job_begin) { $var = 1.0; job_end; } } __PACKAGE__->meta->make_immutable; } my $wrk = Worker->new; $wrk->do_job;
jmcveigh/perl-design-patterns
ConcurrencyPatterns/Balking.pl
Perl
mit
778
%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%% % % Newton's cooling law % % Possible solution in prolog for % http://rosettacode.org/wiki/Euler_method % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff(ncl(t), Result) :- Result is -k * (ncl(t+h) - ncl(t)). ncl(0,Return) :- ncl(t, Return) :-
alexmsmartins/ChemlogSim
exp/newtons_cooling_law.pl
Perl
mit
296
#!/usr/bin/env perl # Unit test for Sourcemod plugin Multi-Giveaway # # Check for discrepencies in translation phrase usage. Reports potential typos. use strict; use warnings; use v5.14; use File::Basename; my @cfiles = ('multi-giveaway.sp'); my @tfiles = ('Multi-Giveaway.phrases.txt'); my $tpath = 'translations'; my @phrases; my %report = ( valid => {}, # Phrases used that exist in a translation file invalid => {}, # Phrases used that do not exist in a translation file unused => [] # Phrases available but not used ); chdir dirname($0); # Scan our translation file(s) foreach my $f (@tfiles) { open my $fh, '<', "../$tpath/$f"; while (<$fh>) { push @phrases, $1 if $_ =~ /^\s\s"(.+)"$/; } close $fh; } # Walk our code and generate a report foreach my $f (@cfiles) { my $regex = qr/"(MG_[^"]+)",?/; open my $fh, '<', "../$f"; while (my $line = <$fh>) { #next unless $line =~ /%t/; if ($line !~ /\/\/\s*.*$regex/) { my @matches = $line =~ /"(MG_[^"]+)",?/g; foreach my $m (@matches) { if (grep {$_ eq $m} @phrases) { $report{valid}{$.} //= []; push @{$report{valid}{$.}}, $m; } else { $report{invalid}{$.} = $1; } } } } close $fh; } # Check for unused translations @{$report{unused}} = @phrases; foreach my $v (values %{$report{valid}}) { foreach my $p (@$v) { @{$report{unused}} = grep {$_ ne $p} @{$report{unused}}; } } # Print report my $valid = keys %{$report{valid}}; my $invalid = keys %{$report{invalid}}; my $unused = @{$report{unused}}; my $total_uses = (keys %{$report{valid}}) + (keys %{$report{invalid}}); print "$total_uses phrase uses out of " . scalar @phrases . " total\n"; print($invalid ? '✗' : '✓', " $invalid invalid\n"); print($unused ? '!' : '✓', " $unused unused\n"); print "Invalid uses:\n" if $invalid; while (my ($line, $p) = each %{$report{invalid}}) { print "[*] Line $line: $p\n"; } do { local $" = ', '; print "Unused: @{$report{unused}}\n" if $unused }; # Exit status for git hook exit 1 if $invalid;
ZeroKnight/sm-Multi-Giveaway
tests/check_translations.pl
Perl
mit
2,123
# This file is auto-generated by the Perl DateTime Suite time zone # code generator (0.07) This code generator comes with the # DateTime::TimeZone module distribution in the tools/ directory # # Generated from debian/tzdata/africa. Olson data version 2008c # # Do not edit this file directly. # package DateTime::TimeZone::Africa::Lubumbashi; use strict; use Class::Singleton; use DateTime::TimeZone; use DateTime::TimeZone::OlsonDB; @DateTime::TimeZone::Africa::Lubumbashi::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' ); my $spans = [ [ DateTime::TimeZone::NEG_INFINITY, 59859036608, DateTime::TimeZone::NEG_INFINITY, 59859043200, 6592, 0, 'LMT' ], [ 59859036608, DateTime::TimeZone::INFINITY, 59859043808, DateTime::TimeZone::INFINITY, 7200, 0, 'CAT' ], ]; sub olson_version { '2008c' } sub has_dst_changes { 0 } sub _max_year { 2018 } sub _new_instance { return shift->_init( @_, spans => $spans ); } 1;
carlgao/lenga
images/lenny64-peon/usr/share/perl5/DateTime/TimeZone/Africa/Lubumbashi.pm
Perl
mit
946
# Copyrights 2003,2004,2007 by Mark Overmeer <perl@overmeer.net>. # For other contributors see Changes. # See the manual pages for details on the licensing terms. # Pod stripped from pm file by OODoc 1.02. package User::Identity; use vars '$VERSION'; $VERSION = '0.92'; use base 'User::Identity::Item'; use strict; use warnings; use Carp; use overload '""' => 'fullName'; #----------------------------------------- my @attributes = qw/charset courtesy birth full_name formal_name firstname gender initials language nickname prefix surname titles /; sub init($) { my ($self, $args) = @_; exists $args->{$_} && ($self->{'UI_'.$_} = delete $args->{$_}) foreach @attributes; $self->SUPER::init($args); } sub type() { 'user' } sub user() { shift } sub charset() { shift->{UI_charset} || $ENV{LC_CTYPE} } sub nickname() { my $self = shift; $self->{UI_nickname} || $self->name; # TBI: If OS-specific info exists, then username } sub firstname() { my $self = shift; $self->{UI_firstname} || ucfirst $self->nickname; } sub initials() { my $self = shift; return $self->{UI_initials} if defined $self->{UI_initials}; if(my $firstname = $self->firstname) { my $i = ''; while( $firstname =~ m/(\w+)(\-)?/g ) { my ($part, $connect) = ($1,$2); $connect ||= '.'; $part =~ m/^(chr|th|\w)/i; $i .= ucfirst(lc $1).$connect; } return $i; } } sub prefix() { shift->{UI_prefix} } sub surname() { shift->{UI_surname} } sub fullName() { my $self = shift; return $self->{UI_full_name} if defined $self->{UI_full_name}; my ($first, $prefix, $surname) = @$self{ qw/UI_firstname UI_prefix UI_surname/}; $surname = ucfirst $self->nickname if defined $first && ! defined $surname; $first = $self->firstname if !defined $first && defined $surname; my $full = join ' ', grep {defined $_} ($first,$prefix,$surname); $full = $self->firstname unless length $full; # TBI: if OS-specific knowledge, then unix GCOS? $full; } sub formalName() { my $self = shift; return $self->{UI_formal_name} if defined $self->{UI_formal_name}; my $initials = $self->initials; my $firstname = $self->{UI_firstname}; $firstname = "($firstname)" if defined $firstname; my $full = join ' ', grep {defined $_} $self->courtesy, $initials , @$self{ qw/UI_prefix UI_surname UI_titles/ }; } my %male_courtesy = ( mister => 'en' , mr => 'en' , sir => 'en' , 'de heer' => 'nl' , mijnheer => 'nl' , dhr => 'nl' , herr => 'de' ); my %male_courtesy_default = ( en => 'Mr.' , nl => 'De heer' , de => 'Herr' ); my %female_courtesy = ( miss => 'en' , ms => 'en' , mrs => 'en' , madam => 'en' , mevr => 'nl' , mevrouw => 'nl' , frau => 'de' ); my %female_courtesy_default = ( en => 'Madam' , nl => 'Mevrouw' , de => 'Frau' ); sub courtesy() { my $self = shift; return $self->{UI_courtesy} if defined $self->{UI_courtesy}; my $table = $self->isMale ? \%male_courtesy_default : $self->isFemale ? \%female_courtesy_default : return undef; my $lang = lc $self->language; return $table->{$lang} if exists $table->{$lang}; $lang =~ s/\..*//; # "en_GB.utf8" --> "en-GB" and retry return $table->{$lang} if exists $table->{$lang}; $lang =~ s/[-_].*//; # "en_GB.utf8" --> "en" and retry $table->{$lang}; } # TBI: if we have a courtesy, we may detect the language. # TBI: when we have a postal address, we may derive the language from # the country. # TBI: if we have an e-mail addres, we may derive the language from # that. sub language() { shift->{UI_language} || 'en' } sub gender() { shift->{UI_gender} } sub isMale() { my $self = shift; if(my $gender = $self->{UI_gender}) { return $gender =~ m/^[mh]/i; } if(my $courtesy = $self->{UI_courtesy}) { $courtesy = lc $courtesy; $courtesy =~ s/[^\s\w]//g; return 1 if exists $male_courtesy{$courtesy}; } undef; } sub isFemale() { my $self = shift; if(my $gender = $self->{UI_gender}) { return $gender =~ m/^[vf]/i; } if(my $courtesy = $self->{UI_courtesy}) { $courtesy = lc $courtesy; $courtesy =~ s/[^\s\w]//g; return 1 if exists $female_courtesy{$courtesy}; } undef; } sub dateOfBirth() { shift->{UI_birth} } sub birth() { my $birth = shift->dateOfBirth; my $time; if($birth =~ m/^\s*(\d{4})[-\s]*(\d{2})[-\s]*(\d{2})\s*$/) { # Pre-formatted. return sprintf "%04d%02d%02d", $1, $2, $3; } eval "require Date::Parse"; unless($@) { my ($day,$month,$year) = (Date::Parse::strptime($birth))[3,4,5]; if(defined $year) { return sprintf "%04d%02d%02d" , ($year + 1900) , (defined $month ? $month+1 : 0) , ($day || 0); } } # TBI: Other date parsers undef; } sub age() { my $birth = shift->birth or return; my ($year, $month, $day) = $birth =~ m/^(\d{4})(\d\d)(\d\d)$/; my ($today, $tomonth, $toyear) = (localtime)[3,4,5]; $tomonth++; my $age = $toyear+1900 - $year; $age-- if $month > $tomonth || ($month == $tomonth && $day >= $today); $age; } sub titles() { shift->{UI_titles} } 1;
carlgao/lenga
images/lenny64-peon/usr/share/perl5/User/Identity.pm
Perl
mit
5,562
package SequenceMapper::Sequence_obj; use strict; use warnings; use List::MoreUtils qw(any); use Data::Dumper; use Class::Std::Utils; use SequenceMapper::Alignment_obj; use SequenceMapper::Contig_obj; { #Class Attributes my %name_of; my %length_of; my %alignments_of; my %contigs_of; my %coverage_of; sub new { my ($class, $args_href) = @_; #print "$class\n"; #print "$args_href->{'name'}\n"; #check if essential parameters defined, could use to give better error report if ( any {! defined} $args_href->{name}, $args_href->{length} ) { die "Cannot create new Sequence object. Parameter undefined.\n"; } #bless takes two args, a reference to the variable and a string containing th ename of the class #/do{my $anon_scalar} = reference to a scalar that only has scope within the do statement. So the object doesn't "exist" after the end of the do but it still kept alive because of the blessed reference to it #could be done with the anon_scalar() method from class::std::utils my $new_obj = bless \do{my $anon_scalar}, $class; #set parameters for object; length() returns a unique id for the object $name_of{ident $new_obj} = $args_href->{name}; $length_of{ident $new_obj} = $args_href->{length}; #print "$name_of{ident $new_obj}\n"; #store a reference to an empty array for the alignments hash $alignments_of{ident $new_obj} = []; #print "success!\n"; return $new_obj; } sub get_name { my ($self) = @_; if ( ! defined $name_of{ident $self}) { return "Header of object is not defined. Make sure object was created. \n"; } else { return $name_of{ident $self}; } } sub get_length { my ($self) = @_; if ( ! defined $length_of{ident $self} ) { return "Length of object is not defined. Make sure object was created. \n"; } else { return $length_of{ident $self}; } } sub add_alignment { my ($self, $alignment) = @_; #my $alignments_of; #add the new alignment object reference to the array push @{$alignments_of{ident $self}}, $alignment; } sub get_alignments { my ($self) = @_; #Do I want to return an array? or the reference? #return the ref because it is better on memory return $alignments_of{ident $self}; } sub get_contigs { my ($self) = @_; return $contigs_of{ident $self}; } sub build_contigs { my ($self) = @_; #sort by alignment length my @sorted_aligns = sort {$a->get_length() <=> $b->get_length()} @{$self->get_alignments}; #set first and last positions for the sequence (use intuitive scale-starting with one) my @sequence; my $last = $self->get_length(); #STEP 1: add each alignment giving precidence to the longer alignments (b/c of the sort) foreach my $alignment (@sorted_aligns) { for ( my $i = $alignment->get_start(); $i <= $alignment->get_end(); $i++ ) { $sequence[$i] = $alignment if ( ! defined $sequence[$i] ); } print "$alignment\n"; } print "seq elements =", scalar @sequence, " \n"; #STEP 2: Parse the sequence for contigs #data type to hold contig alignments = anon hash within anon array my $contig = []; for ( my $i = 0; $i < @sequence; $i++ ) { if ( ! defined $sequence[$i] ) { next; } my $id = $sequence[$i]; my $start = $i; while ($sequence[$i] = $sequence[$i+1]) { $i++; #print "$sequence[$i]\t$sequence[$i+1]\n"; } my $end = $i; #add the portion of the contig to the whole thing (as a hash ref) push @{$contig}, {'id' => $id, 'start' => $start, 'end' => $end}; #end the contig if there is an undefined index next if ( ! defined $sequence[$i+1] ) { $self->add_contig($contig); $contig = []; } } } sub add_contig { my ($self, $contig) = @_; my $new_contig = SequenceMapper::Contig_obj->new({'from_build' => $contig}); push @{$contigs_of{ident $self}}, $new_contig; } sub perc_cov { my ($self) = @_; my $total_coverage = 0; foreach my $contig (@{$contigs_of{ident $self}}) { $total_coverage += $contig->get_length; } my $percent_cov = ($total_coverage / $self->get_length) * 100; return $percent_cov; } #may be handled better by a map object(that can keep track of stats, etc) #or perhaps each contig should be a contig object with stats #either way, this is very costly, don't want to allow the user to do more than once. sub percent_coverage { my ($self) = @_; #check if it has already been calculated first return $coverage_of{ident $self} if ( defined $coverage_of{ident $self} ); #arrays refs to store start and end value pairs my @start = (); my @end = (); foreach my $alignment (@{$self->get_alignments()}) { print $alignment->get_name(), "\tstart= ", $alignment->get_start(), "\tend= ", $alignment->get_end(),"\n"; print "Beginning ", join "\t", @start, "\n"; print "Beginning ", join "\t", @end, "\n\n"; #declare these to avoid repeated calls my $aln_start = $alignment->get_start(); my $aln_end = $alignment->get_end(); #this fires up only on the first alignment if ( ! @start ) { push @start, $aln_start; push @end, $aln_end; next; } my $cur_contig = 0; my $collapse = 0; my $new_min = $aln_start; my $new_max = $aln_end; for (; $cur_contig < @start; $cur_contig++ ) { print "$cur_contig = contig \t"; print "$start[$cur_contig] :: $end[$cur_contig]\n"; if ( $aln_start <= $start[$cur_contig] ) { for (my $i = $cur_contig; $i < @start; $i++ ) { if ( $new_max < $start[$i] ) { print "cur = $cur_contig\n"; print "i = $i\n"; last; } else { print "cur = $cur_contig\n"; $new_max = $end[$i] if ( $end[$i] > $new_max ); $collapse++; } } #end the loop here (keeps the contig value right) might be able to remove main loop if use a loop like this one in the second half last; } elsif ( $aln_start > $start[$cur_contig] ) { #next if alignment ends later than contig; if last contig, it will make a new entry next if ( $aln_start > $end[$cur_contig] ); if ( $aln_start <= $end[$cur_contig] ) { $new_min = $start[$cur_contig]; for ( my $i = $cur_contig; $i < @start; $i++ ) { if ( $new_max < $start[$i] ) { last; } else { $new_max = $end[$i] if ( $end[$i] > $new_max ); $collapse++; } #should change loop to use cur_contig or remove the main loop instead of this hack } } #last to end the loop -> may be able to collapse main loop last; } print "end cur = $cur_contig\n"; } #end contig loop #splice the contigs print "cur = $cur_contig\n"; splice( @start, $cur_contig, $collapse, $new_min ); splice( @end, $cur_contig, $collapse, $new_max ); print "Splice = start, ", $cur_contig, ", $collapse, $new_min\n"; print "\nEnd ", join "\t", @start, "\n"; print "End ", join "\t", @end, "\n\n"; } #end alignment #calculate percent my $total_cov = 0; for ( my $i = 0; $i < @start; $i++ ) { $total_cov += ($end[$i] - $start[$i]); } print "$total_cov ", $self->get_length, "\n"; my $perc_cov = $total_cov / $self->get_length(); #store the value to prevent multiple calculations $coverage_of{ident $self} = $perc_cov; return $perc_cov; } sub Build_contigs { my ($self) = @_; } #delete all attributes of the object; won't destroy the object through b/c there is still ref to it in the main program? sub DESTROY { my ($self) = @_; delete $name_of{ident $self}; delete $length_of{ident $self}; delete $alignments_of{ident $self}; delete $coverage_of{ident $self}; } } 1;
hunter-cameron/Bioinformatics
perl/SequenceMapper/Sequence_obj.pm
Perl
mit
9,852
use v5.14; package Diversion::FeedFetcher { use Moo; use XML::Loy; use Encode qw(); use Diversion::UrlArchiver; has url => ( is => "ro", required => 1 ); has feed => ( is => "lazy", predicate => "feed_is_fetched", ); sub _build_feed { my ($self) = @_; my @entries; my $feed = { entry => \@entries }; my $response = Diversion::UrlArchiver->new->get_remote( $self->url ); die "Failed to retrieve ". $self->url ." : $response->{reason}" unless $response && $response->{success}; die "Status Not OK: " . $self->url . " : $response->{reason}" unless $response->{status} == 200; my ($enc) = $response->{content} =~ m!\A.+encoding="([^"]+)"!; $enc ||= "utf-8"; $enc = lc($enc); my $feed_content = Encode::decode($enc, $response->{content}); my $xloy = XML::Loy->new( $feed_content ); my $root; if ($root = $xloy->find("rss")->[0]) { for my $tag ("title", "description", "updated") { if (my $e = $root->find($tag)->[0]) { $feed->{$tag} = $e->all_text; } } } elsif ($root = $xloy->find("feed")->[0]) { for my $tag ("id", "title", "description", "updated") { if (my $e = $root->find($tag)->[0]) { $feed->{$tag} = $e->all_text; } } } $xloy->find("item, entry")->each( sub { my $el = $_[0]; push @entries, my $entry = {}; for my $tag ("content", "thumbnail") { my $e2 = $el->find($tag)->[0]; if ($e2) { $entry->{"media_$tag"} = $e2->attr("url"); } } for my $tag ("category", "creator", "author", "title", "link", "description", "summary", "pubDate", "updated") { my $e2 = $el->find($tag)->[0]; if ($e2) { $entry->{$tag} = $e2->all_text =~ s!\A\s+!!r =~ s!\s+$!!r; } } unless ($entry->{link}) { for my $e2 ($el->find("link")->each) { my $type = $e2->attr("type") or next; my $rel = $e2->attr("rel") or next; if ($type eq "text/html" && $rel eq "alternate") { $entry->{link} = $e2->attr("href"); } } } $entry->{description} = Mojo::DOM->new("<div>" . ($entry->{description}//"") . "</div>")->all_text; for (keys %$entry) { $entry->{$_} = Encode::decode_utf8($entry->{$_}) unless Encode::is_utf8($entry->{$_}); } $entry->{title} =~ s!\n! !g; } ); return $feed; } sub each_entry { my ($self, $cb) = @_; return @{ $self->feed->{entry} } if !$cb; return unless ref($cb) eq 'CODE'; my @entries = @{ $self->feed->{entry} }; for my $i (0..$#entries) { $cb->($entries[$i], $i); } return $self; } }; no Moo; 1;
gugod/Diversion
lib/Diversion/FeedFetcher.pm
Perl
cc0-1.0
3,332
# # Copyright 2021 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package storage::dell::fluidfs::snmp::mode::components::overall; use strict; use warnings; my $mapping = { fluidFSNASApplianceApplianceServiceTag => { oid => '.1.3.6.1.4.1.674.11000.2000.200.1.16.1.3' }, fluidFSNASApplianceStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.200.1.16.1.5' }, fluidFSNASApplianceModel => { oid => '.1.3.6.1.4.1.674.11000.2000.200.1.16.1.6' }, }; my $oid_fluidFSNASApplianceEntry = '.1.3.6.1.4.1.674.11000.2000.200.1.16.1'; sub load { my ($self) = @_; push @{$self->{request}}, { oid => $oid_fluidFSNASApplianceEntry }; } sub check { my ($self) = @_; $self->{output}->output_add(long_msg => "Checking nas overall"); $self->{components}->{overall} = {name => 'overall', total => 0, skip => 0}; return if ($self->check_filter(section => 'overall')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_fluidFSNASApplianceEntry}})) { next if ($oid !~ /^$mapping->{fluidFSNASApplianceStatus}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fluidFSNASApplianceEntry}, instance => $instance); next if ($self->check_filter(section => 'overall', instance => $instance)); $self->{components}->{overall}->{total}++; $self->{output}->output_add(long_msg => sprintf("nas '%s/%s' overall status is '%s' [instance = %s]", $result->{fluidFSNASApplianceApplianceServiceTag}, $result->{fluidFSNASApplianceModel}, $result->{fluidFSNASApplianceStatus}, $instance )); my $exit = $self->get_severity(label => 'default', section => 'overall', value => $result->{fluidFSNASApplianceStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("nas '%s/%s' overall status is '%s'", $result->{fluidFSNASApplianceApplianceServiceTag}, $result->{fluidFSNASApplianceModel}, $result->{fluidFSNASApplianceStatus} )); } } } 1;
Tpo76/centreon-plugins
storage/dell/fluidfs/snmp/mode/components/overall.pm
Perl
apache-2.0
3,163
package Paws::ELBv2::DeleteRule; use Moose; has RuleArn => (is => 'ro', isa => 'Str', required => 1); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'DeleteRule'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::ELBv2::DeleteRuleOutput'); class_has _result_key => (isa => 'Str', is => 'ro', default => 'DeleteRuleResult'); 1; ### main pod documentation begin ### =head1 NAME Paws::ELBv2::DeleteRule - Arguments for method DeleteRule on Paws::ELBv2 =head1 DESCRIPTION This class represents the parameters used for calling the method DeleteRule on the Elastic Load Balancing service. Use the attributes of this class as arguments to method DeleteRule. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to DeleteRule. As an example: $service_obj->DeleteRule(Att1 => $value1, Att2 => $value2, ...); Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. =head1 ATTRIBUTES =head2 B<REQUIRED> RuleArn => Str The Amazon Resource Name (ARN) of the rule. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method DeleteRule in L<Paws::ELBv2> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/ELBv2/DeleteRule.pm
Perl
apache-2.0
1,583
use strict; use warnings; use Bio::EnsEMBL::Registry; my $registry = 'Bio::EnsEMBL::Registry'; $registry->load_all('/hps/nobackup2/production/ensembl/anja/release_97/human/regulation_effect/ensembl.registry'); my $species = 'human'; my $sa = $registry->get_adaptor($species, 'core', 'slice'); my $rfa = $registry->get_adaptor($species, 'funcgen', 'RegulatoryFeature'); my $vdba = $registry->get_DBAdaptor($species, 'variation'); my $dbh = $vdba->dbc->db_handle; #{"seq_region_end" => 44599149,"seq_region_name" => 10,"seq_region_start" => 39643689} #{"seq_region_end" => 29384982,"seq_region_name" => 17,"seq_region_start" => 24487486} #{"seq_region_end" => 53970840,"seq_region_name" => 5,"seq_region_start" => 49064401} my $seq_region_name = 10; my $seq_region_start = 39643689; my $seq_region_end = 44599149; my $slice = $sa->fetch_by_region('toplevel', $seq_region_name, $seq_region_start, $seq_region_end); my @regulatory_features = grep { $_->seq_region_end <= $seq_region_end } @{$rfa->fetch_all_by_Slice($slice)||[]}; foreach my $regulatory_feature (@regulatory_features) { my $stable_id = $regulatory_feature->stable_id; my $sth = $dbh->prepare(qq{ SELECT COUNT(distinct variation_feature_id) FROM regulatory_feature_variation WHERE feature_stable_id=?; }); $sth->execute($stable_id) or die 'Could not execute statement ' . $sth->errstr; my @row = $sth->fetchrow_array; my $count = $row[0]; $sth->finish(); $slice = $sa->fetch_by_Feature($regulatory_feature); my @vfs = (); push @vfs, @{ $slice->get_all_VariationFeatures }; push @vfs, @{ $slice->get_all_somatic_VariationFeatures }; my $count_vfs = scalar @vfs; if ($count_vfs != $count) { print STDERR $stable_id, ' ', $count, ' ', $count_vfs, "\n"; my @sorted = sort {$a->seq_region_end <=> $b->seq_region_end} @vfs; my $smallest = $sorted[0]; my $largest = $sorted[$#sorted]; print STDERR $smallest->seq_region_start, ' ', $smallest->seq_region_end, "\n"; print STDERR $largest->seq_region_start, ' ', $largest->seq_region_end, "\n"; } }
at7/work
api/find_boundary_variations.pl
Perl
apache-2.0
2,069
# Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute # Copyright [2016-2022] EMBL-European Bioinformatics Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. =pod =head1 NAME transfer_ig_genes.pl =head1 DESCRIPTION This script transfers IG gene segments from a source ("query") DB to an output ("target") DB. In the process, if the "query" gene segment overlaps at the exon level with a gene (of a specified biotype) in the target DB, the "query" gene will *overwrite* the "target" one. Note: the script expects the query DB to contain *no other gene types* except Ig gene segments. =head1 OPTIONS =head2 DB connection: =head3 DB containing query (source) Ig gene segments -qydbuser Read-only username to connect to query DB -qydbhost Where the query DB is -qydbname query DB name -qydbport Port to connect to query DB =head3 DB containing target (output) genes (some of them to be overwritten by "query" genes) -tgdbuser Username to connect to target DB with write permissions -tgdbpass Password to connect to target DB -tgdbhost Where the target DB is -tgdbname target DB name -tgdbport Port to connect to target DB =head3 DB containing DNA sequences. You must provide such details if your query and/or target DB contains no DNA sequence. -dnadbuser Read-only username to connect to DNA DB -dnadbhost Where the DNA DB is -dnadbname DNA DB name -dnadbport Port to connect to DNA DB -path The version of the assembly you want to fetch DNA sequences from (e.g "GRCh37", "NCBIM37") ----------------------------------------------------------------------- =head2 Analysis and output options: -tgbiotypes A list of biotypes of target genes which should be compared against query genes *and* can be replaced by query genes if substantial exon overlap is found between the query and target. The list should be comma-separated with no whitespace, e.g."protein_coding,pseudogene" -sub_biotypes Optional. A boolean flag to indicate whether a biotype substitution check needs to be done. Switched off by default. The check mainly concerns copying Ig gene segments from Vega DB (query DB) to a target DB which already contains some Ig gene segments from Ensembl. Vega Ig gene segments always have priority over Ensembl ones, so Vega Ig models will overwrite Ensembl ones. However, Ensembl Ig models sometimes have more detailed biotypes (e.g. "IG_V_gene" instead of simply "IG_gene"), and we want to keep the more elaborate biotypes. Therefore, the script can check if the target gene has a biotype starting with "IG*", and if yes, the script will assign the original target's biotype onto the overwriting Vega Ig model. -verbose A boolean option to get more print statements to follow the script. Set to 0 (not verbose) by default. =cut #!/usr/bin/env perl use strict; use warnings; use Getopt::Long qw(:config no_ignore_case); use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::DBSQL::DBAdaptor; use Digest::MD5 qw(md5_hex); my ( $dbname, $dbhost, $dbuser, $dbport, $tgdbname, $tgdbhost, $tgdbuser, $tgdbport, $tgdbpass, $path, @tg_biotypes, %tg_biotypes, $tg_biotypes, $dna_dbuser, $dna_dbhost, $dna_dbname, $dna_dbport ); $dbuser = 'ensro' ; $dbport = 3306 ; $tgdbuser = 'ensro' ; $tgdbport = 3306 ; $dna_dbuser = 'ensro' ; $dna_dbport = 3306 ; my $sub_biotypes = 0; my $verbose = 0; GetOptions( 'qydbname|dbname|db|D=s' => \$dbname, 'qydbuser|dbuser|user|u=s' => \$dbuser, 'qydbhost|dbhost|host|h=s' => \$dbhost, 'qydbport|dbport|port|P=s' => \$dbport, 'tgdbname=s' => \$tgdbname, 'tgdbuser=s' => \$tgdbuser, 'tgdbhost=s' => \$tgdbhost, 'tgdbport=s' => \$tgdbport, 'tgdbpass=s' => \$tgdbpass, 'tgbiotypes=s' => \$tg_biotypes, 'dnadbuser:s' => \$dna_dbuser, 'dnadbhost:s' => \$dna_dbhost, 'dnadbname:s' => \$dna_dbname, 'dnadbport:s' => \$dna_dbport, 'sub_biotypes!'=> \$sub_biotypes, 'verbose!' => \$verbose, 'path=s' => \$path ); my $qy_db = Bio::EnsEMBL::DBSQL::DBAdaptor-> new( '-dbname' => $dbname, '-host' => $dbhost, '-user' => $dbuser, '-port' => $dbport, ); my $tg_db = Bio::EnsEMBL::DBSQL::DBAdaptor-> new( '-dbname' => $tgdbname, '-host' => $tgdbhost, '-user' => $tgdbuser, '-port' => $tgdbport, '-pass' => $tgdbpass ); my $qyDB_has_DNA = check_if_DB_contains_DNA($qy_db); my $tgDB_has_DNA = check_if_DB_contains_DNA($tg_db); if ($qyDB_has_DNA == 0 || $tgDB_has_DNA == 0) { if (!defined $dna_dbname || !defined $dna_dbhost) { throw ("You must provide both -dnadbname and -dnadbhost on the commandline to connect to ". "DNA_DB or else the code will die when trying to fully load genes."); } my $dnadb = Bio::EnsEMBL::DBSQL::DBAdaptor-> new( -dbname => $dna_dbname, -host => $dna_dbhost, -user => $dna_dbuser, -port => $dna_dbport, -path => $path ); if ($qyDB_has_DNA == 0) { print "Attaching DNA_DB to " . $qy_db->dbc->dbname . "\n"; $qy_db->dnadb($dnadb); } if ($tgDB_has_DNA ==0) { print "Attaching DNA_DB to " . $tg_db->dbc->dbname . "\n"; $tg_db->dnadb($dnadb); } } print "\n"; if ($tg_biotypes) { @tg_biotypes = split (",",$tg_biotypes); print "This is your array of transcript biotypes which can be overwritten by Ig models should there be exon overlap : ",join(" - ",@tg_biotypes),"\n"; map { $tg_biotypes{$_} = 1 } @tg_biotypes; } else { map { $tg_biotypes{$_} = 1 } ('protein_coding', 'pseudogene'); } $verbose and print STDERR "\nCurrent target db gene summary:\n" . &gene_stats_string . "\n"; my (@genes, %genes_by_slice); $verbose and print STDERR "Fetching new genes...\n"; if (@ARGV) { foreach my $slid (@ARGV) { my $sl = $qy_db->get_SliceAdaptor->fetch_by_name($slid); my $tl_sl = $qy_db->get_SliceAdaptor->fetch_by_region('toplevel', $sl->seq_region_name); my @genes = @{$sl->get_all_Genes}; @genes = map { $_->transfer($tl_sl) } @genes; push @{$genes_by_slice{$sl->seq_region_name}}, @genes; } } else { @genes = @{$qy_db->get_GeneAdaptor->fetch_all}; } ######################################################### # Fully load query DB (source) Ig genes to keep their # protein annotation features ######################################################### my ($new_sid_hash, $pep_feat_hash); $verbose and print STDERR "Fully loading genes...\n"; $pep_feat_hash = &fully_load_genes(\@genes); ######################################################## # Find relationships between new genes and old geneset ######################################################## $verbose and print STDERR "Comparing new genes to current...\n"; my ($genes_to_delete_hash, $stable_id_event_hash); if ($sub_biotypes){ ($genes_to_delete_hash, $stable_id_event_hash) = &compare_new_genes_with_current_genes(\@genes, 1); }else{ ($genes_to_delete_hash, $stable_id_event_hash) = &compare_new_genes_with_current_genes(\@genes, 0); } ######################################################## # remove old genes and store new ones ######################################################## $verbose and print STDERR "Storing new genes...\n"; @genes = @{&store_genes($pep_feat_hash, \@genes)}; $verbose and print "Removing interfering old genes...\n"; foreach my $g (values %$genes_to_delete_hash) { $tg_db->get_GeneAdaptor->remove($g); } $verbose and printf(STDERR "Done (%s removed, %d added)\n%s\n", scalar(keys %$genes_to_delete_hash), scalar(@genes), &gene_stats_string); ############################################################## sub fully_load_genes { my $glist = shift; my $prot_feat_hash = {}; foreach my $g (@$glist) { foreach my $t (@{$g->get_all_Transcripts}) { foreach my $e (@{$t->get_all_Exons}) { $e->get_all_supporting_features; } my $tr = $t->translation; if (defined $tr) { # adaptor cascade for gene does not handle protein # features. In order to do that here, we have to keep # the the translation object so that we can obtain # its new dbID after storage $prot_feat_hash->{$tr->dbID} = [$tr]; foreach my $pf (@{$tr->get_all_ProteinFeatures}) { push @{$prot_feat_hash->{$tr->dbID}}, $pf; } } $t->get_all_supporting_features; } } return $prot_feat_hash; } ###################################################################### ###################################################################### sub store_genes { my ($prot_feat_hash, $glist) = @_; my $g_adap = $tg_db->get_GeneAdaptor; my $p_adap = $tg_db->get_ProteinFeatureAdaptor; my $dbea = $tg_db->get_DBEntryAdaptor; foreach my $g (@$glist) { $g_adap->store($g); } # At this point, all translations should have new dbIDs. # We can now store the protein features foreach my $old_dbid (keys %$prot_feat_hash) { my ($trn, @feats) = @{$prot_feat_hash->{$old_dbid}}; my $new_dbid = $trn->dbID; foreach my $f (@feats) { $p_adap->store($f, $new_dbid); } } # finally, refetch the stored genes from the target database # so that they we are working exclusively with target databases # adaptors from here on in my @tg_genes; foreach my $g (@$glist) { my $ng = $g_adap->fetch_by_dbID($g->dbID); foreach my $t (@{$ng->get_all_Transcripts}) { $t->get_all_supporting_features; $t->translation; foreach my $e (@{$t->get_all_Exons}) { $e->get_all_supporting_features; } } push @tg_genes, $ng; } return \@tg_genes; } ###################################################################### sub compare_new_genes_with_current_genes { my ($glist, $sub_biotypes) = @_; my (%by_slice, %genes_to_remove, %stable_id_event); map { push @{$by_slice{$_->slice->seq_region_name}}, $_ } @$glist; foreach my $sr_id (keys %by_slice) { my @g = sort { $a->start <=> $b->start } @{$by_slice{$sr_id}}; my $tg_tl_slice = $tg_db->get_SliceAdaptor->fetch_by_region('toplevel', $sr_id); foreach my $g (@g) { # Need to fully load the genes $g->load(); my $oslice = $tg_db->get_SliceAdaptor->fetch_by_region('toplevel', $sr_id, $g->start, $g->end); my @ogenes = map { $_->transfer($tg_tl_slice) } @{$oslice->get_all_Genes}; @ogenes = grep { exists($tg_biotypes{$_->biotype}) } @ogenes; # print "YOUR HAVE THIS ORIGINAL GENES: ",scalar(@ogenes),"\n"; if (@ogenes) { foreach my $t (@{$g->get_all_Transcripts}) { my @exons = @{$g->get_all_Exons}; foreach my $og (@ogenes) { # Fully load the genes $og->load(); foreach my $ot (@{$og->get_all_Transcripts}) { my $has_exon_overlap = 0; PAIR: foreach my $oe (@{$ot->get_all_Exons}) { foreach my $e (@exons) { if ($e->strand == $oe->strand and $e->overlaps($oe)) { $has_exon_overlap = 1; last PAIR; } } } if ($has_exon_overlap) { # transcripts $t and $ot have exon overlap # therefore: # delete gene $og (and all transcripts) # map $og to $g # map $ot to $t # map $ot->translation to $t->translation # Do a biotype check here if "sub_biotypes" flag # is set to 1. # If the original/target gene (to be replaced) has # an "IG*" biotype, we keep the target biotype as # it's already quite specific. # i.e. we do replace the target gene *model* with # the query *model* but the replaced gene will # retain its original biotype. if ($sub_biotypes == 1){ if ($og->biotype =~/IG/){ $g->biotype($og->biotype); $t->biotype($ot->biotype); } } $genes_to_remove{$og->dbID} = $og; } } } } } } } return (\%genes_to_remove, \%stable_id_event); } ###################################################################### sub gene_stats_string { my $summary_string = ""; my $sql = "select biotype, count(*) from gene group by biotype order by biotype"; my $st = $tg_db->dbc->prepare($sql); $st->execute; while(my ($tp, $c) = $st->fetchrow_array) { $summary_string .= sprintf("%-20s %5d\n", $tp, $c); } $st->finish; return $summary_string; } ####################################################################### sub check_if_DB_contains_DNA { my ($db) = @_; my $sql_command = "select count(*) from dna"; my $sth = $db->dbc->prepare($sql_command); $sth->execute(); my @dna_array = $sth->fetchrow_array; if ($dna_array[0] > 0) { print "Your DB ". $db->dbc->dbname ." contains DNA sequences. No need to attach a ". "DNA_DB to it.\n" if ($verbose); return 1; } else { print "Your DB ". $db->dbc->dbname ." does not contain DNA sequences.\n" if ($verbose); return 0; } }
Ensembl/ensembl-analysis
scripts/ig/transfer_gene_segments.pl
Perl
apache-2.0
15,232
package Paws::ES::InstanceCountLimits; use Moose; has MaximumInstanceCount => (is => 'ro', isa => 'Int'); has MinimumInstanceCount => (is => 'ro', isa => 'Int'); 1; ### main pod documentation begin ### =head1 NAME Paws::ES::InstanceCountLimits =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::ES::InstanceCountLimits object: $service_obj->Method(Att1 => { MaximumInstanceCount => $value, ..., MinimumInstanceCount => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::ES::InstanceCountLimits object: $result = $service_obj->Method(...); $result->Att1->MaximumInstanceCount =head1 DESCRIPTION InstanceCountLimits represents the limits on number of instances that be created in Amazon Elasticsearch for given InstanceType. =head1 ATTRIBUTES =head2 MaximumInstanceCount => Int =head2 MinimumInstanceCount => Int =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::ES> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/ES/InstanceCountLimits.pm
Perl
apache-2.0
1,484
where_food(Food, Location) :- location(object(Food, _, _, _), Location), edible(object(Food, _, _, _)). exists_food(Food) :- where_food(Food, ?). % recursive definition of containment % or the Object is contained in AnotherContainer, which is contained in the original Container is_contained_in(object(Object, Color, Size, Weight), Container) :- location(object(Object, Color, Size, Weight), AnotherContainer), is_contained_in(object(AnotherContainer, _, _, _), Container). % either the Object is directly contained in its Container is_contained_in(object(Object, Color, Size, Weight), Container) :- location(object(Object, Color, Size, Weight), Container). % syntactic alias for is_contained_in is_in(Object, Container) :- is_contained_in(object(Object, _, _, _), Container). % list the elements in a given room (fail is needed to loop through the whole KB) list_things(Room) :- is_contained_in(object(Item, _, _, Weight), Room), object(Item, _, _, Weight), tab(2), write(Item), write_weight(Weight), nl, fail. % after the listing ends, the loop fails, so we need to tell that the "loop" is always true list_things(_). write_weight(Weight) :- Weight =< 1, write(' ('), write(Weight), write(' kg)'). write_weight(Weight) :- Weight > 1, write(' ('), write(Weight), write(' kgs)'). % tell the game player where he or she is, what things are in the room, and which rooms are adjacent look :- here(Here), write('You are in the '), write(Here), write('.'), nl, write('Here''s what you can find: '), nl, list_things(Here), write('You can now go to: '), nl, list_connections(Here). look_in(Place) :- write(Place), write(' contains the following items:'), nl, list_things(Place), nl. % inventory/0 lists the have/1 things inventory :- write('You have the following items:'), nl, have(X), tab(2), write('- '), write(X), nl, fail. inventory.
frapontillo/adventure-in-prolog
src/rules-items.pl
Perl
apache-2.0
1,844