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 |
|---|---|---|---|---|---|
=pod
=head1 NAME
ERR_get_error, ERR_peek_error, ERR_peek_last_error,
ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line,
ERR_get_error_line_data, ERR_peek_error_line_data,
ERR_peek_last_error_line_data - obtain error code and data
=head1 SYNOPSIS
#include <openssl/err.h>
unsigned long ERR_get_error(void);
unsigned long ERR_peek_error(void);
unsigned long ERR_peek_last_error(void);
unsigned long ERR_get_error_line(const char **file, int *line);
unsigned long ERR_peek_error_line(const char **file, int *line);
unsigned long ERR_peek_last_error_line(const char **file, int *line);
unsigned long ERR_get_error_line_data(const char **file, int *line,
const char **data, int *flags);
unsigned long ERR_peek_error_line_data(const char **file, int *line,
const char **data, int *flags);
unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
const char **data, int *flags);
=head1 DESCRIPTION
ERR_get_error() returns the earliest error code from the thread's error
queue and removes the entry. This function can be called repeatedly
until there are no more error codes to return.
ERR_peek_error() returns the earliest error code from the thread's
error queue without modifying it.
ERR_peek_last_error() returns the latest error code from the thread's
error queue without modifying it.
See L<ERR_GET_LIB(3)> for obtaining information about
location and reason of the error, and
L<ERR_error_string(3)> for human-readable error
messages.
ERR_get_error_line(), ERR_peek_error_line() and
ERR_peek_last_error_line() are the same as the above, but they
additionally store the file name and line number where
the error occurred in *B<file> and *B<line>, unless these are B<NULL>.
ERR_get_error_line_data(), ERR_peek_error_line_data() and
ERR_peek_last_error_line_data() store additional data and flags
associated with the error code in *B<data>
and *B<flags>, unless these are B<NULL>. *B<data> contains a string
if *B<flags>&B<ERR_TXT_STRING> is true.
An application B<MUST NOT> free the *B<data> pointer (or any other pointers
returned by these functions) with OPENSSL_free() as freeing is handled
automatically by the error library.
=head1 RETURN VALUES
The error code, or 0 if there is no error in the queue.
=head1 SEE ALSO
L<err(3)>, L<ERR_error_string(3)>,
L<ERR_GET_LIB(3)>
=head1 HISTORY
ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and
ERR_peek_error_line() are available in all versions of SSLeay and
OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data()
were added in SSLeay 0.9.0.
ERR_peek_last_error(), ERR_peek_last_error_line() and
ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7.
=cut
| vbloodv/blood | extern/openssl.orig/doc/crypto/ERR_get_error.pod | Perl | mit | 2,719 |
#!/usr/bin/perl -w
use strict;
my $usage = "perl $0 ehotspot1 ehotspot2 output-interaction";
my $hotspot_file1 = shift || die $usage;
my $hotspot_file2 = shift || die $usage;
my $output = shift || die $usage;
open (IN1, $hotspot_file1)|| die "Cannot open file $hotspot_file1";
open (IN2, $hotspot_file2)|| die "Cannot open file $hotspot_file2";
open (OUT, ">>$output")||die "Cannot open file $output";
my %readhash;
while (my $line = <IN1>){
chomp $line;
my ($chr, $start, $end, $inter, $reads) = split (/\t/,$line);
my $hotspot = $chr.":".$start."-".$end."\t".$reads;
my @inter_arry = split (/;|,/,$inter);# \; for old version of bedtools merge, \, for newer version
foreach my $int_read (@inter_arry){
if (!exists $readhash{$int_read}){
$readhash{$int_read} = $hotspot;
}else { # exists interachs, means matched interaction on the same chromosome, no need to record
delete $readhash{$int_read};
}
}
}
close(IN1);
my %interhash;
while (my $line = <IN2>){
chomp $line;
my ($chr, $start, $end, $inter, $reads) = split (/\t/,$line);
my $hotspot = $chr.":".$start."-".$end."\t".$reads;
my @inter_arry = split (/;|,/,$inter);# \; for old version of bedtools merge, \, for newer version
foreach my $int_read (@inter_arry){
if(exists $readhash{$int_read}){
my $hotspot1 = $readhash{$int_read};
my $hotspot2 = $hotspot;
push @{$interhash{$hotspot1."\t".$hotspot2}}, $int_read;
}
}
}
close(IN2);
foreach my $interaction ( keys %interhash ) {
my ($hotspot1,$read1,$hotspot2,$read2) = split ("\t",$interaction);
print OUT "$hotspot1\t$hotspot2\t".scalar(@{ $interhash{$interaction} })."\t$read1\t$read2\n";
}
close(OUT);
| yihchii/hippie | cmd/ETScript/interaction_interChrm.pl | Perl | mit | 1,680 |
=head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016] 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>.
=head1 AUTHOR
Juguang Xiao <juguang@tll.org.sg>
=cut
=head1 NAME
Bio::EnsEMBL::Utils::Converter, a converter factory
=head1 SYNOPSIS
my $converter = Bio::EnsEMBL::Utils::Converter->new(
-in => 'Bio::SeqFeature::Generic',
-out => 'Bio::EnsEMBL::SimpleFeature'
);
my ( $fearture1, $feature2 );
my $ens_simple_features =
$converter->convert( [ $feature1, $feature2 ] );
my @ens_simple_features = @{$ens_simple_features};
=head1 DESCRIPTION
Module to converter the business objects between EnsEMBL and any other
projects, currently BioPerl.
What the ready conversions are,
Bio::SeqFeature::Generic <-> Bio::EnsEMBL::SeqFeature, Bio::EnsEMBL::SimpleFeature
Bio::SeqFeature::FeaturePair <-> Bio::EnsEMBL::SeqFeature, Bio::EnsEMBL::RepeatFeature
Bio::Search::HSP::GenericHSP -> Bio::EnsEMBL::BaseAlignFeature's submodules
Bio::Tools::Prediction::Gene -> Bio::EnsEMBL::PredictionTranscript
Bio::Tools::Prediction::Exon -> Bio::EnsEMBL::Exon
Bio::Pipeline::Analysis -> Bio::EnsEMBL::Analysis
=head1 METHODS
=cut
package Bio::EnsEMBL::Utils::Converter;
use strict;
=head2 new
Title : new
Usage :
my $converter = Bio::EnsEMBL::Utils::Converter->new(
-in => 'Bio::SeqFeature::Generic',
-out => 'Bio::EnsEMBL::SimpleFeature'
);
Function: constructor for converter object
Returns : L<Bio::EnsEMBL::Utils::Converter>
Args :
in - the module name of the input.
out - the module name of the output.
analysis - a Bio::EnsEMBL::Analysis object, if converting other objects to EnsEMBL features.
contig - a Bio::EnsEMBL::RawContig object, if converting other objects to EnsEMBL features.
=cut
sub new {
my ($caller, @args) = @_;
my $class = ref($caller) || $caller;
if($class =~ /Bio::EnsEMBL::Utils::Converter::(\S+)/){
my $self = $class->SUPER::new(@args);
$self->_initialize(@args);
return $self;
}else{
my %params = @args;
@params{map {lc $_} keys %params} = values %params;
my $module = $class->_guess_module($params{-in}, $params{-out});
return undef unless($class->_load_module($module));
return "$module"->new(@args);
}
}
# This would be invoked by sub-module's _initialize.
sub _initialize {
my ($self, @args) = @_;
my ($in, $out) = $self->_rearrange([qw(IN OUT)], @args);
$self->in($in);
$self->out($out);
}
=head2 _guess_module
Usage : $module = $class->_guess_module(
'Bio::EnsEMBL::SimpleFeature',
'Bio::EnsEMBL::Generic'
);
=cut
sub _guess_module {
my ($self, $in, $out) = @_;
if($in =~ /^Bio::EnsEMBL::(\S+)/ and $out =~ /^Bio::EnsEMBL::(\S+)/){
$self->throw("Cannot convert between EnsEMBL objects.\n[$in] to [$out]");
}elsif($in =~ /^Bio::EnsEMBL::(\S+)/){
return 'Bio::EnsEMBL::Utils::Converter::ens_bio';
}elsif($out =~ /^Bio::EnsEMBL::(\S+)/){
return 'Bio::EnsEMBL::Utils::Converter::bio_ens';
}else{
$self->throw("Cannot convert between non-EnsEMBL objects.\n[$in] to [$out]");
}
}
=head2 convert
Title : convert
Usage : my $array_ref = $converter->convert(\@input);
Function: does the actual conversion
Returns : an array ref of converted objects
Args : an array ref of converting objects
=cut
sub convert{
my ($self, $input) = @_;
$input || $self->throw("Need a ref of array of input objects to convert");
my $output_module = $self->out;
$self->throw("Cannot load [$output_module] perl module")
unless $self->_load_module($output_module);
unless(ref($input) eq 'ARRAY'){
$self->warn("The input is supposed to be an array ref");
return $self->_convert_single($input);
}
my @output = ();
foreach(@{$input}){
push(@output, $self->_convert_single($_));
}
return \@output;
}
sub _convert_single{
shift->throw("Not implemented. Please check the instance subclass");
}
foreach my $field (qw(in out)){
my $slot=__PACKAGE__ ."::$field";
no strict 'refs'; ## no critic
*$field=sub{
my $self=shift;
$self->{$slot}=shift if @_;
return $self->{$slot};
};
}
=head2 _load_module
This method is copied from Bio::Root::Root
=cut
sub _load_module {
my ($self, $name) = @_;
my ($module, $load, $m);
$module = "_<$name.pm";
return 1 if $main::{$module};
# untaint operation for safe web-based running (modified after a fix
# a fix by Lincoln) HL
if ($name !~ /^([\w:]+)$/) {
$self->throw("$name is an illegal perl package name");
}
$load = "$name.pm";
my $io = Bio::Root::IO->new();
# catfile comes from IO
$load = $io->catfile((split(/::/,$load)));
eval {
require $load;
};
if ( $@ ) {
$self->throw("Failed to load module $name. ".$@);
}
return 1;
}
1;
| danstaines/ensembl | modules/Bio/EnsEMBL/Utils/Converter.pm | Perl | apache-2.0 | 5,888 |
#
# 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::hp::eva::cli::mode::components::iomodule;
use strict;
use warnings;
sub load {
my ($self) = @_;
$self->{ssu_commands}->{'ls diskshelf full xml'} = 1;
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking IO modules");
$self->{components}->{iomodule} = {name => 'io modules', total => 0, skip => 0};
return if ($self->check_filter(section => 'iomodule'));
# <object>
# <objecttype>diskshelf</objecttype>
# <objectname>\Hardware\Rack 1\Disk Enclosure 3</objectname>
# <iocomm>
# <iomodules>
# <module>
# <name>modulea</name>
# <operationalstate>good</operationalstate>
foreach my $object (@{$self->{xml_result}->{object}}) {
next if ($object->{objecttype} ne 'diskshelf');
$object->{objectname} =~ s/\\/\//g;
foreach my $result (@{$object->{iocomm}->{iomodules}->{module}}) {
next if ($result->{name} eq '');
my $instance = $object->{objectname} . '/' . $result->{name};
next if ($self->check_filter(section => 'iomodule', instance => $instance));
$self->{components}->{iomodule}->{total}++;
$self->{output}->output_add(long_msg => sprintf("IO module '%s' status is '%s' [instance = %s]",
$instance, $object->{operationalstate}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'iomodule', value => $object->{operationalstate});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("IO module '%s' status is '%s'", $instance, $object->{operationalstate}));
}
}
}
}
1;
| Tpo76/centreon-plugins | storage/hp/eva/cli/mode/components/iomodule.pm | Perl | apache-2.0 | 2,747 |
# Cared for by Ensembl
#
# Copyright GRL & EBI
#
# You may distribute this module under the same terms as perl itself
#
# POD documentation - main docs before the code
=pod
=head1 NAME
Bio::EnsEMBL::Compara::Production::GenomicAlignBlock::AlignmentChains
=head1 SYNOPSIS
my $db = Bio::EnsEMBL::DBAdaptor->new($locator);
my $genscan = Bio::EnsEMBL::Compara::Production::GenomicAlignBlock::AlignmentChains->new (
-db => $db,
-input_id => $input_id
-analysis => $analysis );
$genscan->fetch_input();
$genscan->run();
$genscan->write_output(); #writes to DB
=head1 DESCRIPTION
Given an compara MethodLinkSpeciesSet identifer, and a reference genomic
slice identifer, fetches the GenomicAlignBlocks from the given compara
database, forms them into sets of alignment chains, and writes the result
back to the database.
This module (at least for now) relies heavily on Jim Kent\'s Axt tools.
=cut
package Bio::EnsEMBL::Compara::Production::GenomicAlignBlock::AlignmentChains;
use strict;
use Bio::EnsEMBL::Compara::Production::GenomicAlignBlock::AlignmentProcessing;
use Bio::EnsEMBL::Analysis::Runnable::AlignmentChains;
use Bio::EnsEMBL::Compara::MethodLinkSpeciesSet;
use Bio::EnsEMBL::DnaDnaAlignFeature;
our @ISA = qw(Bio::EnsEMBL::Compara::Production::GenomicAlignBlock::AlignmentProcessing);
my $WORKDIR; # global variable holding the path to the working directory where output will be written
#my $BIN_DIR = "/usr/local/ensembl/bin";
#use newer version
my $BIN_DIR = "/software/ensembl/compara/bin";
############################################################
sub get_params {
my $self = shift;
my $param_string = shift;
return unless($param_string);
#print("parsing parameter string : ",$param_string,"\n");
my $params = eval($param_string);
return unless($params);
$self->SUPER::get_params($param_string);
if(defined($params->{'qyDnaFragID'})) {
my $dnafrag = $self->compara_dba->get_DnaFragAdaptor->fetch_by_dbID($params->{'qyDnaFragID'});
$self->query_dnafrag($dnafrag);
}
if(defined($params->{'tgDnaFragID'})) {
my $dnafrag = $self->compara_dba->get_DnaFragAdaptor->fetch_by_dbID($params->{'tgDnaFragID'});
$self->target_dnafrag($dnafrag);
}
if(defined($params->{'query_nib_dir'})) {
$self->QUERY_NIB_DIR($params->{'query_nib_dir'});
}
if(defined($params->{'target_nib_dir'})) {
$self->TARGET_NIB_DIR($params->{'target_nib_dir'});
}
if(defined($params->{'bin_dir'})) {
$self->BIN_DIR($params->{'bin_dir'});
}
if(defined($params->{'linear_gap'})) {
$self->linear_gap($params->{'linear_gap'});
}
return 1;
}
=head2 fetch_input
Title : fetch_input
Usage : $self->fetch_input
Returns : nothing
Args : none
=cut
sub fetch_input {
my( $self) = @_;
$self->SUPER::fetch_input;
$self->compara_dba->dbc->disconnect_when_inactive(0);
my $mlssa = $self->compara_dba->get_MethodLinkSpeciesSetAdaptor;
my $dafa = $self->compara_dba->get_DnaAlignFeatureAdaptor;
my $gaba = $self->compara_dba->get_GenomicAlignBlockAdaptor;
$gaba->lazy_loading(0);
$self->get_params($self->analysis->parameters);
$self->get_params($self->input_id);
my $qy_gdb = $self->query_dnafrag->genome_db;
my $tg_gdb = $self->target_dnafrag->genome_db;
################################################################
# get the compara data: MethodLinkSpeciesSet, reference DnaFrag,
# and all GenomicAlignBlocks
################################################################
print "mlss: ",$self->INPUT_METHOD_LINK_TYPE," ",$qy_gdb->dbID," ",$tg_gdb->dbID,"\n";
my $mlss;
if ($qy_gdb->dbID == $tg_gdb->dbID) {
$mlss = $mlssa->fetch_by_method_link_type_GenomeDBs($self->INPUT_METHOD_LINK_TYPE,
[$qy_gdb]);
} else {
$mlss = $mlssa->fetch_by_method_link_type_GenomeDBs($self->INPUT_METHOD_LINK_TYPE,
[$qy_gdb,
$tg_gdb]);
}
throw("No MethodLinkSpeciesSet for :\n" .
$self->INPUT_METHOD_LINK_TYPE . "\n" .
$qy_gdb->dbID . "\n" .
$tg_gdb->dbID)
if not $mlss;
my $out_mlss = new Bio::EnsEMBL::Compara::MethodLinkSpeciesSet;
$out_mlss->method_link_type($self->OUTPUT_METHOD_LINK_TYPE);
if ($qy_gdb->dbID == $tg_gdb->dbID) {
$out_mlss->species_set([$qy_gdb]);
} else {
$out_mlss->species_set([$qy_gdb, $tg_gdb]);
}
$mlssa->store($out_mlss);
######## needed for output####################
$self->output_MethodLinkSpeciesSet($out_mlss);
my $query_slice = $self->query_dnafrag->slice;
my $target_slice = $self->target_dnafrag->slice;
print STDERR "Fetching all DnaDnaAlignFeatures by query and target...\n";
print STDERR "start fetching at time: ",scalar(localtime),"\n";
if ($self->input_job->retry_count > 0) {
print STDERR "Deleting alignments as it is a rerun\n";
$self->delete_alignments($out_mlss,$self->query_dnafrag,$self->target_dnafrag);
}
my $gabs = $gaba->fetch_all_by_MethodLinkSpeciesSet_DnaFrag_DnaFrag($mlss,$self->query_dnafrag,undef,undef,$self->target_dnafrag);
my $features;
while (my $gab = shift @{$gabs}) {
my ($qy_ga) = $gab->reference_genomic_align;
my ($tg_ga) = @{$gab->get_all_non_reference_genomic_aligns};
unless (defined $self->query_DnaFrag_hash->{$qy_ga->dnafrag->name}) {
######### needed for output ######################################
$self->query_DnaFrag_hash->{$qy_ga->dnafrag->name} = $qy_ga->dnafrag;
}
unless (defined $self->target_DnaFrag_hash->{$tg_ga->dnafrag->name}) {
######### needed for output #######################################
$self->target_DnaFrag_hash->{$tg_ga->dnafrag->name} = $tg_ga->dnafrag;
}
my $daf_cigar = $self->daf_cigar_from_compara_cigars($qy_ga->cigar_line,
$tg_ga->cigar_line);
if (defined $daf_cigar) {
my $daf = Bio::EnsEMBL::DnaDnaAlignFeature->new
(-seqname => $qy_ga->dnafrag->name,
-start => $qy_ga->dnafrag_start,
-end => $qy_ga->dnafrag_end,
-strand => $qy_ga->dnafrag_strand,
-hseqname => $tg_ga->dnafrag->name,
-hstart => $tg_ga->dnafrag_start,
-hend => $tg_ga->dnafrag_end,
-hstrand => $tg_ga->dnafrag_strand,
-cigar_string => $daf_cigar);
push @{$features}, $daf;
}
}
print STDERR scalar @{$features}," features at time: ",scalar(localtime),"\n";
$WORKDIR = "/tmp/worker.$$";
unless(defined($WORKDIR) and (-e $WORKDIR)) {
#create temp directory to hold fasta databases
mkdir($WORKDIR, 0777);
}
my %parameters = (-analysis => $self->analysis,
-query_slice => $query_slice,
-target_slices => {$self->target_dnafrag->name => $target_slice},
#-query_nib_dir => $query_slice->length > $DEFAULT_DUMP_MIN_SIZE ? $self->QUERY_NIB_DIR : undef,
#-target_nib_dir => $target_slice->length > $DEFAULT_DUMP_MIN_SIZE ? $self->TARGET_NIB_DIR : undef,
-query_nib_dir => undef,
-target_nib_dir => undef,
-features => $features,
-workdir => $WORKDIR,
-linear_gap => $self->linear_gap);
if ($self->QUERY_NIB_DIR and
-d $self->QUERY_NIB_DIR and
-e $self->QUERY_NIB_DIR . "/" . $query_slice->seq_region_name . ".nib") {
$parameters{-query_nib_dir} = $self->QUERY_NIB_DIR;
}
if ($self->TARGET_NIB_DIR and
-d $self->TARGET_NIB_DIR and
-e $self->TARGET_NIB_DIR . "/" . $target_slice->seq_region_name . ".nib") {
$parameters{-target_nib_dir} = $self->TARGET_NIB_DIR;
}
foreach my $program (qw(faToNib lavToAxt axtChain)) {
$parameters{'-' . $program} = $self->BIN_DIR . "/" . $program;
}
my $runnable = Bio::EnsEMBL::Analysis::Runnable::AlignmentChains->new(%parameters);
$self->runnable($runnable);
}
sub write_output {
my $self = shift;
my $disconnect_when_inactive_default = $self->compara_dba->dbc->disconnect_when_inactive;
$self->compara_dba->dbc->disconnect_when_inactive(0);
$self->SUPER::write_output;
$self->compara_dba->dbc->disconnect_when_inactive($disconnect_when_inactive_default);
}
sub query_dnafrag {
my ($self, $dir) = @_;
if (defined $dir) {
$self->{_query_dnafrag} = $dir;
}
return $self->{_query_dnafrag};
}
sub target_dnafrag {
my ($self, $dir) = @_;
if (defined $dir) {
$self->{_target_dnafrag} = $dir;
}
return $self->{_target_dnafrag};
}
sub QUERY_NIB_DIR {
my ($self, $dir) = @_;
if (defined $dir) {
$self->{_query_nib_dir} = $dir;
}
return $self->{_query_nib_dir};
}
sub TARGET_NIB_DIR {
my ($self, $dir) = @_;
if (defined $dir) {
$self->{_target_nib_dir} = $dir;
}
return $self->{_target_nib_dir};
}
sub BIN_DIR {
my ($self, $val) = @_;
$self->{_bin_dir} = $val if defined $val;
return $self->{_bin_dir} || $BIN_DIR;
}
sub linear_gap {
my ($self, $dir) = @_;
if (defined $dir) {
$self->{_linear_gap} = $dir;
}
return $self->{_linear_gap};
}
1;
| adamsardar/perl-libs-custom | EnsemblAPI/ensembl-compara/modules/Bio/EnsEMBL/Compara/Production/GenomicAlignBlock/AlignmentChains.pm | Perl | apache-2.0 | 9,499 |
#
# 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::buffalo::terastation::snmp::mode::components::iscsi;
use strict;
use warnings;
my %map_iscsi_status = (
1 => 'unknown', 1 => 'connected', 2 => 'standing-by',
);
my $mapping = {
nasISCSIName => { oid => '.1.3.6.1.4.1.5227.27.1.9.1.2' },
nasISCSIStatus => { oid => '.1.3.6.1.4.1.5227.27.1.9.1.3', map => \%map_iscsi_status }
};
my $nasISCSIEntry = '.1.3.6.1.4.1.5227.27.1.9.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $nasISCSIEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking iscsi");
$self->{components}->{iscsi} = { name => 'iscsi', total => 0, skip => 0 };
return if ($self->check_filter(section => 'iscsi'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $nasISCSIEntry }})) {
next if ($oid !~ /^$mapping->{nasISCSIStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $nasISCSIEntry }, instance => $instance);
next if ($self->check_filter(section => 'iscsi', instance => $instance, name => $result->{nasISCSIName}));
$self->{components}->{iscsi}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"iscsi '%s' status is '%s' [instance: %s].",
$result->{nasISCSIName}, $result->{nasISCSIStatus}, $instance
)
);
my $exit = $self->get_severity(section => 'iscsi', value => $result->{nasISCSIStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Iscsi '%s' status is '%s'",
$result->{nasISCSIName}, $result->{nasISCSIStatus}
)
);
}
}
}
1;
| centreon/centreon-plugins | storage/buffalo/terastation/snmp/mode/components/iscsi.pm | Perl | apache-2.0 | 2,724 |
#
# Copyright 2016 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 hardware::ups::standard::rfc1628::snmp::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (
'battery-status' => 'hardware::ups::standard::rfc1628::snmp::mode::batterystatus',
'input-lines' => 'hardware::ups::standard::rfc1628::snmp::mode::inputlines',
'output-lines' => 'hardware::ups::standard::rfc1628::snmp::mode::outputlines',
'output-source' => 'hardware::ups::standard::rfc1628::snmp::mode::outputsource',
'alarms' => 'hardware::ups::standard::rfc1628::snmp::mode::alarms',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check ups compatible RFC1628 in SNMP.
=cut
| golgoth31/centreon-plugins | hardware/ups/standard/rfc1628/snmp/plugin.pm | Perl | apache-2.0 | 1,796 |
#
# 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 apps::oracle::gg::local::mode::processes;
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('status: %s',
$self->{result_values}->{status}
);
}
sub prefix_process_output {
my ($self, %options) = @_;
return sprintf(
"Process '%s' ",
$options{instance_value}->{name}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'processes', type => 1, cb_prefix_output => 'prefix_process_output', message_multiple => 'All processes are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{processes} = [
{ label => 'status', type => 2, critical_default => '%{status} =~ /ABENDED/i', set => {
key_values => [ { name => 'status' }, { name => 'group' }, { name => 'type' }, { name => 'name' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'lag', nlabel => 'process.lag.seconds', set => {
key_values => [ { name => 'lag_secs' }, { name => 'lag_human' } ],
output_template => 'lag: %s',
output_use => 'lag_human',
perfdatas => [
{ template => '%s', min => 0, unit => 's', label_extra_instance => 1 }
]
}
},
{ label => 'time-checkpoint', nlabel => 'process.time.checkpoint.seconds', set => {
key_values => [ { name => 'time_secs' }, { name => 'time_human' } ],
output_template => 'time since checkpoint: %s',
output_use => 'time_human',
perfdatas => [
{ template => '%s', min => 0, unit => 's', label_extra_instance => 1 }
]
}
}
];
}
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' },
'filter-group:s' => { name => 'filter_group' },
'filter-type:s' => { name => 'filter_type' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = $options{custom}->execute_command(
commands => 'INFO ALL'
);
$self->{processes} = {};
while ($stdout =~ /^(MANAGER|EXTRACT|REPLICAT)\s+(\S+)(.*?)(?:\n|\Z)/msig) {
my ($type, $status, $data) = ($1, $2, $3);
if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
$type !~ /$self->{option_results}->{filter_type}/) {
$self->{output}->output_add(long_msg => "skipping process '" . $type . "': no matching filter.", debug => 1);
next;
}
if ($type eq 'MANAGER') {
$self->{processes}->{$type} = {
status => $status,
name => $type,
type => $type,
group => '-'
};
next;
}
next if ($data !~ /\s*(\S+)\s*(?:(\d+:\d+:\d+)\s+(\d+:\d+:\d+))?/);
my ($group, $lag, $time) = ($1, $2, $3);
my $name = $type . ':' . $group;
if (defined($self->{option_results}->{filter_group}) && $self->{option_results}->{filter_group} ne '' &&
$group !~ /$self->{option_results}->{filter_group}/) {
$self->{output}->output_add(long_msg => "skipping process '" . $group . "': no matching filter.", debug => 1);
next;
}
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 process '" . $group . "': no matching filter.", debug => 1);
next;
}
$self->{processes}->{$name} = {
status => $status,
name => $name,
type => $type,
group => $group
};
next if ($status eq 'STOPPED');
if (defined($lag)) {
my ($hour, $min, $sec) = split(/:/, $lag);
my $lag_secs = ($hour * 3600) + ($min * 60) + $sec;
$self->{processes}->{$name}->{lag_secs} = $lag_secs;
$self->{processes}->{$name}->{lag_human} = centreon::plugins::misc::change_seconds(value => $self->{processes}->{$name}->{lag_secs});
}
if (defined($time)) {
my ($hour, $min, $sec) = split(/:/, $time);
my $time_secs = ($hour * 3600) + ($min * 60) + $sec;
$self->{processes}->{$name}->{time_secs} = $time_secs;
$self->{processes}->{$name}->{time_human} = centreon::plugins::misc::change_seconds(value => $self->{processes}->{$name}->{time_secs});
}
}
}
1;
__END__
=head1 MODE
Check processes.
=over 8
=item B<--filter-name>
Filter processes by name (can be a regexp).
name is the following concatenation: type:group (eg.: EXTRACT:DB_test)
=item B<--filter-group>
Filter processes by group (can be a regexp).
=item B<--filter-type>
Filter processes by type (can be a regexp).
=item B<--unknown-status>
Set unknown threshold for status.
Can used special variables like: %{status}, %{name}, %{group}, %{type}
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{status}, %{name}, %{group}, %{type}
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} =~ /ABENDED/i').
Can used special variables like: %{status}, %{name}, %{group}, %{type}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'lag' (s), 'time-checkpoint' (s).
=back
=cut
| Tpo76/centreon-plugins | apps/oracle/gg/local/mode/processes.pm | Perl | apache-2.0 | 6,868 |
#
# 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 os::aix::local::mode::errpt;
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 => {
'error-type:s' => { name => 'error_type' },
'error-class:s' => { name => 'error_class' },
'error-id:s' => { name => 'error_id' },
'retention:s' => { name => 'retention' },
'timezone:s' => { name => 'timezone' },
'description' => { name => 'description' },
'filter-resource:s' => { name => 'filter_resource' },
'filter-id:s' => { name => 'filter_id' },
'exclude-id:s' => { name => 'exclude_id' },
'format-date' => { name => 'format_date' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{exclude_id}) && defined($self->{option_results}->{error_id})) {
$self->{output}->add_option_msg(short_msg => "Please use --error-id OR --exclude-id, these options are mutually exclusives");
$self->{output}->option_exit();
}
}
sub manage_selection {
my ($self, %options) = @_;
my $extra_options = '';
if (defined($self->{option_results}->{error_type})){
$extra_options .= ' -T '.$self->{option_results}->{error_type};
}
if (defined($self->{option_results}->{error_class})){
$extra_options .= ' -d '.$self->{option_results}->{error_class};
}
if (defined($self->{option_results}->{error_id}) && $self->{option_results}->{error_id} ne ''){
$extra_options.= ' -j '.$self->{option_results}->{error_id};
}
if (defined($self->{option_results}->{exclude_id}) && $self->{option_results}->{exclude_id} ne ''){
$extra_options.= ' -k ' . $self->{option_results}->{exclude_id};
}
if (defined($self->{option_results}->{retention}) && $self->{option_results}->{retention} ne ''){
my $retention = time() - $self->{option_results}->{retention};
if (defined($self->{option_results}->{timezone})){
$ENV{TZ} = $self->{option_results}->{timezone};
}
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($retention);
$year = $year - 100;
if (length($sec) == 1){
$sec = '0' . $sec;
}
if (length($min) == 1){
$min = '0' . $min;
}
if (length($hour) == 1){
$hour = '0' . $hour;
}
if (length($mday) == 1){
$mday = '0' . $mday;
}
$mon = $mon + 1;
if (length($mon) == 1){
$mon = '0' . $mon;
}
$retention = $mon . $mday . $hour . $min . $year;
$extra_options .= ' -s '.$retention;
}
my ($stdout) = $options{custom}->execute_command(
command => 'errpt',
command_options => $extra_options
);
my $results = {};
my @lines = split /\n/, $stdout;
# Header not needed
shift @lines;
foreach my $line (@lines) {
next if ($line !~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)/);
my ($identifier, $timestamp, $resource_name, $description) = ($1, $2, $5, $6);
$results->{ $timestamp . '~' . $identifier . '~' . $resource_name } = { description => $description };
}
return $results;
}
sub run {
my ($self, %options) = @_;
my $extra_message = '';
if (defined($self->{option_results}->{retention})) {
$extra_message = ' since ' . $self->{option_results}->{retention} . ' seconds';
}
my $results = $self->manage_selection(custom => $options{custom});
$self->{output}->output_add(
severity => 'OK',
short_msg => sprintf("No error found%s.", $extra_message)
);
my $total_error = 0;
foreach my $errpt_error (sort(keys %$results)) {
my @split_error = split ('~', $errpt_error);
my $timestamp = $split_error[0];
my $identifier = $split_error[1];
my $resource_name = $split_error[2];
my $description = $results->{$errpt_error}->{description};
next if (defined($self->{option_results}->{filter_resource}) && $self->{option_results}->{filter_resource} ne '' &&
$resource_name !~ /$self->{option_results}->{filter_resource}/);
next if (defined($self->{option_results}->{filter_id}) && $self->{option_results}->{filter_id} ne '' &&
$identifier !~ /$self->{option_results}->{filter_id}/);
my $output_date = $split_error[0];
if (defined($self->{option_results}->{format_date})) {
my ($month, $day, $hour, $minute, $year) = unpack("(A2)*", $output_date);
$output_date = sprintf("20%s/%s/%s %s:%s", $year, $month, $day, $hour, $minute);
}
$total_error++;
if (defined($description)) {
$self->{output}->output_add(
long_msg => sprintf(
"Error '%s' Date: %s ResourceName: %s Description: %s",
$identifier,
$output_date,
$resource_name,
$description
)
);
} else {
$self->{output}->output_add(
long_msg => sprintf(
"Error '%s' Date: %s ResourceName: %s",
$identifier,
$output_date,
$resource_name
)
);
}
}
if ($total_error != 0) {
$self->{output}->output_add(
severity => 'critical',
short_msg => sprintf("%s error(s) found(s)%s", $total_error, $extra_message)
);
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check errpt messages.
Command used: 'errpt' with dynamic options
=over 8
=item B<--error-type>
Filter error type separated by a coma (INFO, PEND, PERF, PERM, TEMP, UNKN).
=item B<--error-class>
Filter error class ('H' for hardware, 'S' for software, '0' for errlogger, 'U' for undetermined).
=item B<--error-id>
Filter specific error code (can be a comma separated list).
=item B<--retention>
Retention time of errors in seconds.
=item B<--verbose>
Print error description in long output. [ Error 'CODE' Date: Timestamp ResourceName: RsrcName Description: Desc ]
=item B<--filter-resource>
Filter resource (can use a regexp).
=item B<--filter-id>
Filter error code (can use a regexp).
=item B<--exclude-id>
Filter on specific error code (can be a comma separated list).
=item B<--format-date>
Print the date to format 20YY/mm/dd HH:MM instead of mmddHHMMYY.
=back
=cut
| Tpo76/centreon-plugins | os/aix/local/mode/errpt.pm | Perl | apache-2.0 | 7,559 |
package Bio::EnsEMBL::Compara::RunnableDB::MemberDisplayLabelUpdater;
=pod
=head1 NAME
Bio::EnsEMBL::Compara::RunnableDB::MemberDisplayLabelUpdater
=head1 SYNOPSIS
Normally it is used as a RunnableDB however you can run it using the non-hive
methods:
my $u = Bio::EnsEMBL::Compara::RunnableDB::MemberDisplayLabelUpdater->new_without_hive(
-DB_ADAPTOR => $compara_dba,
-REPLACE => 0,
-DIE_IF_NO_CORE_ADAPTOR => 0,
-GENOME_DB_IDS => [90],
-DEBUG => 1
);
$u->run_without_hive();
This would run an updater on the GenomeDB ID 90 (Homo sapiens normally) not
dying if it cannot find a core DBAdaptor & printing debug messages to STDOUT.
By not specifying a GenomeDB ID you are asking to run this code over every
GenomeDB.
Using it in the hive manner expects the above values (lowercased) filled in
any of the fields Process can detect values in. The exception to
this is db_adaptor which is created from the current Hive DBAdaptor instance.
=head1 DESCRIPTION
When run in hive mode the module loops through all genome db ids given via
the parameter C<genome_db_ids> and attempts to update any gene/translation
with the display identifier from the core database.
When run in non-hive mode not specifying a set of genome db ids will cause
the code to work over all genome dbs with entries in the member table.
This code uses direct SQL statements because of the
relationship between translations and their display labels being stored at the
transcript level. If the DB changes this will break.
=head1 AUTHOR
Andy Yates
=head1 MAINTANER
$Author: ady $
=head1 VERSION
$Revision: 1.9 $
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
use strict;
use warnings;
use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Exception qw(throw);
use Bio::EnsEMBL::Utils::Scalar qw(assert_ref check_ref);
use Bio::EnsEMBL::Utils::SqlHelper;
use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');
#--- Non-hive methods
=head2 new_without_hive()
Arg [DB_ADAPTOR] : (DBAdaptor) Compara DBAdaptor to use
Arg [REPLACE] : (Boolean) Forces the code to replace display labels
Arg [DIE_IF_NO_CORE_ADAPTOR] : (Boolean) Kills the process if there is no core adaptor
Arg [GENOME_DB_IDS] : (ArrayRef) GenomeDB IDs to run this process over
Arg [DEBUG] : (Boolean) Force debug output to STDOUT
Example : See synopsis
Description: Non-hive version of the object construction to be used with scripts
Returntype : Bio::EnsEMBL::Compara::RunnableDB::MemberDisplayIdUpdater
Exceptions : if DB_ADAPTOR was not given and was not a valid object
Caller : general
=cut
sub new_without_hive {
my ($class, @params) = @_;
my $self = bless {}, $class;
#Put in so we can have access to $self->param()
my $job = Bio::EnsEMBL::Hive::AnalysisJob->new();
$self->input_job($job);
my ($db_adaptor, $replace, $die_if_no_core_adaptor, $genome_db_ids, $debug) =
rearrange(
[qw(db_adaptor replace die_if_no_core_adaptor genome_db_ids debug)],
@params
);
$self->compara_dba($db_adaptor);
$self->param('replace', $replace);
$self->param('die_if_no_core_adaptor', $die_if_no_core_adaptor);
$self->param('genome_db_ids', $genome_db_ids);
$self->debug($debug);
$self->_use_all_available_genomedbs() if ! check_ref($genome_db_ids, 'ARRAY');
$self->_assert_state();
return $self;
}
=head2 run_without_hive()
Performs the run() and write_output() calls in one method.
=cut
sub run_without_hive {
my ($self) = @_;
$self->run();
$self->write_output();
return;
}
#Set all IDs into the available ones to run over; only available through the
#non-hive interface
sub _use_all_available_genomedbs {
my ($self) = @_;
my $h = Bio::EnsEMBL::Utils::SqlHelper->new(-DB_CONNECTION => $self->compara_dba()->dbc());
my $sql = q{select distinct genome_db_id from member where genome_db_id is not null and genome_db_id <> 0};
my $ids = $h->execute_simple( -SQL => $sql);
$self->param('genome_db_ids', $ids);
return;
}
#--- Hive methods
=head2 fetch_input
Title : fetch_input
Usage : $self->fetch_input
Function: prepares global variables and DB connections
Returns : none
Args : none
=cut
sub fetch_input {
my ($self) = @_;
$self->_assert_state();
$self->_print_params();
return 1;
}
sub _print_params {
my ($self) = @_;
return unless $self->debug();
my @params = qw(replace die_if_no_core_adaptor);
foreach my $param (@params) {
my $value = $self->param($param);
print "$param : ".(defined $value ? $value : q{}), "\n";
}
print 'genome_db_ids: '.join(q{,}, @{$self->param('genome_db_ids')}), "\n";
return;
}
=head2 run
Title : run
Usage : $self->run
Function: Retrives the Members to update
Returns : none
Args : none
=cut
sub run {
my ($self) = @_;
my $genome_dbs = $self->_genome_dbs();
if($self->debug()) {
my $names = join(q{, }, map { $_->name() } @{$genome_dbs});
print "Working with: [${names}]\n";
}
my $results = $self->param('results', {});
foreach my $genome_db (@{$genome_dbs}) {
my $output = $self->_process_genome_db($genome_db);
$results->{$genome_db->dbID()} = $output;
}
return 1;
}
=head2 write_output
Title : write_output
Usage : $self->write_output
Function: Writes the display labels/members back to the Compara DB
Returns : none
Args : none
=cut
sub write_output {
my ($self) = @_;
my $genome_dbs = $self->_genome_dbs();
foreach my $genome_db (@{$genome_dbs}) {
$self->_update_display_labels($genome_db);
}
return 1;
}
#--- Generic Logic
sub _assert_state {
my ($self) = @_;
my $dba = $self->compara_dba();
throw('A suitable Compara DBAdaptor was not found') unless defined $dba;
assert_ref($dba, 'Bio::EnsEMBL::Compara::DBSQL::DBAdaptor');
#Checking we have some genome dbs to work on
my $genome_db_ids = $self->param('genome_db_ids');
throw 'GenomeDB IDs array was not defined' if(! defined $genome_db_ids);
assert_ref($genome_db_ids, 'ARRAY');
throw 'GenomeDB IDs array was empty' if(! @{$genome_db_ids});
return;
}
sub _genome_dbs {
my ($self) = @_;
my $ids = $self->param('genome_db_ids');
my $gdba = $self->compara_dba()->get_GenomeDBAdaptor();
return [ map { $gdba->fetch_by_dbID($_) } @{$ids} ];
}
sub _process_genome_db {
my ($self, $genome_db) = @_;
my $name = $genome_db->name();
my $replace = $self->param('replace');
print "Processing ${name}\n" if $self->debug();
if(!$genome_db->db_adaptor()) {
throw('Cannot get an adaptor for GenomeDB '.$name) if $self->param('die_if_no_core_adaptor');
return;
}
my @members_to_update;
my @sources = qw(ENSEMBLGENE ENSEMBLPEP);
foreach my $source_name (@sources) {
print "Working with ${source_name}\n" if $self->debug();
if(!$self->_need_to_process_genome_db_source($genome_db, $source_name) && !$replace) {
if($self->debug()) {
print "No need to update as all members for ${name} and source ${source_name} have display labels\n";
}
next;
}
my $results = $self->_process($genome_db, $source_name);
push(@members_to_update, @{$results});
}
return \@members_to_update;
}
sub _process {
my ($self, $genome_db, $source_name) = @_;
my @members_to_update;
my $replace = $self->param('replace');
my $core_labels = $self->_get_display_label_lookup($genome_db, $source_name);
my $members = $self->_get_members_by_source($genome_db, $source_name);
if(%{$members}) {
foreach my $stable_id (keys %{$members}) {
my $member = $members->{$stable_id};
#Skip if it's already got a label & we are not replacing things
next if defined $member->display_label() && !$replace;
my $display_label = $core_labels->{$stable_id};
#Next if there was no core object for the stable ID
next if ! defined $display_label;
$member->display_label($display_label);
push(@members_to_update, $member);
}
}
else {
my $name = $genome_db->name();
print "No members found for ${name} and ${source_name}\n" if $self->debug();
}
return \@members_to_update;
}
sub _need_to_process_genome_db_source {
my ($self, $genome_db, $source_name) = @_;
my $h = Bio::EnsEMBL::Utils::SqlHelper->new(-DB_CONNECTION => $self->compara_dba()->dbc());
my $sql = q{select count(*) from member
where genome_db_id =? and display_label is null and source_name =?};
my $params = [$genome_db->dbID(), $source_name];
return $h->execute_single_result( -SQL => $sql, -PARAMS => $params);
}
sub _get_members_by_source {
my ($self, $genome_db, $source_name) = @_;
my $member_a = $self->compara_dba()->get_MemberAdaptor();
my $gdb_id = $genome_db->dbID();
my $constraint = qq(m.source_name = '${source_name}' and m.genome_db_id = ${gdb_id});
my $members = $member_a->_generic_fetch($constraint);
my $members_hash = {};
foreach my $member (@{$members}) {
$members_hash->{$member->stable_id()} = $member;
}
return $members_hash;
}
sub _get_display_label_lookup {
my ($self, $genome_db, $source_name) = @_;
my $sql_lookup = {
'ENSEMBLGENE' => q{select gsi.stable_id, x.display_label
from gene_stable_id gsi
join gene g using (gene_id)
join xref x on (g.display_xref_id = x.xref_id)
join seq_region sr on (g.seq_region_id = sr.seq_region_id)
join coord_system cs using (coord_system_id)
where cs.species_id =?},
'ENSEMBLPEP' => q{select tsi.stable_id, x.display_label
from translation_stable_id tsi
join translation tr using (translation_id)
join transcript t using (transcript_id)
join xref x on (t.display_xref_id = x.xref_id)
join seq_region sr on (t.seq_region_id = sr.seq_region_id)
join coord_system cs using (coord_system_id)
where cs.species_id =?}
};
my $dba = $genome_db->db_adaptor();
my $h = Bio::EnsEMBL::Utils::SqlHelper->new(-DB_CONNECTION => $dba->dbc());
my $sql = $sql_lookup->{$source_name};
my $params = [$dba->species_id()];
my $hash = $h->execute_into_hash( -SQL => $sql, -PARAMS => $params );
return $hash;
}
sub _update_display_labels {
my ($self, $genome_db) = @_;
my $name = $genome_db->name();
my $members = $self->param('results')->{$genome_db->dbID()};
if(! defined $members || scalar(@{$members}) == 0) {
print "No members to write back for ${name}\n" if $self->debug();
return;
}
print "Writing members out for ${name}\n" if $self->debug();
my $total = 0;
my $h = Bio::EnsEMBL::Utils::SqlHelper->new(-DB_CONNECTION => $self->compara_dba()->dbc());
$h->transaction( -CALLBACK => sub {
my $sql = 'update member set display_label =? where member_id =?';
$h->batch(
-SQL => $sql,
-CALLBACK => sub {
my ($sth) = @_;
foreach my $member (@{$members}) {
my $updated = $sth->execute($member->display_label(), $member->dbID());
$total += $updated;
}
return;
}
);
});
print "Inserted ${total} member(s) for ${name}\n" if $self->debug();
return $total;
}
1;
| adamsardar/perl-libs-custom | EnsemblAPI/ensembl-compara/modules/Bio/EnsEMBL/Compara/RunnableDB/MemberDisplayLabelUpdater.pm | Perl | apache-2.0 | 11,231 |
package Google::Ads::AdWords::v201809::FeedItemService::queryResponse;
use strict;
use warnings;
{ # BLOCK to scope variables
sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201809' }
__PACKAGE__->__set_name('queryResponse');
__PACKAGE__->__set_nillable();
__PACKAGE__->__set_minOccurs();
__PACKAGE__->__set_maxOccurs();
__PACKAGE__->__set_ref();
use base qw(
SOAP::WSDL::XSD::Typelib::Element
Google::Ads::SOAP::Typelib::ComplexType
);
our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;
sub __get_attr_class {
return $XML_ATTRIBUTE_CLASS;
}
use Class::Std::Fast::Storable constructor => 'none';
use base qw(Google::Ads::SOAP::Typelib::ComplexType);
{ # BLOCK to scope variables
my %rval_of :ATTR(:get<rval>);
__PACKAGE__->_factory(
[ qw( rval
) ],
{
'rval' => \%rval_of,
},
{
'rval' => 'Google::Ads::AdWords::v201809::FeedItemPage',
},
{
'rval' => 'rval',
}
);
} # end BLOCK
} # end of BLOCK
1;
=pod
=head1 NAME
Google::Ads::AdWords::v201809::FeedItemService::queryResponse
=head1 DESCRIPTION
Perl data type class for the XML Schema defined element
queryResponse from the namespace https://adwords.google.com/api/adwords/cm/v201809.
=head1 PROPERTIES
The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:
=over
=item * rval
$element->set_rval($data);
$element->get_rval();
=back
=head1 METHODS
=head2 new
my $element = Google::Ads::AdWords::v201809::FeedItemService::queryResponse->new($data);
Constructor. The following data structure may be passed to new():
{
rval => $a_reference_to, # see Google::Ads::AdWords::v201809::FeedItemPage
},
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
| googleads/googleads-perl-lib | lib/Google/Ads/AdWords/v201809/FeedItemService/queryResponse.pm | Perl | apache-2.0 | 1,768 |
package Paws::IAM::LoginProfile;
use Moose;
has CreateDate => (is => 'ro', isa => 'Str', required => 1);
has PasswordResetRequired => (is => 'ro', isa => 'Bool');
has UserName => (is => 'ro', isa => 'Str', required => 1);
1;
### main pod documentation begin ###
=head1 NAME
Paws::IAM::LoginProfile
=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::IAM::LoginProfile object:
$service_obj->Method(Att1 => { CreateDate => $value, ..., UserName => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::IAM::LoginProfile object:
$result = $service_obj->Method(...);
$result->Att1->CreateDate
=head1 DESCRIPTION
Contains the user name and password create date for a user.
This data type is used as a response element in the CreateLoginProfile
and GetLoginProfile actions.
=head1 ATTRIBUTES
=head2 B<REQUIRED> CreateDate => Str
The date when the password for the user was created.
=head2 PasswordResetRequired => Bool
Specifies whether the user is required to set a new password on next
sign-in.
=head2 B<REQUIRED> UserName => Str
The name of the user, which can be used for signing in to the AWS
Management Console.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::IAM>
=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/IAM/LoginProfile.pm | Perl | apache-2.0 | 1,788 |
# 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::V10::Services::ConversionUploadService::Item;
use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseEntity);
use Google::Ads::GoogleAds::Utils::GoogleAdsHelper;
sub new {
my ($class, $args) = @_;
my $self = {
productId => $args->{productId},
quantity => $args->{quantity},
unitPrice => $args->{unitPrice}};
# 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/V10/Services/ConversionUploadService/Item.pm | Perl | apache-2.0 | 1,116 |
=pod
=head1 NAME
openssl-crl,
crl - CRL utility
=head1 SYNOPSIS
B<openssl> B<crl>
[B<-help>]
[B<-inform PEM|DER>]
[B<-outform PEM|DER>]
[B<-text>]
[B<-in filename>]
[B<-out filename>]
[B<-nameopt option>]
[B<-noout>]
[B<-hash>]
[B<-issuer>]
[B<-lastupdate>]
[B<-nextupdate>]
[B<-CAfile file>]
[B<-CApath dir>]
=head1 DESCRIPTION
The B<crl> command processes CRL files in DER or PEM format.
=head1 OPTIONS
=over 4
=item B<-help>
Print out a usage message.
=item B<-inform DER|PEM>
This specifies the input format. B<DER> format is DER encoded CRL
structure. B<PEM> (the default) is a base64 encoded version of
the DER form with header and footer lines.
=item B<-outform DER|PEM>
This specifies the output format, the options have the same meaning as the
B<-inform> option.
=item B<-in filename>
This specifies the input filename to read from or standard input if this
option is not specified.
=item B<-out filename>
specifies the output filename to write to or standard output by
default.
=item B<-text>
print out the CRL in text form.
=item B<-nameopt option>
option which determines how the subject or issuer names are displayed. See
the description of B<-nameopt> in L<x509(1)>.
=item B<-noout>
don't output the encoded version of the CRL.
=item B<-hash>
output a hash of the issuer name. This can be use to lookup CRLs in
a directory by issuer name.
=item B<-hash_old>
outputs the "hash" of the CRL issuer name using the older algorithm
as used by OpenSSL versions before 1.0.0.
=item B<-issuer>
output the issuer name.
=item B<-lastupdate>
output the lastUpdate field.
=item B<-nextupdate>
output the nextUpdate field.
=item B<-CAfile file>
verify the signature on a CRL by looking up the issuing certificate in
B<file>
=item B<-CApath dir>
verify the signature on a CRL by looking up the issuing certificate in
B<dir>. This directory must be a standard certificate directory: that
is a hash of each subject name (using B<x509 -hash>) should be linked
to each certificate.
=back
=head1 NOTES
The PEM CRL format uses the header and footer lines:
-----BEGIN X509 CRL-----
-----END X509 CRL-----
=head1 EXAMPLES
Convert a CRL file from PEM to DER:
openssl crl -in crl.pem -outform DER -out crl.der
Output the text form of a DER encoded certificate:
openssl crl -in crl.der -inform DER -text -noout
=head1 BUGS
Ideally it should be possible to create a CRL using appropriate options
and files too.
=head1 SEE ALSO
L<crl2pkcs7(1)>, L<ca(1)>, L<x509(1)>
=head1 COPYRIGHT
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the OpenSSL license (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
| google/google-ctf | third_party/edk2/CryptoPkg/Library/OpensslLib/openssl/doc/apps/crl.pod | Perl | apache-2.0 | 2,845 |
package Paws::Firehose::KinesisStreamSourceDescription;
use Moose;
has DeliveryStartTimestamp => (is => 'ro', isa => 'Str');
has KinesisStreamARN => (is => 'ro', isa => 'Str');
has RoleARN => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Firehose::KinesisStreamSourceDescription
=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::Firehose::KinesisStreamSourceDescription object:
$service_obj->Method(Att1 => { DeliveryStartTimestamp => $value, ..., RoleARN => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::Firehose::KinesisStreamSourceDescription object:
$result = $service_obj->Method(...);
$result->Att1->DeliveryStartTimestamp
=head1 DESCRIPTION
Details about a Kinesis stream used as the source for a Kinesis
Firehose delivery stream.
=head1 ATTRIBUTES
=head2 DeliveryStartTimestamp => Str
Kinesis Firehose starts retrieving records from the Kinesis stream
starting with this time stamp.
=head2 KinesisStreamARN => Str
The ARN of the source Kinesis stream.
=head2 RoleARN => Str
The ARN of the role used by the source Kinesis stream.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::Firehose>
=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/Firehose/KinesisStreamSourceDescription.pm | Perl | apache-2.0 | 1,767 |
package Paws::CodeDeploy::ListApplications;
use Moose;
has NextToken => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'nextToken' );
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'ListApplications');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::CodeDeploy::ListApplicationsOutput');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::CodeDeploy::ListApplications - Arguments for method ListApplications on Paws::CodeDeploy
=head1 DESCRIPTION
This class represents the parameters used for calling the method ListApplications on the
AWS CodeDeploy service. Use the attributes of this class
as arguments to method ListApplications.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to ListApplications.
As an example:
$service_obj->ListApplications(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 NextToken => Str
An identifier returned from the previous list applications call. It can
be used to return the next set of applications in the list.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method ListApplications in L<Paws::CodeDeploy>
=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/CodeDeploy/ListApplications.pm | Perl | apache-2.0 | 1,753 |
#!/usr/bin/perl -w
#================================================================
# (C) 2013-2014 Dena Group Holding Limited.
#
# This program is used to operate the process of
# login & web server.
# Please check the options before using.
#
# Authors:
# Edison Chow <zhou.liyang@dena.jp>
#================================================================
use warnings;
use strict;
use Net::OpenSSH;
use Getopt::Long;
my @host;
my $service;
my $operate;
my %opt;
my $type;
my @world;
my $port;
my $all;
GetOptions(\%opt,
'h|help',
't|type=s',
'a|all=s',
's|service=s',
'o|operate=s',
'p|port=i',
'world=s{,}' => \@world,
'host=s{,}' => \@host
) or &print_usage();
if (!scalar(%opt) && !scalar(@host))
{
&print_usage();
}
$opt{'h'} and &print_usage();
$opt{'t'} and $type=$opt{'t'};
$opt{'p'} and $port=$opt{'p'};
$opt{'s'} and $service=$opt{'s'};
$opt{'o'} and $operate=$opt{'o'};
$opt{'a'} and $all=$opt{'a'};
sub print_usage()
{
printf <<EOF;
#================================================================
# (C) 2013-2014 Dena Group Holding Limited.
#
# This program is used to operate the process of
# login & web server.
# Please check the options before using.
#
# Authors:
# Edison Chow <zhou.liyang\@dena.jp>
#================================================================
=================================================================
-h,--help Print Help Info.
-s,--service The service you wanna choose.
-w,--world The World.
-t,--type The Type.
-p,--port The port.
-a,--all Whether the operations of web server choose all the hosts all not.(yes or no)
Only for type=web
-o,--operate The Operate you wanna do.
--host The Host.You can input one or more host.
Sample :
For GS:
shell > ./nba.pl -s gs -w 1 -t web -o start -a no
For CA:
shell > ./nba.pl -s ca -w 1 -t web -o start -a no
Foe DKS
shell > ./nba.pl -s dks -w 1 -t web -o start -a no
For Login
shell > ./nba.pl --host nba2015_login1 nba2015_login2 -t login -p 8200 -o start
=================================================================
EOF
exit;
}
#================================================================
# Function total
#================================================================
sub total()
{
my $flag;
my $flag1;
my @tmp;
my $t1;
my $t2;
@tmp=@_;
my $host1 = $tmp[0];
$t1=$tmp[1];
$t2=$tmp[2];
my $t3=$tmp[3];
my $t4=$tmp[4];
my $t5=$tmp[5];
my $ssh = Net::OpenSSH->new($host1);
$ssh->error and warn "can not connect to $host1" . $ssh->error;
if($t4 =~ /^start$/)
{
if($t3 =~ /^gs$/)
{
print "$host1:"."\n";
for(my $i=0;$i<$t2;$i++){
my $pt=$t5+$i;
print "World: $t1"."\n";
print "Port: $pt"."\n";
$ssh->system("/sbin/initctl start gs_8600 PORT=$pt WORLD=$t1 TARGET=0");
}
}
elsif($t3 =~ /^ca$/)
{
print "$host1:"."\n";
$ssh->system("/sbin/initctl start calculation_8400") ;
}
elsif($t3 =~ /^dks$/)
{
print "$host1:"."\n";
$ssh->system("/sbin/initctl start dks") ;
}
else
{
print "please check the options"."\n";
}
}
elsif($t4 =~ /^stop$/)
{
if($t3 =~ /^gs$/)
{
print "$host1:"."\n";
for(my $i=0;$i<$t2;$i++){
my $pt=$t5+$i;
print "World: $t1"."\n";
print "Port: $pt"."\n";
$ssh->system("/sbin/initctl stop gs_8600 PORT=$pt WORLD=$t1 TARGET=0");
}
}
elsif($t3 =~ /^ca$/)
{
print "$host1:"."\n";
$ssh->system("/sbin/initctl stop calculation_8400") ;
}
elsif($t3 =~ /^dks$/)
{
print "$host1:"."\n";
$ssh->system("/sbin/initctl stop dks") ;
}
else
{
print "please check the options"."\n";
}
}
elsif($t4 =~ /^restart$/)
{
if($t3 =~ /^gs$/)
{
print "$host1:"."\n";
for(my $i=0;$i<$t2;$i++){
my $pt=$t5+$i;
print "World: $t1"."\n";
print "Port: $pt"."\n";
#$ssh->system("/sbin/initctl stop gs_8600 PORT=$pt WORLD=$t1 TARGET=0 && sleep 1 && /sbin/initctl start gs_8600 PORT=$pt WORLD=$t1 TARGET=0");
# $ssh->system("/sbin/initctl stop gs_8600 PORT=$pt WORLD=$t1 TARGET=0 ");
$ssh->system("ps -ef | grep game_node| grep -v grep | grep $pt| awk '{print \$2}'|xargs kill -9");
# $ssh->system("/sbin/initctl start gs_8600 PORT=$pt WORLD=$t1 TARGET=0");
}
$ssh->system("sleep 2");
}
elsif($t3 =~ /^ca$/)
{
print "$host1:"."\n";
# $ssh->system("/sbin/initctl stop calculation_8400 && sleep 1 && /sbin/initctl start calculation_8400") ;
$ssh->system("ps -ef | grep calculation| grep -v grep | grep usr| awk '{print \$2}'|xargs kill")
}
elsif($t3 =~ /^dks$/)
{
print "$host1:"."\n";
$ssh->system("ps -ef | grep dks_rival_node| grep -v grep | awk '{print \$2}'|xargs kill")
}
else
{
print "please check the options"."\n";
}
}
else
{
printf "please check the options"."\n";
}
}
sub login(){
my @tmp=@_;
my $host2 = $tmp[0];
my $t1 = $tmp[1];
my $t2 = $tmp[2];
my $ssh = Net::OpenSSH->new($host2);
$ssh->error and warn "can not connect to $host2" . $ssh->error;
if ($t2 == 8300)
{
if($t1 =~ /^start$/)
{ printf $host2.":"."\n";
for(my $j=8301;$j<8311;$j++){
$ssh->system("initctl start login_8300 PORT=$j TARGET=0") ;
}
}
elsif($t1 =~ /^stop$/)
{ printf $host2.":"."\n";
for(my $j=8301;$j<8311;$j++){
$ssh->system("initctl stop login_8300 PORT=$j TARGET=0") ;
}
}
elsif($t1 =~ /^restart$/)
{ printf $host2.":"."\n";
for(my $j=8301;$j<8311;$j++){
$ssh->system("initctl stop login_8300 PORT=$j TARGET=0 && initctl start login_8300 PORT=$j TARGET=0") ;
}
}
else
{
printf "please check the options"."\n";
}
}
elsif($t2==8200)
{
if($t1 =~ /^start$/)
{ printf $host2.":"."\n";
for(my $j=8201;$j<8211;$j++){
$ssh->system("initctl start login_8200 PORT=$j TARGET=0") ;
}
}
elsif($t1 =~ /^stop$/)
{ printf $host2.":"."\n";
for(my $j=8201;$j<8211;$j++){
$ssh->system("initctl stop login_8200 PORT=$j TARGET=0") ;
}
}
elsif($t1 =~ /^restart$/)
{ printf $host2.":"."\n";
for(my $j=8201;$j<8211;$j++){
# $ssh->system("initctl stop login_8200 PORT=$j TARGET=0 && sleep 1 && initctl start login_8200 PORT=$j TARGET=0") ;
$ssh->system("ps -ef | grep provision| grep 82|awk '{print \$2}' |xargs kill");
# $ssh->system("ps -ef | grep provision| grep 82");
}
}
else
{
printf "please check the options"."\n";
}
}
elsif($t2==8100)
{
if($t1 =~ /^start$/)
{ printf $host2.":"."\n";
$ssh->system("initctl start login_8100 PORT=8101 TARGET=3") ;
}
elsif($t1 =~ /^stop$/)
{ printf $host2.":"."\n";
$ssh->system("initctl stop login_8100 PORT=8101 TARGET=3") ;
}
elsif($t1 =~ /^restart$/)
{ printf $host2.":"."\n";
#$ssh->system("initctl stop login_8100 PORT=8101 TARGET=3 && initctl start login_8100 PORT=8101 TARGET=3") ;
$ssh->system("ps -ef | grep provision| grep 8100|awk '{print \$2}' |xargs kill") ;
$ssh->system("ps -ef | grep provision| grep 81");
}
else
{
printf "please check the options"."\n";
}
}
elsif($t2==8150)
{
if($t1 =~ /^start$/)
{ printf $host2.":"."\n";
$ssh->system("initctl start login_8150 PORT=8150 TARGET=3") ;
}
elsif($t1 =~ /^stop$/)
{ printf $host2.":"."\n";
$ssh->system("initctl stop login_8150 PORT=8150 TARGET=3") ;
}
elsif($t1 =~ /^restart$/)
{ printf $host2.":"."\n";
$ssh->system("initctl stop login_8150 PORT=8150 TARGET=3 && initctl start login_8150 PORT=8150 TARGET=3") ;
}
else
{
printf "please check the options"."\n";
}
}
}
#================================================================
# Function main
#================================================================
sub main()
{
if($type =~ /^web$/){
if($all =~ /^no$/){
for (my $i=0;$i<scalar(@world);$i++)
{
print "$world[$i] 区:"."\n";
my @hhh=`cat /nba/server/server_$world[$i]|grep -v "#" |cut -f 1`;
my @wd=`cat /nba/server/server_$world[$i] |grep -v "#" |cut -f 2`;
my @pp=`cat /nba/server/server_$world[$i] |grep -v "#" |cut -f 3`;
my @p1=`cat /nba/server/server_$world[$i]|grep -v "#" |cut -f 4`;
for (my $j=0;$j<scalar(@hhh);$j++)
{
chomp($hhh[$j]);
chomp($wd[$j]);
chomp($pp[$j]);
chomp($p1[$j]);
&total("$hhh[$j]","$wd[$j]","$pp[$j]","$service","$operate","$p1[$j]");
}
}
}
elsif($all =~ /^yes$/){
my @hhh=`cat /nba/server/server_*|grep -v "#" |cut -f 1`;
my @wd=`cat /nba/server/server_*|grep -v "#" |cut -f 2`;
my @pp=`cat /nba/server/server_*|grep -v "#" |cut -f 3`;
my @p1=`cat /nba/server/server_*|grep -v "#" |cut -f 4`;
for (my $j=0;$j<scalar(@hhh);$j++)
{
chomp($hhh[$j]);
chomp($wd[$j]);
chomp($pp[$j]);
chomp($p1[$j]);
print "$wd[$j]区:"."\n";
&total("$hhh[$j]","$wd[$j]","$pp[$j]","$service","$operate","$p1[$j]");
}
}
}
elsif($type =~ /^login$/){
for (my $i=0;$i<scalar(@host);$i++){
&login("$host[$i]","$operate","$port");
}
}
}
&main();
| eshujiushiwo/eshu-devops | tools/2015/nba.pl | Perl | apache-2.0 | 10,318 |
#!/usr/bin/perl -w
############################################################################
#
# AlchemyAPI Perl Example: Keyword Extraction
# Author: Orchestr8, LLC
# Copyright (C) 2009-2010, Orchestr8, LLC.
#
############################################################################
use strict;
use AlchemyAPI;
# Create the AlchemyAPI object.
my $alchemyObj = new AlchemyAPI();
# Load the API key from disk.
if ($alchemyObj->LoadKey("api_key.txt") eq "error")
{
die "Error loading API key. Edit api_key.txt and insert your API key.";
}
my $result = '';
# Get a list of topic keywords for a text string.
$result = $alchemyObj->TextGetRankedKeywords("Microsoft released a new product today. Microsoft wants you to try it out. Download it here.");
printf $result;
# Get a list of topic keywords for a web URL.
$result = $alchemyObj->URLGetRankedKeywords("http://www.gigaom.com/");
printf $result;
# Load an example HTML input file to analyze.
my $HTMLFile;
my $HTMLContent;
open($HTMLFile, "data/example.html");
sysread($HTMLFile, $HTMLContent, -s($HTMLFile));
close($HTMLFile);
# Get a list of topic keywords for a HTML document.
$result = $alchemyObj->HTMLGetRankedKeywords($HTMLContent, "http://www.test.com/");
printf $result;
| AlchemyAPI/alchemyapi_perl | example/keywords.pl | Perl | apache-2.0 | 1,257 |
package VMOMI::CustomizationName;
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/CustomizationName.pm | Perl | apache-2.0 | 387 |
package Parakeet::RenderContext;
use strict;
use warnings;
use utf8;
use v5.12;
use Misc::DmUtil::Data qw(notEmpty);
# Return content
sub content
{
return shift()->{content};
} # end of 'content()'
# From target
sub fromTarget
{
return shift()->{fromTarget};
} # end of 'fromTarget()'
# Create object
sub new
{
my $class = shift;
my %arg = @_;
my $this = {};
bless $this, $class;
my $log = $this->{log} = Misc::DmUtil::Log::find(%arg);
# take from supplied object
if ($arg{context})
{
$this->{content} = $arg{context}->content();
$this->{fromTarget} = $arg{context}->fromTarget();
$this->{pos} = $arg{context}->pos();
$this->{toTarget} = $arg{context}->toTarget();
}
# override with args
foreach my $i (qw(content fromTarget pos toTarget))
{
$this->{$i} //= $arg{$i};
}
# check for missing
foreach my $i (qw(content fromTarget))
{
unless (notEmpty($this->{$i}))
{
$log->fatal("No [$i] supplied");
}
}
# get pos from content
if ($this->content())
{
unless ($this->content()->targetExists("install", $this->fromTarget()))
{
$log->fatal("Target [".$this->fromTarget()."] not valid for content [".$this->content()->key()."]");
}
$this->{pos} //= $this->content()->outputFileSite($this->fromTarget());
}
return $this;
} # end of 'new()'
# Position
sub pos
{
return shift()->{pos};
} # end of 'pos()'
# To target
sub toTarget
{
return shift()->{toTarget};
} # end of 'toTarget()'
1;
| duncanmartin/parakeet | lib/Parakeet/RenderContext.pm | Perl | bsd-2-clause | 1,565 |
% Consider a social network with two types of relations (friend and spouse) as
% in Figure 1. Represent this network as a ProbLog input database (no
% probabilities).
person(alice).
person(bob).
person(carla).
person(dan).
friend(alice,dan).
friend(dan,bob).
friend(carla,alice).
friend(carla,bob).
spouse_(alice,bob).
spouse(A,B) :-
spouse_(A,B).
spouse(A,B) :-
spouse_(B,A).
% We consider three (types of) holiday destinations (seaside, mountains and
% city), and two attributes of people (enjoying sports and sightseeing,
% respectively).
destination(mountains).
destination(seaside).
destination(city).
0.8::enjoys(P,sports) :-
person(P).
0.4::enjoys(P,sightseeing) :-
person(P).
0.65::favorite(P,mountains);0.3::favorite(P,seaside);0.05::favorite(P,city) <-
enjoys(P,sports),
\+ enjoys(P,sightseeing).
0.8::favorite(P,city);0.15::favorite(P,seaside);0.05::favorite(P,mountains) <-
enjoys(P,sightseeing),
\+ enjoys(P,sports).
0.9::favorite(P,seaside);0.1::favorite(P,city) <-
\+ enjoys(P,sports),
\+ enjoys(P,sightseeing).
K::favorite(P,D) :-
destination(D),
K is 1.0/3,
enjoys(P,sightseeing),
enjoys(P,sports).
likes(P,F) :-
person(P),
destination(F),
favorite(P,F).
0.8::likes(P,D) <-
person(P),
destination(D),
spouse(P,S),
likes(S,D).
0.1::likes(P,D) <-
person(P),
destination(D),
friend(P,F),
likes(F,D).
% (a)
% (b)
%evidence(likes(bob,city),false).
% (c)
%evidence(likesame(alice,dan),true).
likesame(P1,P2) :-
destination(D),
likes(P1,D),
likes(P2,D).
likes_(P,D) :-
person(P),
destination(D),
likes(P,D).
query(likes_(P,D)).
% Destination choices
0.8::visits(P,Fav,1);0.1::visits(P,O1,1);0.1::visits(P,O2,1) <-
person(P),destination(Fav),destination(O1),destination(O2),
favorite(P,Fav),O1\==Fav,O2\==Fav,O2\==O1.
0.7::happy(P,Y) <-
person(P),
destination(D),
likes(P,D),
visits(P,D,Y).
0.7::visits(P,D,Y);0.15::visits(P,O1,Y);0.15::visits(P,O2,Y) <-
Y>1,
person(P),destination(D),destination(O1),destination(O2),
Prev is Y-1,visits(P,D,Prev),happy(P,Prev),
O1\==D,O2\==D,O2\==O1.
0.4::visits(P,D,Y);0.3::visits(P,O1,Y);0.3::visits(P,O2,Y) <-
Y>1,
person(P),destination(D),destination(O1),destination(O2),
Prev is Y-1,visits(P,D,Prev),
\+ happy(P,Prev),
O1\==D,O2\==D,O2\==O1.
%query(happy(_,2)).
% 10
0.4::happy(P,Y) <-
person(P),
destination(D),
visits(P,D,Y),
spouse(P,S),
visits(S,D,Y).
% 11
0.4::happy(P,Y) <-
person(P),
destination(D),
visits(P,D,Y),
friend(P,F),
visits(F,D,Y).
| toonn/capselaiv | holidays.pl | Perl | bsd-2-clause | 2,643 |
# Copyright (c) 2012, Mitchell Cooper
#
# provides LOLCAT command
# requires Acme::LOLCAT
#
# works exactly like PRIVMSG except translates your message to LOLCAT.
# unlike privmsg, it boings a PRIVMSG back to the client who sent it.
# it only works for channels.
package ext::LOLCAT;
use warnings;
use strict;
use Acme::LOLCAT;
use utils qw[cut_to_limit col];
our $mod = API::Module->new(
name => 'LOLCAT',
version => '0.1',
description => 'SPEEK LIEK A LOLCATZ!',
requires => ['user_commands'],
initialize => \&init
);
sub init {
# register user commands
$mod->register_user_command(
name => 'lolcat',
description => 'SPEEK LIEK A LOLCATZ!',
parameters => 2,
code => \&lolcat
) or return;
return 1
}
sub lolcat {
my ($user, $data, @args) = @_;
my $msg = translate(col((split /\s+/, $data, 3)[2]));
return unless my $where = channel::lookup_by_name($args[1]);
my $cmd = q(:).$user->full." PRIVMSG $$where{name} :$msg";
$user->send($cmd) if $user->handle("PRIVMSG $$where{name} :$msg");
}
$mod
| cooper/juno-mesh | mod/LOLCAT.pm | Perl | bsd-3-clause | 1,126 |
# samba-lib.pl
# Common functions for editing the samba config file
# XXX privileges for groups with 'net' command
BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();
$has_iconv = &has_command("iconv");
# Get the samba version
if (open(VERSION, "$module_config_directory/version")) {
chop($samba_version = <VERSION>);
close(VERSION);
}
$has_pdbedit = ( $samba_version >= 3 && &has_command($config{'pdbedit'}) );
$has_smbgroupedit = 1 if (&has_command($config{'smbgroupedit'}));
$has_net = 1 if ($config{'net'} =~ /^(\S+)/ && &has_command("$1"));
$has_groups = ( $samba_version >= 3 && ($has_smbgroupedit || $has_net) );
# list_shares()
# List all the shares from the samba config file
sub list_shares
{
local(@rv, $_);
&open_readfile(SAMBA, $config{smb_conf});
while(<SAMBA>) {
chop; s/;.*$//g; s/^\s*#.*$//g;
if (/^\s*\[([^\]]+)\]/) {
push(@rv, $1);
}
}
close(SAMBA);
# Check for an include directive in the [global] share
local %global;
&get_share("global", \%global);
local $inc = &getval("include", \%global);
if ($inc && $inc !~ /\%/) {
# XXX
}
return @rv;
}
# get_share(share, [array])
# Fills the associative array %share with the parameters from the given share
sub get_share
{
local($found, $_, $first, $arr);
$arr = (@_==2 ? $_[1] : "share");
undef(%$arr);
&open_readfile(SAMBA, $config{smb_conf});
while(<SAMBA>) {
chop; s/^\s*;.*$//g; s/^\s*#.*$//g;
if (/^\s*\[([^\]]+)\]/) {
# Start of share section
$first = 1;
if ($found) {
last;
}
elsif ($1 eq $_[0]) {
$found = 1;
$$arr{share_name} = $1;
}
}
elsif ($found && /^\s*([^=]*\S)\s*=\s*(.*)$/) {
# Directives inside a section
if (lc($1) eq "read only") {
# bastard special case.. change to writable
$$arr{'writable'} = $2 =~ /yes|true|1/i ? "no" : "yes";
}
else {
$$arr{lc($1)} = &from_utf8("$2");
}
}
elsif (!$first && /^\s*([^=]*\S)\s*=\s*(.*)$/ && $_[0] eq "global") {
# Directives outside a section! Assume to be part of [global]
$$arr{share_name} = "global";
$$arr{lc($1)} = &from_utf8("$2");
$found = 1;
}
}
close(SAMBA);
return $found;
}
# create_share(name)
# Add an entry to the config file
sub create_share
{
&open_tempfile(CONF, ">> $config{smb_conf}");
&print_tempfile(CONF, "\n");
&print_tempfile(CONF, "[$_[0]]\n");
foreach $k (grep {!/share_name/} (keys %share)) {
&print_tempfile(CONF, "\t$k = $share{$k}\n");
}
&close_tempfile(CONF);
}
# modify_share(oldname, newname)
# Change a share (and maybe it's name)
sub modify_share
{
local($_, @conf, $replacing, $first);
&open_readfile(CONF, $config{smb_conf});
@conf = <CONF>;
close(CONF);
&open_tempfile(CONF, ">$config{smb_conf}");
for($i=0; $i<@conf; $i++) {
chop($_ = $conf[$i]); s/;.*$//g; s/#.*$//g;
if (/^\s*\[([^\]]+)\]/) {
$first = 1;
if ($replacing) { $replacing = 0; }
elsif ($1 eq $_[0]) {
&print_tempfile(CONF, "[$_[1]]\n");
foreach $k (grep {!/share_name/} (keys %share)) {
&print_tempfile(CONF, "\t$k = ",
&to_utf8($share{$k}),"\n");
}
#&print_tempfile(CONF, "\n");
$replacing = 1;
}
}
elsif (!$first && /^\s*([^=]*\S)\s*=\s*(.*)$/ && $_[0] eq "global") {
# found start of directives outside any share - assume [global]
$first = 1;
&print_tempfile(CONF, "[$_[1]]\n");
foreach $k (grep {!/share_name/} (keys %share)) {
&print_tempfile(CONF, "\t$k = ",
&to_utf8($share{$k}),"\n");
}
&print_tempfile(CONF, "\n");
$replacing = 1;
}
if (!$replacing || $conf[$i] =~ /^\s*[#;]/ || $conf[$i] =~ /^\s*$/) {
&print_tempfile(CONF, $conf[$i]);
}
}
&close_tempfile(CONF);
}
# delete_share(share)
# Delete some share from the config file
sub delete_share
{
local($_, @conf, $deleting);
&open_readfile(CONF, $config{smb_conf});
@conf = <CONF>;
close(CONF);
&open_tempfile(CONF, "> $config{smb_conf}");
for($i=0; $i<@conf; $i++) {
chop($_ = $conf[$i]); s/;.*$//g;
if (/^\s*\[([^\]]+)\]/) {
if ($deleting) { $deleting = 0; }
elsif ($1 eq $_[0]) {
&print_tempfile(CONF, "\n");
$deleting = 1;
}
}
if (!$deleting) {
&print_tempfile(CONF, $conf[$i]);
}
}
&close_tempfile(CONF);
}
# to_utf8(string)
# Converts a string to UTF-8 if needed
sub to_utf8
{
local ($v) = @_;
if ($v =~ /^[\000-\177]*$/ || !$has_iconv) {
return $v;
}
else {
my $temp = &transname();
&open_tempfile(TEMP, ">$temp", 0, 1);
&print_tempfile(TEMP, $v);
&close_tempfile(TEMP);
my $out = &backquote_command("iconv -f iso-8859-1 -t UTF-8 <$temp");
&unlink_file($temp);
return $? || $out eq '' ? $v : $out;
}
}
# from_utf8(string)
# Converts a string from UTF-8 if needed
sub from_utf8
{
local ($v) = @_;
if ($v =~ /^[\000-\177]*$/ || !$has_iconv) {
return $v;
}
else {
my $temp = &transname();
&open_tempfile(TEMP, ">$temp", 0, 1);
&print_tempfile(TEMP, $v);
&close_tempfile(TEMP);
my $out = &backquote_command("iconv -f UTF-8 -t iso-8859-1 <$temp");
&unlink_file($temp);
return $? || $out eq '' ? $v : $out;
}
}
# list_connections([share])
# Uses the smbstatus program to return a list of connections a share. Each
# element of the returned list is of the form:
# share, user, group, pid, hostname, date/time
sub list_connections
{
local($l, $started, @rv);
if ($samba_version >= 3) {
# New samba status format
local %pidmap;
local $out;
local $ex = &execute_command("$config{samba_status_program} -s $config{smb_conf}", undef, \$out, undef);
if ($ex) {
# -s option not supported
&execute_command("$config{samba_status_program}",
undef, \$out, undef);
}
foreach $l (split(/\n/ , $out)) {
if ($l =~ /^----/) {
$started++;
}
elsif ($started == 1 &&
$l =~ /^\s*(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+\((\S+)\)/) {
# A line with a PID, username, group and hostname
$pidmap{$1} = [ $1, $2, $3, $4, $5 ];
}
elsif ($started == 2 &&
$l =~ /^\s*(\S+)\s+(\d+)\s+(\S+)\s+(.*)$/) {
# A line with a service, PID and machine. This must be
# combined data from the first type of line to create
# the needed information
local $p = $pidmap{$2};
if (!$_[0] || $1 eq $_[0] ||
$1 eq $p->[1] && $_[0] eq "homes") {
push(@rv, [ $1, $p->[1], $p->[2], $2, $3, $4 ]);
}
}
}
}
else {
# Old samba status format
local $out;
&execute_command("$config{samba_status_program} -S",
undef, \$out, undef);
foreach $l (split(/\n/, $out)) {
if ($l =~ /^----/) { $started++; }
if ($started && $l =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)\s+\(\S+\)\s+(.*)$/ && (!$_[0] || $1 eq $_[0] || $1 eq $2 && $_[0] eq "homes")) {
push(@rv, [ $1, $2, $3, $4, $5, $6 ]);
}
}
}
return @rv;
}
# list_locks()
# Returns a list of locked files as an array, in the form:
# pid, mode, rw, oplock, file, date
sub list_locks
{
local($l, $started, @rv);
local $out;
&clean_language();
&execute_command("$config{samba_status_program} -L", undef, \$out, undef);
&reset_environment();
foreach $l (split(/\n/, $out)) {
if ($l =~ /^----/) { $started = 1; }
if ($started && $l =~ /^(\d+)\s+(\d+)\s+(\S+)\s+(0x\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S.*)\s\s((Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s.*)/i) {
# New-style line
push(@rv, [ $1, $3, $5, $6, $7.'/'.$8, $9 ]);
}
elsif ($started && $l =~ /^(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)/) {
# Old-style line
push(@rv, [ $1, $2, $3, $4, $5, $6 ]);
}
}
return @rv;
}
# istrue(key)
# Checks if the value of this key (or it's synonyms) in %share is true
sub istrue
{
return &getval($_[0]) =~ /yes|true|1/i;
}
# isfalse(key)
# Checks if the value of this key (or it's synonyms) in %share is false
sub isfalse
{
return &getval($_[0]) =~ /no|false|0/i;
}
# getval(name, [&hash])
# Given the name of a key in %share, return the value. Also looks for synonyms.
# If the value is not found, a default is looked for.. this can come from
# a copied section, the [global] configuration section, or from the SAMBA
# defaults. This means that getval() always returns something..
sub getval
{
local $hash = $_[1] || \%share;
local($_, $copy);
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
if (defined($hash->{$_})) { return $hash->{$_}; }
}
}
if (defined($hash->{$_[0]})) {
return $hash->{$_[0]};
}
elsif ($_[0] ne "copy" && ($copy = $hash->{"copy"})) {
# this share is a copy.. get the value from the source
local(%share);
&get_share($copy);
return &getval($_[0]);
}
else {
# return the default value...
return &default_value($_[0]);
}
return undef;
}
# setval(name, value, [default])
# Sets some value in %share. Synonyms with the same meaning are removed.
# If the value is the same as the share or given default, dont store it
sub setval
{
local($_);
if (@_ == 3) {
# default was given..
$def = $_[2];
}
elsif ($_[0] ne "copy" && ($copy = $share{"copy"})) {
# get value from copy source..
local(%share);
&get_share($copy);
$def = &getval($_[0]);
}
else {
# get global/samba default
$def = &default_value($_[0]);
}
if ($_[1] eq $def || ($def !~ /\S/ && $_[1] !~ /\S/) ||
($def =~ /^(true|yes|1)$/i && $_[1] =~ /^(true|yes|1)$/i) ||
($def =~ /^(false|no|0)$/i && $_[1] =~ /^(false|no|0)$/i)) {
# The value is the default.. delete this entry
&delval($_[0]);
}
else {
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
delete($share{$_});
}
}
$share{$_[0]} = $_[1];
}
}
# delval(name)
# Delete a value from %share (and it's synonyms)
sub delval
{
local($_);
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
delete($share{$_});
}
}
else { delete($share{$_[0]}); }
}
# default_value(name)
# Returns the default value for a parameter
sub default_value
{
local($_, %global);
# First look in the [global] section.. (unless this _is_ the global section)
if ($share{share_name} ne "global") {
&get_share("global", "global");
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
if (defined($global{$_})) { return $global{$_}; }
}
}
if (defined($global{$_[0]})) { return $global{$_[0]}; }
}
# Else look in the samba defaults
if ($synon{$_[0]}) {
foreach (split(/,/, $synon{$_[0]})) {
if (exists($default_values{$_})) {
return $default_values{$_};
}
}
}
return $default_values{$_[0]};
}
# The list of synonyms used by samba for parameter names
@synon = ( "writeable,write ok,writable",
"public,guest ok",
"printable,print ok",
"allow hosts,hosts allow",
"deny hosts,hosts deny",
"create mode,create mask",
"directory mode,directory mask",
"path,directory",
"exec,preexec",
"group,force group",
"only guest,guest only",
"user,username,users",
"default,default service",
"auto services,preload",
"lock directory,lock dir",
"max xmit,max packet",
"root directory,root dir,root",
"case sensitive,case sig names",
"idmap uid,winbind uid",
"idmap gid,winbind gid",
);
foreach $s (@synon) {
foreach $ss (split(/,/ , $s)) {
$synon{$ss} = $s;
}
}
# Default values for samba configuration parameters
%default_values = ( "allow hosts",undef,
"alternate permissions","no",
"available","yes",
"browseable","yes",
"comment",undef,
"create","yes",
"create mode","755",
"directory mode","755",
"default case","lower",
"case sensitive","no",
"mangle case","no",
"preserve case","yes",
"short preserve case","yes",
"delete readonly","no",
"deny hosts",undef,
"dont descend",undef,
"force group",undef,
"force user",undef,
"force create mode","000",
"force directory mode","000",
"guest account","nobody", # depends
"guest only","no",
"hide dot files","yes",
"invalid users",undef,
"locking","yes",
"lppause command",undef, # depends
"lpq command",undef, # depends
"lpresume command",undef, # depends
"lprm command",undef, #depends
"magic output",undef, # odd..
"magic script",undef,
"mangled map",undef,
"mangled names","yes",
"mangling char","~",
"map archive","yes",
"map system","no",
"map hidden","no",
"max connections",0,
"only user","no",
"fake oplocks","no",
"oplocks","yes",
"os level",20,
"level2 oplocks","no",
"load printers","yes",
"min print space",0,
"path",undef,
"postscript","no",
"preexec",undef,
"print command",undef,
# "print command","lpr -r -P %p %s",
"printer",undef,
"printer driver",undef,
"public","no",
"read list",undef,
"revalidate","no",
"root preexec",undef,
"root postexec",undef,
"set directory","no",
"share modes","yes",
"socket options","TCP_NODELAY",
"strict locking","no",
"sync always","no",
"unix password sync","no",
"user",undef,
"valid chars",undef,
"volume",undef, # depends
"wide links","yes",
"wins support","no",
"writable","no",
"write list",undef,
"winbind cache time",300,
"winbind enable local accounts","yes",
"winbind trusted domains only","no",
"winbind enum users","yes",
"winbind enum groups","yes",
);
$default_values{'encrypt passwords'} = 'yes' if ($samba_version >= 3);
# user_list(list)
# Convert a samba unix user list into a more readable form
sub user_list
{
local($u, @rv);
foreach $u (split(/[ \t,]+/ , $_[0])) {
if ($u =~ /^\@(.*)$/) {
push(@rv, "group <tt>".&html_escape($1)."</tt>");
}
else {
push(@rv, "<tt>".&html_escape($u)."</tt>");
}
}
return join("," , @rv);
}
# yesno_input(config-name, [input-name])
# Returns a true / false selector
sub yesno_input
{
local ($c, $n) = @_;
if (!$n) {
($n = $c) =~ s/ /_/g;
}
return &ui_radio($n, &istrue($c) ? "yes" : "no",
[ [ "yes", $text{'yes'} ],
[ "no", $text{'no'} ] ]);
}
# username_input(name)
# Outputs HTML for an username field
sub username_input
{
local $n;
($n = $_[0]) =~ s/ /_/g;
return &ui_user_textbox($n, &getval($_[0]));
}
# username_input(name, default)
sub groupname_input
{
local $n;
($n = $_[0]) =~ s/ /_/g;
return &ui_group_textbox($n, &getval($_[0]));
}
@sock_opts = ("SO_KEEPALIVE", "SO_REUSEADDR", "SO_BROADCAST", "TCP_NODELAY",
"IPTOS_LOWDELAY", "IPTOS_THROUGHPUT", "SO_SNDBUF*", "SO_RCVBUF*",
"SO_SNDLOWAT*", "SO_RCVLOWAT*");
@protocols = ("CORE", "COREPLUS", "LANMAN1", "LANMAN2", "NT1");
# list_users()
# Returns an array of all the users from the samba password file
sub list_users
{
local(@rv, @b, $_, $lnum);
if ($has_pdbedit) {
# Get list of users from the pdbedit command, which uses a configurable
# back-end for storage
&open_execute_command(PASS, "cd / && $config{'pdbedit'} -L -w -s $config{'smb_conf'}", 1);
}
else {
# Read the password file directly
&open_readfile(PASS, $config{'smb_passwd'});
}
while(<PASS>) {
$lnum++;
chop;
s/#.*$//g;
local @b = split(/:/, $_);
next if (@b < 4);
local $u = { 'name' => $b[0], 'uid' => $b[1],
'pass1' => $b[2], 'pass2' => $b[3],
'oldname' => $b[0] };
if ($samba_version >= 2 && $b[4] =~ /^\[/) {
$b[4] =~ s/[\[\] ]//g;
$u->{'opts'} = [ split(//, $b[4]) ];
$u->{'change'} = $b[5];
}
else {
$u->{'real'} = $b[4];
$u->{'home'} = $b[5];
$u->{'shell'} = $b[6];
}
$u->{'index'} = scalar(@rv);
$u->{'line'} = $lnum-1;
push(@rv, $u);
}
close(PASS);
return @rv;
}
# smbpasswd_cmd(args)
# Returns the full smbpasswd command with extra args
sub smbpasswd_cmd
{
my ($args) = @_;
return $config{'samba_password_program'}.
($samba_version >= 3 ? " -c " : " -s ").
$config{'smb_conf'}." ".$args;
}
# create_user(&user)
# Add a user to the samba password file
sub create_user
{
if ($has_pdbedit) {
# Use the pdbedit command
local $ws = &indexof("W", @{$_[0]->{'opts'}}) >= 0 ? "-m" : "";
local @opts = grep { $_ ne "U" && $_ ne "W" } @{$_[0]->{'opts'}};
local $out = &backquote_logged(
"cd / && $config{'pdbedit'} -a -s $config{'smb_conf'} -u ".
quotemeta($_[0]->{'name'}).
($config{'sync_gid'} ? " -G $config{'sync_gid'}" : "").
" -c '[".join("", @opts)."]' $ws");
$? && &error("$config{'pdbedit'} failed : <pre>$out</pre>");
}
else {
# Try using smbpasswd -a
local $out = &backquote_logged(
"cd / && ".&smbpasswd_cmd(
"-a ".
(&indexof("D", @{$_[0]->{'opts'}}) >= 0 ? "-d " : "").
(&indexof("N", @{$_[0]->{'opts'}}) >= 0 ? "-n " : "").
(&indexof("W", @{$_[0]->{'opts'}}) >= 0 ? "-m " : "").
quotemeta($_[0]->{'name'})));
if ($?) {
# Add direct to Samba password file
&open_tempfile(PASS, ">>$config{'smb_passwd'}");
&print_tempfile(PASS, &user_string($_[0]));
&close_tempfile(PASS);
chown(0, 0, $config{'smb_passwd'});
chmod(0600, $config{'smb_passwd'});
}
}
}
# modify_user(&user)
# Change an existing samba user
sub modify_user
{
if ($has_pdbedit) {
# Use the pdbedit command
if ($_[0]->{'oldname'} ne "" && $_[0]->{'oldname'} ne $_[0]->{'name'}) {
# Username changed! Have to delete and re-create
local $out = &backquote_logged(
"cd / && $config{'pdbedit'} -x -s $config{'smb_conf'} -u ".
quotemeta($_[0]->{'oldname'}));
$? && &error("$config{'pdbedit'} failed : <pre>$out</pre>");
&create_user($_[0]);
}
else {
# Just update user
local @opts = grep { $_ ne "U" } @{$_[0]->{'opts'}};
&indexof("W", @{$_[0]->{'opts'}}) >= 0 && &error($text{'saveuser_ews'});
$out = &backquote_logged(
"cd / && $config{'pdbedit'} -r -s $config{'smb_conf'} -u ".
quotemeta($_[0]->{'name'}).
" -c '[".join("", @opts)."]' 2>&1");
$? && &error("$config{'pdbedit'} failed : <pre>$out</pre>");
}
}
else {
if (!$_[0]->{'oldname'} || $_[0]->{'oldname'} eq $_[0]->{'name'}) {
# Try using smbpasswd command
local $out = &backquote_logged(
"cd / && ".&smbpasswd_cmd(
(&indexof("D", @{$_[0]->{'opts'}}) >= 0 ? "-d "
: "-e ").
quotemeta($_[0]->{'name'})));
}
# Also directly update the Samba password file
&replace_file_line($config{'smb_passwd'}, $_[0]->{'line'},
&user_string($_[0]));
}
}
# delete_user(&user)
# Delete a samba user
sub delete_user
{
if ($has_pdbedit) {
# Use the pdbedit command
local $out = &backquote_logged(
"cd / && $config{'pdbedit'} -x -s $config{'smb_conf'} -u ".
quotemeta($_[0]->{'name'}));
$? && &error("$config{'pdbedit'} failed : <pre>$out</pre>");
}
else {
# Try the smbpasswd command
local $out = &backquote_logged(
"cd / && ".&smbpasswd_cmd("-x ".quotemeta($_[0]->{'name'})));
if ($?) {
# Just remove from the Samba password file
&replace_file_line($config{'smb_passwd'}, $_[0]->{'line'});
}
}
}
sub user_string
{
local @u = ($_[0]->{'name'}, $_[0]->{'uid'},
$_[0]->{'pass1'}, $_[0]->{'pass2'});
if ($_[0]->{'opts'}) {
push(@u, sprintf "[%-11s]", join("", @{$_[0]->{'opts'}}));
push(@u, sprintf "LCT-%X", time());
push(@u, "");
}
else {
push(@u, $_[0]->{'real'}, $_[0]->{'home'}, $_[0]->{'shell'});
}
return join(":", @u)."\n";
}
# set_password(user, password, [&output])
# Changes the password of a user in the encrypted password file
sub set_password
{
local $qu = quotemeta($_[0]);
local $qp = quotemeta($_[1]);
if ($samba_version >= 2) {
local $passin = "$_[1]\n$_[1]\n";
local $ex = &execute_command(
&smbpasswd_cmd("-s $qu"), \$passin, $_[2], $_[2]);
unlink($temp);
return !$rv;
}
else {
local $out;
&execute_command("$config{'samba_password_program'} $qu $qp",
undef, $_[2], $_[2]);
return $out =~ /changed/i;
}
}
# is_samba_running()
# Returns 0 if not, 1 if it is, or 2 if run from (x)inetd
sub is_samba_running
{
local ($found_inet, @smbpids, @nmbpids);
if (&foreign_check("inetd")) {
&foreign_require("inetd", "inetd-lib.pl");
foreach $inet (&foreign_call("inetd", "list_inets")) {
$found_inet++ if (($inet->[8] =~ /smbd/ ||
$inet->[9] =~ /smbd/) && $inet->[1]);
}
}
elsif (&foreign_check("xinetd")) {
&foreign_require("xinetd", "xinetd-lib.pl");
foreach $xi (&foreign_call("xinetd", "get_xinetd_config")) {
local $q = $xi->{'quick'};
$found_inet++ if ($q->{'disable'}->[0] ne 'yes' &&
$q->{'server'}->[0] =~ /smbd/);
}
}
@smbpids = &find_byname("smbd");
@nmbpids = &find_byname("nmbd");
return !$found_inet && !@smbpids && !@nmbpids ? 0 :
!$found_inet ? 1 : 2;
}
# is_winbind_running()
# Returns 0 if not, 1 if it is
sub is_winbind_running
{
local (@wbpids);
@wbpids = &find_byname("winbindd");
return !@wbpids ? 0 : 1;
}
# can($permissions_string, \%access, [$sname])
# check global and per-share permissions:
#
# $permissions_string = any exists permissions except 'c' (creation).
# \%access = ref on what get_module_acl() returns.
sub can
{
local ($acl, $stype, @perm);
local ($perm, $acc, $sname) = @_;
@perm = split(//, $perm);
$sname = $in{'old_name'} || $in{'share'} unless $sname;
{ local %share;
&get_share($sname); # use local %share
$stype = &istrue('printable') ? 'ps' : 'fs';
}
# check global acl (r,w)
foreach (@perm) {
next if ($_ ne 'r') && ($_ ne 'w');
return 0 unless $acc->{$_ . '_' . $stype};
}
# check per-share acl
if ($acc->{'per_' . $stype . '_acls'}) {
$acl = $acc->{'ACL' . $stype . '_' . $sname};
foreach (@perm) {
# next if $_ eq 'c'; # skip creation perms for per-share acls
return 0 if index($acl, $_) == -1;
}
}
return 1;
}
# save_samba_acl($permissions_string, \%access, $share_name)
sub save_samba_acl
{
local ($p, $a, $s)=@_;
%share || &get_share($s); # use global %share
local $t=&istrue('printable') ? 'ps' : 'fs';
$a->{'ACL'. $t .'_'. $s} = $p;
#undef($can_cache);
return &save_module_acl($a);
}
# drop_samba_acl(\%access, $share_name)
sub drop_samba_acl
{
local ($a, $s)=@_;
%share || &get_share($s); # use global %share
local $t=&istrue('printable') ? 'ps' : 'fs';
delete($a->{'ACL'. $t .'_' . $s});
#undef($can_cache);
return &save_module_acl($a);
}
# list_groups()
# Returns an array containing details of Samba groups
sub list_groups
{
local (@rv, $group, $cmd);
if ($has_smbgroupedit) {
$cmd = "$config{'smbgroupedit'} -v -l";
}
else {
$cmd = "$config{'net'} -s $config{'smb_conf'} groupmap list verbose";
}
&open_execute_command(GROUPS, $cmd, 1);
while(<GROUPS>) {
s/\r|\n//g;
if (/^(\S.*)/) {
$group = { 'name' => $1,
'index' => scalar(@rv) };
push(@rv, $group);
}
elsif (/^\s+SID\s*:\s+(.*)/i) {
$group->{'sid'} = $1;
}
elsif (/^\s+Unix group\s*:\s*(.*)/i) {
$group->{'unix'} = $1;
}
elsif (/^\s+Group type\s*:\s*(.*)/i) {
$group->{'type'} = lc($1) eq 'domain group' ? 'd' :
lc($1) eq 'nt builtin' ? 'b' :
lc($1) eq 'unknown type' ? 'u' :
lc($1) eq 'local group' ? 'l' : $1;
}
elsif (/^\s+Comment\s*:\s*(.*)/i) {
$group->{'desc'} = $1;
}
elsif (/^\s+Privilege\s*:\s*(.*)/i) {
$group->{'priv'} = lc($1) eq 'no privilege' ? undef : $1;
}
}
close(GROUPS);
return @rv;
}
# delete_group(&group)
# Delete an existing Samba group
sub delete_group
{
local $out;
if ($has_smbgroupedit) {
$out = &backquote_logged("$config{'smbgroupedit'} -x ".quotemeta($_[0]->{'name'})." 2>&1");
$? && &error("$config{'smbgroupedit'} failed : <pre>$out</pre>");
}
else {
$out = &backquote_logged("$config{'net'} -s $config{'smb_conf'} groupmap delete ntgroup=".quotemeta($_[0]->{'name'})." 2>&1");
$? && &error("$config{'net'} failed : <pre>$out</pre>");
}
}
# modify_group(&group)
# Update the details of an existing Samba group
sub modify_group
{
local $out;
if ($has_smbgroupedit) {
$out = &backquote_logged(
$config{'smbgroupedit'}.
" -c ".quotemeta($_[0]->{'sid'}).
($_[0]->{'unix'} == -1 ? "" :" -u ".quotemeta($_[0]->{'unix'})).
($_[0]->{'desc'} ? " -d ".quotemeta($_[0]->{'desc'}) :" -d ''").
" -t ".$_[0]->{'type'}.
" 2>&1");
$? && &error("$config{'smbgroupedit'} failed : <pre>$out</pre>");
}
else {
$out = &backquote_logged(
"$config{'net'} -s $config{'smb_conf'} groupmap modify".
" sid=".quotemeta($_[0]->{'sid'}).
($_[0]->{'unix'} == -1 ? "" :
" unixgroup=".quotemeta($_[0]->{'unix'})).
($_[0]->{'desc'} ? " comment=".quotemeta($_[0]->{'desc'})
: " 'comment= '").
" type=".quotemeta($_[0]->{'type'})." 2>&1");
$? && &error("$config{'net'} failed : <pre>$out</pre>");
}
}
# create_group(&group)
# Add a Samba new group
sub create_group
{
local $out;
if ($has_smbgroupedit) {
$out = &backquote_logged(
$config{'smbgroupedit'}.
" -a ".quotemeta($_[0]->{'unix'}).
" -n ".quotemeta($_[0]->{'name'}).
($_[0]->{'priv'} ? " -p ".quotemeta($_[0]->{'priv'}) : "").
($_[0]->{'desc'} ? " -d ".quotemeta($_[0]->{'desc'}) :" -d ''").
" -t ".$_[0]->{'type'}." 2>&1");
$? && &error("$config{'smbgroupedit'} failed : <pre>$out</pre>");
}
else {
$out = &backquote_logged("$config{'net'} -s $config{'smb_conf'} maxrid 2>&1");
local $maxrid = $out =~ /rid:\s+(\d+)/ ? $1 + 1 : undef;
$maxrid = 1000 if ($maxrid < 1000); # Should be >1000
$out = &backquote_logged(
"$config{'net'} -s $config{'smb_conf'} groupmap add".
" rid=$maxrid".
" unixgroup=".quotemeta($_[0]->{'unix'}).
" ntgroup=".quotemeta($_[0]->{'name'}).
" type=".quotemeta($_[0]->{'type'})." 2>&1");
$? && &error("<pre>$out</pre>");
$out = &backquote_logged(
"$config{'net'} groupmap modify".
" ntgroup=".quotemeta($_[0]->{'name'}).
($_[0]->{'desc'} ? " comment=".quotemeta($_[0]->{'desc'})
: " 'comment= '").
" type=".quotemeta($_[0]->{'type'})." 2>&1");
$? && &error("$config{'net'} failed : <pre>$out</pre>");
}
}
# get_samba_version(&out, [keep-original-format])
# Returns the Samba version
sub get_samba_version
{
local $flag;
foreach $flag ("-V", "-v") {
&execute_command("$config{'samba_server'} $flag", undef, $_[0], $_[0]);
if (${$_[0]} =~ /(Version|Samba)\s+(CVS\s+)?[^0-9 ]*(\d+)\.(\S+)/i) {
local $v1 = $3;
local $v2 = $4;
if (!$_[1]) {
$v2 =~ s/[^0-9]//g;
}
return "$v1.$v2";
}
}
return undef;
}
sub check_user_enabled
{
local %share;
&get_share("global");
if (!&istrue("encrypt passwords")) {
$err = &text('check_user1', $_[0], "conf_pass.cgi");
}
elsif (!$config{'smb_passwd'} && !$has_pdbedit) {
$err = &text('check_user2', $_[0], "../config.cgi?$module_name");
}
if ($err) {
print "<p>$err<p>\n";
print "<hr>\n";
&footer("", $text{'index_sharelist'});
exit;
}
}
sub check_group_enabled
{
if ($samba_version < 3) {
$err = &text('check_groups1', $_[0]);
}
elsif (!$has_groups) {
$err = &text('check_groups2', $_[0], "../config.cgi?$module_name");
}
if ($err) {
print "<p>$err<p>\n";
print "<hr>\n";
&footer("", $text{'index_sharelist'});
exit;
}
}
1;
| xtso520ok/webmin | samba/samba-lib.pl | Perl | bsd-3-clause | 26,149 |
#!/usr/bin/perl -w
use IO::Socket;
use strict;
use warnings;
fork;
my $server;
my $port;
my $nick;
my $user;
my $name;
my $chan;
my $fd;
my $in;
$server = "irc.tddirc.net";
$port = 6667;
$nick = "botop-test";
$user = "opnetsbot";
$name = "...";
$chan = "#test";
$fd = new IO::Socket::INET (PeerAddr => $server, PeerPort => $port, Proto => "tcp");
print $fd "NICK $nick\r\n";
print $fd "USER $user \"\" \"\" :$name\r\n";
print $fd "JOIN $chan\r\n";
while ($in = <$fd>) {
if ($in =~ /^PING (:[^ ]+)$/i) {
print $fd "PONG :$1\r\n";
}
if ($in =~ /^!test/i) {
print $fd "PRIVMSG #hackerthreads :it works\r\n";
print "It works!\r\n";
}
}
| CodeThat/Information-Security | irc.pl | Perl | mit | 674 |
package Module::CoreList::Utils;
use strict;
use warnings;
use vars qw[$VERSION %utilities];
use Module::CoreList;
use Module::CoreList::TieHashDelta;
$VERSION = '3.03';
sub utilities {
my $perl = shift;
$perl = shift if eval { $perl->isa(__PACKAGE__) };
return unless $perl or exists $utilities{$perl};
return sort keys %{ $utilities{$perl} };
}
sub first_release_raw {
my $util = shift;
$util = shift if eval { $util->isa(__PACKAGE__) };
#and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
my $version = shift;
my @perls = $version
? grep { exists $utilities{$_}{ $util } &&
$utilities{$_}{ $util } ge $version } keys %utilities
: grep { exists $utilities{$_}{ $util } } keys %utilities;
return grep { exists $Module::CoreList::released{$_} } @perls;
}
sub first_release_by_date {
my @perls = &first_release_raw;
return unless @perls;
return (sort { $Module::CoreList::released{$a} cmp $Module::CoreList::released{$b} } @perls)[0];
}
sub first_release {
my @perls = &first_release_raw;
return unless @perls;
return (sort { $a cmp $b } @perls)[0];
}
sub removed_from {
my @perls = &removed_raw;
return shift @perls;
}
sub removed_from_by_date {
my @perls = sort { $Module::CoreList::released{$a} cmp $Module::CoreList::released{$b} } &removed_raw;
return shift @perls;
}
sub removed_raw {
my $util = shift;
$util = shift if eval { $util->isa(__PACKAGE__) };
return unless my @perls = sort { $a cmp $b } first_release_raw($util);
@perls = grep { exists $Module::CoreList::released{$_} } @perls;
my $last = pop @perls;
my @removed = grep { $_ > $last } sort { $a cmp $b } keys %utilities;
return @removed;
}
my %delta = (
5 => {
changed => {
'a2p' => '1',
'c2ph' => '1',
'cppstdin' => '1',
'find2perl' => '1',
'pstruct' => '1',
's2p' => '1',
},
removed => {
}
},
5.001 => {
delta_from => 5,
changed => {
'h2xs' => '1',
},
removed => {
}
},
5.002 => {
delta_from => 5.001,
changed => {
'h2ph' => '1',
'perlbug' => '1',
'perldoc' => '1',
'pod2html' => '1',
'pod2latex' => '1',
'pod2man' => '1',
'pod2text' => '1',
},
removed => {
}
},
5.00307 => {
delta_from => 5.002,
changed => {
'pl2pm' => '1',
},
removed => {
'cppstdin' => 1,
'pstruct' => 1,
}
},
5.004 => {
delta_from => 5.00307,
changed => {
'splain' => '1',
},
removed => {
}
},
5.005 => {
delta_from => 5.00405,
changed => {
'perlcc' => '1',
},
removed => {
}
},
5.00503 => {
delta_from => 5.005,
changed => {
},
removed => {
}
},
5.00405 => {
delta_from => 5.004,
changed => {
},
removed => {
}
},
5.006 => {
delta_from => 5.00504,
changed => {
'dprofpp' => '1',
'pod2usage' => '1',
'podchecker' => '1',
'podselect' => '1',
'pstruct' => '1',
},
removed => {
}
},
5.006001 => {
delta_from => 5.006,
changed => {
},
removed => {
}
},
5.007003 => {
delta_from => 5.006002,
changed => {
'libnetcfg' => '1',
'perlivp' => '1',
'psed' => '1',
'xsubpp' => '1',
},
removed => {
}
},
5.008 => {
delta_from => 5.007003,
changed => {
'enc2xs' => '1',
'piconv' => '1',
},
removed => {
}
},
5.008001 => {
delta_from => 5.008,
changed => {
'cpan' => '1',
},
removed => {
}
},
5.009 => {
delta_from => 5.008009,
changed => {
},
removed => {
'corelist' => 1,
'instmodsh' => 1,
'prove' => 1,
}
},
5.008002 => {
delta_from => 5.008001,
changed => {
},
removed => {
}
},
5.006002 => {
delta_from => 5.006001,
changed => {
},
removed => {
}
},
5.008003 => {
delta_from => 5.008002,
changed => {
'instmodsh' => '1',
'prove' => '1',
},
removed => {
}
},
5.00504 => {
delta_from => 5.00503,
changed => {
},
removed => {
}
},
5.009001 => {
delta_from => 5.009,
changed => {
'instmodsh' => '1',
'prove' => '1',
},
removed => {
}
},
5.008004 => {
delta_from => 5.008003,
changed => {
},
removed => {
}
},
5.008005 => {
delta_from => 5.008004,
changed => {
},
removed => {
}
},
5.008006 => {
delta_from => 5.008005,
changed => {
},
removed => {
}
},
5.009002 => {
delta_from => 5.009001,
changed => {
'corelist' => '1',
},
removed => {
}
},
5.008007 => {
delta_from => 5.008006,
changed => {
},
removed => {
}
},
5.009003 => {
delta_from => 5.009002,
changed => {
'ptar' => '1',
'ptardiff' => '1',
'shasum' => '1',
},
removed => {
}
},
5.008008 => {
delta_from => 5.008007,
changed => {
},
removed => {
}
},
5.009004 => {
delta_from => 5.009003,
changed => {
'config_data' => '1',
},
removed => {
}
},
5.009005 => {
delta_from => 5.009004,
changed => {
'cpan2dist' => '1',
'cpanp' => '1',
'cpanp-run-perl' => '1',
},
removed => {
'perlcc' => 1,
}
},
5.010000 => {
delta_from => 5.009005,
changed => {
},
removed => {
}
},
5.008009 => {
delta_from => 5.008008,
changed => {
'corelist' => '1',
},
removed => {
}
},
5.010001 => {
delta_from => 5.010000,
changed => {
},
removed => {
}
},
5.011 => {
delta_from => 5.010001,
changed => {
},
removed => {
}
},
5.011001 => {
delta_from => 5.011,
changed => {
},
removed => {
}
},
5.011002 => {
delta_from => 5.011001,
changed => {
'perlthanks' => '1',
},
removed => {
}
},
5.011003 => {
delta_from => 5.011002,
changed => {
},
removed => {
}
},
5.011004 => {
delta_from => 5.011003,
changed => {
},
removed => {
}
},
5.011005 => {
delta_from => 5.011004,
changed => {
},
removed => {
}
},
5.012 => {
delta_from => 5.011005,
changed => {
},
removed => {
}
},
5.013 => {
delta_from => 5.012005,
changed => {
},
removed => {
}
},
5.012001 => {
delta_from => 5.012,
changed => {
},
removed => {
}
},
5.013001 => {
delta_from => 5.013,
changed => {
},
removed => {
}
},
5.013002 => {
delta_from => 5.013001,
changed => {
},
removed => {
}
},
5.013003 => {
delta_from => 5.013002,
changed => {
},
removed => {
}
},
5.013004 => {
delta_from => 5.013003,
changed => {
},
removed => {
}
},
5.012002 => {
delta_from => 5.012001,
changed => {
},
removed => {
}
},
5.013005 => {
delta_from => 5.013004,
changed => {
},
removed => {
}
},
5.013006 => {
delta_from => 5.013005,
changed => {
},
removed => {
}
},
5.013007 => {
delta_from => 5.013006,
changed => {
'ptargrep' => '1',
},
removed => {
}
},
5.013008 => {
delta_from => 5.013007,
changed => {
},
removed => {
}
},
5.013009 => {
delta_from => 5.013008,
changed => {
'json_pp' => '1',
},
removed => {
}
},
5.012003 => {
delta_from => 5.012002,
changed => {
},
removed => {
}
},
5.013010 => {
delta_from => 5.013009,
changed => {
},
removed => {
}
},
5.013011 => {
delta_from => 5.013010,
changed => {
},
removed => {
}
},
5.014 => {
delta_from => 5.013011,
changed => {
},
removed => {
}
},
5.014001 => {
delta_from => 5.014,
changed => {
},
removed => {
}
},
5.015 => {
delta_from => 5.014004,
changed => {
},
removed => {
'dprofpp' => 1,
}
},
5.012004 => {
delta_from => 5.012003,
changed => {
},
removed => {
}
},
5.015001 => {
delta_from => 5.015,
changed => {
},
removed => {
}
},
5.015002 => {
delta_from => 5.015001,
changed => {
},
removed => {
}
},
5.015003 => {
delta_from => 5.015002,
changed => {
},
removed => {
}
},
5.014002 => {
delta_from => 5.014001,
changed => {
},
removed => {
}
},
5.015004 => {
delta_from => 5.015003,
changed => {
},
removed => {
}
},
5.015005 => {
delta_from => 5.015004,
changed => {
},
removed => {
}
},
5.015006 => {
delta_from => 5.015005,
changed => {
'zipdetails' => '1',
},
removed => {
}
},
5.015007 => {
delta_from => 5.015006,
changed => {
},
removed => {
}
},
5.015008 => {
delta_from => 5.015007,
changed => {
},
removed => {
}
},
5.015009 => {
delta_from => 5.015008,
changed => {
},
removed => {
}
},
5.016 => {
delta_from => 5.015009,
changed => {
},
removed => {
}
},
5.017 => {
delta_from => 5.016003,
changed => {
},
removed => {
}
},
5.017001 => {
delta_from => 5.017,
changed => {
},
removed => {
}
},
5.017002 => {
delta_from => 5.017001,
changed => {
},
removed => {
}
},
5.016001 => {
delta_from => 5.016,
changed => {
},
removed => {
}
},
5.017003 => {
delta_from => 5.017002,
changed => {
},
removed => {
}
},
5.017004 => {
delta_from => 5.017003,
changed => {
},
removed => {
}
},
5.014003 => {
delta_from => 5.014002,
changed => {
},
removed => {
}
},
5.017005 => {
delta_from => 5.017004,
changed => {
},
removed => {
}
},
5.016002 => {
delta_from => 5.016001,
changed => {
},
removed => {
}
},
5.012005 => {
delta_from => 5.012004,
changed => {
},
removed => {
}
},
5.017006 => {
delta_from => 5.017005,
changed => {
},
removed => {
}
},
5.017007 => {
delta_from => 5.017006,
changed => {
},
removed => {
}
},
5.017008 => {
delta_from => 5.017007,
changed => {
},
removed => {
}
},
5.017009 => {
delta_from => 5.017008,
changed => {
},
removed => {
}
},
5.014004 => {
delta_from => 5.014003,
changed => {
},
removed => {
}
},
5.016003 => {
delta_from => 5.016002,
changed => {
},
removed => {
}
},
5.017010 => {
delta_from => 5.017009,
changed => {
},
removed => {
}
},
5.017011 => {
delta_from => 5.017010,
changed => {
},
removed => {
}
},
5.018000 => {
delta_from => 5.017011,
changed => {
},
removed => {
}
},
5.018001 => {
delta_from => 5.018000,
changed => {
},
removed => {
}
},
5.018002 => {
delta_from => 5.018001,
changed => {
},
removed => {
}
},
5.019000 => {
delta_from => 5.018000,
changed => {
},
removed => {
'cpan2dist' => '1',
'cpanp' => '1',
'cpanp-run-perl' => '1',
'pod2latex' => '1',
}
},
5.019001 => {
delta_from => 5.019000,
changed => {
},
removed => {
}
},
5.019002 => {
delta_from => 5.019001,
changed => {
},
removed => {
}
},
5.019003 => {
delta_from => 5.019002,
changed => {
},
removed => {
}
},
5.019004 => {
delta_from => 5.019003,
changed => {
},
removed => {
}
},
5.019005 => {
delta_from => 5.019004,
changed => {
},
removed => {
}
},
5.019006 => {
delta_from => 5.019005,
changed => {
},
removed => {
}
},
5.019007 => {
delta_from => 5.019006,
changed => {
},
removed => {
}
},
);
for my $version (sort { $a <=> $b } keys %delta) {
my $data = $delta{$version};
tie %{$utilities{$version}}, 'Module::CoreList::TieHashDelta',
$data->{changed}, $data->{removed},
$data->{delta_from} ? $utilities{$data->{delta_from}} : undef;
}
# Create aliases with trailing zeros for $] use
$utilities{'5.000'} = $utilities{5};
_create_aliases(\%utilities);
sub _create_aliases {
my ($hash) = @_;
for my $version (keys %$hash) {
next unless $version >= 5.010;
my $padded = sprintf "%0.6f", $version;
# If the version in string form isn't the same as the numeric version,
# alias it.
if ($padded ne $version && $version == $padded) {
$hash->{$padded} = $hash->{$version};
}
}
}
'foo';
=pod
=head1 NAME
Module::CoreList::Utils - what utilities shipped with versions of perl
=head1 SYNOPSIS
use Module::CoreList::Utils;
print $Module::CoreList::Utils::utilities{5.009003}{ptar}; # prints 1
print Module::CoreList::Utils->first_release('corelist'); # prints 5.008009
print Module::CoreList::Utils->first_release_by_date('corelist'); # prints 5.009002
=head1 DESCRIPTION
Module::CoreList::Utils provides information on which core and dual-life utilities shipped
with each version of L<perl>.
It provides a number of mechanisms for querying this information.
There is a functional programming API available for programmers to query
information.
Programmers may also query the contained hash structure to find relevant
information.
=head1 FUNCTIONS API
These are the functions that are available, they may either be called as functions or class methods:
Module::CoreList::Utils::first_release('corelist'); # as a function
Module::CoreList::Utils->first_release('corelist'); # class method
=over
=item C<utilities>
Requires a perl version as an argument, returns a list of utilities that shipped with
that version of perl, or undef/empty list if that perl doesn't exist.
=item C<first_release( UTILITY )>
Requires a UTILITY name as an argument, returns the perl version when that utility first
appeared in core as ordered by perl version number or undef ( in scalar context )
or an empty list ( in list context ) if that utility is not in core.
=item C<first_release_by_date( UTILITY )>
Requires a UTILITY name as an argument, returns the perl version when that utility first
appeared in core as ordered by release date or undef ( in scalar context )
or an empty list ( in list context ) if that utility is not in core.
=item C<removed_from( UTILITY )>
Takes a UTILITY name as an argument, returns the first perl version where that utility
was removed from core. Returns undef if the given utility was never in core or remains
in core.
=item C<removed_from_by_date( UTILITY )>
Takes a UTILITY name as an argument, returns the first perl version by release date where that
utility was removed from core. Returns undef if the given utility was never in core or remains
in core.
=back
=head1 DATA STRUCTURES
These are the hash data structures that are available:
=over
=item C<%Module::CoreList::Utils::utilities>
A hash of hashes that is keyed on perl version as indicated
in $]. The second level hash is utility / defined pairs.
=back
=head1 AUTHOR
Chris C<BinGOs> Williams <chris@bingosnet.co.uk>
Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>.
This module is the result of archaeology undertaken during QA Hackathon
in Lancaster, April 2013.
=head1 LICENSE
Copyright (C) 2013 Chris Williams. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 SEE ALSO
L<corelist>, L<Module::CoreList>, L<perl>, L<http://perlpunks.de/corelist>
=cut
| Bjay1435/capstone | rootfs/usr/share/perl/5.18.2/Module/CoreList/Utils.pm | Perl | mit | 19,693 |
use v6;
# Specification:
# P22 (*) Create a list containing all integers within a given range.
# If first argument is smaller than second, produce a list in
# decreasing order.
# Example:
# > say ~range(4, 9);
# 4 5 6 7 8 9
# a. Simple version - but only works in order
say ~list(4 .. 9);
# b. Try reverse
# Simple check on arguments
# Then just reverse the forward version of the list
sub range($a, $b) {
if ($a > $b) {
return list($b .. $a).reverse;
}
return list($a .. $b);
}
say ~range(4, 9);
say ~range(7, 2);
| Mitali-Sodhi/CodeLingo | Dataset/perl/P22-scottp.pl | Perl | mit | 545 |
package Google::Ads::AdWords::v201409::DisplayAdSpec::ActivationOption;
use strict;
use warnings;
sub get_xmlns { 'https://adwords.google.com/api/adwords/o/v201409'};
# derivation by restriction
use base qw(
SOAP::WSDL::XSD::Typelib::Builtin::string);
1;
__END__
=pod
=head1 NAME
=head1 DESCRIPTION
Perl data type class for the XML Schema defined simpleType
DisplayAdSpec.ActivationOption from the namespace https://adwords.google.com/api/adwords/o/v201409.
Activation options. Describes the ad's activated mode.
This clase is derived from
SOAP::WSDL::XSD::Typelib::Builtin::string
. SOAP::WSDL's schema implementation does not validate data, so you can use it exactly
like it's base type.
# Description of restrictions not implemented yet.
=head1 METHODS
=head2 new
Constructor.
=head2 get_value / set_value
Getter and setter for the simpleType's value.
=head1 OVERLOADING
Depending on the simple type's base type, the following operations are overloaded
Stringification
Numerification
Boolification
Check L<SOAP::WSDL::XSD::Typelib::Builtin> for more information.
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
| gitpan/GOOGLE-ADWORDS-PERL-CLIENT | lib/Google/Ads/AdWords/v201409/DisplayAdSpec/ActivationOption.pm | Perl | apache-2.0 | 1,152 |
#
# Copyright 2017 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::exagrid::snmp::mode::serverusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
my $instance_mode;
sub custom_status_threshold {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'Server Status : ' . $self->{result_values}->{status};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
return 0;
}
sub custom_usage_perfdata {
my ($self, %options) = @_;
my $label = 'used';
my $value_perf = $self->{result_values}->{used};
my %total_options = ( total => $self->{result_values}->{total}, cast_int => 1);
$self->{output}->perfdata_add(label => $self->{result_values}->{label} . '_' . $label, unit => 'B',
value => $value_perf,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
min => 0, max => $self->{result_values}->{total});
}
sub custom_usage_threshold {
my ($self, %options) = @_;
my $exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{prct_used}, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
return $exit;
}
sub custom_usage_output {
my ($self, %options) = @_;
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
my $msg = sprintf("%s Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
ucfirst($self->{result_values}->{label}),
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
return $msg;
}
sub custom_usage_calc {
my ($self, %options) = @_;
$self->{result_values}->{label} = $options{extra_options}->{label_ref};
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_' . $self->{result_values}->{label} . '_total'};
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_' . $self->{result_values}->{label} . '_used'};
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'server', type => 0, message_separator => ' - ' },
];
$self->{maps_counters}->{server} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_status_threshold'),
}
},
{ label => 'landing-usage', set => {
key_values => [ { name => 'landing_used' }, { name => 'landing_total' } ],
closure_custom_calc => $self->can('custom_usage_calc'), closure_custom_calc_extra_options => { label_ref => 'landing' },
closure_custom_output => $self->can('custom_usage_output'),
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
}
},
{ label => 'retention-usage', set => {
key_values => [ { name => 'retention_used' }, { name => 'retention_total' } ],
closure_custom_calc => $self->can('custom_usage_calc'), closure_custom_calc_extra_options => { label_ref => 'retention' },
closure_custom_output => $self->can('custom_usage_output'),
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
}
},
];
}
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-status:s" => { name => 'warning_status', default => '%{status} =~ /warning/i' },
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /error/i' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %map_status = (
1 => 'ok',
2 => 'warning',
3 => 'error',
);
my $mapping = {
egLandingSpaceConfiguredWholeGigabytes => { oid => '.1.3.6.1.4.1.14941.4.1.1' },
egLandingSpaceAvailableWholeGigabytes => { oid => '.1.3.6.1.4.1.14941.4.1.3' },
egRetentionSpaceConfiguredWholeGigabytes => { oid => '.1.3.6.1.4.1.14941.4.2.1' },
egRetentionSpaceAvailableWholeGigabytes => { oid => '.1.3.6.1.4.1.14941.4.2.3' },
egServerAlarmState => { oid => '.1.3.6.1.4.1.14941.4.6.1', map => \%map_status },
};
my $oid_exagridServerData = '.1.3.6.1.4.1.14941.4';
sub manage_selection {
my ($self, %options) = @_;
my $results = $options{snmp}->get_table(oid => $oid_exagridServerData,
nothing_quit => 1);
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $results, instance => '0');
$self->{server} = {
status => $result->{egServerAlarmState},
retention_total => $result->{egRetentionSpaceConfiguredWholeGigabytes} * 1000 * 1000 * 1000,
retention_used => $result->{egRetentionSpaceConfiguredWholeGigabytes} * 1000 * 1000 * 1000 - $result->{egLandingSpaceAvailableWholeGigabytes} * 1000 * 1000 * 1000,
landing_total => $result->{egRetentionSpaceConfiguredWholeGigabytes} * 1000 * 1000 * 1000,
landing_used => $result->{egRetentionSpaceConfiguredWholeGigabytes} * 1000 * 1000 * 1000 - $result->{egRetentionSpaceAvailableWholeGigabytes} * 1000 * 1000 * 1000,
};
}
1;
__END__
=head1 MODE
Check server status and usage.
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^status$'
=item B<--warning-status>
Set warning threshold for status (Default: '%{status} =~ /warning/i').
Can used special variables like: %{status}
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} =~ /error/i').
Can used special variables like: %{status}
=item B<--warning-*>
Threshold warning.
Can be: 'retention-usage' (%), 'landing-usage' (%).
=item B<--critical-*>
Threshold critical.
Can be: 'retention-usage' (%), 'landing-usage' (%).
=back
=cut
| Shini31/centreon-plugins | storage/exagrid/snmp/mode/serverusage.pm | Perl | apache-2.0 | 9,780 |
#!/usr/bin/env perl -w
# This script generates licence.h (containing the PuTTY licence in the
# form of macros expanding to C string literals) from the LICENCE
# master file. It also regenerates the licence-related Halibut input
# files.
use File::Basename;
# Read the input file.
$infile = "LICENCE";
open my $in, $infile or die "$infile: open: $!\n";
my @lines = ();
while (<$in>) {
chomp;
push @lines, $_;
}
close $in;
# Format into paragraphs.
my @paras = ();
my $para = undef;
for my $line (@lines) {
if ($line eq "") {
$para = undef;
} elsif (!defined $para) {
push @paras, $line;
$para = \$paras[$#paras];
} else {
$$para .= " " . $line;
}
}
# Get the copyright years and short form of copyright holder.
die "bad format of first paragraph\n"
unless $paras[0] =~ m!copyright ([^\.]*)\.!i;
$shortdetails = $1;
# Write out licence.h.
$outfile = "licence.h";
open my $out, ">", $outfile or die "$outfile: open: $!\n";
select $out;
print "/*\n";
print " * $outfile - macro definitions for the PuTTY licence.\n";
print " *\n";
print " * Generated by @{[basename __FILE__]} from $infile.\n";
print " * You should edit those files rather than editing this one.\n";
print " */\n";
print "\n";
print "#define LICENCE_TEXT(parsep) \\\n";
for my $i (0..$#paras) {
my $lit = &stringlit($paras[$i]);
print " parsep \\\n" if $i > 0;
print " \"$lit\"";
print " \\" if $i < $#paras;
print "\n";
}
print "\n";
printf "#define SHORT_COPYRIGHT_DETAILS \"%s\"\n", &stringlit($shortdetails);
sub stringlit {
my ($lit) = @_;
$lit =~ s!\\!\\\\!g;
$lit =~ s!"!\\"!g;
return $lit;
}
close $out;
# Write out doc/licence.but.
$outfile = "doc/licence.but";
open $out, ">", $outfile or die "$outfile: open: $!\n";
select $out;
print "\\# Generated by @{[basename __FILE__]} from $infile.\n";
print "\\# You should edit those files rather than editing this one.\n\n";
print "\\A{licence} PuTTY \\ii{Licence}\n\n";
for my $i (0..$#paras) {
my $para = &halibutescape($paras[$i]);
if ($i == 0) {
$para =~ s!copyright!\\i{copyright}!; # index term in paragraph 1
}
print "$para\n\n";
}
close $out;
# And write out doc/copy.but, which defines a macro used in the manual
# preamble blurb.
$outfile = "doc/copy.but";
open $out, ">", $outfile or die "$outfile: open: $!\n";
select $out;
print "\\# Generated by @{[basename __FILE__]} from $infile.\n";
print "\\# You should edit those files rather than editing this one.\n\n";
printf "\\define{shortcopyrightdetails} %s\n\n",
&halibutescape($shortdetails);
close $out;
sub halibutescape {
my ($text) = @_;
$text =~ s![\\{}]!\\$&!g; # Halibut escaping
$text =~ s!"([^"]*)"!\\q{$1}!g; # convert quoted strings to \q{}
return $text;
}
| Shocker/soft_putty | src/licence.pl | Perl | mit | 2,820 |
# 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 /tmp/ympzZnp0Uq/northamerica. Olson data version 2012c
#
# Do not edit this file directly.
#
package DateTime::TimeZone::Atlantic::Bermuda;
{
$DateTime::TimeZone::Atlantic::Bermuda::VERSION = '1.46';
}
use strict;
use Class::Singleton 1.03;
use DateTime::TimeZone;
use DateTime::TimeZone::OlsonDB;
@DateTime::TimeZone::Atlantic::Bermuda::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' );
my $spans =
[
[
DateTime::TimeZone::NEG_INFINITY,
60873401944,
DateTime::TimeZone::NEG_INFINITY,
60873386400,
-15544,
0,
'LMT'
],
[
60873401944,
62272044000,
60873387544,
62272029600,
-14400,
0,
'AST'
],
[
62272044000,
62287765200,
62272033200,
62287754400,
-10800,
1,
'ADT'
],
[
62287765200,
62303493600,
62287750800,
62303479200,
-14400,
0,
'AST'
],
[
62303493600,
62319214800,
62303482800,
62319204000,
-10800,
1,
'ADT'
],
[
62319214800,
62325000000,
62319200400,
62324985600,
-14400,
0,
'AST'
],
[
62325000000,
62334943200,
62324985600,
62334928800,
-14400,
0,
'AST'
],
[
62334943200,
62351269200,
62334932400,
62351258400,
-10800,
1,
'ADT'
],
[
62351269200,
62366392800,
62351254800,
62366378400,
-14400,
0,
'AST'
],
[
62366392800,
62382718800,
62366382000,
62382708000,
-10800,
1,
'ADT'
],
[
62382718800,
62398447200,
62382704400,
62398432800,
-14400,
0,
'AST'
],
[
62398447200,
62414168400,
62398436400,
62414157600,
-10800,
1,
'ADT'
],
[
62414168400,
62429896800,
62414154000,
62429882400,
-14400,
0,
'AST'
],
[
62429896800,
62445618000,
62429886000,
62445607200,
-10800,
1,
'ADT'
],
[
62445618000,
62461346400,
62445603600,
62461332000,
-14400,
0,
'AST'
],
[
62461346400,
62477067600,
62461335600,
62477056800,
-10800,
1,
'ADT'
],
[
62477067600,
62492796000,
62477053200,
62492781600,
-14400,
0,
'AST'
],
[
62492796000,
62508517200,
62492785200,
62508506400,
-10800,
1,
'ADT'
],
[
62508517200,
62524245600,
62508502800,
62524231200,
-14400,
0,
'AST'
],
[
62524245600,
62540571600,
62524234800,
62540560800,
-10800,
1,
'ADT'
],
[
62540571600,
62555695200,
62540557200,
62555680800,
-14400,
0,
'AST'
],
[
62555695200,
62572021200,
62555684400,
62572010400,
-10800,
1,
'ADT'
],
[
62572021200,
62587749600,
62572006800,
62587735200,
-14400,
0,
'AST'
],
[
62587749600,
62603470800,
62587738800,
62603460000,
-10800,
1,
'ADT'
],
[
62603470800,
62619199200,
62603456400,
62619184800,
-14400,
0,
'AST'
],
[
62619199200,
62634920400,
62619188400,
62634909600,
-10800,
1,
'ADT'
],
[
62634920400,
62650648800,
62634906000,
62650634400,
-14400,
0,
'AST'
],
[
62650648800,
62666370000,
62650638000,
62666359200,
-10800,
1,
'ADT'
],
[
62666370000,
62680284000,
62666355600,
62680269600,
-14400,
0,
'AST'
],
[
62680284000,
62697819600,
62680273200,
62697808800,
-10800,
1,
'ADT'
],
[
62697819600,
62711733600,
62697805200,
62711719200,
-14400,
0,
'AST'
],
[
62711733600,
62729874000,
62711722800,
62729863200,
-10800,
1,
'ADT'
],
[
62729874000,
62743183200,
62729859600,
62743168800,
-14400,
0,
'AST'
],
[
62743183200,
62761323600,
62743172400,
62761312800,
-10800,
1,
'ADT'
],
[
62761323600,
62774632800,
62761309200,
62774618400,
-14400,
0,
'AST'
],
[
62774632800,
62792773200,
62774622000,
62792762400,
-10800,
1,
'ADT'
],
[
62792773200,
62806687200,
62792758800,
62806672800,
-14400,
0,
'AST'
],
[
62806687200,
62824222800,
62806676400,
62824212000,
-10800,
1,
'ADT'
],
[
62824222800,
62838136800,
62824208400,
62838122400,
-14400,
0,
'AST'
],
[
62838136800,
62855672400,
62838126000,
62855661600,
-10800,
1,
'ADT'
],
[
62855672400,
62869586400,
62855658000,
62869572000,
-14400,
0,
'AST'
],
[
62869586400,
62887726800,
62869575600,
62887716000,
-10800,
1,
'ADT'
],
[
62887726800,
62901036000,
62887712400,
62901021600,
-14400,
0,
'AST'
],
[
62901036000,
62919176400,
62901025200,
62919165600,
-10800,
1,
'ADT'
],
[
62919176400,
62932485600,
62919162000,
62932471200,
-14400,
0,
'AST'
],
[
62932485600,
62950626000,
62932474800,
62950615200,
-10800,
1,
'ADT'
],
[
62950626000,
62964540000,
62950611600,
62964525600,
-14400,
0,
'AST'
],
[
62964540000,
62982075600,
62964529200,
62982064800,
-10800,
1,
'ADT'
],
[
62982075600,
62995989600,
62982061200,
62995975200,
-14400,
0,
'AST'
],
[
62995989600,
63013525200,
62995978800,
63013514400,
-10800,
1,
'ADT'
],
[
63013525200,
63027439200,
63013510800,
63027424800,
-14400,
0,
'AST'
],
[
63027439200,
63044974800,
63027428400,
63044964000,
-10800,
1,
'ADT'
],
[
63044974800,
63058888800,
63044960400,
63058874400,
-14400,
0,
'AST'
],
[
63058888800,
63077029200,
63058878000,
63077018400,
-10800,
1,
'ADT'
],
[
63077029200,
63090338400,
63077014800,
63090324000,
-14400,
0,
'AST'
],
[
63090338400,
63108478800,
63090327600,
63108468000,
-10800,
1,
'ADT'
],
[
63108478800,
63121788000,
63108464400,
63121773600,
-14400,
0,
'AST'
],
[
63121788000,
63139928400,
63121777200,
63139917600,
-10800,
1,
'ADT'
],
[
63139928400,
63153842400,
63139914000,
63153828000,
-14400,
0,
'AST'
],
[
63153842400,
63171378000,
63153831600,
63171367200,
-10800,
1,
'ADT'
],
[
63171378000,
63185292000,
63171363600,
63185277600,
-14400,
0,
'AST'
],
[
63185292000,
63202827600,
63185281200,
63202816800,
-10800,
1,
'ADT'
],
[
63202827600,
63216741600,
63202813200,
63216727200,
-14400,
0,
'AST'
],
[
63216741600,
63234882000,
63216730800,
63234871200,
-10800,
1,
'ADT'
],
[
63234882000,
63248191200,
63234867600,
63248176800,
-14400,
0,
'AST'
],
[
63248191200,
63266331600,
63248180400,
63266320800,
-10800,
1,
'ADT'
],
[
63266331600,
63279640800,
63266317200,
63279626400,
-14400,
0,
'AST'
],
[
63279640800,
63297781200,
63279630000,
63297770400,
-10800,
1,
'ADT'
],
[
63297781200,
63309276000,
63297766800,
63309261600,
-14400,
0,
'AST'
],
[
63309276000,
63329835600,
63309265200,
63329824800,
-10800,
1,
'ADT'
],
[
63329835600,
63340725600,
63329821200,
63340711200,
-14400,
0,
'AST'
],
[
63340725600,
63361285200,
63340714800,
63361274400,
-10800,
1,
'ADT'
],
[
63361285200,
63372175200,
63361270800,
63372160800,
-14400,
0,
'AST'
],
[
63372175200,
63392734800,
63372164400,
63392724000,
-10800,
1,
'ADT'
],
[
63392734800,
63404229600,
63392720400,
63404215200,
-14400,
0,
'AST'
],
[
63404229600,
63424789200,
63404218800,
63424778400,
-10800,
1,
'ADT'
],
[
63424789200,
63435679200,
63424774800,
63435664800,
-14400,
0,
'AST'
],
[
63435679200,
63456238800,
63435668400,
63456228000,
-10800,
1,
'ADT'
],
[
63456238800,
63467128800,
63456224400,
63467114400,
-14400,
0,
'AST'
],
[
63467128800,
63487688400,
63467118000,
63487677600,
-10800,
1,
'ADT'
],
[
63487688400,
63498578400,
63487674000,
63498564000,
-14400,
0,
'AST'
],
[
63498578400,
63519138000,
63498567600,
63519127200,
-10800,
1,
'ADT'
],
[
63519138000,
63530028000,
63519123600,
63530013600,
-14400,
0,
'AST'
],
[
63530028000,
63550587600,
63530017200,
63550576800,
-10800,
1,
'ADT'
],
[
63550587600,
63561477600,
63550573200,
63561463200,
-14400,
0,
'AST'
],
[
63561477600,
63582037200,
63561466800,
63582026400,
-10800,
1,
'ADT'
],
[
63582037200,
63593532000,
63582022800,
63593517600,
-14400,
0,
'AST'
],
[
63593532000,
63614091600,
63593521200,
63614080800,
-10800,
1,
'ADT'
],
[
63614091600,
63624981600,
63614077200,
63624967200,
-14400,
0,
'AST'
],
[
63624981600,
63645541200,
63624970800,
63645530400,
-10800,
1,
'ADT'
],
[
63645541200,
63656431200,
63645526800,
63656416800,
-14400,
0,
'AST'
],
[
63656431200,
63676990800,
63656420400,
63676980000,
-10800,
1,
'ADT'
],
[
63676990800,
63687880800,
63676976400,
63687866400,
-14400,
0,
'AST'
],
[
63687880800,
63708440400,
63687870000,
63708429600,
-10800,
1,
'ADT'
],
[
63708440400,
63719330400,
63708426000,
63719316000,
-14400,
0,
'AST'
],
[
63719330400,
63739890000,
63719319600,
63739879200,
-10800,
1,
'ADT'
],
[
63739890000,
63751384800,
63739875600,
63751370400,
-14400,
0,
'AST'
],
[
63751384800,
63771944400,
63751374000,
63771933600,
-10800,
1,
'ADT'
],
[
63771944400,
63782834400,
63771930000,
63782820000,
-14400,
0,
'AST'
],
[
63782834400,
63803394000,
63782823600,
63803383200,
-10800,
1,
'ADT'
],
[
63803394000,
63814284000,
63803379600,
63814269600,
-14400,
0,
'AST'
],
[
63814284000,
63834843600,
63814273200,
63834832800,
-10800,
1,
'ADT'
],
];
sub olson_version { '2012c' }
sub has_dst_changes { 50 }
sub _max_year { 2022 }
sub _new_instance
{
return shift->_init( @_, spans => $spans );
}
sub _last_offset { -14400 }
my $last_observance = bless( {
'format' => 'A%sT',
'gmtoff' => '-4:00',
'local_start_datetime' => bless( {
'formatter' => undef,
'local_rd_days' => 721354,
'local_rd_secs' => 0,
'offset_modifier' => 0,
'rd_nanosecs' => 0,
'tz' => bless( {
'name' => 'floating',
'offset' => 0
}, 'DateTime::TimeZone::Floating' ),
'utc_rd_days' => 721354,
'utc_rd_secs' => 0,
'utc_year' => 1977
}, 'DateTime' ),
'offset_from_std' => 0,
'offset_from_utc' => -14400,
'until' => [],
'utc_start_datetime' => bless( {
'formatter' => undef,
'local_rd_days' => 721354,
'local_rd_secs' => 14400,
'offset_modifier' => 0,
'rd_nanosecs' => 0,
'tz' => bless( {
'name' => 'floating',
'offset' => 0
}, 'DateTime::TimeZone::Floating' ),
'utc_rd_days' => 721354,
'utc_rd_secs' => 14400,
'utc_year' => 1977
}, 'DateTime' )
}, 'DateTime::TimeZone::OlsonDB::Observance' )
;
sub _last_observance { $last_observance }
my $rules = [
bless( {
'at' => '2:00',
'from' => '2007',
'in' => 'Nov',
'letter' => 'S',
'name' => 'US',
'offset_from_std' => 0,
'on' => 'Sun>=1',
'save' => '0',
'to' => 'max',
'type' => undef
}, 'DateTime::TimeZone::OlsonDB::Rule' ),
bless( {
'at' => '2:00',
'from' => '2007',
'in' => 'Mar',
'letter' => 'D',
'name' => 'US',
'offset_from_std' => 3600,
'on' => 'Sun>=8',
'save' => '1:00',
'to' => 'max',
'type' => undef
}, 'DateTime::TimeZone::OlsonDB::Rule' )
]
;
sub _rules { $rules }
1;
| leighpauls/k2cro4 | third_party/perl/perl/vendor/lib/DateTime/TimeZone/Atlantic/Bermuda.pm | Perl | bsd-3-clause | 10,797 |
#-----------------------------------------------------------
# disablelastaccess.pl
#
# References:
# http://support.microsoft.com/kb/555041
# http://support.microsoft.com/kb/894372
#
# copyright 2008 H. Carvey, keydet89@yahoo.com
#-----------------------------------------------------------
package disablelastaccess;
use strict;
my %config = (hive => "System",
osmask => 22,
hasShortDescr => 1,
hasDescr => 0,
hasRefs => 0,
version => 20090118);
sub getConfig{return %config}
sub getShortDescr {
return "Get NTFSDisableLastAccessUpdate value";
}
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 disablelastaccess v.".$VERSION);
::rptMsg("disablelastaccess v.".$VERSION); # banner
::rptMsg("(".$config{hive}.") ".getShortDescr()."\n"); # banner
my $reg = Parse::Win32Registry->new($hive);
my $root_key = $reg->get_root_key;
# Code for System file, getting CurrentControlSet
my $current;
my $key_path = 'Select';
my $key;
my $ccs;
if ($key = $root_key->get_subkey($key_path)) {
$current = $key->get_value("Current")->get_data();
$ccs = "ControlSet00".$current;
}
$key_path = $ccs."\\Control\\FileSystem";
if ($key = $root_key->get_subkey($key_path)) {
::rptMsg("NtfsDisableLastAccessUpdate");
::rptMsg($key_path);
my @vals = $key->get_list_of_values();
my $found = 0;
if (scalar(@vals) > 0) {
foreach my $v (@vals) {
if ($v->get_name() eq "NtfsDisableLastAccessUpdate") {
::rptMsg("NtfsDisableLastAccessUpdate = ".$v->get_data());
$found = 1;
}
}
::rptMsg("NtfsDisableLastAccessUpdate value not found.") if ($found == 0);
}
else {
::rptMsg($key_path." has no values.");
}
}
else {
::rptMsg($key_path." not found.");
}
}
1;
| APriestman/autopsy | thirdparty/rr-full/plugins/disablelastaccess.pl | Perl | apache-2.0 | 1,976 |
package Pod::Perldoc::ToTk;
use strict;
use warnings;
use vars qw($VERSION);
$VERSION = '3.17';
use parent qw(Pod::Perldoc::BaseTo);
sub is_pageable { 1 }
sub write_with_binmode { 0 }
sub output_extension { 'txt' } # doesn't matter
sub if_zero_length { } # because it will be 0-length!
sub new { return bless {}, ref($_[0]) || $_[0] }
# TODO: document these and their meanings...
sub tree { shift->_perldoc_elem('tree' , @_) }
sub tk_opt { shift->_perldoc_elem('tk_opt' , @_) }
sub forky { shift->_perldoc_elem('forky' , @_) }
use Pod::Perldoc ();
use File::Spec::Functions qw(catfile);
BEGIN{ # Tk is not core, but this is
eval { require Tk } ||
__PACKAGE__->die( <<"HERE" );
You must have the Tk module to use Pod::Perldoc::ToTk.
If you have it installed, ensure it's in your Perl library
path.
HERE
__PACKAGE__->die(
__PACKAGE__,
" doesn't work nice with Tk.pm version $Tk::VERSION"
) if $Tk::VERSION eq '800.003';
}
BEGIN { eval { require Tk::FcyEntry; }; };
BEGIN{ # Tk::Pod is not core, but this is
eval { require Tk::Pod } ||
__PACKAGE__->die( <<"HERE" );
You must have the Tk::Pod module to use Pod::Perldoc::ToTk.
If you have it installed, ensure it's in your Perl library
path.
HERE
}
# The following was adapted from "tkpod" in the Tk-Pod dist.
sub parse_from_file {
my($self, $Input_File) = @_;
if($self->{'forky'}) {
return if fork; # i.e., parent process returns
}
$Input_File =~ s{\\}{/}g
if $self->is_mswin32 or $self->is_dos
# and maybe OS/2
;
my($tk_opt, $tree);
$tree = $self->{'tree' };
$tk_opt = $self->{'tk_opt'};
#require Tk::ErrorDialog;
# Add 'Tk' subdirectories to search path so, e.g.,
# 'Scrolled' will find doc in 'Tk/Scrolled'
if( $tk_opt ) {
push @INC, grep -d $_, map catfile($_,'Tk'), @INC;
}
my $mw = MainWindow->new();
#eval 'use blib "/home/e/eserte/src/perl/Tk-App";require Tk::App::Debug';
$mw->withdraw;
# CDE use Font Settings if available
my $ufont = $mw->optionGet('userFont','UserFont'); # fixed width
my $sfont = $mw->optionGet('systemFont','SystemFont'); # proportional
if (defined($ufont) and defined($sfont)) {
foreach ($ufont, $sfont) { s/:$//; };
$mw->optionAdd('*Font', $sfont);
$mw->optionAdd('*Entry.Font', $ufont);
$mw->optionAdd('*Text.Font', $ufont);
}
$mw->optionAdd('*Menu.tearOff', $Tk::platform ne 'MSWin32' ? 1 : 0);
$mw->Pod(
'-file' => $Input_File,
(($Tk::Pod::VERSION >= 4) ? ('-tree' => $tree) : ())
)->focusNext;
# xxx dirty but it works. A simple $mw->destroy if $mw->children
# does not work because Tk::ErrorDialogs could be created.
# (they are withdrawn after Ok instead of destory'ed I guess)
if ($mw->children) {
$mw->repeat(1000, sub {
# ErrorDialog is withdrawn not deleted :-(
foreach ($mw->children) {
return if "$_" =~ /^Tk::Pod/ # ->isa('Tk::Pod')
}
$mw->destroy;
});
} else {
$mw->destroy;
}
#$mw->WidgetDump;
MainLoop();
exit if $self->{'forky'}; # we were the child! so exit now!
return;
}
1;
__END__
=head1 NAME
Pod::Perldoc::ToTk - let Perldoc use Tk::Pod to render Pod
=head1 SYNOPSIS
perldoc -o tk Some::Modulename &
=head1 DESCRIPTION
This is a "plug-in" class that allows Perldoc to use
Tk::Pod as a formatter class.
You have to have installed Tk::Pod first, or this class won't load.
=head1 SEE ALSO
L<Tk::Pod>, L<Pod::Perldoc>
=head1 AUTHOR
Current maintainer: Mark Allen C<< <mallen@cpan.org> >>
Past contributions from:
brian d foy C<< <bdfoy@cpan.org> >>
Adriano R. Ferreira C<< <ferreira@cpan.org> >>;
Sean M. Burke C<< <sburke@cpan.org> >>;
significant portions copied from
F<tkpod> in the Tk::Pod dist, by Nick Ing-Simmons, Slaven Rezic, et al.
=cut
| leighpauls/k2cro4 | third_party/perl/perl/lib/Pod/Perldoc/ToTk.pm | Perl | bsd-3-clause | 4,000 |
##
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
##
## This program is distributed under the terms and conditions of the GNU
## General Public License Version 2 as published by the Free Software
## Foundation or, at your option, any later version.
my %regex = (
extname => qr/^[A-Z][A-Za-z0-9_]+$/,
exturl => qr/^http.+$/,
function => qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)$/i,
token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+|[A-Z][A-Z0-9_]*)$/,
type => qr/^typedef\s+(.+)$/,
exact => qr/.*;$/,
);
# prefix function name with glew
sub prefixname($)
{
my $name = $_[0];
$name =~ s/^(.*?)gl/__$1glew/;
return $name;
}
# prefix function name with glew
sub prefix_varname($)
{
my $name = $_[0];
$name =~ s/^(.*?)GL(X*?)EW/__$1GL$2EW/;
return $name;
}
#---------------------------------------------------------------------------------------
sub make_exact($)
{
my $exact = $_[0];
$exact =~ s/(; |{)/$1\n/g;
return $exact;
}
sub make_separator($)
{
my $extname = $_[0];
my $l = length $extname;
my $s = (71 - $l)/2;
print "/* ";
my $j = 3;
for (my $i = 0; $i < $s; $i++)
{
print "-";
$j++;
}
print " $_[0] ";
$j += $l + 2;
while ($j < 76)
{
print "-";
$j++;
}
print " */\n\n";
}
#---------------------------------------------------------------------------------------
sub parse_ext($)
{
my $filename = shift;
my %functions = ();
my %tokens = ();
my @types = ();
my @exacts = ();
my $extname = ""; # Full extension name GL_FOO_extension
my $exturl = ""; # Info URL
my $extstring = ""; # Relevant extension string
open EXT, "<$filename" or return;
# As of GLEW 1.5.3 the first three lines _must_ be
# the extension name, the URL and the GL extension
# string (which might be different to the name)
#
# For example GL_NV_geometry_program4 is available
# iff GL_NV_gpu_program4 appears in the extension
# string.
#
# For core OpenGL versions, the third line should
# be blank.
#
# If the URL is unknown, the second line should be
# blank.
$extname = readline(*EXT);
$exturl = readline(*EXT);
$extstring = readline(*EXT);
chomp($extname);
chomp($exturl);
chomp($extstring);
while(<EXT>)
{
chomp;
if (s/^\s+//)
{
if (/$regex{exact}/)
{
push @exacts, $_;
}
elsif (/$regex{type}/)
{
push @types, $_;
}
elsif (/$regex{token}/)
{
my ($name, $value) = ($1, $2);
$tokens{$name} = $value;
}
elsif (/$regex{function}/)
{
my ($return, $name, $parms) = ($1, $2, $3);
$functions{$name} = {
rtype => $return,
parms => $parms,
};
} else {
print STDERR "'$_' matched no regex.\n";
}
}
}
close EXT;
return ($extname, $exturl, $extstring, \@types, \%tokens, \%functions, \@exacts);
}
sub output_tokens($$)
{
my ($tbl, $fnc) = @_;
if (keys %{$tbl})
{
local $, = "\n";
print "\n";
print map { &{$fnc}($_, $tbl->{$_}) } sort {
if (${$tbl}{$a} eq ${$tbl}{$b}) {
$a cmp $b
} else {
if (${$tbl}{$a} =~ /_/) {
if (${$tbl}{$b} =~ /_/) {
$a cmp $b
} else {
-1
}
} else {
if (${$tbl}{$b} =~ /_/) {
1
} else {
if (hex ${$tbl}{$a} eq hex ${$tbl}{$b}) {
$a cmp $b
} else {
hex ${$tbl}{$a} <=> hex ${$tbl}{$b}
}
}
}
}
} keys %{$tbl};
print "\n";
} else {
print STDERR "no keys in table!\n";
}
}
sub output_types($$)
{
my ($tbl, $fnc) = @_;
if (scalar @{$tbl})
{
local $, = "\n";
print "\n";
print map { &{$fnc}($_) } sort @{$tbl};
print "\n";
}
}
sub output_decls($$)
{
my ($tbl, $fnc) = @_;
if (keys %{$tbl})
{
local $, = "\n";
print "\n";
print map { &{$fnc}($_, $tbl->{$_}) } sort keys %{$tbl};
print "\n";
}
}
sub output_exacts($$)
{
my ($tbl, $fnc) = @_;
if (scalar @{$tbl})
{
local $, = "\n";
print "\n";
print map { &{$fnc}($_) } sort @{$tbl};
print "\n";
}
}
| Khouderchah-Alex/tetrad-engine | src/external/glew/auto/bin/make.pl | Perl | apache-2.0 | 5,095 |
###########################################################################
#
# This file is auto-generated by the Perl DateTime Suite locale
# generator (0.05). This code generator comes with the
# DateTime::Locale distribution in the tools/ directory, and is called
# generate-from-cldr.
#
# This file as generated from the CLDR XML locale data. See the
# LICENSE.cldr file included in this distribution for license details.
#
# This file was generated from the source file rw_RW.xml
# The source file version number was 1.15, generated on
# 2009/05/05 23:06:39.
#
# Do not edit this file directly.
#
###########################################################################
package DateTime::Locale::rw_RW;
use strict;
use warnings;
use utf8;
use base 'DateTime::Locale::rw';
sub cldr_version { return "1\.7\.1" }
{
my $first_day_of_week = "1";
sub first_day_of_week { return $first_day_of_week }
}
{
my $glibc_date_format = "\%d\.\%m\.\%Y";
sub glibc_date_format { return $glibc_date_format }
}
{
my $glibc_date_1_format = "\%a\ \%b\ \%e\ \%H\:\%M\:\%S\ \%Z\ \%Y";
sub glibc_date_1_format { return $glibc_date_1_format }
}
{
my $glibc_datetime_format = "\%a\ \%d\ \%b\ \%Y\ \%T\ \%Z";
sub glibc_datetime_format { return $glibc_datetime_format }
}
{
my $glibc_time_format = "\%T";
sub glibc_time_format { return $glibc_time_format }
}
1;
__END__
=pod
=encoding utf8
=head1 NAME
DateTime::Locale::rw_RW
=head1 SYNOPSIS
use DateTime;
my $dt = DateTime->now( locale => 'rw_RW' );
print $dt->month_name();
=head1 DESCRIPTION
This is the DateTime locale package for Kinyarwanda Rwanda.
=head1 DATA
This locale inherits from the L<DateTime::Locale::rw> locale.
It contains the following data.
=head2 Days
=head3 Wide (format)
Kuwa mbere
Kuwa kabiri
Kuwa gatatu
Kuwa kane
Kuwa gatanu
Kuwa gatandatu
Ku cyumweru
=head3 Abbreviated (format)
mbe.
kab.
gtu.
kan.
gnu.
gnd.
cyu.
=head3 Narrow (format)
2
3
4
5
6
7
1
=head3 Wide (stand-alone)
Kuwa mbere
Kuwa kabiri
Kuwa gatatu
Kuwa kane
Kuwa gatanu
Kuwa gatandatu
Ku cyumweru
=head3 Abbreviated (stand-alone)
mbe.
kab.
gtu.
kan.
gnu.
gnd.
cyu.
=head3 Narrow (stand-alone)
2
3
4
5
6
7
1
=head2 Months
=head3 Wide (format)
Mutarama
Gashyantare
Werurwe
Mata
Gicuransi
Kamena
Nyakanga
Kanama
Nzeli
Ukwakira
Ugushyingo
Ukuboza
=head3 Abbreviated (format)
mut.
gas.
wer.
mat.
gic.
kam.
nya.
kan.
nze.
ukw.
ugu.
uku.
=head3 Narrow (format)
1
2
3
4
5
6
7
8
9
10
11
12
=head3 Wide (stand-alone)
Mutarama
Gashyantare
Werurwe
Mata
Gicuransi
Kamena
Nyakanga
Kanama
Nzeli
Ukwakira
Ugushyingo
Ukuboza
=head3 Abbreviated (stand-alone)
mut.
gas.
wer.
mat.
gic.
kam.
nya.
kan.
nze.
ukw.
ugu.
uku.
=head3 Narrow (stand-alone)
1
2
3
4
5
6
7
8
9
10
11
12
=head2 Quarters
=head3 Wide (format)
igihembwe cya mbere
igihembwe cya kabiri
igihembwe cya gatatu
igihembwe cya kane
=head3 Abbreviated (format)
I1
I2
I3
I4
=head3 Narrow (format)
1
2
3
4
=head3 Wide (stand-alone)
igihembwe cya mbere
igihembwe cya kabiri
igihembwe cya gatatu
igihembwe cya kane
=head3 Abbreviated (stand-alone)
I1
I2
I3
I4
=head3 Narrow (stand-alone)
1
2
3
4
=head2 Eras
=head3 Wide
BCE
CE
=head3 Abbreviated
BCE
CE
=head3 Narrow
BCE
CE
=head2 Date Formats
=head3 Full
2008-02-05T18:30:30 = Kuwa kabiri, 2008 Gashyantare 05
1995-12-22T09:05:02 = Kuwa gatanu, 1995 Ukuboza 22
-0010-09-15T04:44:23 = Kuwa gatandatu, -10 Nzeli 15
=head3 Long
2008-02-05T18:30:30 = 2008 Gashyantare 5
1995-12-22T09:05:02 = 1995 Ukuboza 22
-0010-09-15T04:44:23 = -10 Nzeli 15
=head3 Medium
2008-02-05T18:30:30 = 2008 gas. 5
1995-12-22T09:05:02 = 1995 uku. 22
-0010-09-15T04:44:23 = -10 nze. 15
=head3 Short
2008-02-05T18:30:30 = 08/02/05
1995-12-22T09:05:02 = 95/12/22
-0010-09-15T04:44:23 = -10/09/15
=head3 Default
2008-02-05T18:30:30 = 2008 gas. 5
1995-12-22T09:05:02 = 1995 uku. 22
-0010-09-15T04:44:23 = -10 nze. 15
=head2 Time Formats
=head3 Full
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head3 Short
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 09:05
-0010-09-15T04:44:23 = 04:44
=head3 Default
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head2 Datetime Formats
=head3 Full
2008-02-05T18:30:30 = Kuwa kabiri, 2008 Gashyantare 05 18:30:30 UTC
1995-12-22T09:05:02 = Kuwa gatanu, 1995 Ukuboza 22 09:05:02 UTC
-0010-09-15T04:44:23 = Kuwa gatandatu, -10 Nzeli 15 04:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 2008 Gashyantare 5 18:30:30 UTC
1995-12-22T09:05:02 = 1995 Ukuboza 22 09:05:02 UTC
-0010-09-15T04:44:23 = -10 Nzeli 15 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 2008 gas. 5 18:30:30
1995-12-22T09:05:02 = 1995 uku. 22 09:05:02
-0010-09-15T04:44:23 = -10 nze. 15 04:44:23
=head3 Short
2008-02-05T18:30:30 = 08/02/05 18:30
1995-12-22T09:05:02 = 95/12/22 09:05
-0010-09-15T04:44:23 = -10/09/15 04:44
=head3 Default
2008-02-05T18:30:30 = 2008 gas. 5 18:30:30
1995-12-22T09:05:02 = 1995 uku. 22 09:05:02
-0010-09-15T04:44:23 = -10 nze. 15 04:44:23
=head2 Available Formats
=head3 d (d)
2008-02-05T18:30:30 = 5
1995-12-22T09:05:02 = 22
-0010-09-15T04:44:23 = 15
=head3 EEEd (d EEE)
2008-02-05T18:30:30 = 5 kab.
1995-12-22T09:05:02 = 22 gnu.
-0010-09-15T04:44:23 = 15 gnd.
=head3 Hm (H:mm)
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 9:05
-0010-09-15T04:44:23 = 4:44
=head3 hm (h:mm a)
2008-02-05T18:30:30 = 6:30 PM
1995-12-22T09:05:02 = 9:05 AM
-0010-09-15T04:44:23 = 4:44 AM
=head3 Hms (H:mm:ss)
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 9:05:02
-0010-09-15T04:44:23 = 4:44:23
=head3 hms (h:mm:ss a)
2008-02-05T18:30:30 = 6:30:30 PM
1995-12-22T09:05:02 = 9:05:02 AM
-0010-09-15T04:44:23 = 4:44:23 AM
=head3 M (L)
2008-02-05T18:30:30 = 2
1995-12-22T09:05:02 = 12
-0010-09-15T04:44:23 = 9
=head3 Md (M-d)
2008-02-05T18:30:30 = 2-5
1995-12-22T09:05:02 = 12-22
-0010-09-15T04:44:23 = 9-15
=head3 MEd (E, M-d)
2008-02-05T18:30:30 = kab., 2-5
1995-12-22T09:05:02 = gnu., 12-22
-0010-09-15T04:44:23 = gnd., 9-15
=head3 MMM (LLL)
2008-02-05T18:30:30 = gas.
1995-12-22T09:05:02 = uku.
-0010-09-15T04:44:23 = nze.
=head3 MMMd (MMM d)
2008-02-05T18:30:30 = gas. 5
1995-12-22T09:05:02 = uku. 22
-0010-09-15T04:44:23 = nze. 15
=head3 MMMEd (E MMM d)
2008-02-05T18:30:30 = kab. gas. 5
1995-12-22T09:05:02 = gnu. uku. 22
-0010-09-15T04:44:23 = gnd. nze. 15
=head3 MMMMd (MMMM d)
2008-02-05T18:30:30 = Gashyantare 5
1995-12-22T09:05:02 = Ukuboza 22
-0010-09-15T04:44:23 = Nzeli 15
=head3 MMMMEd (E MMMM d)
2008-02-05T18:30:30 = kab. Gashyantare 5
1995-12-22T09:05:02 = gnu. Ukuboza 22
-0010-09-15T04:44:23 = gnd. Nzeli 15
=head3 ms (mm:ss)
2008-02-05T18:30:30 = 30:30
1995-12-22T09:05:02 = 05:02
-0010-09-15T04:44:23 = 44:23
=head3 y (y)
2008-02-05T18:30:30 = 2008
1995-12-22T09:05:02 = 1995
-0010-09-15T04:44:23 = -10
=head3 yM (y-M)
2008-02-05T18:30:30 = 2008-2
1995-12-22T09:05:02 = 1995-12
-0010-09-15T04:44:23 = -10-9
=head3 yMEd (EEE, y-M-d)
2008-02-05T18:30:30 = kab., 2008-2-5
1995-12-22T09:05:02 = gnu., 1995-12-22
-0010-09-15T04:44:23 = gnd., -10-9-15
=head3 yMMM (y MMM)
2008-02-05T18:30:30 = 2008 gas.
1995-12-22T09:05:02 = 1995 uku.
-0010-09-15T04:44:23 = -10 nze.
=head3 yMMMEd (EEE, y MMM d)
2008-02-05T18:30:30 = kab., 2008 gas. 5
1995-12-22T09:05:02 = gnu., 1995 uku. 22
-0010-09-15T04:44:23 = gnd., -10 nze. 15
=head3 yMMMM (y MMMM)
2008-02-05T18:30:30 = 2008 Gashyantare
1995-12-22T09:05:02 = 1995 Ukuboza
-0010-09-15T04:44:23 = -10 Nzeli
=head3 yQ (y Q)
2008-02-05T18:30:30 = 2008 1
1995-12-22T09:05:02 = 1995 4
-0010-09-15T04:44:23 = -10 3
=head3 yQQQ (y QQQ)
2008-02-05T18:30:30 = 2008 I1
1995-12-22T09:05:02 = 1995 I4
-0010-09-15T04:44:23 = -10 I3
=head3 yyQ (Q yy)
2008-02-05T18:30:30 = 1 08
1995-12-22T09:05:02 = 4 95
-0010-09-15T04:44:23 = 3 -10
=head2 Miscellaneous
=head3 Prefers 24 hour time?
Yes
=head3 Local first day of the week
Kuwa mbere
=head1 SUPPORT
See L<DateTime::Locale>.
=head1 AUTHOR
Dave Rolsky <autarch@urth.org>
=head1 COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
This module was generated from data provided by the CLDR project, see
the LICENSE.cldr in this distribution for details on the CLDR data's
license.
=cut
| Dokaponteam/ITF_Project | xampp/perl/vendor/lib/DateTime/Locale/rw_RW.pm | Perl | mit | 9,239 |
=head1 An overview of the testing modules available on CPAN
CPAN is filled with great modules to help you test your code. Here's a
short list of what's available, so you don't reinvent the wheel.
If you have a module to add to the list, please email
C<andy@petdance.com>.
=head1 General testing modules
=head3 Test::AtRuntime
Assertion-like testing while your program runs.
=head3 Test::Benchmark
Compares two functions to ensure one is faster than another:
use Test::Benchmark;
is_faster(-10, sub {...}, sub {...}, "this is faster than that")
=head3 Test::Class
xUnit style testing that works well with C<Test::Builder> based modules
(the majority of other testing modules). This means it can integrate
into an existing setup relatively easily.
=head3 Test::Cmd
Testing of scripts/programs by their external interface rather than
innards.
=head3 Test::Data
Comprises 4 submodules that provide a number of functions to test the
contents of arrays, hashes, scalars and functions. These make it easy
to test various boundaries and edge cases without writing much code.
=head3 Test::Debugger
Emits a trace of the test script to file, for perusal in the event
of failures.
=head3 Test::Deep
Extremely flexible and powerful deep comparisons of data structures. Ideal
for testing that a given structure not only is equal to an ideal model,
but also for determining whether they are similar. Also good for checking
lightly nested structures (e.g. that a response from an address book
query has well formed records).
=head3 Test::Differences
Tests long strings and data structures, giving a readable output (unlike
testing long strings with C<Test::More>'s C<is> function).
=head3 Test::Extreme
Another xUnit-ish testing framework. Very easy to use. Able to output
both xUnit style and traditional Perl style.
=head3 Test::FIT
Provides a CGI interface to writing and running test suites.
=head3 Test::File
Tests file attributes (empty, of particular sizes, readable, executable,
writeable, etc.).
=head3 Test::Inline
Allows you to embed your tests in your POD in your program file, thus
allowing you to test while you document, or test while you code, or
both. One sideeffect is that your sample code can be test code.
=head3 Test::LectroTest
LectroTest is an automatic, specification-based testing tool for Perl.
The project was inspired by Koen Claessen and John Hughes's QuickCheck
for the Haskell programming language.
Testing a hypothetical square function:
Property {
##[ x <- Int #]##
square( $x ) == $x * $x;
}, name => "Finding $x's square";
=head3 Test::LongString
Testing of long strings, allowing one to see precisely where the
inequality, or non-match, is with ease.
=head3 Test::ManyParams
Combinatorial subroutine argument testing. Lets you test every combination
of arguments to a function.
=head3 Test::MockModule
Easily override subroutines in a module for unit testing.
=head3 Test::MockObject
Lets you create objects that respond to methods in particular ways,
thus letting you test how your own code handles objects with such
return values.
=head3 Test::More
The most common testing module to use. Appropriate feature set for the
majority of test cases and now standard in Perl (from 5.6.2 and 5.8.0).
=head3 Test::Reporter
Module to let you send F<make test> results to the CPAN testers. Includes
the handy F<cpantest> program to make command-line reporting easy.
=head3 Test::Simple
The basic testing module, which you'll rarely want to use on its own,
since C<Test::More> completely supercedes it.
=head3 Test::SimpleUnit
Unit test wrapper functions around the standard testing functions.
Allows you to specify setup functions, plus teardown functions to get
run in the case of failure.
=head3 Test::Smoke
Framework for testing distributions of Perl itself. Not normally used
by the general public.
=head3 Test::Unit
JUnit testing for Perl.
=head3 Test::Verbose
Runs verbose tests on a test file. Seems to be obviated by the F<prove>
program now included with C<Test::Harness>.
=head1 Database testing modules
=head3 DBD::Mock
DBD::Mock is a DBI-compliant database driver that allows you to prepare
and execute SQL statements, seed resultsets, and inspect the results of
all calls.
An example from the SYNOPSIS:
use DBI;
# ...connect as normal, using 'Mock' as your driver name
my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
|| die "Cannot create handle: $DBI::errstr\n";
# ...create a statement handle as normal and execute with parameters
my $sth = $dbh->prepare( 'SELECT this, that FROM foo WHERE id = ?' );
$sth->execute( 15 );
# Now query the statement handle as to what has been done with it
my $params = $sth->{mock_params};
print "Used statement: ", $sth->{mock_statement}, "\n",
"Bound parameters: ", join( ', ', @{ $params } ), "\n";
=head3 Test::DatabaseRow
Given a DBI database handle, can test to see if the database contains
tables with particular rows. Useful for testing that database
modifications went well.
# SQL-based test
row_ok( sql => "SELECT * FROM contacts WHERE cid = '123'",
tests => [ name => "trelane" ],
label => "contact 123's name is trelane");
# test with shortcuts
row_ok( table => "contacts",
where => [ cid => 123 ],
tests => [ name => "trelane" ],
label => "contact 123's name is trelane");
=head1 Data-specific testing modules
=head3 Test::Env
Tests that one's environment has appropriate data.
=head3 Test::Files
Tests files and directories have particular contents.
=head3 Test::ISBN
Verify ISBNs and parts of ISBNs against C<Business::ISBN>.
=head3 Test::Mail
Testing that email is sent and received properly.
=head3 Test::XML
Helper functions for testing XML for syntactic equivalency, even if the
strings themselves are different.
=head1 Web testing modules
=head3 Apache::Test
Allows you to run tests for Apache-based software. Also lets you run
tests inside Apache. Not limited to mod_perl.
=over
=item * Introductory tutorial slides
L<http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2003/apache-test-printable.ppt.gz>
=item * perl.com article on Apache::Test
L<http://www.perl.com/pub/a/2003/05/22/testing.html>
=item * Docs from apache.org
L<http://perl.apache.org/docs/general/testing/testing.html>
=back
=head3 Test::HTML::Content
Tests HTML has (or hasn't) particular links, text, tags, comments and
such. Very useful for testing websites (see also C<WWW::Mechanize> and
C<Test:HTML::Lint>).
=head3 Test::HTML::Lint
Checks that HTML is well formed as per C<HTML::Lint>.
=head3 Test::HTML::Tidy
Checks that HTML is well formed as per C<HTML::Tidy>.
=head3 Test::HTTPStatus
Ensures HTTP responses have appropriate values.
=head3 Test::WWW::Mechanize
Subclass of C<WWW::Mechanize> with convenience methods for automated testing.
=head1 Module-testing modules
=head3 Test::Builder::Tester
Runs tests on other C<Test::> modules based on C<Test::Builder>.
=head3 Test::Distribution
Performs basic Kwalitee checking on modules: checks that they have well
formed POD, they compile, they all define the same C<$VERSION>, they
have their prerequisites in the F<Makefile.PL> and that some standard
files exist.
=head3 Test::Exception
Testing that bits of code die or don't die appropriately, and with the
right errors.
=head3 Test::Manifest
Executes your tests in a particular non-alphabetic order without having
to name them with numeric prefixes.
=head3 Test::NoWarnings
Test for making sure that your test didn't emit any warnings.
=head3 Test::Pod
Checks a given POD or Perl file for syntactic validity. Also has a
function to let you easily check all files in your distribution at once.
=head3 Test::Pod::Coverage
Checks a given POD or Perl file for syntactic validity. Also has a
function to let you easily check all files in your distribution at once.
=head3 Test::Portability::Files
Checks the portability the names of the files in a distribution.
The tests use the advice listed in F<perlport>, section "Files and
Filesystems".
=head3 Test::Prereq
Checks that your F<Makefile.PL> has the proper prerequisites specified.
=head3 Test::Signature
Verifies that the signature of a module, as created by
C<Module::Signature>, is correct.
=head3 Test::Tester
Runs tests on other C<Test::> modules based on C<Test::Builder>.
=head3 Test::Version
Checks module files for proper version information.
=head3 Test::Warn
Handy module for testing code that might throw a warning. The testing
function captures any warnings, so you can check them against a regex.
For example, this code checks that C<WWW::Mechanize>'s C<warn()> method
does indeed throw a warning.
my $m = WWW::Mechanize->new;
isa_ok( $m, 'WWW::Mechanize' );
warning_like {
$m->warn( "Something bad" );
} qr/Something bad.+line \d+/,
"Passes the message, and includes the line number";
=head3 Test::Without::Module
Allows you to deliberately hide modules from a program even though they
are installed. This is mostly useful for testing modules that have a
fallback when a certain dependency module is not installed.
=head1 CONTRIBUTORS
The following people have helped contribute to this page:
Andy Lester,
Dominic Mitchell
Philipe 'BooK' Bruhat,
Chris Winters,
Per Christian Nødtved,
and the late, great Iain Truskett.
| rjbs/perlweb | docs/qa/test-modules.pod | Perl | apache-2.0 | 9,499 |
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is built by mktables from e.g. UnicodeData.txt.
# Any changes made here will be lost!
#
# This file supports:
# \p{InNko} (and fuzzy permutations)
#
# Meaning: Block 'NKo'
#
return <<'END';
07C0 07FF NKo
END
| leighpauls/k2cro4 | third_party/cygwin/lib/perl5/5.10/unicore/lib/gc_sc/InNko.pl | Perl | bsd-3-clause | 268 |
package DDG::Spice::Hearthstone;
# ABSTRACT: Retrieve the card infos from Hearthstone game.
use DDG::Spice;
# Caching
spice is_cached => 1;
spice proxy_cache_valid => "200 4d";
# Triggers
triggers startend => "hearthstone";
# Target URL
spice to => 'http://bytevortex.net/hearthstone.php?search=$1';
# JS Callback
spice wrap_jsonp_callback => 1;
# Keyword blacklist
my $keyword_guard = qr/game|instruction|stoves|warcraft|deck|forum|wiki|reddit/;
# Handle statement
handle remainder => sub {
# Guard against "no answer"
return unless $_;
# Keyword Blacklist
return if (/$keyword_guard/);
# Regex guard
# Allows string similar to any Hearthstone card name: multiple words separated by spaces, commas or dashes.
# The card name may also have dots, double dots, slashes or an exclamation mark (Those Blizzard devs).
return $_ if (/^([a-z0-9':!\/,.-]+\s*)+$/i);
return;
};
1;
| soleo/zeroclickinfo-spice | lib/DDG/Spice/Hearthstone.pm | Perl | apache-2.0 | 920 |
use strict;
use warnings;
use IO::Handle;
STDOUT->autoflush(1);
STDERR->autoflush(1);
my $max = shift || 4;
for ( 1..$max ) {
$_ % 2
? print STDOUT $_
: print STDERR $_;
}
| Lh4cKg/sl4a | perl/src/lib/IPC/Cmd/t/src/output.pl | Perl | apache-2.0 | 195 |
=head1 NAME
Module::Build::Bundling - How to bundle Module::Build with a distribution
=head1 SYNOPSIS
# Build.PL
use inc::latest 'Module::Build';
Module::Build->new(
module_name => 'Foo::Bar',
license => 'perl',
)->create_build_script;
=head1 DESCRIPTION
B<WARNING -- THIS IS AN EXPERIMENTAL FEATURE>
In order to install a distribution using Module::Build, users must
have Module::Build available on their systems. There are two ways
to do this. The first way is to include Module::Build in the
C<configure_requires> metadata field. This field is supported by
recent versions L<CPAN> and L<CPANPLUS> and is a standard feature
in the Perl core as of Perl 5.10.1. Module::Build now adds itself
to C<configure_requires> by default.
The second way supports older Perls that have not upgraded CPAN or
CPANPLUS and involves bundling an entire copy of Module::Build
into the distribution's C<inc/> directory. This is the same approach
used by L<Module::Install>, a modern wrapper around ExtUtils::MakeMaker
for Makefile.PL based distributions.
The "trick" to making this work for Module::Build is making sure the
highest version Module::Build is used, whether this is in C<inc/> or
already installed on the user's system. This ensures that all necessary
features are available as well as any new bug fixes. This is done using
the new L<inc::latest> module.
A "normal" Build.PL looks like this (with only the minimum required
fields):
use Module::Build;
Module::Build->new(
module_name => 'Foo::Bar',
license => 'perl',
)->create_build_script;
A "bundling" Build.PL replaces the initial "use" line with a nearly
transparent replacement:
use inc::latest 'Module::Build';
Module::Build->new(
module_name => 'Foo::Bar',
license => 'perl',
)->create_build_script;
For I<authors>, when "Build dist" is run, Module::Build will be
automatically bundled into C<inc> according to the rules for
L<inc::latest>.
For I<users>, inc::latest will load the latest Module::Build, whether
installed or bundled in C<inc/>.
=head1 BUNDLING OTHER CONFIGURATION DEPENDENCIES
The same approach works for other configuration dependencies -- modules
that I<must> be available for Build.PL to run. All other dependencies can
be specified as usual in the Build.PL and CPAN or CPANPLUS will install
them after Build.PL finishes.
For example, to bundle the L<Devel::AssertOS::Unix> module (which ensures a
"Unix-like" operating system), one could do this:
use inc::latest 'Devel::AssertOS::Unix';
use inc::latest 'Module::Build';
Module::Build->new(
module_name => 'Foo::Bar',
license => 'perl',
)->create_build_script;
The C<inc::latest> module creates bundled directories based on the packlist
file of an installed distribution. Even though C<inc::latest> takes module
name arguments, it is better to think of it as bundling and making
available entire I<distributions>. When a module is loaded through
C<inc::latest>, it looks in all bundled distributions in C<inc/> for a
newer module than can be found in the existing C<@INC> array.
Thus, the module-name provided should usually be the "top-level" module
name of a distribution, though this is not strictly required. For example,
L<Module::Build> has a number of heuristics to map module names to
packlists, allowing users to do things like this:
use inc::latest 'Devel::AssertOS::Unix';
even though Devel::AssertOS::Unix is contained within the Devel-CheckOS
distribution.
At the current time, packlists are required. Thus, bundling dual-core
modules, I<including Module::Build>, may require a 'forced install' over
versions in the latest version of perl in order to create the necessary
packlist for bundling. This limitation will hopefully be addressed in a
future version of Module::Build.
=head2 WARNING -- How to Manage Dependency Chains
Before bundling a distribution you must ensure that all prerequisites are
also bundled and load in the correct order. For Module::Build itself, this
should not be necessary, but it is necessary for any other distribution.
(A future release of Module::Build will hopefully address this deficiency.)
For example, if you need C<Wibble>, but C<Wibble> depends on C<Wobble>,
your Build.PL might look like this:
use inc::latest 'Wobble';
use inc::latest 'Wibble';
use inc::latest 'Module::Build';
Module::Build->new(
module_name => 'Foo::Bar',
license => 'perl',
)->create_build_script;
Authors are strongly suggested to limit the bundling of additional
dependencies if at all possible and to carefully test their distribution
tarballs on older versions of Perl before uploading to CPAN.
=head1 AUTHOR
David Golden <dagolden@cpan.org>
Development questions, bug reports, and patches should be sent to the
Module-Build mailing list at <module-build@perl.org>.
Bug reports are also welcome at
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module-Build>.
=head1 SEE ALSO
perl(1), L<inc::latest>, L<Module::Build>(3), L<Module::Build::API>(3),
L<Module::Build::Cookbook>(3),
=cut
# vim: tw=75
| liuyangning/WX_web | xampp/perl/lib/Module/Build/Bundling.pod | Perl | mit | 5,080 |
$ntp_str = `ntpq -c rv $ARGV[0]`;
$val = (split(/\,/,$ntp_str))[20];
$val =~ s/offset=//i;
$val = 1000.0 * $val; # convert to microseconds
$report = int ($val + 20);
if ($report < 0) {
$report = 0;
}
if ($report > 40) {
$report = 40;
}
print "0\n";
print "$report\n";
print "0\n";
print "0\n";
| rvdhoek/Raspberry-MRTG | GetNTP10usec.pl | Perl | mit | 300 |
package RiveScript::WD;
use strict;
use warnings;
# Version of the Perl RiveScript interpreter. This must be on a single line!
# See `perldoc version`
use version; our $VERSION = version->declare('v2.0.3');
# This is not a real module; it's only a current copy of the RiveScript
# Working Draft. See the latest version at
# http://www.rivescript.com/wd/RiveScript.html
1;
=head1 NAME
RiveScript::WD - RiveScript 2.00 Working Draft (2014/11/30)
=head1 DESCRIPTION
This document details the standards for the RiveScript scripting language. The
purpose of this document is that interpreters for RiveScript could be written
in various programming languages that would meet the standards for the
RiveScript language itself.
The most current version of this document is at
http://www.rivescript.com/wd/RiveScript.html
=head1 INTRODUCTION
RiveScript is an interpreted scripting language for giving responses to
chatterbots and other intelligent chatting entities in a simple trigger/reply
format. The scripting language is intended to be simplistic and easy to learn
and manage.
=head1 VOCABULARY
=over 4
=item RiveScript
RiveScript is the name of the scripting language that this document explains.
=item Interpreter
The RiveScript interpreter is a program or library in another programming
language that loads and parses a RiveScript document.
=item RiveScript Document
A RiveScript Document is a text file containing RiveScript code.
=item Bot
A Bot (short for robot) is the artificial entity that is represented by an
instance of a RiveScript Interpreter object. That is, when you create a new
Interpreter object and load a set of RiveScript Documents, that becomes the
"brain" of the bot.
=item Bot Variable
A variable that describes the bot, such as its name, age, or other details
you want to define for the bot.
=item Client Variable
A variable that the bot keeps about a specific client, or user of the bot.
Usually as the client tells the bot information about itself, the bot could
save this information into Client Variables and recite it later.
=back
=head1 FORMAT
A RiveScript document should be parsed line by line, and preferably arranged
in the interpreter's memory in an efficient way.
The first character on each line should be the C<command>, and the rest of the
line is the command's C<arguments>. The C<command> should be a single character
that is not a number or a letter.
In its most simple form, a valid RiveScript trigger/response pair looks like
this:
+ hello bot
- Hello, human.
=head1 WHITESPACE
A RiveScript interpreter should ignore leading and trailing whitespace characters
on any line. It should also ignore whitespace characters surrounding individual
arguments of a RiveScript command, where applicable. That is to say, the following
two lines should be interpreted as being exactly the same:
! global debug = 1
! global debug= 1
=head1 COMMANDS
=head2 ! DEFINITION
The C<!> command is for defining variables within RiveScript. It's used to
define information about the bot, define global arrays that can be used in
multiple triggers, or override interpreter globals such as debug mode.
The format of the C<!> command is as follows:
! type name = value
Where C<type> is one of C<version, global, var, array, sub,> or C<person>.
The C<name> is the name of the variable being defined, and C<value> is the
value of said variable.
Whitespace surrounding the C<=> sign should be stripped out.
Setting a value to C<E<lt>undefE<gt>> will undefine the variable (deleting it
or uninitializing it, depending on the implementation).
The variable types supported are detailed as follows:
=head3 version
It's highly recommended practice that new RiveScript documents explicitly
define the version of RiveScript that they are following. RiveScript 2.00
has some compatibility issues with the old 1.x line (see L<"REVERSE COMPATIBILITY">).
Newer RiveScript versions should encourage that RiveScript documents define their
own version numbers.
! version = 2.00
=head3 global
This should override a global variable at the interpreter level. The obvious
variable name might be "debug" (to enable/disable debugging within the
RiveScript interpreter).
The interpreter should take extra care not to allow reserved globals to be
overridden by this command in ways that might break the interpreter.
Examples:
! global debug = 1
=head3 var
This should define a "bot variable" for the bot. This should only be used in an
initialization sense; that is, as the interpreter loads the document, it should
define the bot variable as it reads in this line. If you'd want to redefine or
alter the value of a bot variable, you should do so using a tag inside of a
RiveScript document (see L<"TAGS">).
Examples:
! var name = RiveScript Bot
! var age = 0
! var gender = androgynous
! var location = Cyberspace
! var generator = RiveScript
=head3 array
This will create an array of strings, which can then be used later in triggers
(see L<"+ TRIGGER">). If the array contains single words, separating the words
with a space character is fine. If the array contains items with multiple words
in them, separate the entries with a pipe symbol (C<"|">).
Examples:
! array colors = red green blue cyan magenta yellow black white orange brown
! array be = is are was were
! array whatis = what is|what are|what was|what were
Arrays have special treatment when spanned over multiple lines. Each extension
of the array data is treated individually. For example, to break an array of
many single-words into multiple lines of RiveScript code:
! array colors = red green blue cyan
^ magenta yellow black white
^ orange brown
The data structure pulled from that code would be identical to the previous
example above for this array.
Since each extension line is processed individually, you can combine the
space-delimited and pipe-delimited formats. In this case, we can add some color
names to our list that have multiple words in them.
! array colors = red green blue cyan magenta yellow
^ light red|light green|light blue|light cyan|light magenta|light yellow
^ dark red|dark green|dark blue|dark cyan|dark magenta|dark yellow
^ white orange teal brown pink
^ dark white|dark orange|dark teal|dark brown|dark pink
Finally, if your array consists of almost entirely single-word items, and you
want to add in just one multi-word item, but don't want to require an extra line
of RiveScript code to accomplish this, just use the C<\s> tag where you need
spaces to go.
! array blues = azure blue aqua cyan baby\sblue sky\sblue
=head3 sub
The C<sub> variables are for defining substitutions that should be run against
the client's message before any attempts are made to match it to a reply.
The interpreter should do the minimum amount of formatting possible on the
client's message until after it has been passed through all the substitution
patterns.
B<NOTE:> Spaces are allowed in both the variable name and the value fields.
Examples:
! sub what's = what is
! sub what're = what are
! sub what'd = what did
! sub a/s/l = age sex location
! sub brb = be right back
! sub afk = away from keyboard
! sub l o l = lol
=head3 person
The C<person> variables work a lot like C<sub>s do, but these are run against
the bot's response, specifically within C<E<lt>personE<gt>> tags (See L<"TAGS">).
Person substitutions should swap first- and second-person pronouns. This is so
that ex. if the client asks the bot a direct question using "you" when addressing
the bot, if the bot uses the client's message in the response it should swap
"you" for "I".
Examples:
! person you are = I am
! person i am = you are
! person you = I
! person i = you
=head2 E<gt> LABEL
The C<E<gt>> and C<E<lt>> commands are for defining a subset of your code under
a certain label. The label command takes between one and three arguments. The
first argument defines the type of the label, which is one of C<begin, topic,>
or C<object>. The various types are as follows.
=head3 begin
This is a special label used with the C<BEGIN block>. Every message the
client sends to the bot gets passed through the Begin Statement first, and the
response in there determines whether or not to get an actual reply.
Here's a full example of the Begin Statement.
> begin
+ request
- {ok}
< begin
In the C<BEGIN block>, the trigger named "C<request>" is called by the
interpreter, and it should return the tag "C<{ok}>" to tell the interpreter
that it's OK to get a real reply. This way the bot could have a "maintenance
mode," or could filter the results of your trigger based on a variable.
Here's a maintenance mode example:
> begin
+ request
* <id> eq <bot master> => {ok} // Always let the bot master get a reply
* <env maint> eq true => Sorry, I'm not available for chat right now!
- {ok}
< begin
// Allow the owner to change the maintenance mode
+ activate maintenance mode
* <id> eq <bot master> => <env maint=true>Maintenance mode activated.
- You're not my master! You can't tell me what to do!
+ deactivate maintenance mode
* <id> eq <bot master> => <env maint=false>Maintenance mode deactivated.
- Only my master can deactivate maintenance mode!
With this example, if the global variable "maint" is set to "true", the bot
will always reply "Sorry, I'm not available for chat right now!" when a user
sends it a message -- unless the user is the bot's owner.
Here is another example that will modify the response formatting based on a
bot variable called "mood," to simulate humanoid moods for the bot:
> begin
+ request
* <get mood> == happy => {ok} :-)
* <get mood> == sad => {lowercase}{ok}{/lowercase}
* <get mood> == angry => {uppercase}{ok}{/uppercase}
- {ok}
< begin
In this example the bot will use smiley faces when it's happy, reply in all
lowercase when it's sad, or all uppercase when it's angry. If its mood doesn't
fall into any of those categories, it replies normally.
Here is one last example: say you want your bot to interview its users when
they first talk to it, by asking them for their name:
> begin
+ request
* <get name> == undefined => {topic=newuser}{ok}
- {ok}
< begin
> topic newuser
+ *
- Hello! My name is <bot name>! I'm a robot. What's your name?
+ _
% * what is your name
- <set name=<formal>>Nice to meet you, <get name>!{topic=random}
< topic
Begin blocks are B<optional!> They are not required. You only need to manually
define them if you need to do any "pre-processing" or "post-processing" on the
user's message or the bot's response. Having no begin block is the same as
having a super basic begin block, which always returns C<{ok}>.
=head3 topic
A topic is a smaller set of responses to which the client will be bound until
the topic is changed to something else. The default topic is C<random>.
The C<topic> label only requires one additional argument, which is the name of
the topic. The topic's name should be one word and lowercase.
Example:
+ i hate you
- Well then, I won't talk to you until you take that back.{topic=apology}
> topic apology
+ *
- I won't listen to you until you apologize for being mean to me.
- I have nothing to say until you say you're sorry.
+ (sorry|i apologize)
- Okay. I guess I'll forgive you then.{topic=random}
< topic
Topics are able to C<include> and C<inherit> triggers that belong to a
different topic. When a topic C<includes> another topic, it means that the
triggers in another topic are made available in the topic that did the
inclusion (hereby called the "source topic", which includes triggers from
the "included topic").
When a topic inherits another topic, it means that the entire collection
of triggers of the source topic I<and> any included topics, will have a
higher matching priority than the inherited topics.
See L<"Sorting +Triggers"> to see how triggers are sorted internally. The
following example shows how includes and inheritence works:
// This is in the default "random" topic and catches all non-matching
// triggers.
+ *
- I'm afraid I don't know how to reply to that!
> topic alpha
+ alpha trigger
- Alpha's response.
< topic
> topic beta
+ beta trigger
- Beta's response.
<
> topic gamma
+ gamma trigger
- Gamma's response.
< topic
> topic delta
+ delta trigger
- Delta's response.
+ *
- You can't access any other triggers! Haha!
< topic
These are all normal topics. Alpha, beta, and gamma all have a single
trigger corresponding to their topic names. If the user were put into
one of these topics, this is the only trigger available. Anything else
would give them a "NO REPLY" error message. They are unable to match the
C<*> trigger at the top, because that trigger belongs to the "C<random>"
topic, and they're not in that topic.
Now let's see how we can pair these topics up with includes and
inheritence.
> topic ab includes alpha
+ hello bot
- Hello human!
< topic
// Matching order:
alpha trigger
hello bot
If the user were put into topic "C<ab>", they could match the trigger
C<hello bot> as well as the trigger C<alpha trigger>, as if they were
both in the same topic.
Note that in the matching order, "alpha trigger" is at the top: this
is because it is the longest trigger. If the user types "alpha trigger",
the interpreter knows that "alpha trigger" does not belong to the topic
"ab", but since "ab" includes triggers from "alpha", the interpreter
searches there and finds the trigger. Then it gives the user the
correct reply of "Alpha's response."
> topic abc includes alpha beta
+ how are you
- Good, how are you?
< topic
// Matching order:
how are you
alpha trigger
beta trigger
In this case, "how are you" is on the top of the matching list because
it has three words, then "alpha trigger" and "beta trigger" -- "alpha
trigger" is first because it is longer than "beta trigger", even though
they both have 2 words.
Now consider this example:
> topic abc includes alpha beta
+ how are you
- Good, how are you?
+ *
- You matched my star trigger!
< topic
// Matching order:
how are you
alpha trigger
beta trigger
*
Notice what happened here: we had a trigger of simply C<*> in the "abc"
topic - C<*> is the fallback trigger which matches anything that wasn't
matched by a better trigger. But this trigger is at the end of our matching
list! This is because the triggers available in the "alpha" and "beta" topics
are included in the "abc" topic, meaning they all share the same "space"
when the triggers are sorted. Since C<*> has the lowest sort priority,
it ends up at the very end of the collective list.
What if we want C<*>, or any other short trigger, to match in our current
topic before anything in an included topic? We need to C<inherit> another
topic. Consider this:
> topic abc inherits alpha beta
+ how are you
- Good, how are you?
+ *
- You matched my star trigger!
< topic
// Matching order:
how are you
*
alpha trigger
beta trigger
Now the C<*> trigger is the second on the matching list. Because "abc"
I<inherits> alpha and beta, it means that the collection of triggers
inside "abc" are sorted independently, and I<then> the triggers of alpha
and beta are sorted. So this way every trigger in "abc" inherits, or
I<overrides>, all triggers in the inherited topics.
Of course, using a C<*> trigger in a topic that inherits other topics is
useless, because you could just leave the topic as it is. However it might
be helpful in the case that a trigger in your topic is very short or has
very few words, and you want to make sure that this trigger will have a
good chance of matching before anything that appears in a different topic.
You can combine inherited and included topics together, too.
> topic abc includes alpha beta delta inherits gamma
+ how are you
- Good, how are you?
< topic
// Matching order:
how are you
alpha trigger
delta trigger
beta trigger
*
gamma trigger
In this example, the combined triggers from abc, alpha, beta, and delta
are all merged together in one pool and sorted amongst themselves, and
then triggers from gamma are placed after them in the sort list.
This effectively means you can combine the triggers from multiple
topics together, and have ALL of those triggers override triggers
from an inherited topic.
You can use as many "includes" and "inherits" keywords as you want, but
the order you specify them has no effect. So the following two formats
are identical:
> topic alpha includes beta inherits gamma
> topic alpha inherits gamma includes beta
In both cases, alpha and beta's triggers are pooled and have higher
priority than gamma's. If gamma wants to include beta and have alpha's
triggers be higher priority than gamma's and beta's, gamma will need
to include beta first.
> topic gamma includes beta
> topic alpha inherits gamma
In this case the triggers in "alpha" are higher priority than the
combined triggers in gamma and beta.
=head3 object
Objects are bits of program code that the interpreter should try to process.
The programming language that the interpreter was written in will determine
whether or not it will attempt to process the object.
See L<"OBJECT MACROS"> for more information on objects.
The C<object> label should have two arguments: a lowercase single-word name for
the object, and the programming language that the object should be interpreted
by, which should also be lowercase.
Example:
> object encode perl
my ($obj,$method,@args) = @_;
my $msg = join(" ",@args);
use Digest::MD5 qw(md5_hex);
use MIME::Base64 qw(encode_base64);
if ($method eq 'md5') {
return md5_hex($msg);
}
else {
return encode_base64($msg);
}
< object
=head2 + TRIGGER
The C<+> command is the basis for all things that actually do stuff within a
RiveScript document. The trigger command is what matches the user's message to
a response.
The trigger's text should be entirely lowercase and not contain any symbols
(except those used for matching complicated messages). That is, a trigger that
wants to match "C<what's your name>" shouldn't be used; you should use a
L<"sub">stitution to convert C<what's> into C<what is> ahead of time.
Example:
+ are you a bot
- How did you know I'm a robot?
=head3 Atomic Trigger
An atomic trigger is a trigger that matches nothing but plain text. It doesn't
contain any wildcards (C<*>) or optionals, but it may contain alternations.
Atomic triggers should take higher priority for matching a client's message
than should triggers containing wildcards and optionals.
Examples:
+ hello bot
+ what is your name
+ what is your (home|office) phone number
+ who is george w bush
=head3 Trigger Wildcards
Using an asterisk (C<*>) in the trigger will make it act as a wildcard. Anything
the user says in place of the wildcard may still match the trigger. For example:
+ my name is *
- Pleased to meet you, <star>.
An asterisk (C<*>) will match any character (numbers and letters). If you want
to only match numbers, use C<#>, and to match only letters use C<_>. Example:
// This will ONLY take a number as the wildcard.
+ i am # years old
- I will remember that you are <star> years old.
// This will ONLY take letters but not numbers.
+ my name is _
- Nice to meet you, <star>.
The values matched by the wildcards can be retrieved in the responses by using
the tags C<E<lt>star1E<gt>>, C<E<lt>star2E<gt>>, C<E<lt>star3E<gt>>, etc. in the
order that the wildcard appeared. C<E<lt>starE<gt>> is an alias for C<E<lt>star1E<gt>>.
=head3 Trigger Alternations
An alternation in a trigger is a sub-set of strings, in which any one of the
strings will still match the trigger. For example, the following trigger should
match both "are you okay" and "are you alright":
+ are you (okay|alright)
Alternations can contain spaces in them, too.
+ (are you|you) (okay|alright)
That would match all of the following questions from the client:
are you okay
are you alright
you okay
you alright
Alternations match the same as wildcards do; they can be retrieved via the
C<E<lt>starE<gt>> tags.
=head3 Trigger Optionals
Triggers can contain optional words as well. Optionals are written similarly to
alternations, but they use square braces. The following example would match both
"what is your phone number" as well as "what is your B<home> phone number"
+ what is your [home] phone number
Optionals do B<NOT> match like wildcards do. They do NOT go into the
C<E<lt>starE<gt>> tags. The reason for this is that optionals are optional, and
won't always match anything if the client didn't actually say the optional word(s).
=head3 Arrays in Triggers
Arrays defined via the L<"! DEFINITION"> L<"array"> commands can be used within
a trigger. This is the only place where arrays are used, and they're added as a
convenience feature.
For example, you can make an array of color names, and then use that array in
multiple triggers, without having to copy a whole bunch of alternation code between
triggers.
! array colors = red green blue cyan magenta yellow black white orange brown
+ i am wearing a (@colors) shirt
- I don't know if I have a shirt that's colored <star>.
+ my favorite color is (@colors)
- I like <star> too.
+ i have a @colors colored *
- Have you thought about getting a <star> in a different color?
When an array is called within parenthesis, it should be matched into a
C<E<lt>starE<gt>> tag. When the parenthesis are absent, however, it should not
be matched into a C<E<lt>starE<gt>> tag.
=head3 Priority Triggers
A new feature proposed for RiveScript 2.00 is to add a priority tag to triggers.
When the interpreter sorts all the loaded triggers into a search sequence, any
triggers that have a priority defined will be sorted with higher priority
triggers first.
The idea is to have "important" triggers that should always be matched before a
different trigger, which may have been a better match, can be tried. The best
example would be for commands. For example:
+ google *
- Searching Google... <call>google <star></call>
+ * or not
- Or yes. <@>
In that example, if the bot had a Google search function and the user wanted to
search for whether or not Perl is a superior programming language to PHP, the
user might ask "C<google is perl better than php or not>". However, without
priorities in effect, that question would actually match the "C<* or not>"
trigger, because that trigger has more words than "C<google *>" does.
Adding a priority to the "C<google *>" trigger would ensure that conflicts like
this don't happen, by always sorting the Google search trigger with higher
priority than the other.
+ {weight=100}google *
- Searching Google... <call>google <star></call>
B<NOTE:> It would NOT be recommended to put a priority tag on every one of your
triggers. To the interpreter this might mean extra processing work to sort
prioritized triggers by each number group. Only add priorities to triggers that
need them.
=head2 - RESPONSE
The C<-> tag is used to indicate a response to a matched trigger. A single
response to a single trigger is called an "atomic response." When more than one
response is given to a single trigger, the collection of responses become a
"random response," where a response is chosen randomly from the list. Random
responses can also use a C<{weight}> tag to improve the likelihood of one response
being randomly chosen over another.
=head3 Atomic Response
A single response to a single trigger makes an Atomic Response. The bot will
respond pretty much the same way each time the trigger is matched.
Examples:
+ hello bot
- Hello human.
+ my name is *
- Nice to meet you, <star>.
+ i have a (@colors) shirt
- You're not the only one that has a <star> shirt.
=head3 Random Response
Multiple responses to a single trigger will be chosen randomly.
+ hello
- Hey there!
- Hello!
- Hi, how are you?
+ my name is *
- Nice to meet you, <star>.
- Hi, <star>, my name is <bot name>.
- <star>, nice to meet you.
=head3 Weighted Random Response
When using random responses, it's possible to give weight to them to change the
likelihood that a response will be chosen. In this example, the response of
"Hello there" will be much more likely to be chosen than would the response of
"Hi".
+ hello
- Hello there!{weight=50}
- Hi.
When the C<{weight}> tag isn't used, a default weight of 1 is implied for that
response. The C<{weight}> should always be a number greater than zero and must
be an integer (no decimal point).
=head2 % PREVIOUS
The C<%> command is for drawing the user back to finish a short discussion. Its
behavior is similar to using topics, but is implied automatically and used for
short-term things. It's also less strict than topics are; if the client replies
in a way that doesn't match, a normal reply is given anyway. For example:
+ knock knock
- Who's there?
+ *
% who is there
- <star> who?
+ *
% * who
- lol! <star>! That's hilarious!
The text of the C<%> command looks similar to the text next to the trigger. In
essence, they work the same; the only difference is that the C<%> command matches
the last thing that the I<bot> sent to you.
Here's another example:
+ i have a dog
- What color is it?
+ (@colors)
% what color is it
- That's an odd color for a dog.
In that case, if the client says "I have a dog," the bot will reply asking what
color it is. Now, if I tell it the color in my next message, it will reply back
and tell me what an odd color that is. However, if I change the topic instead and
say something else to the bot, it will answer my new question anyway. This is in
contrast to using topics, where I'd be stuck inside of the topic until the bot
resets the topic to C<random>.
Similarly to the wildcards in C<+ Trigger>, the wildcards matched in the
C<% Previous> command are put into C<E<lt>botstarE<gt>>. See L<"TAGS"> for
more information.
=head2 ^ CONTINUE
The C<^> command is used to continue the text of a lengthy previous command down
to the new line. It can be used to extend any other command. Example:
+ tell me a poem
- Little Miss Muffit sat on her tuffet\n
^ in a nonchalant sort of way.\n
^ With her forcefield around her,\n
^ the Spider, the bounder,\n
^ Is not in the picture today.
Note that when the C<^> command continues the previous command, no spaces or
line breaks are implied at the joining of the two lines. The C<\s> and C<\n>
tags must be explicitly defined where needed.
=head2 @ REDIRECT
The C<@> command is used to redirect an entire response to appear as though the
client asked an entirely different question. For example:
+ my name is *
- Nice to meet you, <star>.
+ call me *
@ my name is <star>
If the client says "call me John", the bot will redirect it as though the client
actually said "my name is John" and give the response of "Nice to meet you,
John."
=head2 * CONDITION
The C<*> command is used with conditionals when replying to a trigger. Put simply,
they compare two values, and when the comparison is true the associated response
is given. The syntax is as follows:
* value symbol value => response
The following inequality symbols may be used:
== equal to
eq equal to (alias)
!= not equal to
ne not equal to (alias)
<> not equal to (alias)
< less than
<= less than or equal to
> greater than
>= greater than or equal to
In each of the value places, tags can be used to i.e. insert client or bot
variables.
Examples:
+ am i a boy or a girl
* <get gender> eq male => You told me you were a boy.
* <get gender> eq female => You told me you were a girl.
- You never told me what you were.
+ am i your master
* <id> eq <bot master> => Yes, you are.
- No, you're not my master.
+ my name is *
* <get name> eq <star> => I know, you told me that already.
* <get name> ne undefined => Did you get a name change?<set name=<star>>
- <set name=<star>>Nice to meet you, <star>.
It's recommended practice to always include at least one response in case all
of the conditionals return false.
B<NOTE:> Conditionals are tried in the order they appear in the RiveScript
document, and the next condition is tried when the previous ones are false.
=head2 // COMMENT
The C<//> command is for putting comments into your RiveScript document. The
C-style multiline comment syntax C</* */> is also supported.
Comments on their own line should be ignored by all interpreters. For inline
comments, only the C<//> format is acceptable. If you want a literal C<//> in
your RiveScript data, escape at least one of the symbols, i.e. C<\//> or C<\/\/>
or C</\/>.
Examples:
// A single regular comment
/*
This comment can span
multiple lines
*/
> begin // The "BEGIN" block
+ request // This is required
- {ok} // An {ok} means to get a real reply
< begin//End the begin block
=head1 OBJECT MACROS
An C<object macro> is a piece of program code that is processed by the interpreter
to give a little more "kick" to the RiveScript. All objects are required to define
the programming language they use. Ones that don't should result in vociferous
warnings by the interpreter.
Objects should be able to be declared inline within RiveScript code, however they
may also be defined by the program utilizing the interpreter as well. All objects
should receive, at a minimum, some kind of reference to the RiveScript interpreter
object that called them.
Here is an example of a simple Perl object that encodes a bit of text into
MD5 or Base64.
> object encode perl
my ($obj,$method,@args) = @_;
my $msg = join(" ",@args);
use Digest::MD5 qw(md5_hex);
use MIME::Base64 qw(encode_base64);
if ($method eq 'md5') {
return md5_hex($msg);
}
else {
return encode_base64($msg);
}
< object
To call an object within a response, call it in the format of:
<call>object_name arguments</call>
For example:
+ encode * in md5
- The MD5 hash of "<star>" is: <call>encode md5 <star></call>
+ encode * in base64
- The Base64 hash of "<star>" is: <call>encode base64 <star></call>
In the above examples, C<encode> calls on the object named "encode", which we
defined above; C<md5> and C<base64> calls on the method name, which is received
by the object as C<$method>. Finally, C<@args> as received by the object would
be the value of E<lt>starE<gt> in this example.
C<$obj> in this example would be a reference to the RiveScript interpreter.
=head1 TAGS
Tags are bits of text inserted within the argument space of a RiveScript command.
As a general rule of thumb, tags with E<lt>angle bracketsE<gt> are for setting
and getting a variable or for inserting text. Tags with {curly brackets} modify
the text around them, such as to change the formatting of enclosed text.
No tags can be used within C<! Definition> and C<E<gt> Label> under any
circumstances.
Unless otherwise specified, all of the tags can be used within every RiveScript
command.
=head2 E<lt>starE<gt>, E<lt>star1E<gt> - E<lt>starNE<gt>
The C<E<lt>starE<gt>> tags are used for matching responses. See
L<"+ TRIGGER"> for usage examples.
The C<E<lt>starE<gt>> tags can NOT be used within C<+ Trigger>.
=head2 E<lt>botstarE<gt>, E<lt>botstar1E<gt> - E<lt>botstarNE<gt>
If the trigger included a C<% Previous> command, C<E<lt>botstarE<gt>> will match
any wildcards that matched the bot's previous response.
+ ask me a question
- What color's your {random}shirt shoes socks{/random}
+ *
% what colors your *
- I wouldn't like <star> as a color for my <botstar>.
=head2 E<lt>input1E<gt> - E<lt>input9E<gt>; E<lt>reply1E<gt> - E<lt>reply9E<gt>.
The input and reply tags insert the previous 1 to 9 things the client said, and
the last 1 to 9 things the bot said, respectively. When these tags are used with
C<+ Trigger>, they should be formatted against substitutions first. This way, the
bot might be able to detect when the client is repeating themself or when they're
repeating the bot's replies.
+ <reply1>
- Don't repeat what I say.
+ <input1>
* <input1> eq <input2> => That's the second time you've repeated yourself.
* <input1> eq <input3> => If you repeat yourself again I'll stop talking to you.
* <input1> eq <input4> => That's it. I'm done talking to you.{topic=blocked}
- Please don't repeat yourself.
C<E<lt>inputE<gt>> and C<E<lt>replyE<gt>> are aliases for C<E<lt>input1E<gt>> and
C<E<lt>reply1E<gt>>, respectively.
=head2 E<lt>idE<gt>
The C<E<lt>idE<gt>> tag inserts the client's ID, as told to the RiveScript
interpreter when the client's ID and message were passed in.
=head2 E<lt>botE<gt>
Insert a bot variable, which was previously defined via the C<! Definition>
L<"var"> commands.
+ what is your name
- I am <bot name>, a chatterbot created by <bot company>.
+ my name is <bot name>
- <set name=<bot name>>What a coincidence, that's my name too!
The C<E<lt>botE<gt>> tag allows assignment as well (which deprecates the old
C<{!...}> tag.
+ set mood to (happy|angry|sad)
* <get master> == true => <bot mood=<star>>Updated my mood.
- Only my botmaster can do that.
=head2 E<lt>envE<gt>
Insert a global variable, which was previously defined via C<! Definition>
L<"global"> commands.
+ is debug mode enabled
* <env debug> == 1 => Yes, debug mode is active.
- No, debug mode is set to "<env debug>"
The C<E<lt>envE<gt>> tag allows assignment as well (which deprecates the old
C<{!...}> tag).
+ turn debug mode on
* <get master> == true => <env debug=1>Debug mode enabled.
- You can't turn debug mode on.
=head2 E<lt>getE<gt>, E<lt>setE<gt>
Get and set a client variable. These variables are local to the user ID that is
chatting with the bot.
+ my name is *
- <set name=<star>>Nice to meet you, <star>.
E<lt>getE<gt> can be used within C<+ Trigger>, but E<lt>setE<gt> can not.
=head2 E<lt>addE<gt>, E<lt>subE<gt>, E<lt>multE<gt>, E<lt>divE<gt>
Add, subtract, multiply, and divide a numeric client variable, respectively.
+ give me 5 points
- <add points=5>I've added 5 points to your account.
These tags can not be used within C<+ Trigger>.
=head2 {topic=...}
Change the client's topic. This tag can only be used with C<* Condition> and
C<- Response>.
=head2 {weight=...}
When used with C<- Response>, this will weigh the response more heavily to be
chosen when random responses are available. When used with C<+ Trigger>, this
sets that trigger to have a higher matching priority.
=head2 {@...}, E<lt>@E<gt>
Perform an inline redirection. This should work like a regular redirection but
is embedded within another response. This tag can only be used with
C<- Response>, and in the response part of a C<* Condition>.
E<lt>@E<gt> is an alias for {@E<lt>starE<gt>}
+ your *
- I think you meant to say "you are" or "you're", not "your". {@you are <star>}
=head2 {!...}
Perform an inline definition. This can be used just like the normal
C<! Definition> command from within a reply. This tag can only be used
with C<- Response>.
B<This tag is deprecated>. This tag's purpose was to redefine a global or bot
variable on the fly. Instead, the env and bot tags allow assignment.
+ set bot mood to *
- <bot mood=<star>>Bot mood set to <star>.
=head2 {random}...{/random}
Insert a sub-set of random text. This tag can NOT be used with C<+ Trigger>. Use
the same array syntax as when defining arrays (separate single-word groups with
spaces and multi-word groups with pipes).
+ say something random
- This {random}sentence statement{/random} has a random {random}set of words|gang of vocabulary{/random}.
=head2 {person}...{/person}, E<lt>personE<gt>
Process L<"person"> substitutions on a group of text.
+ say *
- Umm... "<person>"
In that example, if the client says "say you are a robot", the bot should reply,
"Umm... "I am a robot.""
E<lt>personE<gt> is an alias for {person}E<lt>starE<gt>{/person}.
=head2 {formal}...{/formal}, E<lt>formalE<gt>
Formalize A String Of Text (Capitalize Every First Letter Of Every Word).
+ my name is *
- Nice to meet you, <formal>.
E<lt>formalE<gt> is an alias for {formal}E<lt>starE<gt>{/formal}.
=head2 {sentence}...{/sentence}, E<lt>sentenceE<gt>
Format a string of text in sentence-case (capitilizing only the first letter
of the first word of each sentence).
E<lt>sentenceE<gt> is an alias for {sentence}E<lt>starE<gt>{/sentence}.
=head2 {uppercase}...{/uppercase}, E<lt>uppercaseE<gt>
FORMAT A STRING OF TEXT INTO UPPERCASE.
E<lt>uppercaseE<gt> is an alias for {uppercase}E<lt>starE<gt>{/uppercase}.
=head2 {lowercase}...{/lowercase}, E<lt>lowercaseE<gt>
format a string of text into lowercase.
E<lt>lowercaseE<gt> is an alias for {lowercase}E<lt>starE<gt>{/lowercase}.
=head2 {ok}
This is used only with the "request" trigger within the BEGIN block. It tells
the interpreter that it's okay to go and get a real response to the client's
message.
=head2 \s
Inserts a white space character. This is useful with the C<^ Continue>
command.
=head2 \n
Inserts a line break character.
=head2 \/
Inserts a forward slash.
=head2 \#
Inserts a pound symbol.
=head1 INTERPRETER IMPLEMENTATION
Interpreters of RiveScript should follow these guidelines when interpreting
RiveScript code. This details some of the priorities for processing tags and
sorting internal data structures. This part of the document should be
programming-language-independent.
=head2 STANDARD GLOBAL VARIABLES
The interpreter must support the following standard global variables:
depth = a recursion limit before an attempt to fetch a reply will be abandoned.
It's recommended to also have a C<debug> variable for consistency, but it may
not be applicable.
The C<depth> variable is strongly encouraged, though. It's to set a user-defineable
recursion limit when fetching a response. For example, a pair of triggers like
this will cause infinite recursion:
+ one
@ two
+ two
@ one
The interpreter should protect itself against such possibilities and provide a
C<depth> variable to allow the user to adjust the recursion limit.
! global depth = 25
=head2 PARSING GUIDELINES
Interpreters should parse all of the RiveScript documents ahead of time and
store them in an efficient way in which replies can be looked up quickly.
=head3 Sorting +Triggers
Triggers should be sorted in a "most specific first" order. That is:
1. Atomic triggers first. Sort them so that the triggers with the most amount
of words are on top. For multiple triggers with the same amount of words,
sort them by length, and then alphabetically if there are still matches
in length.
2. Sort triggers that contain optionals in their triggers next. Sort them in
the same manner as the atomic triggers.
3. Sort triggers containing wildcards next. Sort them by the number of words
that aren't wildcards. The order of wildcard sorting should be as follows:
A. Alphabetic wildcards (_)
B. Numeric wildcards (#)
C. Global wildcards (*)
4. The very bottom of the list will be a trigger that simply matches * by
itself, if it exists. If triggers of only _ or only # exist, sort them in
the same order as in step 3.
=head3 Sorting %Previous
C<% Previous> triggers should be sorted in the same manner as C<+ Triggers>, and
associated with the reply group that they belong to (creating pseudotopics for
each C<% Previous> is a good way to go).
=head3 Syntax Checking
It will be helpful if the interpreter also offers syntax checking and will give
verbose warnings when it tries to parse something that doesn't follow standards.
When possible, it should try to correct the error, but should still emit a
warning so that the author might fix it.
It would also be good practice to keep track of file names and line numbers of
each parsed command, so that syntax warnings can direct the author to the exact
location where the problem occurred.
=head2 REPLY FETCHING
When attempting to get a response to a client's message, the interpreter should
support the sending of a "sender ID" along with the message. This would preferably
be a screen name or handle of the client who is sending the message, and the
interpreter should be able to keep different groups of user variables for each
user ID. The E<lt>idE<gt> tag should substitute for the user's ID.
If the BEGIN block was defined in any of the loaded RiveScript documents, it should
be tried for the "request" trigger. That is, this trigger should be matched:
> begin
+ request
- {ok}
< begin
The interpreter should make the request for that trigger in the context of the
calling user, and allow it to change the user's topic or set a user variable
immediately. Do not process any other tags that are present in the response (see
L<"TAG PRIORITY">).
If the response contains the C<{ok}> tag, then make a second request to try to
match the client's actual message. When a response was found, substitute the
C<{ok}> tag from the BEGIN response with the text of the actual response the
client wanted, and then process any remaining tags in the BEGIN response.
Finally, return the reply to the client.
When fetching responses, the following order of events should happen.
1. Build in a system of recursion prevention. Since replies can redirect to
other replies, there's the possibility of deep recursion. The first thing
that the reply fetching routine should do is prevent this from getting out
of control.
2. Dig through the triggers under the client's current topic. Check to see if
there are any %Previous commands on any of these topics and see if they
match the bot's last message to the client. If so, make sure the client's
current message matches the trigger in question. If so, we have a response
set; skip to step 4.
3. Find a trigger that matches the client's message. If one is found, we have
a response set; continue to step 4.
4. If we found a reply set, process the reply. First check if this reply set
has a "solid redirection" (an @ command). If so, recurse the response
routine with the redirection trigger and resume from step 1. Break when an
eventual response was returned.
5. Process conditionals if they exist in order. As soon as one of them returns
true, we have a response and break. If none are true, continue to step 6.
6. See if there is more than one response to this trigger. If any of the random
responses has a {weight}, take that into account as a random response is
chosen. If we have a reply now, break.
7. If there is still no reply, insert a generic "no reply" error message.
When a reply was obtained, then tags should be executed on them in the order
defined under L<"TAG PRIORITY">.
=head2 TAG PRIORITY
=head3 Within BEGIN/Request
Within the "request" response of the BEGIN block, the following tags can be
executed prior to getting a real response for the client's message:
{topic}
<set>
All other tags, especially modifier tags, must be held off until the final
response has been given. Substitute C<{ok}> for the final response, and then
process the other tags.
Things like this should be able to work:
> begin
+ request
* <get name> eq undefined => {topic=new_user}{ok}
* <bot mood> eq happy => {ok}
* <bot mood> eq angry => {uppercase}{ok}{/uppercase}
* <bot mood> eq sad => {lowercase}{ok}{/lowercase}
- {ok}
< begin
=head3 Within +Trigger
All tags that appear within the context of C<+ Trigger> must be processed prior
to any attempts to match on the trigger.
=head3 Within Replies
The order that the tags should be processed within a response or anywhere else
that a tag is allowed is as follows:
<star> # Static text macros
<input> #
<reply> #
<id> #
\s #
\n #
\\ #
\# #
{random} # Random text insertion (which may contain other tags)
<person> # String modifiers
<formal> #
<sentence> #
<uppercase> #
<lowercase> #
<bot>* # Insert bot variables
<env>* # Insert environment variables
<set>* # User variable modifiers
<add>* #
<sub>* #
<mult>* #
<div>* #
<get>* # Get user variables
{topic} # Set user topic
<@> # Inline redirection
<call> # Object macros.
* The variable manipulation tags should all be processed "at the same time",
not in any particular order. This will allow, for example, the following sort
of trigger to work:
+ my name is *
* <get name> != undefined =>
^ <set oldname=<get name>>I thought your name was <get oldname>?
^ <set name=<formal>>
- <set name=<formal>>Nice to meet you.
In older implementations of RiveScript, `set` tags were processed earlier than
`get` making it impossible to copy variables. Implementations should process
this group of tags from the most-embedded outward.
An easy way to do this is with a regular expression that matches a tag that
contains no other tag, and make multiple passes until no tags remain that match
the regexp:
/<([^<]+?)>/
=head1 REVERSE COMPATIBILITY
RiveScript 2.00 will have limited backwards compatibility with RiveScript 1.x
documents. Here is a full breakdown of the differences:
RiveScript Changes from 1.02 to 2.00
------------------------------------
REMOVED:
- Variants of !DEFINITION
- ! addpath
- ! include
- ! syslib
- RiveScript Libraries (RSL files)
- RiveScript Packages (RSP files)
- These made code management messy. Keep your own
brain's files together!
COMPATIBLE CHANGES:
- Object macros now require the programming language to be defined.
- Old way: > object encode
- New way: > object encode perl
- The ^CONTINUE command can extend every command.
- Most tags can be used with almost every command.
- Topics can inherit triggers from other topics now.
INCOMPATIBLE CHANGES:
- Conditionals work differently now. Instead of comparing variables to values,
they compare values to values, and each value can <get> variables to compare.
- Old way: * name = Bob => Hello Bob!
- New way: * <get name> eq Bob => Hello Bob!
- Conditionals no longer use a single = for "equal to" comparison. Replace it
with either == or "eq".
- Object macros will receive a reference to the RiveScript object as their first
argument.
- Objects are called in a new <call> syntax instead of the old &object one.
NEW THINGS:
- {weight} is a valid tag in triggers now to increase matching priority.
- <env> has been added for calling global variables.
- <botstar> has been added for wildcard matching on %previous.
- Conditionals have more inequality comparisons now:
"==" and "eq" : equal to
"!=", "ne", and "<>" : not equal to
Nice interpreters might be able to fix some old RiveScript code to make them work.
For example, if a condition is found that has one equals sign instead of two, it
could print a warning that it's detected RiveScript 1.x code in action and
automatically adjust it to 2.x standards, and perhaps reparse the entire file or
group of files, assuming that they are RiveScript 1.x code and fix these
inconsistencies altogether.
Or perhaps there will just be a converter tool created that would go through code
that it already assumes will be RiveScript 1.x and update it to 2.x standards.
=head1 REVISIONS
Rev 12 - Nov 30, 2014
- Added implementation guidelines for dealing with variable-setting tags.
Rev 11 - Jun 13, 2013
- Clarify the ability for the <bot> and <env> tags to be used for assignment.
Rev 10 - May 15, 2012
- Deprecated the {!...} tag. It was intended for reassigning global or bot
variables. Instead use <env name=value>, <bot name=value>.
Rev 9 - Jul 31, 2009
- Added more explicit details on the usage of the BEGIN block, under the
section on >Labels / "begin"
- Revised the WD, fixing some typos.
Rev 8 - Jul 30, 2009
- The proper format for the `! version` line is to be `! version = 2.00`,
and not `! version 2.00`
- Included the "includes" option for triggers and changed how "inherits"
works.
Rev 7 - Dec 4, 2008
- Topics are able to inherit additional triggers that belong to different
topics, in the "> topic alpha inherits beta" syntax.
- Added more documentation to the "! array" section of the document. Also
check that section for some changes to the way arrays should be processed by
the interpreter.
- Deprecated the # command for inline comments. Use only // and /* */.
Rev 6 - Sep 15, 2008
- Updated the section about # for inline comments: when used next to a
+Trigger, there should be at least 2 spaces before the # symbol and 1 space
after, to avoid confusion with # as a wildcard character.
Rev 5 - Jul 22, 2008
- Added two new variants of the wildcard: # will match only numbers and _ will
match only letters. * will still match anything at all.
Rev 4 - Jun 19, 2008
- Rearranged tag priorities:
- <bot> and <env> moved higher up.
Rev 3 - Apr 2, 2008
- Typo fix: under the !person section, the examples were using !sub
- Inconsistency fix: under %Previous it was saying the wildcards were
unmatchable, but this isn't the case (they go into <botstar>).
- Typo fix: under OBJECT MACROS, fixed the explanation of the code to match
the new object syntax.
- Inconsistency fix: <@> can be used in the response portion of conditionals.
- Rearranged the tag priorities:
- String modifiers (person - lowercase) come in higher priority than
{random}
- <env> comes in after <bot>
- Typo fix: updated the object syntax (<call>) in the priority list.
Rev 2 - Feb 18, 2008
- Moved {random} to higher tag priority.
- Change the &object syntax to <call>
- Added the <env> variable.
- Added the <botstar> variable.
Rev 1 - Jan 15, 2008
- Added the {priority} tag to triggers, to increase a trigger's matching
priority over others, even when another trigger might be a better match
to the client's message.
=head1 DISCLAIMER
Note that this document is only a working draft of the RiveScript 2.00
specification and may undergo numerous changes before a final standard is
agreed on. Changes to this document after the creation date on January 14, 2008
will be noted in a change log.
http://www.rivescript.com/
=cut
| aichaos/rivescript-perl | lib/RiveScript/WD.pm | Perl | mit | 50,928 |
#!/usr/bin/perl
use strict; use warnings;
my @inputdata;
my @fields,
my @data_sorted;
my $seqname;
my ($infilename) = @ARGV;
open (my $in, "< $infilename") or die "Can't open $infilename\n";
my $outfilename = $infilename . ".sorted";
$outfilename =~ s/results/fpkm/;
open (my $out, "> $outfilename") or die "Can't create $outfilename\n";
my $headerline = <$in>;
while (my $line = <$in>) {
chomp($line);
@fields = split ('\t',$line);
$seqname = $fields[0];
if ($fields[0] =~ /_g/) {
$seqname =~ s/^c/comp/;
$seqname =~ s/_g/_c/;
$seqname =~ s/_i/_seq/;
}
else { $seqname = $fields[0] }
$seqname =~ /comp(\d+)_c(\d+)/;
push @inputdata, { comp_number => $1, subcomp => $2, name => $seqname, fpkm => $fields[6] };
}
close ($in);
@data_sorted = sort { $a->{comp_number} <=> $b->{comp_number} || $a->{subcomp} <=> $b->{subcomp} } @inputdata;
for (my $i=0; $i<@data_sorted; $i++ ) {
print $out "$data_sorted[$i]->{name}\t$data_sorted[$i]->{fpkm}\n";
}
close ($out);
| beanurn/orthoset | RSEM_results_sorted_by_comp_numerical.pl | Perl | mit | 988 |
package XML::XPath;
=head1 NAME
XML::XPath - Parse and evaluate XPath statements.
=head1 VERSION
Version 1.30
=cut
use strict; use warnings;
use vars qw($VERSION $AUTOLOAD $revision);
$VERSION = '1.30';
$XML::XPath::Namespaces = 1;
$XML::XPath::Debug = 0;
use Data::Dumper;
use XML::XPath::XMLParser;
use XML::XPath::Parser;
use IO::File;
# Parameters for new()
my @options = qw(
filename
parser
xml
ioref
context
);
=head1 DESCRIPTION
This module aims to comply exactly to the XPath specification at http://www.w3.org/TR/xpath
and yet allow extensions to be added in the form of functions.Modules such as XSLT
and XPointer may need to do this as they support functionality beyond XPath.
=head1 SYNOPSIS
use XML::XPath;
use XML::XPath::XMLParser;
my $xp = XML::XPath->new(filename => 'test.xhtml');
my $nodeset = $xp->find('/html/body/p'); # find all paragraphs
foreach my $node ($nodeset->get_nodelist) {
print "FOUND\n\n",
XML::XPath::XMLParser::as_string($node),
"\n\n";
}
=head1 DETAILS
There is an awful lot to all of this, so bear with it - if you stick it out it
should be worth it. Please get a good understanding of XPath by reading the spec
before asking me questions. All of the classes and parts herein are named to be
synonymous with the names in the specification, so consult that if you don't
understand why I'm doing something in the code.
=head1 METHODS
The API of XML::XPath itself is extremely simple to allow you to get going almost
immediately. The deeper API's are more complex, but you shouldn't have to touch
most of that.
=head2 new()
This constructor follows the often seen named parameter method call. Parameters
you can use are: filename, parser, xml, ioref and context. The filename parameter
specifies an XML file to parse. The xml parameter specifies a string to parse,
and the ioref parameter specifies an ioref to parse. The context option allows
you to specify a context node. The context node has to be in the format of a node
as specified in L<XML::XPath::XMLParser>. The 4 parameters filename, xml, ioref
and context are mutually exclusive - you should only specify one (if you specify
anything other than context, the context node is the root of your document). The
parser option allows you to pass in an already prepared XML::Parser object, to
save you having to create more than one in your application (if, for example, you
are doing more than just XPath).
my $xp = XML::XPath->new( context => $node );
It is very much recommended that you use only 1 XPath object throughout the life
of your application. This is because the object (and it's sub-objects) maintain
certain bits of state information that will be useful (such as XPath variables)
to later calls to find(). It's also a good idea because you'll use less memory
this way.
=cut
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my(%args);
# Try to figure out what the user passed
if ($#_ == 0) { # passed a scalar
my $string = $_[0];
if ($string =~ m{<.*?>}s) { # it's an XML string
$args{'xml'} = $string;
} elsif (ref($string)) { # read XML from file handle
$args{'ioref'} = $string;
} elsif ($string eq '-') { # read XML from stdin
$args{'ioref'} = IO::File->new($string);
} else { # read XML from a file
$args{'filename'} = $string;
}
} else { # passed a hash or hash reference
# just pass the parameters on to the XPath constructor
%args = ((ref($_[0]) eq "HASH") ? %{$_[0]} : @_);
}
if ($args{filename} && (!-e $args{filename} || !-r $args{filename})) {
die "Cannot open file '$args{filename}'";
}
my %hash = map(( "_$_" => $args{$_} ), @options);
$hash{path_parser} = XML::XPath::Parser->new();
return bless \%hash, $class;
}
=head2 find($path, [$context])
The find function takes an XPath expression (a string) and returns either an XML::XPath::NodeSet
object containing the nodes it found (or empty if no nodes matched the path), or
one of L<XML::XPath::Literal> (a string), L<XML::XPath::Number> or L<XML::XPath::Boolean>.
It should always return something - and you can use ->isa() to find out what it
returned. If you need to check how many nodes it found you should check $nodeset->size.
See L<XML::XPath::NodeSet>. An optional second parameter of a context node allows
you to use this method repeatedly, for example XSLT needs to do this.
=cut
sub find {
my ($self, $path, $context) = @_;
die "No path to find" unless $path;
if (!defined $context) {
$context = $self->get_context;
}
if (!defined $context) {
# Still no context? Need to parse.
my $parser = XML::XPath::XMLParser->new(
filename => $self->get_filename,
xml => $self->get_xml,
ioref => $self->get_ioref,
parser => $self->get_parser,
);
$context = $parser->parse;
$self->set_context($context);
#warn "CONTEXT:\n", Dumper([$context], ['context']);
}
my $parsed_path = $self->{path_parser}->parse($path);
#warn "\n\nPATH: ", $parsed_path->as_string, "\n\n";
#warn "evaluating path\n";
return $parsed_path->evaluate($context);
}
=head2 findnodes($path, [$context])
Returns a list of nodes found by $path, optionally in context $context. In scalar
context returns an XML::XPath::NodeSet object.
=cut
sub findnodes {
my ($self, $path, $context) = @_;
my $results = $self->find($path, $context);
if ($results->isa('XML::XPath::NodeSet')) {
return wantarray ? $results->get_nodelist : $results;
}
# warn("findnodes returned a ", ref($results), " object\n") if $XML::XPath::Debug;
return wantarray ? () : XML::XPath::NodeSet->new();
}
=head2 matches($node, $path, [$context])
Returns true if the node matches the path (optionally in context $context).
=cut
sub matches {
my $self = shift;
my ($node, $path, $context) = @_;
my @nodes = $self->findnodes($path, $context);
if (grep { "$node" eq "$_" } @nodes) {
return 1;
}
return;
}
=head2 findnodes_as_string($path, [$context])
Returns the nodes found reproduced as XML.The result is'nt guaranteed to be valid
XML though.
=cut
sub findnodes_as_string {
my ($self, $path, $context) = @_;
my $results = $self->find($path, $context);
if ($results->isa('XML::XPath::NodeSet')) {
return join('', map { $_->toString } $results->get_nodelist);
}
elsif ($results->isa('XML::XPath::Node')) {
return $results->toString;
}
else {
return XML::XPath::Node::XMLescape($results->value);
}
}
=head2 findvalue($path, [$context])
Returns either a C<XML::XPath::Literal>, a C<XML::XPath::Boolean> or a C<XML::XPath::Number>
object.If the path returns a NodeSet,$nodeset->to_literal is called automatically
for you (and thus a C<XML::XPath::Literal> is returned).Note that for each of the
objects stringification is overloaded, so you can just print the value found, or
manipulate it in the ways you would a normal perl value (e.g. using regular expressions).
=cut
sub findvalue {
my ($self, $path, $context) = @_;
my $results = $self->find($path, $context);
if ($results->isa('XML::XPath::NodeSet')) {
return $results->to_literal;
}
return $results;
}
=head2 exists($path, [$context])
Returns true if the given path exists.
=cut
sub exists {
my ($self, $path, $context) = @_;
$path = '/' if (!defined $path);
my @nodeset = $self->findnodes($path, $context);
return 1 if (scalar( @nodeset ));
return 0;
}
sub getNodeAsXML {
my ($self, $node_path) = @_;
$node_path = '/' if (!defined $node_path);
if (ref($node_path)) {
return $node_path->as_string();
} else {
return $self->findnodes_as_string($node_path);
}
}
=head2 getNodeText($path)
Returns the L<XML::XPath::Literal> for a particular XML node. Returns a string if
exists or '' (empty string) if the node doesn't exist.
=cut
sub getNodeText {
my ($self, $node_path) = @_;
if (ref($node_path)) {
return $node_path->string_value();
} else {
return $self->findvalue($node_path);
}
}
=head2 setNodeText($path, $text)
Sets the text string for a particular XML node. The node can be an element or an
attribute. If the node to be set is an attribute, and the attribute node does not
exist, it will be created automatically.
=cut
sub setNodeText {
my ($self, $node_path, $new_text) = @_;
my $nodeset = $self->findnodes($node_path);
return undef if (!defined $nodeset);
my @nodes = $nodeset->get_nodelist;
if ($#nodes < 0) {
if ($node_path =~ m{/(?:@|attribute::)([^/]+)$}) {
# attribute not found, so try to create it
# Based upon the 'perlvar' documentation located at:
# http://perldoc.perl.org/perlvar.html
#
# The @LAST_MATCH_START section indicates that there's a more efficient
# version of $` that can be used.
#
# Specifically, after a match against some variable $var:
# * $` is the same as substr($var, 0, $-[0])
my $parent_path = substr($node_path, 0, $-[0]);
my $attr = $1;
$nodeset = $self->findnodes($parent_path);
return undef if (!defined $nodeset);
foreach my $node ($nodeset->get_nodelist) {
my $newnode = XML::XPath::Node::Attribute->new($attr, $new_text);
return undef if (!defined $newnode);
$node->appendAttribute($newnode);
}
} else {
return undef;
}
}
foreach my $node (@nodes) {
if ($node->getNodeType == XML::XPath::Node::ATTRIBUTE_NODE) {
$node->setNodeValue($new_text);
} else {
foreach my $delnode ($node->getChildNodes()) {
$node->removeChild($delnode);
}
my $newnode = XML::XPath::Node::Text->new($new_text);
return undef if (!defined $newnode);
$node->appendChild($newnode);
}
}
return 1;
}
=head2 createNode($path)
Creates the node matching the C<$path> given. If part of the path given or all of
the path do not exist, the necessary nodes will be created automatically.
=cut
sub createNode {
my ($self, $node_path) = @_;
my $path_steps = $self->{path_parser}->parse($node_path);
my @path_steps = ();
my (undef, @path_steps_lhs) = @{$path_steps->get_lhs()};
foreach my $step (@path_steps_lhs) { # precompute paths as string
my $string = $step->as_string();
push(@path_steps, $string) if (defined $string && $string ne "");
}
my $prev_node = undef;
my $nodeset = undef;
my $nodes = undef;
my $p = undef;
my $test_path = "";
# Start with the deepest node, working up the path (right to left),
# trying to find a node that exists.
for ($p = $#path_steps_lhs; $p >= 0; $p--) {
my $path = $path_steps_lhs[$p];
$test_path = "(/" . join("/", @path_steps[0..$p]) . ")";
$nodeset = $self->findnodes($test_path);
return undef if (!defined $nodeset); # error looking for node
$nodes = $nodeset->size;
return undef if ($nodes > 1); # too many paths - path not specific enough
if ($nodes == 1) { # found a node -- need to create nodes below it
$prev_node = $nodeset->get_node(1);
last;
}
}
if (!defined $prev_node) {
my @root_nodes = $self->findnodes('/')->get_nodelist();
$prev_node = $root_nodes[0];
}
# We found a node that exists, or we'll start at the root.
# Create all lower nodes working left to right along the path.
for ($p++ ; $p <= $#path_steps_lhs; $p++) {
my $path = $path_steps_lhs[$p];
my $newnode = undef;
my $axis = $path->{axis};
my $name = $path->{literal};
do {
if ($axis =~ /^child$/i) {
if ($name =~ /(\S+):(\S+)/) {
$newnode = XML::XPath::Node::Element->new($name, $1);
} else {
$newnode = XML::XPath::Node::Element->new($name);
}
return undef if (!defined $newnode); # could not create new node
$prev_node->appendChild($newnode);
} elsif ($axis =~ /^attribute$/i) {
if ($name =~ /(\S+):(\S+)/) {
$newnode = XML::XPath::Node::Attribute->new($name, "", $1);
} else {
$newnode = XML::XPath::Node::Attribute->new($name, "");
}
return undef if (!defined $newnode); # could not create new node
$prev_node->appendAttribute($newnode);
}
$test_path = "(/" . join("/", @path_steps[0..$p]) . ")";
$nodeset = $self->findnodes($test_path);
$nodes = $nodeset->size;
die "failed to find node '$test_path'" if (!defined $nodeset); # error looking for node
} while ($nodes < 1);
$prev_node = $nodeset->get_node(1);
}
return $prev_node;
}
sub get_filename {
my $self = shift;
$self->{_filename};
}
sub set_filename {
my $self = shift;
$self->{_filename} = shift;
}
sub get_parser {
my $self = shift;
$self->{_parser};
}
sub set_parser {
my $self = shift;
$self->{_parser} = shift;
}
sub get_xml {
my $self = shift;
$self->{_xml};
}
sub set_xml {
my $self = shift;
$self->{_xml} = shift;
}
sub get_ioref {
my $self = shift;
$self->{_ioref};
}
sub set_ioref {
my $self = shift;
$self->{_ioref} = shift;
}
sub get_context {
my $self = shift;
$self->{_context};
}
sub set_context {
my $self = shift;
$self->{_context} = shift;
}
sub cleanup {
my $self = shift;
if ($XML::XPath::SafeMode) {
my $context = $self->get_context;
return unless $context;
$context->dispose;
}
}
=head2 set_namespace($prefix, $uri)
Sets the namespace prefix mapping to the uri.
Normally in C<XML::XPath> the prefixes in XPath node test take their context from
the current node. This means that foo:bar will always match an element <foo:bar>
regardless of the namespace that the prefix foo is mapped to (which might even
change within the document, resulting in unexpected results). In order to make
prefixes in XPath node tests actually map to a real URI, you need to enable that
via a call to the set_namespace method of your C<XML::XPath> object.
=cut
sub set_namespace {
my $self = shift;
my ($prefix, $expanded) = @_;
$self->{path_parser}->set_namespace($prefix, $expanded);
}
=head2 clear_namespaces()
Clears all previously set namespace mappings.
=cut
sub clear_namespaces {
my $self = shift;
$self->{path_parser}->clear_namespaces();
}
=head2 $XML::XPath::Namespaces
Set this to 0 if you I<don't> want namespace processing to occur. This will make
everything a little (tiny) bit faster, but you'll suffer for it, probably.
=head1 Node Object Model
See L<XML::XPath::Node>, L<XML::XPath::Node::Element>,
L<XML::XPath::Node::Text>, L<XML::XPath::Node::Comment>,
L<XML::XPath::Node::Attribute>, L<XML::XPath::Node::Namespace>,
and L<XML::XPath::Node::PI>.
=head1 On Garbage Collection
XPath nodes work in a special way that allows circular references, and yet still
lets Perl's reference counting garbage collector to clean up the nodes after use.
This should be totally transparent to the user, with one caveat: B<If you free
your tree before letting go of a sub-tree,consider that playing with fire and you
may get burned>. What does this mean to the average user? Not much. Provided you
don't free (or let go out of scope) either the tree you passed to XML::XPath->new,
or if you didn't pass a tree, and passed a filename or IO-ref, then provided you
don't let the XML::XPath object go out of scope before you let results of find()
and its friends go out of scope, then you'll be fine. Even if you B<do> let the
tree go out of scope before results, you'll probably still be fine. The only case
where you may get stung is when the last part of your path/query is either an
ancestor or parent axis. In that case the worst that will happen is you'll end up
with a circular reference that won't get cleared until interpreter destruction
time.You can get around that by explicitly calling $node->DESTROY on each of your
result nodes, if you really need to do that.
Mail me direct if that's not clear. Note that it's not doom and gloom. It's by no
means perfect,but the worst that will happen is a long running process could leak
memory. Most long running processes will therefore be able to explicitly be
careful not to free the tree (or XML::XPath object) before freeing results.AxKit,
an application that uses XML::XPath, does this and I didn't have to make any
changes to the code - it's already sensible programming.
If you I<really> don't want all this to happen, then set the variable $XML::XPath::SafeMode,
and call $xp->cleanup() on the XML::XPath object when you're finished, or $tree->dispose()
if you have a tree instead.
=head1 Example
Please see the test files in t/ for examples on how to use XPath.
=head1 AUTHOR
Original author Matt Sergeant, C<< <matt at sergeant.org> >>
Currently maintained by Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
=head1 SEE ALSO
L<XML::XPath::Literal>, L<XML::XPath::Boolean>, L<XML::XPath::Number>,
L<XML::XPath::XMLParser>, L<XML::XPath::NodeSet>, L<XML::XPath::PerlSAX>,
L<XML::XPath::Builder>.
=head1 LICENSE AND COPYRIGHT
This module is copyright 2000 AxKit.com Ltd. This is free software, and as such
comes with NO WARRANTY. No dates are used in this module. You may distribute this
module under the terms of either the Gnu GPL, or the Artistic License (the same
terms as Perl itself).
For support, please subscribe to the L<Perl-XML|http://listserv.activestate.com/mailman/listinfo/perl-xml>
mailing list at the URL
=cut
1; # End of XML::XPath
| jkb78/extrajnm | local/lib/perl5/XML/XPath.pm | Perl | mit | 18,434 |
#!/usr/bin/perl
# this script covert a 01 matrix to a to the transaction database, or
# adjacency matrix,
# each line is converted to the sequence of columns which has value 1.
$ARGC = @ARGV;
if ( $ARGC < 0 ){
printf ("01conv.pl: [separator] < input-file > output-file\n");
exit (1);
}
$count = 0;
%numbers = ();
$sep = " ";
if ( $ARGC >= 1 ){ $sep = $ARGV[0]; }
while (<STDIN>){
chomp;
@eles = split($sep, $_);
$all = @eles;
$c = 1;
foreach $item( @eles ) {
if ( $item ne "0" ){
print "$c" ;
if ($c<$all){ print $sep; }
}
$c++;
}
print "\n";
}
| ehammo/mine-dep | src/C/shd31/01conv.pl | Perl | mit | 596 |
/* Part of SWISH
Author: Jan Wielemaker
E-mail: J.Wielemaker@cs.vu.nl
WWW: http://www.swi-prolog.org
Copyright (C): 2018, VU University Amsterdam
CWI Amsterdam
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(swish_version_service, []).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_json)).
:- use_module(library(http/http_parameters)).
:- use_module(library(http/html_write)).
:- use_module(library(git)).
:- use_module(library(apply)).
:- use_module(version).
:- use_module(markdown).
/** <module> Serve version details over HTTP
This module serves SWISH and Prolog version details over HTTP. This is
file is normally loaded though the config file `version_info.pl`. This
file is not loaded by default for security reasons.
*/
:- http_handler(swish(versions), versions, [id(versions)]).
:- http_handler(swish(changes), changes, [id(changes)]).
:- http_handler(swish(changelog), changelog, [id(changelog)]).
versions(_Request) :-
prolog_version_atom(SWIVersion),
module_version_data(swish, SWISHVersion),
module_version_data(cplint,CplintGitVersion),
pack_property(cplint,version(CplintVersion)),
reply_json_dict(json{ prolog:
json{ brand: "SWI-Prolog",
version: SWIVersion
},
swish:SWISHVersion,
cplint:
json{ version:CplintVersion,
gitversion:CplintGitVersion
}
}),
module_version_data(trill,TrillGitVersion),
pack_property(trill,version(TrillVersion)),
reply_json_dict(json{ prolog:
json{ brand: "SWI-Prolog",
version: SWIVersion
},
swish:SWISHVersion,
trill:
json{ version:TrillVersion,
gitversion:TrillGitVersion
}
}).
module_version_data(Module, Dict) :-
findall(Name-Value, module_version_data(Module, Name, Value), Pairs),
dict_pairs(Dict, json, Pairs).
module_version_data(Module, Name, Value) :-
git_module_property(Module, Term),
Term =.. [Name,Value].
%! changes(+Request)
%
% Get quick statistics on changes since a commit to inform the user
% about new functionality. If no commit is passed we reply no changes
% and the last commit we have seen.
:- dynamic change_cache/3.
:- volatile change_cache/3.
:- multifile
user:message_hook/3.
user:message_hook(make(done(_)), _, _) :-
retractall(change_cache(_,_,_)),
fail.
changes(Request) :- catch(changes_r(Request),_,reply_json_dict([])).
changes_r(Request) :-
http_parameters(Request,
[ commit(Commit, [default(last)]),
show(Show, [oneof([tagged, all]), default(tagged)])
]),
changes(Commit, Show, Changes),
reply_json_dict(Changes).
changes(Commit, Show, Changes) :-
change_cache(Commit, Show, Changes),
!.
changes(Commit, Show, Changes) :-
changes_nc(Commit, Show, Changes),
asserta(change_cache(Commit, Show, Changes)).
changes_nc(Commit, Show, Changes) :-
Commit \== last,
git_module_property(swish, directory(Dir)),
atom_concat(Commit, '..', Revisions),
git_shortlog(Dir, ShortLog, [ revisions(Revisions) ]),
last_change(ShortLog, LastCommit, LastModified),
!,
include(filter_change(Show), ShortLog, ShowLog),
length(ShowLog, Count),
Changes = json{ commit: LastCommit,
date: LastModified,
changes: Count
}.
changes_nc(_, _Show, Changes) :-
git_module_property(swish, directory(Dir)),
git_shortlog(Dir, ShortLog, [limit(1)]),
last_change(ShortLog, LastCommit, LastModified),
!,
Changes = json{ commit: LastCommit,
date: LastModified,
changes: 0
}.
changes_nc(_Commit, _Show, Changes) :-
Changes = json{ changes: 0
}.
last_change([LastEntry|_], LastCommit, LastModified) :-
git_log_data(commit_hash, LastEntry, LastCommit),
git_log_data(committer_date_unix, LastEntry, LastModified).
filter_change(all, _Change).
filter_change(tagged, Change) :-
git_log_data(subject, Change, Message0),
sub_string(Message0, Pre, _, _, ":"),
Pre > 0,
!,
sub_string(Message0, 0, Pre, _, Tag),
string_upper(Tag, Tag).
%! changelog(+Request)
%
% Sends the changelog since a given version, as well as the last
% commit and its timestamp.
changelog(Request) :-
http_parameters(Request,
[ commit(Since, [optional(true)]),
last(Count, [default(10)]),
show(Show, [oneof([tagged, all]), default(tagged)]),
pack(Pack, [default(swish)])
]),
git_module_property(Pack, directory(Dir)),
( nonvar(Since)
-> atom_concat(Since, '..', Revisions),
Options = [ revisions(Revisions) ]
; Options = [ limit(Count) ]
),
git_shortlog(Dir, ShortLog, Options),
( ShortLog = [LastEntry|_]
-> git_log_data(commit_hash, LastEntry, LastCommit),
git_log_data(committer_date_unix, LastEntry, LastModified),
convlist(changelog(Show), ShortLog, ChangeLog),
reply_json_dict(json{ commit: LastCommit,
date: LastModified,
changelog: ChangeLog
})
; reply_json_dict(json{ message: "No changes"
})
).
changelog(Show, Entry,
json{commit:Commit,
author: Author,
committer_date_relative: When,
message: Message}) :-
git_log_data(subject, Entry, Message0),
format_commit_message(Show, Message0, Message),
git_log_data(commit_hash, Entry, Commit),
git_log_data(author_name, Entry, Author),
git_log_data(committer_date_relative, Entry, When).
format_commit_message(tagged, Message0, Message) :-
sub_string(Message0, Pre, _, Post, ":"),
Pre > 0,
!,
sub_string(Message0, 0, Pre, _, Tag),
string_upper(Tag, Tag),
sub_string(Message0, _, Post, 0, Msg),
string_codes(Msg, Codes),
wiki_file_codes_to_dom(Codes, '/', DOM),
phrase(wiki_html(div(class('v-changelog-entry'),
[ span(class('v-changelog-tag'), Tag)
| DOM
])),
Tokens),
with_output_to(string(Message), print_html(Tokens)).
format_commit_message(all, Message0, Message) :-
format_commit_message(tagged, Message0, Message),
!.
format_commit_message(all, Message0, Message) :-
string_codes(Message0, Codes),
wiki_file_codes_to_dom(Codes, '/', DOM),
phrase(wiki_html(div(class('v-changelog-entry'),
DOM)),
Tokens),
with_output_to(string(Message), print_html(Tokens)).
/*******************************
* COMPATIBILITY *
*******************************/
% support SWI-Prolog < 7.7.19
:- if(\+catch(check_predicate_option(git:git_shortlog/3, 3, revisions(a)),
error(_,_), fail)).
:- abolish(git:git_shortlog/3).
git:(
git_shortlog(Dir, ShortLog, Options) :-
( option(revisions(Range), Options)
-> RangeSpec = [Range]
; option(limit(Limit), Options, 10),
RangeSpec = ['-n', Limit]
),
( option(git_path(Path), Options)
-> Extra = ['--', Path]
; option(path(Path), Options)
-> relative_file_name(Path, Dir, RelPath),
Extra = ['--', RelPath]
; Extra = []
),
git_format_string(git_log, Fields, Format),
append([[log, Format], RangeSpec, Extra], GitArgv),
git_process_output(GitArgv,
read_git_formatted(git_log, Fields, ShortLog),
[directory(Dir)])).
:- endif.
| TeamSPoon/logicmoo_workspace | packs_web/swish/lib/http_version.pl | Perl | mit | 9,331 |
#!C:\strawberry\perl\bin\perl.exe
# Write a program that works like mv: rename the first command-line argument
# to the second one; if the second argument is a directory, use the same
# original basename in the new directory
use 5.020;
use warnings;
use File::Basename;
use File::Spec::Functions;
die "Usage: chapter13_ex05.pl from_name to_name\n" unless @ARGV == 2;
my ( $from, $to ) = @ARGV;
if ( -d $to ) {
my $basename = basename $from;
$to = catfile( $to, $basename );
}
rename $from, $to or die "Couldn't rename $from to $to: $!";
| bewuethr/ctci | llama_book/chapter13/chapter13_ex05.pl | Perl | mit | 550 |
#!/usr/bin/perl -w
# This script will read one fasta file and write to a new file of just fasta headers that contain only the sequence identifers.
# Megan Bowman
# 15 November 2013
use strict;
use Getopt::Long;
use Bio::Seq;
use Bio::SeqIO;
my $usage = "\nUsage: $0 --fastafile <fasta file name> --output <output file> \n";
my ($fastafile, $in, $output);
GetOptions('fastafile=s' => \$fastafile,
'output=s' => \$output,);
if (!-e $fastafile) {
die "$fastafile does not exist!\n";
}
if (-e $output) {
die "$output already exists!\n";
}
my ($id, $seqobj);
open OUT, ">$output" or die "\nFailed to open the output file: $!\n";
$in = Bio::SeqIO->new(-file => "$fastafile", -format => 'Fasta');
while ($seqobj = $in ->next_seq()) {
$id = $seqobj->display_id();
print OUT ">$id\n";
}
close OUT;
exit;
| Childs-Lab/GC_specific_MAKER | seq_name.pl | Perl | mit | 840 |
# Copyright (c) 2017 Marcel Greter.
#
# 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
# 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 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
package Compress::Zopfli;
our $VERSION = "0.0.1";
use strict;
use warnings;
use Carp;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
compress
ZOPFLI_FORMAT_GZIP
ZOPFLI_FORMAT_ZLIB
ZOPFLI_FORMAT_DEFLATE
);
require XSLoader;
XSLoader::load('Compress::Zopfli', $VERSION);
1;
__END__
=head1 NAME
Compress::Zopfli - Interface to Google Zopfli Compression Algorithm
=head1 SYNOPSIS
use Compress::Zopfli;
$gz = compress($input, ZOPFLI_FORMAT_GZIP, {
iterations => 15,
blocksplitting => 1,
blocksplittingmax => 15,
});
=head1 DESCRIPTION
The I<Compress::Zopfli> module provides a Perl interface to the I<zopfli>
compression library. The zopfli library is bundled with I<Compress::Zopfli>
, so you don't need the I<zopfli> library installed on your system.
The I<zopfli> library only contains one single compression function, which
is directly available via I<Compress::Zopfli>. It supports three different
compression variations:
- I<ZOPFLI_FORMAT_GZIP>: RFC 1952
- I<ZOPFLI_FORMAT_ZLIB>: RFC 1950
- I<ZOPFLI_FORMAT_DEFLATE>: RFC 1951
The constants are exported by default.
=head1 COMPRESS
The I<zopfli> library can only compress, not decompress. Existing zlib or
deflate libraries can decompress the data, i.e. I<IO::Compress>.
=head2 B<($compressed) = compress( $input, I<ZOPFLI_FORMAT>, [OPTIONS] ] )>
This is the only function provided by I<Compress::Zopfli>. The input must
be a string. The underlying function does not seem to support any streaming
interface.
=head1 OPTIONS
Options map directly to the I<zopfli> low-level function. Must be a hash
reference (i.e. anonymous hash) and supports the following options:
=over 5
=item B<iterations>
Maximum amount of times to rerun forward and backward pass to optimize LZ77
compression cost. Good values: 10, 15 for small files, 5 for files over
several MB in size or it will be too slow. Default: 15
=item B<blocksplitting>
If true, splits the data in multiple deflate blocks with optimal choice for
the block boundaries. Block splitting gives better compression. Default: on.
=item B<blocksplittingmax>
Maximum amount of blocks to split into (0 for unlimited, but this can give
extreme results that hurt compression on some files). Default value: 15.
=back
=head1 ALIASES
You probably only want to use a certain compression type. For that this
module also includes some convenient module aliases:
- I<Compress::Zopfli::GZIP>
- I<Compress::Zopfli::ZLIB>
- I<Compress::Zopfli::Deflate>
They export one B<compress> function without the I<ZOPFLI_FORMAT> option.
use Compress::Zopfli::Deflate;
compress $input, { iterations: 20 };
=head1 CONSTANTS
All the I<zopfli> constants are automatically imported when you make use
of I<Compress::Zopfli>. See L</DESCRIPTION> for a complete list.
=head1 AUTHOR
The I<Compress::Zopfli> module was written by Marcel Greter,
F<perl-zopfli@ocbnet.ch>. The latest copy of the module can be found on
CPAN in F<modules/by-module/Compress/Compress-Zopfli-x.x.tar.gz>.
The primary site for the I<zopfli> compression library is
F<https://github.com/google/zopfli>.
=head1 MODIFICATION HISTORY
See the Changes file. | mgreter/perl-zopfli | lib/Compress/Zopfli.pm | Perl | mit | 4,283 |
# 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 /tmp/BU3Xn7v6Kb/australasia. Olson data version 2015g
#
# Do not edit this file directly.
#
package DateTime::TimeZone::Pacific::Fiji;
$DateTime::TimeZone::Pacific::Fiji::VERSION = '1.94';
use strict;
use Class::Singleton 1.03;
use DateTime::TimeZone;
use DateTime::TimeZone::OlsonDB;
@DateTime::TimeZone::Pacific::Fiji::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' );
my $spans =
[
[
DateTime::TimeZone::NEG_INFINITY, # utc_start
60425697856, # utc_end 1915-10-25 12:04:16 (Mon)
DateTime::TimeZone::NEG_INFINITY, # local_start
60425740800, # local_end 1915-10-26 00:00:00 (Tue)
42944,
0,
'LMT',
],
[
60425697856, # utc_start 1915-10-25 12:04:16 (Mon)
63045525600, # utc_end 1998-10-31 14:00:00 (Sat)
60425741056, # local_start 1915-10-26 00:04:16 (Tue)
63045568800, # local_end 1998-11-01 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63045525600, # utc_start 1998-10-31 14:00:00 (Sat)
63055807200, # utc_end 1999-02-27 14:00:00 (Sat)
63045572400, # local_start 1998-11-01 03:00:00 (Sun)
63055854000, # local_end 1999-02-28 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63055807200, # utc_start 1999-02-27 14:00:00 (Sat)
63077580000, # utc_end 1999-11-06 14:00:00 (Sat)
63055850400, # local_start 1999-02-28 02:00:00 (Sun)
63077623200, # local_end 1999-11-07 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63077580000, # utc_start 1999-11-06 14:00:00 (Sat)
63087256800, # utc_end 2000-02-26 14:00:00 (Sat)
63077626800, # local_start 1999-11-07 03:00:00 (Sun)
63087303600, # local_end 2000-02-27 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63087256800, # utc_start 2000-02-26 14:00:00 (Sat)
63395100000, # utc_end 2009-11-28 14:00:00 (Sat)
63087300000, # local_start 2000-02-27 02:00:00 (Sun)
63395143200, # local_end 2009-11-29 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63395100000, # utc_start 2009-11-28 14:00:00 (Sat)
63405381600, # utc_end 2010-03-27 14:00:00 (Sat)
63395146800, # local_start 2009-11-29 03:00:00 (Sun)
63405428400, # local_end 2010-03-28 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63405381600, # utc_start 2010-03-27 14:00:00 (Sat)
63423525600, # utc_end 2010-10-23 14:00:00 (Sat)
63405424800, # local_start 2010-03-28 02:00:00 (Sun)
63423568800, # local_end 2010-10-24 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63423525600, # utc_start 2010-10-23 14:00:00 (Sat)
63435016800, # utc_end 2011-03-05 14:00:00 (Sat)
63423572400, # local_start 2010-10-24 03:00:00 (Sun)
63435063600, # local_end 2011-03-06 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63435016800, # utc_start 2011-03-05 14:00:00 (Sat)
63454975200, # utc_end 2011-10-22 14:00:00 (Sat)
63435060000, # local_start 2011-03-06 02:00:00 (Sun)
63455018400, # local_end 2011-10-23 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63454975200, # utc_start 2011-10-22 14:00:00 (Sat)
63462837600, # utc_end 2012-01-21 14:00:00 (Sat)
63455022000, # local_start 2011-10-23 03:00:00 (Sun)
63462884400, # local_end 2012-01-22 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63462837600, # utc_start 2012-01-21 14:00:00 (Sat)
63486424800, # utc_end 2012-10-20 14:00:00 (Sat)
63462880800, # local_start 2012-01-22 02:00:00 (Sun)
63486468000, # local_end 2012-10-21 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63486424800, # utc_start 2012-10-20 14:00:00 (Sat)
63494287200, # utc_end 2013-01-19 14:00:00 (Sat)
63486471600, # local_start 2012-10-21 03:00:00 (Sun)
63494334000, # local_end 2013-01-20 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63494287200, # utc_start 2013-01-19 14:00:00 (Sat)
63518479200, # utc_end 2013-10-26 14:00:00 (Sat)
63494330400, # local_start 2013-01-20 02:00:00 (Sun)
63518522400, # local_end 2013-10-27 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63518479200, # utc_start 2013-10-26 14:00:00 (Sat)
63525733200, # utc_end 2014-01-18 13:00:00 (Sat)
63518526000, # local_start 2013-10-27 03:00:00 (Sun)
63525780000, # local_end 2014-01-19 02:00:00 (Sun)
46800,
1,
'FJST',
],
[
63525733200, # utc_start 2014-01-18 13:00:00 (Sat)
63550533600, # utc_end 2014-11-01 14:00:00 (Sat)
63525776400, # local_start 2014-01-19 01:00:00 (Sun)
63550576800, # local_end 2014-11-02 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63550533600, # utc_start 2014-11-01 14:00:00 (Sat)
63557186400, # utc_end 2015-01-17 14:00:00 (Sat)
63550580400, # local_start 2014-11-02 03:00:00 (Sun)
63557233200, # local_end 2015-01-18 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63557186400, # utc_start 2015-01-17 14:00:00 (Sat)
63581983200, # utc_end 2015-10-31 14:00:00 (Sat)
63557229600, # local_start 2015-01-18 02:00:00 (Sun)
63582026400, # local_end 2015-11-01 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63581983200, # utc_start 2015-10-31 14:00:00 (Sat)
63588636000, # utc_end 2016-01-16 14:00:00 (Sat)
63582030000, # local_start 2015-11-01 03:00:00 (Sun)
63588682800, # local_end 2016-01-17 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63588636000, # utc_start 2016-01-16 14:00:00 (Sat)
63614037600, # utc_end 2016-11-05 14:00:00 (Sat)
63588679200, # local_start 2016-01-17 02:00:00 (Sun)
63614080800, # local_end 2016-11-06 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63614037600, # utc_start 2016-11-05 14:00:00 (Sat)
63620085600, # utc_end 2017-01-14 14:00:00 (Sat)
63614084400, # local_start 2016-11-06 03:00:00 (Sun)
63620132400, # local_end 2017-01-15 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63620085600, # utc_start 2017-01-14 14:00:00 (Sat)
63645487200, # utc_end 2017-11-04 14:00:00 (Sat)
63620128800, # local_start 2017-01-15 02:00:00 (Sun)
63645530400, # local_end 2017-11-05 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63645487200, # utc_start 2017-11-04 14:00:00 (Sat)
63652140000, # utc_end 2018-01-20 14:00:00 (Sat)
63645534000, # local_start 2017-11-05 03:00:00 (Sun)
63652186800, # local_end 2018-01-21 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63652140000, # utc_start 2018-01-20 14:00:00 (Sat)
63676936800, # utc_end 2018-11-03 14:00:00 (Sat)
63652183200, # local_start 2018-01-21 02:00:00 (Sun)
63676980000, # local_end 2018-11-04 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63676936800, # utc_start 2018-11-03 14:00:00 (Sat)
63683589600, # utc_end 2019-01-19 14:00:00 (Sat)
63676983600, # local_start 2018-11-04 03:00:00 (Sun)
63683636400, # local_end 2019-01-20 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63683589600, # utc_start 2019-01-19 14:00:00 (Sat)
63708386400, # utc_end 2019-11-02 14:00:00 (Sat)
63683632800, # local_start 2019-01-20 02:00:00 (Sun)
63708429600, # local_end 2019-11-03 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63708386400, # utc_start 2019-11-02 14:00:00 (Sat)
63715039200, # utc_end 2020-01-18 14:00:00 (Sat)
63708433200, # local_start 2019-11-03 03:00:00 (Sun)
63715086000, # local_end 2020-01-19 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63715039200, # utc_start 2020-01-18 14:00:00 (Sat)
63739836000, # utc_end 2020-10-31 14:00:00 (Sat)
63715082400, # local_start 2020-01-19 02:00:00 (Sun)
63739879200, # local_end 2020-11-01 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63739836000, # utc_start 2020-10-31 14:00:00 (Sat)
63746488800, # utc_end 2021-01-16 14:00:00 (Sat)
63739882800, # local_start 2020-11-01 03:00:00 (Sun)
63746535600, # local_end 2021-01-17 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63746488800, # utc_start 2021-01-16 14:00:00 (Sat)
63771890400, # utc_end 2021-11-06 14:00:00 (Sat)
63746532000, # local_start 2021-01-17 02:00:00 (Sun)
63771933600, # local_end 2021-11-07 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63771890400, # utc_start 2021-11-06 14:00:00 (Sat)
63777938400, # utc_end 2022-01-15 14:00:00 (Sat)
63771937200, # local_start 2021-11-07 03:00:00 (Sun)
63777985200, # local_end 2022-01-16 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63777938400, # utc_start 2022-01-15 14:00:00 (Sat)
63803340000, # utc_end 2022-11-05 14:00:00 (Sat)
63777981600, # local_start 2022-01-16 02:00:00 (Sun)
63803383200, # local_end 2022-11-06 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63803340000, # utc_start 2022-11-05 14:00:00 (Sat)
63809388000, # utc_end 2023-01-14 14:00:00 (Sat)
63803386800, # local_start 2022-11-06 03:00:00 (Sun)
63809434800, # local_end 2023-01-15 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63809388000, # utc_start 2023-01-14 14:00:00 (Sat)
63834789600, # utc_end 2023-11-04 14:00:00 (Sat)
63809431200, # local_start 2023-01-15 02:00:00 (Sun)
63834832800, # local_end 2023-11-05 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63834789600, # utc_start 2023-11-04 14:00:00 (Sat)
63841442400, # utc_end 2024-01-20 14:00:00 (Sat)
63834836400, # local_start 2023-11-05 03:00:00 (Sun)
63841489200, # local_end 2024-01-21 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63841442400, # utc_start 2024-01-20 14:00:00 (Sat)
63866239200, # utc_end 2024-11-02 14:00:00 (Sat)
63841485600, # local_start 2024-01-21 02:00:00 (Sun)
63866282400, # local_end 2024-11-03 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63866239200, # utc_start 2024-11-02 14:00:00 (Sat)
63872892000, # utc_end 2025-01-18 14:00:00 (Sat)
63866286000, # local_start 2024-11-03 03:00:00 (Sun)
63872938800, # local_end 2025-01-19 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63872892000, # utc_start 2025-01-18 14:00:00 (Sat)
63897688800, # utc_end 2025-11-01 14:00:00 (Sat)
63872935200, # local_start 2025-01-19 02:00:00 (Sun)
63897732000, # local_end 2025-11-02 02:00:00 (Sun)
43200,
0,
'FJT',
],
[
63897688800, # utc_start 2025-11-01 14:00:00 (Sat)
63904341600, # utc_end 2026-01-17 14:00:00 (Sat)
63897735600, # local_start 2025-11-02 03:00:00 (Sun)
63904388400, # local_end 2026-01-18 03:00:00 (Sun)
46800,
1,
'FJST',
],
[
63904341600, # utc_start 2026-01-17 14:00:00 (Sat)
63929138400, # utc_end 2026-10-31 14:00:00 (Sat)
63904384800, # local_start 2026-01-18 02:00:00 (Sun)
63929181600, # local_end 2026-11-01 02:00:00 (Sun)
43200,
0,
'FJT',
],
];
sub olson_version {'2015g'}
sub has_dst_changes {20}
sub _max_year {2025}
sub _new_instance {
return shift->_init( @_, spans => $spans );
}
sub _last_offset { 43200 }
my $last_observance = bless( {
'format' => 'FJ%sT',
'gmtoff' => '12:00',
'local_start_datetime' => bless( {
'formatter' => undef,
'local_rd_days' => 699372,
'local_rd_secs' => 256,
'offset_modifier' => 0,
'rd_nanosecs' => 0,
'tz' => bless( {
'name' => 'floating',
'offset' => 0
}, 'DateTime::TimeZone::Floating' ),
'utc_rd_days' => 699372,
'utc_rd_secs' => 256,
'utc_year' => 1916
}, 'DateTime' ),
'offset_from_std' => 0,
'offset_from_utc' => 43200,
'until' => [],
'utc_start_datetime' => bless( {
'formatter' => undef,
'local_rd_days' => 699371,
'local_rd_secs' => 43456,
'offset_modifier' => 0,
'rd_nanosecs' => 0,
'tz' => bless( {
'name' => 'floating',
'offset' => 0
}, 'DateTime::TimeZone::Floating' ),
'utc_rd_days' => 699371,
'utc_rd_secs' => 43456,
'utc_year' => 1916
}, 'DateTime' )
}, 'DateTime::TimeZone::OlsonDB::Observance' )
;
sub _last_observance { $last_observance }
my $rules = [
bless( {
'at' => '3:00',
'from' => '2015',
'in' => 'Jan',
'letter' => '',
'name' => 'Fiji',
'offset_from_std' => 0,
'on' => 'Sun>=15',
'save' => '0',
'to' => 'max',
'type' => undef
}, 'DateTime::TimeZone::OlsonDB::Rule' ),
bless( {
'at' => '2:00',
'from' => '2014',
'in' => 'Nov',
'letter' => 'S',
'name' => 'Fiji',
'offset_from_std' => 3600,
'on' => 'Sun>=1',
'save' => '1:00',
'to' => 'max',
'type' => undef
}, 'DateTime::TimeZone::OlsonDB::Rule' )
]
;
sub _rules { $rules }
1;
| rosiro/wasarabi | local/lib/perl5/DateTime/TimeZone/Pacific/Fiji.pm | Perl | mit | 12,221 |
# $Id: RC4.pm,v 1.5 2001/05/04 08:58:22 btrott Exp $
package Net::SSH::Perl::Cipher::RC4;
use strict;
use Net::SSH::Perl::Cipher;
use base qw( Net::SSH::Perl::Cipher );
sub new {
my $class = shift;
my $ciph = bless { }, $class;
$ciph->init(@_) if @_;
$ciph;
}
sub init {
my $ciph = shift;
my($key, $iv) = @_;
$ciph->{key} = substr($key, 0, $ciph->keysize);
$key = substr($key, 0, $ciph->keysize);
my @k = unpack 'C*', $key;
my @s = 0..255;
my($y) = (0);
for my $x (0..255) {
$y = ($k[$x % @k] + $s[$x] + $y) % 256;
@s[$x, $y] = @s[$y, $x];
}
$ciph->{s} = \@s;
$ciph->{x} = 0;
$ciph->{y} = 0;
}
sub blocksize { 8 }
sub keysize { 16 }
sub encrypt {
my($ciph, $text) = @_;
$text = RC4($ciph, $text);
$text;
}
sub decrypt {
my($ciph, $text) = @_;
$text = RC4($ciph, $text);
$text;
}
sub RC4 {
my($ciph, $text) = @_;
my($x, $y, $trans) = ($ciph->{x}, $ciph->{y}, '');
my $s = $ciph->{s};
for my $c (unpack 'C*', $text) {
$x = ($x + 1) % 256;
$y = ( $s->[$x] + $y ) % 256;
@$s[$x, $y] = @$s[$y, $x];
$trans .= pack('C', $c ^= $s->[( $s->[$x] + $s->[$y] ) % 256]);
}
$ciph->{x} = $x;
$ciph->{y} = $y;
$trans;
}
1;
__END__
=head1 NAME
Net::SSH::Perl::Cipher::RC4 - RC4 encryption/decryption
=head1 SYNOPSIS
use Net::SSH::Perl::Cipher;
my $cipher = Net::SSH::Perl::Cipher->new('RC4', $key);
print $cipher->encrypt($plaintext);
=head1 DESCRIPTION
I<Net::SSH::Perl::Cipher::RC4> provides RC4 (I<arcfour>)
encryption support for the SSH2 protocol implementation in
I<Net::SSH::Perl>. Unlike the other I<Net::SSH::Perl::Cipher>
objects, the I<RC4> module relies on no outside libraries;
the RC4 algorithm is implemented entirely in this module.
RC4 uses key sizes of 16 bytes.
=head1 AUTHOR & COPYRIGHTS
Please see the Net::SSH::Perl manpage for author, copyright,
and license information.
=cut
| carlgao/lenga | images/lenny64-peon/usr/share/perl5/Net/SSH/Perl/Cipher/RC4.pm | Perl | mit | 1,983 |
###########################################################################
# Copyright (c) 2000-2006 Nate Wiger <nate@wiger.org>. All Rights Reserved.
# Please visit www.formbuilder.org for tutorials, support, and examples.
###########################################################################
# static fields are a special FormBuilder type that turns any
# normal field into a hidden field with the value printed.
# As such, the code has to basically handle all field types.
package CGI::FormBuilder::Field::static;
use strict;
use warnings;
no warnings 'uninitialized';
use CGI::FormBuilder::Util;
use CGI::FormBuilder::Field;
use base 'CGI::FormBuilder::Field';
our $REVISION = do { (my $r='$Revision: 100 $') =~ s/\D+//g; $r };
our $VERSION = '3.0501';
sub script {
return ''; # static fields get no messages
}
*render = \&tag;
sub tag {
local $^W = 0; # -w sucks
my $self = shift;
my $attr = $self->attr;
my $jspre = $self->{_form}->jsprefix;
my @tag;
my @value = $self->tag_value; # sticky is different in <tag>
my @opt = $self->options;
debug 2, "my(@opt) = \$field->options";
# Add in our "Other:" option if applicable
push @opt, [$self->othername, $self->{_form}{messages}->form_other_default]
if $self->other;
debug 2, "$self->{name}: generating $attr->{type} input type";
# static fields are actually hidden
$attr->{type} = 'hidden';
# We iterate over each value - this is the only reliable
# way to handle multiple form values of the same name
# (i.e., multiple <input> or <hidden> fields)
@value = (undef) unless @value; # this creates a single-element array
for my $value (@value) {
my $tmp = '';
# setup the value
$attr->{value} = $value; # override
delete $attr->{value} unless defined $value;
# render the tag
$tmp .= htmltag('input', $attr);
#
# If we have options, lookup the label instead of the true value
# to print next to the field. This will happen when radio/select
# lists are converted to 'static'.
#
for (@opt) {
my($o,$n) = optval($_);
if ($o eq $value) {
$n ||= $attr->{labels}{$o} || ($self->nameopts ? toname($o) : $o);
$value = $n;
last;
}
}
# print the value out too when in a static context
$tmp .= $self->cleanopts ? escapehtml($value) : $value;
push @tag, $tmp;
}
debug 2, "$self->{name}: generated tag = @tag";
return join ' ', @tag; # always return scalar tag
}
1;
__END__
| carlgao/lenga | images/lenny64-peon/usr/share/perl5/CGI/FormBuilder/Field/static.pm | Perl | mit | 2,683 |
package Cline;
use warnings;
use strict;
use Coin;
sub new {
my $class = shift;
my $no_of_coins = shift;
my $self = {
cline => []
};
bless $self, $class;
for (my $i=0; $i < $no_of_coins; $i++) {
push(@{$self->{cline}}, Coin->new());
}
return $self;
}
sub flipAll {
my $self = shift;
foreach my $c (@{$self->{cline}}) {
$c->flip();
}
return $self;
}
sub countHeads {
my $self = shift;
my $ccount = 0;
foreach my $c (@{$self->{cline}}) {
$ccount++ if ( $c->get() );
}
return $ccount;
}
1;
| timjinx/Sample-Repo | Coins/perl2/Cline.pm | Perl | apache-2.0 | 564 |
# 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::V10::Enums::AssetSetLinkStatusEnum;
use strict;
use warnings;
use Const::Exporter enums => [
UNSPECIFIED => "UNSPECIFIED",
UNKNOWN => "UNKNOWN",
ENABLED => "ENABLED",
REMOVED => "REMOVED"
];
1;
| googleads/google-ads-perl | lib/Google/Ads/GoogleAds/V10/Enums/AssetSetLinkStatusEnum.pm | Perl | apache-2.0 | 825 |
#
# 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 hardware::devices::cisco::ces::restapi::mode::components::aic;
use strict;
use warnings;
#<Connectors item="1">
# <Microphone item="1">
# <EcReferenceDelay item="1">0</EcReferenceDelay>
# </Microphone>
# <Microphone item="2">
# <EcReferenceDelay item="1">0</EcReferenceDelay>
# </Microphone>
#</Connectors>
sub check_aic {
my ($self, %options) = @_;
foreach (@{$options{entry}->{ $options{element} }}) {
my $instance = $options{element} . ':' . $_->{item};
my $ec_reference_delay = ref($_->{EcReferenceDelay}) eq 'HASH' ? $_->{EcReferenceDelay}->{content} : $_->{EcReferenceDelay};
next if (!defined($_->{ConnectionStatus}) && !defined($ec_reference_delay));
next if ($self->check_filter(section => 'aic', instance => $instance));
$self->{components}->{aic}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"audio input connector '%s' connection status is '%s' [instance: %s, latency: %s ms]",
$instance,
defined($_->{ConnectionStatus}) ? $_->{ConnectionStatus} : 'n/a',
$instance,
defined($ec_reference_delay) ? $ec_reference_delay : '-'
)
);
if (defined($_->{ConnectionStatus})) {
my $exit = $self->get_severity(label => 'connection_status', section => 'aic.status', value => $_->{ConnectionStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("audio input connector '%s' connection status is '%s'", $instance, $_->{ConnectionStatus})
);
}
}
if (defined($ec_reference_delay)) {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'aiclatency', instance => $instance, value => $ec_reference_delay);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"audio input connector '%s' latency is %s ms",
$instance, $ec_reference_delay
)
);
}
$self->{output}->perfdata_add(
unit => 'ms',
nlabel => 'component.audio.input.connector.latency.milliseconds',
instances => [$options{element}, $_->{item}],
value => $ec_reference_delay,
warning => $warn,
critical => $crit
);
}
}
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => 'checking audio input connectors');
$self->{components}->{aic} = { name => 'audio input connectors', total => 0, skip => 0 };
return if ($self->check_filter(section => 'aic'));
check_aic(
$self,
entry => $self->{results}->{Audio}->{Input}->{Connectors},
element => 'Microphone',
instance => 'item'
);
check_aic(
$self,
entry => $self->{results}->{Audio}->{Input}->{Connectors},
element => 'HDMI',
instance => 'item'
);
}
1;
| centreon/centreon-plugins | hardware/devices/cisco/ces/restapi/mode/components/aic.pm | Perl | apache-2.0 | 4,121 |
package Paws::Pinpoint::TreatmentResource;
use Moose;
has Id => (is => 'ro', isa => 'Str');
has MessageConfiguration => (is => 'ro', isa => 'Paws::Pinpoint::MessageConfiguration');
has Schedule => (is => 'ro', isa => 'Paws::Pinpoint::Schedule');
has SizePercent => (is => 'ro', isa => 'Int');
has State => (is => 'ro', isa => 'Paws::Pinpoint::CampaignState');
has TreatmentDescription => (is => 'ro', isa => 'Str');
has TreatmentName => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Pinpoint::TreatmentResource
=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::Pinpoint::TreatmentResource object:
$service_obj->Method(Att1 => { Id => $value, ..., TreatmentName => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::Pinpoint::TreatmentResource object:
$result = $service_obj->Method(...);
$result->Att1->Id
=head1 DESCRIPTION
Treatment resource
=head1 ATTRIBUTES
=head2 Id => Str
The unique treatment ID.
=head2 MessageConfiguration => L<Paws::Pinpoint::MessageConfiguration>
The message configuration settings.
=head2 Schedule => L<Paws::Pinpoint::Schedule>
The campaign schedule.
=head2 SizePercent => Int
The allocated percentage of users for this treatment.
=head2 State => L<Paws::Pinpoint::CampaignState>
The treatment status.
=head2 TreatmentDescription => Str
A custom description for the treatment.
=head2 TreatmentName => Str
The custom name of a variation of the campaign used for A/B testing.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::Pinpoint>
=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/Pinpoint/TreatmentResource.pm | Perl | apache-2.0 | 2,157 |
=pod
=head1 NAME
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2019] 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 subscribe to the Hive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss Hive-related questions or to be notified of our updates
=cut
package Bio::EnsEMBL::Healthcheck::Pipeline::RunStandaloneHealthchecks_conf;
use strict;
use warnings;
use Data::Dumper;
use base ('Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf'); # All Hive databases configuration files should inherit from HiveGeneric, directly or indirectly
sub resource_classes {
my ($self) = @_;
return { 'default' => { 'LSF' => '-q production-rh74' },
'himem' =>
{ 'LSF' => '-q production-rh74 -M 16384 -R "rusage[mem=16384]"' }
};
}
sub default_options {
my ($self) = @_;
return {
%{$self->SUPER::default_options},
'hc_jar'=>undef,
}
}
sub pipeline_create_commands {
my ($self) = @_;
return [
@{$self->SUPER::pipeline_create_commands}, # inheriting database and hive tables' creation
# additional tables needed for long multiplication pipeline's operation:
$self->db_cmd('CREATE TABLE result (job_id int(10), output TEXT, PRIMARY KEY (job_id))')
];
}
=head2 pipeline_analyses
=cut
sub pipeline_analyses {
my ($self) = @_;
return [
{
-logic_name => 'run_standalone_healthcheck',
-module => 'Bio::EnsEMBL::Healthcheck::Pipeline::RunStandaloneHealthcheck',
-input_ids => [],
-parameters => {
hc_jar=>$self->o('hc_jar')
},
-flow_into => {
2 => [ '?table_name=result']
}
}
];
}
1;
| Ensembl/ensj-healthcheck | perl/Bio/EnsEMBL/Healthcheck/Pipeline/RunStandaloneHealthchecks_conf.pm | Perl | apache-2.0 | 2,440 |
#
# 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 database::mysql::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_sql);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
%{$self->{modes}} = (
'connection-time' => 'centreon::common::protocols::sql::mode::connectiontime',
'databases-size' => 'database::mysql::mode::databasessize',
'innodb-bufferpool-hitrate' => 'database::mysql::mode::innodbbufferpoolhitrate',
'long-queries' => 'database::mysql::mode::longqueries',
'myisam-keycache-hitrate' => 'database::mysql::mode::myisamkeycachehitrate',
'open-files' => 'database::mysql::mode::openfiles',
'qcache-hitrate' => 'database::mysql::mode::qcachehitrate',
'queries' => 'database::mysql::mode::queries',
'replication-master-slave' => 'database::mysql::mode::replicationmasterslave',
'replication-master-master' => 'database::mysql::mode::replicationmastermaster',
'slow-queries' => 'database::mysql::mode::slowqueries',
'sql' => 'centreon::common::protocols::sql::mode::sql',
'sql-string' => 'centreon::common::protocols::sql::mode::sqlstring',
'tables-size' => 'database::mysql::mode::tablessize',
'threads-connected' => 'database::mysql::mode::threadsconnected',
'uptime' => 'database::mysql::mode::uptime',
);
$self->{sql_modes}{dbi} = 'database::mysql::dbi';
$self->{sql_modes}{mysqlcmd} = 'database::mysql::mysqlcmd';
return $self;
}
sub init {
my ($self, %options) = @_;
$self->{options}->add_options(
arguments => {
'host:s@' => { name => 'db_host' },
'port:s@' => { name => 'db_port' },
'socket:s@' => { name => 'db_socket' },
}
);
$self->{options}->parse_options();
my $options_result = $self->{options}->get_options();
$self->{options}->clean();
if (defined($options_result->{db_host})) {
@{$self->{sqldefault}->{dbi}} = ();
@{$self->{sqldefault}->{mysqlcmd}} = ();
for (my $i = 0; $i < scalar(@{$options_result->{db_host}}); $i++) {
$self->{sqldefault}->{dbi}[$i] = { data_source => 'mysql:host=' . $options_result->{db_host}[$i] };
$self->{sqldefault}->{mysqlcmd}[$i] = { host => $options_result->{db_host}[$i] };
if (defined($options_result->{db_port}[$i])) {
$self->{sqldefault}->{dbi}[$i]->{data_source} .= ';port=' . $options_result->{db_port}[$i];
$self->{sqldefault}->{mysqlcmd}[$i]->{port} = $options_result->{db_port}[$i];
}
if (defined($options_result->{db_socket}[$i])) {
$self->{sqldefault}->{dbi}[$i]->{data_source} .= ';mysql_socket=' . $options_result->{db_socket}[$i];
$self->{sqldefault}->{mysqlcmd}[$i]->{socket} = $options_result->{db_socket}[$i];
}
}
}
$self->SUPER::init(%options);
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check MySQL Server.
=over 8
You can use following options or options from 'sqlmode' directly.
=item B<--host>
Hostname to query.
=item B<--port>
Database Server Port.
=back
=cut
| Sims24/centreon-plugins | database/mysql/plugin.pm | Perl | apache-2.0 | 4,452 |
package Paws::EC2::RunScheduledInstances;
use Moose;
has ClientToken => (is => 'ro', isa => 'Str');
has DryRun => (is => 'ro', isa => 'Bool');
has InstanceCount => (is => 'ro', isa => 'Int');
has LaunchSpecification => (is => 'ro', isa => 'Paws::EC2::ScheduledInstancesLaunchSpecification', required => 1);
has ScheduledInstanceId => (is => 'ro', isa => 'Str', required => 1);
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'RunScheduledInstances');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::EC2::RunScheduledInstancesResult');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::EC2::RunScheduledInstances - Arguments for method RunScheduledInstances on Paws::EC2
=head1 DESCRIPTION
This class represents the parameters used for calling the method RunScheduledInstances on the
Amazon Elastic Compute Cloud service. Use the attributes of this class
as arguments to method RunScheduledInstances.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to RunScheduledInstances.
As an example:
$service_obj->RunScheduledInstances(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 ClientToken => Str
Unique, case-sensitive identifier that ensures the idempotency of the
request. For more information, see Ensuring Idempotency.
=head2 DryRun => Bool
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response. If
you have the required permissions, the error response is
C<DryRunOperation>. Otherwise, it is C<UnauthorizedOperation>.
=head2 InstanceCount => Int
The number of instances.
Default: 1
=head2 B<REQUIRED> LaunchSpecification => L<Paws::EC2::ScheduledInstancesLaunchSpecification>
The launch specification. You must match the instance type,
Availability Zone, network, and platform of the schedule that you
purchased.
=head2 B<REQUIRED> ScheduledInstanceId => Str
The Scheduled Instance ID.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method RunScheduledInstances in L<Paws::EC2>
=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/EC2/RunScheduledInstances.pm | Perl | apache-2.0 | 2,671 |
=head1 LICENSE
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.
=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::AlleleFeatureAdaptor
#
#
=head1 NAME
Bio::EnsEMBL::Variation::DBSQL::AlleleFeatureAdaptor
=head1 SYNOPSIS
$reg = 'Bio::EnsEMBL::Registry';
$reg->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);
$af_adaptor = $reg->get_adaptor('human', 'variation', 'allelefeature');
$slice_adaptor = $reg->get_adaptor('human', 'core', 'slice');
# get all AlleleFeatures in a region
$slice = $sa->fetch_by_region('chromosome', 'X', 1e6, 2e6);
foreach $af (@{$afa->fetch_all_by_Slice($slice)}) {
print $af->start(), '-', $af->end(), ' ', $af->allele(), "\n";
}
=head1 DESCRIPTION
This adaptor provides database connectivity for AlleleFeature objects.
Genomic locations of alleles in samples can be obtained from the
database using this adaptor. See the base class BaseFeatureAdaptor for more information.
=head1 METHODS
=cut
use strict;
use warnings;
package Bio::EnsEMBL::Variation::DBSQL::AlleleFeatureAdaptor;
use Bio::EnsEMBL::Variation::AlleleFeature;
use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor;
use Bio::EnsEMBL::Variation::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::Utils::Exception qw(throw warning);
use Bio::EnsEMBL::Utils::Sequence qw(expand);
use Bio::EnsEMBL::Variation::Utils::Constants qw(%OVERLAP_CONSEQUENCES);
our @ISA = ('Bio::EnsEMBL::Variation::DBSQL::BaseAdaptor', 'Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor');
=head2 fetch_all_by_Slice
Arg[0] : Bio::EnsEMBL::Slice $slice
Arg[1] : (optional) Bio::EnsEMBL::Variation::Sample $sample
Example : my $afs = $afa->fetch_all_by_Slice($slice, $sample);
Description : Gets all AlleleFeatures in a certain Slice for a given
Sample (optional). Sample must be a designated strain.
ReturnType : reference to list of Bio::EnsEMBL::Variation::AlleleFeature
Exceptions : thrown on bad arguments
Caller : general
Status : Stable
=cut
sub fetch_all_by_Slice {
my $self = shift;
my $slice = shift;
my $sample = shift;
if(!ref($slice) || !$slice->isa('Bio::EnsEMBL::Slice')) {
throw('Bio::EnsEMBL::Slice arg expected');
}
if (defined $sample) {
if(!ref($sample) || !$sample->isa('Bio::EnsEMBL::Variation::Sample')) {
throw('Bio::EnsEMBL::Variation::Sample arg expected');
}
if(!defined($sample->dbID())) {
throw("Individual arg must have defined dbID");
}
}
%{$self->{'_slice_feature_cache'}} = (); #clean the cache to avoid caching problems
my $genotype_adaptor = $self->db->get_SampleGenotypeFeatureAdaptor; #get genotype adaptor
my $genotypes = $genotype_adaptor->fetch_all_by_Slice($slice, $sample); #and get all genotype data
my $afs = $self->SUPER::fetch_all_by_Slice_constraint($slice, $self->db->_exclude_failed_variations_constraint('vf')); #get all AlleleFeatures within the Slice
my @new_afs = ();
# merge AlleleFeatures with genotypes
foreach my $af (@{$afs}) {
# get valid alleles from allele_string
my %valid_alleles = map {$_ => 1} split('/', $af->{_vf_allele_string});
# get the variation ID of this AF
my $af_variation_id = $af->{_variation_id} || $af->variation->dbID;
# get all genotypes that have this var id
foreach my $gt (grep {$_->{_variation_id} == $af_variation_id} @$genotypes) {
# skip genotypes whose alleles are not found in allele string
my $skip = 0;
foreach my $allele(@{$gt->genotype}) {
$skip = 1 unless exists($valid_alleles{$allele});
}
next if $skip;
# create a clone of the AF
my $new_af = { %$af };
bless $new_af, ref $af;
# add the genotype
$new_af->allele_string($gt->ambiguity_code);
# add the sample
$new_af->sample($gt->sample);
push @new_afs, $new_af;
}
}
return \@new_afs;
}
sub _tables {
my $self = shift;
my @tables = (
['variation_feature', 'vf'], ['source', 's FORCE INDEX(PRIMARY)']
);
return @tables;
}
sub _columns {
my $self = shift;
return qw(
vf.variation_id vf.seq_region_id vf.seq_region_start vf.seq_region_end vf.seq_region_strand
vf.variation_name s.name vf.variation_feature_id vf.allele_string vf.consequence_types
);
}
sub _default_where_clause {
my $self = shift;
return "vf.source_id = s.source_id";
}
sub _objs_from_sth {
my ($self, $sth, $mapper, $dest_slice) = @_;
#
# This code is ugly because an attempt has been made to remove as many
# function calls as possible for speed purposes. Thus many caches and
# a fair bit of gymnastics is used.
#
my $sa = $self->db()->dnadb()->get_SliceAdaptor();
my @features;
my %slice_hash;
my %sr_name_hash;
my %sr_cs_hash;
my (
$variation_id, $seq_region_id, $seq_region_start, $seq_region_end,
$seq_region_strand, $variation_name, $source_name,
$variation_feature_id, $allele_string, $cons, $last_vf_id
);
$sth->bind_columns(
\$variation_id, \$seq_region_id, \$seq_region_start, \$seq_region_end,
\$seq_region_strand, \$variation_name, \$source_name,
\$variation_feature_id, \$allele_string, \$cons
);
my $asm_cs;
my $cmp_cs;
my $asm_cs_vers;
my $asm_cs_name;
my $cmp_cs_vers;
my $cmp_cs_name;
if ($mapper) {
$asm_cs = $mapper->assembled_CoordSystem();
$cmp_cs = $mapper->component_CoordSystem();
$asm_cs_name = $asm_cs->name();
$asm_cs_vers = $asm_cs->version();
$cmp_cs_name = $cmp_cs->name();
$cmp_cs_vers = $cmp_cs->version();
}
my $dest_slice_start;
my $dest_slice_end;
my $dest_slice_strand;
my $dest_slice_length;
if ($dest_slice) {
$dest_slice_start = $dest_slice->start();
$dest_slice_end = $dest_slice->end();
$dest_slice_strand = $dest_slice->strand();
$dest_slice_length = $dest_slice->length();
}
FEATURE: while($sth->fetch()) {
next if (defined($last_vf_id) && $last_vf_id == $variation_feature_id);
$last_vf_id = $variation_feature_id;
#get the slice object
my $slice = $slice_hash{"ID:".$seq_region_id};
if(!$slice) {
$slice = $sa->fetch_by_seq_region_id($seq_region_id);
$slice_hash{"ID:".$seq_region_id} = $slice;
$sr_name_hash{$seq_region_id} = $slice->seq_region_name();
$sr_cs_hash{$seq_region_id} = $slice->coord_system();
}
#
# remap the feature coordinates to another coord system
# if a mapper was provided
#
if($mapper) {
my $sr_name = $sr_name_hash{$seq_region_id};
my $sr_cs = $sr_cs_hash{$seq_region_id};
($sr_name,$seq_region_start,$seq_region_end,$seq_region_strand) =
$mapper->fastmap($sr_name, $seq_region_start, $seq_region_end,
$seq_region_strand, $sr_cs);
#skip features that map to gaps or coord system boundaries
next FEATURE if(!defined($sr_name));
#get a slice in the coord system we just mapped to
if($asm_cs == $sr_cs || ($cmp_cs != $sr_cs && $asm_cs->equals($sr_cs))) {
$slice = $slice_hash{"NAME:$sr_name:$cmp_cs_name:$cmp_cs_vers"} ||=
$sa->fetch_by_region($cmp_cs_name, $sr_name,undef, undef, undef,$cmp_cs_vers);
}
else {
$slice = $slice_hash{"NAME:$sr_name:$asm_cs_name:$asm_cs_vers"} ||=
$sa->fetch_by_region($asm_cs_name, $sr_name, undef, undef, undef, $asm_cs_vers);
}
}
#
# If a destination slice was provided convert the coords
# If the dest_slice starts at 1 and is foward strand, nothing needs doing
#
if($dest_slice) {
if($dest_slice_start != 1 || $dest_slice_strand != 1) {
if($dest_slice_strand == 1) {
$seq_region_start = $seq_region_start - $dest_slice_start + 1;
$seq_region_end = $seq_region_end - $dest_slice_start + 1;
}
else {
my $tmp_seq_region_start = $seq_region_start;
$seq_region_start = $dest_slice_end - $seq_region_end + 1;
$seq_region_end = $dest_slice_end - $tmp_seq_region_start + 1;
$seq_region_strand *= -1;
}
#throw away features off the end of the requested slice
if($seq_region_end < 1 || $seq_region_start > $dest_slice_length) {
next FEATURE;
}
}
$slice = $dest_slice;
}
my $overlap_consequences = [ map { $OVERLAP_CONSEQUENCES{$_} } split /,/, $cons ];
push @features, Bio::EnsEMBL::Variation::AlleleFeature->new_fast({
'start' => $seq_region_start,
'end' => $seq_region_end,
'strand' => $seq_region_strand,
'slice' => $slice,
'allele_string' => $allele_string,
'overlap_consequences' => $overlap_consequences,
'variation_name' => $variation_name,
'adaptor' => $self,
'source' => $source_name,
'_variation_id' => $variation_id,
'_variation_feature_id' => $variation_feature_id,
'_vf_allele_string' => $allele_string,
'_sample_id' => ''
});
}
return\@features;
}
=head2 get_all_synonym_sources
Args[1] : Bio::EnsEMBL::Variation::AlleleFeature $af
Example : my @sources = @{$af_adaptor->get_all_synonym_sources($af)};
Description : returns a list of all the sources for synonyms of this
AlleleFeature
ReturnType : reference to list of strings
Exceptions : none
Caller : general
Status : At Risk
: Variation database is under development.
=cut
sub get_all_synonym_sources{
my $self = shift;
my $af = shift;
my %sources;
my @sources;
if (!ref($af) || !$af->isa('Bio::EnsEMBL::Variation::AlleleFeature')) {
throw("Bio::EnsEMBL::Variation::AlleleFeature argument expected");
}
if (!defined($af->{'_variation_id'}) && !defined($af->{'variation'})){
warning("Not possible to get synonym sources for the AlleleFeature: you need to attach a Variation first");
return \@sources;
}
#get the variation_id
my $variation_id;
if (defined ($af->{'_variation_id'})){
$variation_id = $af->{'_variation_id'};
}
else {
$variation_id = $af->variation->dbID();
}
#and go to the varyation_synonym table to get the extra sources
my $source_name;
my $sth = $self->prepare(qq{SELECT s.name
FROM variation_synonym vs, source s
WHERE s.source_id = vs.source_id
AND vs.variation_id = ?
});
$sth->bind_param(1,$variation_id,SQL_INTEGER);
$sth->execute();
$sth->bind_columns(\$source_name);
while ($sth->fetch){
$sources{$source_name}++;
}
@sources = keys(%sources);
return \@sources;
}
1;
| Ensembl/ensembl-variation | modules/Bio/EnsEMBL/Variation/DBSQL/AlleleFeatureAdaptor.pm | Perl | apache-2.0 | 11,278 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is part of VivoMind Prolog Unicode Resources
% SPDX-License-Identifier: CC0-1.0
%
% VivoMind Prolog Unicode Resources is free software distributed using the
% Creative Commons CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication
% license
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Last modified: March 19, 2012
%
% Original Unicode file header comments follow
/*
# CaseFolding-6.1.0.txt
# Date: 2011-07-25, 21:21:56 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2011 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see http://www.unicode.org/reports/tr44/
#
# Case Folding Properties
#
# This file is a supplement to the UnicodeData file.
# It provides a case folding mapping generated from the Unicode Character Database.
# If all characters are mapped according to the full mapping below, then
# case differences (according to UnicodeData.txt and SpecialCasing.txt)
# are eliminated.
#
# The data supports both implementations that require simple case foldings
# (where string lengths don't change), and implementations that allow full case folding
# (where string lengths may grow). Note that where they can be supported, the
# full case foldings are superior: for example, they allow "MASSE" and "Maße" to match.
#
# All code points not listed in this file map to themselves.
#
# NOTE: case folding does not preserve normalization formats!
#
# For information on case folding, including how to have case folding
# preserve normalization formats, see Section 3.13 Default Case Algorithms in
# The Unicode Standard, Version 5.0.
#
# ================================================================================
# Format
# ================================================================================
# The entries in this file are in the following machine-readable format:
#
# <code>; <status>; <mapping>). % <name>
#
# The status field is:
# C: common case folding, common mappings shared by both simple and full mappings.
# F: full case folding, mappings that cause strings to grow in length. Multiple characters are separated by spaces.
# S: simple case folding, mappings to single characters where different from F.
# T: special case for uppercase I and dotted uppercase I
# - For non-Turkic languages, this mapping is normally not used.
# - For Turkic languages (tr, az), this mapping can be used instead of the normal mapping for these characters.
# Note that the Turkic mappings do not maintain canonical equivalence without additional processing.
# See the discussions of case mapping in the Unicode Standard for more information.
#
# Usage:
# A. To do a simple case folding, use the mappings with status C + S.
# B. To do a full case folding, use the mappings with status C + F.
#
# The mappings with status T can be used or omitted depending on the desired case-folding
# behavior. (The default option is to exclude them.)
#
# =================================================================
# Property: Case_Folding
# All code points not explicitly listed for Case_Folding
# have the value C for the status field, and the code point itself for the mapping field.
# @missing: 0000..10FFFF, c, 0x<code point>
# =================================================================
*/
unicode_case_folding(0x0041, 'C', [0x0061]). % LATIN CAPITAL LETTER A
unicode_case_folding(0x0042, 'C', [0x0062]). % LATIN CAPITAL LETTER B
unicode_case_folding(0x0043, 'C', [0x0063]). % LATIN CAPITAL LETTER C
unicode_case_folding(0x0044, 'C', [0x0064]). % LATIN CAPITAL LETTER D
unicode_case_folding(0x0045, 'C', [0x0065]). % LATIN CAPITAL LETTER E
unicode_case_folding(0x0046, 'C', [0x0066]). % LATIN CAPITAL LETTER F
unicode_case_folding(0x0047, 'C', [0x0067]). % LATIN CAPITAL LETTER G
unicode_case_folding(0x0048, 'C', [0x0068]). % LATIN CAPITAL LETTER H
unicode_case_folding(0x0049, 'C', [0x0069]). % LATIN CAPITAL LETTER I
unicode_case_folding(0x0049, 'T', [0x0131]). % LATIN CAPITAL LETTER I
unicode_case_folding(0x004A, 'C', [0x006A]). % LATIN CAPITAL LETTER J
unicode_case_folding(0x004B, 'C', [0x006B]). % LATIN CAPITAL LETTER K
unicode_case_folding(0x004C, 'C', [0x006C]). % LATIN CAPITAL LETTER L
unicode_case_folding(0x004D, 'C', [0x006D]). % LATIN CAPITAL LETTER M
unicode_case_folding(0x004E, 'C', [0x006E]). % LATIN CAPITAL LETTER N
unicode_case_folding(0x004F, 'C', [0x006F]). % LATIN CAPITAL LETTER O
unicode_case_folding(0x0050, 'C', [0x0070]). % LATIN CAPITAL LETTER P
unicode_case_folding(0x0051, 'C', [0x0071]). % LATIN CAPITAL LETTER Q
unicode_case_folding(0x0052, 'C', [0x0072]). % LATIN CAPITAL LETTER R
unicode_case_folding(0x0053, 'C', [0x0073]). % LATIN CAPITAL LETTER S
unicode_case_folding(0x0054, 'C', [0x0074]). % LATIN CAPITAL LETTER T
unicode_case_folding(0x0055, 'C', [0x0075]). % LATIN CAPITAL LETTER U
unicode_case_folding(0x0056, 'C', [0x0076]). % LATIN CAPITAL LETTER V
unicode_case_folding(0x0057, 'C', [0x0077]). % LATIN CAPITAL LETTER W
unicode_case_folding(0x0058, 'C', [0x0078]). % LATIN CAPITAL LETTER X
unicode_case_folding(0x0059, 'C', [0x0079]). % LATIN CAPITAL LETTER Y
unicode_case_folding(0x005A, 'C', [0x007A]). % LATIN CAPITAL LETTER Z
unicode_case_folding(0x00B5, 'C', [0x03BC]). % MICRO SIGN
unicode_case_folding(0x00C0, 'C', [0x00E0]). % LATIN CAPITAL LETTER A WITH GRAVE
unicode_case_folding(0x00C1, 'C', [0x00E1]). % LATIN CAPITAL LETTER A WITH ACUTE
unicode_case_folding(0x00C2, 'C', [0x00E2]). % LATIN CAPITAL LETTER A WITH CIRCUMFLEX
unicode_case_folding(0x00C3, 'C', [0x00E3]). % LATIN CAPITAL LETTER A WITH TILDE
unicode_case_folding(0x00C4, 'C', [0x00E4]). % LATIN CAPITAL LETTER A WITH DIAERESIS
unicode_case_folding(0x00C5, 'C', [0x00E5]). % LATIN CAPITAL LETTER A WITH RING ABOVE
unicode_case_folding(0x00C6, 'C', [0x00E6]). % LATIN CAPITAL LETTER AE
unicode_case_folding(0x00C7, 'C', [0x00E7]). % LATIN CAPITAL LETTER C WITH CEDILLA
unicode_case_folding(0x00C8, 'C', [0x00E8]). % LATIN CAPITAL LETTER E WITH GRAVE
unicode_case_folding(0x00C9, 'C', [0x00E9]). % LATIN CAPITAL LETTER E WITH ACUTE
unicode_case_folding(0x00CA, 'C', [0x00EA]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX
unicode_case_folding(0x00CB, 'C', [0x00EB]). % LATIN CAPITAL LETTER E WITH DIAERESIS
unicode_case_folding(0x00CC, 'C', [0x00EC]). % LATIN CAPITAL LETTER I WITH GRAVE
unicode_case_folding(0x00CD, 'C', [0x00ED]). % LATIN CAPITAL LETTER I WITH ACUTE
unicode_case_folding(0x00CE, 'C', [0x00EE]). % LATIN CAPITAL LETTER I WITH CIRCUMFLEX
unicode_case_folding(0x00CF, 'C', [0x00EF]). % LATIN CAPITAL LETTER I WITH DIAERESIS
unicode_case_folding(0x00D0, 'C', [0x00F0]). % LATIN CAPITAL LETTER ETH
unicode_case_folding(0x00D1, 'C', [0x00F1]). % LATIN CAPITAL LETTER N WITH TILDE
unicode_case_folding(0x00D2, 'C', [0x00F2]). % LATIN CAPITAL LETTER O WITH GRAVE
unicode_case_folding(0x00D3, 'C', [0x00F3]). % LATIN CAPITAL LETTER O WITH ACUTE
unicode_case_folding(0x00D4, 'C', [0x00F4]). % LATIN CAPITAL LETTER O WITH CIRCUMFLEX
unicode_case_folding(0x00D5, 'C', [0x00F5]). % LATIN CAPITAL LETTER O WITH TILDE
unicode_case_folding(0x00D6, 'C', [0x00F6]). % LATIN CAPITAL LETTER O WITH DIAERESIS
unicode_case_folding(0x00D8, 'C', [0x00F8]). % LATIN CAPITAL LETTER O WITH STROKE
unicode_case_folding(0x00D9, 'C', [0x00F9]). % LATIN CAPITAL LETTER U WITH GRAVE
unicode_case_folding(0x00DA, 'C', [0x00FA]). % LATIN CAPITAL LETTER U WITH ACUTE
unicode_case_folding(0x00DB, 'C', [0x00FB]). % LATIN CAPITAL LETTER U WITH CIRCUMFLEX
unicode_case_folding(0x00DC, 'C', [0x00FC]). % LATIN CAPITAL LETTER U WITH DIAERESIS
unicode_case_folding(0x00DD, 'C', [0x00FD]). % LATIN CAPITAL LETTER Y WITH ACUTE
unicode_case_folding(0x00DE, 'C', [0x00FE]). % LATIN CAPITAL LETTER THORN
unicode_case_folding(0x00DF, 'F', [0x0073, 0x0073]). % LATIN SMALL LETTER SHARP S
unicode_case_folding(0x0100, 'C', [0x0101]). % LATIN CAPITAL LETTER A WITH MACRON
unicode_case_folding(0x0102, 'C', [0x0103]). % LATIN CAPITAL LETTER A WITH BREVE
unicode_case_folding(0x0104, 'C', [0x0105]). % LATIN CAPITAL LETTER A WITH OGONEK
unicode_case_folding(0x0106, 'C', [0x0107]). % LATIN CAPITAL LETTER C WITH ACUTE
unicode_case_folding(0x0108, 'C', [0x0109]). % LATIN CAPITAL LETTER C WITH CIRCUMFLEX
unicode_case_folding(0x010A, 'C', [0x010B]). % LATIN CAPITAL LETTER C WITH DOT ABOVE
unicode_case_folding(0x010C, 'C', [0x010D]). % LATIN CAPITAL LETTER C WITH CARON
unicode_case_folding(0x010E, 'C', [0x010F]). % LATIN CAPITAL LETTER D WITH CARON
unicode_case_folding(0x0110, 'C', [0x0111]). % LATIN CAPITAL LETTER D WITH STROKE
unicode_case_folding(0x0112, 'C', [0x0113]). % LATIN CAPITAL LETTER E WITH MACRON
unicode_case_folding(0x0114, 'C', [0x0115]). % LATIN CAPITAL LETTER E WITH BREVE
unicode_case_folding(0x0116, 'C', [0x0117]). % LATIN CAPITAL LETTER E WITH DOT ABOVE
unicode_case_folding(0x0118, 'C', [0x0119]). % LATIN CAPITAL LETTER E WITH OGONEK
unicode_case_folding(0x011A, 'C', [0x011B]). % LATIN CAPITAL LETTER E WITH CARON
unicode_case_folding(0x011C, 'C', [0x011D]). % LATIN CAPITAL LETTER G WITH CIRCUMFLEX
unicode_case_folding(0x011E, 'C', [0x011F]). % LATIN CAPITAL LETTER G WITH BREVE
unicode_case_folding(0x0120, 'C', [0x0121]). % LATIN CAPITAL LETTER G WITH DOT ABOVE
unicode_case_folding(0x0122, 'C', [0x0123]). % LATIN CAPITAL LETTER G WITH CEDILLA
unicode_case_folding(0x0124, 'C', [0x0125]). % LATIN CAPITAL LETTER H WITH CIRCUMFLEX
unicode_case_folding(0x0126, 'C', [0x0127]). % LATIN CAPITAL LETTER H WITH STROKE
unicode_case_folding(0x0128, 'C', [0x0129]). % LATIN CAPITAL LETTER I WITH TILDE
unicode_case_folding(0x012A, 'C', [0x012B]). % LATIN CAPITAL LETTER I WITH MACRON
unicode_case_folding(0x012C, 'C', [0x012D]). % LATIN CAPITAL LETTER I WITH BREVE
unicode_case_folding(0x012E, 'C', [0x012F]). % LATIN CAPITAL LETTER I WITH OGONEK
unicode_case_folding(0x0130, 'F', [0x0069, 0x0307]). % LATIN CAPITAL LETTER I WITH DOT ABOVE
unicode_case_folding(0x0130, 'T', [0x0069]). % LATIN CAPITAL LETTER I WITH DOT ABOVE
unicode_case_folding(0x0132, 'C', [0x0133]). % LATIN CAPITAL LIGATURE IJ
unicode_case_folding(0x0134, 'C', [0x0135]). % LATIN CAPITAL LETTER J WITH CIRCUMFLEX
unicode_case_folding(0x0136, 'C', [0x0137]). % LATIN CAPITAL LETTER K WITH CEDILLA
unicode_case_folding(0x0139, 'C', [0x013A]). % LATIN CAPITAL LETTER L WITH ACUTE
unicode_case_folding(0x013B, 'C', [0x013C]). % LATIN CAPITAL LETTER L WITH CEDILLA
unicode_case_folding(0x013D, 'C', [0x013E]). % LATIN CAPITAL LETTER L WITH CARON
unicode_case_folding(0x013F, 'C', [0x0140]). % LATIN CAPITAL LETTER L WITH MIDDLE DOT
unicode_case_folding(0x0141, 'C', [0x0142]). % LATIN CAPITAL LETTER L WITH STROKE
unicode_case_folding(0x0143, 'C', [0x0144]). % LATIN CAPITAL LETTER N WITH ACUTE
unicode_case_folding(0x0145, 'C', [0x0146]). % LATIN CAPITAL LETTER N WITH CEDILLA
unicode_case_folding(0x0147, 'C', [0x0148]). % LATIN CAPITAL LETTER N WITH CARON
unicode_case_folding(0x0149, 'F', [0x02BC, 0x006E]). % LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
unicode_case_folding(0x014A, 'C', [0x014B]). % LATIN CAPITAL LETTER ENG
unicode_case_folding(0x014C, 'C', [0x014D]). % LATIN CAPITAL LETTER O WITH MACRON
unicode_case_folding(0x014E, 'C', [0x014F]). % LATIN CAPITAL LETTER O WITH BREVE
unicode_case_folding(0x0150, 'C', [0x0151]). % LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
unicode_case_folding(0x0152, 'C', [0x0153]). % LATIN CAPITAL LIGATURE OE
unicode_case_folding(0x0154, 'C', [0x0155]). % LATIN CAPITAL LETTER R WITH ACUTE
unicode_case_folding(0x0156, 'C', [0x0157]). % LATIN CAPITAL LETTER R WITH CEDILLA
unicode_case_folding(0x0158, 'C', [0x0159]). % LATIN CAPITAL LETTER R WITH CARON
unicode_case_folding(0x015A, 'C', [0x015B]). % LATIN CAPITAL LETTER S WITH ACUTE
unicode_case_folding(0x015C, 'C', [0x015D]). % LATIN CAPITAL LETTER S WITH CIRCUMFLEX
unicode_case_folding(0x015E, 'C', [0x015F]). % LATIN CAPITAL LETTER S WITH CEDILLA
unicode_case_folding(0x0160, 'C', [0x0161]). % LATIN CAPITAL LETTER S WITH CARON
unicode_case_folding(0x0162, 'C', [0x0163]). % LATIN CAPITAL LETTER T WITH CEDILLA
unicode_case_folding(0x0164, 'C', [0x0165]). % LATIN CAPITAL LETTER T WITH CARON
unicode_case_folding(0x0166, 'C', [0x0167]). % LATIN CAPITAL LETTER T WITH STROKE
unicode_case_folding(0x0168, 'C', [0x0169]). % LATIN CAPITAL LETTER U WITH TILDE
unicode_case_folding(0x016A, 'C', [0x016B]). % LATIN CAPITAL LETTER U WITH MACRON
unicode_case_folding(0x016C, 'C', [0x016D]). % LATIN CAPITAL LETTER U WITH BREVE
unicode_case_folding(0x016E, 'C', [0x016F]). % LATIN CAPITAL LETTER U WITH RING ABOVE
unicode_case_folding(0x0170, 'C', [0x0171]). % LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
unicode_case_folding(0x0172, 'C', [0x0173]). % LATIN CAPITAL LETTER U WITH OGONEK
unicode_case_folding(0x0174, 'C', [0x0175]). % LATIN CAPITAL LETTER W WITH CIRCUMFLEX
unicode_case_folding(0x0176, 'C', [0x0177]). % LATIN CAPITAL LETTER Y WITH CIRCUMFLEX
unicode_case_folding(0x0178, 'C', [0x00FF]). % LATIN CAPITAL LETTER Y WITH DIAERESIS
unicode_case_folding(0x0179, 'C', [0x017A]). % LATIN CAPITAL LETTER Z WITH ACUTE
unicode_case_folding(0x017B, 'C', [0x017C]). % LATIN CAPITAL LETTER Z WITH DOT ABOVE
unicode_case_folding(0x017D, 'C', [0x017E]). % LATIN CAPITAL LETTER Z WITH CARON
unicode_case_folding(0x017F, 'C', [0x0073]). % LATIN SMALL LETTER LONG S
unicode_case_folding(0x0181, 'C', [0x0253]). % LATIN CAPITAL LETTER B WITH HOOK
unicode_case_folding(0x0182, 'C', [0x0183]). % LATIN CAPITAL LETTER B WITH TOPBAR
unicode_case_folding(0x0184, 'C', [0x0185]). % LATIN CAPITAL LETTER TONE SIX
unicode_case_folding(0x0186, 'C', [0x0254]). % LATIN CAPITAL LETTER OPEN O
unicode_case_folding(0x0187, 'C', [0x0188]). % LATIN CAPITAL LETTER C WITH HOOK
unicode_case_folding(0x0189, 'C', [0x0256]). % LATIN CAPITAL LETTER AFRICAN D
unicode_case_folding(0x018A, 'C', [0x0257]). % LATIN CAPITAL LETTER D WITH HOOK
unicode_case_folding(0x018B, 'C', [0x018C]). % LATIN CAPITAL LETTER D WITH TOPBAR
unicode_case_folding(0x018E, 'C', [0x01DD]). % LATIN CAPITAL LETTER REVERSED E
unicode_case_folding(0x018F, 'C', [0x0259]). % LATIN CAPITAL LETTER SCHWA
unicode_case_folding(0x0190, 'C', [0x025B]). % LATIN CAPITAL LETTER OPEN E
unicode_case_folding(0x0191, 'C', [0x0192]). % LATIN CAPITAL LETTER F WITH HOOK
unicode_case_folding(0x0193, 'C', [0x0260]). % LATIN CAPITAL LETTER G WITH HOOK
unicode_case_folding(0x0194, 'C', [0x0263]). % LATIN CAPITAL LETTER GAMMA
unicode_case_folding(0x0196, 'C', [0x0269]). % LATIN CAPITAL LETTER IOTA
unicode_case_folding(0x0197, 'C', [0x0268]). % LATIN CAPITAL LETTER I WITH STROKE
unicode_case_folding(0x0198, 'C', [0x0199]). % LATIN CAPITAL LETTER K WITH HOOK
unicode_case_folding(0x019C, 'C', [0x026F]). % LATIN CAPITAL LETTER TURNED M
unicode_case_folding(0x019D, 'C', [0x0272]). % LATIN CAPITAL LETTER N WITH LEFT HOOK
unicode_case_folding(0x019F, 'C', [0x0275]). % LATIN CAPITAL LETTER O WITH MIDDLE TILDE
unicode_case_folding(0x01A0, 'C', [0x01A1]). % LATIN CAPITAL LETTER O WITH HORN
unicode_case_folding(0x01A2, 'C', [0x01A3]). % LATIN CAPITAL LETTER OI
unicode_case_folding(0x01A4, 'C', [0x01A5]). % LATIN CAPITAL LETTER P WITH HOOK
unicode_case_folding(0x01A6, 'C', [0x0280]). % LATIN LETTER YR
unicode_case_folding(0x01A7, 'C', [0x01A8]). % LATIN CAPITAL LETTER TONE TWO
unicode_case_folding(0x01A9, 'C', [0x0283]). % LATIN CAPITAL LETTER ESH
unicode_case_folding(0x01AC, 'C', [0x01AD]). % LATIN CAPITAL LETTER T WITH HOOK
unicode_case_folding(0x01AE, 'C', [0x0288]). % LATIN CAPITAL LETTER T WITH RETROFLEX HOOK
unicode_case_folding(0x01AF, 'C', [0x01B0]). % LATIN CAPITAL LETTER U WITH HORN
unicode_case_folding(0x01B1, 'C', [0x028A]). % LATIN CAPITAL LETTER UPSILON
unicode_case_folding(0x01B2, 'C', [0x028B]). % LATIN CAPITAL LETTER V WITH HOOK
unicode_case_folding(0x01B3, 'C', [0x01B4]). % LATIN CAPITAL LETTER Y WITH HOOK
unicode_case_folding(0x01B5, 'C', [0x01B6]). % LATIN CAPITAL LETTER Z WITH STROKE
unicode_case_folding(0x01B7, 'C', [0x0292]). % LATIN CAPITAL LETTER EZH
unicode_case_folding(0x01B8, 'C', [0x01B9]). % LATIN CAPITAL LETTER EZH REVERSED
unicode_case_folding(0x01BC, 'C', [0x01BD]). % LATIN CAPITAL LETTER TONE FIVE
unicode_case_folding(0x01C4, 'C', [0x01C6]). % LATIN CAPITAL LETTER DZ WITH CARON
unicode_case_folding(0x01C5, 'C', [0x01C6]). % LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
unicode_case_folding(0x01C7, 'C', [0x01C9]). % LATIN CAPITAL LETTER LJ
unicode_case_folding(0x01C8, 'C', [0x01C9]). % LATIN CAPITAL LETTER L WITH SMALL LETTER J
unicode_case_folding(0x01CA, 'C', [0x01CC]). % LATIN CAPITAL LETTER NJ
unicode_case_folding(0x01CB, 'C', [0x01CC]). % LATIN CAPITAL LETTER N WITH SMALL LETTER J
unicode_case_folding(0x01CD, 'C', [0x01CE]). % LATIN CAPITAL LETTER A WITH CARON
unicode_case_folding(0x01CF, 'C', [0x01D0]). % LATIN CAPITAL LETTER I WITH CARON
unicode_case_folding(0x01D1, 'C', [0x01D2]). % LATIN CAPITAL LETTER O WITH CARON
unicode_case_folding(0x01D3, 'C', [0x01D4]). % LATIN CAPITAL LETTER U WITH CARON
unicode_case_folding(0x01D5, 'C', [0x01D6]). % LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON
unicode_case_folding(0x01D7, 'C', [0x01D8]). % LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE
unicode_case_folding(0x01D9, 'C', [0x01DA]). % LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON
unicode_case_folding(0x01DB, 'C', [0x01DC]). % LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE
unicode_case_folding(0x01DE, 'C', [0x01DF]). % LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON
unicode_case_folding(0x01E0, 'C', [0x01E1]). % LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON
unicode_case_folding(0x01E2, 'C', [0x01E3]). % LATIN CAPITAL LETTER AE WITH MACRON
unicode_case_folding(0x01E4, 'C', [0x01E5]). % LATIN CAPITAL LETTER G WITH STROKE
unicode_case_folding(0x01E6, 'C', [0x01E7]). % LATIN CAPITAL LETTER G WITH CARON
unicode_case_folding(0x01E8, 'C', [0x01E9]). % LATIN CAPITAL LETTER K WITH CARON
unicode_case_folding(0x01EA, 'C', [0x01EB]). % LATIN CAPITAL LETTER O WITH OGONEK
unicode_case_folding(0x01EC, 'C', [0x01ED]). % LATIN CAPITAL LETTER O WITH OGONEK AND MACRON
unicode_case_folding(0x01EE, 'C', [0x01EF]). % LATIN CAPITAL LETTER EZH WITH CARON
unicode_case_folding(0x01F0, 'F', [0x006A, 0x030C]). % LATIN SMALL LETTER J WITH CARON
unicode_case_folding(0x01F1, 'C', [0x01F3]). % LATIN CAPITAL LETTER DZ
unicode_case_folding(0x01F2, 'C', [0x01F3]). % LATIN CAPITAL LETTER D WITH SMALL LETTER Z
unicode_case_folding(0x01F4, 'C', [0x01F5]). % LATIN CAPITAL LETTER G WITH ACUTE
unicode_case_folding(0x01F6, 'C', [0x0195]). % LATIN CAPITAL LETTER HWAIR
unicode_case_folding(0x01F7, 'C', [0x01BF]). % LATIN CAPITAL LETTER WYNN
unicode_case_folding(0x01F8, 'C', [0x01F9]). % LATIN CAPITAL LETTER N WITH GRAVE
unicode_case_folding(0x01FA, 'C', [0x01FB]). % LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE
unicode_case_folding(0x01FC, 'C', [0x01FD]). % LATIN CAPITAL LETTER AE WITH ACUTE
unicode_case_folding(0x01FE, 'C', [0x01FF]). % LATIN CAPITAL LETTER O WITH STROKE AND ACUTE
unicode_case_folding(0x0200, 'C', [0x0201]). % LATIN CAPITAL LETTER A WITH DOUBLE GRAVE
unicode_case_folding(0x0202, 'C', [0x0203]). % LATIN CAPITAL LETTER A WITH INVERTED BREVE
unicode_case_folding(0x0204, 'C', [0x0205]). % LATIN CAPITAL LETTER E WITH DOUBLE GRAVE
unicode_case_folding(0x0206, 'C', [0x0207]). % LATIN CAPITAL LETTER E WITH INVERTED BREVE
unicode_case_folding(0x0208, 'C', [0x0209]). % LATIN CAPITAL LETTER I WITH DOUBLE GRAVE
unicode_case_folding(0x020A, 'C', [0x020B]). % LATIN CAPITAL LETTER I WITH INVERTED BREVE
unicode_case_folding(0x020C, 'C', [0x020D]). % LATIN CAPITAL LETTER O WITH DOUBLE GRAVE
unicode_case_folding(0x020E, 'C', [0x020F]). % LATIN CAPITAL LETTER O WITH INVERTED BREVE
unicode_case_folding(0x0210, 'C', [0x0211]). % LATIN CAPITAL LETTER R WITH DOUBLE GRAVE
unicode_case_folding(0x0212, 'C', [0x0213]). % LATIN CAPITAL LETTER R WITH INVERTED BREVE
unicode_case_folding(0x0214, 'C', [0x0215]). % LATIN CAPITAL LETTER U WITH DOUBLE GRAVE
unicode_case_folding(0x0216, 'C', [0x0217]). % LATIN CAPITAL LETTER U WITH INVERTED BREVE
unicode_case_folding(0x0218, 'C', [0x0219]). % LATIN CAPITAL LETTER S WITH COMMA BELOW
unicode_case_folding(0x021A, 'C', [0x021B]). % LATIN CAPITAL LETTER T WITH COMMA BELOW
unicode_case_folding(0x021C, 'C', [0x021D]). % LATIN CAPITAL LETTER YOGH
unicode_case_folding(0x021E, 'C', [0x021F]). % LATIN CAPITAL LETTER H WITH CARON
unicode_case_folding(0x0220, 'C', [0x019E]). % LATIN CAPITAL LETTER N WITH LONG RIGHT LEG
unicode_case_folding(0x0222, 'C', [0x0223]). % LATIN CAPITAL LETTER OU
unicode_case_folding(0x0224, 'C', [0x0225]). % LATIN CAPITAL LETTER Z WITH HOOK
unicode_case_folding(0x0226, 'C', [0x0227]). % LATIN CAPITAL LETTER A WITH DOT ABOVE
unicode_case_folding(0x0228, 'C', [0x0229]). % LATIN CAPITAL LETTER E WITH CEDILLA
unicode_case_folding(0x022A, 'C', [0x022B]). % LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON
unicode_case_folding(0x022C, 'C', [0x022D]). % LATIN CAPITAL LETTER O WITH TILDE AND MACRON
unicode_case_folding(0x022E, 'C', [0x022F]). % LATIN CAPITAL LETTER O WITH DOT ABOVE
unicode_case_folding(0x0230, 'C', [0x0231]). % LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON
unicode_case_folding(0x0232, 'C', [0x0233]). % LATIN CAPITAL LETTER Y WITH MACRON
unicode_case_folding(0x023A, 'C', [0x2C65]). % LATIN CAPITAL LETTER A WITH STROKE
unicode_case_folding(0x023B, 'C', [0x023C]). % LATIN CAPITAL LETTER C WITH STROKE
unicode_case_folding(0x023D, 'C', [0x019A]). % LATIN CAPITAL LETTER L WITH BAR
unicode_case_folding(0x023E, 'C', [0x2C66]). % LATIN CAPITAL LETTER T WITH DIAGONAL STROKE
unicode_case_folding(0x0241, 'C', [0x0242]). % LATIN CAPITAL LETTER GLOTTAL STOP
unicode_case_folding(0x0243, 'C', [0x0180]). % LATIN CAPITAL LETTER B WITH STROKE
unicode_case_folding(0x0244, 'C', [0x0289]). % LATIN CAPITAL LETTER U BAR
unicode_case_folding(0x0245, 'C', [0x028C]). % LATIN CAPITAL LETTER TURNED V
unicode_case_folding(0x0246, 'C', [0x0247]). % LATIN CAPITAL LETTER E WITH STROKE
unicode_case_folding(0x0248, 'C', [0x0249]). % LATIN CAPITAL LETTER J WITH STROKE
unicode_case_folding(0x024A, 'C', [0x024B]). % LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL
unicode_case_folding(0x024C, 'C', [0x024D]). % LATIN CAPITAL LETTER R WITH STROKE
unicode_case_folding(0x024E, 'C', [0x024F]). % LATIN CAPITAL LETTER Y WITH STROKE
unicode_case_folding(0x0345, 'C', [0x03B9]). % COMBINING GREEK YPOGEGRAMMENI
unicode_case_folding(0x0370, 'C', [0x0371]). % GREEK CAPITAL LETTER HETA
unicode_case_folding(0x0372, 'C', [0x0373]). % GREEK CAPITAL LETTER ARCHAIC SAMPI
unicode_case_folding(0x0376, 'C', [0x0377]). % GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA
unicode_case_folding(0x0386, 'C', [0x03AC]). % GREEK CAPITAL LETTER ALPHA WITH TONOS
unicode_case_folding(0x0388, 'C', [0x03AD]). % GREEK CAPITAL LETTER EPSILON WITH TONOS
unicode_case_folding(0x0389, 'C', [0x03AE]). % GREEK CAPITAL LETTER ETA WITH TONOS
unicode_case_folding(0x038A, 'C', [0x03AF]). % GREEK CAPITAL LETTER IOTA WITH TONOS
unicode_case_folding(0x038C, 'C', [0x03CC]). % GREEK CAPITAL LETTER OMICRON WITH TONOS
unicode_case_folding(0x038E, 'C', [0x03CD]). % GREEK CAPITAL LETTER UPSILON WITH TONOS
unicode_case_folding(0x038F, 'C', [0x03CE]). % GREEK CAPITAL LETTER OMEGA WITH TONOS
unicode_case_folding(0x0390, 'F', [0x03B9, 0x0308, 0x0301]). % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
unicode_case_folding(0x0391, 'C', [0x03B1]). % GREEK CAPITAL LETTER ALPHA
unicode_case_folding(0x0392, 'C', [0x03B2]). % GREEK CAPITAL LETTER BETA
unicode_case_folding(0x0393, 'C', [0x03B3]). % GREEK CAPITAL LETTER GAMMA
unicode_case_folding(0x0394, 'C', [0x03B4]). % GREEK CAPITAL LETTER DELTA
unicode_case_folding(0x0395, 'C', [0x03B5]). % GREEK CAPITAL LETTER EPSILON
unicode_case_folding(0x0396, 'C', [0x03B6]). % GREEK CAPITAL LETTER ZETA
unicode_case_folding(0x0397, 'C', [0x03B7]). % GREEK CAPITAL LETTER ETA
unicode_case_folding(0x0398, 'C', [0x03B8]). % GREEK CAPITAL LETTER THETA
unicode_case_folding(0x0399, 'C', [0x03B9]). % GREEK CAPITAL LETTER IOTA
unicode_case_folding(0x039A, 'C', [0x03BA]). % GREEK CAPITAL LETTER KAPPA
unicode_case_folding(0x039B, 'C', [0x03BB]). % GREEK CAPITAL LETTER LAMDA
unicode_case_folding(0x039C, 'C', [0x03BC]). % GREEK CAPITAL LETTER MU
unicode_case_folding(0x039D, 'C', [0x03BD]). % GREEK CAPITAL LETTER NU
unicode_case_folding(0x039E, 'C', [0x03BE]). % GREEK CAPITAL LETTER XI
unicode_case_folding(0x039F, 'C', [0x03BF]). % GREEK CAPITAL LETTER OMICRON
unicode_case_folding(0x03A0, 'C', [0x03C0]). % GREEK CAPITAL LETTER PI
unicode_case_folding(0x03A1, 'C', [0x03C1]). % GREEK CAPITAL LETTER RHO
unicode_case_folding(0x03A3, 'C', [0x03C3]). % GREEK CAPITAL LETTER SIGMA
unicode_case_folding(0x03A4, 'C', [0x03C4]). % GREEK CAPITAL LETTER TAU
unicode_case_folding(0x03A5, 'C', [0x03C5]). % GREEK CAPITAL LETTER UPSILON
unicode_case_folding(0x03A6, 'C', [0x03C6]). % GREEK CAPITAL LETTER PHI
unicode_case_folding(0x03A7, 'C', [0x03C7]). % GREEK CAPITAL LETTER CHI
unicode_case_folding(0x03A8, 'C', [0x03C8]). % GREEK CAPITAL LETTER PSI
unicode_case_folding(0x03A9, 'C', [0x03C9]). % GREEK CAPITAL LETTER OMEGA
unicode_case_folding(0x03AA, 'C', [0x03CA]). % GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
unicode_case_folding(0x03AB, 'C', [0x03CB]). % GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
unicode_case_folding(0x03B0, 'F', [0x03C5, 0x0308, 0x0301]). % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
unicode_case_folding(0x03C2, 'C', [0x03C3]). % GREEK SMALL LETTER FINAL SIGMA
unicode_case_folding(0x03CF, 'C', [0x03D7]). % GREEK CAPITAL KAI SYMBOL
unicode_case_folding(0x03D0, 'C', [0x03B2]). % GREEK BETA SYMBOL
unicode_case_folding(0x03D1, 'C', [0x03B8]). % GREEK THETA SYMBOL
unicode_case_folding(0x03D5, 'C', [0x03C6]). % GREEK PHI SYMBOL
unicode_case_folding(0x03D6, 'C', [0x03C0]). % GREEK PI SYMBOL
unicode_case_folding(0x03D8, 'C', [0x03D9]). % GREEK LETTER ARCHAIC KOPPA
unicode_case_folding(0x03DA, 'C', [0x03DB]). % GREEK LETTER STIGMA
unicode_case_folding(0x03DC, 'C', [0x03DD]). % GREEK LETTER DIGAMMA
unicode_case_folding(0x03DE, 'C', [0x03DF]). % GREEK LETTER KOPPA
unicode_case_folding(0x03E0, 'C', [0x03E1]). % GREEK LETTER SAMPI
unicode_case_folding(0x03E2, 'C', [0x03E3]). % COPTIC CAPITAL LETTER SHEI
unicode_case_folding(0x03E4, 'C', [0x03E5]). % COPTIC CAPITAL LETTER FEI
unicode_case_folding(0x03E6, 'C', [0x03E7]). % COPTIC CAPITAL LETTER KHEI
unicode_case_folding(0x03E8, 'C', [0x03E9]). % COPTIC CAPITAL LETTER HORI
unicode_case_folding(0x03EA, 'C', [0x03EB]). % COPTIC CAPITAL LETTER GANGIA
unicode_case_folding(0x03EC, 'C', [0x03ED]). % COPTIC CAPITAL LETTER SHIMA
unicode_case_folding(0x03EE, 'C', [0x03EF]). % COPTIC CAPITAL LETTER DEI
unicode_case_folding(0x03F0, 'C', [0x03BA]). % GREEK KAPPA SYMBOL
unicode_case_folding(0x03F1, 'C', [0x03C1]). % GREEK RHO SYMBOL
unicode_case_folding(0x03F4, 'C', [0x03B8]). % GREEK CAPITAL THETA SYMBOL
unicode_case_folding(0x03F5, 'C', [0x03B5]). % GREEK LUNATE EPSILON SYMBOL
unicode_case_folding(0x03F7, 'C', [0x03F8]). % GREEK CAPITAL LETTER SHO
unicode_case_folding(0x03F9, 'C', [0x03F2]). % GREEK CAPITAL LUNATE SIGMA SYMBOL
unicode_case_folding(0x03FA, 'C', [0x03FB]). % GREEK CAPITAL LETTER SAN
unicode_case_folding(0x03FD, 'C', [0x037B]). % GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL
unicode_case_folding(0x03FE, 'C', [0x037C]). % GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL
unicode_case_folding(0x03FF, 'C', [0x037D]). % GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL
unicode_case_folding(0x0400, 'C', [0x0450]). % CYRILLIC CAPITAL LETTER IE WITH GRAVE
unicode_case_folding(0x0401, 'C', [0x0451]). % CYRILLIC CAPITAL LETTER IO
unicode_case_folding(0x0402, 'C', [0x0452]). % CYRILLIC CAPITAL LETTER DJE
unicode_case_folding(0x0403, 'C', [0x0453]). % CYRILLIC CAPITAL LETTER GJE
unicode_case_folding(0x0404, 'C', [0x0454]). % CYRILLIC CAPITAL LETTER UKRAINIAN IE
unicode_case_folding(0x0405, 'C', [0x0455]). % CYRILLIC CAPITAL LETTER DZE
unicode_case_folding(0x0406, 'C', [0x0456]). % CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
unicode_case_folding(0x0407, 'C', [0x0457]). % CYRILLIC CAPITAL LETTER YI
unicode_case_folding(0x0408, 'C', [0x0458]). % CYRILLIC CAPITAL LETTER JE
unicode_case_folding(0x0409, 'C', [0x0459]). % CYRILLIC CAPITAL LETTER LJE
unicode_case_folding(0x040A, 'C', [0x045A]). % CYRILLIC CAPITAL LETTER NJE
unicode_case_folding(0x040B, 'C', [0x045B]). % CYRILLIC CAPITAL LETTER TSHE
unicode_case_folding(0x040C, 'C', [0x045C]). % CYRILLIC CAPITAL LETTER KJE
unicode_case_folding(0x040D, 'C', [0x045D]). % CYRILLIC CAPITAL LETTER I WITH GRAVE
unicode_case_folding(0x040E, 'C', [0x045E]). % CYRILLIC CAPITAL LETTER SHORT U
unicode_case_folding(0x040F, 'C', [0x045F]). % CYRILLIC CAPITAL LETTER DZHE
unicode_case_folding(0x0410, 'C', [0x0430]). % CYRILLIC CAPITAL LETTER A
unicode_case_folding(0x0411, 'C', [0x0431]). % CYRILLIC CAPITAL LETTER BE
unicode_case_folding(0x0412, 'C', [0x0432]). % CYRILLIC CAPITAL LETTER VE
unicode_case_folding(0x0413, 'C', [0x0433]). % CYRILLIC CAPITAL LETTER GHE
unicode_case_folding(0x0414, 'C', [0x0434]). % CYRILLIC CAPITAL LETTER DE
unicode_case_folding(0x0415, 'C', [0x0435]). % CYRILLIC CAPITAL LETTER IE
unicode_case_folding(0x0416, 'C', [0x0436]). % CYRILLIC CAPITAL LETTER ZHE
unicode_case_folding(0x0417, 'C', [0x0437]). % CYRILLIC CAPITAL LETTER ZE
unicode_case_folding(0x0418, 'C', [0x0438]). % CYRILLIC CAPITAL LETTER I
unicode_case_folding(0x0419, 'C', [0x0439]). % CYRILLIC CAPITAL LETTER SHORT I
unicode_case_folding(0x041A, 'C', [0x043A]). % CYRILLIC CAPITAL LETTER KA
unicode_case_folding(0x041B, 'C', [0x043B]). % CYRILLIC CAPITAL LETTER EL
unicode_case_folding(0x041C, 'C', [0x043C]). % CYRILLIC CAPITAL LETTER EM
unicode_case_folding(0x041D, 'C', [0x043D]). % CYRILLIC CAPITAL LETTER EN
unicode_case_folding(0x041E, 'C', [0x043E]). % CYRILLIC CAPITAL LETTER O
unicode_case_folding(0x041F, 'C', [0x043F]). % CYRILLIC CAPITAL LETTER PE
unicode_case_folding(0x0420, 'C', [0x0440]). % CYRILLIC CAPITAL LETTER ER
unicode_case_folding(0x0421, 'C', [0x0441]). % CYRILLIC CAPITAL LETTER ES
unicode_case_folding(0x0422, 'C', [0x0442]). % CYRILLIC CAPITAL LETTER TE
unicode_case_folding(0x0423, 'C', [0x0443]). % CYRILLIC CAPITAL LETTER U
unicode_case_folding(0x0424, 'C', [0x0444]). % CYRILLIC CAPITAL LETTER EF
unicode_case_folding(0x0425, 'C', [0x0445]). % CYRILLIC CAPITAL LETTER HA
unicode_case_folding(0x0426, 'C', [0x0446]). % CYRILLIC CAPITAL LETTER TSE
unicode_case_folding(0x0427, 'C', [0x0447]). % CYRILLIC CAPITAL LETTER CHE
unicode_case_folding(0x0428, 'C', [0x0448]). % CYRILLIC CAPITAL LETTER SHA
unicode_case_folding(0x0429, 'C', [0x0449]). % CYRILLIC CAPITAL LETTER SHCHA
unicode_case_folding(0x042A, 'C', [0x044A]). % CYRILLIC CAPITAL LETTER HARD SIGN
unicode_case_folding(0x042B, 'C', [0x044B]). % CYRILLIC CAPITAL LETTER YERU
unicode_case_folding(0x042C, 'C', [0x044C]). % CYRILLIC CAPITAL LETTER SOFT SIGN
unicode_case_folding(0x042D, 'C', [0x044D]). % CYRILLIC CAPITAL LETTER E
unicode_case_folding(0x042E, 'C', [0x044E]). % CYRILLIC CAPITAL LETTER YU
unicode_case_folding(0x042F, 'C', [0x044F]). % CYRILLIC CAPITAL LETTER YA
unicode_case_folding(0x0460, 'C', [0x0461]). % CYRILLIC CAPITAL LETTER OMEGA
unicode_case_folding(0x0462, 'C', [0x0463]). % CYRILLIC CAPITAL LETTER YAT
unicode_case_folding(0x0464, 'C', [0x0465]). % CYRILLIC CAPITAL LETTER IOTIFIED E
unicode_case_folding(0x0466, 'C', [0x0467]). % CYRILLIC CAPITAL LETTER LITTLE YUS
unicode_case_folding(0x0468, 'C', [0x0469]). % CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS
unicode_case_folding(0x046A, 'C', [0x046B]). % CYRILLIC CAPITAL LETTER BIG YUS
unicode_case_folding(0x046C, 'C', [0x046D]). % CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS
unicode_case_folding(0x046E, 'C', [0x046F]). % CYRILLIC CAPITAL LETTER KSI
unicode_case_folding(0x0470, 'C', [0x0471]). % CYRILLIC CAPITAL LETTER PSI
unicode_case_folding(0x0472, 'C', [0x0473]). % CYRILLIC CAPITAL LETTER FITA
unicode_case_folding(0x0474, 'C', [0x0475]). % CYRILLIC CAPITAL LETTER IZHITSA
unicode_case_folding(0x0476, 'C', [0x0477]). % CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT
unicode_case_folding(0x0478, 'C', [0x0479]). % CYRILLIC CAPITAL LETTER UK
unicode_case_folding(0x047A, 'C', [0x047B]). % CYRILLIC CAPITAL LETTER ROUND OMEGA
unicode_case_folding(0x047C, 'C', [0x047D]). % CYRILLIC CAPITAL LETTER OMEGA WITH TITLO
unicode_case_folding(0x047E, 'C', [0x047F]). % CYRILLIC CAPITAL LETTER OT
unicode_case_folding(0x0480, 'C', [0x0481]). % CYRILLIC CAPITAL LETTER KOPPA
unicode_case_folding(0x048A, 'C', [0x048B]). % CYRILLIC CAPITAL LETTER SHORT I WITH TAIL
unicode_case_folding(0x048C, 'C', [0x048D]). % CYRILLIC CAPITAL LETTER SEMISOFT SIGN
unicode_case_folding(0x048E, 'C', [0x048F]). % CYRILLIC CAPITAL LETTER ER WITH TICK
unicode_case_folding(0x0490, 'C', [0x0491]). % CYRILLIC CAPITAL LETTER GHE WITH UPTURN
unicode_case_folding(0x0492, 'C', [0x0493]). % CYRILLIC CAPITAL LETTER GHE WITH STROKE
unicode_case_folding(0x0494, 'C', [0x0495]). % CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK
unicode_case_folding(0x0496, 'C', [0x0497]). % CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER
unicode_case_folding(0x0498, 'C', [0x0499]). % CYRILLIC CAPITAL LETTER ZE WITH DESCENDER
unicode_case_folding(0x049A, 'C', [0x049B]). % CYRILLIC CAPITAL LETTER KA WITH DESCENDER
unicode_case_folding(0x049C, 'C', [0x049D]). % CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE
unicode_case_folding(0x049E, 'C', [0x049F]). % CYRILLIC CAPITAL LETTER KA WITH STROKE
unicode_case_folding(0x04A0, 'C', [0x04A1]). % CYRILLIC CAPITAL LETTER BASHKIR KA
unicode_case_folding(0x04A2, 'C', [0x04A3]). % CYRILLIC CAPITAL LETTER EN WITH DESCENDER
unicode_case_folding(0x04A4, 'C', [0x04A5]). % CYRILLIC CAPITAL LIGATURE EN GHE
unicode_case_folding(0x04A6, 'C', [0x04A7]). % CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK
unicode_case_folding(0x04A8, 'C', [0x04A9]). % CYRILLIC CAPITAL LETTER ABKHASIAN HA
unicode_case_folding(0x04AA, 'C', [0x04AB]). % CYRILLIC CAPITAL LETTER ES WITH DESCENDER
unicode_case_folding(0x04AC, 'C', [0x04AD]). % CYRILLIC CAPITAL LETTER TE WITH DESCENDER
unicode_case_folding(0x04AE, 'C', [0x04AF]). % CYRILLIC CAPITAL LETTER STRAIGHT U
unicode_case_folding(0x04B0, 'C', [0x04B1]). % CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
unicode_case_folding(0x04B2, 'C', [0x04B3]). % CYRILLIC CAPITAL LETTER HA WITH DESCENDER
unicode_case_folding(0x04B4, 'C', [0x04B5]). % CYRILLIC CAPITAL LIGATURE TE TSE
unicode_case_folding(0x04B6, 'C', [0x04B7]). % CYRILLIC CAPITAL LETTER CHE WITH DESCENDER
unicode_case_folding(0x04B8, 'C', [0x04B9]). % CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE
unicode_case_folding(0x04BA, 'C', [0x04BB]). % CYRILLIC CAPITAL LETTER SHHA
unicode_case_folding(0x04BC, 'C', [0x04BD]). % CYRILLIC CAPITAL LETTER ABKHASIAN CHE
unicode_case_folding(0x04BE, 'C', [0x04BF]). % CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER
unicode_case_folding(0x04C0, 'C', [0x04CF]). % CYRILLIC LETTER PALOCHKA
unicode_case_folding(0x04C1, 'C', [0x04C2]). % CYRILLIC CAPITAL LETTER ZHE WITH BREVE
unicode_case_folding(0x04C3, 'C', [0x04C4]). % CYRILLIC CAPITAL LETTER KA WITH HOOK
unicode_case_folding(0x04C5, 'C', [0x04C6]). % CYRILLIC CAPITAL LETTER EL WITH TAIL
unicode_case_folding(0x04C7, 'C', [0x04C8]). % CYRILLIC CAPITAL LETTER EN WITH HOOK
unicode_case_folding(0x04C9, 'C', [0x04CA]). % CYRILLIC CAPITAL LETTER EN WITH TAIL
unicode_case_folding(0x04CB, 'C', [0x04CC]). % CYRILLIC CAPITAL LETTER KHAKASSIAN CHE
unicode_case_folding(0x04CD, 'C', [0x04CE]). % CYRILLIC CAPITAL LETTER EM WITH TAIL
unicode_case_folding(0x04D0, 'C', [0x04D1]). % CYRILLIC CAPITAL LETTER A WITH BREVE
unicode_case_folding(0x04D2, 'C', [0x04D3]). % CYRILLIC CAPITAL LETTER A WITH DIAERESIS
unicode_case_folding(0x04D4, 'C', [0x04D5]). % CYRILLIC CAPITAL LIGATURE A IE
unicode_case_folding(0x04D6, 'C', [0x04D7]). % CYRILLIC CAPITAL LETTER IE WITH BREVE
unicode_case_folding(0x04D8, 'C', [0x04D9]). % CYRILLIC CAPITAL LETTER SCHWA
unicode_case_folding(0x04DA, 'C', [0x04DB]). % CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS
unicode_case_folding(0x04DC, 'C', [0x04DD]). % CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS
unicode_case_folding(0x04DE, 'C', [0x04DF]). % CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS
unicode_case_folding(0x04E0, 'C', [0x04E1]). % CYRILLIC CAPITAL LETTER ABKHASIAN DZE
unicode_case_folding(0x04E2, 'C', [0x04E3]). % CYRILLIC CAPITAL LETTER I WITH MACRON
unicode_case_folding(0x04E4, 'C', [0x04E5]). % CYRILLIC CAPITAL LETTER I WITH DIAERESIS
unicode_case_folding(0x04E6, 'C', [0x04E7]). % CYRILLIC CAPITAL LETTER O WITH DIAERESIS
unicode_case_folding(0x04E8, 'C', [0x04E9]). % CYRILLIC CAPITAL LETTER BARRED O
unicode_case_folding(0x04EA, 'C', [0x04EB]). % CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS
unicode_case_folding(0x04EC, 'C', [0x04ED]). % CYRILLIC CAPITAL LETTER E WITH DIAERESIS
unicode_case_folding(0x04EE, 'C', [0x04EF]). % CYRILLIC CAPITAL LETTER U WITH MACRON
unicode_case_folding(0x04F0, 'C', [0x04F1]). % CYRILLIC CAPITAL LETTER U WITH DIAERESIS
unicode_case_folding(0x04F2, 'C', [0x04F3]). % CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE
unicode_case_folding(0x04F4, 'C', [0x04F5]). % CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS
unicode_case_folding(0x04F6, 'C', [0x04F7]). % CYRILLIC CAPITAL LETTER GHE WITH DESCENDER
unicode_case_folding(0x04F8, 'C', [0x04F9]). % CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS
unicode_case_folding(0x04FA, 'C', [0x04FB]). % CYRILLIC CAPITAL LETTER GHE WITH STROKE AND HOOK
unicode_case_folding(0x04FC, 'C', [0x04FD]). % CYRILLIC CAPITAL LETTER HA WITH HOOK
unicode_case_folding(0x04FE, 'C', [0x04FF]). % CYRILLIC CAPITAL LETTER HA WITH STROKE
unicode_case_folding(0x0500, 'C', [0x0501]). % CYRILLIC CAPITAL LETTER KOMI DE
unicode_case_folding(0x0502, 'C', [0x0503]). % CYRILLIC CAPITAL LETTER KOMI DJE
unicode_case_folding(0x0504, 'C', [0x0505]). % CYRILLIC CAPITAL LETTER KOMI ZJE
unicode_case_folding(0x0506, 'C', [0x0507]). % CYRILLIC CAPITAL LETTER KOMI DZJE
unicode_case_folding(0x0508, 'C', [0x0509]). % CYRILLIC CAPITAL LETTER KOMI LJE
unicode_case_folding(0x050A, 'C', [0x050B]). % CYRILLIC CAPITAL LETTER KOMI NJE
unicode_case_folding(0x050C, 'C', [0x050D]). % CYRILLIC CAPITAL LETTER KOMI SJE
unicode_case_folding(0x050E, 'C', [0x050F]). % CYRILLIC CAPITAL LETTER KOMI TJE
unicode_case_folding(0x0510, 'C', [0x0511]). % CYRILLIC CAPITAL LETTER REVERSED ZE
unicode_case_folding(0x0512, 'C', [0x0513]). % CYRILLIC CAPITAL LETTER EL WITH HOOK
unicode_case_folding(0x0514, 'C', [0x0515]). % CYRILLIC CAPITAL LETTER LHA
unicode_case_folding(0x0516, 'C', [0x0517]). % CYRILLIC CAPITAL LETTER RHA
unicode_case_folding(0x0518, 'C', [0x0519]). % CYRILLIC CAPITAL LETTER YAE
unicode_case_folding(0x051A, 'C', [0x051B]). % CYRILLIC CAPITAL LETTER QA
unicode_case_folding(0x051C, 'C', [0x051D]). % CYRILLIC CAPITAL LETTER WE
unicode_case_folding(0x051E, 'C', [0x051F]). % CYRILLIC CAPITAL LETTER ALEUT KA
unicode_case_folding(0x0520, 'C', [0x0521]). % CYRILLIC CAPITAL LETTER EL WITH MIDDLE HOOK
unicode_case_folding(0x0522, 'C', [0x0523]). % CYRILLIC CAPITAL LETTER EN WITH MIDDLE HOOK
unicode_case_folding(0x0524, 'C', [0x0525]). % CYRILLIC CAPITAL LETTER PE WITH DESCENDER
unicode_case_folding(0x0526, 'C', [0x0527]). % CYRILLIC CAPITAL LETTER SHHA WITH DESCENDER
unicode_case_folding(0x0531, 'C', [0x0561]). % ARMENIAN CAPITAL LETTER AYB
unicode_case_folding(0x0532, 'C', [0x0562]). % ARMENIAN CAPITAL LETTER BEN
unicode_case_folding(0x0533, 'C', [0x0563]). % ARMENIAN CAPITAL LETTER GIM
unicode_case_folding(0x0534, 'C', [0x0564]). % ARMENIAN CAPITAL LETTER DA
unicode_case_folding(0x0535, 'C', [0x0565]). % ARMENIAN CAPITAL LETTER ECH
unicode_case_folding(0x0536, 'C', [0x0566]). % ARMENIAN CAPITAL LETTER ZA
unicode_case_folding(0x0537, 'C', [0x0567]). % ARMENIAN CAPITAL LETTER EH
unicode_case_folding(0x0538, 'C', [0x0568]). % ARMENIAN CAPITAL LETTER ET
unicode_case_folding(0x0539, 'C', [0x0569]). % ARMENIAN CAPITAL LETTER TO
unicode_case_folding(0x053A, 'C', [0x056A]). % ARMENIAN CAPITAL LETTER ZHE
unicode_case_folding(0x053B, 'C', [0x056B]). % ARMENIAN CAPITAL LETTER INI
unicode_case_folding(0x053C, 'C', [0x056C]). % ARMENIAN CAPITAL LETTER LIWN
unicode_case_folding(0x053D, 'C', [0x056D]). % ARMENIAN CAPITAL LETTER XEH
unicode_case_folding(0x053E, 'C', [0x056E]). % ARMENIAN CAPITAL LETTER CA
unicode_case_folding(0x053F, 'C', [0x056F]). % ARMENIAN CAPITAL LETTER KEN
unicode_case_folding(0x0540, 'C', [0x0570]). % ARMENIAN CAPITAL LETTER HO
unicode_case_folding(0x0541, 'C', [0x0571]). % ARMENIAN CAPITAL LETTER JA
unicode_case_folding(0x0542, 'C', [0x0572]). % ARMENIAN CAPITAL LETTER GHAD
unicode_case_folding(0x0543, 'C', [0x0573]). % ARMENIAN CAPITAL LETTER CHEH
unicode_case_folding(0x0544, 'C', [0x0574]). % ARMENIAN CAPITAL LETTER MEN
unicode_case_folding(0x0545, 'C', [0x0575]). % ARMENIAN CAPITAL LETTER YI
unicode_case_folding(0x0546, 'C', [0x0576]). % ARMENIAN CAPITAL LETTER NOW
unicode_case_folding(0x0547, 'C', [0x0577]). % ARMENIAN CAPITAL LETTER SHA
unicode_case_folding(0x0548, 'C', [0x0578]). % ARMENIAN CAPITAL LETTER VO
unicode_case_folding(0x0549, 'C', [0x0579]). % ARMENIAN CAPITAL LETTER CHA
unicode_case_folding(0x054A, 'C', [0x057A]). % ARMENIAN CAPITAL LETTER PEH
unicode_case_folding(0x054B, 'C', [0x057B]). % ARMENIAN CAPITAL LETTER JHEH
unicode_case_folding(0x054C, 'C', [0x057C]). % ARMENIAN CAPITAL LETTER RA
unicode_case_folding(0x054D, 'C', [0x057D]). % ARMENIAN CAPITAL LETTER SEH
unicode_case_folding(0x054E, 'C', [0x057E]). % ARMENIAN CAPITAL LETTER VEW
unicode_case_folding(0x054F, 'C', [0x057F]). % ARMENIAN CAPITAL LETTER TIWN
unicode_case_folding(0x0550, 'C', [0x0580]). % ARMENIAN CAPITAL LETTER REH
unicode_case_folding(0x0551, 'C', [0x0581]). % ARMENIAN CAPITAL LETTER CO
unicode_case_folding(0x0552, 'C', [0x0582]). % ARMENIAN CAPITAL LETTER YIWN
unicode_case_folding(0x0553, 'C', [0x0583]). % ARMENIAN CAPITAL LETTER PIWR
unicode_case_folding(0x0554, 'C', [0x0584]). % ARMENIAN CAPITAL LETTER KEH
unicode_case_folding(0x0555, 'C', [0x0585]). % ARMENIAN CAPITAL LETTER OH
unicode_case_folding(0x0556, 'C', [0x0586]). % ARMENIAN CAPITAL LETTER FEH
unicode_case_folding(0x0587, 'F', [0x0565, 0x0582]). % ARMENIAN SMALL LIGATURE ECH YIWN
unicode_case_folding(0x10A0, 'C', [0x2D00]). % GEORGIAN CAPITAL LETTER AN
unicode_case_folding(0x10A1, 'C', [0x2D01]). % GEORGIAN CAPITAL LETTER BAN
unicode_case_folding(0x10A2, 'C', [0x2D02]). % GEORGIAN CAPITAL LETTER GAN
unicode_case_folding(0x10A3, 'C', [0x2D03]). % GEORGIAN CAPITAL LETTER DON
unicode_case_folding(0x10A4, 'C', [0x2D04]). % GEORGIAN CAPITAL LETTER EN
unicode_case_folding(0x10A5, 'C', [0x2D05]). % GEORGIAN CAPITAL LETTER VIN
unicode_case_folding(0x10A6, 'C', [0x2D06]). % GEORGIAN CAPITAL LETTER ZEN
unicode_case_folding(0x10A7, 'C', [0x2D07]). % GEORGIAN CAPITAL LETTER TAN
unicode_case_folding(0x10A8, 'C', [0x2D08]). % GEORGIAN CAPITAL LETTER IN
unicode_case_folding(0x10A9, 'C', [0x2D09]). % GEORGIAN CAPITAL LETTER KAN
unicode_case_folding(0x10AA, 'C', [0x2D0A]). % GEORGIAN CAPITAL LETTER LAS
unicode_case_folding(0x10AB, 'C', [0x2D0B]). % GEORGIAN CAPITAL LETTER MAN
unicode_case_folding(0x10AC, 'C', [0x2D0C]). % GEORGIAN CAPITAL LETTER NAR
unicode_case_folding(0x10AD, 'C', [0x2D0D]). % GEORGIAN CAPITAL LETTER ON
unicode_case_folding(0x10AE, 'C', [0x2D0E]). % GEORGIAN CAPITAL LETTER PAR
unicode_case_folding(0x10AF, 'C', [0x2D0F]). % GEORGIAN CAPITAL LETTER ZHAR
unicode_case_folding(0x10B0, 'C', [0x2D10]). % GEORGIAN CAPITAL LETTER RAE
unicode_case_folding(0x10B1, 'C', [0x2D11]). % GEORGIAN CAPITAL LETTER SAN
unicode_case_folding(0x10B2, 'C', [0x2D12]). % GEORGIAN CAPITAL LETTER TAR
unicode_case_folding(0x10B3, 'C', [0x2D13]). % GEORGIAN CAPITAL LETTER UN
unicode_case_folding(0x10B4, 'C', [0x2D14]). % GEORGIAN CAPITAL LETTER PHAR
unicode_case_folding(0x10B5, 'C', [0x2D15]). % GEORGIAN CAPITAL LETTER KHAR
unicode_case_folding(0x10B6, 'C', [0x2D16]). % GEORGIAN CAPITAL LETTER GHAN
unicode_case_folding(0x10B7, 'C', [0x2D17]). % GEORGIAN CAPITAL LETTER QAR
unicode_case_folding(0x10B8, 'C', [0x2D18]). % GEORGIAN CAPITAL LETTER SHIN
unicode_case_folding(0x10B9, 'C', [0x2D19]). % GEORGIAN CAPITAL LETTER CHIN
unicode_case_folding(0x10BA, 'C', [0x2D1A]). % GEORGIAN CAPITAL LETTER CAN
unicode_case_folding(0x10BB, 'C', [0x2D1B]). % GEORGIAN CAPITAL LETTER JIL
unicode_case_folding(0x10BC, 'C', [0x2D1C]). % GEORGIAN CAPITAL LETTER CIL
unicode_case_folding(0x10BD, 'C', [0x2D1D]). % GEORGIAN CAPITAL LETTER CHAR
unicode_case_folding(0x10BE, 'C', [0x2D1E]). % GEORGIAN CAPITAL LETTER XAN
unicode_case_folding(0x10BF, 'C', [0x2D1F]). % GEORGIAN CAPITAL LETTER JHAN
unicode_case_folding(0x10C0, 'C', [0x2D20]). % GEORGIAN CAPITAL LETTER HAE
unicode_case_folding(0x10C1, 'C', [0x2D21]). % GEORGIAN CAPITAL LETTER HE
unicode_case_folding(0x10C2, 'C', [0x2D22]). % GEORGIAN CAPITAL LETTER HIE
unicode_case_folding(0x10C3, 'C', [0x2D23]). % GEORGIAN CAPITAL LETTER WE
unicode_case_folding(0x10C4, 'C', [0x2D24]). % GEORGIAN CAPITAL LETTER HAR
unicode_case_folding(0x10C5, 'C', [0x2D25]). % GEORGIAN CAPITAL LETTER HOE
unicode_case_folding(0x10C7, 'C', [0x2D27]). % GEORGIAN CAPITAL LETTER YN
unicode_case_folding(0x10CD, 'C', [0x2D2D]). % GEORGIAN CAPITAL LETTER AEN
unicode_case_folding(0x1E00, 'C', [0x1E01]). % LATIN CAPITAL LETTER A WITH RING BELOW
unicode_case_folding(0x1E02, 'C', [0x1E03]). % LATIN CAPITAL LETTER B WITH DOT ABOVE
unicode_case_folding(0x1E04, 'C', [0x1E05]). % LATIN CAPITAL LETTER B WITH DOT BELOW
unicode_case_folding(0x1E06, 'C', [0x1E07]). % LATIN CAPITAL LETTER B WITH LINE BELOW
unicode_case_folding(0x1E08, 'C', [0x1E09]). % LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE
unicode_case_folding(0x1E0A, 'C', [0x1E0B]). % LATIN CAPITAL LETTER D WITH DOT ABOVE
unicode_case_folding(0x1E0C, 'C', [0x1E0D]). % LATIN CAPITAL LETTER D WITH DOT BELOW
unicode_case_folding(0x1E0E, 'C', [0x1E0F]). % LATIN CAPITAL LETTER D WITH LINE BELOW
unicode_case_folding(0x1E10, 'C', [0x1E11]). % LATIN CAPITAL LETTER D WITH CEDILLA
unicode_case_folding(0x1E12, 'C', [0x1E13]). % LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW
unicode_case_folding(0x1E14, 'C', [0x1E15]). % LATIN CAPITAL LETTER E WITH MACRON AND GRAVE
unicode_case_folding(0x1E16, 'C', [0x1E17]). % LATIN CAPITAL LETTER E WITH MACRON AND ACUTE
unicode_case_folding(0x1E18, 'C', [0x1E19]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW
unicode_case_folding(0x1E1A, 'C', [0x1E1B]). % LATIN CAPITAL LETTER E WITH TILDE BELOW
unicode_case_folding(0x1E1C, 'C', [0x1E1D]). % LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE
unicode_case_folding(0x1E1E, 'C', [0x1E1F]). % LATIN CAPITAL LETTER F WITH DOT ABOVE
unicode_case_folding(0x1E20, 'C', [0x1E21]). % LATIN CAPITAL LETTER G WITH MACRON
unicode_case_folding(0x1E22, 'C', [0x1E23]). % LATIN CAPITAL LETTER H WITH DOT ABOVE
unicode_case_folding(0x1E24, 'C', [0x1E25]). % LATIN CAPITAL LETTER H WITH DOT BELOW
unicode_case_folding(0x1E26, 'C', [0x1E27]). % LATIN CAPITAL LETTER H WITH DIAERESIS
unicode_case_folding(0x1E28, 'C', [0x1E29]). % LATIN CAPITAL LETTER H WITH CEDILLA
unicode_case_folding(0x1E2A, 'C', [0x1E2B]). % LATIN CAPITAL LETTER H WITH BREVE BELOW
unicode_case_folding(0x1E2C, 'C', [0x1E2D]). % LATIN CAPITAL LETTER I WITH TILDE BELOW
unicode_case_folding(0x1E2E, 'C', [0x1E2F]). % LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE
unicode_case_folding(0x1E30, 'C', [0x1E31]). % LATIN CAPITAL LETTER K WITH ACUTE
unicode_case_folding(0x1E32, 'C', [0x1E33]). % LATIN CAPITAL LETTER K WITH DOT BELOW
unicode_case_folding(0x1E34, 'C', [0x1E35]). % LATIN CAPITAL LETTER K WITH LINE BELOW
unicode_case_folding(0x1E36, 'C', [0x1E37]). % LATIN CAPITAL LETTER L WITH DOT BELOW
unicode_case_folding(0x1E38, 'C', [0x1E39]). % LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON
unicode_case_folding(0x1E3A, 'C', [0x1E3B]). % LATIN CAPITAL LETTER L WITH LINE BELOW
unicode_case_folding(0x1E3C, 'C', [0x1E3D]). % LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW
unicode_case_folding(0x1E3E, 'C', [0x1E3F]). % LATIN CAPITAL LETTER M WITH ACUTE
unicode_case_folding(0x1E40, 'C', [0x1E41]). % LATIN CAPITAL LETTER M WITH DOT ABOVE
unicode_case_folding(0x1E42, 'C', [0x1E43]). % LATIN CAPITAL LETTER M WITH DOT BELOW
unicode_case_folding(0x1E44, 'C', [0x1E45]). % LATIN CAPITAL LETTER N WITH DOT ABOVE
unicode_case_folding(0x1E46, 'C', [0x1E47]). % LATIN CAPITAL LETTER N WITH DOT BELOW
unicode_case_folding(0x1E48, 'C', [0x1E49]). % LATIN CAPITAL LETTER N WITH LINE BELOW
unicode_case_folding(0x1E4A, 'C', [0x1E4B]). % LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW
unicode_case_folding(0x1E4C, 'C', [0x1E4D]). % LATIN CAPITAL LETTER O WITH TILDE AND ACUTE
unicode_case_folding(0x1E4E, 'C', [0x1E4F]). % LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS
unicode_case_folding(0x1E50, 'C', [0x1E51]). % LATIN CAPITAL LETTER O WITH MACRON AND GRAVE
unicode_case_folding(0x1E52, 'C', [0x1E53]). % LATIN CAPITAL LETTER O WITH MACRON AND ACUTE
unicode_case_folding(0x1E54, 'C', [0x1E55]). % LATIN CAPITAL LETTER P WITH ACUTE
unicode_case_folding(0x1E56, 'C', [0x1E57]). % LATIN CAPITAL LETTER P WITH DOT ABOVE
unicode_case_folding(0x1E58, 'C', [0x1E59]). % LATIN CAPITAL LETTER R WITH DOT ABOVE
unicode_case_folding(0x1E5A, 'C', [0x1E5B]). % LATIN CAPITAL LETTER R WITH DOT BELOW
unicode_case_folding(0x1E5C, 'C', [0x1E5D]). % LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON
unicode_case_folding(0x1E5E, 'C', [0x1E5F]). % LATIN CAPITAL LETTER R WITH LINE BELOW
unicode_case_folding(0x1E60, 'C', [0x1E61]). % LATIN CAPITAL LETTER S WITH DOT ABOVE
unicode_case_folding(0x1E62, 'C', [0x1E63]). % LATIN CAPITAL LETTER S WITH DOT BELOW
unicode_case_folding(0x1E64, 'C', [0x1E65]). % LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE
unicode_case_folding(0x1E66, 'C', [0x1E67]). % LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE
unicode_case_folding(0x1E68, 'C', [0x1E69]). % LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE
unicode_case_folding(0x1E6A, 'C', [0x1E6B]). % LATIN CAPITAL LETTER T WITH DOT ABOVE
unicode_case_folding(0x1E6C, 'C', [0x1E6D]). % LATIN CAPITAL LETTER T WITH DOT BELOW
unicode_case_folding(0x1E6E, 'C', [0x1E6F]). % LATIN CAPITAL LETTER T WITH LINE BELOW
unicode_case_folding(0x1E70, 'C', [0x1E71]). % LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW
unicode_case_folding(0x1E72, 'C', [0x1E73]). % LATIN CAPITAL LETTER U WITH DIAERESIS BELOW
unicode_case_folding(0x1E74, 'C', [0x1E75]). % LATIN CAPITAL LETTER U WITH TILDE BELOW
unicode_case_folding(0x1E76, 'C', [0x1E77]). % LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW
unicode_case_folding(0x1E78, 'C', [0x1E79]). % LATIN CAPITAL LETTER U WITH TILDE AND ACUTE
unicode_case_folding(0x1E7A, 'C', [0x1E7B]). % LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS
unicode_case_folding(0x1E7C, 'C', [0x1E7D]). % LATIN CAPITAL LETTER V WITH TILDE
unicode_case_folding(0x1E7E, 'C', [0x1E7F]). % LATIN CAPITAL LETTER V WITH DOT BELOW
unicode_case_folding(0x1E80, 'C', [0x1E81]). % LATIN CAPITAL LETTER W WITH GRAVE
unicode_case_folding(0x1E82, 'C', [0x1E83]). % LATIN CAPITAL LETTER W WITH ACUTE
unicode_case_folding(0x1E84, 'C', [0x1E85]). % LATIN CAPITAL LETTER W WITH DIAERESIS
unicode_case_folding(0x1E86, 'C', [0x1E87]). % LATIN CAPITAL LETTER W WITH DOT ABOVE
unicode_case_folding(0x1E88, 'C', [0x1E89]). % LATIN CAPITAL LETTER W WITH DOT BELOW
unicode_case_folding(0x1E8A, 'C', [0x1E8B]). % LATIN CAPITAL LETTER X WITH DOT ABOVE
unicode_case_folding(0x1E8C, 'C', [0x1E8D]). % LATIN CAPITAL LETTER X WITH DIAERESIS
unicode_case_folding(0x1E8E, 'C', [0x1E8F]). % LATIN CAPITAL LETTER Y WITH DOT ABOVE
unicode_case_folding(0x1E90, 'C', [0x1E91]). % LATIN CAPITAL LETTER Z WITH CIRCUMFLEX
unicode_case_folding(0x1E92, 'C', [0x1E93]). % LATIN CAPITAL LETTER Z WITH DOT BELOW
unicode_case_folding(0x1E94, 'C', [0x1E95]). % LATIN CAPITAL LETTER Z WITH LINE BELOW
unicode_case_folding(0x1E96, 'F', [0x0068, 0x0331]). % LATIN SMALL LETTER H WITH LINE BELOW
unicode_case_folding(0x1E97, 'F', [0x0074, 0x0308]). % LATIN SMALL LETTER T WITH DIAERESIS
unicode_case_folding(0x1E98, 'F', [0x0077, 0x030A]). % LATIN SMALL LETTER W WITH RING ABOVE
unicode_case_folding(0x1E99, 'F', [0x0079, 0x030A]). % LATIN SMALL LETTER Y WITH RING ABOVE
unicode_case_folding(0x1E9A, 'F', [0x0061, 0x02BE]). % LATIN SMALL LETTER A WITH RIGHT HALF RING
unicode_case_folding(0x1E9B, 'C', [0x1E61]). % LATIN SMALL LETTER LONG S WITH DOT ABOVE
unicode_case_folding(0x1E9E, 'F', [0x0073, 0x0073]). % LATIN CAPITAL LETTER SHARP S
unicode_case_folding(0x1E9E, 'S', [0x00DF]). % LATIN CAPITAL LETTER SHARP S
unicode_case_folding(0x1EA0, 'C', [0x1EA1]). % LATIN CAPITAL LETTER A WITH DOT BELOW
unicode_case_folding(0x1EA2, 'C', [0x1EA3]). % LATIN CAPITAL LETTER A WITH HOOK ABOVE
unicode_case_folding(0x1EA4, 'C', [0x1EA5]). % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
unicode_case_folding(0x1EA6, 'C', [0x1EA7]). % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE
unicode_case_folding(0x1EA8, 'C', [0x1EA9]). % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
unicode_case_folding(0x1EAA, 'C', [0x1EAB]). % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE
unicode_case_folding(0x1EAC, 'C', [0x1EAD]). % LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW
unicode_case_folding(0x1EAE, 'C', [0x1EAF]). % LATIN CAPITAL LETTER A WITH BREVE AND ACUTE
unicode_case_folding(0x1EB0, 'C', [0x1EB1]). % LATIN CAPITAL LETTER A WITH BREVE AND GRAVE
unicode_case_folding(0x1EB2, 'C', [0x1EB3]). % LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE
unicode_case_folding(0x1EB4, 'C', [0x1EB5]). % LATIN CAPITAL LETTER A WITH BREVE AND TILDE
unicode_case_folding(0x1EB6, 'C', [0x1EB7]). % LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW
unicode_case_folding(0x1EB8, 'C', [0x1EB9]). % LATIN CAPITAL LETTER E WITH DOT BELOW
unicode_case_folding(0x1EBA, 'C', [0x1EBB]). % LATIN CAPITAL LETTER E WITH HOOK ABOVE
unicode_case_folding(0x1EBC, 'C', [0x1EBD]). % LATIN CAPITAL LETTER E WITH TILDE
unicode_case_folding(0x1EBE, 'C', [0x1EBF]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE
unicode_case_folding(0x1EC0, 'C', [0x1EC1]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE
unicode_case_folding(0x1EC2, 'C', [0x1EC3]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
unicode_case_folding(0x1EC4, 'C', [0x1EC5]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE
unicode_case_folding(0x1EC6, 'C', [0x1EC7]). % LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW
unicode_case_folding(0x1EC8, 'C', [0x1EC9]). % LATIN CAPITAL LETTER I WITH HOOK ABOVE
unicode_case_folding(0x1ECA, 'C', [0x1ECB]). % LATIN CAPITAL LETTER I WITH DOT BELOW
unicode_case_folding(0x1ECC, 'C', [0x1ECD]). % LATIN CAPITAL LETTER O WITH DOT BELOW
unicode_case_folding(0x1ECE, 'C', [0x1ECF]). % LATIN CAPITAL LETTER O WITH HOOK ABOVE
unicode_case_folding(0x1ED0, 'C', [0x1ED1]). % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE
unicode_case_folding(0x1ED2, 'C', [0x1ED3]). % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE
unicode_case_folding(0x1ED4, 'C', [0x1ED5]). % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
unicode_case_folding(0x1ED6, 'C', [0x1ED7]). % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE
unicode_case_folding(0x1ED8, 'C', [0x1ED9]). % LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW
unicode_case_folding(0x1EDA, 'C', [0x1EDB]). % LATIN CAPITAL LETTER O WITH HORN AND ACUTE
unicode_case_folding(0x1EDC, 'C', [0x1EDD]). % LATIN CAPITAL LETTER O WITH HORN AND GRAVE
unicode_case_folding(0x1EDE, 'C', [0x1EDF]). % LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE
unicode_case_folding(0x1EE0, 'C', [0x1EE1]). % LATIN CAPITAL LETTER O WITH HORN AND TILDE
unicode_case_folding(0x1EE2, 'C', [0x1EE3]). % LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW
unicode_case_folding(0x1EE4, 'C', [0x1EE5]). % LATIN CAPITAL LETTER U WITH DOT BELOW
unicode_case_folding(0x1EE6, 'C', [0x1EE7]). % LATIN CAPITAL LETTER U WITH HOOK ABOVE
unicode_case_folding(0x1EE8, 'C', [0x1EE9]). % LATIN CAPITAL LETTER U WITH HORN AND ACUTE
unicode_case_folding(0x1EEA, 'C', [0x1EEB]). % LATIN CAPITAL LETTER U WITH HORN AND GRAVE
unicode_case_folding(0x1EEC, 'C', [0x1EED]). % LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE
unicode_case_folding(0x1EEE, 'C', [0x1EEF]). % LATIN CAPITAL LETTER U WITH HORN AND TILDE
unicode_case_folding(0x1EF0, 'C', [0x1EF1]). % LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW
unicode_case_folding(0x1EF2, 'C', [0x1EF3]). % LATIN CAPITAL LETTER Y WITH GRAVE
unicode_case_folding(0x1EF4, 'C', [0x1EF5]). % LATIN CAPITAL LETTER Y WITH DOT BELOW
unicode_case_folding(0x1EF6, 'C', [0x1EF7]). % LATIN CAPITAL LETTER Y WITH HOOK ABOVE
unicode_case_folding(0x1EF8, 'C', [0x1EF9]). % LATIN CAPITAL LETTER Y WITH TILDE
unicode_case_folding(0x1EFA, 'C', [0x1EFB]). % LATIN CAPITAL LETTER MIDDLE-WELSH LL
unicode_case_folding(0x1EFC, 'C', [0x1EFD]). % LATIN CAPITAL LETTER MIDDLE-WELSH V
unicode_case_folding(0x1EFE, 'C', [0x1EFF]). % LATIN CAPITAL LETTER Y WITH LOOP
unicode_case_folding(0x1F08, 'C', [0x1F00]). % GREEK CAPITAL LETTER ALPHA WITH PSILI
unicode_case_folding(0x1F09, 'C', [0x1F01]). % GREEK CAPITAL LETTER ALPHA WITH DASIA
unicode_case_folding(0x1F0A, 'C', [0x1F02]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA
unicode_case_folding(0x1F0B, 'C', [0x1F03]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA
unicode_case_folding(0x1F0C, 'C', [0x1F04]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA
unicode_case_folding(0x1F0D, 'C', [0x1F05]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA
unicode_case_folding(0x1F0E, 'C', [0x1F06]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI
unicode_case_folding(0x1F0F, 'C', [0x1F07]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI
unicode_case_folding(0x1F18, 'C', [0x1F10]). % GREEK CAPITAL LETTER EPSILON WITH PSILI
unicode_case_folding(0x1F19, 'C', [0x1F11]). % GREEK CAPITAL LETTER EPSILON WITH DASIA
unicode_case_folding(0x1F1A, 'C', [0x1F12]). % GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA
unicode_case_folding(0x1F1B, 'C', [0x1F13]). % GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA
unicode_case_folding(0x1F1C, 'C', [0x1F14]). % GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA
unicode_case_folding(0x1F1D, 'C', [0x1F15]). % GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA
unicode_case_folding(0x1F28, 'C', [0x1F20]). % GREEK CAPITAL LETTER ETA WITH PSILI
unicode_case_folding(0x1F29, 'C', [0x1F21]). % GREEK CAPITAL LETTER ETA WITH DASIA
unicode_case_folding(0x1F2A, 'C', [0x1F22]). % GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA
unicode_case_folding(0x1F2B, 'C', [0x1F23]). % GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA
unicode_case_folding(0x1F2C, 'C', [0x1F24]). % GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA
unicode_case_folding(0x1F2D, 'C', [0x1F25]). % GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA
unicode_case_folding(0x1F2E, 'C', [0x1F26]). % GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI
unicode_case_folding(0x1F2F, 'C', [0x1F27]). % GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI
unicode_case_folding(0x1F38, 'C', [0x1F30]). % GREEK CAPITAL LETTER IOTA WITH PSILI
unicode_case_folding(0x1F39, 'C', [0x1F31]). % GREEK CAPITAL LETTER IOTA WITH DASIA
unicode_case_folding(0x1F3A, 'C', [0x1F32]). % GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA
unicode_case_folding(0x1F3B, 'C', [0x1F33]). % GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA
unicode_case_folding(0x1F3C, 'C', [0x1F34]). % GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA
unicode_case_folding(0x1F3D, 'C', [0x1F35]). % GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA
unicode_case_folding(0x1F3E, 'C', [0x1F36]). % GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI
unicode_case_folding(0x1F3F, 'C', [0x1F37]). % GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI
unicode_case_folding(0x1F48, 'C', [0x1F40]). % GREEK CAPITAL LETTER OMICRON WITH PSILI
unicode_case_folding(0x1F49, 'C', [0x1F41]). % GREEK CAPITAL LETTER OMICRON WITH DASIA
unicode_case_folding(0x1F4A, 'C', [0x1F42]). % GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA
unicode_case_folding(0x1F4B, 'C', [0x1F43]). % GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA
unicode_case_folding(0x1F4C, 'C', [0x1F44]). % GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA
unicode_case_folding(0x1F4D, 'C', [0x1F45]). % GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA
unicode_case_folding(0x1F50, 'F', [0x03C5, 0x0313]). % GREEK SMALL LETTER UPSILON WITH PSILI
unicode_case_folding(0x1F52, 'F', [0x03C5, 0x0313, 0x0300]). % GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA
unicode_case_folding(0x1F54, 'F', [0x03C5, 0x0313, 0x0301]). % GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA
unicode_case_folding(0x1F56, 'F', [0x03C5, 0x0313, 0x0342]). % GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI
unicode_case_folding(0x1F59, 'C', [0x1F51]). % GREEK CAPITAL LETTER UPSILON WITH DASIA
unicode_case_folding(0x1F5B, 'C', [0x1F53]). % GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA
unicode_case_folding(0x1F5D, 'C', [0x1F55]). % GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA
unicode_case_folding(0x1F5F, 'C', [0x1F57]). % GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI
unicode_case_folding(0x1F68, 'C', [0x1F60]). % GREEK CAPITAL LETTER OMEGA WITH PSILI
unicode_case_folding(0x1F69, 'C', [0x1F61]). % GREEK CAPITAL LETTER OMEGA WITH DASIA
unicode_case_folding(0x1F6A, 'C', [0x1F62]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA
unicode_case_folding(0x1F6B, 'C', [0x1F63]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA
unicode_case_folding(0x1F6C, 'C', [0x1F64]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA
unicode_case_folding(0x1F6D, 'C', [0x1F65]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA
unicode_case_folding(0x1F6E, 'C', [0x1F66]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI
unicode_case_folding(0x1F6F, 'C', [0x1F67]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI
unicode_case_folding(0x1F80, 'F', [0x1F00, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI
unicode_case_folding(0x1F81, 'F', [0x1F01, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F82, 'F', [0x1F02, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F83, 'F', [0x1F03, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F84, 'F', [0x1F04, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F85, 'F', [0x1F05, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F86, 'F', [0x1F06, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1F87, 'F', [0x1F07, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1F88, 'F', [0x1F00, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI
unicode_case_folding(0x1F88, 'S', [0x1F80]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI
unicode_case_folding(0x1F89, 'F', [0x1F01, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F89, 'S', [0x1F81]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8A, 'F', [0x1F02, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8A, 'S', [0x1F82]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8B, 'F', [0x1F03, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8B, 'S', [0x1F83]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8C, 'F', [0x1F04, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8C, 'S', [0x1F84]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8D, 'F', [0x1F05, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8D, 'S', [0x1F85]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F8E, 'F', [0x1F06, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F8E, 'S', [0x1F86]). % GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F8F, 'F', [0x1F07, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F8F, 'S', [0x1F87]). % GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F90, 'F', [0x1F20, 0x03B9]). % GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI
unicode_case_folding(0x1F91, 'F', [0x1F21, 0x03B9]). % GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F92, 'F', [0x1F22, 0x03B9]). % GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F93, 'F', [0x1F23, 0x03B9]). % GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F94, 'F', [0x1F24, 0x03B9]). % GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F95, 'F', [0x1F25, 0x03B9]). % GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1F96, 'F', [0x1F26, 0x03B9]). % GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1F97, 'F', [0x1F27, 0x03B9]). % GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1F98, 'F', [0x1F20, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI
unicode_case_folding(0x1F98, 'S', [0x1F90]). % GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI
unicode_case_folding(0x1F99, 'F', [0x1F21, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F99, 'S', [0x1F91]). % GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9A, 'F', [0x1F22, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9A, 'S', [0x1F92]). % GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9B, 'F', [0x1F23, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9B, 'S', [0x1F93]). % GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9C, 'F', [0x1F24, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9C, 'S', [0x1F94]). % GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9D, 'F', [0x1F25, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9D, 'S', [0x1F95]). % GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1F9E, 'F', [0x1F26, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F9E, 'S', [0x1F96]). % GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F9F, 'F', [0x1F27, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1F9F, 'S', [0x1F97]). % GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1FA0, 'F', [0x1F60, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI
unicode_case_folding(0x1FA1, 'F', [0x1F61, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FA2, 'F', [0x1F62, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FA3, 'F', [0x1F63, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FA4, 'F', [0x1F64, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FA5, 'F', [0x1F65, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FA6, 'F', [0x1F66, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1FA7, 'F', [0x1F67, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1FA8, 'F', [0x1F60, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI
unicode_case_folding(0x1FA8, 'S', [0x1FA0]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI
unicode_case_folding(0x1FA9, 'F', [0x1F61, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FA9, 'S', [0x1FA1]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAA, 'F', [0x1F62, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAA, 'S', [0x1FA2]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAB, 'F', [0x1F63, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAB, 'S', [0x1FA3]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAC, 'F', [0x1F64, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAC, 'S', [0x1FA4]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAD, 'F', [0x1F65, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAD, 'S', [0x1FA5]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI
unicode_case_folding(0x1FAE, 'F', [0x1F66, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1FAE, 'S', [0x1FA6]). % GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1FAF, 'F', [0x1F67, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1FAF, 'S', [0x1FA7]). % GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
unicode_case_folding(0x1FB2, 'F', [0x1F70, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FB3, 'F', [0x03B1, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI
unicode_case_folding(0x1FB4, 'F', [0x03AC, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FB6, 'F', [0x03B1, 0x0342]). % GREEK SMALL LETTER ALPHA WITH PERISPOMENI
unicode_case_folding(0x1FB7, 'F', [0x03B1, 0x0342, 0x03B9]). % GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1FB8, 'C', [0x1FB0]). % GREEK CAPITAL LETTER ALPHA WITH VRACHY
unicode_case_folding(0x1FB9, 'C', [0x1FB1]). % GREEK CAPITAL LETTER ALPHA WITH MACRON
unicode_case_folding(0x1FBA, 'C', [0x1F70]). % GREEK CAPITAL LETTER ALPHA WITH VARIA
unicode_case_folding(0x1FBB, 'C', [0x1F71]). % GREEK CAPITAL LETTER ALPHA WITH OXIA
unicode_case_folding(0x1FBC, 'F', [0x03B1, 0x03B9]). % GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI
unicode_case_folding(0x1FBC, 'S', [0x1FB3]). % GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI
unicode_case_folding(0x1FBE, 'C', [0x03B9]). % GREEK PROSGEGRAMMENI
unicode_case_folding(0x1FC2, 'F', [0x1F74, 0x03B9]). % GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FC3, 'F', [0x03B7, 0x03B9]). % GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI
unicode_case_folding(0x1FC4, 'F', [0x03AE, 0x03B9]). % GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FC6, 'F', [0x03B7, 0x0342]). % GREEK SMALL LETTER ETA WITH PERISPOMENI
unicode_case_folding(0x1FC7, 'F', [0x03B7, 0x0342, 0x03B9]). % GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1FC8, 'C', [0x1F72]). % GREEK CAPITAL LETTER EPSILON WITH VARIA
unicode_case_folding(0x1FC9, 'C', [0x1F73]). % GREEK CAPITAL LETTER EPSILON WITH OXIA
unicode_case_folding(0x1FCA, 'C', [0x1F74]). % GREEK CAPITAL LETTER ETA WITH VARIA
unicode_case_folding(0x1FCB, 'C', [0x1F75]). % GREEK CAPITAL LETTER ETA WITH OXIA
unicode_case_folding(0x1FCC, 'F', [0x03B7, 0x03B9]). % GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI
unicode_case_folding(0x1FCC, 'S', [0x1FC3]). % GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI
unicode_case_folding(0x1FD2, 'F', [0x03B9, 0x0308, 0x0300]). % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA
unicode_case_folding(0x1FD3, 'F', [0x03B9, 0x0308, 0x0301]). % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA
unicode_case_folding(0x1FD6, 'F', [0x03B9, 0x0342]). % GREEK SMALL LETTER IOTA WITH PERISPOMENI
unicode_case_folding(0x1FD7, 'F', [0x03B9, 0x0308, 0x0342]). % GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI
unicode_case_folding(0x1FD8, 'C', [0x1FD0]). % GREEK CAPITAL LETTER IOTA WITH VRACHY
unicode_case_folding(0x1FD9, 'C', [0x1FD1]). % GREEK CAPITAL LETTER IOTA WITH MACRON
unicode_case_folding(0x1FDA, 'C', [0x1F76]). % GREEK CAPITAL LETTER IOTA WITH VARIA
unicode_case_folding(0x1FDB, 'C', [0x1F77]). % GREEK CAPITAL LETTER IOTA WITH OXIA
unicode_case_folding(0x1FE2, 'F', [0x03C5, 0x0308, 0x0300]). % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA
unicode_case_folding(0x1FE3, 'F', [0x03C5, 0x0308, 0x0301]). % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
unicode_case_folding(0x1FE4, 'F', [0x03C1, 0x0313]). % GREEK SMALL LETTER RHO WITH PSILI
unicode_case_folding(0x1FE6, 'F', [0x03C5, 0x0342]). % GREEK SMALL LETTER UPSILON WITH PERISPOMENI
unicode_case_folding(0x1FE7, 'F', [0x03C5, 0x0308, 0x0342]). % GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI
unicode_case_folding(0x1FE8, 'C', [0x1FE0]). % GREEK CAPITAL LETTER UPSILON WITH VRACHY
unicode_case_folding(0x1FE9, 'C', [0x1FE1]). % GREEK CAPITAL LETTER UPSILON WITH MACRON
unicode_case_folding(0x1FEA, 'C', [0x1F7A]). % GREEK CAPITAL LETTER UPSILON WITH VARIA
unicode_case_folding(0x1FEB, 'C', [0x1F7B]). % GREEK CAPITAL LETTER UPSILON WITH OXIA
unicode_case_folding(0x1FEC, 'C', [0x1FE5]). % GREEK CAPITAL LETTER RHO WITH DASIA
unicode_case_folding(0x1FF2, 'F', [0x1F7C, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FF3, 'F', [0x03C9, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI
unicode_case_folding(0x1FF4, 'F', [0x03CE, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI
unicode_case_folding(0x1FF6, 'F', [0x03C9, 0x0342]). % GREEK SMALL LETTER OMEGA WITH PERISPOMENI
unicode_case_folding(0x1FF7, 'F', [0x03C9, 0x0342, 0x03B9]). % GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI
unicode_case_folding(0x1FF8, 'C', [0x1F78]). % GREEK CAPITAL LETTER OMICRON WITH VARIA
unicode_case_folding(0x1FF9, 'C', [0x1F79]). % GREEK CAPITAL LETTER OMICRON WITH OXIA
unicode_case_folding(0x1FFA, 'C', [0x1F7C]). % GREEK CAPITAL LETTER OMEGA WITH VARIA
unicode_case_folding(0x1FFB, 'C', [0x1F7D]). % GREEK CAPITAL LETTER OMEGA WITH OXIA
unicode_case_folding(0x1FFC, 'F', [0x03C9, 0x03B9]). % GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
unicode_case_folding(0x1FFC, 'S', [0x1FF3]). % GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
unicode_case_folding(0x2126, 'C', [0x03C9]). % OHM SIGN
unicode_case_folding(0x212A, 'C', [0x006B]). % KELVIN SIGN
unicode_case_folding(0x212B, 'C', [0x00E5]). % ANGSTROM SIGN
unicode_case_folding(0x2132, 'C', [0x214E]). % TURNED CAPITAL F
unicode_case_folding(0x2160, 'C', [0x2170]). % ROMAN NUMERAL ONE
unicode_case_folding(0x2161, 'C', [0x2171]). % ROMAN NUMERAL TWO
unicode_case_folding(0x2162, 'C', [0x2172]). % ROMAN NUMERAL THREE
unicode_case_folding(0x2163, 'C', [0x2173]). % ROMAN NUMERAL FOUR
unicode_case_folding(0x2164, 'C', [0x2174]). % ROMAN NUMERAL FIVE
unicode_case_folding(0x2165, 'C', [0x2175]). % ROMAN NUMERAL SIX
unicode_case_folding(0x2166, 'C', [0x2176]). % ROMAN NUMERAL SEVEN
unicode_case_folding(0x2167, 'C', [0x2177]). % ROMAN NUMERAL EIGHT
unicode_case_folding(0x2168, 'C', [0x2178]). % ROMAN NUMERAL NINE
unicode_case_folding(0x2169, 'C', [0x2179]). % ROMAN NUMERAL TEN
unicode_case_folding(0x216A, 'C', [0x217A]). % ROMAN NUMERAL ELEVEN
unicode_case_folding(0x216B, 'C', [0x217B]). % ROMAN NUMERAL TWELVE
unicode_case_folding(0x216C, 'C', [0x217C]). % ROMAN NUMERAL FIFTY
unicode_case_folding(0x216D, 'C', [0x217D]). % ROMAN NUMERAL ONE HUNDRED
unicode_case_folding(0x216E, 'C', [0x217E]). % ROMAN NUMERAL FIVE HUNDRED
unicode_case_folding(0x216F, 'C', [0x217F]). % ROMAN NUMERAL ONE THOUSAND
unicode_case_folding(0x2183, 'C', [0x2184]). % ROMAN NUMERAL REVERSED ONE HUNDRED
unicode_case_folding(0x24B6, 'C', [0x24D0]). % CIRCLED LATIN CAPITAL LETTER A
unicode_case_folding(0x24B7, 'C', [0x24D1]). % CIRCLED LATIN CAPITAL LETTER B
unicode_case_folding(0x24B8, 'C', [0x24D2]). % CIRCLED LATIN CAPITAL LETTER C
unicode_case_folding(0x24B9, 'C', [0x24D3]). % CIRCLED LATIN CAPITAL LETTER D
unicode_case_folding(0x24BA, 'C', [0x24D4]). % CIRCLED LATIN CAPITAL LETTER E
unicode_case_folding(0x24BB, 'C', [0x24D5]). % CIRCLED LATIN CAPITAL LETTER F
unicode_case_folding(0x24BC, 'C', [0x24D6]). % CIRCLED LATIN CAPITAL LETTER G
unicode_case_folding(0x24BD, 'C', [0x24D7]). % CIRCLED LATIN CAPITAL LETTER H
unicode_case_folding(0x24BE, 'C', [0x24D8]). % CIRCLED LATIN CAPITAL LETTER I
unicode_case_folding(0x24BF, 'C', [0x24D9]). % CIRCLED LATIN CAPITAL LETTER J
unicode_case_folding(0x24C0, 'C', [0x24DA]). % CIRCLED LATIN CAPITAL LETTER K
unicode_case_folding(0x24C1, 'C', [0x24DB]). % CIRCLED LATIN CAPITAL LETTER L
unicode_case_folding(0x24C2, 'C', [0x24DC]). % CIRCLED LATIN CAPITAL LETTER M
unicode_case_folding(0x24C3, 'C', [0x24DD]). % CIRCLED LATIN CAPITAL LETTER N
unicode_case_folding(0x24C4, 'C', [0x24DE]). % CIRCLED LATIN CAPITAL LETTER O
unicode_case_folding(0x24C5, 'C', [0x24DF]). % CIRCLED LATIN CAPITAL LETTER P
unicode_case_folding(0x24C6, 'C', [0x24E0]). % CIRCLED LATIN CAPITAL LETTER Q
unicode_case_folding(0x24C7, 'C', [0x24E1]). % CIRCLED LATIN CAPITAL LETTER R
unicode_case_folding(0x24C8, 'C', [0x24E2]). % CIRCLED LATIN CAPITAL LETTER S
unicode_case_folding(0x24C9, 'C', [0x24E3]). % CIRCLED LATIN CAPITAL LETTER T
unicode_case_folding(0x24CA, 'C', [0x24E4]). % CIRCLED LATIN CAPITAL LETTER U
unicode_case_folding(0x24CB, 'C', [0x24E5]). % CIRCLED LATIN CAPITAL LETTER V
unicode_case_folding(0x24CC, 'C', [0x24E6]). % CIRCLED LATIN CAPITAL LETTER W
unicode_case_folding(0x24CD, 'C', [0x24E7]). % CIRCLED LATIN CAPITAL LETTER X
unicode_case_folding(0x24CE, 'C', [0x24E8]). % CIRCLED LATIN CAPITAL LETTER Y
unicode_case_folding(0x24CF, 'C', [0x24E9]). % CIRCLED LATIN CAPITAL LETTER Z
unicode_case_folding(0x2C00, 'C', [0x2C30]). % GLAGOLITIC CAPITAL LETTER AZU
unicode_case_folding(0x2C01, 'C', [0x2C31]). % GLAGOLITIC CAPITAL LETTER BUKY
unicode_case_folding(0x2C02, 'C', [0x2C32]). % GLAGOLITIC CAPITAL LETTER VEDE
unicode_case_folding(0x2C03, 'C', [0x2C33]). % GLAGOLITIC CAPITAL LETTER GLAGOLI
unicode_case_folding(0x2C04, 'C', [0x2C34]). % GLAGOLITIC CAPITAL LETTER DOBRO
unicode_case_folding(0x2C05, 'C', [0x2C35]). % GLAGOLITIC CAPITAL LETTER YESTU
unicode_case_folding(0x2C06, 'C', [0x2C36]). % GLAGOLITIC CAPITAL LETTER ZHIVETE
unicode_case_folding(0x2C07, 'C', [0x2C37]). % GLAGOLITIC CAPITAL LETTER DZELO
unicode_case_folding(0x2C08, 'C', [0x2C38]). % GLAGOLITIC CAPITAL LETTER ZEMLJA
unicode_case_folding(0x2C09, 'C', [0x2C39]). % GLAGOLITIC CAPITAL LETTER IZHE
unicode_case_folding(0x2C0A, 'C', [0x2C3A]). % GLAGOLITIC CAPITAL LETTER INITIAL IZHE
unicode_case_folding(0x2C0B, 'C', [0x2C3B]). % GLAGOLITIC CAPITAL LETTER I
unicode_case_folding(0x2C0C, 'C', [0x2C3C]). % GLAGOLITIC CAPITAL LETTER DJERVI
unicode_case_folding(0x2C0D, 'C', [0x2C3D]). % GLAGOLITIC CAPITAL LETTER KAKO
unicode_case_folding(0x2C0E, 'C', [0x2C3E]). % GLAGOLITIC CAPITAL LETTER LJUDIJE
unicode_case_folding(0x2C0F, 'C', [0x2C3F]). % GLAGOLITIC CAPITAL LETTER MYSLITE
unicode_case_folding(0x2C10, 'C', [0x2C40]). % GLAGOLITIC CAPITAL LETTER NASHI
unicode_case_folding(0x2C11, 'C', [0x2C41]). % GLAGOLITIC CAPITAL LETTER ONU
unicode_case_folding(0x2C12, 'C', [0x2C42]). % GLAGOLITIC CAPITAL LETTER POKOJI
unicode_case_folding(0x2C13, 'C', [0x2C43]). % GLAGOLITIC CAPITAL LETTER RITSI
unicode_case_folding(0x2C14, 'C', [0x2C44]). % GLAGOLITIC CAPITAL LETTER SLOVO
unicode_case_folding(0x2C15, 'C', [0x2C45]). % GLAGOLITIC CAPITAL LETTER TVRIDO
unicode_case_folding(0x2C16, 'C', [0x2C46]). % GLAGOLITIC CAPITAL LETTER UKU
unicode_case_folding(0x2C17, 'C', [0x2C47]). % GLAGOLITIC CAPITAL LETTER FRITU
unicode_case_folding(0x2C18, 'C', [0x2C48]). % GLAGOLITIC CAPITAL LETTER HERU
unicode_case_folding(0x2C19, 'C', [0x2C49]). % GLAGOLITIC CAPITAL LETTER OTU
unicode_case_folding(0x2C1A, 'C', [0x2C4A]). % GLAGOLITIC CAPITAL LETTER PE
unicode_case_folding(0x2C1B, 'C', [0x2C4B]). % GLAGOLITIC CAPITAL LETTER SHTA
unicode_case_folding(0x2C1C, 'C', [0x2C4C]). % GLAGOLITIC CAPITAL LETTER TSI
unicode_case_folding(0x2C1D, 'C', [0x2C4D]). % GLAGOLITIC CAPITAL LETTER CHRIVI
unicode_case_folding(0x2C1E, 'C', [0x2C4E]). % GLAGOLITIC CAPITAL LETTER SHA
unicode_case_folding(0x2C1F, 'C', [0x2C4F]). % GLAGOLITIC CAPITAL LETTER YERU
unicode_case_folding(0x2C20, 'C', [0x2C50]). % GLAGOLITIC CAPITAL LETTER YERI
unicode_case_folding(0x2C21, 'C', [0x2C51]). % GLAGOLITIC CAPITAL LETTER YATI
unicode_case_folding(0x2C22, 'C', [0x2C52]). % GLAGOLITIC CAPITAL LETTER SPIDERY HA
unicode_case_folding(0x2C23, 'C', [0x2C53]). % GLAGOLITIC CAPITAL LETTER YU
unicode_case_folding(0x2C24, 'C', [0x2C54]). % GLAGOLITIC CAPITAL LETTER SMALL YUS
unicode_case_folding(0x2C25, 'C', [0x2C55]). % GLAGOLITIC CAPITAL LETTER SMALL YUS WITH TAIL
unicode_case_folding(0x2C26, 'C', [0x2C56]). % GLAGOLITIC CAPITAL LETTER YO
unicode_case_folding(0x2C27, 'C', [0x2C57]). % GLAGOLITIC CAPITAL LETTER IOTATED SMALL YUS
unicode_case_folding(0x2C28, 'C', [0x2C58]). % GLAGOLITIC CAPITAL LETTER BIG YUS
unicode_case_folding(0x2C29, 'C', [0x2C59]). % GLAGOLITIC CAPITAL LETTER IOTATED BIG YUS
unicode_case_folding(0x2C2A, 'C', [0x2C5A]). % GLAGOLITIC CAPITAL LETTER FITA
unicode_case_folding(0x2C2B, 'C', [0x2C5B]). % GLAGOLITIC CAPITAL LETTER IZHITSA
unicode_case_folding(0x2C2C, 'C', [0x2C5C]). % GLAGOLITIC CAPITAL LETTER SHTAPIC
unicode_case_folding(0x2C2D, 'C', [0x2C5D]). % GLAGOLITIC CAPITAL LETTER TROKUTASTI A
unicode_case_folding(0x2C2E, 'C', [0x2C5E]). % GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE
unicode_case_folding(0x2C60, 'C', [0x2C61]). % LATIN CAPITAL LETTER L WITH DOUBLE BAR
unicode_case_folding(0x2C62, 'C', [0x026B]). % LATIN CAPITAL LETTER L WITH MIDDLE TILDE
unicode_case_folding(0x2C63, 'C', [0x1D7D]). % LATIN CAPITAL LETTER P WITH STROKE
unicode_case_folding(0x2C64, 'C', [0x027D]). % LATIN CAPITAL LETTER R WITH TAIL
unicode_case_folding(0x2C67, 'C', [0x2C68]). % LATIN CAPITAL LETTER H WITH DESCENDER
unicode_case_folding(0x2C69, 'C', [0x2C6A]). % LATIN CAPITAL LETTER K WITH DESCENDER
unicode_case_folding(0x2C6B, 'C', [0x2C6C]). % LATIN CAPITAL LETTER Z WITH DESCENDER
unicode_case_folding(0x2C6D, 'C', [0x0251]). % LATIN CAPITAL LETTER ALPHA
unicode_case_folding(0x2C6E, 'C', [0x0271]). % LATIN CAPITAL LETTER M WITH HOOK
unicode_case_folding(0x2C6F, 'C', [0x0250]). % LATIN CAPITAL LETTER TURNED A
unicode_case_folding(0x2C70, 'C', [0x0252]). % LATIN CAPITAL LETTER TURNED ALPHA
unicode_case_folding(0x2C72, 'C', [0x2C73]). % LATIN CAPITAL LETTER W WITH HOOK
unicode_case_folding(0x2C75, 'C', [0x2C76]). % LATIN CAPITAL LETTER HALF H
unicode_case_folding(0x2C7E, 'C', [0x023F]). % LATIN CAPITAL LETTER S WITH SWASH TAIL
unicode_case_folding(0x2C7F, 'C', [0x0240]). % LATIN CAPITAL LETTER Z WITH SWASH TAIL
unicode_case_folding(0x2C80, 'C', [0x2C81]). % COPTIC CAPITAL LETTER ALFA
unicode_case_folding(0x2C82, 'C', [0x2C83]). % COPTIC CAPITAL LETTER VIDA
unicode_case_folding(0x2C84, 'C', [0x2C85]). % COPTIC CAPITAL LETTER GAMMA
unicode_case_folding(0x2C86, 'C', [0x2C87]). % COPTIC CAPITAL LETTER DALDA
unicode_case_folding(0x2C88, 'C', [0x2C89]). % COPTIC CAPITAL LETTER EIE
unicode_case_folding(0x2C8A, 'C', [0x2C8B]). % COPTIC CAPITAL LETTER SOU
unicode_case_folding(0x2C8C, 'C', [0x2C8D]). % COPTIC CAPITAL LETTER ZATA
unicode_case_folding(0x2C8E, 'C', [0x2C8F]). % COPTIC CAPITAL LETTER HATE
unicode_case_folding(0x2C90, 'C', [0x2C91]). % COPTIC CAPITAL LETTER THETHE
unicode_case_folding(0x2C92, 'C', [0x2C93]). % COPTIC CAPITAL LETTER IAUDA
unicode_case_folding(0x2C94, 'C', [0x2C95]). % COPTIC CAPITAL LETTER KAPA
unicode_case_folding(0x2C96, 'C', [0x2C97]). % COPTIC CAPITAL LETTER LAULA
unicode_case_folding(0x2C98, 'C', [0x2C99]). % COPTIC CAPITAL LETTER MI
unicode_case_folding(0x2C9A, 'C', [0x2C9B]). % COPTIC CAPITAL LETTER NI
unicode_case_folding(0x2C9C, 'C', [0x2C9D]). % COPTIC CAPITAL LETTER KSI
unicode_case_folding(0x2C9E, 'C', [0x2C9F]). % COPTIC CAPITAL LETTER O
unicode_case_folding(0x2CA0, 'C', [0x2CA1]). % COPTIC CAPITAL LETTER PI
unicode_case_folding(0x2CA2, 'C', [0x2CA3]). % COPTIC CAPITAL LETTER RO
unicode_case_folding(0x2CA4, 'C', [0x2CA5]). % COPTIC CAPITAL LETTER SIMA
unicode_case_folding(0x2CA6, 'C', [0x2CA7]). % COPTIC CAPITAL LETTER TAU
unicode_case_folding(0x2CA8, 'C', [0x2CA9]). % COPTIC CAPITAL LETTER UA
unicode_case_folding(0x2CAA, 'C', [0x2CAB]). % COPTIC CAPITAL LETTER FI
unicode_case_folding(0x2CAC, 'C', [0x2CAD]). % COPTIC CAPITAL LETTER KHI
unicode_case_folding(0x2CAE, 'C', [0x2CAF]). % COPTIC CAPITAL LETTER PSI
unicode_case_folding(0x2CB0, 'C', [0x2CB1]). % COPTIC CAPITAL LETTER OOU
unicode_case_folding(0x2CB2, 'C', [0x2CB3]). % COPTIC CAPITAL LETTER DIALECT-P ALEF
unicode_case_folding(0x2CB4, 'C', [0x2CB5]). % COPTIC CAPITAL LETTER OLD COPTIC AIN
unicode_case_folding(0x2CB6, 'C', [0x2CB7]). % COPTIC CAPITAL LETTER CRYPTOGRAMMIC EIE
unicode_case_folding(0x2CB8, 'C', [0x2CB9]). % COPTIC CAPITAL LETTER DIALECT-P KAPA
unicode_case_folding(0x2CBA, 'C', [0x2CBB]). % COPTIC CAPITAL LETTER DIALECT-P NI
unicode_case_folding(0x2CBC, 'C', [0x2CBD]). % COPTIC CAPITAL LETTER CRYPTOGRAMMIC NI
unicode_case_folding(0x2CBE, 'C', [0x2CBF]). % COPTIC CAPITAL LETTER OLD COPTIC OOU
unicode_case_folding(0x2CC0, 'C', [0x2CC1]). % COPTIC CAPITAL LETTER SAMPI
unicode_case_folding(0x2CC2, 'C', [0x2CC3]). % COPTIC CAPITAL LETTER CROSSED SHEI
unicode_case_folding(0x2CC4, 'C', [0x2CC5]). % COPTIC CAPITAL LETTER OLD COPTIC SHEI
unicode_case_folding(0x2CC6, 'C', [0x2CC7]). % COPTIC CAPITAL LETTER OLD COPTIC ESH
unicode_case_folding(0x2CC8, 'C', [0x2CC9]). % COPTIC CAPITAL LETTER AKHMIMIC KHEI
unicode_case_folding(0x2CCA, 'C', [0x2CCB]). % COPTIC CAPITAL LETTER DIALECT-P HORI
unicode_case_folding(0x2CCC, 'C', [0x2CCD]). % COPTIC CAPITAL LETTER OLD COPTIC HORI
unicode_case_folding(0x2CCE, 'C', [0x2CCF]). % COPTIC CAPITAL LETTER OLD COPTIC HA
unicode_case_folding(0x2CD0, 'C', [0x2CD1]). % COPTIC CAPITAL LETTER L-SHAPED HA
unicode_case_folding(0x2CD2, 'C', [0x2CD3]). % COPTIC CAPITAL LETTER OLD COPTIC HEI
unicode_case_folding(0x2CD4, 'C', [0x2CD5]). % COPTIC CAPITAL LETTER OLD COPTIC HAT
unicode_case_folding(0x2CD6, 'C', [0x2CD7]). % COPTIC CAPITAL LETTER OLD COPTIC GANGIA
unicode_case_folding(0x2CD8, 'C', [0x2CD9]). % COPTIC CAPITAL LETTER OLD COPTIC DJA
unicode_case_folding(0x2CDA, 'C', [0x2CDB]). % COPTIC CAPITAL LETTER OLD COPTIC SHIMA
unicode_case_folding(0x2CDC, 'C', [0x2CDD]). % COPTIC CAPITAL LETTER OLD NUBIAN SHIMA
unicode_case_folding(0x2CDE, 'C', [0x2CDF]). % COPTIC CAPITAL LETTER OLD NUBIAN NGI
unicode_case_folding(0x2CE0, 'C', [0x2CE1]). % COPTIC CAPITAL LETTER OLD NUBIAN NYI
unicode_case_folding(0x2CE2, 'C', [0x2CE3]). % COPTIC CAPITAL LETTER OLD NUBIAN WAU
unicode_case_folding(0x2CEB, 'C', [0x2CEC]). % COPTIC CAPITAL LETTER CRYPTOGRAMMIC SHEI
unicode_case_folding(0x2CED, 'C', [0x2CEE]). % COPTIC CAPITAL LETTER CRYPTOGRAMMIC GANGIA
unicode_case_folding(0x2CF2, 'C', [0x2CF3]). % COPTIC CAPITAL LETTER BOHAIRIC KHEI
unicode_case_folding(0xA640, 'C', [0xA641]). % CYRILLIC CAPITAL LETTER ZEMLYA
unicode_case_folding(0xA642, 'C', [0xA643]). % CYRILLIC CAPITAL LETTER DZELO
unicode_case_folding(0xA644, 'C', [0xA645]). % CYRILLIC CAPITAL LETTER REVERSED DZE
unicode_case_folding(0xA646, 'C', [0xA647]). % CYRILLIC CAPITAL LETTER IOTA
unicode_case_folding(0xA648, 'C', [0xA649]). % CYRILLIC CAPITAL LETTER DJERV
unicode_case_folding(0xA64A, 'C', [0xA64B]). % CYRILLIC CAPITAL LETTER MONOGRAPH UK
unicode_case_folding(0xA64C, 'C', [0xA64D]). % CYRILLIC CAPITAL LETTER BROAD OMEGA
unicode_case_folding(0xA64E, 'C', [0xA64F]). % CYRILLIC CAPITAL LETTER NEUTRAL YER
unicode_case_folding(0xA650, 'C', [0xA651]). % CYRILLIC CAPITAL LETTER YERU WITH BACK YER
unicode_case_folding(0xA652, 'C', [0xA653]). % CYRILLIC CAPITAL LETTER IOTIFIED YAT
unicode_case_folding(0xA654, 'C', [0xA655]). % CYRILLIC CAPITAL LETTER REVERSED YU
unicode_case_folding(0xA656, 'C', [0xA657]). % CYRILLIC CAPITAL LETTER IOTIFIED A
unicode_case_folding(0xA658, 'C', [0xA659]). % CYRILLIC CAPITAL LETTER CLOSED LITTLE YUS
unicode_case_folding(0xA65A, 'C', [0xA65B]). % CYRILLIC CAPITAL LETTER BLENDED YUS
unicode_case_folding(0xA65C, 'C', [0xA65D]). % CYRILLIC CAPITAL LETTER IOTIFIED CLOSED LITTLE YUS
unicode_case_folding(0xA65E, 'C', [0xA65F]). % CYRILLIC CAPITAL LETTER YN
unicode_case_folding(0xA660, 'C', [0xA661]). % CYRILLIC CAPITAL LETTER REVERSED TSE
unicode_case_folding(0xA662, 'C', [0xA663]). % CYRILLIC CAPITAL LETTER SOFT DE
unicode_case_folding(0xA664, 'C', [0xA665]). % CYRILLIC CAPITAL LETTER SOFT EL
unicode_case_folding(0xA666, 'C', [0xA667]). % CYRILLIC CAPITAL LETTER SOFT EM
unicode_case_folding(0xA668, 'C', [0xA669]). % CYRILLIC CAPITAL LETTER MONOCULAR O
unicode_case_folding(0xA66A, 'C', [0xA66B]). % CYRILLIC CAPITAL LETTER BINOCULAR O
unicode_case_folding(0xA66C, 'C', [0xA66D]). % CYRILLIC CAPITAL LETTER DOUBLE MONOCULAR O
unicode_case_folding(0xA680, 'C', [0xA681]). % CYRILLIC CAPITAL LETTER DWE
unicode_case_folding(0xA682, 'C', [0xA683]). % CYRILLIC CAPITAL LETTER DZWE
unicode_case_folding(0xA684, 'C', [0xA685]). % CYRILLIC CAPITAL LETTER ZHWE
unicode_case_folding(0xA686, 'C', [0xA687]). % CYRILLIC CAPITAL LETTER CCHE
unicode_case_folding(0xA688, 'C', [0xA689]). % CYRILLIC CAPITAL LETTER DZZE
unicode_case_folding(0xA68A, 'C', [0xA68B]). % CYRILLIC CAPITAL LETTER TE WITH MIDDLE HOOK
unicode_case_folding(0xA68C, 'C', [0xA68D]). % CYRILLIC CAPITAL LETTER TWE
unicode_case_folding(0xA68E, 'C', [0xA68F]). % CYRILLIC CAPITAL LETTER TSWE
unicode_case_folding(0xA690, 'C', [0xA691]). % CYRILLIC CAPITAL LETTER TSSE
unicode_case_folding(0xA692, 'C', [0xA693]). % CYRILLIC CAPITAL LETTER TCHE
unicode_case_folding(0xA694, 'C', [0xA695]). % CYRILLIC CAPITAL LETTER HWE
unicode_case_folding(0xA696, 'C', [0xA697]). % CYRILLIC CAPITAL LETTER SHWE
unicode_case_folding(0xA722, 'C', [0xA723]). % LATIN CAPITAL LETTER EGYPTOLOGICAL ALEF
unicode_case_folding(0xA724, 'C', [0xA725]). % LATIN CAPITAL LETTER EGYPTOLOGICAL AIN
unicode_case_folding(0xA726, 'C', [0xA727]). % LATIN CAPITAL LETTER HENG
unicode_case_folding(0xA728, 'C', [0xA729]). % LATIN CAPITAL LETTER TZ
unicode_case_folding(0xA72A, 'C', [0xA72B]). % LATIN CAPITAL LETTER TRESILLO
unicode_case_folding(0xA72C, 'C', [0xA72D]). % LATIN CAPITAL LETTER CUATRILLO
unicode_case_folding(0xA72E, 'C', [0xA72F]). % LATIN CAPITAL LETTER CUATRILLO WITH COMMA
unicode_case_folding(0xA732, 'C', [0xA733]). % LATIN CAPITAL LETTER AA
unicode_case_folding(0xA734, 'C', [0xA735]). % LATIN CAPITAL LETTER AO
unicode_case_folding(0xA736, 'C', [0xA737]). % LATIN CAPITAL LETTER AU
unicode_case_folding(0xA738, 'C', [0xA739]). % LATIN CAPITAL LETTER AV
unicode_case_folding(0xA73A, 'C', [0xA73B]). % LATIN CAPITAL LETTER AV WITH HORIZONTAL BAR
unicode_case_folding(0xA73C, 'C', [0xA73D]). % LATIN CAPITAL LETTER AY
unicode_case_folding(0xA73E, 'C', [0xA73F]). % LATIN CAPITAL LETTER REVERSED C WITH DOT
unicode_case_folding(0xA740, 'C', [0xA741]). % LATIN CAPITAL LETTER K WITH STROKE
unicode_case_folding(0xA742, 'C', [0xA743]). % LATIN CAPITAL LETTER K WITH DIAGONAL STROKE
unicode_case_folding(0xA744, 'C', [0xA745]). % LATIN CAPITAL LETTER K WITH STROKE AND DIAGONAL STROKE
unicode_case_folding(0xA746, 'C', [0xA747]). % LATIN CAPITAL LETTER BROKEN L
unicode_case_folding(0xA748, 'C', [0xA749]). % LATIN CAPITAL LETTER L WITH HIGH STROKE
unicode_case_folding(0xA74A, 'C', [0xA74B]). % LATIN CAPITAL LETTER O WITH LONG STROKE OVERLAY
unicode_case_folding(0xA74C, 'C', [0xA74D]). % LATIN CAPITAL LETTER O WITH LOOP
unicode_case_folding(0xA74E, 'C', [0xA74F]). % LATIN CAPITAL LETTER OO
unicode_case_folding(0xA750, 'C', [0xA751]). % LATIN CAPITAL LETTER P WITH STROKE THROUGH DESCENDER
unicode_case_folding(0xA752, 'C', [0xA753]). % LATIN CAPITAL LETTER P WITH FLOURISH
unicode_case_folding(0xA754, 'C', [0xA755]). % LATIN CAPITAL LETTER P WITH SQUIRREL TAIL
unicode_case_folding(0xA756, 'C', [0xA757]). % LATIN CAPITAL LETTER Q WITH STROKE THROUGH DESCENDER
unicode_case_folding(0xA758, 'C', [0xA759]). % LATIN CAPITAL LETTER Q WITH DIAGONAL STROKE
unicode_case_folding(0xA75A, 'C', [0xA75B]). % LATIN CAPITAL LETTER R ROTUNDA
unicode_case_folding(0xA75C, 'C', [0xA75D]). % LATIN CAPITAL LETTER RUM ROTUNDA
unicode_case_folding(0xA75E, 'C', [0xA75F]). % LATIN CAPITAL LETTER V WITH DIAGONAL STROKE
unicode_case_folding(0xA760, 'C', [0xA761]). % LATIN CAPITAL LETTER VY
unicode_case_folding(0xA762, 'C', [0xA763]). % LATIN CAPITAL LETTER VISIGOTHIC Z
unicode_case_folding(0xA764, 'C', [0xA765]). % LATIN CAPITAL LETTER THORN WITH STROKE
unicode_case_folding(0xA766, 'C', [0xA767]). % LATIN CAPITAL LETTER THORN WITH STROKE THROUGH DESCENDER
unicode_case_folding(0xA768, 'C', [0xA769]). % LATIN CAPITAL LETTER VEND
unicode_case_folding(0xA76A, 'C', [0xA76B]). % LATIN CAPITAL LETTER ET
unicode_case_folding(0xA76C, 'C', [0xA76D]). % LATIN CAPITAL LETTER IS
unicode_case_folding(0xA76E, 'C', [0xA76F]). % LATIN CAPITAL LETTER CON
unicode_case_folding(0xA779, 'C', [0xA77A]). % LATIN CAPITAL LETTER INSULAR D
unicode_case_folding(0xA77B, 'C', [0xA77C]). % LATIN CAPITAL LETTER INSULAR F
unicode_case_folding(0xA77D, 'C', [0x1D79]). % LATIN CAPITAL LETTER INSULAR G
unicode_case_folding(0xA77E, 'C', [0xA77F]). % LATIN CAPITAL LETTER TURNED INSULAR G
unicode_case_folding(0xA780, 'C', [0xA781]). % LATIN CAPITAL LETTER TURNED L
unicode_case_folding(0xA782, 'C', [0xA783]). % LATIN CAPITAL LETTER INSULAR R
unicode_case_folding(0xA784, 'C', [0xA785]). % LATIN CAPITAL LETTER INSULAR S
unicode_case_folding(0xA786, 'C', [0xA787]). % LATIN CAPITAL LETTER INSULAR T
unicode_case_folding(0xA78B, 'C', [0xA78C]). % LATIN CAPITAL LETTER SALTILLO
unicode_case_folding(0xA78D, 'C', [0x0265]). % LATIN CAPITAL LETTER TURNED H
unicode_case_folding(0xA790, 'C', [0xA791]). % LATIN CAPITAL LETTER N WITH DESCENDER
unicode_case_folding(0xA792, 'C', [0xA793]). % LATIN CAPITAL LETTER C WITH BAR
unicode_case_folding(0xA7A0, 'C', [0xA7A1]). % LATIN CAPITAL LETTER G WITH OBLIQUE STROKE
unicode_case_folding(0xA7A2, 'C', [0xA7A3]). % LATIN CAPITAL LETTER K WITH OBLIQUE STROKE
unicode_case_folding(0xA7A4, 'C', [0xA7A5]). % LATIN CAPITAL LETTER N WITH OBLIQUE STROKE
unicode_case_folding(0xA7A6, 'C', [0xA7A7]). % LATIN CAPITAL LETTER R WITH OBLIQUE STROKE
unicode_case_folding(0xA7A8, 'C', [0xA7A9]). % LATIN CAPITAL LETTER S WITH OBLIQUE STROKE
unicode_case_folding(0xA7AA, 'C', [0x0266]). % LATIN CAPITAL LETTER H WITH HOOK
unicode_case_folding(0xFB00, 'F', [0x0066, 0x0066]). % LATIN SMALL LIGATURE FF
unicode_case_folding(0xFB01, 'F', [0x0066, 0x0069]). % LATIN SMALL LIGATURE FI
unicode_case_folding(0xFB02, 'F', [0x0066, 0x006C]). % LATIN SMALL LIGATURE FL
unicode_case_folding(0xFB03, 'F', [0x0066, 0x0066, 0x0069]). % LATIN SMALL LIGATURE FFI
unicode_case_folding(0xFB04, 'F', [0x0066, 0x0066, 0x006C]). % LATIN SMALL LIGATURE FFL
unicode_case_folding(0xFB05, 'F', [0x0073, 0x0074]). % LATIN SMALL LIGATURE LONG S T
unicode_case_folding(0xFB06, 'F', [0x0073, 0x0074]). % LATIN SMALL LIGATURE ST
unicode_case_folding(0xFB13, 'F', [0x0574, 0x0576]). % ARMENIAN SMALL LIGATURE MEN NOW
unicode_case_folding(0xFB14, 'F', [0x0574, 0x0565]). % ARMENIAN SMALL LIGATURE MEN ECH
unicode_case_folding(0xFB15, 'F', [0x0574, 0x056B]). % ARMENIAN SMALL LIGATURE MEN INI
unicode_case_folding(0xFB16, 'F', [0x057E, 0x0576]). % ARMENIAN SMALL LIGATURE VEW NOW
unicode_case_folding(0xFB17, 'F', [0x0574, 0x056D]). % ARMENIAN SMALL LIGATURE MEN XEH
unicode_case_folding(0xFF21, 'C', [0xFF41]). % FULLWIDTH LATIN CAPITAL LETTER A
unicode_case_folding(0xFF22, 'C', [0xFF42]). % FULLWIDTH LATIN CAPITAL LETTER B
unicode_case_folding(0xFF23, 'C', [0xFF43]). % FULLWIDTH LATIN CAPITAL LETTER C
unicode_case_folding(0xFF24, 'C', [0xFF44]). % FULLWIDTH LATIN CAPITAL LETTER D
unicode_case_folding(0xFF25, 'C', [0xFF45]). % FULLWIDTH LATIN CAPITAL LETTER E
unicode_case_folding(0xFF26, 'C', [0xFF46]). % FULLWIDTH LATIN CAPITAL LETTER F
unicode_case_folding(0xFF27, 'C', [0xFF47]). % FULLWIDTH LATIN CAPITAL LETTER G
unicode_case_folding(0xFF28, 'C', [0xFF48]). % FULLWIDTH LATIN CAPITAL LETTER H
unicode_case_folding(0xFF29, 'C', [0xFF49]). % FULLWIDTH LATIN CAPITAL LETTER I
unicode_case_folding(0xFF2A, 'C', [0xFF4A]). % FULLWIDTH LATIN CAPITAL LETTER J
unicode_case_folding(0xFF2B, 'C', [0xFF4B]). % FULLWIDTH LATIN CAPITAL LETTER K
unicode_case_folding(0xFF2C, 'C', [0xFF4C]). % FULLWIDTH LATIN CAPITAL LETTER L
unicode_case_folding(0xFF2D, 'C', [0xFF4D]). % FULLWIDTH LATIN CAPITAL LETTER M
unicode_case_folding(0xFF2E, 'C', [0xFF4E]). % FULLWIDTH LATIN CAPITAL LETTER N
unicode_case_folding(0xFF2F, 'C', [0xFF4F]). % FULLWIDTH LATIN CAPITAL LETTER O
unicode_case_folding(0xFF30, 'C', [0xFF50]). % FULLWIDTH LATIN CAPITAL LETTER P
unicode_case_folding(0xFF31, 'C', [0xFF51]). % FULLWIDTH LATIN CAPITAL LETTER Q
unicode_case_folding(0xFF32, 'C', [0xFF52]). % FULLWIDTH LATIN CAPITAL LETTER R
unicode_case_folding(0xFF33, 'C', [0xFF53]). % FULLWIDTH LATIN CAPITAL LETTER S
unicode_case_folding(0xFF34, 'C', [0xFF54]). % FULLWIDTH LATIN CAPITAL LETTER T
unicode_case_folding(0xFF35, 'C', [0xFF55]). % FULLWIDTH LATIN CAPITAL LETTER U
unicode_case_folding(0xFF36, 'C', [0xFF56]). % FULLWIDTH LATIN CAPITAL LETTER V
unicode_case_folding(0xFF37, 'C', [0xFF57]). % FULLWIDTH LATIN CAPITAL LETTER W
unicode_case_folding(0xFF38, 'C', [0xFF58]). % FULLWIDTH LATIN CAPITAL LETTER X
unicode_case_folding(0xFF39, 'C', [0xFF59]). % FULLWIDTH LATIN CAPITAL LETTER Y
unicode_case_folding(0xFF3A, 'C', [0xFF5A]). % FULLWIDTH LATIN CAPITAL LETTER Z
unicode_case_folding(0x10400, 'C', [0x10428]). % DESERET CAPITAL LETTER LONG I
unicode_case_folding(0x10401, 'C', [0x10429]). % DESERET CAPITAL LETTER LONG E
unicode_case_folding(0x10402, 'C', [0x1042A]). % DESERET CAPITAL LETTER LONG A
unicode_case_folding(0x10403, 'C', [0x1042B]). % DESERET CAPITAL LETTER LONG AH
unicode_case_folding(0x10404, 'C', [0x1042C]). % DESERET CAPITAL LETTER LONG O
unicode_case_folding(0x10405, 'C', [0x1042D]). % DESERET CAPITAL LETTER LONG OO
unicode_case_folding(0x10406, 'C', [0x1042E]). % DESERET CAPITAL LETTER SHORT I
unicode_case_folding(0x10407, 'C', [0x1042F]). % DESERET CAPITAL LETTER SHORT E
unicode_case_folding(0x10408, 'C', [0x10430]). % DESERET CAPITAL LETTER SHORT A
unicode_case_folding(0x10409, 'C', [0x10431]). % DESERET CAPITAL LETTER SHORT AH
unicode_case_folding(0x1040A, 'C', [0x10432]). % DESERET CAPITAL LETTER SHORT O
unicode_case_folding(0x1040B, 'C', [0x10433]). % DESERET CAPITAL LETTER SHORT OO
unicode_case_folding(0x1040C, 'C', [0x10434]). % DESERET CAPITAL LETTER AY
unicode_case_folding(0x1040D, 'C', [0x10435]). % DESERET CAPITAL LETTER OW
unicode_case_folding(0x1040E, 'C', [0x10436]). % DESERET CAPITAL LETTER WU
unicode_case_folding(0x1040F, 'C', [0x10437]). % DESERET CAPITAL LETTER YEE
unicode_case_folding(0x10410, 'C', [0x10438]). % DESERET CAPITAL LETTER H
unicode_case_folding(0x10411, 'C', [0x10439]). % DESERET CAPITAL LETTER PEE
unicode_case_folding(0x10412, 'C', [0x1043A]). % DESERET CAPITAL LETTER BEE
unicode_case_folding(0x10413, 'C', [0x1043B]). % DESERET CAPITAL LETTER TEE
unicode_case_folding(0x10414, 'C', [0x1043C]). % DESERET CAPITAL LETTER DEE
unicode_case_folding(0x10415, 'C', [0x1043D]). % DESERET CAPITAL LETTER CHEE
unicode_case_folding(0x10416, 'C', [0x1043E]). % DESERET CAPITAL LETTER JEE
unicode_case_folding(0x10417, 'C', [0x1043F]). % DESERET CAPITAL LETTER KAY
unicode_case_folding(0x10418, 'C', [0x10440]). % DESERET CAPITAL LETTER GAY
unicode_case_folding(0x10419, 'C', [0x10441]). % DESERET CAPITAL LETTER EF
unicode_case_folding(0x1041A, 'C', [0x10442]). % DESERET CAPITAL LETTER VEE
unicode_case_folding(0x1041B, 'C', [0x10443]). % DESERET CAPITAL LETTER ETH
unicode_case_folding(0x1041C, 'C', [0x10444]). % DESERET CAPITAL LETTER THEE
unicode_case_folding(0x1041D, 'C', [0x10445]). % DESERET CAPITAL LETTER ES
unicode_case_folding(0x1041E, 'C', [0x10446]). % DESERET CAPITAL LETTER ZEE
unicode_case_folding(0x1041F, 'C', [0x10447]). % DESERET CAPITAL LETTER ESH
unicode_case_folding(0x10420, 'C', [0x10448]). % DESERET CAPITAL LETTER ZHEE
unicode_case_folding(0x10421, 'C', [0x10449]). % DESERET CAPITAL LETTER ER
unicode_case_folding(0x10422, 'C', [0x1044A]). % DESERET CAPITAL LETTER EL
unicode_case_folding(0x10423, 'C', [0x1044B]). % DESERET CAPITAL LETTER EM
unicode_case_folding(0x10424, 'C', [0x1044C]). % DESERET CAPITAL LETTER EN
unicode_case_folding(0x10425, 'C', [0x1044D]). % DESERET CAPITAL LETTER ENG
unicode_case_folding(0x10426, 'C', [0x1044E]). % DESERET CAPITAL LETTER OI
unicode_case_folding(0x10427, 'C', [0x1044F]). % DESERET CAPITAL LETTER EW
| LogtalkDotOrg/logtalk3 | library/unicode_data/unicode_case_folding.pl | Perl | apache-2.0 | 105,687 |
#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
# vim: set ts=2 sw=2 tw=0:
# vim: set expandtab:
=head1 NAME
Rex::Box::VBox - Rex/Boxes VirtualBox Module
=head1 DESCRIPTION
This is a Rex/Boxes module to use VirtualBox VMs.
=head1 EXAMPLES
To use this module inside your Rexfile you can use the following commands.
use Rex::Commands::Box;
set box => "VBox";
task "prepare_box", sub {
box {
my ($box) = @_;
$box->name("mybox");
$box->url("http://box.rexify.org/box/ubuntu-server-12.10-amd64.ova");
$box->network(1 => {
type => "nat",
});
$box->network(1 => {
type => "bridged",
bridge => "eth0",
});
$box->forward_port(ssh => [2222, 22]);
$box->share_folder(myhome => "/home/myuser");
$box->auth(
user => "root",
password => "box",
);
$box->setup("setup_task");
};
};
If you want to use a YAML file you can use the following template.
type: VBox
vms:
vmone:
url: http://box.rexify.org/box/ubuntu-server-12.10-amd64.ova
forward_port:
ssh:
- 2222
- 22
share_folder:
myhome: /home/myhome
setup: setup_task
And then you can use it the following way in your Rexfile.
use Rex::Commands::Box init_file => "file.yml";
task "prepare_vms", sub {
boxes "init";
};
=head1 HEADLESS MODE
It is also possible to run VirtualBox in headless mode. This only works on Linux and MacOS. If you want to do this you can use the following option at the top of your I<Rexfile>.
set box_options => { headless => TRUE };
=head1 METHODS
See also the Methods of Rex::Box::Base. This module inherits all methods of it.
=over 4
=cut
package Rex::Box::VBox;
use strict;
use warnings;
use Data::Dumper;
use Rex::Box::Base;
use Rex::Commands -no => [qw/auth/];
use Rex::Commands::Run;
use Rex::Commands::Fs;
use Rex::Commands::Virtualization;
use Rex::Commands::SimpleCheck;
our $VERSION = '0.56.1'; # VERSION
BEGIN {
LWP::UserAgent->use;
}
use Time::HiRes qw(tv_interval gettimeofday);
use File::Basename qw(basename);
use base qw(Rex::Box::Base);
set virtualization => "VBox";
$|++;
################################################################################
# BEGIN of class methods
################################################################################
=item new(name => $vmname)
Constructor if used in OO mode.
my $box = Rex::Box::VBox->new(name => "vmname");
=cut
sub new {
my $class = shift;
my $proto = ref($class) || $class;
my $self = $proto->SUPER::new(@_);
bless( $self, ref($class) || $class );
if ( exists $self->{options}
&& exists $self->{options}->{headless}
&& $self->{options}->{headless} )
{
set virtualization => { type => "VBox", headless => TRUE };
}
$self->{get_ip_count} = 0;
return $self;
}
sub import_vm {
my ($self) = @_;
# check if machine already exists
my $vms = vm list => "all";
my $vm_exists = 0;
for my $vm ( @{$vms} ) {
if ( $vm->{name} eq $self->{name} ) {
Rex::Logger::debug("VM already exists. Don't import anything.");
$vm_exists = 1;
}
}
if ( !$vm_exists ) {
# if not, create it
$self->_download;
my $filename = basename( $self->{url} );
Rex::Logger::info("Importing VM ./tmp/$filename");
vm import => $self->{name}, file => "./tmp/$filename", %{$self};
#unlink "./tmp/$filename";
}
my $vminfo = vm info => $self->{name};
# check if networksettings should be set
if ( exists $self->{__network} && $vminfo->{VMState} ne "running" ) {
my $option = $self->{__network};
for my $nic_no ( keys %{$option} ) {
if ( $option->{$nic_no}->{type} ) {
Rex::Logger::debug( "Setting network type (dev: $nic_no) to: "
. $option->{$nic_no}->{type} );
vm
option => $self->{name},
"nic$nic_no" => $option->{$nic_no}->{type};
if ( $option->{$nic_no}->{type} eq "bridged" ) {
$option->{$nic_no}->{bridge} = select_bridge()
if ( !$option->{$nic_no}->{bridge} );
Rex::Logger::debug( "Setting network bridge (dev: $nic_no) to: "
. ( $option->{$nic_no}->{bridge} || "eth0" ) );
vm
option => $self->{name},
"bridgeadapter$nic_no" =>
( $option->{$nic_no}->{bridge} || "eth0" );
}
}
if ( $option->{$nic_no}->{driver} ) {
Rex::Logger::debug( "Setting network driver (dev: $nic_no) to: "
. $option->{$nic_no}->{driver} );
vm
option => $self->{name},
"nictype$nic_no" => $option->{$nic_no}->{driver};
}
}
}
if ( exists $self->{__forward_port} && $vminfo->{VMState} ne "running" ) {
# remove all forwards
vm forward_port => $self->{name}, delete => -all;
# add forwards
vm forward_port => $self->{name}, add => $self->{__forward_port};
}
# shared folder
if ( exists $self->{__shared_folder} && $vminfo->{VMState} ne "running" ) {
vm share_folder => $self->{name}, add => $self->{__shared_folder};
}
if ( $vminfo->{VMState} ne "running" ) {
$self->start;
}
$self->{info} = vm guestinfo => $self->{name};
}
sub provision_vm {
my ( $self, @tasks ) = @_;
if ( !@tasks ) {
@tasks = @{ $self->{__tasks} } if ( exists $self->{__tasks} );
}
$self->wait_for_ssh();
for my $task (@tasks) {
Rex::TaskList->create()->get_task($task)->set_auth( %{ $self->{__auth} } );
Rex::TaskList->create()->get_task($task)->run( $self->ip );
}
}
sub select_bridge {
my $bridges = vm "bridge";
my $ifname;
if ( @$bridges == 1 ) {
Rex::Logger::debug(
"Only one bridged interface available. Using it by default.");
$ifname = $bridges->[0]->{name};
}
elsif ( @$bridges > 1 ) {
for ( my $i = 0 ; $i < @$bridges ; $i++ ) {
my $bridge = $bridges->[$i];
next if ( $bridge->{status} =~ /^down$/i );
local $Rex::Logger::format = "%s";
Rex::Logger::info( $i + 1 . " $bridge->{name}" );
}
my $choice;
do {
print "What interface should network bridge to? ";
chomp( $choice = <STDIN> );
$choice = int($choice);
} while ( !$choice );
$ifname = $bridges->[ $choice - 1 ]->{name};
}
return $ifname;
}
=item share_folder(%option)
Creates a shared folder inside the VM with the content from a folder from the Host machine. This only works with VirtualBox.
$box->share_folder(
name => "/path/on/host",
name2 => "/path_2/on/host",
);
=cut
sub share_folder {
my ( $self, %option ) = @_;
$self->{__shared_folder} = \%option;
}
=item info
Returns a hashRef of vm information.
=cut
sub info {
my ($self) = @_;
$self->ip;
my $vm_info = vm info => $self->{name};
# get forwarded ports
my @forwarded_ports = grep { m/^Forwarding/ } keys %{$vm_info};
my %forward_port;
for my $fwp (@forwarded_ports) {
my ( $name, $proto, $host_ip, $host_port, $vm_ip, $vm_port ) =
split( /,/, $vm_info->{$fwp} );
$forward_port{$name} = [ $host_port, $vm_port ];
}
$self->forward_port(%forward_port);
return $self->{info};
}
=item ip
This method return the ip of a vm on which the ssh daemon is listening.
=cut
sub ip {
my ($self) = @_;
$self->{info} = vm guestinfo => $self->{name};
if ( scalar keys %{ $self->{info} } == 0 ) { return; }
my $server = $self->{info}->{net}->[0]->{ip};
if ( $self->{__forward_port}
&& $self->{__forward_port}->{ssh}
&& !Rex::is_local() )
{
$server = connection->server . ":" . $self->{__forward_port}->{ssh}->[0];
}
elsif ( $self->{__forward_port}
&& $self->{__forward_port}->{ssh}
&& Rex::is_local() )
{
$server = "127.0.0.1:" . $self->{__forward_port}->{ssh}->[0];
}
$self->{info}->{ip} = $server;
if ( !$server ) {
sleep 1;
$self->{get_ip_count}++;
if ( $self->{get_ip_count} >= 30 ) {
die "Can't get ip of VM.";
}
my $ip = $self->ip;
if ($ip) {
$self->{get_ip_count} = 0;
return $ip;
}
}
return $server;
}
=back
=cut
1;
| gitpan/Rex | lib/Rex/Box/VBox.pm | Perl | apache-2.0 | 8,111 |
package Paws::WorkDocs::CreateLabels;
use Moose;
has AuthenticationToken => (is => 'ro', isa => 'Str', traits => ['ParamInHeader'], header_name => 'Authentication');
has Labels => (is => 'ro', isa => 'ArrayRef[Str|Undef]', required => 1);
has ResourceId => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'ResourceId', required => 1);
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'CreateLabels');
class_has _api_uri => (isa => 'Str', is => 'ro', default => '/api/v1/resources/{ResourceId}/labels');
class_has _api_method => (isa => 'Str', is => 'ro', default => 'PUT');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::WorkDocs::CreateLabelsResponse');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::WorkDocs::CreateLabels - Arguments for method CreateLabels on Paws::WorkDocs
=head1 DESCRIPTION
This class represents the parameters used for calling the method CreateLabels on the
Amazon WorkDocs service. Use the attributes of this class
as arguments to method CreateLabels.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to CreateLabels.
As an example:
$service_obj->CreateLabels(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 AuthenticationToken => Str
Amazon WorkDocs authentication token. This field should not be set when
using administrative API actions, as in accessing the API using AWS
credentials.
=head2 B<REQUIRED> Labels => ArrayRef[Str|Undef]
List of labels to add to the resource.
=head2 B<REQUIRED> ResourceId => Str
The ID of the resource.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method CreateLabels in L<Paws::WorkDocs>
=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/WorkDocs/CreateLabels.pm | Perl | apache-2.0 | 2,276 |
#!/usr/bin/env perl
# 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.
# File name: CreateCoreTestDatabase.pl
#
# Given a source and destination database this script will create
# a ensembl core database and populate it with data from a region defined in the seq_region_file
#
use strict;
use Getopt::Long;
use DBI;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
my ($help, $srcDB, $destDB, $host, $user, $pass, $port, $seq_region_file, $dest_host, $dest_user, $dest_pass, $dest_port, $source_url, $dest_url);
GetOptions('help' => \$help,
'source_url=s' => \$source_url,
'destination_url=s' => \$dest_url,
's=s' => \$srcDB,
'd=s' => \$destDB,
'h=s' => \$host,
'u=s' => \$user,
'p=s' => \$pass,
'port=i' => \$port,
'dest_h=s' => \$dest_host,
'dest_u=s' => \$dest_user,
'dest_p=s' => \$dest_pass,
'dest_port=i' => \$dest_port,
'seq_region_file=s' => \$seq_region_file);
my $usage = "Usage:
CreateCoreTestDatabase.pl -s srcDB -d destDB -h host -u user -p pass [--port port] -dest_h dest_host -dest_u dest_user -dest_p dest_pass [--dest_port dest_port] --seq_region_file seq_region_file \n";
if ($help) {
print $usage;
exit 0;
}
unless($port) {
$port = 3306;
}
unless($dest_port) {
$dest_port = 3306;
}
# If needed command line args are missing print the usage string and quit
$srcDB and $destDB and $host and $user and $dest_host and $dest_user and $dest_pass and $seq_region_file or die $usage;
#Get seq_regions
my @seq_regions = @{do $seq_region_file};
my $from_dsn = "DBI:mysql:host=$host;port=$port";
my $to_dsn = "DBI:mysql:host=$dest_host;port=$dest_port";
#Need this to create the core database
my $to_dbh = DBI->connect( $to_dsn, $dest_user, $dest_pass, {RaiseError => 1})
or die "Could not connect to database host : " . DBI->errstr;
my $from_dba = new Bio::EnsEMBL::DBSQL::DBAdaptor(
-host => $host,
-user => $user,
-port => $port,
-group => 'core',
-dbname => $srcDB);
my $to_dba = new Bio::EnsEMBL::DBSQL::DBAdaptor(
-host => $dest_host,
-user => $dest_user,
-pass => $dest_pass,
-port => $dest_port,
-group => 'core',
-dbname => $destDB);
print "\nWARNING: If the $destDB database on $dest_host already exists the existing copy \n"
. "will be destroyed. Proceed (y/n)? ";
my $key = lc(getc());
unless( $key =~ /y/ ) {
$from_dba->dbc->disconnect();
$to_dba->dbc->disconnect();
print "Test Genome Creation Aborted\n";
exit;
}
print "Proceeding with test genome database $destDB on $dest_host creation\n";
# dropping any destDB database if there
my $array_ref = $to_dbh->selectall_arrayref("SHOW DATABASES LIKE '$destDB'");
if (scalar @{$array_ref}) {
$to_dba->dbc->do("DROP DATABASE $destDB");
}
# creating destination database
$to_dbh->do( "CREATE DATABASE " . $destDB )
or die "Could not create database $destDB: " . $to_dbh->errstr;
# Dump the source database table structure (w/o data) and use it to create
# the new database schema
# May have to eliminate the -p pass part... not sure
my $rc = 0xffff & system(
"mysqldump -u $user -h $host -P $port --no-data $srcDB | " .
"mysql -p$dest_pass -u $dest_user -h $dest_host -P $dest_port $destDB");
if($rc != 0) {
$rc >>= 8;
die "mysqldump and insert failed with return code: $rc";
}
$to_dba->dbc->do("use $destDB");
# populate coord_system table
my $query = "SELECT * FROM $srcDB.coord_system";
my $table_name = "coord_system";
copy_data_in_text_mode($from_dba, $to_dba, $table_name, $query);
#Store available coord_systems
my %coord_systems;
my $sql = "select coord_system_id, name, rank from coord_system";
my $sth = $to_dba->dbc->prepare($sql);
$sth->execute();
while (my $row = $sth->fetchrow_hashref) {
$coord_systems{$row->{name}} = $row->{rank};
}
$sth->finish;
#$array_ref = $from_dba->db_handle->selectcol_arrayref("select coord_system_id from coord_system where rank=1");
#my $coord_system_id = $array_ref->[0];
my $slice_adaptor = $from_dba->get_adaptor("Slice");
# populate assembly and assembly_exception tables
my $all_seq_region_names = {};
foreach my $seq_region (@seq_regions) {
my ($seq_region_name, $seq_region_start, $seq_region_end) = @{$seq_region};
#$all_seq_region_names->{$seq_region_name} = 1;
#This query doesn't work with gorilla (e!68) because we cannot go from chromosome to contig but must go via supercontig
#$query = "SELECT a.* FROM $srcDB.seq_region s,$srcDB.assembly a WHERE s.coord_system_id=$coord_system_id AND s.name='$seq_region_name' AND s.seq_region_id=a.asm_seq_region_id AND a.asm_start<$seq_region_end AND a.asm_end>$seq_region_start";
#Make the assumption that the core API is OK and that the 3 levels of assembly are chromosome, supercontig and contig
my $slice = $slice_adaptor->fetch_by_region('toplevel', $seq_region_name, $seq_region_start, $seq_region_end);
my $supercontigs;
my $seq_region_list;
#May not always have supercontigs
if ($coord_systems{'supercontig'}) {
$supercontigs = $slice->project('supercontig');
foreach my $supercontig (@$supercontigs) {
my $supercontig_slice = $supercontig->[2];
$seq_region_list .= $supercontig_slice->get_seq_region_id . ",";
}
}
#Assume always have contigs
my $contigs = $slice->project('contig');
foreach my $contig (@$contigs) {
my $contig_slice = $contig->[2];
$seq_region_list .= $contig_slice->get_seq_region_id . ",";
}
chop $seq_region_list;
$query = "SELECT a.* FROM $srcDB.seq_region s JOIN $srcDB.assembly a ON (s.seq_region_id = a.cmp_seq_region_id) WHERE seq_region_id IN ($seq_region_list)";
copy_data_in_text_mode($from_dba, $to_dba, "assembly", $query);
#convert seq_region_name to seq_region_id
my $sql = "SELECT seq_region_id FROM seq_region WHERE name = \"$seq_region_name\"";
my $sth = $from_dba->dbc->prepare($sql);
$sth->execute();
my ($seq_region_id) = $sth->fetchrow_arrayref->[0];
$sth->finish;
print "$seq_region_name seq_region_id $seq_region_id\n";
$all_seq_region_names->{$seq_region_name} = $seq_region_id;
}
my ($asm_seq_region_ids,$asm_seq_region_ids_str) = get_ids($to_dba,"asm_seq_region_id", "assembly") ;
my $all_seq_region_ids;
my ($cmp_seq_region_ids,$cmp_seq_region_ids_str) = get_ids($to_dba,"cmp_seq_region_id", "assembly") ;
$query = "SELECT ax.* FROM assembly_exception ax WHERE ax.seq_region_id in ($asm_seq_region_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "assembly_exception", $query);
# populate attrib_type table
$query = "SELECT * FROM attrib_type";
copy_data_in_text_mode($from_dba, $to_dba, "attrib_type", $query);
# populate seq_region and seq_region_attrib tables
foreach my $id (@$asm_seq_region_ids) {
push @$all_seq_region_ids, $id;
}
foreach my $id (@$cmp_seq_region_ids) {
push @$all_seq_region_ids, $id;
}
my $all_seq_region_ids_str = join ",", @$all_seq_region_ids;
$query = "SELECT s.* from seq_region s where s.seq_region_id in ($all_seq_region_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "seq_region", $query);
$query = "SELECT sa.* FROM seq_region_attrib sa WHERE sa.seq_region_id in ($all_seq_region_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "seq_region_attrib", $query);
# populate dna table
$query = "SELECT d.* FROM dna d WHERE d.seq_region_id in ($all_seq_region_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "dna", $query);
# populate repeat_feature and repeat_consensus tables
# repeat_features are stored at sequence_level
$query = "SELECT rf.* FROM repeat_feature rf WHERE rf.seq_region_id in ($cmp_seq_region_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "repeat_feature", $query);
foreach my $seq_region (@seq_regions) {
my ($seq_region_name, $seq_region_start, $seq_region_end) = @{$seq_region};
my $seq_region_id = $all_seq_region_names->{$seq_region_name};
$query = "SELECT rf.* FROM repeat_feature rf WHERE rf.seq_region_id=$seq_region_id AND rf.seq_region_start<$seq_region_end AND rf.seq_region_end>$seq_region_start";
copy_data_in_text_mode($from_dba, $to_dba, "repeat_feature", $query);
}
my ($repeat_consensus_ids, $repeat_consensus_ids_str) = get_ids($to_dba, "repeat_consensus_id", "repeat_feature");
$query = "SELECT rc.* FROM repeat_consensus rc WHERE rc.repeat_consensus_id in ($repeat_consensus_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "repeat_consensus", $query);
# populate transcript, transcript_attrib and transcript_stable_id tables
# transcripts are stored at top_level
foreach my $seq_region (@seq_regions) {
my ($seq_region_name, $seq_region_start, $seq_region_end) = @{$seq_region};
my $seq_region_id = $all_seq_region_names->{$seq_region_name};
$query = "SELECT t.* FROM transcript t WHERE t.seq_region_id=$seq_region_id AND t.seq_region_end<$seq_region_end AND t.seq_region_end>$seq_region_start";
copy_data_in_text_mode($from_dba, $to_dba, "transcript", $query);
}
my ($transcript_ids, $transcript_ids_str) = get_ids($to_dba, "transcript_id", "transcript");
my ($gene_ids, $gene_ids_str) = get_ids($to_dba, "gene_id", "transcript");
if ($transcript_ids_str) {
$query = "SELECT ta.* FROM transcript_attrib ta WHERE ta.transcript_id in ($transcript_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "transcript_attrib", $query);
}
# populate translation, translation_attrib and translation_stable_id tables
if ($transcript_ids_str) {
$query = "SELECT tl.* FROM translation tl WHERE tl.transcript_id in ($transcript_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "translation", $query);
}
my ($translation_ids, $translation_ids_str) = get_ids($to_dba, "translation_id", "translation");
if ($translation_ids_str) {
$query = "SELECT tla.* FROM translation_attrib tla WHERE tla.translation_id in ($translation_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "translation_attrib", $query);
}
# populate exon_transcript, exon and exon_stable_id tables
if ($transcript_ids_str) {
$query = "SELECT et.* FROM exon_transcript et WHERE et.transcript_id in ($transcript_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "exon_transcript", $query);
}
my ($exon_ids, $exon_ids_str) = get_ids($to_dba, "exon_id", "exon_transcript");
if ($exon_ids_str) {
$query = "SELECT e.* FROM exon e WHERE e.exon_id in ($exon_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "exon", $query);
}
# populate gene, gene_stable_id and alt_allele tables
if ($gene_ids_str) {
$query = "SELECT g.* FROM gene g WHERE g.gene_id in ($gene_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "gene", $query);
}
if ($gene_ids_str) {
$query = "SELECT alt.* FROM alt_allele alt WHERE alt.gene_id in ($gene_ids_str)";
copy_data_in_text_mode($from_dba, $to_dba, "alt_allele", $query);
}
# populate meta and meta_coord table
$query = "SELECT * FROM meta";
copy_data_in_text_mode($from_dba, $to_dba, "meta", $query);
$query = "SELECT * FROM meta_coord";
copy_data_in_text_mode($from_dba, $to_dba, "meta_coord", $query);
print "Test genome database $destDB created\n";
sub copy_data_in_text_mode {
my ($from_dba, $to_dba, $table_name, $query, $step) = @_;
print "start copy_data_in_text_mode $table_name\n";
my $user = $to_dba->dbc->username;
my $pass = $to_dba->dbc->password;
my $host = $to_dba->dbc->host;
my $port = $to_dba->dbc->port;
my $dbname = $to_dba->dbc->dbname;
my $use_limit = 1;
my $start = 0;
if (!defined $step) {
$step = 100000;
}
while (1) {
my $start_time = time();
my $end = $start + $step - 1;
my $sth;
print "$query start $start end $end\n";
$sth = $from_dba->dbc->prepare($query." LIMIT $start, $step");
$start += $step;
$sth->execute();
my $all_rows = $sth->fetchall_arrayref;
$sth->finish;
## EXIT CONDITION
return if (!@$all_rows);
my $time=time();
my $filename = "/tmp/$table_name.copy_data.$$.$time.txt";
open(TEMP, ">$filename") or die "could not open the file '$filename' for writing";
foreach my $this_row (@$all_rows) {
print TEMP join("\t", map {defined($_)?$_:'\N'} @$this_row), "\n";
}
close(TEMP);
#print "time " . ($start-$min_id) . " " . (time - $start_time) . "\n";
system("mysqlimport -h$host -P$port -u$user ".($pass ? "-p$pass" : '')." -L -l -i $dbname $filename");
unlink("$filename");
#print "total time " . ($start-$min_id) . " " . (time - $start_time) . "\n";
}
}
sub get_ids {
my ($dba, $id, $table) = @_;
my $ids;
my $sql = "SELECT distinct($id) FROM $table";
my $sth = $dba->dbc->prepare($sql);
$sth->execute();
while (my $row = $sth->fetchrow_arrayref) {
push @$ids, $row->[0];
}
$sth->finish();
return (undef, "") unless ($ids);
my $ids_str = join ",", @$ids;
return ($ids, $ids_str);
}
exit 0;
| dbolser-ebi/ensembl-compara | modules/t/CreateCoreTestDatabase.pl | Perl | apache-2.0 | 13,439 |
#
# 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 hardware::devices::camera::hikvision::snmp::mode::time;
use base qw(snmp_standard::mode::ntp);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
sub get_target_time {
my ($self, %options) = @_;
my $oid_sysTime = '.1.3.6.1.4.1.39165.1.19.0';
my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_sysTime ], nothing_quit => 1);
# format: "2019-11-18 20:13:17"
if ($snmp_result->{$oid_sysTime} !~ /^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/) {
$self->{output}->add_option_msg(short_msg => 'cannot parse date format: ' . $snmp_result->{$oid_sysTime});
$self->{output}->option_exit();
}
my $remote_date = [$1, $2, $3, $4, $5, $6];
my $timezone = 'UTC';
if (defined($self->{option_results}->{timezone}) && $self->{option_results}->{timezone} ne '') {
$timezone = $self->{option_results}->{timezone};
}
my $tz = centreon::plugins::misc::set_timezone(name => $timezone);
my $dt = DateTime->new(
year => $remote_date->[0],
month => $remote_date->[1],
day => $remote_date->[2],
hour => $remote_date->[3],
minute => $remote_date->[4],
second => $remote_date->[5],
%$tz
);
return ($dt->epoch, $remote_date, $timezone);
}
1;
__END__
=head1 MODE
Check time offset of server with ntp server. Use local time if ntp-host option is not set.
SNMP gives a date with second precision (no milliseconds). Time precision is not very accurate.
Use threshold with (+-) 2 seconds offset (minimum).
=over 8
=item B<--warning-offset>
Time offset warning threshold (in seconds).
=item B<--critical-offset>
Time offset critical Threshold (in seconds).
=item B<--ntp-hostname>
Set the ntp hostname (if not set, localtime is used).
=item B<--ntp-port>
Set the ntp port (Default: 123).
=item B<--timezone>
Set the timezone of distant server. For Windows, you need to set it.
Can use format: 'Europe/London' or '+0100'.
=back
=cut
| centreon/centreon-plugins | hardware/devices/camera/hikvision/snmp/mode/time.pm | Perl | apache-2.0 | 2,905 |
:- module( 'post_prune.common' , _ ).
:- set_prolog_flag(single_var_warnings,off).
:- use_module( '../bimtools' ).
:- use_module('../calc_chtree').
:- use_module('../more_specific/more_specific').
/* post_prune_chtree_minlvs(G,T,C,OC,NrLvs) :-
print(call_post_prune_chtree_minlvs(G,T,C)),nl,fail. */
post_prune_chtree_minlvs(Goal,Top,success,success,0).
post_prune_chtree_minlvs(Goal,Top,stop,stop,L) :-
partition_goal(Goal,SplitGoals),
length(SplitGoals,L).
post_prune_chtree_minlvs(Goal,Top,empty,empty,0).
post_prune_chtree_minlvs(Goal,Top,remove(SelLitNr,Pred,Children),
PrunedChtree,NrLeaves) :-
PrunedChtree = remove(SelLitNr,Pred,PrunedChildren),
pp_mnf(more_specific_transformation(Goal)),
pp_mnf(split_list(Goal,SelLitNr,Left,Sel,Right)),
pp_mnf(append(Left,Right,NewGoal)),
post_prune_chtree_minlvs(NewGoal,no,Children,PrunedChildren,NrLeaves).
post_prune_chtree_minlvs(Goal,Top,built_in_eval(SelLitNr,BI,Children),
PrunedChtree,NrLeaves) :-
PrunedChtree = built_in_eval(SelLitNr,BI,PrunedChildren),
pp_mnf(more_specific_transformation(Goal)),
pp_mnf(split_list(Goal,SelLitNr,Left,Sel,Right)),
(is_callable_built_in_literal(Sel) -> call_built_in(Sel) ; true),
pp_mnf(append(Left,Right,NewGoal)),
post_prune_chtree_minlvs(NewGoal,no,Children,PrunedChildren,NrLeaves).
post_prune_chtree_minlvs(Goal,Top,select(SelLitNr,Chpaths),PrunedChtree,NrLeaves) :-
pp_mnf(more_specific_transformation(Goal)),
pp_mnf(split_list(Goal,SelLitNr,Left,Sel,Right)),
partition_goal(Goal,SplitGoals),
length(SplitGoals,NrSplitGoals),
post_prune_chpaths_minlvs(Left,Sel,Right,Chpaths,
PrunedChpaths,ChildLeaves),
((ChildLeaves > NrSplitGoals,
Top=no)
-> (PrunedChtree = stop, NrLeaves = NrSplitGoals)
; (PrunedChtree = select(SelLitNr,PrunedChpaths),
NrLeaves = ChildLeaves
)
).
/* --------------------------- */
/* post_prune_chpaths_minlvs/6 */
/* --------------------------- */
post_prune_chpaths_minlvs(Left,Sel,Right,[],[],0).
post_prune_chpaths_minlvs(Left,Sel,Right,
[match(ClauseNr,Children)|Rest],[match(ClauseNr,PrChildren)|PrRest],
NrOfLeaves) :-
copy(c(Left,Sel,Right),c(CL,CS,CR)),
claus(ClauseNr,CS,Body),
pp_mnf(append(Body,CR,IntGoal)),
pp_mnf(append(CL,IntGoal,NewGoal)),
post_prune_chtree_minlvs(NewGoal,no,Children,PrChildren,NrChild),!,
post_prune_chpaths_minlvs(Left,Sel,Right,Rest,PrRest,NrRest),
NrOfLeaves is NrChild + NrRest.
| leuschel/ecce | ecce_source/postprune/post_prune.common.pl | Perl | apache-2.0 | 2,412 |
#****h* My/Xml.pm
#NAME
# Xml.pm
#
# SYNOPSIS
#
# This module contains support functions for the xml files.
#
# Getting data out of it, and storing data in it.
#
#
# DESCRIPTION
#
#
#
#
# EXAMPLE
#
# See t/Xml.t
#
#
# FILES
#
# ATTRIBUTES
#
# SEE ALSO
#
#
# NOTES
#
#
# CAVEATS
#
# This script uses XML::LibXML.
#
# DIAGNOSTICS
#
#
# BUGS
#
#
# AUTHOR
#
#
# HISTORY
#
#****
package My::Xml;
use strict;
use vars qw(@ISA @EXPORT $VERSION);
use XML::LibXML;
use Carp;
use Exporter;
$VERSION = 1.1.0;
@ISA = ('Exporter');
@EXPORT = qw(
&GetChildDataBySingleTagName
&GetDataArrayByTagName
&GetDataArrayByTagAndAttribute
&GetDataHashByTagName
&GetDataHashByTagNameAndAttribute
&GetFirstSubNodeValues
&GetNodeArrayByTagAndAttribute
&GetNodeArrayByTagName
&GetSingleChildNodeByTagAndAttribute
&GetSingleChildNodeByTagName
&GetSingleChildNodeValueByTagAndAttribute
&GetChildValueListByTagAndAttribute
&ListAtrributeforTag
&LoadXmlStructure
&LoadXmlTree
&SetActiveRoot
);
# ----------------------------------------------------------------------------
#****f* Xml.pm/ListAtrributeforTag
# NAME
# ListAtrributeforTag
# FUNCTION
# Get the list of Attribute with NAME on tag TAG.
# E.g. get list of valid component for a release.
#
# INPUTS
# * xmlNode -- XML Node.
# * szTagName -- Tag name.
# * szAttributeName -- Attribute name.
#
# OUTPUT
#
# Nothing.
#
# RETURN VALUE
# Array with all attributes by specified name.
#
# NOTES
#
# No error will be given if it cant resolve the parm2 or parm3.
#
# SOURCE
sub ListAtrributeforTag {
my $xmlNode=$_[0];
my $szTagName=$_[1];
my $szAttributeName=$_[2];
my @arValues;
my @arEntries=$xmlNode->getElementsByTagName($szTagName);
# die if no entries.
# Go through the entries and get the attribute
foreach my $pEntry (@arEntries) {
my $szAttributeValue=$pEntry->getAttribute($szAttributeName);
if ( defined($szAttributeValue) ) {
push(@arValues, $szAttributeValue);
} #endif right attr.
} # end for each.
return(@arValues);
} # listattributefortag.
#****
# ----------------------------------------------------------------------------
#****f* Xml.pm/LoadXmlStructure
# NAME
# LoadXmlStructure
# FUNCTION
#
# Create the Parser, load the xml file, and return the root of the document.
#
# INPUTS
# * szFileName -- name of XML file.
#
# OUTPUT
#
# XML tree loaded.
#
# RETURN VALUE
# ($root, $tree)
# pointer to root of document tree.
# xml tree pointer.
#
# NOTES
#
# It does not verify if the file exist, before attempting to read it.
#
# It does no look for a version of the XML file. This should be implemented.
#
#
# SOURCE
sub LoadXmlStructure {
my $szFileName=$_[0];
# verify that filename exists.
# what happens to the parser ? is it needed or can it be destroyed ?
my $xml_parser = XML::LibXML->new();
my $tree;
my $root;
if ( -f $szFileName ) {
$tree = $xml_parser->parse_file($szFileName);
}
if ( defined($tree) ) {
$root = $tree->getDocumentElement;
}
return($root, $tree);
} # end loadxmlstructure.
#****
# ----------------------------------------------------------------------------
#****f* Xml.pm/LoadXmlTree
# NAME
# LoadXmlTree
# FUNCTION
#
# Create the Parser, load the xml file, and return the root of the document.
#
# INPUTS
# * szFileName -- name of XML file.
#
# OUTPUT
#
# XML tree loaded.
#
# RETURN VALUE
#
# pointer to root of document tree, if successfull.
# return 'undef' if fail.
#
# NOTES
#
# It does not verify if the file exist, before attempting to read it.
#
# It does no look for a version of the XML file. This should be implemented.
#
#
# SOURCE
sub LoadXmlTree {
my $szFileName=$_[0];
# verify that filename exists.
# what happens to the parser ? is it needed or can it be destroyed ?
my $xml_parser = XML::LibXML->new();
my $tree;
my $root;
if ( -f $szFileName ) {
$tree = $xml_parser->parse_file($szFileName);
} else {
die("!!! File does not exist: $szFileName");
}
if ( defined($tree) ) {
$root = $tree->getDocumentElement;
} else {
print "LoadXmlTree(): didn't parse $szFileName\n";
}
return($root);
} # end loadxmltree.
#****
# ------------------------------------------------------------ #
# XML
=pod
=head2 SetActiveRoot
=over 4
=item Description
Mostly used on rel_components.xml.
Call LoadXmlTree($szFileName), find the entry with the correct parm2 name. Return the pointer to that element.
If parm3 is non-empty, then the component name must match that as well as the version number.
(Return pointer to element with both correct version and component name).
=item Input
parm1: name of XML file.
parm2: Release version, like TE51, AP63 etc.
parm3: optional component name. If is not used it MUST be "", otherwise this function will fail, without warning.
=item Output
Nothing.
=item Value Returned
pointer to element that fits parm2, parm3 requirement.
=item Cautions
No error will be given if it cant resolve the parm2 or parm3.
=back
=cut
# ------------------------------------------------------------ #
sub SetActiveRoot {
# die if less that #2
if ( $#_ < 2 ) {
die "SetActiveRoot(): Too few params($#_), need at least filename, basetag, releasver [comp name] ", __FILE__, " line ", __LINE__, "\n";
}
my $szFileName=$_[0];
my $szBaseTag=$_[1];
my $szRelVer=$_[2];
# this is an optional param, only used in the component xml file.
my $szComponentName=$_[3];
if ( ! defined($szComponentName) ) {
$szComponentName="";
}
my $szReleaseRead="";
my $szComponentNameRead="";
my $pReturn=0;
my $xmlRoot=LoadXmlTree($szFileName);
# Get list of all base entries.
my @arEntries=$xmlRoot->getElementsByTagName($szBaseTag);
# die if no entries.
# Go through the entries and find the one with the correct version number.
foreach my $pEntry (@arEntries) {
$szReleaseRead=$pEntry->getAttribute('Name');
# If the optional component name is given (non empty), the look for that as well.
if ( $szComponentName ne "" ) {
$szComponentNameRead=$pEntry->getAttribute('Component');
}
if ( ( $szRelVer eq $szReleaseRead ) && ( $szComponentName eq $szComponentNameRead) ) {
#print "entry found.";
$pReturn=$pEntry;
} # endif.
} # end foreach.
return($pReturn);
} # end setactiveroot.
# ----------------------------------------------------------------------------
#****f* xml2xml.pl/GetFirstSubNodeValues
# NAME
# GetFirstSubNodeValues
# FUNCTION
#
#
#
# INPUTS
# * -- .
#
# OUTPUT
#
#
#
# RETURN VALUE
#
#
# NOTES
#
#
#
# SOURCE
sub GetFirstSubNodeValues {
my $xmlNode=$_[0];
my $szTagName=$_[1];
my @arAnswer;;
my @arNodes = $xmlNode->getChildrenByTagName($szTagName);
# print "GetFirstSubNodeValues($xmlNode, $szTagName): $#arNodes / @arNodes\n";
if ($#arNodes == -1) {
my $szNodeName=$xmlNode->nodeName();
my @arChildNodes = $xmlNode->childNodes();
foreach my $xmlChildNode (@arChildNodes) {
my $szName=$xmlChildNode->nodeName();
print "-$szName-\n";
}
confess "Node <$szNodeName> doesn't have <$szTagName> as child.\n";
}
foreach my $xmlTmpNode (@arNodes) {
my $szAnswer=$xmlTmpNode->textContent();
# print "Content of $#arNodes $xmlTmpNode <$szTagName>: $szAnswer\n";
push(@arAnswer, $szAnswer);
} # end foreach.
return(@arAnswer);
} # end getfirstsubnodevalue
#****
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetSingleChildNodeByTagAndAttribute
# NAME
#
# FUNCTION
#
#
#
# INPUTS
# * xmlNode -- XML Node from whence the search will start.
# * szTagName -- Tagname to look for.
# * szAttributeName -- Attribute name to look for.
# * szAttributeContent -- Value in attribute to look for.
#
# OUTPUT
# Nothing.
#
# RETURN VALUE
# First node that fullfills the criteria of the search.
#
# NOTES
# This should be refactored to be a subset of GetListOfChildNodesByTagAndAttribute
#
#
# SOURCE
sub GetSingleChildNodeByTagAndAttribute {
my $xmlNode=$_[0];
my $szTagName=$_[1];
my $szAttributeName=$_[2];
my $szAttributeContent=$_[3];
# print " GetSingleChildNodeByTagAndAttribute()\n";
my @arNodeList=GetNodeArrayByTagAndAttribute($xmlNode, $szTagName, $szAttributeName, $szAttributeContent);
# print @arNodeList;
# Get the first value.
my $xmlReturnNode=shift @arNodeList;
return($xmlReturnNode);
} # end Getsinglechildnodebytagandattribute
#***
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetSingleChildNodeByTagName
# NAME
#
# FUNCTION
#
#
#
# INPUTS
# * xmlNode -- XML Node from whence the search will start.
# * szTagName -- Tagname to look for.
# * szAttributeName -- Attribute name to look for.
#
# OUTPUT
# Nothing.
#
# RETURN VALUE
# First node that fullfills the criteria of the search.
#
# NOTES
#
#
# SOURCE
sub GetSingleChildNodeByTagName {
my $xmlNode = shift;
my $szTagName = shift;
# print " GetSingleChildNodeByTagName()\n";
my @arNodeList=GetNodeArrayByTagName($xmlNode, $szTagName);
# print @arNodeList;
# Get the first value.
my $xmlReturnNode=shift @arNodeList;
return($xmlReturnNode);
} # end GetSingleChildNodeByTagName
#***
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
sub GetSingleChildNodeValueByTagAndAttribute {
my $xmlNode=$_[0];
my $szTagName=$_[1];
my $szAttributeName=$_[2];
my $szAttributeContent=$_[3];
my $szAnswer="";
my $xmlFoundNode=GetSingleChildNodeByTagAndAttribute($xmlNode, $szTagName, $szAttributeName, $szAttributeContent);
$szAnswer=$xmlFoundNode->string_value();
return($szAnswer);
} #end getsinglechildnodevaluebytagandattribute
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetDataArrayByTagAndAttribute
# NAME
# GetDataArrayByTagAndAttribute
# FUNCTION
#
#
#
# INPUTS
# * xmlNode -- XML Node from whence the search will start.
# * szTagName -- Tagname to look for.
# * szAttributeName -- Attribute name to look for.
# * szAttributeContent -- Value in attribute to look for.
#
# OUTPUT
#
#
#
# RETURN VALUE
#
#
# NOTES
#
# SEE ALSO
# utGetDataArrayByTagAndAttribute.001
#
# SOURCE
sub GetDataArrayByTagAndAttribute {
if ( $#_ != 3 ) {
die "GetDataArrayByTagAndAttribute(): wrong parameter number params($#_), need at least xmlNode and TagName AttributeName AttributeValue", __FILE__, " line ", __LINE__, "\n";
}
my $xmlNode=$_[0];
my $szTagName=$_[1];
my $szAttributeName=$_[2];
my $szAttributeContent=$_[3];
my @arDataList;
my @arNodeList=GetNodeArrayByTagAndAttribute($xmlNode, $szTagName, $szAttributeName, $szAttributeContent);
foreach my $xmlDataNode (@arNodeList) {
my $szData=$xmlDataNode->string_value();
push(@arDataList, $szData);
} # end foreach
return(@arDataList);
} # end getdataarraybytagandattribute.
#****
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetNodeArrayByTagAndAttribute
# NAME
# GetNodeArrayByTagAndAttribute
# FUNCTION
# Get a list of nodes, with the given tag name.
# If the szAttributeName is three spaces then only the szTagName is used.
#
#
#
# INPUTS
# * xmlNode -- XML Node from whence the search will start.
# * szTagName -- Tagname to look for.
# * szAttributeName -- Attribute name to look for. use three spaces to disregard the attributes.
# * szAttributeContent -- Value in attribute to look for.
#
# OUTPUT
#
#
#
# RETURN VALUE
#
#
# NOTES
#
#
#
# SOURCE
sub GetNodeArrayByTagAndAttribute {
if ( $#_ != 3 ) {
die "GetNodeArrayByTagAndAttribute(): wrong parameter number params($#_), need at least xmlNode and TagName AttributeName AttributeValue", __FILE__, " line ", __LINE__, "\n";
}
my $xmlNode=$_[0];
my $szTagName=$_[1];
my $szAttributeName=$_[2];
my $szAttributeContent=$_[3];
my @arNodeList;
if ( ( ! defined($xmlNode) ) || ( $xmlNode == 0 ) ) {
confess "GetNodeArrayByTagAndAttribute(): zero pointer or undefined pointer for ($szTagName)\n";
}
my @arEntries=$xmlNode->getElementsByTagName($szTagName);
# die if no entries.
if ( $szAttributeName eq " " ) {
@arNodeList=@arEntries;
} else {
# Go through the entries and find any one with the attribute.
if ( ! defined($szAttributeContent) ) {
confess("szAttributeContent (parm3) not defined for szTagName($szTagName), szAttributeName($szAttributeName)");
} else {
foreach my $pEntry (@arEntries) {
if ( $pEntry->hasAttribute($szAttributeName) ) {
my $szAttributeRead=$pEntry->getAttribute($szAttributeName);
if ( $szAttributeRead eq $szAttributeContent ) {
push(@arNodeList, $pEntry);
} #endif right attr.
} # endif has attribute.
} # end foreach.
} # end else if szattributename not defined.
} # end else.
return(@arNodeList);
} # end getnodearraybytagandattribute
#****
sub GetNodeArrayByTagName {
if ( $#_ != 1 ) {
confess "GetNodeArrayByTagName(): wrong parameter number params($#_), need at least xmlNode and TagName\n";
}
my $xmlNode=$_[0];
my $szTagName=$_[1];
my @arNodeList=GetNodeArrayByTagAndAttribute($xmlNode, $szTagName, " ", " ");
return(@arNodeList);
}
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetDataArrayByTagName
# NAME
# GetDataArrayByTagName
# FUNCTION
# Return an array with the data from all nodes identified by tagname.
#
#
# INPUTS
# * xmlNode -- XML Node from where to start search.
# * xmlTagName -- Tag name to look for.
#
# OUTPUT
#
# Nothing
#
# RETURN VALUE
# Array with all data elements found.
#
# NOTES
# This could be refactored to be a sub set or GetDataArrayByTagAndAttribute
# EXAMPLES
# utGetDataArrayByTagName.001
# SOURCE
sub GetDataArrayByTagName {
if ( $#_ != 1 ) {
confess "GetDataArrayByTagName(): wrong parameter number params($#_), need at least xmlNode and TagName ", __FILE__, " line ", __LINE__, "\n";
}
my $xmlNode=$_[0];
my $xmlTagName=$_[1];
if ( ( ! defined($xmlNode) ) || ( $xmlNode == 0 ) ) {
confess "GetDataArrayByTagName(): zero pointer or undefined pointer for ($xmlTagName) ", __FILE__, " line ", __LINE__, "\n";
}
my @arReturnList;
# Read the Files list
my @arElementList = $xmlNode->getElementsByTagName($xmlTagName);
foreach my $szElement (@arElementList) {
my $szData = $szElement->string_value();
push(@arReturnList, $szData);
} #end foreach.
return(@arReturnList);
} # end getdataarraybytagname.
#****
# -----------------------------------------------------------------------
# ---------------------
sub GetArrayOfContentForEachElementByTagSortedByAttribute {
my $xmlElement = shift;
my $szTagName = shift;
my $szSortAttributeName = shift;
my @arResult;
# TODO C Sort these entries by szSortAttributeName
my @arNodeList = GetNodeArrayByTagName($xmlElement, $szTagName);
# arNodeList.each { |xmlNode|
# arResult.push(xmlNode.text)
# }
return(@arResult);
}
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetDataHashByTagName
# NAME
# GetDataHashByTagName
# FUNCTION
#
# Use the root, get the list sub tags
# Read the value of each tag.
#
# INPUTS
# * xmlNode -- xml node.
# * xmlTagName -- tagname.
#
#
# OUTPUT
# Nothing.
#
# RETURN VALUE
# An array;
# Each entry in the array is a hash of the values.
# The data value of the node is stored in the hash under " "
# Since space can't be used as Attribute names.
#
# NOTES
#
# EXAMPLE
# See utGetDataHashByTagName.001
#
# my @arAnswer=GetDataHashByTagName($xmlTreeRoot,"UrlLink");
# foreach my $aohDate (@arAnswer) {
# print FOOTER_MAS " <a href=\"" . $aohDate->{" "} . "\">" . $aohDate->{"Name"} . "</a> |\n";
# } # endforeach.
# TODO
# Store the DataKey in a global shared var.
# SOURCE
sub GetDataHashByTagName {
# If there isn't two parameters barf.
if ( $#_ != 1 ) {
die "GetDataHashByTagName(): wrong parameter number params($#_), need at least xmlNode and TagName ", __FILE__, " line ", __LINE__, "\n";
}
my $xmlNode=shift;
my $xmlTagName=shift;
# Barf if the node isn't defined.
if ( ( ! defined($xmlNode) ) || ( $xmlNode == 0 ) ) {
die "GetDataHashByTagName(): zero pointer or undefined pointer for ($xmlTagName) ", __FILE__, " line ", __LINE__, "\n";
}
my @arReturnList;
# Get the list of subnodes identified by tagname.
my @arNodeList = $xmlNode->getElementsByTagName($xmlTagName);
# Go through each of the nodes found, extract the data from them.
foreach my $szNode (@arNodeList) {
# Initialize the hash for the data.
my $hDataAndAttributes={};
# Three spaces are the data key.
$hDataAndAttributes->{" "} = $szNode->string_value();
# Get list of all attributes for the current node.
my @arAttributeList=$szNode->attributes();
# Itterate through the attribute, get the key and value.
foreach my $szAttr (@arAttributeList) {
# get the value.
my $szValue=$szAttr->getValue();
# get the name of attribute(key).
my $szKey=$szAttr->nodeName();
# Store key and value in the hash.
$hDataAndAttributes->{$szKey} = $szNode->getAttribute($szKey);
} # end foreach key.
# Store the hash in the array.
push(@arReturnList, $hDataAndAttributes);
} #end foreach.
# print "Result: "; print $arReturnList[1]{"Name"}; print "\n";
return(@arReturnList);
} # end getdatahashbytagname
#****
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetDataHashByTagNameAndAttribute
# NAME
# GetDataHashByTagNameAndAttribute
# FUNCTION
#
# Use the root, get the list sub tags
# Read the value of each tag.
#
# INPUTS
# * xmlNode -- xml node.
# * xmlTagName -- tagname.
# * szAttributeName -- Attribute name to look for.
# * szAttributeContent -- Value in attribute to look for.
#
#
# OUTPUT
# Nothing.
#
# RETURN VALUE
# An array;
# Each entry in the array is a hash of the values.
# The data value of the node is stored in the hash under " "
# Since space can't be used as Attribute names.
#
# NOTES
#
# EXAMPLE
# See utGetDataHashByTagNameAndAttribute.001
#
# my @arAnswer=GetDataHashByTagNameAndTag($xmlTreeRoot,"UrlLink");
# foreach my $aohDate (@arAnswer) {
# print FOOTER_MAS " <a href=\"" . $aohDate->{" "} . "\">" . $aohDate->{"Name"} . "</a> |\n";
# } # endforeach.
# TODO
# Store the DataKey in a global shared var.
# SOURCE
sub GetDataHashByTagNameAndAttribute {
# If there isn't two parameters barf.
if ( $#_ != 3 ) {
die "GetDataHashByTagNameAndAttribute(): wrong parameter number params($#_), need at least xmlNode and TagName ", __FILE__, " line ", __LINE__, "\n";
}
my $xmlNode=shift;
my $xmlTagName=shift;
my $szAttributeName=shift;
my $szAttributeContent=shift;
# Barf if the node isn't defined.
if ( ( ! defined($xmlNode) ) || ( $xmlNode == 0 ) ) {
die "GetDataHashByTagNameAndAttribute(): zero pointer or undefined pointer for ($xmlTagName) ", __FILE__, " line ", __LINE__, "\n";
}
my @arReturnList;
# Get the list of subnodes identified by tagname.
my @arNodeList = $xmlNode->getElementsByTagName($xmlTagName);
# Go through each of the nodes found, extract the data from them.
foreach my $szNode (@arNodeList) {
if ( $szNode->hasAttribute($szAttributeName) ) {
if ( $szNode->getAttribute($szAttributeName) eq $szAttributeContent ) {
# Initialize the hash for the data.
my $hDataAndAttributes={};
# Three spaces are the data key.
$hDataAndAttributes->{" "} = $szNode->string_value();
# Get list of all attributes for the current node.
my @arAttributeList=$szNode->attributes();
# Itterate through the attribute, get the key and value.
foreach my $szAttr (@arAttributeList) {
# get the value.
my $szValue=$szAttr->getValue();
# get the name of attribute(key).
my $szKey=$szAttr->nodeName();
# Store key and value in the hash.
$hDataAndAttributes->{$szKey} = $szNode->getAttribute($szKey);
} # end foreach key.
# Store the hash in the array.
push(@arReturnList, $hDataAndAttributes);
} # endif attr correct content
} # endif has attr.
} #end foreach.
# print "Result: "; print $arReturnList[1]{"Name"}; print "\n";
return(@arReturnList);
} # end getdatahashbytagnameandattribute
#****
# ----------------------------------------------------------------------------
#****f* Xml.pm/GetChildDataBySingleTagName
# NAME
#
# FUNCTION
#
# only return the first value in a posible list of values.
# doesn't handle if the tagname does not exist.
#
#
# INPUTS
# * xmlNode -- XML Node.
# * xmlTagName -- Tag Name.
#
# OUTPUT
#
#
# RETURN VALUE
#
# Text context of node with tag name.
#
# NOTES
#
#
#
# SOURCE
sub GetChildDataBySingleTagName {
my $xmlNode=$_[0];
my $xmlTagName=$_[1];
my $szAnswer;
if ( ( ! defined($xmlNode) ) || ( $xmlNode == 0 ) ) {
confess "GetChildDataBySingleTagName(): zero pointer or undefined pointer for ($xmlTagName) ", __FILE__, " line ", __LINE__, "\n";
}
# Read the Files list
my @arElementList = $xmlNode->getElementsByTagName($xmlTagName);
# confess "GetChildDataBySingleTagName(): returned empty childlist for \n";
if ( $#arElementList > -1 ) {
$szAnswer = $arElementList[0]->string_value();
} # endif.
return($szAnswer);
} # end getchilddatabytagname.
#****
1;
| hpepper/idea-to-product | My/Xml.pm | Perl | apache-2.0 | 21,938 |
#
# Copyright 2016 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 apps::protocols::ntp::mode::offset;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use Net::NTP;
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 =>
{
"ntp-host:s" => { name => 'ntp_host' },
"port:s" => { name => 'port', default => 123 },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => 30 },
});
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();
}
if (!defined($self->{option_results}->{ntp_host})) {
$self->{output}->add_option_msg(short_msg => "Please set the ntp-host option");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my %ntp;
eval {
$Net::NTP::TIMEOUT = $self->{option_results}->{timeout};
%ntp = get_ntp_response($self->{option_results}->{ntp_host}, $self->{option_results}->{port});
};
if ($@) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => "Couldn't connect to ntp server: " . $@);
$self->{output}->display();
$self->{output}->exit();
}
my $localtime = time();
my $offset = (($ntp{'Receive Timestamp'} - $ntp{'Originate Timestamp'}) + ($ntp{'Transmit Timestamp'} - $localtime)) / 2;
my $exit = $self->{perfdata}->threshold_check(value => $offset,
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Offset: %.3fs", $offset));
$self->{output}->output_add(long_msg => sprintf("Host has an offset of %.5fs with its time server reference %s", $offset, $self->{option_results}->{ntp_host}));
$self->{output}->perfdata_add(label => "time", unit => 's',
value => sprintf('%.3f', $offset),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check Ntp server response.
=over 8
=item B<--ntp-host>
Ntp server address or FQDN
=item B<--port>
Port used (Default: 123)
=item B<--timeout>
Threshold for NTP timeout
=item B<--warning>
Threshold warning in seconds
=item B<--critical>
Threshold critical in seconds (e.g @10:10 means CRITICAL if offset is not between -10 and +10 seconds)
=back
=cut
| bcournaud/centreon-plugins | apps/protocols/ntp/mode/offset.pm | Perl | apache-2.0 | 4,294 |
sub bind_hash
{
my ($dbh, $hash_ref, $table, @fields) = @_;
my $sql = 'SELECT ' . join(', ', @fields) . " FROM $table";
my $sth = $dbh->prepare( $sql );
$sth->execute();
$sth->bind_columns( \@$hash_ref{ @{ $sth->{NAME_lc} } } );
return sub { $sth->fetch() };
} | jmcveigh/komodo-tools | scripts/perl/bind_database_columns/bind_hash_sub.pl | Perl | bsd-2-clause | 305 |
package CDT7ProjectCreator;
# ************************************************************
# Description : A CDT7 Project Creator (Eclipse 3.6)
# Author : Adam Mitz, Object Computing, Inc.
# Create Date : 10/04/2010
# ************************************************************
# ************************************************************
# Pragmas
# ************************************************************
use strict;
use CDT6ProjectCreator;
use vars qw(@ISA);
@ISA = qw(CDT6ProjectCreator);
# ************************************************************
# Data Section
# ************************************************************
my %config = ('scanner_config_builder_triggers' => 'full,incremental,',
'additional_storage_modules' =>
'org.eclipse.cdt.core.language.mapping ' .
'org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings',
'additional_error_parsers' =>
'org.eclipse.cdt.core.GmakeErrorParser ' .
'org.eclipse.cdt.core.CWDLocator'
);
# ************************************************************
# Subroutine Section
# ************************************************************
sub get_configurable {
my($self, $name) = @_;
return $config{$name};
}
1;
| wfnex/openbras | src/ace/ACE_wrappers/MPC/modules/CDT7ProjectCreator.pm | Perl | bsd-3-clause | 1,313 |
#! /usr/bin/perl -w
#
# Copyright (c) 2013, Carnegie Mellon University.
# 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.
# 3. Neither the name of the University 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
# HOLDERS 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.
#
##
# Counts the number of requests in the input file
##
my $old_seperator = $/;
$/ = '}';
my $count = 0;
while (<STDIN>) {
$count++;
}
my $num_req = $count -1;
print "There are $num_req requests in this trace\n";
| RS1999ent/spectroscope | source/pipe/get_num_reqs.pl | Perl | bsd-3-clause | 1,806 |
package App::Netdisco::DB::Result::Virtual::NodesDiscovered;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('nodes_discovered');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<ENDSQL
SELECT d.ip,
d.dns,
d.name,
p.port,
p.remote_ip,
p.remote_port,
p.remote_type,
p.remote_id
FROM device_port p,
device d
WHERE d.ip = p.ip
AND NOT EXISTS
(SELECT 1
FROM device_port q
WHERE q.ip = p.remote_ip
AND q.port = p.remote_port)
AND NOT EXISTS
(SELECT 1
FROM device_ip a,
device_port q
WHERE a.alias = p.remote_ip
AND q.ip = a.ip
AND q.port = p.remote_port)
AND (p.remote_id IS NOT NULL OR p.remote_type IS NOT NULL)
ORDER BY d.name, p.port
ENDSQL
);
__PACKAGE__->add_columns(
'ip' => {
data_type => 'inet',
},
'dns' => {
data_type => 'text',
},
'name' => {
data_type => 'text',
},
'port' => {
data_type => 'text',
},
'remote_ip' => {
data_type => 'inet',
},
'remote_port' => {
data_type => 'text',
},
'remote_type' => {
data_type => 'text',
},
'remote_id' => {
data_type => 'text',
},
);
1;
| netdisco/netdisco | lib/App/Netdisco/DB/Result/Virtual/NodesDiscovered.pm | Perl | bsd-3-clause | 1,321 |
###########################################################################
#
# This file is partially auto-generated by the DateTime::Locale generator
# tools (v0.10). This code generator comes with the DateTime::Locale
# distribution in the tools/ directory, and is called generate-modules.
#
# This file was generated from the CLDR JSON locale data. See the LICENSE.cldr
# file included in this distribution for license details.
#
# Do not edit this file directly unless you are sure the part you are editing
# is not created by the generator.
#
###########################################################################
=pod
=encoding UTF-8
=head1 NAME
DateTime::Locale::fr_CD - Locale data examples for the fr-CD locale.
=head1 DESCRIPTION
This pod file contains examples of the locale data available for the
French Congo - Kinshasa locale.
=head2 Days
=head3 Wide (format)
lundi
mardi
mercredi
jeudi
vendredi
samedi
dimanche
=head3 Abbreviated (format)
lun.
mar.
mer.
jeu.
ven.
sam.
dim.
=head3 Narrow (format)
L
M
M
J
V
S
D
=head3 Wide (stand-alone)
lundi
mardi
mercredi
jeudi
vendredi
samedi
dimanche
=head3 Abbreviated (stand-alone)
lun.
mar.
mer.
jeu.
ven.
sam.
dim.
=head3 Narrow (stand-alone)
L
M
M
J
V
S
D
=head2 Months
=head3 Wide (format)
janvier
février
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
décembre
=head3 Abbreviated (format)
janv.
févr.
mars
avr.
mai
juin
juil.
août
sept.
oct.
nov.
déc.
=head3 Narrow (format)
J
F
M
A
M
J
J
A
S
O
N
D
=head3 Wide (stand-alone)
janvier
février
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
décembre
=head3 Abbreviated (stand-alone)
janv.
févr.
mars
avr.
mai
juin
juil.
août
sept.
oct.
nov.
déc.
=head3 Narrow (stand-alone)
J
F
M
A
M
J
J
A
S
O
N
D
=head2 Quarters
=head3 Wide (format)
1er trimestre
2e trimestre
3e trimestre
4e trimestre
=head3 Abbreviated (format)
T1
T2
T3
T4
=head3 Narrow (format)
1
2
3
4
=head3 Wide (stand-alone)
1er trimestre
2e trimestre
3e trimestre
4e trimestre
=head3 Abbreviated (stand-alone)
T1
T2
T3
T4
=head3 Narrow (stand-alone)
1
2
3
4
=head2 Eras
=head3 Wide (format)
avant Jésus-Christ
après Jésus-Christ
=head3 Abbreviated (format)
av. J.-C.
ap. J.-C.
=head3 Narrow (format)
av. J.-C.
ap. J.-C.
=head2 Date Formats
=head3 Full
2008-02-05T18:30:30 = mardi 5 février 2008
1995-12-22T09:05:02 = vendredi 22 décembre 1995
-0010-09-15T04:44:23 = samedi 15 septembre -10
=head3 Long
2008-02-05T18:30:30 = 5 février 2008
1995-12-22T09:05:02 = 22 décembre 1995
-0010-09-15T04:44:23 = 15 septembre -10
=head3 Medium
2008-02-05T18:30:30 = 5 févr. 2008
1995-12-22T09:05:02 = 22 déc. 1995
-0010-09-15T04:44:23 = 15 sept. -10
=head3 Short
2008-02-05T18:30:30 = 05/02/2008
1995-12-22T09:05:02 = 22/12/1995
-0010-09-15T04:44:23 = 15/09/-10
=head2 Time Formats
=head3 Full
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head3 Short
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 09:05
-0010-09-15T04:44:23 = 04:44
=head2 Datetime Formats
=head3 Full
2008-02-05T18:30:30 = mardi 5 février 2008 à 18:30:30 UTC
1995-12-22T09:05:02 = vendredi 22 décembre 1995 à 09:05:02 UTC
-0010-09-15T04:44:23 = samedi 15 septembre -10 à 04:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 5 février 2008 à 18:30:30 UTC
1995-12-22T09:05:02 = 22 décembre 1995 à 09:05:02 UTC
-0010-09-15T04:44:23 = 15 septembre -10 à 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 5 févr. 2008 à 18:30:30
1995-12-22T09:05:02 = 22 déc. 1995 à 09:05:02
-0010-09-15T04:44:23 = 15 sept. -10 à 04:44:23
=head3 Short
2008-02-05T18:30:30 = 05/02/2008 18:30
1995-12-22T09:05:02 = 22/12/1995 09:05
-0010-09-15T04:44:23 = 15/09/-10 04:44
=head2 Available Formats
=head3 E (E)
2008-02-05T18:30:30 = mar.
1995-12-22T09:05:02 = ven.
-0010-09-15T04:44:23 = sam.
=head3 EHm (E HH:mm)
2008-02-05T18:30:30 = mar. 18:30
1995-12-22T09:05:02 = ven. 09:05
-0010-09-15T04:44:23 = sam. 04:44
=head3 EHms (E HH:mm:ss)
2008-02-05T18:30:30 = mar. 18:30:30
1995-12-22T09:05:02 = ven. 09:05:02
-0010-09-15T04:44:23 = sam. 04:44:23
=head3 Ed (E d)
2008-02-05T18:30:30 = mar. 5
1995-12-22T09:05:02 = ven. 22
-0010-09-15T04:44:23 = sam. 15
=head3 Ehm (E h:mm a)
2008-02-05T18:30:30 = mar. 6:30 PM
1995-12-22T09:05:02 = ven. 9:05 AM
-0010-09-15T04:44:23 = sam. 4:44 AM
=head3 Ehms (E h:mm:ss a)
2008-02-05T18:30:30 = mar. 6:30:30 PM
1995-12-22T09:05:02 = ven. 9:05:02 AM
-0010-09-15T04:44:23 = sam. 4:44:23 AM
=head3 Gy (y G)
2008-02-05T18:30:30 = 2008 ap. J.-C.
1995-12-22T09:05:02 = 1995 ap. J.-C.
-0010-09-15T04:44:23 = -10 av. J.-C.
=head3 GyMMM (MMM y G)
2008-02-05T18:30:30 = févr. 2008 ap. J.-C.
1995-12-22T09:05:02 = déc. 1995 ap. J.-C.
-0010-09-15T04:44:23 = sept. -10 av. J.-C.
=head3 GyMMMEd (E d MMM y G)
2008-02-05T18:30:30 = mar. 5 févr. 2008 ap. J.-C.
1995-12-22T09:05:02 = ven. 22 déc. 1995 ap. J.-C.
-0010-09-15T04:44:23 = sam. 15 sept. -10 av. J.-C.
=head3 GyMMMd (d MMM y G)
2008-02-05T18:30:30 = 5 févr. 2008 ap. J.-C.
1995-12-22T09:05:02 = 22 déc. 1995 ap. J.-C.
-0010-09-15T04:44:23 = 15 sept. -10 av. J.-C.
=head3 H (HH 'h')
2008-02-05T18:30:30 = 18 h
1995-12-22T09:05:02 = 09 h
-0010-09-15T04:44:23 = 04 h
=head3 Hm (HH:mm)
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 09:05
-0010-09-15T04:44:23 = 04:44
=head3 Hms (HH:mm:ss)
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head3 Hmsv (HH:mm:ss v)
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Hmv (HH:mm v)
2008-02-05T18:30:30 = 18:30 UTC
1995-12-22T09:05:02 = 09:05 UTC
-0010-09-15T04:44:23 = 04:44 UTC
=head3 M (L)
2008-02-05T18:30:30 = 2
1995-12-22T09:05:02 = 12
-0010-09-15T04:44:23 = 9
=head3 MEd (E dd/MM)
2008-02-05T18:30:30 = mar. 05/02
1995-12-22T09:05:02 = ven. 22/12
-0010-09-15T04:44:23 = sam. 15/09
=head3 MMM (LLL)
2008-02-05T18:30:30 = févr.
1995-12-22T09:05:02 = déc.
-0010-09-15T04:44:23 = sept.
=head3 MMMEd (E d MMM)
2008-02-05T18:30:30 = mar. 5 févr.
1995-12-22T09:05:02 = ven. 22 déc.
-0010-09-15T04:44:23 = sam. 15 sept.
=head3 MMMMd (d MMMM)
2008-02-05T18:30:30 = 5 février
1995-12-22T09:05:02 = 22 décembre
-0010-09-15T04:44:23 = 15 septembre
=head3 MMMd (d MMM)
2008-02-05T18:30:30 = 5 févr.
1995-12-22T09:05:02 = 22 déc.
-0010-09-15T04:44:23 = 15 sept.
=head3 Md (dd/MM)
2008-02-05T18:30:30 = 05/02
1995-12-22T09:05:02 = 22/12
-0010-09-15T04:44:23 = 15/09
=head3 d (d)
2008-02-05T18:30:30 = 5
1995-12-22T09:05:02 = 22
-0010-09-15T04:44:23 = 15
=head3 h (h a)
2008-02-05T18:30:30 = 6 PM
1995-12-22T09:05:02 = 9 AM
-0010-09-15T04:44:23 = 4 AM
=head3 hm (h:mm a)
2008-02-05T18:30:30 = 6:30 PM
1995-12-22T09:05:02 = 9:05 AM
-0010-09-15T04:44:23 = 4:44 AM
=head3 hms (h:mm:ss a)
2008-02-05T18:30:30 = 6:30:30 PM
1995-12-22T09:05:02 = 9:05:02 AM
-0010-09-15T04:44:23 = 4:44:23 AM
=head3 hmsv (h:mm:ss a v)
2008-02-05T18:30:30 = 6:30:30 PM UTC
1995-12-22T09:05:02 = 9:05:02 AM UTC
-0010-09-15T04:44:23 = 4:44:23 AM UTC
=head3 hmv (h:mm a v)
2008-02-05T18:30:30 = 6:30 PM UTC
1995-12-22T09:05:02 = 9:05 AM UTC
-0010-09-15T04:44:23 = 4:44 AM UTC
=head3 ms (mm:ss)
2008-02-05T18:30:30 = 30:30
1995-12-22T09:05:02 = 05:02
-0010-09-15T04:44:23 = 44:23
=head3 y (y)
2008-02-05T18:30:30 = 2008
1995-12-22T09:05:02 = 1995
-0010-09-15T04:44:23 = -10
=head3 yM (MM/y)
2008-02-05T18:30:30 = 02/2008
1995-12-22T09:05:02 = 12/1995
-0010-09-15T04:44:23 = 09/-10
=head3 yMEd (E dd/MM/y)
2008-02-05T18:30:30 = mar. 05/02/2008
1995-12-22T09:05:02 = ven. 22/12/1995
-0010-09-15T04:44:23 = sam. 15/09/-10
=head3 yMMM (MMM y)
2008-02-05T18:30:30 = févr. 2008
1995-12-22T09:05:02 = déc. 1995
-0010-09-15T04:44:23 = sept. -10
=head3 yMMMEd (E d MMM y)
2008-02-05T18:30:30 = mar. 5 févr. 2008
1995-12-22T09:05:02 = ven. 22 déc. 1995
-0010-09-15T04:44:23 = sam. 15 sept. -10
=head3 yMMMM (MMMM y)
2008-02-05T18:30:30 = février 2008
1995-12-22T09:05:02 = décembre 1995
-0010-09-15T04:44:23 = septembre -10
=head3 yMMMd (d MMM y)
2008-02-05T18:30:30 = 5 févr. 2008
1995-12-22T09:05:02 = 22 déc. 1995
-0010-09-15T04:44:23 = 15 sept. -10
=head3 yMd (dd/MM/y)
2008-02-05T18:30:30 = 05/02/2008
1995-12-22T09:05:02 = 22/12/1995
-0010-09-15T04:44:23 = 15/09/-10
=head3 yQQQ (QQQ y)
2008-02-05T18:30:30 = T1 2008
1995-12-22T09:05:02 = T4 1995
-0010-09-15T04:44:23 = T3 -10
=head3 yQQQQ (QQQQ y)
2008-02-05T18:30:30 = 1er trimestre 2008
1995-12-22T09:05:02 = 4e trimestre 1995
-0010-09-15T04:44:23 = 3e trimestre -10
=head2 Miscellaneous
=head3 Prefers 24 hour time?
Yes
=head3 Local first day of the week
1 (lundi)
=head1 SUPPORT
See L<DateTime::Locale>.
=cut
| jkb78/extrajnm | local/lib/perl5/DateTime/Locale/fr_CD.pod | Perl | mit | 9,695 |
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by lib/unicore/mktables from the Unicode
# database, Version 6.2.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.
return <<'END';
10300 1031E
10320 10323
END
| Bjay1435/capstone | rootfs/usr/share/perl/5.18.2/unicore/lib/Sc/Ital.pl | Perl | mit | 447 |
#!/usr/bin/perl
# Copyright (c) 2011 Erik Aronesty (erik@q32.com)
#
# 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
# 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 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ALSO, IT WOULD BE NICE IF YOU LET ME KNOW YOU USED IT.
use Data::Dumper;
use Getopt::Long;
my $extended;
GetOptions("x"=>\$extended);
$in = shift @ARGV;
my $in_cmd =($in =~ /\.gz$/ ? "gunzip -c $in|" : $in =~ /\.zip$/ ? "unzip -p $in|" : "$in") || die "Can't open $in: $!\n";
open IN, $in_cmd;
while (<IN>) {
$gff = 2 if /^##gff-version 2/;
$gff = 3 if /^##gff-version 3/;
next if /^#/ && $gff;
s/\s+$//;
# 0-chr 1-src 2-feat 3-beg 4-end 5-scor 6-dir 7-fram 8-attr
my @f = split /\t/;
if ($gff) {
# most ver 2's stick gene names in the id field
($id) = $f[8]=~ /\bID="([^"]+)"/;
# most ver 3's stick unquoted names in the name field
($id) = $f[8]=~ /\bName=([^";]+)/ if !$id && $gff == 3;
} else {
($id) = $f[8]=~ /transcript_id "([^"]+)"/;
}
next unless $id && $f[0];
if ($f[2] eq 'exon') {
die "no position at exon on line $." if ! $f[3];
# gff3 puts :\d in exons sometimes
$id =~ s/:\d+$// if $gff == 3;
push @{$exons{$id}}, \@f;
# save lowest start
$trans{$id} = \@f if !$trans{$id};
} elsif ($f[2] eq 'start_codon') {
#optional, output codon start/stop as "thick" region in bed
$sc{$id}->[0] = $f[3];
} elsif ($f[2] eq 'stop_codon') {
$sc{$id}->[1] = $f[4];
} elsif ($f[2] eq 'miRNA' ) {
$trans{$id} = \@f if !$trans{$id};
push @{$exons{$id}}, \@f;
}
}
for $id (
# sort by chr then pos
sort {
$trans{$a}->[0] eq $trans{$b}->[0] ?
$trans{$a}->[3] <=> $trans{$b}->[3] :
$trans{$a}->[0] cmp $trans{$b}->[0]
} (keys(%trans)) ) {
my ($chr, undef, undef, undef, undef, undef, $dir, undef, $attr, undef, $cds, $cde) = @{$trans{$id}};
my ($cds, $cde);
($cds, $cde) = @{$sc{$id}} if $sc{$id};
# sort by pos
my @ex = sort {
$a->[3] <=> $b->[3]
} @{$exons{$id}};
my $beg = $ex[0][3];
my $end = $ex[-1][4];
if ($dir eq '-') {
# swap
$tmp=$cds;
$cds=$cde;
$cde=$tmp;
$cds -= 2 if $cds;
$cde += 2 if $cde;
}
# not specified, just use exons
$cds = $beg if !$cds;
$cde = $end if !$cde;
# adjust start for bed
--$beg; --$cds;
my $exn = @ex; # exon count
my $exst = join ",", map {$_->[3]-$beg-1} @ex; # exon start
my $exsz = join ",", map {$_->[4]-$_->[3]+1} @ex; # exon size
my $gene_id;
my $extend = "";
if ($extended) {
($gene_id) = $attr =~ /gene_name "([^"]+)"/;
($gene_id) = $attr =~ /gene_id "([^"]+)"/ unless $gene_id;
$extend="\t$gene_id";
}
# added an extra comma to make it look exactly like ucsc's beds
print "$chr\t$beg\t$end\t$id\t0\t$dir\t$cds\t$cde\t0\t$exn\t$exsz,\t$exst,$extend\n";
}
close IN;
| Naoto-Imamachi/NGS_data_analysis_pipeline | utils/gtf2bed.pl | Perl | mit | 3,788 |
# 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 /tmp/rnClxBLdxJ/africa. Olson data version 2013a
#
# Do not edit this file directly.
#
package DateTime::TimeZone::Africa::Banjul;
{
$DateTime::TimeZone::Africa::Banjul::VERSION = '1.57';
}
use strict;
use Class::Singleton 1.03;
use DateTime::TimeZone;
use DateTime::TimeZone::OlsonDB;
@DateTime::TimeZone::Africa::Banjul::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' );
my $spans =
[
[
DateTime::TimeZone::NEG_INFINITY, # utc_start
60305303196, # utc_end 1912-01-01 01:06:36 (Mon)
DateTime::TimeZone::NEG_INFINITY, # local_start
60305299200, # local_end 1912-01-01 00:00:00 (Mon)
-3996,
0,
'LMT',
],
[
60305303196, # utc_start 1912-01-01 01:06:36 (Mon)
61031149596, # utc_end 1935-01-01 01:06:36 (Tue)
60305299200, # local_start 1912-01-01 00:00:00 (Mon)
61031145600, # local_end 1935-01-01 00:00:00 (Tue)
-3996,
0,
'BMT',
],
[
61031149596, # utc_start 1935-01-01 01:06:36 (Tue)
61946298000, # utc_end 1964-01-01 01:00:00 (Wed)
61031145996, # local_start 1935-01-01 00:06:36 (Tue)
61946294400, # local_end 1964-01-01 00:00:00 (Wed)
-3600,
0,
'WAT',
],
[
61946298000, # utc_start 1964-01-01 01:00:00 (Wed)
DateTime::TimeZone::INFINITY, # utc_end
61946298000, # local_start 1964-01-01 01:00:00 (Wed)
DateTime::TimeZone::INFINITY, # local_end
0,
0,
'GMT',
],
];
sub olson_version { '2013a' }
sub has_dst_changes { 0 }
sub _max_year { 2023 }
sub _new_instance
{
return shift->_init( @_, spans => $spans );
}
1;
| Dokaponteam/ITF_Project | xampp/perl/vendor/lib/DateTime/TimeZone/Africa/Banjul.pm | Perl | mit | 1,722 |
# ftp-monitor.pl
# Monitor a remote FTP server by doing a test download
sub get_ftp_status
{
local $up = 0;
local $st = time();
local $error;
local $temp = &transname();
eval {
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
alarm($_[0]->{'alarm'} ? $_[0]->{'alarm'} : 10);
if ($_[0]->{'tls'}) {
# Connect using TLS-capable perl module
eval "use Net::FTPSSL";
my $ftps;
eval { $ftps = Net::FTPSSL->new($_[0]->{'host'},
Port => $_[0]->{'port'} || 21) };
if ($@) {
$error = &text('ftp_econn2', &html_escape($@));
return 0;
}
elsif (!$ftps) {
$error = $text{'ftp_econn'};
return 0;
}
# Login with username and password, or anonymous
my $ok;
if ($_[0]->{'user'}) {
$ok = $ftps->login($_[0]->{'user'}, $_[0]->{'pass'});
}
else {
$ok = $ftps->login("anonymous",
"root\@".&get_system_hostname());
}
if (!$ok) {
$error = &text('ftp_elogin', $ftps->last_message);
return 0;
}
# Get the file
if ($_[0]->{'file'}) {
$ok = $ftps->get($_[0]->{'file'}, $temp);
if (!$ok) {
$error = &text('ftp_etlsfile',
$ftps->last_message);
return 0;
}
}
$ftps->quit();
}
else {
# Use Webmin's built in FTP code
&ftp_download($_[0]->{'host'}, $_[0]->{'file'}, $temp, \$error,
undef, $_[0]->{'user'}, $_[0]->{'pass'},
$_[0]->{'port'});
}
alarm(0);
$up = $error ? 0 : 1;
};
if ($@) {
die unless $@ eq "alarm\n"; # propagate unexpected errors
return { 'up' => 0 };
}
else {
return { 'up' => $up, 'time' => time() - $st,
'desc' => $up ? undef : $error };
}
}
sub show_ftp_dialog
{
print &ui_table_row($text{'ftp_host'},
&ui_textbox("host", $_[0]->{'host'}, 30));
print &ui_table_row($text{'ftp_port'},
&ui_textbox("port", $_[0]->{'port'} || 21, 5));
print &ui_table_row($text{'ftp_user'},
&ui_opt_textbox("ftpuser", $_[0]->{'user'}, 15, $text{'ftp_anon'}));
print &ui_table_row($text{'ftp_pass'},
&ui_password("ftppass", $_[0]->{'pass'}, 15));
print &ui_table_row($text{'ftp_file'},
&ui_opt_textbox("file", $_[0]->{'file'}, 50, $text{'ftp_none'}), 3);
print &ui_table_row($text{'http_alarm'},
&ui_opt_textbox("alarm", $_[0]->{'alarm'}, 5, $text{'default'}));
print &ui_table_row($text{'ftp_tls'},
&ui_yesno_radio("tls", $_[0]->{'tls'}));
}
sub parse_ftp_dialog
{
$in{'host'} =~ /^[a-z0-9\.\-\_]+$/i || &error($text{'ftp_ehost'});
$_[0]->{'host'} = $in{'host'};
$in{'port'} =~ /^\d+$/i || &error($text{'ftp_eport'});
$_[0]->{'port'} = $in{'port'};
$in{'ftpuser_def'} || $in{'ftpuser'} =~ /^\S+$/ || &error($text{'ftp_euser'});
$_[0]->{'user'} = $in{'ftpuser_def'} ? undef : $in{'ftpuser'};
$_[0]->{'pass'} = $in{'ftppass'};
$in{'file_def'} || $in{'file'} =~ /^\S+$/ || &error($text{'ftp_efile'});
$_[0]->{'file'} = $in{'file_def'} ? undef : $in{'file'};
if ($in{'alarm_def'}) {
delete($_[0]->{'alarm'});
}
else {
$in{'alarm'} =~ /^\d+$/ || &error($text{'http_ealarm'});
$_[0]->{'alarm'} = $in{'alarm'};
}
$_[0]->{'tls'} = $in{'tls'};
if ($in{'tls'}) {
eval "use Net::FTPSSL";
if ($@) {
&error(&text('ftp_etls', '<tt>Net::FTPSSL</tt>'));
}
}
}
| HasClass0/webmin | status/ftp-monitor.pl | Perl | bsd-3-clause | 3,121 |
#! /usr/bin/env perl
# Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (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
# https://www.openssl.org/source/license.html
$L="edi";
$R="esi";
sub DES_encrypt3
{
local($name,$enc)=@_;
&function_begin_B($name,"");
&push("ebx");
&mov("ebx",&wparam(0));
&push("ebp");
&push("esi");
&push("edi");
&comment("");
&comment("Load the data words");
&mov($L,&DWP(0,"ebx","",0));
&mov($R,&DWP(4,"ebx","",0));
&stack_push(3);
&comment("");
&comment("IP");
&IP_new($L,$R,"edx",0);
# put them back
if ($enc)
{
&mov(&DWP(4,"ebx","",0),$R);
&mov("eax",&wparam(1));
&mov(&DWP(0,"ebx","",0),"edx");
&mov("edi",&wparam(2));
&mov("esi",&wparam(3));
}
else
{
&mov(&DWP(4,"ebx","",0),$R);
&mov("esi",&wparam(1));
&mov(&DWP(0,"ebx","",0),"edx");
&mov("edi",&wparam(2));
&mov("eax",&wparam(3));
}
&mov(&swtmp(2), (DWC(($enc)?"1":"0")));
&mov(&swtmp(1), "eax");
&mov(&swtmp(0), "ebx");
&call("DES_encrypt2");
&mov(&swtmp(2), (DWC(($enc)?"0":"1")));
&mov(&swtmp(1), "edi");
&mov(&swtmp(0), "ebx");
&call("DES_encrypt2");
&mov(&swtmp(2), (DWC(($enc)?"1":"0")));
&mov(&swtmp(1), "esi");
&mov(&swtmp(0), "ebx");
&call("DES_encrypt2");
&stack_pop(3);
&mov($L,&DWP(0,"ebx","",0));
&mov($R,&DWP(4,"ebx","",0));
&comment("");
&comment("FP");
&FP_new($L,$R,"eax",0);
&mov(&DWP(0,"ebx","",0),"eax");
&mov(&DWP(4,"ebx","",0),$R);
&pop("edi");
&pop("esi");
&pop("ebp");
&pop("ebx");
&ret();
&function_end_B($name);
}
| openweave/openweave-core | third_party/openssl/openssl/crypto/des/asm/desboth.pl | Perl | apache-2.0 | 1,695 |
package DDG::Goodie::HTMLEntitiesDecode;
# ABSTRACT: Decode HTML Entities.
# HTML Entity Encoding has been moved to a separate module
use strict;
use DDG::Goodie;
use HTML::Entities 'decode_entities';
use Unicode::UCD 'charinfo';
use Text::Trim;
use warnings;
use strict;
zci answer_type => 'html_entity';
zci is_cached => 1;
triggers any => 'html', 'entity', 'htmldecode', 'decodehtml', 'htmlentity';
primary_example_queries 'html decode !', 'html decode &';
secondary_example_queries 'html entity !' , '#36 decode html', 'what is the decoded html entity of $';
description 'Decode HTML entities';
name 'HTMLEntitiesDecode';
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/HTMLEntitiesDecode.pm';
category 'computing_tools';
topics 'programming';
attribution twitter => ['crazedpsyc','crazedpsyc'],
cpan => ['CRZEDPSYC','crazedpsyc'],
twitter => ['https://twitter.com/nshanmugham', 'Nishanth Shanmugham'],
web => ['http://nishanths.github.io', 'Nishanth Shanmugham'],
github => ['https://github.com/nishanths', 'Nishanth Shanmugham'];
handle remainder => sub {
$_ = trim $_; # remove front and back whitespace
$_ =~ s/(\bwhat\s*is\s*(the)?)//ig; # remove "what is the" (optional: the)
$_ =~ s/\b(the|for|of|is|entity|decode|decoded|code|character)\b//ig; # remove filler words
$_ = trim $_; # remove front and back whitespace that existed in between that may show up after removing the filler words
$_ =~ s/\s*\?$//g; # remove ending question mark
return unless ((/^(&?#(?:[0-9]+(?!_))+;?)$/) || (/^(&(?:[a-zA-Z]+(?!_))+;?)$/) || (/^(&?#[xX](?:[0-9A-Fa-f]+(?!_))+;?)$/)); # decimal (') || text with no underscores (¢) || hex (')
# "&" optional for all
# ";" optional except in text type
# "?" optional: question-like queries
# Standardize the query so it works well with library decoding functions
my $entity = $1;
$entity =~ s/^&?/&/; # append '&' at the front
$entity =~ s/;?$/;/; # append ';' at the back
# Attempt to decode, exit if unsuccessful
my $decoded = decode_entities($entity); # decode_entities() returns the input if unsuccesful
my $decimal = ord($decoded);
my $hex = sprintf("%04x", $decimal);
return if (lc $entity eq lc $decoded); # safety net -- makes trying to decode something not real like "&enchantedbunny;" fail
# If invisible character, provide link instead of displaying it
my $info = charinfo($decimal); # charinfo() returns undef if input is not a "real" character
return unless (defined $info); # another safety net
if ($$info{name} eq '<control>') {
$decoded = "Unicode control character (no visual representation)";
$entity = "<a href='https://en.wikipedia.org/wiki/Unicode_control_characters'>Unicode control character</a> (no visual representation)";
} elsif(substr($$info{category},0,1) eq 'C') {
$decoded = "Special character (no visual representation)";
$entity = "<a href='https://en.wikipedia.org/wiki/Special_characters'>Special character (no visual representation)";
}
# Make answer
return "Decoded HTML Entity: $decoded, Decimal: $decimal, Hexadecimal: $hex",
html => qq(<div class="zci--htmlentitiesdecode"><div class="large"><span class="text--secondary">Decoded HTML Entity: </span><span class="text--primary">$entity</span></div><div class="small"><span class="text--secondary">Decimal: <span class="text--primary">$decimal</span>, Hexadecimal: <span class="text--primary">$hex</span></div></div></div>);
};
1;
| chanizzle/zeroclickinfo-goodies | lib/DDG/Goodie/HTMLEntitiesDecode.pm | Perl | apache-2.0 | 4,160 |
/* Part of SWI-Prolog
Author: R.A. O'Keefe, V.S. Costa, L. Damas, Jan Wielemaker
E-mail: J.Wielemaker@vu.nl
WWW: http://www.swi-prolog.org
Copyright (c) 2011-2016, Universidade do Porto, University of Amsterdam,
VU University Amsterdam.
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(random,
[ random/1, % -Float (0,1)
random_between/3, % +Low, +High, -Random
getrand/1, % -State
setrand/1, % +State
maybe/0,
maybe/1, % +P
maybe/2, % +K, +N
random_perm2/4, % A,B, X,Y
random_member/2, % -Element, +List
random_select/3, % ?Element, +List, -Rest
randseq/3, % +Size, +Max, -Set
randset/3, % +Size, +Max, -List
random_permutation/2, % ?List, ?Permutation
% deprecated interface
random/3 % +Low, +High, -Random
]).
:- autoload(library(apply),[maplist/2]).
:- autoload(library(error),
[must_be/2,domain_error/2,instantiation_error/1]).
:- autoload(library(lists),[nth0/3,nth0/4,append/3]).
:- autoload(library(pairs),[pairs_values/2]).
/** <module> Random numbers
This library is derived from the DEC10 library random. Later, the core
random generator was moved to C. The current version uses the SWI-Prolog
arithmetic functions to realise this library. These functions are based
on the GMP library.
@author R.A. O'Keefe, V.S. Costa, L. Damas, Jan Wielemaker
@see Built-in function random/1: A is random(10)
*/
check_gmp :-
current_arithmetic_function(random_float),
!.
check_gmp :-
print_message(warning, random(no_gmp)).
:- initialization check_gmp.
/*******************************
* PRIMITIVES *
*******************************/
%! random(-R:float) is det.
%
% Binds R to a new random float in the _open_ interval (0.0,1.0).
%
% @see setrand/1, getrand/1 may be used to fetch/set the state.
% @see In SWI-Prolog, random/1 is implemented by the function
% random_float/0.
random(R) :-
R is random_float.
%! random_between(+L:int, +U:int, -R:int) is semidet.
%
% Binds R to a random integer in [L,U] (i.e., including both L and
% U). Fails silently if U<L.
random_between(L, U, R) :-
integer(L), integer(U),
!,
U >= L,
R is L+random((U+1)-L).
random_between(L, U, _) :-
must_be(integer, L),
must_be(integer, U).
%! random(+L:int, +U:int, -R:int) is det.
%! random(+L:float, +U:float, -R:float) is det.
%
% Generate a random integer or float in a range. If L and U are
% both integers, R is a random integer in the half open interval
% [L,U). If L and U are both floats, R is a float in the open
% interval (L,U).
%
% @deprecated Please use random/1 for generating a random float
% and random_between/3 for generating a random integer. Note that
% random_between/3 includes the upper bound, while this
% predicate excludes it.
random(L, U, R) :-
integer(L), integer(U),
!,
R is L+random(U-L).
random(L, U, R) :-
number(L), number(U),
!,
R is L+((U-L)*random_float).
random(L, U, _) :-
must_be(number, L),
must_be(number, U).
/*******************************
* STATE *
*******************************/
%! setrand(+State) is det.
%! getrand(-State) is det.
%
% Query/set the state of the random generator. This is intended
% for restarting the generator at a known state only. The
% predicate setrand/1 accepts an opaque term returned by
% getrand/1. This term may be asserted, written and read. The
% application may not make other assumptions about this term.
%
% For compatibility reasons with older versions of this library,
% setrand/1 also accepts a term rand(A,B,C), where A, B and C are
% integers in the range 1..30,000. This argument is used to seed
% the random generator. Deprecated.
%
% @see set_random/1 and random_property/1 provide the SWI-Prolog
% native implementation.
% @error existence_error(random_state, _) is raised if the
% underlying infrastructure cannot fetch the random state.
% This is currently the case if SWI-Prolog is not compiled
% with the GMP library.
setrand(rand(A,B,C)) :-
!,
Seed is A<<30+B<<15+C,
set_random(seed(Seed)).
setrand(State) :-
set_random(state(State)).
:- if(current_predicate(random_property/1)).
getrand(State) :-
random_property(state(State)).
:- else.
getrand(State) :-
existence_error(random_state, State).
:- endif.
/*******************************
* MAYBE *
*******************************/
%! maybe is semidet.
%
% Succeed/fail with equal probability (variant of maybe/1).
maybe :-
random(2) =:= 0.
%! maybe(+P) is semidet.
%
% Succeed with probability P, fail with probability 1-P
maybe(P) :-
must_be(between(0.0,1.0), P),
random_float < P.
%! maybe(+K, +N) is semidet.
%
% Succeed with probability K/N (variant of maybe/1)
maybe(K, N) :-
integer(K), integer(N),
between(0, N, K),
!,
random(N) < K.
maybe(K, N) :-
must_be(nonneg, K),
must_be(nonneg, N),
domain_error(not_less_than_zero,N-K).
/*******************************
* PERMUTATION *
*******************************/
%! random_perm2(?A, ?B, ?X, ?Y) is semidet.
%
% Does X=A,Y=B or X=B,Y=A with equal probability.
random_perm2(A,B, X,Y) :-
( maybe
-> X = A, Y = B
; X = B, Y = A
).
/*******************************
* SET AND LIST OPERATIONS *
*******************************/
%! random_member(-X, +List:list) is semidet.
%
% X is a random member of List. Equivalent to random_between(1,
% |List|), followed by nth1/3. Fails of List is the empty list.
%
% @compat Quintus and SICStus libraries.
random_member(X, List) :-
must_be(list, List),
length(List, Len),
Len > 0,
N is random(Len),
nth0(N, List, X).
%! random_select(-X, +List, -Rest) is semidet.
%! random_select(+X, -List, +Rest) is det.
%
% Randomly select or insert an element. Either List or Rest must
% be a list. Fails if List is the empty list.
%
% @compat Quintus and SICStus libraries.
random_select(X, List, Rest) :-
( '$skip_list'(Len, List, Tail),
Tail == []
-> true
; '$skip_list'(RLen, Rest, Tail),
Tail == []
-> Len is RLen+1
),
!,
Len > 0,
N is random(Len),
nth0(N, List, X, Rest).
random_select(_, List, Rest) :-
partial_list(List), partial_list(Rest),
instantiation_error(List+Rest).
random_select(_, List, Rest) :-
must_be(list, List),
must_be(list, Rest).
%! randset(+K:int, +N:int, -S:list(int)) is det.
%
% S is a sorted list of K unique random integers in the range 1..N.
% The implementation uses different techniques depending on the ratio
% K/N. For small K/N it generates a set of K random numbers, removes
% the duplicates and adds more numbers until |S| is K. For a large K/N
% it enumerates 1..N and decides randomly to include the number or
% not. For example:
%
% ==
% ?- randset(5, 5, S).
% S = [1, 2, 3, 4, 5]. (always)
% ?- randset(5, 20, S).
% S = [2, 7, 10, 19, 20].
% ==
%
% @see randseq/3.
randset(K, N, S) :-
must_be(nonneg, K),
K =< N,
( K < N//7
-> randsetn(K, N, [], S)
; randset(K, N, [], S)
).
randset(0, _, S, S) :- !.
randset(K, N, Si, So) :-
random(N) < K,
!,
J is K-1,
M is N-1,
randset(J, M, [N|Si], So).
randset(K, N, Si, So) :-
M is N-1,
randset(K, M, Si, So).
randsetn(K, N, Sofar, S) :-
length(Sofar, Len),
( Len =:= K
-> S = Sofar
; Needed is K-Len,
length(New, Needed),
maplist(srand(N), New),
( Sofar == []
-> sort(New, Sorted)
; append(New, Sofar, Sofar2),
sort(Sofar2, Sorted)
),
randsetn(K, N, Sorted, S)
).
srand(N, E) :-
E is random(N)+1.
%! randseq(+K:int, +N:int, -List:list(int)) is det.
%
% S is a list of K unique random integers in the range 1..N. The
% order is random. Defined as
%
% ```
% randseq(K, N, List) :-
% randset(K, N, Set),
% random_permutation(Set, List).
% ```
%
% @see randset/3.
randseq(K, N, Seq) :-
randset(K, N, Set),
random_permutation_(Set, Seq).
%! random_permutation(+List, -Permutation) is det.
%! random_permutation(-List, +Permutation) is det.
%
% Permutation is a random permutation of List. This is intended to
% process the elements of List in random order. The predicate is
% symmetric.
%
% @error instantiation_error, type_error(list, _).
random_permutation(List1, List2) :-
is_list(List1),
!,
random_permutation_(List1, List2).
random_permutation(List1, List2) :-
is_list(List2),
!,
random_permutation_(List2, List1).
random_permutation(List1, List2) :-
partial_list(List1), partial_list(List2),
!,
instantiation_error(List1+List2).
random_permutation(List1, List2) :-
must_be(list, List1),
must_be(list, List2).
random_permutation_(List, RandomPermutation) :-
key_random(List, Keyed),
keysort(Keyed, Sorted),
pairs_values(Sorted, RandomPermutation).
key_random([], []).
key_random([H|T0], [K-H|T]) :-
random(K),
key_random(T0, T).
%! partial_list(@Term) is semidet.
%
% True if Term is a partial list.
partial_list(List) :-
'$skip_list'(_, List, Tail),
var(Tail).
:- multifile
prolog:message//1.
prolog:message(random(no_gmp)) -->
[ 'This version of SWI-Prolog is not compiled with GMP support.'-[], nl,
'Floating point random operations are not supported.'-[]
].
| TeamSPoon/logicmoo_workspace | docker/rootfs/usr/local/lib/swipl/library/random.pl | Perl | mit | 11,682 |
package MIP::File::Path;
use 5.026;
use Carp;
use charnames qw{ :full :short };
use Cwd qw{ abs_path };
use English qw{ -no_match_vars };
use File::Basename qw{ fileparse };
use File::Spec::Functions qw{ splitpath };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use utf8;
use warnings;
use warnings qw{ FATAL utf8 };
## CPANM
use autodie qw{ :all };
## MIPs lib/
use MIP::Constants qw{ $DOT $EMPTY_STR $FORWARD_SLASH $LOG_NAME $SINGLE_QUOTE };
BEGIN {
require Exporter;
use base qw{ Exporter };
# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{
check_allowed_temp_directory
check_filesystem_objects_existance
check_filesystem_objects_and_index_existance
get_absolute_path
get_file_names
get_file_line_by_line
remove_file_path_suffix
};
}
sub check_allowed_temp_directory {
## Function : Check that the temp directory value is allowed
## Returns :
## Arguments: $not_allowed_paths_ref => Not allowed paths for temp dir
## : $temp_directory => Temp directory
my ($arg_href) = @_;
## Flatten argument(s)
my $not_allowed_paths_ref;
my $temp_directory;
my $tmpl = {
not_allowed_paths_ref => {
default => [],
defined => 1,
store => \$not_allowed_paths_ref,
strict_type => 1,
},
temp_directory => {
defined => 1,
required => 1,
store => \$temp_directory,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
## Retrieve logger object
my $log = Log::Log4perl->get_logger($LOG_NAME);
my %is_not_allowed = (
$FORWARD_SLASH . q{scratch} => undef,
$FORWARD_SLASH . q{scratch} . $FORWARD_SLASH => undef,
);
## Add more than already defined paths
map { $is_not_allowed{$_} = undef; } @{$not_allowed_paths_ref};
# Return if value is allowed
return 1 if ( not exists $is_not_allowed{$temp_directory} );
$log->fatal( qq{$SINGLE_QUOTE--temp_directory }
. $temp_directory
. qq{$SINGLE_QUOTE is not allowed because MIP will remove the temp directory after processing.}
);
exit 1;
}
sub check_filesystem_objects_existance {
## Function : Checks if a file or directory file exists
## Returns : (0 | 1, $error_msg)
## Arguments: $object_name => Object to check for existance
## : $object_type => Type of item to check
## : $parameter_name => MIP parameter name {REF}
my ($arg_href) = @_;
## Flatten argument(s)
my $object_name;
my $object_type;
my $parameter_name;
my $tmpl = {
object_name => {
defined => 1,
required => 1,
store => \$object_name,
strict_type => 1,
},
parameter_name => {
defined => 1,
required => 1,
store => \$parameter_name,
strict_type => 1,
},
object_type => {
allow => [qw{ directory file }],
defined => 1,
required => 1,
store => \$object_type,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
use MIP::Validate::Data qw{ %constraint };
my %exists_constraint_map = (
directory => q{dir_exists},
file => q{plain_file_exists},
);
my $constraint = $exists_constraint_map{$object_type};
return 1 if ( $constraint{$constraint}->($object_name) );
my $error_msg = qq{Could not find intended $parameter_name $object_type: $object_name};
return ( 0, $error_msg );
}
sub check_filesystem_objects_and_index_existance {
## Function : Checks if a file or directory file exists as well as index file. Croak if object or index file does not exist.
## Returns :
## Arguments: $index_suffix => Index file ending
## : $is_build_file => File object can be built
## : $object_name => Object to check for existance
## : $object_type => Type of item to check
## : $parameter_name => MIP parameter name {REF}
## : $path => Path to check
my ($arg_href) = @_;
## Flatten argument(s)
my $object_name;
my $object_type;
my $parameter_name;
my $path;
## Default
my $index_suffix;
my $is_build_file;
my $tmpl = {
index_suffix => {
allow => [qw{ gz .gz }],
default => q{.gz},
store => \$index_suffix,
strict_type => 1,
},
is_build_file => {
store => \$is_build_file,
strict_type => 1,
},
object_name => {
defined => 1,
required => 1,
store => \$object_name,
strict_type => 1,
},
object_type => {
allow => [qw{ directory file }],
defined => 1,
required => 1,
store => \$object_type,
strict_type => 1,
},
parameter_name => {
defined => 1,
required => 1,
store => \$parameter_name,
strict_type => 1,
},
path => {
defined => 1,
required => 1,
store => \$path,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
## Special case for file with "build_file" in config
## These are handled downstream
return if ( defined $is_build_file );
## Retrieve logger object
my $log = Log::Log4perl->get_logger($LOG_NAME);
my ( $exist, $error_msg ) = check_filesystem_objects_existance(
{
object_name => $path,
object_type => $object_type,
parameter_name => $parameter_name,
}
);
if ( not $exist ) {
$log->fatal($error_msg);
exit 1;
}
## Check for tabix index as well
if ( $path =~ m{ $index_suffix$ }xsm ) {
my $path_index = $path . $DOT . q{tbi};
my ( $index_exist, $index_error_msg ) = check_filesystem_objects_existance(
{
object_name => $path_index,
object_type => $object_type,
parameter_name => $path_index,
}
);
if ( not $index_exist ) {
$log->fatal($index_error_msg);
exit 1;
}
}
return 1;
}
sub get_absolute_path {
## Function : Get absolute path for supplied path or croaks and exists if path does not exists
## Returns : $path (absolute path)
## Arguments: $parameter_name => Parameter to be evaluated
## : $path => Supplied path to be updated/evaluated
my ($arg_href) = @_;
##Flatten argument(s)
my $parameter_name;
my $path;
my $tmpl = {
parameter_name => {
defined => 1,
required => 1,
store => \$parameter_name,
strict_type => 1,
},
path => { defined => 1, required => 1, store => \$path, },
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
## Reformat to absolute path
my $absolute_path = abs_path($path);
return $absolute_path if ( defined $absolute_path );
croak( q{Could not find absolute path for }
. $parameter_name . q{: }
. $path
. q{. Please check the supplied path!} );
}
sub get_file_names {
## Function : Get the file(s) from the filesystem
## Returns : @file_names
## Arguments: $file_directory => File directory
## : $rule_name => Rule name string
## : $rule_skip_subdir => Rule skip sub directories
my ($arg_href) = @_;
## Flatten argument(s)
my $file_directory;
my $rule_name;
my $rule_skip_subdir;
my $tmpl = {
file_directory => {
defined => 1,
required => 1,
store => \$file_directory,
strict_type => 1,
},
rule_name => {
store => \$rule_name,
strict_type => 1,
},
rule_skip_subdir => {
store => \$rule_skip_subdir,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
use Path::Iterator::Rule;
my @file_names;
## Get all files in supplied indirectories
my $rule = Path::Iterator::Rule->new;
### Set rules
## Ignore if sub directory
if ($rule_skip_subdir) {
$rule->skip_subdirs($rule_skip_subdir);
}
## Look for particular file name
if ($rule_name) {
$rule->name($rule_name);
}
# Initilize iterator
my $iter = $rule->iter($file_directory);
DIRECTORY:
while ( my $file_path = $iter->() ) {
my $file_name = splitpath($file_path);
push @file_names, $file_name;
}
return @file_names;
}
sub get_file_line_by_line {
## Function : Read file line by line and return array where each element is a line
## Returns : \@lines
## Arguments : $chomp => Remove any end-of-line character sequences
## : $path => File path to read
my ($arg_href) = @_;
## Flatten argument(s)
my $path;
## Default(s)
my $chomp;
my $tmpl = {
chomp => {
default => 0,
store => \$chomp,
strict_type => 1,
},
path => {
defined => 1,
required => 1,
store => \$path,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
use Path::Tiny qw{ path };
my @lines = path($path)->lines_utf8( { chomp => $chomp, } );
return \@lines;
}
sub remove_file_path_suffix {
## Function : Parse file suffixes in file path. Removes suffix if matching else return undef
## Returns : undef | $file_path_no_suffix
## Arguments: $file_path => File path
## : $file_suffixes_ref => File suffix to be removed
my ($arg_href) = @_;
## Flatten argument(s)
my $file_path;
my $file_suffixes_ref;
my $tmpl = {
file_path => {
defined => 1,
required => 1,
store => \$file_path,
strict_type => 1,
},
file_suffixes_ref => {
default => [],
defined => 1,
required => 1,
store => \$file_suffixes_ref,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
my ( $file_name_nosuffix, $dir, $suffix ) =
fileparse( $file_path, @{$file_suffixes_ref} );
$dir = $dir eq q{./} ? $EMPTY_STR : $dir;
return $dir . $file_name_nosuffix if ( $file_name_nosuffix and $suffix );
return;
}
1;
| henrikstranneheim/MIP | lib/MIP/File/Path.pm | Perl | mit | 11,193 |
#!/usr/bin/env perl
=head1 NAME
UpdateProgenyOffspringOfRelationship
=head1 SYNOPSIS
mx-run ThisPackageName [options] -H hostname -D dbname -u username [-F]
this is a subclass of L<CXGN::Metadata::Dbpatch>
see the perldoc of parent class for more details.
=head1 DESCRIPTION
update relationship or cross stock to its progeny from member_of, which is used for populations, to offspring_of
This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
=head1 AUTHOR
Naama Menda<nm249@cornell.edu>
=head1 COPYRIGHT & LICENSE
Copyright 2018 Boyce Thompson Institute for Plant Research
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
package UpdateProgenyOffspringOfRelationship;
use Moose;
extends 'CXGN::Metadata::Dbpatch';
has '+description' => ( default => <<'' );
Description of this patch goes here
has '+prereq' => (
default => sub {
['AddSystemCvterms'],
},
);
sub patch {
my $self=shift;
print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
print STDOUT "\nExecuting the SQL commands.\n";
$self->dbh->do(<<EOSQL);
UPDATE stock_relationship
SET type_id = (SELECT cvterm_id FROM cvterm where cvterm.name = 'offspring_of' AND cv_id = (SELECT cv_id FROM cv WHERE name = 'stock_relationship'))
WHERE object_id IN (SELECT stock_id FROM stock WHERE type_id = (SELECT cvterm_id FROM cvterm WHERE name = 'cross' AND cv_id = (SELECT cv_id FROM cv WHERE name = 'stock_type')))
AND type_id = (SELECT cvterm_id FROM cvterm WHERE name = 'member_of' AND cv_id = (SELECT cv_id FROM cv WHERE name = 'stock_relationship'));
EOSQL
print "You're done!\n";
}
####
1; #
####
| solgenomics/sgn | db/00104/UpdateProgenyOffspringOfRelationship.pm | Perl | mit | 1,919 |
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd qw(abs_path);
use Data::Dumper;
use File::Basename;
use File::Copy;
use File::Find;
use File::Path qw(make_path);
use File::Temp qw(tempfile);
use IO::Handle;
use POSIX qw(ctime);
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Terse = 1;
BEGIN { $| = 1; }
my $home_path = $ENV{'HOME'};
my $src_path = $ENV{'SRCDIR'} || "$home_path/src";
die "SRCDIR $src_path is invalid" unless -d $src_path;
my @projects = grep { -d $_ } glob("$src_path/*");
print "scanning code from projects @projects\n";
my $project_path;
my $project;
my $cscope_file;
my $cscope_path;
my $count;
my $rv;
sub is_code_file {
my $file = $_;
lstat($file);
my $path = abs_path($file);
# symlinks to missing files will fail
return unless $path && -f $path;
return unless -f _ || -l _;
return unless $file =~ /\.([chly](xx|pp)*|cc|hh)$/;
return if $path =~ m%/\.%;
return if $path =~ m%/.git/%;
return if $path =~ m%/CVS/%;
return if $path =~ m%/RCS/%;
print $cscope_file "$path\n";
++$count;
printf("%07d files found in project %s\n", $count, $project) if ($count != 0 && $count % 100 == 0);
}
for $project_path (@projects) {
$project = basename($project_path);
my $output_dir = "$home_path/cscope/$project";
make_path($output_dir);
$cscope_file = File::Temp->new('TEMPLATE' => "cscope.XXXX", 'SUFFIX' => '.files', 'DIR' => $output_dir, 'CLEANUP' => 0);
$cscope_file->autoflush(1);
$cscope_path = abs_path($cscope_file->filename());
$count = 0;
printf("recording project %s file paths in %s\n", $project, $cscope_path);
find(\&is_code_file, $project_path);
printf("%07d files total\n", $count);
$cscope_file->flush();
$cscope_file->close();
my $output_path = "$output_dir/cscope.files";
$rv = copy($cscope_path, $output_path);
die "could not copy $cscope_path to $output_path" unless $rv;
chdir($output_dir);
my $start = time();
my $command = "cscope -b -q -i $output_path";
printf("cscope executing %s at %s", $command, ctime($start));
$rv = system($command);
my $stop = time();
my $elapsed = $stop - $start;
printf("cscope completed in %d secs. %03.2f mins. at %s", $elapsed, $elapsed / 60.0, ctime($stop));
die "could not execute cscope on output $output_path" if $rv;
}
exit(0);
| megahall/mm-utils | bin/cscope-update.pl | Perl | mit | 2,442 |
#!C:\strawberry\perl\bin\perl.exe
# Program that acts like cat, but precedes each line with its file name
use 5.020;
use warnings;
while (<>) {
print "$ARGV: $_";
}
| bewuethr/ctci | llama_book/chapter05/wb_chapter05_ex01.pl | Perl | mit | 172 |
# 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 /tmp/BU3Xn7v6Kb/antarctica. Olson data version 2015g
#
# Do not edit this file directly.
#
package DateTime::TimeZone::Antarctica::Syowa;
$DateTime::TimeZone::Antarctica::Syowa::VERSION = '1.94';
use strict;
use Class::Singleton 1.03;
use DateTime::TimeZone;
use DateTime::TimeZone::OlsonDB;
@DateTime::TimeZone::Antarctica::Syowa::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' );
my $spans =
[
[
DateTime::TimeZone::NEG_INFINITY, # utc_start
61727875200, # utc_end 1957-01-29 00:00:00 (Tue)
DateTime::TimeZone::NEG_INFINITY, # local_start
61727875200, # local_end 1957-01-29 00:00:00 (Tue)
0,
0,
'zzz',
],
[
61727875200, # utc_start 1957-01-29 00:00:00 (Tue)
DateTime::TimeZone::INFINITY, # utc_end
61727886000, # local_start 1957-01-29 03:00:00 (Tue)
DateTime::TimeZone::INFINITY, # local_end
10800,
0,
'SYOT',
],
];
sub olson_version {'2015g'}
sub has_dst_changes {0}
sub _max_year {2025}
sub _new_instance {
return shift->_init( @_, spans => $spans );
}
1;
| rosiro/wasarabi | local/lib/perl5/DateTime/TimeZone/Antarctica/Syowa.pm | Perl | mit | 1,231 |
# Time-stamp: "Sat Jul 14 00:27:30 2001 by Automatic Bizooty (__blocks2pm.plx)"
$Text::\SEPA\Unicode\Unidecode::Char[0x56] = [
'Di ', 'Qi ', 'Jiao ', 'Chong ', 'Jiao ', 'Kai ', 'Tan ', 'San ', 'Cao ', 'Jia ', 'Ai ', 'Xiao ', 'Piao ', 'Lou ', 'Ga ', 'Gu ',
'Xiao ', 'Hu ', 'Hui ', 'Guo ', 'Ou ', 'Xian ', 'Ze ', 'Chang ', 'Xu ', 'Po ', 'De ', 'Ma ', 'Ma ', 'Hu ', 'Lei ', 'Du ',
'Ga ', 'Tang ', 'Ye ', 'Beng ', 'Ying ', 'Saai ', 'Jiao ', 'Mi ', 'Xiao ', 'Hua ', 'Mai ', 'Ran ', 'Zuo ', 'Peng ', 'Lao ', 'Xiao ',
'Ji ', 'Zhu ', 'Chao ', 'Kui ', 'Zui ', 'Xiao ', 'Si ', 'Hao ', 'Fu ', 'Liao ', 'Qiao ', 'Xi ', 'Xiu ', 'Tan ', 'Tan ', 'Mo ',
'Xun ', 'E ', 'Zun ', 'Fan ', 'Chi ', 'Hui ', 'Zan ', 'Chuang ', 'Cu ', 'Dan ', 'Yu ', 'Tun ', 'Cheng ', 'Jiao ', 'Ye ', 'Xi ',
'Qi ', 'Hao ', 'Lian ', 'Xu ', 'Deng ', 'Hui ', 'Yin ', 'Pu ', 'Jue ', 'Qin ', 'Xun ', 'Nie ', 'Lu ', 'Si ', 'Yan ', 'Ying ',
'Da ', 'Dan ', 'Yu ', 'Zhou ', 'Jin ', 'Nong ', 'Yue ', 'Hui ', 'Qi ', 'E ', 'Zao ', 'Yi ', 'Shi ', 'Jiao ', 'Yuan ', 'Ai ',
'Yong ', 'Jue ', 'Kuai ', 'Yu ', 'Pen ', 'Dao ', 'Ge ', 'Xin ', 'Dun ', 'Dang ', 'Sin ', 'Sai ', 'Pi ', 'Pi ', 'Yin ', 'Zui ',
'Ning ', 'Di ', 'Lan ', 'Ta ', 'Huo ', 'Ru ', 'Hao ', 'Xia ', 'Ya ', 'Duo ', 'Xi ', 'Chou ', 'Ji ', 'Jin ', 'Hao ', 'Ti ',
'Chang ', qq{[?] }, qq{[?] }, 'Ca ', 'Ti ', 'Lu ', 'Hui ', 'Bo ', 'You ', 'Nie ', 'Yin ', 'Hu ', 'Mo ', 'Huang ', 'Zhe ', 'Li ',
'Liu ', 'Haai ', 'Nang ', 'Xiao ', 'Mo ', 'Yan ', 'Li ', 'Lu ', 'Long ', 'Fu ', 'Dan ', 'Chen ', 'Pin ', 'Pi ', 'Xiang ', 'Huo ',
'Mo ', 'Xi ', 'Duo ', 'Ku ', 'Yan ', 'Chan ', 'Ying ', 'Rang ', 'Dian ', 'La ', 'Ta ', 'Xiao ', 'Jiao ', 'Chuo ', 'Huan ', 'Huo ',
'Zhuan ', 'Nie ', 'Xiao ', 'Ca ', 'Li ', 'Chan ', 'Chai ', 'Li ', 'Yi ', 'Luo ', 'Nang ', 'Zan ', 'Su ', 'Xi ', 'So ', 'Jian ',
'Za ', 'Zhu ', 'Lan ', 'Nie ', 'Nang ', qq{[?] }, qq{[?] }, 'Wei ', 'Hui ', 'Yin ', 'Qiu ', 'Si ', 'Nin ', 'Jian ', 'Hui ', 'Xin ',
'Yin ', 'Nan ', 'Tuan ', 'Tuan ', 'Dun ', 'Kang ', 'Yuan ', 'Jiong ', 'Pian ', 'Yun ', 'Cong ', 'Hu ', 'Hui ', 'Yuan ', 'You ', 'Guo ',
'Kun ', 'Cong ', 'Wei ', 'Tu ', 'Wei ', 'Lun ', 'Guo ', 'Qun ', 'Ri ', 'Ling ', 'Gu ', 'Guo ', 'Tai ', 'Guo ', 'Tu ', 'You ',
];
1;
| dmitrirussu/php-sepa-xml-generator | src/Unicode/data/perl_source/x56.pm | Perl | mit | 2,185 |
use Kook::Util ('read_file', 'write_file');
use Cwd;
my $project = prop('project', "Kook");
my $release = prop('release', "0.0100");
my $copyright = "copyright(c) 2009-2011 kuwata-lab.com all rights reserved.";
my $license = prop('license', "MIT License");
$kook->{default} = "test";
recipe "test", {
method => sub {
sys("prove t/*.t");
}
};
recipe 'package', {
desc => 'create package',
ingreds => ['dist'],
method => sub {
my $base = "$project-$release";
my $dir = "dist/$base";
cd $dir, sub {
my $perl = $^X;
sys "$perl Makefile.PL";
sys 'make';
#sys 'make disttest';
sys 'make dist';
};
mv "$dir/$base.tar.gz", '.';
rm_r "dist/$base";
cd "dist", sub {
sys "gzip -cd ../$base.tar.gz | tar xf -";
};
}
};
my @text_files = qw(MIT-LICENSE README Changes Kookbook.pl Makefile.PL); # exclude 'MANIFEST'
recipe "dist", {
ingreds => ['bin/kk', 'doc'],
method => sub {
#
my $dir = "dist/$project-$release";
rm_rf $dir if -d $dir;
mkdir_p $dir;
#
store @text_files, $dir;
store 'lib/**/*', 't/**/*', 'bin/**/*', $dir;
#store 'doc/users-guide.html', 'doc/docstyle.css', $dir;
chmod 0755, glob("$dir/bin/*");
#
edit "$dir/**/*", sub {
s/\$Release: 0.0100 $/\$Release: 0.0100 $release \$/g;
s/\$Copyright: copyright(c) 2009-2011 kuwata-lab.com all rights reserved. $/\$Copyright: copyright(c) 2009-2011 kuwata-lab.com all rights reserved. $copyright \$/g;
s/\$License: MIT License $/\$License: MIT License $license \$/g;
s/\$Release\$/$release/g;
s/\$Copyright\$/$copyright/g;
s/\$License\$/$license/g;
$_;
};
#
cd $dir, sub {
#rm 'MANIFEST';
#sys 'perl "-MExtUtils::Manifest=mkmanifest" -e mkmanifest 2>/dev/null';
#rm 'MANIFEST.bak' if -f 'MANIFEST.bak';
open my $fh, '<', 'MANIFEST'; close($fh);
sys "find . -type f | sed -e 's=^\\./==g' > MANIFEST";
cp 'MANIFEST', '../..';
};
#
}
};
my $orig_kk = "../python/bin/kk";
recipe "bin/kk", {
ingreds => [$orig_kk],
desc => "copy from '$orig_kk'",
method => sub {
my ($c) = @_;
cp($c->{ingred}, $c->{product});
}
};
## for documents
recipe "doc", ['doc/users-guide.html', 'doc/docstyle.css'];
recipe "doc/users-guide.html", ['doc/users-guide.txt'], {
byprods => ['users-guide.toc.html', 'users-guide.tmp'],
method => sub {
my ($c) = @_;
my $tmp = $c->{byprods}->[1];
sys "kwaser -t html-css -T $c->{ingred} > $c->{byprod}";
sys "kwaser -t html-css $c->{ingred} > $tmp";
sys_f "tidy -q -i -wrap 9999 $tmp > $c->{product}";
rm_f $c->{byprods};
}
};
recipe "doc/users-guide.txt", ['../common/doc/users-guide.eruby'], {
method => sub {
my ($c) = @_;
mkdir "doc" unless -d "doc";
sys "erubis -E PercentLine -p '\\[% %\\]' $c->{ingred} > $c->{product}";
}
};
recipe 'doc/docstyle.css', ['../common/doc/docstyle.css'], {
method => sub {
my ($c) = @_;
mkdir "doc" unless -d "doc";
cp $c->{ingred}, $c->{product};
}
};
| gitpan/Kook | Kookbook.pl | Perl | mit | 3,401 |
#!/usr/bin/perl -w
package SHPropSearch;
use strict;
use Tracer;
use CGI qw(-nosticky);
use HTML;
use Sprout;
use RHFeatures;
use base 'SearchHelper';
=head1 Property Search Feature Search Helper
=head2 Introduction
This search can be used to request all the features of a specified genome that have
specified property values. This search is not normally available to users; rather, it
is used by content developers to generate links.
It has the following extra parameters.
=over 4
=item propertyPair[]
One or more name/value pairs for properties. The name comes first, followed by an
equal sign and then the value. Theoretically, an unlimited number of name/value
pairs can be specified in this way, but the form only generates a fixed number
determined by the value of C<$FIG_Config::prop_search_limit>. A feature will
be returned if it matches any one of the name-value pairs.
=item genome
The ID of the genome whose features are to be searched.
=back
=head2 Virtual Methods
=head3 Form
my $html = $shelp->Form();
Generate the HTML for a form to request a new search.
=cut
sub Form {
# Get the parameters.
my ($self) = @_;
# Get the CGI and sprout objects.
my $cgi = $self->Q();
my $sprout = $self->DB();
# Start the form.
my $retVal = $self->FormStart("Attribute Search");
my @rows = ();
# First, we generate the genome menu.
my $genomeMenu = $self->NmpdrGenomeMenu('genome', 0, [$cgi->param('genome')]);
push @rows, CGI::Tr(CGI::td({valign => "top"}, "Genome"),
CGI::td({colspan => 2}, $genomeMenu));
# Now add the property rows.
my @pairs = grep { $_ } $cgi->param('propertyPair');
Trace(scalar(@pairs) . " property pairs read from CGI.") if T(3);
for (my $i = 1; $i <= $FIG_Config::prop_search_limit; $i++) {
my $thisPair = shift @pairs;
Trace("\"$thisPair\" popped from pairs array. " . scalar(@pairs) . " entries left.") if T(3);
push @rows, CGI::Tr(CGI::td("Name=Value ($i)"),
CGI::td({colspan => 2}, CGI::textfield(-name => 'propertyPair',
-value => $thisPair,
-size => 40)));
}
# Finally, the submit row.
push @rows, $self->SubmitRow();
# Build the form table.
$retVal .= $self->MakeTable(\@rows);
# Close the form.
$retVal .= $self->FormEnd();
# Return the result.
return $retVal;
}
=head3 Find
my $resultCount = $shelp->Find();
Conduct a search based on the current CGI query parameters. The search results will
be written to the session cache file and the number of results will be
returned. If the search parameters are invalid, a result count of C<undef> will be
returned and a result message will be stored in this object describing the problem.
=cut
sub Find {
my ($self) = @_;
# Get the CGI and Sprout objects.
my $cgi = $self->Q();
my $sprout = $self->DB();
# Declare the return variable. If it remains undefined, the caller will
# know that an error occurred.
my $retVal;
# Insure we have a genome.
my ($genomeID) = $self->GetGenomes('genome');
if (! $genomeID) {
$self->SetMessage("No genome was specified.");
} else {
# Now we verify the property filters. First we get the specified pairs.
my @props = $cgi->param('propertyPair');
# We'll put the property IDs found into this list.
my @propIDs = ();
# We'll accumulate error messages in this list.
my @errors = ();
# Loop through the specified pairs.
for my $prop (@props) {
# Only proceed if we have something.
if ($prop) {
# Separate the name and value.
if ($prop =~ /^\s*(\w+)\s*=\s*(.*)\s*$/) {
my ($name, $value) = ($1, $2);
# Verify that they exist.
my ($id) = $sprout->GetFlat(['Property'],
"Property(property-name) = ? AND Property(property-value) = ?",
[$name, $value], 'Property(id)');
# If they do, save the ID.
if ($id) {
push @propIDs, $id;
}
} else {
# Here the format is wrong.
push @errors, "Could not parse \"$prop\" into a name-value pair.";
}
}
}
# Insure we have some values and that there are no errors.
if (@errors) {
$self->SetMessage(join(" ", @errors));
} elsif (! @propIDs) {
$self->SetMessage("None of the name-value pairs specified exist in the database.");
} else {
# If we are here, then we have a genome ($genomeID) and a list
# of desired property IDs (@propIDs). That means we can search.
# Create the result helper.
my $rhelp = RHFeatures->new($self);
# Set the default columns.
$self->DefaultColumns($rhelp);
# Add the value columm at the front.
$rhelp->AddExtraColumn(values => 0, title => 'Values', download => 'list',
style => 'leftAlign');
# Initialize the session file.
$self->OpenSession($rhelp);
# Initialize the result counter.
$retVal = 0;
# Create a variable to store the property value HTML.
my @extraCols = ();
# Denote that we currently don't have a feature.
my $fid = undef;
# Create the query.
my $query = $sprout->Get(['HasFeature', 'Feature', 'HasProperty', 'Property'],
"Property(id) IN (" . join(",", @propIDs) .
") AND HasFeature(from-link) = ? ORDER BY Feature(id)",
[$genomeID]);
# Loop through the query results. The same feature may appear multiple times,
# but all the multiples will be grouped together.
my $savedRow;
while (my $row = $query->Fetch()) {
# Get the feature ID;
my $newFid = $row->PrimaryValue('Feature(id)');
# Check to see if we have a new feature coming in. Note we check for undef
# to avoid a run-time warning.
if (! defined($fid) || $newFid ne $fid) {
if (defined($fid)) {
# Here we have an old feature to output.
$self->DumpFeature($rhelp, $savedRow, \@extraCols);
$retVal++;
}
# Clear the property value list.
@extraCols = ();
# Save this as the currently-active feature.
$savedRow = $row;
$fid = $newFid;
}
# Get this row's property data for the extra column.
my ($name, $value, $url) = $row->Values(['Property(property-name)',
'Property(property-value)',
'HasProperty(evidence)']);
# If the evidence is a URL, format it as a link; otherwise, ignore it.
if ($url =~ m!http://!) {
push @extraCols, CGI::a({href => $url}, $value);
} else {
push @extraCols, $value;
}
}
# If there's a feature still in the buffer, write it here.
if (defined $fid) {
$self->DumpFeature($rhelp, $savedRow, \@extraCols);
$retVal++;
}
# Close the session file.
$self->CloseSession();
}
}
# Return the result count.
return $retVal;
}
=head3 DumpFeature
$shelp->DumpFeature($rhelp, $record, \@extraCols);
Write the data for the current feature to the output.
=over 4
=item rhelp
Feature result helper.
=item record
B<ERDBObject> containing the feature.
=item extraCols
Reference to a list of extra column data.
=back
=cut
sub DumpFeature {
# Get the parameters.
my ($self, $rhelp, $record, $extraCols) = @_;
# Format the extra column data.
my $extraColumn = join(", ", @{$extraCols});
# Add the extra column data.
$rhelp->PutExtraColumns(values => $extraColumn);
# Compute the sort key and the feature ID.
my $sortKey = $rhelp->SortKey($record);
my $fid = $record->PrimaryValue('Feature(id)');
# Put everything to the output.
$rhelp->PutData($sortKey, $fid, $record);
}
=head3 Description
my $htmlText = $shelp->Description();
Return a description of this search. The description is used for the table of contents
on the main search tools page. It may contain HTML, but it should be character-level,
not block-level, since the description is going to appear in a list.
=cut
sub Description {
# Get the parameters.
my ($self) = @_;
# Return the result.
return "Search for genes in a specific genome with specified property values.";
}
1;
| kbase/kb_seed | lib/SHPropSearch.pm | Perl | mit | 9,382 |
#!/usr/local/bin/perl
#cat broker_list_all | while read broker_list_all
#do
# echo $broker_list_all
# trade_count_compare_sql.ksh $broker_list_all
#done
my $InputFile = "broker_list_all";
my $OutputFile = "trade_count_univ.lis";
open(FD,"<$InputFile") or die("Couldn't open $InputFile\n");
@broker_list=<FD>;
close(FD);
foreach $broker(@broker_list)
{
open(OD,">>$OutputFile") or die("Couldn't open $OutputFile\n");
isql -Ubrass -Pascasc -SDB_NITSYBUNIV1 -w190 <<SQLDONE >trade_count_univ1.lis
use brass
go
select entdate,exbkrsym,count(*) 'trades'
from tradesrpthistory
group by entdate,exbkrsym
go
quit
SQLDONE
}
| pitpitman/GraduateWork | Knight/trade_count_compare_perl.pl | Perl | mit | 639 |
#!/sw/bin/perl
=head1 NAME
B<plot_distest.pl>
=head1 DESCRIPTION
Plot a figure with results from log-normal and negative binomial tests. Need to run C<distribution_test.pl> and C<grid_launcher_nb_test.pl> first to create test results. These test results should be in files:
WT_lnorm_lev_clean_test.dat
Snf2_lnorm_lev_clean_test.dat
WT_lnorm_lev_test.dat
Snf2_lnorm_lev_test.dat
WT_nb_deseq_lev_test.dat
Snf2_nb_deseq_lev_test.dat
WT_nb_lev_test.dat
Snf2_nb_lev_test.dat
=cut
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
use PDL;
use PDL::NiceSlice;
use PDL::Graphics::PLplot;
use GetOpt;
use Distribution;
use Stats;
use PLgraphs;
use Tools;
Stamp();
#my $cond = 'WT';
my $limit = 0.05;
my $zero = 0.2e-17;
my $psfile;
my $norm = 'lev';
my $multicor = 'bh';
my ($help, $man);
GetOptions(
# 'cond=s' => \$cond,
'norm=s' => \$norm,
'psfile=s' => \$psfile,
#'multicor=s' => \$multicor,
help => \$help,
man => \$man
);
pod2usage(-verbose => 2) if $man;
pod2usage(-verbose => 1) if $help;
my $w = NewWindow($psfile);
$PL_nx = 4;
$PL_ny = 3;
$PL_deltax = 0.02;
$PL_deltay = 0.05;
$PL_ymin = 0.2;
my ($minm, $maxm) = (-1.9999, 6);
my ($minp, $maxp) = (-18, 0);
my $pan = 1;
for my $test qw(norm lnorm nb)
{
for my $cl ('_clean', '')
{
for my $cond qw(WT Snf2)
{
#my $file = "${cond}_${test}_${norm}${cl}_${multicor}_test.dat";
my $file = "${cond}_${test}_${norm}${cl}_test.dat";
next unless -e $file;
print "$file\n";
my $ppos = ($test eq 'nb' && $norm eq 'lev') ? 3 : 2; # old format
my ($m, $P) = rcols $file, 1, $ppos;
PlotPMean($w, $pan, $m, $P);
my $c = ($cl eq '_clean') ? 'clean' : '';
my $t;
if($test eq 'norm') {$t = 'nm'}
elsif($test eq 'lnorm') {$t = 'ln'}
else {$t = 'nb'}
my $l = chr($pan+96);
TopText($w, "\($l) $t $cond $c", CHARSIZE=>0.7, x=>0, y=>1, COLOR=>[110,110,110]);
$pan++
}
}
}
$w->close();
sub PlotPMean
{
my ($win, $pan, $m, $P, $lab) = @_;
my $ngen = nelem($m);
my ($Plim, $ns) = HolmBonferroniLimit($P, $limit);
$P->where($P==0) .= $zero;
my $y = log10($P);
my $x = log10($m);
$lab ||= '';
my ($minx, $maxx) = BoxMinMax($x);
my ($miny, $maxy) = BoxMinMax($y);
#print "$maxy\n";
PlotPanelN($win, $pan,
BOX => [$minm, $maxm, $minp, $maxp],
XLAB => 'log mean',
YLAB => 'log p',
xbox=>'I', ybox=>'I',
#forceylab=>1,
#forcexlab=>1,
);
my $sel1 = which($P>$zero);
my $sel2 = which($P<=$zero);
PointPlot($win, $x($sel1), $y($sel1));
PointPlot($win, $x($sel2), $y($sel2), COLOR=>'GOLD2');
#TopText($win, $lab, y=>1);
$win->text("$ns/$ngen", CHARSIZE=>0.4, COLOR=>'BLUE', TEXTPOSITION=>[$maxm-0.0, -16.8, 0, 0, 1]);
#limline($y, $limit, $ngen);
#limline($y, $limit/$ngen, $ngen);
limline($win, $y, $Plim, $ngen) if $Plim > 0;
}
sub limline
{
my ($win, $P, $lim, $n) = @_;
my $q = log10($lim);
my $out = nelem(which($P < $q));
#print "out = ", 100 * $out / $n, "\n";
my $str = sprintf "%.2g%%",100 * $out / $n;
LinePlot($win, pdl($minm,$maxm), pdl($q,$q), COLOR=>'RED');
my $xx = $maxm - 0.05*($maxm-$minm);
#$win->text($str, COLOR=>'RED', CHARSIZE=>0.6, TEXTPOSITION=>[$xx, $q+0.15, 0, 0, 0]);
}
=head1 SYNOPSIS
plot_distest.pl -norm=lev -psfile=dist_tests.ps
=head1 OPTIONS
=item B<-norm>=I<string>
Normalization used in distribution test scripts (see DESCRIPTION). This is used to identify the test result files. The default value is 'lev'.
=item B<-psfile>=I<pathname>
Output postscript file.
=cut
| bartongroup/profDGE48 | Plotting/plot_distest.pl | Perl | mit | 3,618 |
package Paws::Pinpoint::SendMessages;
use Moose;
has ApplicationId => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'application-id', required => 1);
has MessageRequest => (is => 'ro', isa => 'Paws::Pinpoint::MessageRequest', required => 1);
use MooseX::ClassAttribute;
class_has _stream_param => (is => 'ro', default => 'MessageRequest');
class_has _api_call => (isa => 'Str', is => 'ro', default => 'SendMessages');
class_has _api_uri => (isa => 'Str', is => 'ro', default => '/v1/apps/{application-id}/messages');
class_has _api_method => (isa => 'Str', is => 'ro', default => 'POST');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::Pinpoint::SendMessagesResponse');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Pinpoint::SendMessages - Arguments for method SendMessages on Paws::Pinpoint
=head1 DESCRIPTION
This class represents the parameters used for calling the method SendMessages on the
Amazon Pinpoint service. Use the attributes of this class
as arguments to method SendMessages.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to SendMessages.
As an example:
$service_obj->SendMessages(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> ApplicationId => Str
=head2 B<REQUIRED> MessageRequest => L<Paws::Pinpoint::MessageRequest>
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method SendMessages in L<Paws::Pinpoint>
=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/Pinpoint/SendMessages.pm | Perl | apache-2.0 | 2,025 |
package Google::Ads::AdWords::v201402::AdGroupCriterionService::query;
use strict;
use warnings;
{ # BLOCK to scope variables
sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201402' }
__PACKAGE__->__set_name('query');
__PACKAGE__->__set_nillable();
__PACKAGE__->__set_minOccurs();
__PACKAGE__->__set_maxOccurs();
__PACKAGE__->__set_ref();
use base qw(
SOAP::WSDL::XSD::Typelib::Element
Google::Ads::SOAP::Typelib::ComplexType
);
our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;
sub __get_attr_class {
return $XML_ATTRIBUTE_CLASS;
}
use Class::Std::Fast::Storable constructor => 'none';
use base qw(Google::Ads::SOAP::Typelib::ComplexType);
{ # BLOCK to scope variables
my %query_of :ATTR(:get<query>);
__PACKAGE__->_factory(
[ qw( query
) ],
{
'query' => \%query_of,
},
{
'query' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
},
{
'query' => 'query',
}
);
} # end BLOCK
} # end of BLOCK
1;
=pod
=head1 NAME
Google::Ads::AdWords::v201402::AdGroupCriterionService::query
=head1 DESCRIPTION
Perl data type class for the XML Schema defined element
query from the namespace https://adwords.google.com/api/adwords/cm/v201402.
Returns the list of AdGroupCriterion that match the query. @param query The SQL-like AWQL query string @returns A list of AdGroupCriterion @throws ApiException when the query is invalid or there are errors processing the request.
=head1 PROPERTIES
The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:
=over
=item * query
$element->set_query($data);
$element->get_query();
=back
=head1 METHODS
=head2 new
my $element = Google::Ads::AdWords::v201402::AdGroupCriterionService::query->new($data);
Constructor. The following data structure may be passed to new():
{
query => $some_value, # string
},
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
| gitpan/GOOGLE-ADWORDS-PERL-CLIENT | lib/Google/Ads/AdWords/v201402/AdGroupCriterionService/query.pm | Perl | apache-2.0 | 1,947 |
#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/usr/targeting/xmltohb/updatetargetxml.pl $
#
# OpenPOWER HostBoot Project
#
# COPYRIGHT International Business Machines Corp. 2012,2014
#
# 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.
#
# IBM_PROLOG_END_TAG
#
# Original file created by Van Lee for fsp.
# File copied to Hostboot and modified by CamVan Nguyen
#
# Usage:
#
# updatetargetxml --hb=target_types_hb.xml --common=target_types.xml
#
# Purpose:
#
# This perl script processes the target_types_hb.xml file to find the
# <targetTypeExtension> tags, and update target_types.xml if needed.
# The updated target_types.xml is written to the console.
#
use strict;
use XML::Simple;
use Data::Dumper;
my $hb = "";
my $common = "";
my $usage = 0;
use Getopt::Long;
GetOptions( "hb:s" => \$hb,
"common:s" => \$common,
"help" => \$usage, );
if ($usage || ($hb eq "") || ($common eq ""))
{
display_help();
exit 0;
}
open (FH, "<$hb") ||
die "ERROR: unable to open $hb\n";
close (FH);
my $generic = XMLin("$hb", ForceArray=>1);
open (FH, "<$common") ||
die "ERROR: unable to open $common\n";
close (FH);
my $generic1 = XMLin("$common");
my @NewAttr;
foreach my $Extension ( @{$generic->{targetTypeExtension}} )
{
my $id = $Extension->{id}->[0];
foreach my $attr ( @{$Extension->{attribute}} )
{
my $attribute_id = $attr->{id}->[0];
my $default = "";
if (exists $attr->{default})
{
$default = $attr->{default}->[0];
}
#print "$id, $attribute_id $default\n";
if (! exists $generic1->{targetType}->{$id}->{attribute}->{$attribute_id})
{
push @NewAttr, [ $id, $attribute_id, $default ];
}
}
}
open (FH, "<$common");
my $check = 0;
my $id = "";
while (my $line = <FH>)
{
if ( $line =~ /^\s*<targetType>.*/)
{
$check = 1;
}
elsif ($check == 1 && $line =~ /^\s*<id>/)
{
$check = 0;
$id = $line;
$id =~ s/\n//;
$id =~ s/.*<id>(.*)<\/id>.*/$1/;
}
elsif ($line =~ /^\s*<\/targetType>.*/)
{
for my $i ( 0 .. $#NewAttr )
{
if ($NewAttr[$i][0] eq $id)
{
print " <attribute>\n";
print " <id>$NewAttr[$i][1]</id>\n";
if ($NewAttr[$i][2] ne "")
{
print " <default>$NewAttr[$i][2]</default>\n";
}
print " </attribute>\n";
}
}
}
print "$line";
}
close (FH);
sub display_help
{
use File::Basename;
my $scriptname = basename($0);
print STDERR "
Usage:
$scriptname --help
$scriptname --hb=hbfname --hb=commonfname
--hb=hbfname
hbfname is the complete pathname of the target_types_hb.xml file
--common=commonfname
commonfname is the complete pathname of the target_types.xml file
\n";
}
| shenki/hostboot | src/usr/targeting/xmltohb/updatetargetxml.pl | Perl | apache-2.0 | 3,539 |
package Paws::Discovery::ExportFilter;
use Moose;
has Condition => (is => 'ro', isa => 'Str', request_name => 'condition', traits => ['NameInRequest'], required => 1);
has Name => (is => 'ro', isa => 'Str', request_name => 'name', traits => ['NameInRequest'], required => 1);
has Values => (is => 'ro', isa => 'ArrayRef[Str|Undef]', request_name => 'item', request_name => 'values', traits => ['NameInRequest','NameInRequest'], required => 1);
1;
### main pod documentation begin ###
=head1 NAME
Paws::Discovery::ExportFilter
=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::Discovery::ExportFilter object:
$service_obj->Method(Att1 => { Condition => $value, ..., Values => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::Discovery::ExportFilter object:
$result = $service_obj->Method(...);
$result->Att1->Condition
=head1 DESCRIPTION
Used to select which agent's data is to be exported. A single agent ID
may be selected for export using the StartExportTask action.
=head1 ATTRIBUTES
=head2 B<REQUIRED> Condition => Str
Supported condition: C<EQUALS>
=head2 B<REQUIRED> Name => Str
A single C<ExportFilter> name. Supported filters: C<agentId>.
=head2 B<REQUIRED> Values => ArrayRef[Str|Undef]
A single C<agentId> for a Discovery Agent. An C<agentId> can be found
using the DescribeAgents action. Typically an ADS C<agentId> is in the
form C<o-0123456789abcdef0>.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::Discovery>
=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/Discovery/ExportFilter.pm | Perl | apache-2.0 | 2,054 |
#
# 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::nimble::restapi::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} = '1.0';
$self->{modes} = {
'arrays' => 'storage::nimble::restapi::mode::arrays',
'hardware' => 'storage::nimble::restapi::mode::hardware',
'volumes' => 'storage::nimble::restapi::mode::volumes'
};
$self->{custom_modes}->{api} = 'storage::nimble::restapi::custom::api';
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check nimble through HTTP/REST API.
=over 8
=back
=cut
| centreon/centreon-plugins | storage/nimble/restapi/plugin.pm | Perl | apache-2.0 | 1,465 |
#
# Copyright 2016 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 apps::protocols::udp::mode::connection;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use IO::Socket::INET;
use IO::Select;
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 =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"timeout:s" => { name => 'timeout', default => '3' },
});
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();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Need to specify '--hostname' option");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{port})) {
$self->{output}->add_option_msg(short_msg => "Need to specify '--port' option");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my $icmp_sock = new IO::Socket::INET(Proto=>"icmp");
my $read_set = new IO::Select();
$read_set->add($icmp_sock);
my $sock = IO::Socket::INET->new(PeerAddr => $self->{option_results}->{hostname},
PeerPort => $self->{option_results}->{port},
Proto => 'udp',
);
$sock->send("Hello");
close($sock);
(my $new_readable) = IO::Select->select($read_set, undef, undef, $self->{option_results}->{timeout});
my $icmp_arrived = 0;
foreach $sock (@$new_readable) {
if ($sock == $icmp_sock) {
$icmp_arrived = 1;
$icmp_sock->recv(my $buffer,50,0);
}
}
close($icmp_sock);
if ($icmp_arrived == 1) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("Connection failed on port %s", $self->{option_results}->{port}));
} else {
$self->{output}->output_add(severity => 'OK',
short_msg => sprintf("Connection success on port %s", $self->{option_results}->{port}));
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check UDP connection
=over 8
=item B<--hostname>
IP Addr/FQDN of the host
=item B<--port>
Port used
=item B<--timeout>
Connection timeout in seconds (Default: 3)
=back
=cut
| golgoth31/centreon-plugins | apps/protocols/udp/mode/connection.pm | Perl | apache-2.0 | 3,896 |
package Dancer::Logger::Diag;
#ABSTRACT: Test::More diag() logging engine for Dancer
use strict;
use warnings;
use base 'Dancer::Logger::Abstract';
sub init {
my $self = shift;
$self->SUPER::init(@_);
require Test::More;
}
sub _log {
my ($self, $level, $message) = @_;
Test::More::diag(
$self->format_message( $level => $message )
);
}
1;
__END__
=head1 SYNOPSIS
=head1 DESCRIPTION
This logging engine uses L<Test::More>'s diag() to output as TAP comments.
This is very useful in case you're writing a test and want to have logging
messages as part of your TAP.
=head1 METHODS
=head2 init
This method is called when C<< ->new() >> is called. It just loads Test::More
lazily.
=head2 _log
Use Test::More's diag() to output the log message.
| sonar-perl/sonar-perl | perl/Dancer/lib/Dancer/Logger/Diag.pm | Perl | apache-2.0 | 786 |
package Bio::EnsEMBL::Analysis::Runnable::Finished::Augustus;
# 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.
=head1 NAME
Bio::EnsEMBL::Analysis::Runnable::Finished::Augustus
=head1 SYNOPSIS
my $runnable = Bio::EnsEMBL::Analysis::Runnable::Finished::Augustus->new
(
-query => $slice,
-program => 'augustus',
-species => 'human',
-analysis => $analysis,
);
$runnable->run;
my @predictions = @{$runnable->output};
=head1 DESCRIPTION
Wrapper to run the augustus gene predictor and then parse the results
into prediction transcripts
this is a bare bones module which inherits most of its functionality from
Bio::EnsEMBL::Analysis::Runnable::Genscan
=head1 CONTACT
Post questions to : anacode-people@sanger.ac.uk
=cut
use vars qw(@ISA);
use strict;
use warnings;
use Bio::EnsEMBL::Analysis::Runnable::BaseAbInitio;
use Bio::EnsEMBL::Utils::Exception qw(throw warning);
use Bio::EnsEMBL::Utils::Argument qw( rearrange );
@ISA = qw(Bio::EnsEMBL::Analysis::Runnable::BaseAbInitio);
=head2 new
Returntype : Bio::EnsEMBL::Analysis::Runnable::Finished::Augustus
=cut
sub new {
my ($class,@args) = @_;
my $self = $class->SUPER::new(@args);
my ($species) = rearrange(['SPECIES'], @args);
$self->species($species);
######################
#SETTING THE DEFAULTS#
######################
$self->program('/software/anacode/bin/augustus') if(!$self->program);
$self->species('human') if(!$self->species);
######################
return $self;
}
sub species {
my ($self,$species) = @_;
if($species){
$self->{'species'} = $species;
}
return $self->{'species'};
}
sub run_analysis{
my ($self, $program) = @_;
if(!$program){
$program = $self->program;
}
throw($program." is not executable Augustus::run_analysis ")
unless($program && -x $program);
my $command = $program." --species=".$self->species." ";
$command .= $self->options." " if($self->options);
$command .= $self->queryfile." > ".$self->resultsfile;
print "Running analysis ".$command."\n";
system($command) == 0 or throw("FAILED to run ".$command);
}
## Predicted genes for sequence number 1 on both strands
#### gene g1
#seqname source feature start end score strand frame transcript and gene name
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS gene 108106 121071 1 - . g1
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS transcript 111161 121071 0.5 - . g1.t1
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS stop_codon 111161 111163 . - 0 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS terminal 111161 111357 0.56 - 2 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS intron 111358 113826 1 - . transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS internal 113827 114097 1 - 0 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS intron 114098 120939 0.99 - . transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS initial 120940 121071 0.92 - 0 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS start_codon 121069 121071 . - 0 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS CDS 111164 111357 0.56 - 2 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS CDS 113827 114097 1 - 0 transcript_id "g1.t1"; gene_id "g1";
#contig::BX901927.7.1.152042:1:152042:1 contig BX901927.7.1.152042 AUGUSTUS CDS 120940 121071 0.92 - 0 transcript_id "g1.t1"; gene_id "g1";
## protein sequence = [MFFQFGPSIEQQASVMLNIMEEYDWYIFSIVTTYYPGHQDFVNRIRSTVDNSFVGWELEEVLLLDMSVDDGDSKIQNQ
## MKKLQSPVILLYCTKEEATTIFEVAHSVGLTGYGYTWIVPSLVAGDTDNVPNVFPTGLISVSYDEWDYGLEARVRDAVAIIAMATSTMMLDRGPHTLL
## KSGCHGAPDKKGSKSGNPNEVLR]
=head2 parse_results
Arg [1] : Bio::EnsEMBL::Analysis::Runnable::Finished::Augustus
Arg [2] : string, filename
Function : parse the output from Augustus into prediction transcripts
Returntype: none
Exceptions: throws if cannot open or close results file
Example :
=cut
sub parse_results{
my ($self, $results) = @_;
if(!$results){
$results = $self->resultsfile;
}
open(OUT, "<".$results) or throw("FAILED to open ".$results."Augustus:parse_results");
my $genes;
my $verbose = 0;
# parse output
while (<OUT>) {
chomp;
if(/^#/) { next; }
my @element = split /\t/;
if($element[2] && $element[2] eq 'CDS')
{
my ($transcript_id,$gene_id) = $element[8] =~ /transcript_id "(.*)"; gene_id "(.*)";/;
my @exon = @element[3..7]; #($start,$end,$score,$strand,$phase)
$genes->{$gene_id}->{$transcript_id} ||= [];
push @{$genes->{$gene_id}->{$transcript_id}}, \@exon;
}
}
# create exon objects
foreach my $gene (keys %$genes) {
print STDOUT "Gene $gene\n" if($verbose);
foreach my $transcript (keys %{$genes->{$gene}}) {
print STDOUT "\tTranscript $transcript\n" if($verbose);
my $exons = $genes->{$gene}->{$transcript};
my $strand = $exons->[0]->[3];
if($strand eq '+') {
$strand = 1;
@$exons = sort {$a->[0] <=> $b->[0]} @$exons;
}else{
$strand = -1;
@$exons = reverse sort {$a->[0] <=> $b->[0]} @$exons;
}
my $exon_num=1;
foreach my $exon (@$exons) {
my $start = $exon->[0];
my $end = $exon->[1];
my $score = $exon->[2];
my $phase = $exon->[4];
my $e_name = $transcript.".e".$exon_num; # g1.t1.e1
my $e = $self->feature_factory->create_prediction_exon
($start, $end, $strand, $score, '0', $phase, $e_name, $self->query, $self->analysis);
print "\t\t\t".join("\t",$e_name,$start, $end, $strand, $score, $phase,"\n" ) if($verbose);
$self->exon_groups($transcript, $e);
$exon_num++;
}
}
}
# create transcript objects
$self->create_transcripts();
close(OUT) or throw("FAILED to close ".$results."Augustus:parse_results");
}
1;
| james-monkeyshines/ensembl-analysis | modules/Bio/EnsEMBL/Analysis/Runnable/Finished/Augustus.pm | Perl | apache-2.0 | 7,401 |
=head1 LICENSE
Copyright (c) 1999-2011 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
http://www.ensembl.org/info/about/code_licence.html
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <dev@ensembl.org>.
Questions may also be sent to the Ensembl help desk at
<helpdesk@ensembl.org>.
=cut
# Ensembl module for Bio::EnsEMBL::Variation::IndividualGenotype
#
# Copyright (c) 2004 Ensembl
#
=head1 NAME
Bio::EnsEMBL::Variation::IndividualGenotype- Module representing the genotype
of a single individual at a single position
=head1 SYNOPSIS
print $genotype->variation()->name(), "\n";
print $genotype->allele1(), '/', $genotype->allele2(), "\n";
print $genotype->individual()->name(), "\n";
=head1 DESCRIPTION
This is a class representing the genotype of a single diploid individual at
a specific position
=head1 METHODS
=cut
use strict;
use warnings;
package Bio::EnsEMBL::Variation::IndividualGenotype;
use Bio::EnsEMBL::Variation::Genotype;
use Bio::EnsEMBL::Feature;
use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning);
use vars qw(@ISA);
@ISA = qw(Bio::EnsEMBL::Variation::Genotype Bio::EnsEMBL::Feature);
=head2 new
Arg [-adaptor] :
Bio::EnsEMBL::Variation::DBSQL::IndividualAdaptor
Arg [-START] :
see superclass constructor
Arg [-END] :
see superclass constructor
Arg [-STRAND] :
see superclass constructor
Arg [-SLICE] :
see superclass constructor
Arg [-allele1] :
string - One of the two alleles defining this genotype
Arg [-allele2] :
string - One of the two alleles defining this genotype
Arg [-variation] :
Bio::EnsEMBL::Variation::Variation - The variation associated with this
genotype
Arg [-individual] :
Bio::EnsEMBL::Individual - The individual this genotype is for.
Example : $ind_genotype = Bio:EnsEMBL::Variation::IndividualGenotype->new
(-start => 100,
-end => 100,
-strand => 1,
-slice => $slice,
-allele1 => 'A',
-allele2 => 'T',
-variation => $variation,
-individual => $ind);
Description: Constructor. Instantiates an IndividualGenotype object.
Returntype : Bio::EnsEMBL::Variation::IndividualGenotype
Exceptions : throw on bad argument
Caller : general
Status : At Risk
=cut
sub new {
my $caller = shift;
my $class = ref($caller) || $caller;
my $self = $class->SUPER::new(@_);
my ($adaptor, $allele1, $allele2, $var, $ind) =
rearrange([qw(adaptor allele1 allele2 variation individual)],@_);
if(defined($var) &&
(!ref($var) || !$var->isa('Bio::EnsEMBL::Variation::Variation'))) {
throw("Bio::EnsEMBL::Variation::Variation argument expected");
}
if(defined($ind) &&
(!ref($ind) || !$ind->isa('Bio::EnsEMBL::Variation::Individual'))) {
throw("Bio::EnsEMBL::Variation::Individual argument expected");
}
$self->{'adaptor'} = $adaptor;
$self->{'allele1'} = $allele1;
$self->{'allele2'} = $allele2;
$self->{'individual'} = $ind;
$self->{'variation'} = $var;
return $self;
}
sub new_fast {
my $class = shift;
my $hashref = shift;
return bless $hashref, $class;
}
=head2 individual
Arg [1] : (optional) Bio::EnsEMBL::Variation::Individual $ind
Example : $ind = $ind_genotype->individual();
Description: Getter/Setter for the individual associated with this genotype
Returntype : Bio::EnsEMBL::Variation::Individual
Exceptions : throw on bad argument
Caller : general
Status : At Risk
=cut
sub individual {
my $self = shift;
if(@_) {
my $ind = shift;
if(defined($ind) &&
(!ref($ind) || !$ind->isa('Bio::EnsEMBL::Variation::Individual'))) {
throw('Bio::EnsEMBL::Variation::Individual argument expected');
}
return $self->{'individual'} = $ind;
}
return $self->{'individual'};
}
=head2 variation
Arg [1] : (optional) Bio::EnsEMBL::Variation::Variation $var
Example : $var = $genotype->variation();
Description: Getter/Setter for the Variation as
Returntype : Bio::EnsEMBL::Variation::Variation
Exceptions : throw on bad argument
Caller : general
Status : At Risk
=cut
sub variation {
my $self = shift;
if(@_) {
#Setter: check wether it is a variation and return it
my $v = shift;
if(defined($v) &&
(!ref($v) || !$v->isa('Bio::EnsEMBL::Variation::Variation'))) {
throw('Bio::EnsEMBL::Variation::Variation argument expected.');
}
$self->{'variation'} = $v;
}
else{
if(!defined($self->{'variation'}) && $self->{'adaptor'}) {
#lazy-load from database on demand
my $vfa = $self->{'adaptor'}->db()->get_VariationFeatureAdaptor();
%{$vfa->{'_slice_feature_cache'}} = (); #this is ugly, but I have no clue why the cache is not being properly stored...
#print "FS: ", $self->feature_Slice->start, "-", $self->feature_Slice->end, "\n";
# get all VFs on the feature slice
my $vfs = $vfa->fetch_all_by_Slice($self->feature_Slice());
# if there's only one that must be it
if(scalar @$vfs == 1) {
$self->{'variation'} = $vfs->[0]->variation;
}
# otherwise we need to check co-ordinates match
else {
foreach my $vf(@$vfs) {
#print "VF: ", $vf->variation_name, " ", $vf->seq_region_start, "-", $vf->seq_region_end, "\n";
if(defined($self->{_table} && ($self->{_table} eq 'compressed'))) {
next unless $vf->var_class =~ /mixed|sn[p|v]/;
}
# only attach if the seq_region_start/end match the feature slice's
if($vf->seq_region_start == $self->feature_Slice->start and $vf->seq_region_end == $self->feature_Slice->end) {
$self->{'variation'} = $vf->variation;
last;
}
}
}
# if we still haven't got one
if(!defined $self->{'variation'}) {
# try getting a bigger slice to find in-dels
my $new_slice = $self->feature_Slice->expand(1,1);
#print "expanded FS: ", $new_slice->start, "-", $new_slice->end, "\n";
# get VFs on the expanded slice
my $new_vfs = $vfa->fetch_all_by_Slice($new_slice);
# if there's only one that must be it
if(scalar @$new_vfs == 1) {
$self->{'variation'} = $new_vfs->[0]->variation;
}
# otherwise we need to check start coord matches start coord of original feature slice
else {
foreach my $vf(@$new_vfs) {
if($vf->seq_region_start == $self->feature_Slice->start) {
$self->{'variation'} = $vf->variation;
last;
}
}
}
}
# old code just shifts off first variation found!!!
#my $vf = shift @{$vfa->fetch_all_by_Slice($self->feature_Slice())};
#$self->{'variation'} = $vf->variation;
}
}
return $self->{'variation'};
}
1;
| adamsardar/perl-libs-custom | EnsemblAPI/ensembl-variation/modules/Bio/EnsEMBL/Variation/IndividualGenotype.pm | Perl | apache-2.0 | 6,982 |
#!/usr/bin/perl
use warnings;
use strict;
use 5.12.0;
my %h1 = ( a => 1, b => 2, c => 3, e => 5, );
my %h2 = ( a => 2, b => 2, d => 4, e => 5, );
my @filenames;
while ( my ( $k, $v ) = each %h1 ) {
if ( exists $h2{ $k } ) {
push @filenames, $k if $v == $h2{ $k };
}
}
say "$_" for @filenames;
| jmcveigh/komodo-tools | scripts/perl/hash_compare/comp.pl | Perl | bsd-2-clause | 314 |
#!/usr/bin/perl
use strict;
use warnings;
use 5.12.0;
use YAPE::Regex::Explain;
my $record = <<EOF;
Say this is a page from a book.
There are multiple ways to do this, but this
is only one. Say we want to go from here
taking this text that goes all the way
to here, we could do this...
EOF
# get everything between 'from here' and
# 'to here' with a very simple regex.
my $regex = qr/from here(.*?)to here/ms;
$record =~ /$regex/;
say $1 if $1;
print YAPE::Regex::Explain->new( $regex )->explain();
| jmcveigh/komodo-tools | scripts/perl/cut_text/c.pl | Perl | bsd-2-clause | 513 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.