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
ent(200001740,200003763). ent(200001740,200003142). ent(200003595,200003142). ent(200010542,200009805). ent(200011570,200009805). ent(200012846,200009805). ent(200026062,200025612). ent(200037297,200032951). ent(200038285,200979316). ent(200039991,200038285). ent(200041553,200038285). ent(200041915,200041553). ent(200042237,200038285). ent(200042383,201352850). ent(200043683,200043841). ent(200055849,201578434). ent(200056004,200054862). ent(200067743,201249365). ent(200101196,200796419). ent(200144780,200144395). ent(200170705,200169382). ent(200176221,200937788). ent(200178848,200177962). ent(200220063,200887606). ent(200222992,200223888). ent(200243167,200244343). ent(200249246,200149731). ent(200250149,200158081). ent(200251084,200250254). ent(200252610,200259088). ent(200253017,200874035). ent(200256119,200256293). ent(200256119,200256707). ent(200258079,200259859). ent(200260683,200263340). ent(200260887,200310783). ent(200275897,200259859). ent(200276850,200147396). ent(200277320,201453160). ent(200280062,200279863). ent(200286340,200287213). ent(200287213,201368651). ent(200287585,201267341). ent(200288116,201268253). ent(200289068,201371248). ent(200298215,200103366). ent(200298386,200107371). ent(200341666,201316088). ent(200346915,200356023). ent(200350877,200163821). ent(200379434,200903723). ent(200403367,200397666). ent(200403563,200409147). ent(200403563,200403772). ent(200410090,200423416). ent(200412827,200401559). ent(200417676,200413589). ent(200426161,200423416). ent(200429256,200428321). ent(200432256,200430966). ent(200436631,200341143). ent(200438616,200440138). ent(200439864,200441099). ent(200440946,200440790). ent(200441099,200440138). ent(200442843,200440138). ent(200447862,200448015). ent(200452184,200494502). ent(200471410,200328742). ent(200471542,200475488). ent(200522959,200561647). ent(200525378,200547039). ent(200527377,200520277). ent(200533881,200534018). ent(200536087,200536527). ent(200536690,200536087). ent(200539391,201233236). ent(200543716,200598975). ent(200548039,200548199). ent(200549308,201270990). ent(200550221,200519543). ent(200560756,200452184). ent(200566099,200685210). ent(200581023,200452184). ent(200584733,200548199). ent(200585109,200584957). ent(200589053,200587904). ent(200593428,200554194). ent(200605041,200555115). ent(200609634,200609009). ent(200610047,200671307). ent(200612323,200452184). ent(200613686,200452184). ent(200613914,200613686). ent(200634158,200464775). ent(200634420,200632077). ent(200643108,200642112). ent(200650192,200649804). ent(200662608,200638109). ent(200669199,200652168). ent(200669398,200669199). ent(200674369,200548199). ent(200680786,200671763). ent(200690164,200689807). ent(200694753,200630586). ent(200698898,200698219). ent(200700989,200547364). ent(200712534,200638109). ent(200730350,200727813). ent(200732598,200727087). ent(200733279,200733647). ent(200735972,201325142). ent(200738369,200727087). ent(200740680,200740218). ent(200743671,200727087). ent(200744139,200727087). ent(200745640,200744139). ent(200753559,200727087). ent(200755341,200727087). ent(200755829,200730350). ent(200756166,200727813). ent(200758527,200756442). ent(200760677,201036035). ent(200765509,200738369). ent(200771084,200782363). ent(200771236,200769883). ent(200772104,200772389). ent(200783256,200782363). ent(200783551,200770753). ent(200785251,200727087). ent(200787825,200787073). ent(200790401,201138569). ent(200791535,200894764). ent(200791671,200894764). ent(200792410,200792261). ent(200794578,200817247). ent(200794578,200817727). ent(200797128,201569514). ent(200797570,200793267). ent(200799278,200796419). ent(200799929,200801099). ent(200800058,200786286). ent(200806992,200806715). ent(200807220,200795711). ent(200809681,200787825). ent(200812675,200793267). ent(200812675,200796419). ent(200812836,200801099). ent(200813321,200787073). ent(200813733,200813536). ent(200814571,200786286). ent(200814875,200814571). ent(200815217,200003763). ent(200815217,200003142). ent(200815671,200815217). ent(200816457,200815217). ent(200816767,200816880). ent(200817921,200817727). ent(200819436,200786286). ent(200823328,200820743). ent(200824290,200820743). ent(200828871,200828539). ent(200831685,200881672). ent(200839492,200061518). ent(200839492,200048850). ent(200839727,200852114). ent(200840974,200909621). ent(200846139,200048850). ent(200848495,200118898). ent(200849393,200852114). ent(200852114,200820743). ent(200854691,200852114). ent(200855099,200855412). ent(200855839,201069335). ent(200857380,200857882). ent(200868307,200909621). ent(200869864,201069335). ent(200873818,200960484). ent(200879090,200915832). ent(200893075,200893983). ent(200893840,200854691). ent(200894577,200894368). ent(200895827,200118898). ent(200903064,201069335). ent(200907105,200881999). ent(200908176,200907105). ent(200918314,201044340). ent(200923141,201044340). ent(200923454,200951804). ent(200925560,201397433). ent(200925695,201398059). ent(200926457,200915832). ent(200930588,200223888). ent(200936790,200907105). ent(200939634,201263706). ent(200939968,201278717). ent(200950091,200946301). ent(200951086,200852114). ent(200951184,200852114). ent(200952658,200992533). ent(200953839,200259088). ent(200956445,200852114). ent(200958408,200960484). ent(200972191,201003100). ent(200974283,200884615). ent(200974668,200836413). ent(200975083,200974668). ent(200979094,200977560). ent(200980523,200835355). ent(200981851,201263706). ent(200981851,201249365). ent(200982468,201262658). ent(200982881,201262658). ent(200983020,201371248). ent(200988164,201069335). ent(200989353,200857046). ent(200992230,200828539). ent(200999476,201086949). ent(201017466,200909621). ent(201045069,201073112). ent(201045661,200915832). ent(201046021,201301287). ent(201052666,201249365). ent(201053591,200847935). ent(201053698,200992533). ent(201057119,201056979). ent(201061500,200872449). ent(201061911,201352850). ent(201064160,201351432). ent(201064888,201352959). ent(201066360,200852114). ent(201068221,201072274). ent(201071376,201069335). ent(201074219,201069335). ent(201080585,200909621). ent(201080749,200909621). ent(201081810,200951804). ent(201082541,200988164). ent(201085085,201050168). ent(201087364,201086204). ent(201096237,200659537). ent(201097412,200291365). ent(201099125,200274169). ent(201122087,200281123). ent(201125635,201150202). ent(201127488,200977560). ent(201142763,200320369). ent(201143604,200223888). ent(201144692,201144127). ent(201144828,200222862). ent(201144937,200907105). ent(201145053,200907105). ent(201146010,200994488). ent(201147024,201144127). ent(201147136,201144127). ent(201147336,200907105). ent(201149445,201148908). ent(201154002,200987993). ent(201154313,200222621). ent(201154430,200259088). ent(201154777,200852114). ent(201155645,201156145). ent(201158924,201089750). ent(201160087,201089750). ent(201161694,201089750). ent(201161825,201089750). ent(201166173,201164896). ent(201172225,201173263). ent(201172225,201172990). ent(201172225,201173875). ent(201178115,201177316). ent(201182922,201180692). ent(201185569,201096854). ent(201186056,200005052). ent(201189939,201190265). ent(201190534,200894764). ent(201191006,200894764). ent(201195951,200187287). ent(201200071,201316559). ent(201210839,201210505). ent(201212775,201213391). ent(201212998,200454769). ent(201213391,200454501). ent(201217443,201215448). ent(201229372,200813536). ent(201229528,201226464). ent(201230365,201202849). ent(201230365,201227336). ent(201231606,201225879). ent(201239069,201238865). ent(201239331,201227336). ent(201241470,200589833). ent(201241953,201213391). ent(201266059,201416151). ent(201272526,201270990). ent(201278717,200992533). ent(201278717,201249365). ent(201286408,201392754). ent(201293338,201316088). ent(201295960,201295872). ent(201296740,201299603). ent(201299603,201316088). ent(201312143,201312034). ent(201312847,200832742). ent(201314376,200995437). ent(201315463,201325658). ent(201316315,201361796). ent(201317106,201331981). ent(201319726,201253107). ent(201320261,200938859). ent(201321024,201171148). ent(201321324,201320576). ent(201321667,201357794). ent(201322156,201323685). ent(201322778,201322256). ent(201323908,201322778). ent(201324029,201288660). ent(201325037,201340005). ent(201326758,201326973). ent(201331859,201323578). ent(201339823,201323578). ent(201339823,201336773). ent(201339823,201341375). ent(201357794,201301287). ent(201363605,201363279). ent(201370014,201340005). ent(201379952,201253107). ent(201381493,201253107). ent(201384702,200765817). ent(201384809,200765817). ent(201384929,201384199). ent(201391162,201391432). ent(201391776,201800838). ent(201393713,200872449). ent(201404337,201358414). ent(201406309,201314495). ent(201406309,201408362). ent(201407660,201408362). ent(201410999,201351846). ent(201418065,201414286). ent(201421708,200158081). ent(201422262,201262658). ent(201430118,201349856). ent(201441769,201442173). ent(201443215,201442173). ent(201449652,200009805). ent(201449939,201442173). ent(201450271,201442173). ent(201453784,201453160). ent(201454384,201453900). ent(201455682,201455581). ent(201455904,201455581). ent(201456213,201442173). ent(201456459,201456984). ent(201457770,201456984). ent(201458506,201457770). ent(201459428,201456984). ent(201472096,201457770). ent(201472212,201457770). ent(201483324,201457618). ent(201485853,201485693). ent(201498845,201485853). ent(201499632,201487855). ent(201501429,201500737). ent(201501559,201442173). ent(201511279,201540968). ent(201511279,200455018). ent(201513366,201530096). ent(201517466,201518274). ent(201520167,201263706). ent(201523426,201522764). ent(201535023,201505951). ent(201537888,201520768). ent(201538082,201535023). ent(201542252,201542388). ent(201543212,201520167). ent(201546679,201511279). ent(201546679,201535023). ent(201551195,201511279). ent(201556712,200760028). ent(201567391,201474374). ent(201568792,201073802). ent(201569388,201568792). ent(201571953,201545865). ent(201578874,201692292). ent(201584659,201585711). ent(201590088,201511279). ent(201599236,201590833). ent(201601206,201077449). ent(201605849,201585001). ent(201653732,201654097). ent(201654488,201654097). ent(201665336,200548199). ent(201676697,200602402). ent(201679448,200674764). ent(201679924,200551242). ent(201685323,201677599). ent(201688387,200540104). ent(201693484,200263886). ent(201695650,201695318). ent(201697383,201696280). ent(201702169,201718791). ent(201702169,200571723). ent(201702479,201532130). ent(201703421,200453556). ent(201704207,200548199). ent(201705170,201703421). ent(201721088,201725008). ent(201751275,201641924). ent(201753347,201752871). ent(201754557,201755765). ent(201761339,201718881). ent(201782943,201775163). ent(201785787,201782836). ent(201787039,201782836). ent(201787206,200062604). ent(201796443,201794357). ent(201802820,200464166). ent(201804260,201688387). ent(201804260,200540419). ent(201834058,200727087). ent(201857366,201210505). ent(201883959,200255423). ent(201885160,201885339). ent(201886178,201885866). ent(201892658,201883756). ent(201892970,201892477).
TeamSPoon/logicmoo_workspace
packs_sys/logicmoo_nlu/data/WNprolog-1.6/prolog/wn_ent.pl
Perl
mit
11,102
#!/usr/bin/env perl use strict; use Warnings::Version '5.6'; chmod 777, '10-version-5.006-chmod.tmp';
gitpan/Warnings-Version
t/10-helpers/chmod.pl
Perl
mit
104
# # 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 hardware::pdu::raritan::snmp::mode::components::sensor; use strict; use warnings; use hardware::pdu::raritan::snmp::mode::components::resources qw($mapping %raritan_type %map_type); sub load { my ($self, %options) = @_; push @{$self->{request}}, { oid => $mapping->{$options{type} . '_label'}->{Label}->{oid} }, { oid => $mapping->{$options{type}}->{Unit}->{oid} }, { oid => $mapping->{$options{type}}->{Decimal}->{oid} }, { oid => $mapping->{$options{type}}->{EnabledThresholds}->{oid} }, { oid => $mapping->{$options{type}}->{LowerCriticalThreshold}->{oid} }, { oid => $mapping->{$options{type}}->{LowerWarningThreshold}->{oid} }, { oid => $mapping->{$options{type}}->{UpperCriticalThreshold}->{oid} }, { oid => $mapping->{$options{type}}->{UpperWarningThreshold}->{oid} }, { oid => $mapping->{$options{type}}->{State}->{oid} }, { oid => $mapping->{$options{type}}->{Value}->{oid} }; } sub check { my ($self, %options) = @_; foreach my $component (sort keys %raritan_type) { my $long_msg = 0; next if ($component !~ /$options{component}/); $self->{components}->{$component} = {name => $component, total => 0, skip => 0}; next if ($self->check_filter(section => $component)); my $instance_type = $raritan_type{$component}; my $value_type = $map_type{$instance_type}; foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}})) { next if ($oid !~ /^$mapping->{$options{type}}->{State}->{oid}\.(\d+)\.(\d+)\.$instance_type$/); my $instance = $1 . '.' . $2 . '.' . $instance_type; my $result = $self->{snmp}->map_instance(mapping => $mapping->{$options{type}}, results => $self->{results}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping->{$options{type} . '_label'}, results => $self->{results}, instance => $1 . '.' . $2); $instance = defined($result2->{Label}) && $result2->{Label} ne '' ? $result2->{Label} : $1 . '.' . $2; next if ($self->check_filter(section => $component, instance => $instance)); if ($long_msg == 0) { $self->{output}->output_add(long_msg => "Checking " . $component); $long_msg = 1; } $self->{components}->{$component}->{total}++; my $value = (defined($result->{Value}) && $result->{Value} ne '') ? $result->{Value} : '-'; if ($value =~ /[0-9]/) { $value *= 10 ** -int($result->{Decimal}); } $self->{output}->output_add( long_msg => sprintf( "'%s' %s state is '%s' [instance: %s, value: %s, unit: %s, label: %s]", $instance, $component, $result->{State}, $instance, $value, $result->{Unit}->{unit}, $result2->{Label} ) ); my $exit = $self->get_severity( section => $component, label => $value_type, instance => $instance, value => $result->{State} ); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add( severity => $exit, short_msg => sprintf( "'%s' %s state is '%s'", $instance, $component, $result->{State} ) ); } if ($value =~ /[0-9]/) { next if ($value =~ /^0$/ && $result->{Unit}->{unit} eq ''); my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => $component, instance => $instance, value => $value); if ($checked == 0) { $result->{EnabledThresholds} = oct("0b". unpack('b*', $result->{EnabledThresholds})); my $warn_th; $warn_th = ($result->{LowerWarningThreshold} * 10 ** -int($result->{Decimal})) . ':' if (($result->{EnabledThresholds} & (1 << 1))); if (($result->{EnabledThresholds} & (1 << 2))) { if (defined($warn_th)) { $warn_th .= ($result->{UpperWarningThreshold} * 10 ** -int($result->{Decimal})); } else { $warn_th = '~:' . ($result->{UpperWarningThreshold} * 10 ** -int($result->{Decimal})); } } my $crit_th; $crit_th = ($result->{LowerCriticalThreshold} * 10 ** -int($result->{Decimal})) . ':' if (($result->{EnabledThresholds} & (1 << 0))); if (($result->{EnabledThresholds} & (1 << 3))) { if (defined($crit_th)) { $crit_th .= ($result->{UpperCriticalThreshold} * 10 ** -int($result->{Decimal})); } else { $crit_th = '~:' . ($result->{UpperCriticalThreshold} * 10 ** -int($result->{Decimal})); } } $self->{perfdata}->threshold_validate(label => 'warning-' . $component . '-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'critical-' . $component . '-instance-' . $instance, value => $crit_th); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $component . '-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $component . '-instance-' . $instance); } if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { $self->{output}->output_add( severity => $exit2, short_msg => sprintf( "'%s' %s value is %s %s", $instance, $component, $value, $result->{Unit}->{unit} ) ); } my $nunit = (defined($result->{Unit}->{nunit}) ? $result->{Unit}->{nunit} : lc($result->{Unit}->{unit})); $self->{output}->perfdata_add( label => $component, unit => $result->{Unit}->{unit}, nlabel => 'hardware.sensor.' . $options{type} . '.' . lc($component) . '.' . $nunit, instances => $instance, value => $value, warning => $warn, critical => $crit ); } } } } 1;
Tpo76/centreon-plugins
hardware/pdu/raritan/snmp/mode/components/sensor.pm
Perl
apache-2.0
7,519
# OpenXPKI::Server::Workflow::Activity::CSR:GenerateKey: # Written by Alexander Klink for the OpenXPKI project 2006 # Rewritten by Julia Dubenskaya for the OpenXPKI project 2007 # Copyright (c) 2006-2007 by The OpenXPKI Project package OpenXPKI::Server::Workflow::Activity::CSR::GenerateKey; use strict; use base qw( OpenXPKI::Server::Workflow::Activity ); use OpenXPKI::Server::Context qw( CTX ); use OpenXPKI::Exception; use OpenXPKI::Debug; use OpenXPKI::Serialization::Simple; use Data::Dumper; sub execute { my $self = shift; my $workflow = shift; my $context = $workflow->context(); my $default_token = CTX('api')->get_default_token(); my $key_type = $context->param('_key_type'); ##! 16: 'key_type: ' . $key_type my $password = $context->param('_password'); # password check if (! defined $password || $password eq '') { OpenXPKI::Exception->throw( message => 'I18N_OPENXPKI_SERVER_WORKFLOW_ACTIVITY_CSR_GENERATEKEY_MISSING_OR_EMPTY_PASSWORD', ); } my $supported_algs = $default_token->command({COMMAND => "list_algorithms", FORMAT => "all_data"}); # keytype check if (! exists $supported_algs->{$key_type}) { OpenXPKI::Exception->throw( message => 'I18N_OPENXPKI_SERVER_WORKFLOW_ACTIVITY_CSR_GENERATEKEY_WRONG_KEYTYPE', params => { 'KEYTYPE' => $key_type, }, ); } my $serializer = OpenXPKI::Serialization::Simple->new({SEPARATOR => "-"}); my $context_parameters = $context->param('_key_gen_params'); if (! defined $context_parameters) { OpenXPKI::Exception->throw( message => 'I18N_OPENXPKI_SERVER_WORKFLOW_ACTIVITY_CSR_GENERATEKEY_MISSING_PARAMETERS', ); } my $parameters = $serializer->deserialize($context_parameters); # parameters check my ($param, $value, $param_values) = ("","","undef"); while (($param, $value) = each(%{$parameters})) { if (! exists $supported_algs->{$key_type}->{$param}) { OpenXPKI::Exception->throw( message => 'I18N_OPENXPKI_SERVER_WORKFLOW_ACTIVITY_CSR_GENERATEKEY_UNSUPPORTED_PARAMNAME', params => { 'KEYTYPE' => $key_type, 'PARAMNAME' => $param, } ); } # if param name is not supported $param_values = $default_token->command({COMMAND => "list_algorithms", FORMAT => "param_values", ALG => $key_type, PARAM => $param}); if (! exists $param_values->{$value}) { OpenXPKI::Exception->throw( message => 'I18N_OPENXPKI_SERVER_WORKFLOW_ACTIVITY_CSR_GENERATEKEY_UNSUPPORTED_PARAMVALUE', params => { 'KEYTYPE' => $key_type, 'PARAMNAME' => $param, 'PARAMVALUE' => $value, } ); } # if param value is not supported } # while each(%{$parameters}) # command definition my $command = { COMMAND => 'create_key', TYPE => $key_type, PASSWD => $password, PARAMETERS => $parameters, }; ##! 16: 'command: ' . Dumper $command my $key = $default_token->command($command); ##! 16: 'key: ' . $key CTX('log')->log( MESSAGE => 'Created ' . $key_type . ' private key for ' . $context->param('creator'), PRIORITY => 'info', FACILITY => 'audit', ); $context->param('private_key' => $key); # pass on the password to the PKCS#10 generation activity $context->param('_password' => $password); return 1; } 1; __END__ =head1 Name OpenXPKI::Server::Workflow::Activity::CSR::GenerateKey =head1 Description Creates a new (encrypted) private key with the given parameters _key_type and _password. _key_type is a symbolic name for a given key configuration, the details of which are defined in $params_map. The encrypted private key is written to the context parameter private_key, while the password is passed on in the volatile param '_password', as it is still needed for the PKCS#10 generation.
durko/openxpki
core/server/OpenXPKI/Server/Workflow/Activity/CSR/GenerateKey.pm
Perl
apache-2.0
4,438
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =head1 NAME Bio::EnsEMBL::Hive::RunnableDB::DumpMultiAlign::Readme =head1 SYNOPSIS This RunnableDB module is part of the DumpMultiAlign pipeline. =head1 DESCRIPTION This RunnableDB module generates a general README.{emf} file and a specific README for the multiple alignment being dumped =cut package Bio::EnsEMBL::Compara::RunnableDB::DumpMultiAlign::Readme; use strict; use warnings; use Cwd; use Text::Wrap; use Bio::EnsEMBL::Compara::Graph::NewickParser; use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable'); sub run { my $self = shift; # #Copy README.{format} to output_dir eg README.emf #Currently there is only a README.emf # my $from = $INC{"Bio/EnsEMBL/Compara/RunnableDB/DumpMultiAlign/Readme.pm"}; my $format = $self->param('format'); $from =~ s/Readme\.pm$/README.$format/; my $to = $self->param('output_dir'); my $cmd = "cp $from $to"; #Check README file and directory exist (do not for maf) if (-e $from && -e $to) { if(my $return_value = system($cmd)) { $return_value >>= 8; die "system( $cmd ) failed: $return_value"; } } #Create specific README file $self->_create_specific_readme(); } # #Internal methods # # #Create specific README file # sub _create_specific_readme { my ($self) = @_; #Note this is using the database set in $self->param('compara_db'). my $compara_dba = $self->compara_dba; #Get method_link_species_set my $mlss_adaptor = $compara_dba->get_MethodLinkSpeciesSetAdaptor; my $mlss = $mlss_adaptor->fetch_by_dbID($self->param('mlss_id')); #If dumping conservation scores, need to find associated multiple alignment #mlss if (($mlss->method->type) eq "GERP_CONSERVATION_SCORE") { $mlss = $mlss_adaptor->fetch_by_dbID($mlss->get_value_for_tag('msa_mlss_id')); } #Get tree and ordered set of genome_dbs my ($newick_species_tree, $species_set) = $self->_get_species_tree($mlss); my $filename = $self->param_required('readme_file'); open my $fh, '>', $filename || die ("Cannot open $filename"); $self->param('fh', $fh); if ($mlss->method->type eq "PECAN") { $self->_create_specific_pecan_readme($compara_dba, $mlss, $species_set, $newick_species_tree); } elsif ($mlss->method->type eq "EPO") { $self->_create_specific_epo_readme($compara_dba, $mlss, $species_set, $newick_species_tree); } elsif ($mlss->method->type eq "EPO_LOW_COVERAGE") { $self->_create_specific_epo_low_coverage_readme($compara_dba, $mlss, $species_set, $newick_species_tree, $mlss_adaptor); } elsif ($mlss->method->type eq "LASTZ_NET") { $self->_create_specific_pairaligner_readme($compara_dba, $mlss, $species_set, 'LastZ'); } elsif ($mlss->method->type eq "BLASTZ_NET") { $self->_create_specific_pairaligner_readme($compara_dba, $mlss, $species_set, 'BlastZ'); } elsif ($mlss->method->type eq 'TRANSLATED_BLAT_NET' ) { $self->_create_specific_pairaligner_readme($compara_dba, $mlss, $species_set, 'Translated Blat'); } else { die "I don't know how to generate a README for ".$mlss->method->type."\n"; } close($fh); } # # Get the species tree either from a file or the database. # Prune if necessary. # Convert genome_db_ids to species names if necessary # Return species_tree and ordered list of genome_dbs # sub _get_species_tree { my ($self, $mlss) = @_; my $ordered_species; my $species_tree = $mlss->species_tree; my $genome_dbs = $mlss->species_set->genome_dbs; return (undef, $genome_dbs) unless $species_tree; my $newick_species_tree = $species_tree->root->newick_format('ryo', '%{-n}:%{d}'); foreach my $leaf (@{$species_tree->root->get_all_sorted_leaves}) { push @$ordered_species, $leaf->genome_db; } return ($newick_species_tree, $ordered_species); } # #Create EPO README file # sub _create_specific_epo_readme { my ($self, $compara_dba, $mlss, $species_set, $newick_species_tree) = @_; $self->_print_header(scalar(@$species_set)."-way Enredo-Pecan-Ortheus (EPO) multiple alignments"); $self->_print_species_set("The set of species is:", $species_set); $self->_print_species_tree($newick_species_tree); $self->_print_paragraph("First, Enredo is used to build a set of co-linear regions between the genomes. Then Pecan aligns these whole set of sequences. Last, Ortheus uses the Pecan alignments to infer the ancestral sequences."); $self->_print_enredo_help(); $self->_print_pecan_help(); $self->_print_ortheus_help(); $self->_print_file_grouping_help(); $self->_print_format_helper($mlss); } # #Create EPO_LOW_COVERAGE README file # sub _create_specific_epo_low_coverage_readme { my ($self, $compara_dba, $mlss, $species_set, $newick_species_tree, $mlss_adaptor) = @_; my $high_coverage_mlss = $mlss_adaptor->fetch_by_dbID($mlss->get_value_for_tag('high_coverage_mlss_id')); my $high_coverage_species_set = $high_coverage_mlss->species_set->genome_dbs; my %high_coverage_species; foreach my $species (@$high_coverage_species_set) { $high_coverage_species{$species->dbID} = 1; } $self->_print_header(scalar(@$species_set)."-way Enredo-Pecan-Ortheus (EPO) multiple alignments"); #species_set is ordered so want to print out lists in the correct #phylogenetic order $self->_print_species_set( "The core set of species used for the " . @$high_coverage_species_set . "-way EPO alignment:", [grep {defined $high_coverage_species{$_->dbID}} @$species_set]); $self->_print_species_set( "And the extra 2X genomes are:", [grep {not defined $high_coverage_species{$_->dbID}} @$species_set]); $self->_print_species_tree($newick_species_tree); my $gdb_grouping = $self->compara_dba->get_GenomeDBAdaptor->fetch_by_dbID($self->param('genome_db_id')); my $species = lc $self->_get_species_common_name($gdb_grouping); $self->_print_paragraph("To build the " . @$high_coverage_species_set . "-way alignment, first, Enredo is used to build a set of co-linear regions between the genomes and then Pecan aligns these regions. Next, Ortheus uses the Pecan alignments to infer the ancestral sequences. Then the 2X genomes were mapped to the $species sequence using their pairwise BlastZ-net alignments. Any insertions in the 2X genomes were removed (ie no gaps were introduced into the $species sequence)."); $self->_print_enredo_help(); $self->_print_pecan_help(); $self->_print_ortheus_help(); $self->_print_gerp_help(); $self->_print_file_grouping_help(); $self->_print_format_helper($mlss); } # #Create PECAN README file # sub _create_specific_pecan_readme { my ($self, $compara_dba, $mlss, $species_set, $newick_species_tree) = @_; $self->_print_header(scalar(@$species_set)."-way Pecan multiple alignments"); $self->_print_species_set("The set of species was:", $species_set); $self->_print_species_tree($newick_species_tree); $self->_print_paragraph("First, Mercator is used to build a synteny map between the genomes and then Pecan builds alignments in these syntenic regions."); $self->_print_pecan_help(); $self->_print_gerp_help(); $self->_print_file_grouping_help(); $self->_print_format_helper($mlss); } # #Create PairAligner README file # sub _create_specific_pairaligner_readme { my ($self, $compara_dba, $mlss, $species_set, $aligner_name) = @_; my $full_pairwise_name = join(' vs ', map {lc $self->_get_species_description($_)} @$species_set); $self->_print_header("$full_pairwise_name $aligner_name pairwise alignments"); my $ref_species = $mlss->get_value_for_tag('reference_species'); my $ref_genome_db = $self->compara_dba->get_GenomeDBAdaptor->fetch_by_name_assembly($ref_species); my $common_species_name = lc $self->_get_species_common_name($ref_genome_db); $self->_print_paragraph("$common_species_name was used as the reference species. After running $aligner_name, the raw alignment blocks are chained according to their location in both genomes. During the final netting process, the best sub-chain is chosen in each region on the reference species."); $self->_print_file_grouping_help(); $self->_print_format_helper($mlss); } #### Utils ############## sub _get_species_common_name { my ($self, $genome_db) = @_; return $genome_db->db_adaptor->get_MetaContainer->get_common_name; } sub _get_species_description { my ($self, $genome_db) = @_; return sprintf('%s (%s)', $self->_get_species_common_name($genome_db), $genome_db->assembly); } sub _print_paragraph { my ($self, $text) = @_; local $Text::Wrap::columns = 100; $self->param('fh')->write( fill('', '', ucfirst $text)."\n\n" ); } sub _print_line { my ($self, $text) = @_; $self->param('fh')->write( (ucfirst $text)."\n" ); } sub _print_species_set { my ($self, $intro_text, $set) = @_; $self->_print_line($intro_text); foreach my $species (@$set) { $self->_print_line(" - ".(ucfirst $self->_get_species_description($species))); } $self->_print_line(""); } sub _print_species_tree { my ($self, $newick_species_tree) = @_; # The original layout was like this: #$newick_species_tree =~ s/\(/(\n/g; #$newick_species_tree =~ s/,/,\n/g; # but it's quite difficult to see the structure (there is no indentation) # This solution adds indentation my $c = -1; my %inc = ( '(' => 1, ')' => -1, ',' => 0 ); my $sep = " "; $newick_species_tree =~ s/([\(\)\,])/$1 eq ')' ? "\n".($sep x($c+=$inc{$1})).$1 : "$1\n".($sep x($c+=$inc{$1}))/eg; # There is an even more advanced solution, but I find it less readable # And the advantage of the previous solution is that it is still # newick-compatible... Very good for copy-paste ! #my $c = 0; #my $leaf = "+--"; #my $ind = "| "; #$newick_species_tree =~ s/([\(\)\,])/if($1 eq '(') {$c++; $leaf} elsif($1 eq ')') {$c--; "\n".${ind}x$c} else {"\n".${ind}x($c-1).$leaf}/eg; $self->_print_line("The species tree was:"); $self->_print_line($newick_species_tree); $self->_print_line("\n"); } ## Shared pieces of text ########################## sub _print_enredo_help { my ($self) = @_; $self->_print_paragraph("Enredo is a graph-based method. The initial graph is built from a mapping of a set of anchors on every genome. Note that each anchor can map several times on a single genome. Enredo uses this information to define co-linear regions. Read more about Enredo: https://github.com/jherrero/enredo"); } sub _print_pecan_help { my ($self) = @_; $self->_print_paragraph("Pecan is a global multiple sequence alignment program that makes practical the probabilistic consistency methodology for significant numbers of sequences of practically arbitrary length. As input it takes a set of sequences and a phylogenetic tree. The parameters and heuristics it employs are highly user configurable, it is written entirely in Java and also requires the installation of Exonerate. Read more about Pecan: http://hgwdev.cse.ucsc.edu/~benedict/code/Pecan.html"); } sub _print_ortheus_help { my ($self) = @_; $self->_print_paragraph("Ortheus is a probabilistic method for the inference of ancestor (a.k.a tree) alignments. The main contribution of Ortheus is the use of a phylogenetic model incorporating gaps to infer insertion and deletion events. Read more about Ortheus: http://hgwdev.cse.ucsc.edu/~benedict/code/Ortheus.html"); } sub _print_gerp_help { my ($self) = @_; $self->_print_paragraph("GERP scores the conservation of each position in the alignment and defines constrained elements based on these conservation scores. Read more about Gerp: http://mendel.stanford.edu/SidowLab/downloads/gerp/index.html"); } sub _print_file_grouping_help { my ($self) = @_; my $gdb_grouping = $self->compara_dba->get_GenomeDBAdaptor->fetch_by_dbID($self->param('genome_db_id')); my $common_species_name = lc $self->_get_species_common_name($gdb_grouping); my @par = (); if ($self->param('split_by_chromosome')) { push @par, "Alignments are grouped by $common_species_name chromosome, and then by coordinate system."; push @par, "Alignments containing duplications in $common_species_name are dumped once per duplicated segment."; push @par, "The files named *.other*." . $self->param('format') . " contain alignments that do not include any $common_species_name region."; } if ($self->param('split_size')) { push @par, "Each file contains up to " . $self->param('split_size') . " alignments."; } $self->_print_paragraph(join(" ", @par)); } sub _print_header { my ($self, $title) = @_; my $schema_version = $self->compara_dba->get_MetaContainer->get_schema_version(); $self->_print_paragraph("This directory contains all the $title corresponding to Release $schema_version of Ensembl (see http://www.ensembl.org for further details and credits about the Ensembl project)."); } sub _print_format_helper { my ($self, $mlss) = @_; if ($self->param('format') eq 'emf') { $self->_print_paragraph("An emf2maf parser is available with the ensembl compara API, in the scripts/dumps directory. Alternatively you can download it using the GitHub frontend: https://github.com/Ensembl/ensembl-compara/raw/master/scripts/dumps/emf2maf.pl"); } elsif ($self->param('format') eq 'maf') { my $txt = "The MAF format is described at https://cgwb.nci.nih.gov/FAQ/FAQformat.html#format5"; $txt .= "Please note that MAF format does not support conservation scores." if ($mlss->method->type eq 'EPO_LOW_COVERAGE') or ($mlss->method->type eq 'PECAN'); $self->_print_paragraph($txt); } } 1;
danstaines/ensembl-compara
modules/Bio/EnsEMBL/Compara/RunnableDB/DumpMultiAlign/Readme.pm
Perl
apache-2.0
14,760
# Copyright 2020, Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package Google::Ads::GoogleAds::V8::Services::AccountLinkService::MutateAccountLinkRequest; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = { customerId => $args->{customerId}, operation => $args->{operation}, partialFailure => $args->{partialFailure}, validateOnly => $args->{validateOnly}}; # Delete the unassigned fields in this object for a more concise JSON payload remove_unassigned_fields($self, $args); bless $self, $class; return $self; } 1;
googleads/google-ads-perl
lib/Google/Ads/GoogleAds/V8/Services/AccountLinkService/MutateAccountLinkRequest.pm
Perl
apache-2.0
1,197
# 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::CustomerLabelService::MutateCustomerLabelsResponse; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = { partialFailureError => $args->{partialFailureError}, results => $args->{results}}; # 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/CustomerLabelService/MutateCustomerLabelsResponse.pm
Perl
apache-2.0
1,129
# 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 apps::centreon::map::jmx::mode::brokerstats; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use Digest::MD5 qw(md5_hex); use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); sub custom_status_output { my ($self, %options) = @_; my $msg = sprintf("Packets Delta: %d [%d/%d]", $self->{result_values}->{diff_packets}, $self->{result_values}->{processed_packets}, $self->{result_values}->{received_packets}); return $msg; } sub custom_status_calc { my ($self, %options) = @_; $self->{result_values}->{received_packets} = $options{new_datas}->{$self->{instance} . '_ReceivedPackets'}; $self->{result_values}->{processed_packets} = $options{new_datas}->{$self->{instance} . '_ProcessedPackets'}; $self->{result_values}->{diff_packets} = $self->{result_values}->{received_packets} - $self->{result_values}->{processed_packets}; return 0; } sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'global', type => 0 }, ]; $self->{maps_counters}->{global} = [ { label => 'status', set => { key_values => [ { name => 'ReceivedPackets', diff => 1 }, { name => 'ProcessedPackets', diff => 1 } ], 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 => \&catalog_status_threshold, } }, { label => 'received-packets-rate', set => { key_values => [ { name => 'ReceivedPackets', diff => 1 } ], output_template => 'Received Packets: %.2f/s', per_second => 1, perfdatas => [ { label => 'received_packets_rate', value => 'ReceivedPackets_per_second', template => '%.2f', min => 0, unit => 'packets/s' }, ], } }, { label => 'processed-packets-rate', set => { key_values => [ { name => 'ProcessedPackets', diff => 1 } ], output_template => 'Processed Packets: %.2f/s', per_second => 1, perfdatas => [ { label => 'processed_packets_rate', value => 'ProcessedPackets_per_second', template => '%.2f', min => 0, unit => 'packets/s' }, ], } }, ]; } sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; $options{options}->add_options(arguments => { "filter-counters:s" => { name => 'filter_counters', default => '' }, "warning-status:s" => { name => 'warning_status', default => '' }, "critical-status:s" => { name => 'critical_status', default => '%{processed_packets} < %{received_packets}' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); } my $mbean_broker = "com.centreon.studio.map:type=broker,name=statistics"; sub manage_selection { my ($self, %options) = @_; $self->{cache_name} = "centreon_map_" . md5_hex($options{custom}->{url}) . '_' . $self->{mode} . '_' . (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); $self->{request} = [ { mbean => $mbean_broker } ]; my $result = $options{custom}->get_attributes(request => $self->{request}, nothing_quit => 0); $self->{global} = {}; $self->{global} = { ReceivedPackets => $result->{$mbean_broker}->{ReceivedPackets}, ProcessedPackets => $result->{$mbean_broker}->{ProcessedPackets}, }; } 1; __END__ =head1 MODE Check broker packets rate received and processed. Example: perl centreon_plugins.pl --plugin=apps::centreon::map::jmx::plugin --custommode=jolokia --url=http://10.30.2.22:8080/jolokia-war --mode=broker-stats =over 8 =item B<--filter-counters> Only display some counters (regexp can be used). (Example: --filter-counters='session') =item B<--warning-status> Set warning threshold for status. (Default: ''). Can use special variables like: %{processed_packets}, %{received_packets}, %{diff_packets}. =item B<--critical-status> Set critical threshold for status. (Default: '%{processed_packets} < %{received_packets}'). Can use special variables like: %{processed_packets}, %{received_packets}, %{diff_packets}. =item B<--warning-*> Threshold warning. Can be: 'received-packets-rate', 'processed-packets-rate'. =item B<--critical-*> Threshold critical. Can be: 'received-packets-rate', 'processed-packets-rate'. =back =cut
Sims24/centreon-plugins
apps/centreon/map/jmx/mode/brokerstats.pm
Perl
apache-2.0
5,792
=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>. =cut =head1 NAME Bio::EnsEMBL::IdMapping::TinyFeature - lightweight feature object =head1 SYNOPSIS This object isn't instantiated. See objects which inherit from it (TinyGene, TinyTranscript, etc.) for examples. =head1 DESCRIPTION This is the base class for the lightweight feature objects used by the stable Id maping application. For performance reasons, these objects are instantiated using a new_fast() method. The internal implementation is an arrayref (rather than the more common hashref), which optimises memory usage. There are no adaptors to fetch TinyFeatures from the database. You rather use the normal feature adaptors and then create the TinyFeatures from the heavy objects you get. The memory saving will therefore mainly take effect when serialising and reloading these objects. Also note that TinyFeatures don't have a slice attached to them - all location information (where required) is stored on the feature object directly. =head1 METHODS new_fast id stable_id version created_date modified_date to_string =cut package Bio::EnsEMBL::IdMapping::TinyFeature; # internal data structure (array indices): # # 0 dbID # 1 stable_id # 2 version # 3 created_date # 4 modified_date # # other instance variables differ by subclass implementation, so look there. use strict; use warnings; no warnings 'uninitialized'; use Bio::EnsEMBL::Utils::Exception qw(throw warning); =head2 new_fast Arg[1] : Arrayref $array_ref - the arrayref to bless into the new object Description : Constructor. Return type : Bio::EnsEMBL::IdMapping::TinyFeature implementing class Exceptions : none Caller : Bio::EnsEMBL::IdMapping::Cache Status : At Risk : under development =cut sub new_fast { my $class = shift; my $array_ref = shift; return bless $array_ref, $class; } =head2 id Arg[1] : (optional) Int - the feature's internal Id ("dbID") Description : Getter/setter for the feature's internal Id. Return type : Int Exceptions : none Caller : Bio::EnsEMBL::IdMapping::Cache Status : At Risk : under development =cut sub id { my $self = shift; $self->[0] = shift if (@_); return $self->[0]; } =head2 stable_id Arg[1] : (optional) String - the feature's stable Id Description : Getter/setter for the feature's stable Id. Return type : String Exceptions : none Caller : Bio::EnsEMBL::IdMapping::Cache Status : At Risk : under development =cut sub stable_id { my $self = shift; $self->[1] = shift if (@_); return $self->[1]; } =head2 version Arg[1] : (optional) Int - the feature's stable Id version Description : Getter/setter for the feature's stable Id version. Return type : Int Exceptions : none Caller : Bio::EnsEMBL::IdMapping::Cache Status : At Risk : under development =cut sub version { my $self = shift; $self->[2] = shift if (@_); return $self->[2]; } =head2 created_date Arg[1] : (optional) String - the feature's stable Id creation date Description : Getter/setter for the feature's stable Id creation date. Return type : String Exceptions : none Caller : Bio::EnsEMBL::IdMapping::Cache Status : At Risk : under development =cut sub created_date { my $self = shift; $self->[3] = shift if (@_); return $self->[3]; } =head2 modified_date Arg[1] : (optional) String - the feature's stable Id modification date Description : Getter/setter for the feature's stable Id modification date. Return type : String Exceptions : none Caller : Bio::EnsEMBL::IdMapping::Cache Status : At Risk : under development =cut sub modified_date { my $self = shift; $self->[4] = shift if (@_); return $self->[4]; } =head2 to_string Example : print LOG "Created ", $f->to_string, "\n"; Description : Prints a string representation of the feature for debug purposes. Return type : String Exceptions : none Caller : general Status : At Risk : under development =cut sub to_string { my $self = shift; return $self->id.':'.$self->stable_id.'.'.$self->version; } 1;
danstaines/ensembl
modules/Bio/EnsEMBL/IdMapping/TinyFeature.pm
Perl
apache-2.0
5,217
package Google::Ads::AdWords::v201809::ConstantDataService::ApiExceptionFault; use strict; use warnings; { # BLOCK to scope variables sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201809' } __PACKAGE__->__set_name('ApiExceptionFault'); __PACKAGE__->__set_nillable(); __PACKAGE__->__set_minOccurs(); __PACKAGE__->__set_maxOccurs(); __PACKAGE__->__set_ref(); use base qw( SOAP::WSDL::XSD::Typelib::Element Google::Ads::AdWords::v201809::ApiException ); } 1; =pod =head1 NAME Google::Ads::AdWords::v201809::ConstantDataService::ApiExceptionFault =head1 DESCRIPTION Perl data type class for the XML Schema defined element ApiExceptionFault from the namespace https://adwords.google.com/api/adwords/cm/v201809. A fault element of type ApiException. =head1 METHODS =head2 new my $element = Google::Ads::AdWords::v201809::ConstantDataService::ApiExceptionFault->new($data); Constructor. The following data structure may be passed to new(): $a_reference_to, # see Google::Ads::AdWords::v201809::ApiException =head1 AUTHOR Generated by SOAP::WSDL =cut
googleads/googleads-perl-lib
lib/Google/Ads/AdWords/v201809/ConstantDataService/ApiExceptionFault.pm
Perl
apache-2.0
1,094
# # 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 centreon::common::fortinet::fortigate::mode::clusterstatus; use base qw(centreon::plugins::mode); use strict; use warnings; my $oid_fgHaSystemMode = '.1.3.6.1.4.1.12356.101.13.1.1'; # '.0' to have the mode my $oid_fgHaStatsSerial = '.1.3.6.1.4.1.12356.101.13.2.1.1.2'; my $oid_fgHaStatsMasterSerial = '.1.3.6.1.4.1.12356.101.13.2.1.1.16'; my $oid_fgHaStatsSyncStatus = '.1.3.6.1.4.1.12356.101.13.2.1.1.12'; my %maps_ha_mode = ( 1 => 'standalone', 2 => 'activeActive', 3 => 'activePassive', ); my %maps_sync_status = ( 0 => 'not synchronized', 1 => 'synchronized', ); 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 => { "one-node-status:s" => { name => 'one_node_status', default => 'critical' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); if ($self->{output}->is_litteral_status(status => $self->{option_results}->{one_node_status}) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong one-node-status status option '" . $self->{option_results}->{one_node_status} . "'."); $self->{output}->option_exit(); } } sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; $self->{result} = $self->{snmp}->get_multiple_table(oids => [ { oid => $oid_fgHaSystemMode }, { oid => $oid_fgHaStatsMasterSerial }, { oid => $oid_fgHaStatsSerial }, { oid => $oid_fgHaStatsSyncStatus }, ], nothing_quit => 1); # Check if mode cluster my $ha_mode = $self->{result}->{$oid_fgHaSystemMode}->{$oid_fgHaSystemMode . '.0'}; my $ha_output = defined($maps_ha_mode{$ha_mode}) ? $maps_ha_mode{$ha_mode} : 'unknown'; $self->{output}->output_add(long_msg => 'High availabily mode is ' . $ha_output . '.'); if ($ha_mode == 1) { $self->{output}->output_add(severity => 'ok', short_msg => sprintf("No cluster configuration (standalone mode).")); } else { $self->{output}->output_add(severity => 'ok', short_msg => sprintf("Cluster status is ok.")); foreach my $key ($self->{snmp}->oid_lex_sort(keys %{$self->{result}->{$oid_fgHaStatsSerial}})) { next if ($key !~ /^$oid_fgHaStatsSerial\.([0-9]+)$/); if ($ha_mode == 3) { my $state = $self->{result}->{$oid_fgHaStatsMasterSerial}->{$oid_fgHaStatsMasterSerial . '.' . $1} eq '' ? 'master' : 'slave'; $self->{output}->output_add(long_msg => sprintf("Node '%s' is %s.", $self->{result}->{$oid_fgHaStatsSerial}->{$key}, $state)); } my $sync_status = $self->{result}->{$oid_fgHaStatsSyncStatus}->{$oid_fgHaStatsSyncStatus . '.' . $1}; next if (!defined($sync_status)); $self->{output}->output_add(long_msg => sprintf("Node '%s' sync-status is %s.", $self->{result}->{$oid_fgHaStatsSerial}->{$key}, $maps_sync_status{$sync_status})); if ($sync_status == 0) { $self->{output}->output_add(severity => 'critical', short_msg => sprintf("Node '%s' sync-status is %s.", $self->{result}->{$oid_fgHaStatsSerial}->{$key}, $maps_sync_status{$sync_status})); } } if (scalar(keys %{$self->{result}->{$oid_fgHaStatsSerial}}) == 1 && !$self->{output}->is_status(value => $self->{option_results}->{one_node_status}, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $self->{option_results}->{one_node_status}, short_msg => sprintf("Cluster with one node only")); } } $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check cluster status (FORTINET-FORTIGATE-MIB). =over 8 =item B<--one-node-status> Status if only one node (default: 'critical'). =back =cut
bcournaud/centreon-plugins
centreon/common/fortinet/fortigate/mode/clusterstatus.pm
Perl
apache-2.0
5,534
=head1 LICENSE Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =cut =head1 NAME Bio::EnsEMBL::Compara::RunnableDB::GeneTrees::CAFESpeciesTree =head1 SYNOPSIS =head1 DESCRIPTION This RunnableDB builds a CAFE-compliant species tree (binary & ultrametric with time units). =head1 INHERITANCE TREE Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable =head1 APPENDIX The rest of the documentation details each of the object methods. Internal methods are usually preceded with an underscore (_) =cut package Bio::EnsEMBL::Compara::RunnableDB::GeneTrees::CAFESpeciesTree; use strict; use Data::Dumper; use Scalar::Util qw(looks_like_number); use Bio::EnsEMBL::Compara::Graph::NewickParser; use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable'); sub param_defaults { return { 'tree_fmt' => '%{n}%{":"d}', 'pvalue_lim' => 0.01, 'label' => 'full_species_tree', }; } =head2 fetch_input Title : fetch_input Usage : $self->fetch_input Function : Fetches input data from database Returns : none Args : none =cut sub fetch_input { my ($self) = @_; $self->param_required('mlss_id'); my $speciesTree_Adaptor = $self->compara_dba->get_SpeciesTreeAdaptor(); $self->param('speciesTree_Adaptor', $speciesTree_Adaptor); my $genomeDB_Adaptor = $self->compara_dba->get_GenomeDBAdaptor(); $self->param('genomeDB_Adaptor', $genomeDB_Adaptor); my $NCBItaxon_Adaptor = $self->compara_dba->get_NCBITaxon(); # Adaptor?? $self->param('NCBItaxon_Adaptor', $NCBItaxon_Adaptor); my $CAFETree_Adaptor = $self->compara_dba->get_CAFEGeneFamilyAdaptor(); $self->param('cafeTree_Adaptor', $CAFETree_Adaptor); # my $full_species_tree = $self->get_species_tree_string($label); ## Now in Runnable::BaseRunnable my $full_species_tree = $self->compara_dba->get_SpeciesTreeAdaptor->fetch_by_method_link_species_set_id_label($self->param('mlss_id'), $self->param('label')); $self->param('full_species_tree', $full_species_tree); ## This is the full tree, not the string $self->param('tree_fmt', '%{n}%{":"d}'); # format for the tree my $cafe_species = eval $self->param('cafe_species'); $self->param('cafe_species', $cafe_species); if ((not defined $cafe_species) or ($cafe_species eq '') or (scalar(@{$cafe_species}) == 0)) { # No species for the tree. Make a full tree print STDERR "No species provided for the CAFE tree. I will take them all\n" if ($self->debug()); $self->param('cafe_species', undef); } return; } sub run { my ($self) = @_; my $species_tree = $self->param('full_species_tree'); my $species_tree_root = $species_tree->root; $species_tree_root->print_tree(0.2); my $species = $self->param('cafe_species'); my $fmt = $self->param('tree_fmt'); my $mlss_id = $self->param('mlss_id'); my $pvalue_lim = $self->param('pvalue_lim'); print STDERR Dumper $species if ($self->debug()); # my $eval_species_tree = Bio::EnsEMBL::Compara::Graph::NewickParser::parse_newick_into_tree($species_tree_string); $self->include_distance_to_parent($species_tree_root); $self->fix_ensembl_timetree_mya($species_tree_root); $self->ensembl_timetree_mya_to_distance_to_parent($species_tree_root); $self->include_names($species_tree_root); $self->ultrametrize($species_tree_root); my $binTree = $self->binarize($species_tree_root); $self->fix_zeros($binTree); my $cafe_tree_root; if (defined $species) { $cafe_tree_root = $self->prune_tree($binTree, $species); } else { $cafe_tree_root = $binTree; } if ($self->debug) { $self->check_tree($cafe_tree_root); } ## The modified tree is put back in the species tree object $species_tree->root($cafe_tree_root); # Store the tree (At this point, it is a species tree not a CAFE tree) my $speciesTree_Adaptor = $self->param('speciesTree_Adaptor'); my $cafe_tree_str = $cafe_tree_root->newick_format('ryo', $fmt); print STDERR "Tree to store:\n$cafe_tree_str\n" if ($self->debug); $species_tree->species_tree($cafe_tree_str); $species_tree->label('cafe'); $speciesTree_Adaptor->store($species_tree); } sub write_output { my ($self) = @_; } ############################# ## Internal methods ######### ############################# sub get_taxon_id_from_dbID { my ($self, $dbID) = @_; my $genomeDB_Adaptor = $self->param('genomeDB_Adaptor'); my $genomeDB = $genomeDB_Adaptor->fetch_by_dbID($dbID); return $genomeDB->taxon_id(); } sub is_in { my ($item, $arref) = @_; for my $elem (@$arref) { if ($item eq $elem) { return 1; } } return 0; } sub include_distance_to_parent { my ($self, $tree) = @_; my $NCBItaxon_Adaptor = $self->param('NCBItaxon_Adaptor'); my $nodes = $tree->get_all_nodes(); for my $node (@$nodes) { unless ($node->is_leaf) { my $taxon_id = $node->taxon_id(); my $ncbiTaxon = $NCBItaxon_Adaptor->fetch_node_by_taxon_id($taxon_id); my $mya = $ncbiTaxon->get_tagvalue('ensembl timetree mya'); for my $child (@{$node->children}) { if ($mya) { $child->distance_to_parent(int($mya)); } else { $child->distance_to_parent(0); } } } } } sub fix_ensembl_timetree_mya { my ($self, $tree) = @_; my $leaves = $tree->get_all_leaves(); for my $leaf (@$leaves) { fix_path($leaf); } } sub fix_path { my ($node) = @_; for (;;) { if ($node->has_parent()) { if ($node->parent->distance_to_parent() == 0) { $node = $node->parent; next; } if ($node->parent()->distance_to_parent() < $node->distance_to_parent()) { $node->distance_to_parent($node->parent()->distance_to_parent()) if ($node->parent->has_parent); ## The last if is because the root doesn't have proper mya set } } else { return } $node = $node->parent(); } } sub ensembl_timetree_mya_to_distance_to_parent { my ($self, $tree) = @_; my $leaves = $tree->get_all_leaves(); for my $leaf (@$leaves) { mya_to_dtp_1path($leaf); } } sub mya_to_dtp_1path { my ($node) = @_; my $d = 0; for (;;) { my $dtp = 0; if ($node->get_tagvalue('revised') eq 1) { if ($node->has_parent()) { $node = $node->parent(); next; } else { return; } } if ($node->distance_to_parent != 0 && $node->has_parent) { $dtp = $node->distance_to_parent - $d; } $node->distance_to_parent($dtp); $node->add_tag("revised", "1"); $d += $dtp; if ($node->has_parent()) { $node = $node->parent(); } else { return; } } } sub include_names { my ($self, $tree) = @_; my $genomeDB_Adaptor = $self->param('genomeDB_Adaptor'); my $leaves = $tree->get_all_leaves(); for my $leaf ( @$leaves ) { my $taxon_id = $leaf->taxon_id(); # $taxon_id =~ s/\*//g; my $genomeDB = $genomeDB_Adaptor->fetch_by_taxon_id($taxon_id); my $name = $genomeDB->name(); $name =~ s/_/\./g; $leaf->name($name); } } sub ultrametrize { my ($self, $tree) = @_; my $longest_path = get_longest_path($tree); my $leaves = $tree->get_all_leaves(); for my $leaf (@$leaves) { my $path = path_length($leaf); $leaf->distance_to_parent($leaf->distance_to_parent() + ($longest_path-$path)); } } sub get_longest_path { my ($tree) = @_; my $leaves = $tree->get_all_leaves(); my @paths; my $longest = -1; for my $leaf(@$leaves) { my $newpath = path_length($leaf); if ($newpath > $longest) { $longest = $newpath; } } return $longest; } sub binarize { my ($self, $orig_tree) = @_; my $newTree = $orig_tree->new(); $newTree->name('root'); $newTree->taxon_id($orig_tree->taxon_id); $newTree->genome_db_id($orig_tree->genome_db_id); $newTree->node_id('0'); _binarize($orig_tree, $newTree, {}); return $newTree; } sub _binarize { my ($origTree, $binTree, $taxon_ids) = @_; my $children = $origTree->children(); for my $child (@$children) { my $newNode = $child->new(); $newNode->taxon_id($child->taxon_id); $taxon_ids->{$child->parent->taxon_id}++; $newNode->genome_db_id($child->genome_db_id); # We make sure that we don't have spaces in the names of internal nodes (for example Testudines + Archosauria group) my $name = $child->name() || $child->taxon_id; $name =~ s/\ /./g; $newNode->name($name); $newNode->node_id($child->node_id()); $newNode->distance_to_parent($child->distance_to_parent()); # no parent!! $newNode->node_name($child->name); if (scalar @{$binTree->children()} > 1) { $child->disavow_parent(); my $newBranch = $child->new(); for my $c (@{$binTree->children()}) { $c->distance_to_parent(0); $newBranch->add_child($c); } $binTree->add_child($newBranch); $newBranch->name($newBranch->parent->name); $newBranch->taxon_id($newBranch->parent->taxon_id); $newBranch->genome_db_id($newBranch->parent->genome_db_id); my $suffix = $taxon_ids->{$newBranch->parent->taxon_id} ? ".dup" . $taxon_ids->{$newBranch->parent->taxon_id} : ""; $newBranch->node_name($newBranch->parent->name . $suffix); } $binTree->add_child($newNode); _binarize($child, $newNode, $taxon_ids); } } sub fix_zeros { my ($self, $tree) = @_; my $leaves = $tree->get_all_leaves(); for my $leaf (@$leaves) { fix_zeros_1($leaf); } } sub fix_zeros_1 { my ($node) = @_; my $to_add = 0; for (;;) { return unless ($node->has_parent()); my $dtp = $node->distance_to_parent(); if ($dtp == 0) { $to_add++; $node->distance_to_parent(1); } my $siblings = $node->siblings; die "too many siblings" if (scalar @$siblings > 1); $siblings->[0]->distance_to_parent($siblings->[0]->distance_to_parent() + $to_add); $node = $node->parent(); } } sub prune_tree { my ($self, $tree, $species_to_keep) = @_; my $leaves = $tree->get_all_leaves(); my %species_to_remove; for my $leaf (@$leaves) { my $name = $leaf->name(); $species_to_remove{$name} = 1; } for my $sp (@$species_to_keep) { delete $species_to_remove{$sp}; } my $newTree = remove_nodes($tree, [keys %species_to_remove]); return $newTree; } sub remove_nodes { my ($tree, $nodes) = @_; my $leaves = $tree->get_all_leaves(); for my $node (@$leaves) { if (is_in($node->name, $nodes)) { if ($node->has_parent()) { my $parent = $node->parent(); my $siblings = $node->siblings; if (scalar @$siblings > 1) { die "The tree is not binary"; } $node->disavow_parent(); if ($parent->has_parent) { ## We avoid having "_dup" nodes without no "_dup" versions if ($siblings->[0]->node_name =~ /_dup$/) { $siblings->[0]->node_name($parent->node_name); } my $grandpa = $parent->parent(); my $dtg = $parent->distance_to_parent(); $parent->disavow_parent(); my $newsdtp = $siblings->[0]->distance_to_parent() + $dtg; $grandpa->add_child($siblings->[0], $newsdtp); } else { $siblings->[0]->disavow_parent(); $tree=$siblings->[0]; } } } } return $tree; } sub check_tree { my ($self, $tree) = @_; if (is_ultrametric($tree)) { if ($self->debug()) { print STDERR "The tree is ultrametric\n"; } } else { die "The tree is NOT ultrametric\n"; } eval (is_binary($tree)); if ($@) { die $@; } else { if ($self->debug()) { print STDERR "The tree is binary\n"; } } } sub is_binary { my ($node) = @_; if ($node->is_leaf()) { return 0 } my $children = $node->children(); if (scalar @$children != 2) { my $name = $node->name(); die "Not binary in node $name\n"; } for my $child (@$children) { is_binary($child); } } sub is_ultrametric { my ($tree) = @_; my $leaves = $tree->get_all_leaves(); my $path = -1; for my $leaf (@$leaves) { my $newpath = path_length($leaf); if ($path == -1) { $path = $newpath; next; } if ($path == $newpath) { $path = $newpath; } else { return 0 } } return 1 } sub path_length { my ($node) = @_; print STDERR "PATH LENGTH FOR ", $node->taxon_id; my $d = 0; for (;;){ $d += $node->distance_to_parent(); if ($node->has_parent()) { $node = $node->parent(); } else { last; } } print STDERR " IS $d\n"; return $d; } 1;
dbolser-ebi/ensembl-compara
modules/Bio/EnsEMBL/Compara/RunnableDB/GeneTrees/CAFESpeciesTree.pm
Perl
apache-2.0
14,385
[ # homology description for set1, referred by --url1 { 'ortholog_one2one' => 1, 'ortholog_one2many' => 2, 'ortholog_many2many' => 3, 'inparalog' => 4 } , # homology description for set2, referred by --url2 { 'ortholog_one2one' => 1, 'apparent_ortholog_one2one' => 2, 'ortholog_one2many' => 3, 'ortholog_many2many' => 4, 'within_species_paralog' => 5, 'between_species_paralog' => 6 } #{ 'UBRH' => 1, # 'MBRH' => 2, # 'RHS' => 3, # 'YoungParalogues' => 4 } ] ;
adamsardar/perl-libs-custom
EnsemblAPI/ensembl-compara/scripts/compare/homology_diff.conf.pl
Perl
apache-2.0
480
#!/usr/local/bin/perl use strict; use Bio::EnsEMBL::Registry; use Getopt::Long; # Fetch a list of ENSG ids and get the protein alignment for them. Print # the alignment in clustalw format on a list of files my ($inputfile,$debug); GetOptions( 'i|input|inputfile:s' => \$inputfile, 'd|debug:s' => \$debug, ); Bio::EnsEMBL::Registry->load_registry_from_db (-host=>"ensembldb.ensembl.org", -user=>"anonymous"); my $human_gene_adaptor = Bio::EnsEMBL::Registry->get_adaptor ("Homo sapiens", "core", "Gene"); my $member_adaptor = Bio::EnsEMBL::Registry->get_adaptor ("Compara", "compara", "Member"); my $homology_adaptor = Bio::EnsEMBL::Registry->get_adaptor ("Compara", "compara", "Homology"); my $proteintree_adaptor = Bio::EnsEMBL::Registry->get_adaptor ("Compara", "compara", "ProteinTree"); open INPUT,"$inputfile" or die "$!\n"; my @gene_ids; while (<INPUT>) { chomp $_; next if ($_ !~ /ENSG0/); push @gene_ids, $_; } foreach my $gene_id (@gene_ids) { my $gene = $human_gene_adaptor-> fetch_by_stable_id($gene_id); my $member = $member_adaptor-> fetch_by_source_stable_id("ENSEMBLGENE",$gene->stable_id); unless (defined $member) { print "# No members for $gene_id\n"; next; } # Fetch the proteintree my $proteintree = $proteintree_adaptor-> fetch_by_gene_Member_root_id($member); unless (defined $proteintree) { print "# No alignment for $gene_id\n"; next; } # foreach my $leaf (@{$proteintree->get_all_leaves}) { # print $leaf->description, "\n"; # } # # Show the tree # print "\n", $proteintree->newick_format("display_label_composite"), "\n\n"; # print $proteintree->nhx_format("display_label_composite"), "\n\n"; # $proteintree->print_tree(10); # Get the protein multialignment and the back-translated CDS alignment my $protein_align = $proteintree->get_SimpleAlign; # my $cds_align = $proteintree->get_SimpleAlign(-cdna=>1); eval {require Bio::AlignIO;}; last if ($@); # We can use bioperl to print out the aln in fasta format my $filename = $gene->stable_id . ".clustalw"; my $stdout_alignio = Bio::AlignIO->new (-file => ">$filename", -format => 'clustalw'); $stdout_alignio->write_aln($protein_align); print "# Alignment $filename\n"; # We can print out the aln in phylip format, with a space between # each codon (tag_length = 3) # my $phylip_alignio = Bio::AlignIO->new # (-file => ">$filename", # -format => 'clustalw'); # $phylip_alignio->write_aln($cds_align); # print STDERR "Your file $filename has been generated\n"; }
adamsardar/perl-libs-custom
EnsemblAPI/ensembl-compara/scripts/examples/homology13.pl
Perl
apache-2.0
2,629
package VMOMI::ArrayOfDatacenterMismatchArgument; use parent 'VMOMI::ComplexType'; use strict; use warnings; our @class_ancestors = ( ); our @class_members = ( ['DatacenterMismatchArgument', 'DatacenterMismatchArgument', 1, 1], ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
stumpr/p5-vmomi
lib/VMOMI/ArrayOfDatacenterMismatchArgument.pm
Perl
apache-2.0
456
package Math::Util::CalculatedValue::Validatable; use Moose; use MooseX::NonMoose; extends 'Math::Util::CalculatedValue'; with 'MooseX::Role::Validatable'; =head1 NAME Math::Util::CalculatedValue::Validatable - math adjustment, which can containe another adjustments with validation =head1 DESCRIPTION Represents an adjustment to a value (which can contain additional adjustments) with validation. =cut ## VERSION =head1 SYNOPSIS my $tid = Math::Util::CalculatedValue::Validatable->new({ name => 'time_in_days', description => 'Duration in days', set_by => 'Contract', base_amount => 0, }); my $tiy = Math::Util::CalculatedValue::Validatable->new({ name => 'time_in_years', description => 'Duration in years', set_by => 'Contract', base_amount => 1, }); my $dpy = Math::Util::CalculatedValue::Validatable->new({ name => 'days_per_year', description => 'days in a year', set_by => 'Contract', base_amount => 365, }); $tid->include_adjustment('reset', $tiy); $tid->include_adjustment('multiply', $dpy); print $tid->amount; =head2 BUILD Bulder args to add validation method =cut sub BUILD { my $self = shift; $self->{validation_methods} = [qw(_validate_all_sub_adjustments)]; return; } sub _validate_all_sub_adjustments { my $self = shift; my @errors; foreach my $cv (map { $_->[1] } @{$self->adjustments}) { push @errors, $cv->all_errors unless ($cv->confirm_validity); } return @errors; } =head1 AUTHOR binary.com, C<< <rakesh at binary.com> >> =head1 BUGS Please report any bugs or feature requests to C<bug-math-util-calculatedvalue at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-Util-CalculatedValue>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Math::Util::CalculatedValue You can also look for information at: =over 4 =item * RT: CPAN's request tracker (report bugs here) L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Math-Util-CalculatedValue> =item * AnnoCPAN: Annotated CPAN documentation L<http://annocpan.org/dist/Math-Util-CalculatedValue> =item * CPAN Ratings L<http://cpanratings.perl.org/d/Math-Util-CalculatedValue> =item * Search CPAN L<http://search.cpan.org/dist/Math-Util-CalculatedValue/> =back =head1 ACKNOWLEDGEMENTS =cut no Moose; __PACKAGE__->meta->make_immutable; 1; # End of Math::Util::CalculatedValue::Validatable
binary-com/perl-Math-Util-CalculatedValue
lib/Math/Util/CalculatedValue/Validatable.pm
Perl
apache-2.0
2,711
package resources::compute; use strict; use warnings; no warnings('once'); use MGRAST::Analysis; use List::MoreUtils qw(any uniq); use File::Temp qw(tempfile tempdir); use Conf; use parent qw(resources::resource); # Override parent constructor sub new { my ($class, @args) = @_; # Call the constructor of the parent class my $self = $class->SUPER::new(@args); # Add name / attributes $self->{name} = "compute"; $self->{example} = '"columns": ["mgm4441619.3","mgm4441656.4","mgm4441680.3","mgm4441681.3"], "rows": ["Eukaryota","Bacteria","Archaea"], "data": [[135,410,848,1243],[4397,6529,71423,204413],[1422,2156,874,1138]]'; $self->{attributes} = { alphadiversity => { "id" => [ "string", "unique metagenome identifier" ], "url" => [ "string", "resource location of this object instance" ], "data" => [ 'float', 'alpha diversity value' ] }, normalize => { 'data' => ['list', ['list', ['float', 'normalized value']]], 'rows' => ['list', ['string', 'row id']], 'columns' => ['list', ['string', 'column id']] }, significance => { 'data' => ['list', ['list', ['float', 'significance value']]], 'rows' => ['list', ['string', 'row name']], 'columns' => ['list', ['string', 'column name']] }, distance => { 'data' => ['list', ['list', ['float', 'distance value']]], 'rows' => ['list', ['string', 'row id']], 'columns' => ['list', ['string', 'column id']] }, heatmap => { 'data' => ['list', ['list', ['float', 'normalized value']]], 'rows' => ['list', ['string', 'row id']], 'columns' => ['list', ['string', 'column id']], 'colindex' => ['list', ['float', 'column id index']], 'rowindex' => ['list', ['float', 'row id index']], 'coldend' => ['object', 'dendrogram object for columns'], 'rowdend' => ['object', 'dendrogram object for rows'] }, pcoa => { 'data' => [ 'list', ['object', [ {'id' => ['string', 'column id'], 'pco' => ['list', ['float', 'principal component value']]}, "pcoa object" ] ] ], 'pco' => ['list', ['float', 'average principal component value']] } }; $self->{norm} = ["DESeq_blind","standardize","quantile","DESeq_per_condition","DESeq_pooled","DESeq_pooled_CR"]; $self->{distance} = ["bray-curtis", "euclidean", "maximum", "manhattan", "canberra", "minkowski", "difference"]; $self->{cluster} = ["ward", "single", "complete", "mcquitty", "median", "centroid"]; $self->{significance} = ["Kruskal-Wallis", "t-test-paired", "Wilcoxon-paired", "t-test-unpaired", "Mann-Whitney-unpaired-Wilcoxon", "ANOVA-one-way"]; return $self; } # resource is called without any parameters # this method must return a description of the resource sub info { my ($self) = @_; my $content = { 'name' => $self->name, 'url' => $self->cgi->url."/".$self->name, 'description' => "Calculate various statistics for given input data.", 'type' => 'object', 'documentation' => $self->cgi->url.'/api.html#'.$self->name, 'requests' => [ { 'name' => "info", 'request' => $self->cgi->url."/".$self->name, 'description' => "Returns description of parameters and attributes.", 'method' => "GET", 'type' => "synchronous", 'attributes' => "self", 'parameters' => { 'options' => {}, 'required' => {}, 'body' => {} } }, { 'name' => "alphadiversity", 'request' => $self->cgi->url."/".$self->name."/alphadiversity/{ID}", 'description' => "Calculate alpha diversity value for given ID and taxon level.", 'example' => [ $self->cgi->url."/".$self->name."/alphadiversity/mgm4447943.3?level=order", "retrieve alpha diversity for order taxon" ], 'method' => "GET", 'type' => "synchronous", 'attributes' => $self->{attributes}{alphadiversity}, 'parameters' => { 'options' => { 'level' => [ 'cv', $self->hierarchy->{organism} ], 'source' => [ 'cv', [@{$self->source->{protein}}, @{$self->source->{rna}}] ] }, 'required' => { 'id' => ["string", "unique object identifier"] }, 'body' => {} } }, { 'name' => "normalize", 'request' => $self->cgi->url."/".$self->name."/normalize", 'description' => "Calculate normalized values for given input data.", 'example' => [ 'curl -X POST -d \'{'.$self->{example}.'}\' "'.$self->cgi->url."/".$self->name.'/normalize"', "retrieve normalized values for input abundances" ], 'method' => "POST", 'type' => "synchronous", 'attributes' => $self->{attributes}{normalize}, 'parameters' => { 'options' => {}, 'required' => {}, 'body' => { "data" => ['list', ['list', ['int', 'raw value']]], "rows" => ['list', ['string', 'row id']], "columns" => ['list', ['string', 'column id']], "norm" => ['cv', [map {[$_, $_." normalization method"]} @{$self->{norm}}]] } } }, { 'name' => "significance", 'request' => $self->cgi->url."/".$self->name."/significance", 'description' => "Calculate significance values for given input data.", 'example' => [ 'curl -X POST -d \'{"test":"Kruskal-Wallis","groups":["whale","whale","cow","cow"],'.$self->{example}.'}\' "'.$self->cgi->url."/".$self->name.'/significance"', "retrieve significance values for input abundances and groups using the 'Kruskal-Wallis' significance test" ], 'method' => "POST", 'type' => "synchronous", 'attributes' => $self->{attributes}{significance}, 'parameters' => { 'options' => {}, 'required' => {}, 'body' => { "data" => ['list', ['list', ['int', 'raw value']]], "rows" => ['list', ['string', 'row id']], "columns" => ['list', ['string', 'column id']], "groups" => ['list', ['string', 'group name']], "test" => ['cv', [map {[$_, $_." significance testing method"]} @{$self->{significance}}]], "norm" => ['cv', [map {[$_, $_." normalization method"]} @{$self->{norm}}]], "raw" => ["boolean", "option to use raw data (not normalize)"] } } }, { 'name' => "distance", 'request' => $self->cgi->url."/".$self->name."/distance", 'description' => "Calculate a distance matrix for given input data.", 'example' => [ 'curl -X POST -d \'{distance":"euclidean",'.$self->{example}.'}\' "'.$self->cgi->url."/".$self->name.'/distance"', "retrieve distance matrix of normalized input abundances using 'euclidean' distance method" ], 'method' => "POST", 'type' => "synchronous", 'attributes' => $self->{attributes}{distance}, 'parameters' => { 'options' => {}, 'required' => {}, 'body' => { "data" => ['list', ['list', ['float', 'raw or normalized value']]], "rows" => ['list', ['string', 'row id']], "columns" => ['list', ['string', 'column id']], "distance" => ['cv', [map {[$_, $_." distance method"]} @{$self->{distance}}]], "norm" => ['cv', [map {[$_, $_." normalization method"]} @{$self->{norm}}]], "raw" => ["boolean", "option to use raw data (not normalize)"] } } }, { 'name' => "heatmap", 'request' => $self->cgi->url."/".$self->name."/heatmap", 'description' => "Calculate a dendrogram for given input data.", 'example' => [ 'curl -X POST -d \'{"raw":0,"cluster":"mcquitty",'.$self->{example}.'}\' "'.$self->cgi->url."/".$self->name.'/heatmap"', "retrieve dendrogram of normalized input abundances using 'mcquitty' cluster method" ], 'method' => "POST", 'type' => "synchronous", 'attributes' => $self->{attributes}{heatmap}, 'parameters' => { 'options' => {}, 'required' => {}, 'body' => { "data" => ['list', ['list', ['float', 'raw or normalized value']]], "rows" => ['list', ['string', 'row id']], "columns" => ['list', ['string', 'column id']], "cluster" => ['cv', [map {[$_, $_." cluster method"]} @{$self->{cluster}}]], "distance" => ['cv', [map {[$_, $_." distance method"]} @{$self->{distance}}]], "norm" => ['cv', [map {[$_, $_." normalization method"]} @{$self->{norm}}]], "raw" => ["boolean", "option to use raw data (not normalize)"] } } }, { 'name' => "pcoa", 'request' => $self->cgi->url."/".$self->name."/pcoa", 'description' => "Calculate a PCoA for given input data.", 'example' => [ 'curl -X POST -d \'{"raw":1,"distance":"euclidean",'.$self->{example}.'}\' "'.$self->cgi->url."/".$self->name.'/pcoa"', "retrieve PCO of raw input abundances using 'euclidean' distance method" ], 'method' => "POST", 'type' => "synchronous", 'attributes' => $self->{attributes}{pcoa}, 'parameters' => { 'options' => {}, 'required' => {}, 'body' => { "data" => ['list', ['list', ['float', 'raw or normalized value']]], "rows" => ['list', ['string', 'row id']], "columns" => ['list', ['string', 'column id']], "distance" => ['cv', [map {[$_, $_." distance method"]} @{$self->{distance}}]], "norm" => ['cv', [map {[$_, $_." normalization method"]} @{$self->{norm}}]], "raw" => ["boolean", "option to use raw data (not normalize)"] } } } ] }; $self->return_data($content); } # Override parent request function sub request { my ($self) = @_; # determine sub-module to use if (scalar(@{$self->rest}) == 0) { $self->info(); } elsif (($self->rest->[0] eq 'alphadiversity') && $self->rest->[1]) { $self->diversity_compute($self->rest->[1]); } elsif (any {$self->rest->[0] eq $_} ('normalize', 'significance', 'distance', 'heatmap', 'pcoa')) { $self->abundance_compute($self->rest->[0]); } elsif (any {$self->rest->[0] eq $_} ('stats', 'drisee', 'kmer')) { $self->sequence_compute($self->rest->[0]); } else { $self->info(); } } sub sequence_compute { my ($self, $type) = @_; $self->return_data( {"ERROR" => "compute request $type is not currently available"}, 404 ); } sub diversity_compute { my ($self, $mgid) = @_; # check id format my (undef, $id) = $mgid =~ /^(mgm)?(\d+\.\d+)$/; if (! $id) { $self->return_data( {"ERROR" => "invalid id format: " . $mgid}, 400 ); } # paramaters my $level = $self->cgi->param('level') || 'species'; my $source = $self->cgi->param('source') || 'RefSeq'; # initialize analysis obj with mgid my $master = $self->connect_to_datasource(); my $mgdb = MGRAST::Analysis->new( $master->db_handle ); unless (ref($mgdb)) { $self->return_data({"ERROR" => "could not connect to analysis database"}, 500); } $mgdb->set_jobs([$id]); my @alpha = values %{ $mgdb->get_rarefaction_curve([$source], 1, $level) }; if (@alpha != 1) { $self->return_data({"ERROR" => "unable to calculate alpha diversity"}, 500); } my $data = { id => 'mgm'.$id, url => $self->cgi->url.'/alphadiversity/mgm'.$id.'?level='.$level.'&source='.$source, data => sprintf("%.3f", $alpha[0]) }; $self->return_data($data); } sub abundance_compute { my ($self, $type) = @_; # paramaters my $raw = $self->cgi->param('raw') || 0; my $test = $self->cgi->param('test') || 'Kruskal-Wallis'; my $norm = $self->cgi->param('norm') || 'DESeq_blind'; my $cluster = $self->cgi->param('cluster') || 'ward'; my $distance = $self->cgi->param('distance') || 'bray-curtis'; my $groups = $self->cgi->param('groups') ? [split(/,/, $self->cgi->param('groups'))] : []; my $infile = ''; # posted data my $post_data = $self->cgi->param('POSTDATA') ? $self->cgi->param('POSTDATA') : join("", $self->cgi->param('keywords')); if ($post_data) { my ($data, $col, $row) = ([], [], []); eval { my $json_data = $self->json->decode($post_data); if (exists $json_data->{raw}) { $raw = $json_data->{raw}; } if (exists $json_data->{test}) { $test = $json_data->{test}; } if (exists $json_data->{norm}) { $norm = $json_data->{norm}; } if (exists $json_data->{cluster}) { $cluster = $json_data->{cluster}; } if (exists $json_data->{distance}) { $distance = $json_data->{distance}; } $data = $json_data->{data}; $col = $json_data->{columns}; $row = $json_data->{rows}; $groups = exists($json_data->{groups}) ? $json_data->{groups} : []; }; if ($@ || (@$data == 0)) { $self->return_data( {"ERROR" => "unable to obtain POSTed data: ".$@}, 500 ); } if (scalar(@$col) < 2) { $self->return_data( {"ERROR" => "a minimum of 2 columns are required"}, 400 ); } if (scalar(@$row) < 2) { $self->return_data( {"ERROR" => "a minimum of 2 rows are required"}, 400 ); } if ($type eq 'significance') { if (scalar(@$groups) < 3) { $self->return_data( {"ERROR" => "a minimum of 3 groups are required"}, 400 ); } if (scalar(@$groups) != scalar(@$col)) { $self->return_data( {"ERROR" => "number of groups must match number of columns"}, 400 ); } } # transform POSTed json to input file format my ($tfh, $tfile) = tempfile($type."XXXXXXX", DIR => $Conf::temp, SUFFIX => '.txt'); eval { print $tfh "\t".join("\t", @$col)."\n"; for (my $i=0; $i<scalar(@$data); $i++) { print $tfh $row->[$i]."\t".join("\t", @{$data->[$i]})."\n"; } }; if ($@) { $self->return_data( {"ERROR" => "POSTed data format is invalid: ".$@}, 500 ); } close $tfh; chmod 0666, $tfile; $infile = $tfile; # data sent in file upload } elsif ($self->cgi->param('data')) { $infile = $self->form_file('data', $type, 'txt'); } else { $self->return_data( {"ERROR" => "POST request missing data"}, 400 ); } # check cv unless (any {$_ eq $test} @{$self->{significance}}) { $self->return_data({"ERROR" => "test '$test' is invalid, use one of: ".join(",", @{$self->{significance}})}, 400); } unless (any {$_ eq $norm} @{$self->{norm}}) { $self->return_data({"ERROR" => "norm '$norm' is invalid, use one of: ".join(",", @{$self->{norm}})}, 400); } unless (any {$_ eq $cluster} @{$self->{cluster}}) { $self->return_data({"ERROR" => "cluster '$cluster' is invalid, use one of: ".join(",", @{$self->{cluster}})}, 400); } unless (any {$_ eq $distance} @{$self->{distance}}) { $self->return_data({"ERROR" => "distance '$distance' is invalid, use one of: ".join(",", @{$self->{distance}})}, 400); } my $data; # nomalize if ($type eq 'normalize') { $data = $self->normalize($infile, $norm, 1); } # significance elsif ($type eq 'significance') { if (! $raw) { $infile = $self->normalize($infile, $norm); } $data = $self->significance($infile, $groups, $test, 1); } # distance elsif ($type eq 'distance') { if (! $raw) { $infile = $self->normalize($infile, $norm); } $data = $self->distance($infile, $distance, 1); } # heatmap elsif ($type eq 'heatmap') { if (! $raw) { $infile = $self->normalize($infile, $norm); } $data = $self->heatmap($infile, $distance, $cluster, 1); } # pcoa elsif ($type eq 'pcoa') { if (! $raw) { $infile = $self->normalize($infile, $norm); } $data = $self->pcoa($infile, $distance, 1); } $self->return_data($data); } sub form_file { my ($self, $param, $prefix, $suffix) = @_; my $infile = ''; my $fname = $self->cgi->param($param); if ($fname) { if ($fname =~ /\.\./) { $self->return_data({"ERROR" => "Invalid parameters, trying to change directory with filename, aborting"}, 400); } if ($fname !~ /^[\w\d_\.]+$/) { $self->return_data({"ERROR" => "Invalid parameters, filename allows only word, underscore, dot (.), and number characters"}, 400); } my $fhdl = $self->cgi->upload($param); if (defined $fhdl) { my ($bytesread, $buffer); my $io_handle = $fhdl->handle; my ($tfh, $tfile) = tempfile($prefix."XXXXXXX", DIR => $Conf::temp, SUFFIX => '.'.$suffix); while ($bytesread = $io_handle->read($buffer, 4096)) { print $tfh $buffer; } close $tfh; chmod 0666, $tfile; $infile = $tfile; } else { $self->return_data({"ERROR" => "storing object failed - could not open target file"}, 507); } } else { $self->return_data({"ERROR" => "Invalid parameters, requires filename and data"}, 400); } return $infile; } sub normalize { my ($self, $fname, $method, $json) = @_; my $time = time; my $src = $Conf::bin."/norm_deseq.r"; my $fout = $Conf::temp."/rdata.normalize.".$time; my $rcmd = qq(source("$src") MGRAST_preprocessing( norm_method="$method", file_in="$fname", file_out="$fout", produce_fig=FALSE ) ); $self->run_r($rcmd); if ($json) { return $self->parse_matrix($fout); } else { return $fout; } } sub significance { my ($self, $fname, $groups, $test, $json) = @_; my $time = time; my $src = $Conf::bin."/group_stats_plot.r"; my $fout = $Conf::temp."/rdata.significance.".$time; my $grps = 'c('.join(',', map {'"'.$_.'"'} @$groups).')'; my $rcmd = qq(source("$src") group_stats_plot( file_in="$fname", file_out="$fout", stat_test="$test", order_by=NULL, order_decreasing=TRUE, my_grouping=$grps ) ); $self->run_r($rcmd); if ($json) { return $self->parse_matrix($fout); } else { return $fout; } } sub distance { my ($self, $fname, $dist, $json) = @_; my $time = time; my $src = $Conf::bin."/calc_distance.r"; my $fout = $Conf::temp."/rdata.distance.".$time; my $rcmd = qq(source("$src") MGRAST_distance( file_in="$fname", file_out="$fout", dist_method="$dist" ) ); $self->run_r($rcmd); if ($json) { return $self->parse_matrix($fout); } else { return $fout; } } sub heatmap { my ($self, $fname, $dist, $clust, $json) = @_; my $time = time; my $src = $Conf::bin."/dendrogram.r"; my ($fcol, $frow) = ($Conf::temp."/rdata.col.$time", $Conf::temp."/rdata.row.$time"); my $rcmd = qq(source("$src") MGRAST_dendrograms( file_in="$fname", file_out_column="$fcol", file_out_row="$frow", dist_method="$dist", clust_method="$clust", produce_figures=FALSE ) ); $self->run_r($rcmd); if ($json) { my $data = $self->parse_matrix($fname); ($data->{colindex}, $data->{coldend}) = $self->ordered_distance($fcol); ($data->{rowindex}, $data->{rowdend}) = $self->ordered_distance($frow); return $data; } else { return ($fcol, $frow); } } sub pcoa { my ($self, $fname, $dist, $json) = @_; my $time = time; my $src = $Conf::bin."/plot_pco.r"; my $fout = $Conf::temp."/rdata.pcoa.".$time; my $rcmd = qq(source("$src") MGRAST_plot_pco( file_in="$fname", file_out="$fout", dist_method="$dist", headers=0 ) ); $self->run_r($rcmd); if ($json) { my $data = { data => [], pco => [] }; my @matrix = map { [split(/\t/, $_)] } split(/\n/, $self->read_file($fout)); foreach my $row (@matrix) { my $r = shift @$row; @$row = map {$_ * 1.0} @$row; $r =~ s/\"//g; if ($r =~ /^PCO/) { push @{$data->{pco}}, $row->[0]; } else { push @{$data->{data}}, {'id' => $r, 'pco' => $row}; } } return $data; } else { return $fout; } } sub run_r { my ($self, $rcmd) = @_; eval { my $R = ($Conf::r_executable) ? $Conf::r_executable : "R"; system(qq(echo '$rcmd' | $R --vanilla --slave)); }; if ($@) { $self->return_data({"ERROR" => "Error running R: ".$@}, 500); } } sub read_file { my ($self, $fname) = @_; my $data = ""; eval { open(DFH, "<$fname"); $data = do { local $/; <DFH> }; close DFH; unlink $fname; }; if ($@ || (! $data)) { $self->return_data({"ERROR" => "Unable to retrieve results: ".$@}, 400); } return $data; } sub ordered_distance { my ($self, $fname) = @_; my @lines = split(/\n/, $self->read_file($fname)); my $line1 = shift @lines; my @order_dist = map { int($_) } split(/,/, $line1); my @dist_matrix = (); shift @lines; foreach my $l (@lines) { my @row = map { int($_) } split(/\t/, $l); push @dist_matrix, \@row; } return (\@order_dist, \@dist_matrix); } sub parse_matrix { my ($self, $fname) = @_; my $data = { data => [], rows => [], columns => [] }; my @matrix = map { [split(/\t/, $_)] } split(/\n/, $self->read_file($fname)); $data->{columns} = shift @matrix; shift @{$data->{columns}}; foreach my $row (@matrix) { my $r = shift @$row; @$row = map {$_ * 1.0} @$row; push @{$data->{rows}}, $r; push @{$data->{data}}, $row; } return $data; } 1;
wilke/MG-RAST
src/MGRAST/lib/resources/compute.pm
Perl
bsd-2-clause
24,460
#!/usr/bin/perl # Mingyu @ Jun 4 2013 # A script to launch all the simulations use strict; my @dTypes = ("NP2DuvNV2D"); #my @usrs = ("M1", "C1", "J1", "C3", "C4", # "E1", "U1", "Z1", "I1", "L1", # "Z2", "K1", "T2", "M3", "J4", # "D1", "W1", "T3"); my @usrs = ("M1", "C1"); use Parallel::ForkManager; my $pm = new Parallel::ForkManager( 6 ); # up to 6 processes foreach my $dType (@dTypes) { foreach my $u (@usrs) { $pm->start and next; #======================================================== #------ LeaveOneOut ------ print "perl 3_0_train_HMM_single.pl $dType $u\n"; system("perl 3_0_train_HMM_single.pl $dType $u"); #======================================================== $pm->finish; } } $pm->wait_all_children;
mingyu623/6DMG
6DMG_htk/airwriting_word_based/GroundTruth/3_1_batch.pl
Perl
bsd-2-clause
762
#!/usr/bin/perl ####################################################### # sgbbook2csv # --------------------- # converts a description of character meetups in a book # into node and edge CSV tables, starting from an input # file that conforms to the Stanford Graph Base book format # (e.g. 'anna.dat' and/or 'jean.dat') # # usage # --------------------- # sgbbook2csv.pl SGB_FILE.dat NODE_OUT.csv EDGE_OUT.csv # # Author: Matthew W. Taylor # Copyright (c) 2015, Northwestern 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 copyright holder 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 # HOLDER 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. ####################################################### @srcnodedata; @srcedgedata; @nodedata; @edgedata; $numArgs = $#ARGV + 1; if ($numArgs < 3) { print("\nusage: sgbbook2csv.pl PATH_TO_SGB_FILE.dat PATH_TO_NODE_CSV_OUTPUT.csv PATH_TO_EDGE_CSV_OUTPUT.csv\n"); exit(0); } $sgbbookfile = $ARGV[0]; $nodeoutfile = $ARGV[1]; $edgeoutfile = $ARGV[2]; sub read_in_file; sub generate_edge_list; sub generate_node_list; sub write_edge_file; sub write_node_file; sub trim; sub ttrim; sub read_in_file { # open the sgb file and iterate to gather the blocks open($infile, "<:encoding(UTF-8)", $sgbbookfile) or die "cannot open < $sgbbookfile: $!"; # first section of file contains node data, second contains edge data # sections are separated by an empty line my $section = 1; my $line; while($line = <$infile>) { if($line =~ /\*.*/) { # looks like a comment line, ignore it } elsif($line =~ /^$/) { # looks like an empty line, change modes $section++; } elsif($section eq 1) { chop($line); push @srcnodedata, $line; } else { chop($line); push @srcedgedata, $line; } } close($infile); } sub generate_edge_list { # chapters have 1 or more sets of meetups my $chapter = ""; # a meetup involves one or more characters my $meetups = ""; my $idcounter = 0; foreach(@srcedgedata) { $line = $_; if ($line =~ /\:/) { ($chapter, $meetups) = split(/\:/, $line, 2); # an array of meetup sets split on semicolons @meetupgroups = split(/;/, $meetups); foreach(@meetupgroups) { #meetup members are separated by commas @meetupmembers = split(/,/, $_); my $meetupSize = @meetupmembers; if ($meetupSize < 2) { # not interested in meetup parties of one } else { # we want to generate a list of meetups # all combinations of characters in the meetup # taken two at a time foreach my $a (0..$#meetupmembers) { foreach my $b ($a+1..$#meetupmembers) { # log the meetup $idcounter++; push @edgedata, $meetupmembers[$a] . "," . $meetupmembers[$b] ."," . "Undirected" . "," . $idcounter . "," .$chapter; } } } } } else { # no meetup data for this line, did not contain a colon } } } sub generate_node_list { foreach(@srcnodedata) { $line = $_; my($nodeID, $labelanddescription) = split(/\s/, $line, 2); my($description, $label) = split(/\t/, $labelanddescription, 2); $label=~s/^\s+//; $label=~s/\s+$//; $description=~s/^\s+//; $description=~s/\s+$//; $nodeID=~s/^\s+//; $nodeID=~s/\s+$//; if ($label eq "") { $label = $nodeID; } push @nodedata, "\"$nodeID\",\"$label\",\"$description\""; } } sub write_node_file { my $filehandle; open($filehandle, ">:encoding(UTF-8)", $nodeoutfile) or die "Could not open file '$filename'"; print $filehandle ("Id,Label,Description" . "\n"); foreach(@nodedata) { print $filehandle ($_ . "\n"); } close($filehandle); } sub write_edge_file { my $filehandle; open($filehandle, ">:encoding(UTF-8)", $edgeoutfile) or die "Could not open file '$filename'"; print $filehandle ("Source,Target,Type,Id,Label" ."\n"); foreach(@edgedata) { print $filehandle ($_ . "\n"); } close($filehandle); } sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; sub ttrim { my $s = shift; $s =~ s/^\t+|\t+$//g; return $s }; read_in_file; generate_edge_list; generate_node_list; write_node_file; write_edge_file;
mmlc/sgbbookparser_perl
sgbbook2csv.pl
Perl
bsd-3-clause
5,484
iret(101,3902). iret(109,3063). iret(123,66). iret(125,5903). iret(127,5480). iret(132,5430). iret(134,3470). iret(136,3015). iret(139,1895). iret(147,335). iret(155,3421). iret(171,5242). iret(182,1092). iret(193,2756). iret(200,3259). iret(202,2105). iret(204,4989). iret(210,2075). iret(212,4679). iret(214,3800). iret(241,1806). iret(997,289). iret(1003,5101). iret(1006,5773). iret(1009,860). iret(1328,2440). iret(1331,3570). iret(1334,3411). iret(1343,1775). iret(1346,3496). iret(1349,1642). iret(1358,5230). iret(1361,3702). iret(1364,3300). iret(1373,3390). iret(1465,1975). iret(1471,2673). iret(1477,4916). iret(1481,5919). iret(1485,5971). iret(1498,6128). iret(1553,3863). iret(1557,2158). iret(1559,145). iret(1562,4347). iret(1571,1151). iret(1573,2792). iret(1576,2844). iret(1580,2670). iret(1599,398). iret(1609,1651). iret(1627,3306). iret(1634,3712). iret(1639,5479). iret(1647,927). iret(1655,667). iret(1663,537). iret(1679,2435). iret(1684,2772). iret(1691,5920). iret(1693,603). iret(1695,812). iret(1700,5588). iret(1708,1388). iret(1715,2476). iret(1726,1679). iret(1733,3017). iret(1808,1352). iret(1874,1648). iret(1879,342). iret(1884,6049). iret(1887,196). iret(1890,1832). iret(1892,3448). iret(1894,3302). iret(1902,4616). iret(2072,4622). iret(2077,2833). iret(2084,5509). iret(2099,1929). iret(2104,4042). iret(2109,4845). iret(2114,3101). iret(2119,5857). iret(2124,2505). iret(2129,2678). iret(2134,1392). iret(2139,138). iret(2144,3876). iret(2149,2879). iret(2154,3476). iret(2159,3203). iret(2164,5573). iret(2169,1557). iret(2174,4600). iret(2179,608). iret(2184,2874). iret(2189,1825). iret(2194,5066). iret(2199,2619). iret(2204,5321). iret(2209,5221). iret(2214,1725). iret(2219,3626). iret(2224,614). iret(2229,5832). iret(2234,1525). iret(2239,291). iret(2244,3843). iret(2249,2524). iret(2254,3941). iret(2259,244). iret(2264,1569). iret(2269,5664). iret(2274,4260). iret(2279,2166). iret(2284,5898). iret(2289,4396). iret(2294,2936). iret(2299,81). iret(2304,2442). iret(2309,4842). iret(2314,320). iret(2319,3931). iret(2324,5469). iret(2329,1430). iret(2334,2666). iret(2339,4456). iret(2344,2978). iret(2349,4154). iret(2354,2200). iret(2359,4584). iret(2364,1316). iret(2369,3997). iret(2374,1221). iret(2379,5037). iret(2384,4357). iret(2389,4914). iret(2394,2124). iret(2399,1373). iret(2404,4176). iret(2409,1689). iret(2414,4638). iret(2419,106). iret(2424,4528). iret(2429,1199). iret(2442,5932). iret(2451,2269). iret(2455,4074). iret(2459,2816). iret(2463,2862). iret(2467,2433). iret(2471,577). iret(2475,296). iret(2479,5051). iret(2483,129). iret(2487,3234). iret(2491,3971). iret(2495,1298). iret(2499,2716). iret(2503,2813). iret(2507,3833). iret(2511,4119). iret(2515,4854). iret(2519,2340). iret(2523,4121). iret(2527,3685). iret(2531,5735). iret(2535,6073). iret(2539,5771). iret(2543,5855). iret(2547,5642). iret(2551,5425). iret(2555,2770). iret(2559,2724). iret(2563,2786). iret(2567,1635). iret(2571,2064). iret(2575,2035). iret(2579,828). iret(2583,1567). iret(2587,79). iret(2591,5786). iret(2595,3764). iret(2599,543). iret(2603,249). iret(2607,170). iret(2611,523). iret(2615,1174). iret(2619,1874). iret(2623,148). iret(2627,4144). iret(2631,862). iret(2635,1419). iret(2656,324). iret(2920,3345). iret(3045,6165). iret(3049,4190). iret(3063,1745). iret(3076,853). iret(3078,1394). iret(3080,5936). iret(3103,2005). iret(3105,5288). iret(3110,768). iret(3116,4567). iret(3132,5454). iret(3156,1926). iret(3159,5277). iret(3166,5225). iret(3168,1732). iret(3170,640). iret(3206,2432). iret(3226,1987). iret(3244,5843). iret(3282,952). iret(3284,3305). iret(3287,2727). iret(3289,4499). iret(3291,3649). iret(3316,5472). iret(3338,974). iret(3344,790). iret(3596,5956). iret(3608,2863). iret(3628,1524). iret(3635,1005). iret(3637,4376). iret(3662,2384). iret(3664,2457). iret(3667,5604). iret(3675,39). iret(3689,2586). iret(3692,5804). iret(3738,3510). iret(3757,1621). iret(3760,6021). iret(3765,3912). iret(3768,4159). iret(3812,5777). iret(3825,452). iret(3827,5520). iret(3829,2421). iret(3872,2271). iret(3879,4944). iret(3881,1233). iret(3883,2921). iret(3887,5890). iret(3890,3759). iret(3892,4872). iret(3894,2156). iret(3928,1089). iret(4444,4682). iret(4465,4046). iret(4468,837). iret(4470,4717). iret(4472,600). iret(4489,1791). iret(4499,2436). iret(4521,4688). iret(4523,2905). iret(4529,6136). iret(4536,714). iret(4553,2686). iret(4556,963). iret(4559,2037). iret(4564,679). iret(4566,4140). iret(4574,1748). iret(4576,5126). iret(4578,814). iret(4580,1680). iret(4583,300). iret(4585,1676). iret(4587,1543). iret(4604,117). iret(4615,4539). iret(4618,5720). iret(4620,5160). iret(4622,6167). iret(4631,4149). iret(4635,559). iret(4704,5665). iret(4747,4041). iret(4749,5057). iret(4751,2550). iret(4759,1277). iret(4771,822). iret(4774,2093). iret(4786,429). iret(4795,5611). iret(4843,3884). iret(4845,4766). iret(4847,4593). iret(4850,721). iret(4867,1925). iret(4880,908). iret(4906,4794). iret(4910,5531). iret(4913,1966). iret(4916,5306). iret(4918,3325). iret(4921,5483). iret(4923,4310). iret(4925,5034). iret(4927,5397). iret(4959,1252). iret(4964,4378). iret(4966,5881). iret(4982,4552). iret(4984,2176). iret(4986,2403). iret(4998,434). iret(5000,5937). iret(5003,5331). iret(5005,2239). iret(5009,222). iret(5012,4030). iret(5014,4798). iret(5016,5695). iret(5034,2144). iret(5036,6168). iret(5056,5516). iret(5058,1263). iret(5061,2233). iret(5063,4722). iret(5116,3860). iret(5118,539). iret(5123,1618). iret(5126,3638). iret(5131,3093). iret(5133,174). iret(5136,4390). iret(5138,5113). iret(5140,2347). iret(5142,1044). iret(5146,941). iret(5148,6172). iret(5192,4697). iret(5194,243). iret(5196,678). iret(5198,5614). iret(5227,2043). iret(5274,4321). iret(5276,5384). iret(5279,3464). iret(5281,4293). iret(5284,719). iret(5286,5599). iret(5293,5893). iret(5295,5141). iret(5297,1903). iret(5304,1064). iret(5306,2748). iret(5308,4928). iret(5315,227). iret(5339,982). iret(5348,3359). iret(5379,6173). iret(5386,3788). iret(5403,5079). iret(5468,284). iret(5470,4327). iret(5473,5348). iret(5479,5848). iret(5487,6174). iret(5527,5234). iret(5534,3472). iret(5537,1946). iret(5540,3285). iret(5542,4849). iret(5544,4346). iret(5622,1940). iret(5628,2835). iret(5631,5324). iret(5635,1624). iret(5638,4509). iret(5643,3109). iret(5650,1323). iret(5658,3516). iret(5674,2178). iret(5676,5623). iret(5678,65). iret(5690,2871). iret(5695,3353). iret(5697,2555). iret(5701,3265). iret(5706,64). iret(5708,4603). iret(5712,3431). iret(5714,3548). iret(5719,5147). iret(5722,5104). iret(5724,2180). iret(5740,234). iret(5743,4771). iret(5746,3529). iret(5748,1924). iret(5753,1266). iret(5761,6175). iret(5766,2957). iret(5774,3095). iret(5808,2843). iret(5816,5265). iret(5818,458). iret(5824,4948). iret(5828,3006). iret(5857,1976). iret(5859,6010). iret(5861,530). iret(5892,4091). iret(5951,3354). iret(5964,3013). iret(5966,4790). iret(5968,707). iret(5972,1097). iret(6012,1415). iret(6031,1890). iret(6034,4044). iret(6037,930). iret(6040,5012). iret(6045,1527). iret(6047,2222). iret(6049,511). iret(6051,4389). iret(6056,3133). iret(6061,2254). iret(6065,2488). iret(6067,971). iret(6069,5737). iret(6071,5116). iret(6076,3257). iret(6078,2912). iret(6081,5374). iret(6083,1327). iret(6090,2466). iret(6092,2255). iret(6095,4541). iret(6097,68). iret(6116,5552). iret(6128,3316). iret(6130,4212). iret(6150,3542). iret(6152,5885). iret(6154,4253). iret(6159,3803). iret(6193,5227). iret(6204,5040). iret(6221,3761). iret(6235,4392). iret(6256,1231). iret(6267,3289). iret(6269,2334). iret(6272,3195). iret(6274,75). iret(6277,852). iret(6279,2891). iret(6282,432). iret(6284,4075). iret(6290,1879). iret(6292,5959). iret(6302,3460). iret(6312,522). iret(6319,6178). iret(6331,17). iret(6341,638). iret(6355,3953). iret(6360,2274). iret(6377,2139). iret(6379,6116). iret(6384,5793). iret(6388,5948). iret(6391,5915). iret(6393,3168). iret(6395,5659). iret(6399,3158). iret(6402,4434). iret(6405,2329). iret(6407,3249). iret(6409,3005). iret(6429,3855). iret(6438,2321). iret(6456,735). iret(6476,1108). iret(6478,1218). iret(6481,2911). iret(6483,5744). iret(6494,57). iret(6496,5095). iret(6500,5926). iret(6503,779). iret(6505,1837). iret(6511,1171). iret(6513,3513). iret(6515,2876). iret(6522,4130). iret(6540,6180). iret(6559,4280). iret(6562,3940). iret(6572,2014). iret(6597,4341). iret(6599,5353). iret(6602,1817). iret(6604,806). iret(6610,3143). iret(6612,1982). iret(6614,5967). iret(6617,372). iret(6619,5049). iret(6621,3301). iret(6623,2523). iret(6685,6181). iret(6709,2377). iret(6712,2848). iret(6714,3862). iret(6723,1255). iret(6768,3679). iret(6770,4343). iret(6772,5802). iret(6780,6098). iret(6783,1489). iret(6785,5536). iret(6787,5002). iret(6792,6004). iret(6794,3980). iret(6796,1443). iret(6798,5064). iret(6800,3489). iret(6805,4618). iret(6807,5598). iret(6809,2372). iret(6811,670). iret(6813,4259). iret(6845,5800). iret(6876,5301). iret(6878,912). iret(6888,602). iret(6913,595). iret(6916,220). iret(6925,2953). iret(6928,1160). iret(6930,4085). iret(6936,5112). iret(6938,4530). iret(6940,3344). iret(6961,3346). iret(6975,4344). iret(6979,9). iret(6984,1347). iret(6993,3827). iret(6999,5253). iret(7004,4945). iret(7007,4025). iret(7011,4394). iret(7023,5259). iret(7028,4590). iret(7032,1335). iret(7034,1742). iret(7039,4061). iret(7046,2257). iret(7048,5693). iret(7055,218). iret(7062,4659). iret(7121,4038). iret(7123,1730). iret(7125,2601). iret(7132,4333). iret(7134,3707). iret(7136,2142). iret(7144,3561). iret(7146,706). iret(7148,2244). iret(7214,1773). iret(7223,1098). iret(7237,4133). iret(7248,5632). iret(7250,5815). iret(7252,2319). iret(7259,3367). iret(7261,3397). iret(7263,904). iret(7327,2478). iret(7334,5370). iret(7359,4726). iret(7362,2855). iret(7366,2385). iret(7370,1821). iret(7379,206). iret(7392,1692). iret(7397,864). iret(7409,919). iret(7412,5443). iret(7415,2587). iret(7417,6089). iret(7419,3636). iret(7429,1203). iret(7492,2791). iret(7500,4999). iret(7502,4224). iret(7504,4146). iret(7507,951). iret(7512,156). iret(7514,460). iret(7516,3375). iret(7522,4369). iret(7524,2029). iret(7527,1052). iret(7529,3562). iret(7539,3810). iret(7569,3722). iret(7622,4850). iret(7630,5921). iret(7639,4721). iret(7681,2129). iret(7683,3814). iret(7710,6087). iret(7728,3243). iret(7730,465). iret(7732,804). iret(7740,5518). iret(7742,2689). iret(7744,1256). iret(7746,1121). iret(7750,1947). iret(7753,5756). iret(7755,2381). iret(7812,6129). iret(7815,764). iret(7849,5447). iret(7915,5788). iret(7917,3596). iret(7919,1616). iret(7921,3826). iret(7923,2908). iret(7927,761). iret(7935,4977). iret(7938,4826). iret(7940,5966). iret(7942,5424). iret(7946,1447). iret(7953,5644). iret(7961,1262). iret(7966,983). iret(7970,3775). iret(7972,2337). iret(7979,3461). iret(7981,4129). iret(7983,5688). iret(7987,4475). iret(7989,1666). iret(7992,2807). iret(7994,2714). iret(7998,1939). iret(8000,4242). iret(8004,2465). iret(8006,3014). iret(8012,93). iret(8014,1274). iret(8018,842). iret(8020,5466). iret(8037,1448). iret(8052,5038). iret(8072,3021). iret(8074,1469). iret(8078,607). iret(8087,6099). iret(8095,1614). iret(8103,1800). iret(8111,2112). iret(8115,3102). iret(8119,2162). iret(8123,2593). iret(8127,4857). iret(8131,1417). iret(8135,4759). iret(8139,4550). iret(8143,3880). iret(8147,3670). iret(8151,4414). iret(8155,3157). iret(8159,2608). iret(8163,2660). iret(8167,5725). iret(8171,396). iret(8175,4966). iret(8179,4291). iret(8183,4804). iret(8187,1797). iret(8191,482). iret(8195,2824). iret(8199,3055). iret(8203,5892). iret(8207,3736). iret(8211,4371). iret(8215,4443). iret(8219,4193). iret(8223,4819). iret(8227,4865). iret(8231,1177). iret(8235,2132). iret(8239,686). iret(8243,2297). iret(8247,2897). iret(8251,2154). iret(8255,3628). iret(8259,4135). iret(8263,3204). iret(8267,5897). iret(8271,5145). iret(8275,5795). iret(8279,5980). iret(8283,817). iret(8287,1848). iret(8291,1309). iret(8295,2235). iret(8299,2552). iret(8303,3260). iret(8307,3623). iret(8311,3400). iret(8315,5092). iret(8319,2341). iret(8323,1961). iret(8327,2788). iret(8331,4141). iret(8335,4098). iret(8339,2287). iret(8343,4315). iret(8347,5864). iret(8351,747). iret(8355,5555). iret(8359,118). iret(8363,4305). iret(8367,4281). iret(8371,5179). iret(8375,3970). iret(8379,2399). iret(8383,2113). iret(8387,2259). iret(8391,2247). iret(8395,885). iret(8399,10). iret(8403,414). iret(8407,5807). iret(8411,5526). iret(8415,2292). iret(8419,1590). iret(8423,3758). iret(8427,367). iret(8431,439). iret(8435,459). iret(8439,834). iret(8443,4755). iret(8447,5018). iret(8451,4691). iret(8455,5651). iret(8459,3051). iret(8463,1998). iret(8467,2735). iret(8471,468). iret(8475,2515). iret(8479,4990). iret(8483,5123). iret(8487,5950). iret(8491,729). iret(8495,3287). iret(8499,6008). iret(8503,1964). iret(8507,1729). iret(8511,4230). iret(8515,4024). iret(8519,1712). iret(8523,6114). iret(8527,1854). iret(8531,1688). iret(8535,3137). iret(8539,3676). iret(8543,2750). iret(8547,641). iret(8551,966). iret(8555,2676). iret(8559,611). iret(8563,557). iret(8567,1887). iret(8571,2325). iret(8575,4715). iret(8579,3380). iret(8583,4554). iret(8587,76). iret(8591,4122). iret(8595,6113). iret(8599,6029). iret(8603,5878). iret(8607,3212). iret(8611,1408). iret(8615,2088). iret(8619,4853). iret(8623,2245). iret(8627,3205). iret(8631,4189). iret(8635,3818). iret(8639,2326). iret(8643,3760). iret(8647,3658). iret(8651,750). iret(8655,2867). iret(8659,4202). iret(8663,4904). iret(8667,4428). iret(8671,1914). iret(8675,200). iret(8679,5856). iret(8683,2517). iret(8687,5835). iret(8691,3915). iret(8695,3687). iret(8699,4263). iret(8703,169). iret(8707,2000). iret(8711,2364). iret(8715,5619). iret(8719,754). iret(8723,995). iret(8727,3875). iret(8731,4576). iret(8735,2185). iret(8739,2248). iret(8743,3923). iret(8747,5247). iret(8751,3032). iret(8755,55). iret(8759,3786). iret(8763,3774). iret(8767,5292). iret(8771,4527). iret(8775,3557). iret(8779,647). iret(8783,1756). iret(8787,744). iret(8791,1325). iret(8795,1339). iret(8799,2828). iret(8803,2572). iret(8807,149). iret(8811,3238). iret(8815,1783). iret(8819,1623). iret(8823,5186). iret(8827,4713). iret(8831,1362). iret(8835,1291). iret(8839,303). iret(8843,3246). iret(8847,1999). iret(8851,1836). iret(8855,5500). iret(8859,5453). iret(8863,5193). iret(8867,859). iret(8871,5026). iret(8875,2842). iret(8879,1172). iret(8883,1502). iret(8887,3694). iret(8891,2557). iret(8895,4675). iret(8899,5010). iret(8903,5319). iret(8907,141). iret(8911,5667). iret(8915,5778). iret(8919,3326). iret(8923,4345). iret(8927,1813). iret(8931,1227). iret(8935,1734). iret(8939,585). iret(8943,501). iret(8947,1264). iret(8951,2223). iret(8955,6012). iret(8959,5675). iret(8963,5393). iret(8967,5419). iret(8971,22). iret(8975,357). iret(8979,5806). iret(8983,5706). iret(8987,3437). iret(8991,3279). iret(8995,2344). iret(8999,3593). iret(9003,4431). iret(9007,4639). iret(9011,3210). iret(9015,3403). iret(9019,596). iret(9023,535). iret(9027,2604). iret(9031,4779). iret(9035,960). iret(9039,850). iret(9043,2538). iret(9047,2645). iret(9051,3269). iret(9055,3132). iret(9059,4608). iret(9063,4711). iret(9067,6062). iret(9071,6132). iret(9075,4056). iret(9079,3414). iret(9083,3248). iret(9087,4488). iret(9091,2019). iret(9095,5626). iret(9099,4283). iret(9103,3978). iret(9107,1810). iret(9111,3683). iret(9115,1377). iret(9119,400). iret(9123,4747). iret(9127,126). iret(9131,544). iret(9135,5296). iret(9139,5818). iret(9143,759). iret(9147,2732). iret(9151,2696). iret(9155,1370). iret(9159,2808). iret(9163,2569). iret(9167,1883). iret(9171,914). iret(9175,1137). iret(9179,4410). iret(9183,4781). iret(9187,2196). iret(9191,2388). iret(9195,2202). iret(9199,1935). iret(9203,2599). iret(9207,2989). iret(9211,5587). iret(9215,4936). iret(9219,2513). iret(9223,3908). iret(9227,2965). iret(9231,2997). iret(9235,3412). iret(9239,3519). iret(9243,241). iret(9247,176). iret(9251,594). iret(9255,1463). iret(9259,1286). iret(9263,1239). iret(9267,675). iret(9271,67). iret(9275,4624). iret(9279,4551). iret(9283,3692). iret(9287,3377). iret(9291,3795). iret(9295,3341). iret(9299,1240). iret(9303,813). iret(9307,271). iret(9311,1210). iret(9315,5439). iret(9319,5349). iret(9323,5891). iret(9327,1011). iret(9331,150). iret(9335,5195). iret(9339,4555). iret(9343,2563). iret(9347,4402). iret(9351,4282). iret(9355,3156). iret(9359,2120). iret(9363,159). iret(9367,2236). iret(9371,2715). iret(9375,1022). iret(9379,1626). iret(9383,1619). iret(9387,2188). iret(9391,2498). iret(9395,2968). iret(9399,2884). iret(9403,5343). iret(9407,3484). iret(9411,5083). iret(9415,5295). iret(9419,4900). iret(9423,1196). iret(9427,4156). iret(9431,3989). iret(9435,6108). iret(9439,1904). iret(9443,2677). iret(9447,909). iret(9451,4858). iret(9455,4802). iret(9459,1012). iret(9463,2122). iret(9467,3430). iret(9471,6078). iret(9475,3559). iret(9479,5989). iret(9483,4799). iret(9487,5166). iret(9491,5952). iret(9495,3075). iret(9499,4064). iret(9503,4165). iret(9507,1351). iret(9511,1547). iret(9515,2443). iret(9519,2890). iret(9523,525). iret(9527,166). iret(9531,1938). iret(9535,2882). iret(9539,2415). iret(9543,3463). iret(9547,4448). iret(9551,3973). iret(9555,3837). iret(9559,3724). iret(9563,3956). iret(9567,4844). iret(9571,4220). iret(9575,1034). iret(9579,3783). iret(9583,3072). iret(9587,2056). iret(9591,3159). iret(9595,4800). iret(9599,5119). iret(9603,1496). iret(9607,1420). iret(9611,1950). iret(9615,2883). iret(9619,872). iret(9623,2764). iret(9627,5223). iret(9631,4271). iret(9635,2331). iret(9639,787). iret(9643,6124). iret(9647,5986). iret(9651,4322). iret(9655,5916). iret(9659,2590). iret(9663,2753). iret(9667,3650). iret(9671,2455). iret(9675,1875). iret(9679,1792). iret(9683,2406). iret(9687,4586). iret(9691,5062). iret(9695,5745). iret(9699,202). iret(9703,4317). iret(9707,717). iret(9711,5399). iret(9715,956). iret(9719,2018). iret(9723,1823). iret(9727,1600). iret(9731,652). iret(9735,60). iret(9739,905). iret(9743,2717). iret(9747,1979). iret(9751,2232). iret(9755,5854). iret(9759,4987). iret(9763,5812). iret(9767,945). iret(9771,1119). iret(9775,2036). iret(9779,626). iret(9783,4332). iret(9787,4831). iret(9791,3357). iret(9795,1984). iret(9799,40). iret(9803,531). iret(9807,240). iret(9811,1943). iret(9815,2630). iret(9819,3025). iret(9823,4918). iret(9827,5299). iret(9831,2768). iret(9835,3144). iret(9839,3610). iret(9843,2949). iret(9847,5369). iret(9851,4988). iret(9855,1132). iret(9859,2195). iret(9863,152). iret(9867,767). iret(9871,2070). iret(9875,72). iret(9879,1990). iret(9883,4408). iret(9887,778). iret(9891,1079). iret(9895,5151). iret(9899,2150). iret(9903,5635). iret(9907,4304). iret(9911,1536). iret(9915,1374). iret(9919,2160). iret(9923,4196). iret(9927,1921). iret(9931,3048). iret(9935,3790). iret(9939,2429). iret(9943,3321). iret(9947,4191). iret(9951,2821). iret(9955,1722). iret(9959,2939). iret(9963,127). iret(9967,4175). iret(9971,2741). iret(9975,5024). iret(9979,3867). iret(9983,2749). iret(9987,2929). iret(9991,2643). iret(9995,2373). iret(9999,1403). iret(10003,902). iret(10007,5267). iret(10011,551). iret(10015,2485). iret(10019,2161). iret(10023,2089). iret(10027,2045). iret(10031,197). iret(10035,334). iret(10039,3348). iret(10061,2068). iret(10063,580). iret(10105,3663). iret(10114,3073). iret(10136,5561). iret(10147,4324). iret(10150,5987). iret(10153,1461). iret(10156,920). iret(10701,495). iret(10713,1161). iret(10717,2679). iret(10724,3677). iret(10727,1095). iret(10729,1488). iret(10733,2276). iret(10751,347). iret(10757,5517). iret(10779,716). iret(10781,3079). iret(10783,681). iret(10806,4459). iret(10808,4787). iret(10810,4559). iret(10827,5658). iret(10847,4662). iret(10855,5043). iret(10861,2371). iret(10866,1801). iret(10870,3018). iret(10878,3501). iret(10882,3245). iret(10884,775). iret(10906,5739). iret(10951,5162). iret(10954,5637). iret(10956,2209). iret(10958,5091). iret(10969,3743). iret(10972,2544). iret(10975,1289). iret(10997,1508). iret(11006,1656). iret(11008,2832). iret(11011,5657). iret(11017,3606). iret(11020,2228). iret(11025,6192). iret(11059,5359). iret(11062,1288). iret(11065,5188). iret(11090,233). iret(11095,3466). iret(11098,3603). iret(11123,1954). iret(11126,3932). iret(11133,5858). iret(11154,2719). iret(11156,3748). iret(11222,520). iret(11224,500). iret(11226,1201). iret(11229,2445). iret(11231,6023). iret(11246,1202). iret(11280,1315). iret(11286,5446). iret(11288,4694). iret(11290,1104). iret(11292,317). iret(11303,1006). iret(11311,630). iret(11315,3002). iret(11317,461). iret(11337,3045). iret(11341,4081). iret(11355,2620). iret(11357,3427). iret(11360,487). iret(11363,1281). iret(11365,5365). iret(11372,3104). iret(11374,1599). iret(11376,4285). iret(11382,2865). iret(11384,345). iret(11386,4939). iret(11394,203). iret(11396,3993). iret(11398,698). iret(11402,2940). iret(11407,2256). iret(11430,2020). iret(11448,4573). iret(11474,1275). iret(11476,6135). iret(11490,307). iret(11497,3262). iret(11500,547). iret(11513,1654). iret(11515,1465). iret(11518,4382). iret(11520,362). iret(11522,3173). iret(11558,3278). iret(11571,5015). iret(11578,6194). iret(11597,900). iret(11620,486). iret(11630,5691). iret(11632,4547). iret(11635,4188). iret(11643,1886). iret(11645,5977). iret(11647,2312). iret(11662,2694). iret(11667,1261). iret(11681,4494). iret(11684,5575). iret(11688,5784). iret(11691,5996). iret(11694,346). iret(11716,5261). iret(11726,733). iret(11729,4364). iret(11750,5902). iret(11753,3714). iret(11755,2685). iret(11758,6093). iret(11760,4084). iret(11813,1771). iret(11816,2033). iret(11818,2946). iret(11821,3415). iret(11824,1356). iret(11829,4148). iret(11831,2502). iret(11837,1544). iret(11839,5760). iret(11852,2251). iret(11870,4111). iret(11884,5109). iret(11887,6196). iret(11900,5434). iret(11902,3027). iret(11920,4643). iret(11931,4875). iret(11945,360). iret(11958,309). iret(11960,2947). iret(11963,4200). iret(11966,689). iret(11974,1493). iret(11977,3770). iret(11979,1517). iret(11981,4089). iret(11983,6016). iret(11985,2365). iret(11987,1923). iret(11989,3599). iret(11992,4500). iret(11996,2674). iret(12023,4289). iret(12026,1453). iret(12028,4429). iret(12041,4043). iret(12049,2703). iret(12052,236). iret(12055,5852). iret(12058,1573). iret(12076,5506). iret(12092,2849). iret(12129,1129). iret(12132,219). iret(12134,4268). iret(12157,4026). iret(12166,3550). iret(12172,1737). iret(12174,1126). iret(12177,403). iret(12189,5621). iret(12194,5203). iret(12196,1091). iret(12198,2822). iret(12205,3728). iret(12207,3253). iret(12209,3819). iret(12220,1885). iret(12249,2473). iret(12251,2191). iret(12254,1365). iret(12256,3732). iret(12288,3239). iret(12293,783). iret(12299,777). iret(12305,4451). iret(12309,5928). iret(12311,6002). iret(12374,4262). iret(12377,1632). iret(12379,4650). iret(12383,2042). iret(12386,2700). iret(12388,506). iret(12390,4403). iret(12392,4983). iret(12397,5025). iret(12421,4100). iret(12429,4435). iret(12440,3811). iret(12443,3224). iret(12446,2740). iret(12448,2077). iret(12453,838). iret(12455,91). iret(12462,972). iret(12473,4642). iret(12475,2755). iret(12477,3379). iret(12480,5254). iret(12482,5666). iret(12484,4874). iret(12493,3934). iret(12495,1752). iret(12499,114). iret(12502,3540). iret(12524,2669). iret(12626,5660). iret(12629,4197). iret(12631,435). iret(12638,1740). iret(12666,873). iret(12675,2261). iret(12686,2387). iret(12688,2370). iret(12690,5653). iret(12692,4636). iret(12695,2118). iret(12703,1211). iret(12705,2611). iret(12708,4899). iret(12710,5571). iret(12714,4416). iret(12724,5048). iret(12727,6006). iret(12736,0). iret(12749,1456). iret(12753,3276). iret(12755,6202). iret(12771,3927). iret(12773,4495). iret(12776,4236). iret(12778,3227). iret(12781,949). iret(12783,3297). iret(12786,825). iret(12788,1936). iret(12793,4789). iret(12797,420). iret(12799,4974). iret(12803,280). iret(12809,6203). iret(12815,4975). iret(12817,5029). iret(12819,3016). iret(12828,496). iret(12830,1871). iret(12833,4118). iret(12835,328). iret(12840,3155). iret(12842,5238). iret(12844,4641). iret(12847,3629). iret(12850,2126). iret(12852,1384). iret(12860,6204). iret(12862,6205). iret(12881,338). iret(12884,3605). iret(12886,4976). iret(12894,5584). iret(12896,2956). iret(12904,5813). iret(12908,2046). iret(12911,4071). iret(12993,3794). iret(12999,3750). iret(13009,6209). iret(13015,2417). iret(13019,6210). iret(13021,4198). iret(13023,887). iret(13028,6211). iret(13033,566). iret(13035,6212). iret(13037,2303). iret(13039,5609). iret(13043,6213). iret(13048,786). iret(13050,5511). iret(13052,2291). iret(13056,6214). iret(13059,4888). iret(13061,6215). iret(13065,6216). iret(13089,1868). iret(13092,731). iret(13099,5168). iret(13105,5698). iret(13108,5089). iret(13148,4768). iret(13153,5382). iret(13180,3363). iret(13182,3742). iret(13187,4797). iret(13190,2138). iret(13192,5736). iret(13205,6218). iret(13208,2527). iret(13213,4734). iret(13215,4651). iret(13217,3509). iret(13219,5888). iret(13222,321). iret(13224,4288). iret(13226,6038). iret(13228,2468). iret(13230,4240). iret(13246,1894). iret(13248,1382). iret(13250,3190). iret(13252,5759). iret(13263,6219). iret(13269,6220). iret(13271,3020). iret(13273,6221). iret(13286,3404). iret(13288,3376). iret(13293,474). iret(13295,6222). iret(13297,6223). iret(13328,6154). iret(13340,5440). iret(13345,2796). iret(13349,3575). iret(13351,1449). iret(13353,771). iret(13355,1131). iret(13360,2215). iret(13362,1490). iret(13365,3640). iret(13367,5861). iret(13374,2304). iret(13376,3053). iret(13379,3709). iret(13381,1563). iret(13408,889). iret(13430,1307). iret(13433,1634). iret(13442,2574). iret(13454,2078). iret(13457,3865). iret(13459,1785). iret(13461,5581). iret(13481,436). iret(13486,1851). iret(13488,5846). iret(13490,4529). iret(13541,690). iret(13560,2207). iret(13562,5871). iret(13604,3646). iret(13620,3669). iret(13627,5009). iret(13634,5260). iret(13646,4512). iret(13651,2163). iret(13664,2769). iret(13666,5375). iret(13688,3391). iret(13690,462). iret(13692,4290). iret(13703,6225). iret(13705,6226). iret(13707,6227). iret(13710,5008). iret(13725,4101). iret(13743,4524). iret(13783,2300). iret(13785,3918). iret(13792,5305). iret(13795,2640). iret(13797,230). iret(13803,4422). iret(13806,1743). iret(13835,5790). iret(13837,6228). iret(13855,4732). iret(13857,3672). iret(13860,5682). iret(13862,4778). iret(13882,2634). iret(13886,2301). iret(13892,4393). iret(13894,3100). iret(13897,2106). iret(13899,1491). iret(13901,4027). iret(13905,4873). iret(13908,6009). iret(13915,3081). iret(13916,942). iret(13922,3981). iret(13968,1901). iret(13976,3856). iret(13983,3944). iret(13990,3829). iret(14000,5093). iret(14004,1046). iret(14014,1219). iret(14076,512). iret(14089,2002). iret(14091,1393). iret(14094,3754). iret(14096,672). iret(14105,5266). iret(14111,37). iret(14125,3727). iret(14151,282). iret(14153,3595). iret(14155,4932). iret(14165,1193). iret(14168,2585). iret(14170,1192). iret(14180,5873). iret(14182,1915). iret(14185,3232). iret(14187,59). iret(14191,5163). iret(14197,184). iret(14202,2644). iret(14207,6232). iret(14224,4279). iret(14229,4901). iret(14237,1363). iret(14250,2237). iret(14256,5823). iret(14258,541). iret(14260,1348). iret(14264,1045). iret(14267,5335). iret(14269,1359). iret(14274,2374). iret(14276,5219). iret(14278,891). iret(14288,3703). iret(14290,2146). iret(14292,1507). iret(14301,3896). iret(14303,2690). iret(14317,257). iret(14329,2157). iret(14332,5477). iret(14334,3198). iret(14336,6041). iret(14338,2147). iret(14388,2464). iret(14392,2760). iret(14394,3088). iret(14397,6233). iret(14401,1071). iret(14403,6234). iret(14408,4833). iret(14412,1122). iret(14414,6235). iret(14417,1520). iret(14419,3965). iret(14429,4581). iret(14440,3334). iret(14473,5906). iret(14480,6237). iret(14490,3820). iret(14492,2353). iret(14499,1165). iret(14558,517). iret(14584,58). iret(14590,1050). iret(14593,5548). iret(14599,613). iret(14618,6105). iret(14667,3675). iret(14672,3777). iret(14679,1345). iret(14687,5248). iret(14691,1528). iret(14693,2127). iret(14695,492). iret(14701,839). iret(14703,882). iret(14709,5463). iret(14711,4703). iret(14714,3154). iret(14717,418). iret(14762,4684). iret(14764,223). iret(14767,38). iret(14771,3502). iret(14781,6020). iret(14783,3881). iret(14785,1468). iret(14795,2805). iret(14797,98). iret(14801,2168). iret(14803,5285). iret(14857,90). iret(14871,3475). iret(14873,1828). iret(14876,1175). iret(14880,4468). iret(14882,201). iret(14884,2526). iret(14912,4072). iret(14929,4689). iret(14932,2530). iret(14945,1232). iret(14955,1425). iret(14959,1911). iret(14966,1423). iret(14972,5073). iret(15020,4465). iret(15023,409). iret(15026,3240). iret(15028,3958). iret(15030,261). iret(15035,5530). iret(15037,3534). iret(15039,632). iret(15047,2895). iret(15049,3221). iret(15052,281). iret(15054,4031). iret(15061,5485). iret(15064,797). iret(15086,6238). iret(15105,1337). iret(15107,2790). iret(15131,1717). iret(15134,5847). iret(15136,3886). iret(15210,4951). iret(15219,3936). iret(15227,3130). iret(15229,597). iret(15232,1639). iret(15234,4585). iret(15236,4720). iret(15241,2335). iret(15244,5512). iret(15246,2496). iret(15248,3385). iret(15265,3187). iret(15268,472). iret(15281,1053). iret(15296,5164). iret(15306,1709). iret(15312,1487). iret(15318,4611). iret(15321,2907). iret(15324,508). iret(15336,252). iret(15341,946). iret(15343,1897). iret(15345,2711). iret(15347,5156). iret(15349,792). iret(15351,3162). iret(15353,4998). iret(15357,1581). iret(15359,3507). iret(15361,925). iret(15363,4701). iret(15365,5761). iret(15367,5142). iret(15369,5796). iret(15371,3929). iret(15373,1605). iret(15375,1715). iret(15377,1598). iret(15382,760). iret(15384,795). iret(15418,1627). iret(15486,3975). iret(15488,5608). iret(15492,6053). iret(15498,3293). iret(15540,4589). iret(15557,1280). iret(15567,2713). iret(15573,1970). iret(15575,2932). iret(15577,5603). iret(15584,1529). iret(15586,2241). iret(15588,4453). iret(15599,136). iret(15612,4708). iret(15642,2091). iret(15649,1665). iret(15654,3842). iret(15656,6149). iret(15658,4272). iret(15663,5070). iret(15673,6240). iret(15675,4250). iret(15678,6241). iret(15720,5138). iret(15722,2881). iret(15724,1364). iret(15727,943). iret(15729,1716). iret(15731,3160). iret(15734,624). iret(15736,4535). iret(15738,2691). iret(15741,2376). iret(15743,899). iret(15761,2013). iret(15776,4019). iret(15778,704). iret(15780,3664). iret(15787,5490). iret(15790,5822). iret(15792,1683). iret(15794,1310). iret(15797,3897). iret(15799,2252). iret(15803,5859). iret(15807,2130). iret(15809,3541). iret(15826,1847). iret(15864,6242). iret(15867,6244). iret(15870,6246). iret(15873,3480). iret(15876,6247). iret(15879,5827). iret(15908,4978). iret(15910,6249). iret(15936,3084). iret(15941,1842). iret(15963,1686). iret(15965,1341). iret(15968,4092). iret(15970,258). iret(16010,4249). iret(16013,3270). iret(16023,718). iret(16025,4409). iret(16070,4836). iret(16084,1611). iret(16088,283). iret(16090,846). iret(16094,3275). iret(16103,3718). iret(16108,5322). iret(16110,3961). iret(16139,697). iret(16160,5964). iret(16162,181). iret(16164,3957). iret(16171,3988). iret(16173,4702). iret(16175,2447). iret(16191,2745). iret(16193,555). iret(16195,3815). iret(16200,5061). iret(16203,1283). iret(16206,5275). iret(16212,2072). iret(16215,2192). iret(16239,810). iret(16242,2575). iret(16245,3937). iret(16248,4287). iret(16251,5148). iret(16254,3164). iret(16257,4114). iret(16260,1521). iret(16263,4536). iret(16266,3438). iret(16269,5504). iret(16272,5939). iret(16275,370). iret(16277,3962). iret(16289,867). iret(16300,3250). iret(16302,849). iret(16304,1784). iret(16319,1). iret(16321,2282). iret(16324,97). iret(16326,4022). iret(16328,5969). iret(16331,2111). iret(16334,4070). iret(16345,2631). iret(16347,2054). iret(16350,3151). iret(16354,225). iret(16361,1178). iret(16367,185). iret(16375,440). iret(16377,720). iret(16380,4365). iret(16383,2795). iret(16396,2167). iret(16442,6250). iret(16462,2044). iret(16465,4630). iret(16467,5464). iret(16470,2356). iret(16472,4142). iret(16474,5328). iret(16478,4981). iret(16500,3233). iret(16507,1759). iret(16509,1099). iret(16521,5257). iret(16535,3071). iret(16537,2012). iret(16539,4652). iret(16576,4846). iret(16584,397). iret(16606,2812). iret(16609,3893). iret(16631,1531). iret(16633,251). iret(16642,1589). iret(16654,1300). iret(16670,3854). iret(16691,4363). iret(16701,1714). iret(16704,1568). iret(16707,5252). iret(16709,4237). iret(16711,113). iret(16716,155). iret(16718,5154). iret(16720,1995). iret(16728,4065). iret(16730,2108). iret(16733,268). iret(16735,5992). iret(16749,4166). iret(16761,6251). iret(16768,1586). iret(16771,2217). iret(16774,3085). iret(16780,4102). iret(16824,738). iret(16827,4558). iret(16837,5150). iret(16844,749). iret(16853,2279). iret(16855,658). iret(16864,1100). iret(16866,5431). iret(16868,3762). iret(16872,6104). iret(16874,2705). iret(16880,2484). iret(16888,3866). iret(16890,1432). iret(16892,4619). iret(16909,2386). iret(16914,8). iret(16919,1297). iret(16924,124). iret(16930,6252). iret(16932,1588). iret(16939,2272). iret(16941,1470). iret(16943,740). iret(16960,5074). iret(16972,1758). iret(17024,3064). iret(17026,3739). iret(17028,725). iret(17035,5910). iret(17046,443). iret(17066,5416). iret(17071,5022). iret(17074,3969). iret(17076,20). iret(17078,502). iret(17080,6100). iret(17082,4816). iret(17087,5422). iret(17089,1592). iret(17091,809). iret(17094,2818). iret(17097,2071). iret(17099,4437). iret(17106,2380). iret(17108,4961). iret(17110,4210). iret(17113,5833). iret(17116,5290). iret(17118,2573). iret(17124,4670). iret(17126,3972). iret(17128,21). iret(17131,2469). iret(17134,1284). iret(17136,3343). iret(17139,5329). iret(17141,1704). iret(17149,297). iret(17154,3046). iret(17157,2149). iret(17159,4736). iret(17161,2179). iret(17164,375). iret(17166,32). iret(17168,1985). iret(17170,473). iret(17172,1021). iret(17179,4993). iret(17181,5249). iret(17183,25). iret(17189,671). iret(17191,5514). iret(17194,5117). iret(17196,1530). iret(17199,2983). iret(17202,4487). iret(17204,3299). iret(17211,1612). iret(17213,643). iret(17215,3588). iret(17224,2596). iret(17226,401). iret(17228,6083). iret(17230,45). iret(17232,4115). iret(17246,4297). iret(17249,3402). iret(17251,1033). iret(17254,6111). iret(17257,5860). iret(17260,934). iret(17282,5909). iret(17290,3667). iret(17292,2424). iret(17295,4330). iret(17297,1399). iret(17301,6054). iret(17306,857). iret(17308,901). iret(17311,6047). iret(17313,2461). iret(17320,794). iret(17322,2579). iret(17324,5560). iret(17337,6253). iret(17369,5336). iret(17382,2438). iret(17391,1093). iret(17408,3339). iret(17413,42). iret(17416,6254). iret(17428,4433). iret(17470,2731). iret(17472,83). iret(17474,5943). iret(17476,4760). iret(17479,6255). iret(17482,3425). iret(17492,1336). iret(17496,933). iret(17499,4606). iret(17504,285). iret(17506,4123). iret(17509,922). iret(17512,3434). iret(17514,4399). iret(17533,5820). iret(17542,4299). iret(17544,5767). iret(17549,2114). iret(17553,3517). iret(17575,5595). iret(17585,4765). iret(17589,4969). iret(17595,4463). iret(17601,1864). iret(17611,819). iret(17623,1426). iret(17627,2083). iret(17629,3634). iret(17632,3779). iret(17635,4980). iret(17641,5982). iret(17643,1919). iret(17645,937). iret(17658,881). iret(17697,5467). iret(17700,5023). iret(17704,4286). iret(17711,438). iret(17714,3076). iret(17724,4312). iret(17728,3845). iret(17730,3841). iret(17733,1343). iret(17735,5708). iret(17737,685). iret(17742,1442). iret(17744,5087). iret(17746,2140). iret(17748,1191). iret(17753,2560). iret(17755,1937). iret(17757,874). iret(17761,6040). iret(17779,3054). iret(17785,5565). iret(17803,1584). iret(17806,6256). iret(17810,3631). iret(17814,4094). iret(17817,637). iret(17819,1376). iret(17821,3122). iret(17823,4108). iret(17827,6257). iret(17838,5368). iret(17853,1090). iret(17855,5084). iret(17871,5046). iret(17874,4835). iret(17876,3798). iret(17896,5271). iret(17898,1367). iret(17900,3555). iret(17907,4692). iret(17909,5462). iret(17911,110). iret(17923,3019). iret(17925,4563). iret(17930,364). iret(17934,5723). iret(17936,1645). iret(17943,1051). iret(17948,3178). iret(17950,703). iret(17952,6258). iret(17982,2219). iret(17984,4733). iret(17994,921). iret(17999,4339). iret(18028,2097). iret(18051,1896). iret(18061,4864). iret(18082,6112). iret(18084,2646). iret(18090,724). iret(18092,5662). iret(18094,1250). iret(18097,2378). iret(18106,1188). iret(18108,2636). iret(18111,2826). iret(18114,3456). iret(18120,1906). iret(18123,4057). iret(18126,1150). iret(18128,2402). iret(18133,1811). iret(18135,4205). iret(18138,4685). iret(18140,344). iret(18143,4034). iret(18145,4996). iret(18149,2945). iret(18151,3984). iret(18155,6102). iret(18161,4147). iret(18163,4871). iret(18165,1628). iret(18167,272). iret(18170,581). iret(18173,2069). iret(18176,6110). iret(18178,753). iret(18181,4820). iret(18183,2313). iret(18188,4080). iret(18190,4796). iret(18192,2581). iret(18194,393). iret(18197,4218). iret(18199,2889). iret(18202,1272). iret(18204,4560). iret(18257,4125). iret(18266,2094). iret(18269,2629). iret(18281,1209). iret(18287,2726). iret(18304,5556). iret(18306,365). iret(18309,3708). iret(18311,2389). iret(18313,803). iret(18333,6084). iret(18335,4862). iret(18337,4328). iret(18358,3873). iret(18368,3332). iret(18371,5433). iret(18373,4164). iret(18375,1225). iret(18386,2582). iret(18388,526). iret(18392,3383). iret(18394,3458). iret(18433,5245). iret(18436,1991). iret(18449,5407). iret(18451,2151). iret(18458,2801). iret(18460,5624). iret(18470,2628). iret(18475,4839). iret(18477,518). iret(18479,3419). iret(18486,4152). iret(18488,5925). iret(18490,3087). iret(18526,994). iret(18531,256). iret(18533,2061). iret(18538,5035). iret(18542,700). iret(18553,2400). iret(18558,4353). iret(18600,2858). iret(18603,798). iret(18605,3455). iret(18608,19). iret(18610,4462). iret(18613,2121). iret(18615,1699). iret(18617,5750). iret(18620,589). iret(18622,5732). iret(18624,3423). iret(18625,5183).
datalaude/datalaude
examples/examples/datalog/nfcchat/Iret.pl
Perl
bsd-3-clause
38,225
#!/usr/bin/perl # # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of SWITCH nor the names of its contributors may be # used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # $Author: peter $ # # $Id: Nfcomm.pm 69 2014-06-23 19:27:50Z peter $ # # $LastChangedRevision: 69 $ package Nfcomm; use strict; # BEGIN { $ENV{PATH} = '/usr/ucb:/bin' } use Socket; use Carp; use POSIX 'strftime'; use POSIX 'setsid'; use POSIX ":sys_wait_h"; use Sys::Syslog; use Nfsync; use UNIVERSAL; use Log; use NfProfile; use NfAlert; use Lookup; my %CMD_lookup = ( # get commands 'get-du' => \&NfSen::DiskUsage, 'get-globals' => \&GetGlobals, 'get-profilelist' => \&NfProfile::GetAllProfiles, 'get-profilegroups' => \&NfProfile::GetProfilegroups, 'get-frontendplugins' => \&NfSen::GetFrontendPlugins, 'get-profile' => \&NfProfile::GetProfile, 'get-channelstat' => \&NfProfile::GetChannelstat, 'get-channelfilter' => \&NfProfile::GetChannelfilter, 'get-formatlist' => \&NfSen::GetOutputFormats, 'get-filterlist' => \&NfSen::GetDefaultFilterList, 'get-filter' => \&NfSen::GetDefaultFilter, 'get-alertlist' => \&NfAlert::GetAllAlerts, 'get-alert' => \&NfAlert::GetAlert, 'get-alertfilter' => \&NfAlert::GetAlertFilter, 'get-alertcondition' => \&GetAlertConditions, 'get-alertgraph' => \&NfAlert::GetAlertGraph, 'get-statinfo' => \&NfProfile::GetStatinfo, 'get-picture' => \&NfProfile::SendPicture, 'get-anypicture' => \&NfSen::SendAnyPicture, 'get-detailsgraph' => \&NfProfile::GetDetailsGraph, 'get-peek' => \&NfProfile::SearchPeak, # add command 'add-profile' => \&NfProfile::AddProfile, 'add-channel' => \&NfProfile::AddProfileChannel, 'add-format' => \&NfSen::AddOuputFormat, 'add-filter' => \&NfSen::AddDefaultFilter, 'add-alert' => \&NfAlert::AddAlert, 'arm-alert' => \&NfAlert::ArmAlert, 'run-alertaction' => \&RunPluginAction, # delete commands 'delete-profile' => \&NfProfile::DeleteProfile, 'delete-channel' => \&NfProfile::DeleteProfileChannel, 'delete-format' => \&NfSen::DeleteOuputFormat, 'delete-filter' => \&NfSen::DeleteDefaultFilter, 'delete-alert' => \&NfAlert::DeleteAlert, 'commit-profile' => \&NfProfile::CommitProfile, 'cancel-profile' => \&NfProfile::CancelProfile, 'modify-profile' => \&NfProfile::ModifyProfile, 'modify-channel' => \&NfProfile::ModifyProfileChannel, 'modify-alert' => \&NfAlert::ModifyAlert, 'run-nfdump' => \&RunNfdump, 'run-plugins' => \&RunPlugins, 'rebuild-profile' => \&NfProfile::RebuildProfile, 'expire-profile' => \&NfProfile::ExpireProfile, 'reconfig' => \&Nfsources::Reconfig, 'lookup' => \&Lookup::Lookup, 'semcheck' => \&SemCheck, 'signal' => \&OpSignal, ); my $EOL = "\012"; my $EODATA = ".\n"; my $MAX_CHILDS = 20; my $DEBUGENABLED = 1; my $PRINT_DEBUG = 0; sub spawn; # forward declaration my $waitedpid = 0; my $sigchld = 0; my $done = 0; my $child_exit; my $num_childs = 0; my $GMToffset = 0; my $TZname = ''; my $nfsen_version = 'unknown'; my %ProfilePlugins; my %modules_loaded; our $in_periodic = 0; my $cleanup_trigger = 0; sub SIG_CHILD { my $child; $sigchld = 1; while (($waitedpid = waitpid(-1,WNOHANG)) > 0) { $child_exit = $?; my $exit_value = $child_exit >> 8; my $signal_num = $child_exit & 127; my $dumped_core = $child_exit & 128; $num_childs--; if ( $child_exit ) { syslog('debug', "comm child[$waitedpid] terminated Exit: $exit_value, Signal: $signal_num, Core: $dumped_core"); } else { syslog('debug', "comm child[$waitedpid] terminated with no exit value"); } } $SIG{CHLD} = \&SIG_CHILD; # loathe sysV } # End of SIG_CHILD sub SIG_DIE { my $why = shift; syslog('err', "PANIC Comm Server dies: $why"); } # End of SIG_DIE sub GetGlobals { my $socket = shift; my $opts = shift; # for the reason of daylight saving time, we need to check the UTC offset my ($offhour, $offmin) = strftime('%z', localtime) =~ /^(.\d{2})(\d{2})/; $GMToffset = $offhour * 3600 + $offmin * 60; print $socket "_globals=\$SUBDIRLAYOUT = \"$NfConf::SUBDIRLAYOUT\";\n"; print $socket "_globals=\$FRONTEND_PLUGINDIR = \"$NfConf::FRONTEND_PLUGINDIR\";\n"; print $socket "_globals=\$RRDoffset = \"$NfConf::RRDoffset\";\n"; print $socket "_globals=\$CYCLETIME = \"$NfConf::CYCLETIME\";\n"; print $socket "_globals=\$Refresh = \"$NfConf::Refresh\";\n"; print $socket "_globals=\$GMToffset = $GMToffset;\n"; print $socket "_globals=\$TZname = \"$TZname\";\n"; print $socket "_globals=\$AllowsSystemCMD = \"$NfConf::AllowsSystemCMD\";\n"; print $socket "_globals=\$version = \"$nfsen_version\";\n"; print $socket $EODATA; print $socket "OK command completed.\n"; } # End of GetGlobals sub SemCheck { my $socket = shift; my $opts = shift; print $socket ". Semaphore Nfsync::semlock\n"; print $socket $EODATA; if ( Nfsync::semnowait() ) { Nfsync::semsignal(); print $socket "OK Semaphore available\n"; } else { print $socket "ERR Semaphore not available\n"; } } sub OpSignal { my $socket = shift; my $opts = shift; if ( !exists $$opts{'flag'} ) { print $socket $EODATA; print $socket "ERR Missing signal flag"; return; } my $flag = $$opts{'flag'}; if ( $flag eq "start-periodic" ) { $in_periodic = 1; } elsif ( $flag eq "end-periodic" ) { $in_periodic = 0; $cleanup_trigger = 1; } else { print $socket $EODATA; print $socket "ERR Illegal flag '$flag'!\n"; return; } print $socket $EODATA; print $socket "OK signal\n"; } # End of OpSignal sub RunNfdump { my $socket = shift; my $opts = shift; my $args = exists $$opts{'args'} ? $$opts{'args'} : ''; my @FilterChain = (); if ( exists $$opts{'srcselector'} ) { my $dirlist; my $ret = NfProfile::CompileFileArg($opts, \$dirlist, \@FilterChain); if ( $ret ne "ok" ) { print $socket $EODATA; print $socket "ERR $ret\n"; return; } $args = "$dirlist $args"; } my $filter = 'any'; if ( exists $$opts{'filter'} ) { my @_tmp; foreach my $line ( @{$$opts{'filter'}} ) { next if $line =~ /^\s*#/; if ( $line =~ /(.+)#/ ) { push @_tmp, $1; } else { push @_tmp, $line; } } $filter = join "\n", @_tmp; } if ( $filter =~ /[^\s!-~\n]+/ || $filter =~ /['"`;\\]/ ) { print $socket $EODATA; print $socket "ERR Illegal characters in filter\n"; return; } print "DEBUG: Stripped filer: '$filter'\n" if $PRINT_DEBUG; if ( exists $$opts{'and_filter'} ) { my $name = $$opts{'and_filter'}; if ( $name =~ /[^A-Za-z0-9\-+_]+/ ) { print $socket $EODATA; print $socket "ERR Illegal characters in filter name '$name': '$&'!\n"; return; } if ( !-f "$NfConf::FILTERDIR/$name" ) { print $socket $EODATA; print $socket "ERR filter '$name' No such filter!\n"; return; } my @_tmp; if ( open FILTER, "$NfConf::FILTERDIR/$name" ) { @_tmp = <FILTER>; close FILTER; } else { print $socket $EODATA; print $socket "ERR filter '$name': $!!\n"; return; } if ( $filter eq 'any' ) { $filter = "(" . join("", @_tmp) . ")"; } else { $filter = " ($filter) and (" . join("", @_tmp) . ")"; } } if ( scalar @FilterChain > 0 ) { if ( $filter eq 'any' ) { $filter = "(" . join("\n", @FilterChain) . ")"; } else { $filter = "(" . join("\n", @FilterChain) . ") and ( $filter )"; } } my @lines; local $SIG{CHLD} = 'DEFAULT'; print $socket ".run nfdump $args \n"; foreach my $line ( split "\n", $filter ) { print $socket "_filter=$line\n"; } print $socket "arg=$args\n"; my $pid = open(NFDUMP, "$NfConf::PREFIX/nfdump $args '$filter' 2>&1|"); if ( !$pid ) { my $err = "ERR nfdump run error: $!\n"; print $socket $EODATA; print $socket $err; return; } print $socket ".pid: $pid\n"; while ( <NFDUMP> ) { print $socket "_nfdump=$_"; } my $nfdump_exit = 0; if ( !close NFDUMP ) { $nfdump_exit = $?; my $exit_value = $nfdump_exit >> 8; my $signal_num = $nfdump_exit & 127; my $dumped_core = $nfdump_exit & 128; syslog('err', "Run nfdump failed: Exit: $exit_value, Signal: $signal_num, Coredump: $dumped_core"); }; print $socket "exit=$nfdump_exit\n"; print $socket $EODATA; print $socket "OK command completed.\n"; } # End of RunNfdump sub GetAlertConditions { my $socket = shift; my $opts = shift; if ( !exists $$opts{'alert'} ) { print $socket $EODATA; print $socket "ERR Missing alert name"; return; } my $alert = $$opts{'alert'}; if ( $alert =~ /[^A-Za-z0-9\-+_]+/ ) { print $socket $EODATA; print $socket "ERR Illegal characters in alert name '$alert'!\n"; return; } if ( !NfAlert::AlertExists($alert)) { print $socket $EODATA; print $socket "ERR Illegal characters in alert name '$alert'!\n"; return; } if ( !exists $$opts{'alertfile'} ) { print $socket $EODATA; print $socket "ERR Missing alert flow file"; return; } my $alertfile = $$opts{'alertfile'}; if ( ! -f $alertfile ) { print $socket $EODATA; print $socket "ERR alert flow file '$alertfile' does not exists!\n"; return; } if ( !exists $$opts{'plugin'} ) { print $socket $EODATA; print $socket "ERR Missing plugin name"; return; } my $plugin = $$opts{'plugin'}; if ( $plugin =~ /[^A-Za-z0-9\-+_]+/ ) { print $socket $EODATA; print $socket "ERR Illegal characters in plugin name '$plugin'!\n"; return; } if ( !exists $NfAlert::AlertPluginsCondition{$plugin} ) { print $socket $EODATA; print $socket "ERR Plugin '$plugin' does not exists or has no alert condition function\n"; return; } if ( !exists $$opts{'timeslot'} ) { print $socket $EODATA; print $socket "ERR Missing plugin name"; return; } my $timeslot = $$opts{'timeslot'}; if ( !NfSen::ValidISO($timeslot) ) { print $socket $EODATA; print $socket "ERR Not a valid timeslot '$timeslot'!\n"; return; } # now query the plugin my $ret; my $sub = "${plugin}::alert_condition"; no strict 'refs'; eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{'CHLD'} = 'DEFAULT'; $ret = &$sub( { 'alert' => $alert, 'alertfile' => $alertfile, 'timeslot' => $timeslot } ); }; use strict 'refs'; if ( $@ ) { print $socket $EODATA; print $socket "ERR Plugin: Error while running plugin '$plugin': $@ "; return; } print $socket "condition=$ret\n"; print $socket $EODATA; print $socket "OK command completed\n"; } # End of GetAlertConditions sub RunPluginAction { my $socket = shift; my $opts = shift; if ( !exists $$opts{'alert'} ) { print $socket $EODATA; print $socket "ERR Missing alert name"; return; } my $alert = $$opts{'alert'}; if ( $alert =~ /[^A-Za-z0-9\-+_]+/ ) { print $socket $EODATA; print $socket "ERR Illegal characters in alert name '$alert'!\n"; return; } if ( !NfAlert::AlertExists($alert)) { print $socket $EODATA; print $socket "ERR Illegal characters in alert name '$alert'!\n"; return; } if ( !exists $$opts{'plugin'} ) { print $socket $EODATA; print $socket "ERR Missing plugin name"; return; } my $plugin = $$opts{'plugin'}; if ( $plugin =~ /[^A-Za-z0-9\-+_]+/ ) { print $socket $EODATA; print $socket "ERR Illegal characters in plugin name '$plugin'!\n"; return; } if ( !exists $NfAlert::AlertPluginsAction{$plugin} ) { print $socket $EODATA; print $socket "ERR Plugin '$plugin' does not exists or has no alert action function\n"; return; } if ( !exists $$opts{'timeslot'} ) { print $socket $EODATA; print $socket "ERR Missing plugin name"; return; } my $timeslot = $$opts{'timeslot'}; if ( !NfSen::ValidISO($timeslot) ) { print $socket $EODATA; print $socket "ERR Not a valid timeslot '$timeslot'!\n"; return; } # now run the plugin my $sub = "${plugin}::alert_action"; no strict 'refs'; eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{'CHLD'} = 'DEFAULT'; my $ret = &$sub( { 'alert' => $alert, 'timeslot' => $timeslot } ); }; use strict 'refs'; if ( $@ ) { print $socket $EODATA; print $socket "ERR Plugin: Error while running plugin '$plugin': $@ "; return; } print $socket $EODATA; print $socket "OK command completed\n"; } # End of RunPluginAction sub load_module { my $module = shift; my ($HasRun, $HasAlertCondition, $HasAlertAction) = (0, 0, 0); eval { local $SIG{'__DIE__'} = 'DEFAULT'; require "$module.pm"; }; if ( my $err = $@ ) { syslog('err', "Loading plugin '$module': Failed."); syslog('err', "ERROR: $err"); return ($HasRun, $HasAlertCondition, $HasAlertAction); } syslog('info', "Loading plugin '$module': Success"); my $plugin_version = eval( "\$${module}::VERSION"); if ( !defined $plugin_version ) { syslog('warning', "** Important **: Plugin '$module' is a legacy plugin."); } if ( !$module->can('Init') ) { syslog('err', "plugin '$module' has no Init() function. Skip plugin."); return ($HasRun, $HasAlertCondition, $HasAlertAction); } my $ret = eval { local $SIG{'__DIE__'} = 'DEFAULT'; $module->Init(); }; if ( $@ ) { syslog('err', "Initializing plugin '$module': Module died: $@"); } else { if ( $ret ) { $HasRun = $module->can('run') ? 1 : 0; $HasAlertCondition = $module->can('alert_condition') ? 1 : 0; $HasAlertAction = $module->can('alert_action') ? 1 : 0; syslog('info', "Initializing plugin '$module': Success"); syslog('info', "plugin '$module': Profile plugin: $HasRun, Alert condition plugin: $HasAlertCondition, Alert action plugin: $HasAlertAction"); } else { syslog('warning', "Initializing plugin '$module': Suspended"); } } return ($HasRun, $HasAlertCondition, $HasAlertAction); } # End of load_module sub load_lookup { my $module = "Lookup_site"; eval { local $SIG{'__DIE__'} = 'DEFAULT'; require "$module.pm"; }; if ( my $err = $@ ) { syslog('info', "No site specific lookup module found"); return \&Lookup::Lookup; } syslog('info', "Found site specific lookup module"); if ( !$module->can('Lookup') ) { syslog('err', "site specific lookup module has no Lookup() function. Fallback to default."); return \&Lookup::Lookup; } if ( $module->can('Init') ) { syslog('info', "Run Init of site specific lookup module"); my $ret = eval { local $SIG{'__DIE__'} = 'DEFAULT'; $module->Init(); }; if ( $@ ) { syslog('err', "Initializing site specific lookup module failed: $@"); return \&Lookup::Lookup; } return \&Lookup_site::Lookup; } return \&Lookup_site::Lookup; } # End of load_lookup sub cleanup_module { my $module = shift; if ( !$module->can('Cleanup') ) { syslog('info', "plugin '$module' has no cleanup"); return; } my $ret = eval { local $SIG{'__DIE__'} = 'DEFAULT'; $module->Cleanup(); }; if ( $@ ) { syslog('err', "Cleanup plugin '$module': Module died: $@"); } else { if ( $ret ) { syslog('info', "Cleanup plugin '$module' returned: $ret"); } else { syslog('warning', "Cleanup plugin '$module': done."); } } return; } # End of cleanup_module sub CleanupPlugins { syslog('info', "Cleanup plugins"); foreach my $module ( keys %modules_loaded ) { syslog('info', "Cleanup plugin: $module"); cleanup_module($module); } } # End of CleanupPlugins sub LoadPlugins { if ( scalar @NfConf::plugins == 0 ) { return; } # That's were we find all the plugins # make warnings happy, as $NfConf::BACKEND_PLUGINDIR is used once only no warnings; unshift @INC, "$NfConf::BACKEND_PLUGINDIR"; use warnings; # Load all plugins foreach my $plugin ( @NfConf::plugins ) { my $profilelist = $$plugin[0]; my $module = $$plugin[1]; my @Profiles; # Check and report frontend plugin file if ( -f "$NfConf::FRONTEND_PLUGINDIR/${module}.php" ) { syslog('info', "Frontend module '${module}.php' found"); } # Check and report backend plugin file if ( !-f "$NfConf::BACKEND_PLUGINDIR/${module}.pm" ) { syslog('info', "No backend module '${module}.pm' found"); next; } # Try to load and initialize the module my ($HasRun, $HasAlertCondition, $HasAlertAction) = load_module($module); next if ( $HasRun == 0 && $HasAlertCondition == 0 && $HasAlertAction == 0 ); $modules_loaded{$module} = 1; $NfAlert::AlertPluginsCondition{$module} = 1 if $HasAlertCondition; $NfAlert::AlertPluginsAction{$module} = 1 if $HasAlertAction; if ( $profilelist ne '!' && $HasRun == 0 ) { syslog('err', "Plugin: '$module' has configured profiles, but no 'run' function!"); next; } next if ( $profilelist eq '!' || $HasRun == 0 ); if ( $profilelist eq '*' ) { foreach my $profilegroup ( NfProfile::ProfileGroups() ) { push @Profiles, map( "$profilegroup/$_", NfProfile::ProfileList($profilegroup)); } if ( scalar @Profiles == 0 ) { syslog('err', $Log::ERROR) if defined $Log::ERROR; } } else { @Profiles = split /\s*,\s*/, $profilelist; } foreach my $profileswitch ( @Profiles ) { my ($profilegroup, $profile); if ( $profileswitch =~ m#/# ) { ($profilegroup, $profile) = split /\//, $profileswitch; } else { $profilegroup = '.'; $profile = $profileswitch; } if ( ! NfProfile::ProfileExists($profile, $profilegroup)) { syslog('err', "Register plugin '$module' for profile '$profile' in profile group '$profilegroup' does not exists!"); next; } if ( exists $ProfilePlugins{"$profilegroup/$profile"} ) { $ProfilePlugins{"$profilegroup/$profile"} .= ",$module"; } else { $ProfilePlugins{"$profilegroup/$profile"} = "$module"; } } } foreach my $key ( keys %ProfilePlugins ) { syslog('info', "Plugins for profile : $key - $ProfilePlugins{$key}"); } foreach my $plugin ( keys %NfAlert::AlertPluginsCondition ) { syslog('info', "Plugins for Alert conditions: $plugin"); } foreach my $plugin ( keys %NfAlert::AlertPluginsAction ) { syslog('info', "Plugins for Alert actions : $plugin"); } $CMD_lookup{'lookup'} = load_lookup(); } # End of LoadPlugins sub RunPlugins { my $socket = shift; my $opts = shift; if ( !exists $$opts{'plugins'} ) { print $socket ".nothing to do\n"; print $socket $EODATA; print $socket "OK command completed.\n"; return; } if ( ref $$opts{'plugins'} ne "ARRAY" ) { print $socket $EODATA; syslog('err', "Plugins: argument vector array required, not a scalar."); print $socket "ERR argument vector array required, not a scalar.\n"; return; } foreach my $opt ( @{$$opts{'plugins'}} ) { my ( $profilegroup, $profile, $timeslot ) = split ':', $opt; if ( !defined $profilegroup ) { syslog('warning', "Plugins: Can not decode '$opt'"); next; } syslog('debug', "Plugin Cycle: $profilegroup, $profile, $timeslot"); next unless exists $ProfilePlugins{"$profilegroup/$profile"}; my $modules = $ProfilePlugins{"$profilegroup/$profile"}; foreach my $module ( split ',', $modules ) { syslog("info", "Plugin Cycle: Time: $timeslot, Profile: $profile, Group: $profilegroup, Module: $module, "); my $sub = "${module}::run"; my $plugin_version = eval( "\$${module}::VERSION"); no strict 'refs'; eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{'CHLD'} = 'DEFAULT'; if ( !defined $plugin_version ) { syslog("info", "Plugin $module: Run in compatibility mode."); &$sub($profile, $timeslot, $profilegroup); } else { &$sub( { 'profile' => $profile, 'profilegroup' => $profilegroup, 'timeslot' => $timeslot } ); } }; use strict 'refs'; if ( $@ ) { syslog("err", "Plugin: Error while running plugin '$module': $@ "); } } } print $socket $EODATA; print $socket "OK command completed.\n"; } # End of RunPlugins sub Setup_Server { my $version = shift; # in case we want INET sockets: my $port = shift; my $server; if ( 1 ) { # UNIX socket if ( !socket($server, PF_UNIX, SOCK_STREAM, 0) ) { $Log::ERROR = $!; return undef; } my $socket_path = $NfConf::COMMSOCKET; unlink $socket_path; my $uaddr = sockaddr_un($socket_path); my $ok = bind($server, $uaddr); if ( !$ok ) { $Log::ERROR = $!; close $server; return undef; } chown $NfConf::UID, $NfConf::GID, $socket_path; chmod 0660, $socket_path; } else { # TCP Internet socket my $proto_tcp = getprotobyname('tcp'); if ( !socket($server, PF_UNIX, SOCK_STREAM, $proto_tcp) ) { $Log::ERROR = $!; return undef; } my $ok = setsockopt($server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)); if ( !$ok ) { $Log::ERROR = $!; close $server; return undef; } $ok = bind($server, sockaddr_in($port, INADDR_ANY)); if ( !$ok ) { $Log::ERROR = $!; close $server; return undef; } } listen($server,SOMAXCONN); $Log::ERROR = undef; $SIG{INT} = sub { $done = 1; }; $SIG{TERM} = sub { $done = 1; }; $SIG{CHLD} = \&SIG_CHILD; $SIG{'__DIE__'} = \&SIG_DIE; $TZname = strftime('%Z', localtime); $nfsen_version = $version; return $server; } # End of Setup_Server sub spawn { my $coderef = shift; unless (@_ == 0 && $coderef && ref($coderef) eq 'CODE') { confess "usage: spawn CODEREF"; } my $pid; if (!defined($pid = fork)) { print STDERR "comm server: cannot fork: $!"; return; } elsif ($pid) { syslog('debug', "comm server started: $pid"); return; # I'm the parent } # else I'm the child -- go spawn open(STDIN, "<&Client") || die "can't dup client to stdin"; open(STDOUT, ">&Client") || die "can't dup client to stdout"; ## open(STDERR, ">&STDOUT") || die "can't dup stdout to stderr"; exit &$coderef(); } # End of spawn sub CmdDecode { my $cmd_list = shift; my $silent = shift; my $cmd = shift @$cmd_list; return 0 if !defined $cmd; if ( $cmd eq '' ) { print $EODATA; print "OK I'm here", $EOL; return 0; } my ($command, $args) = $cmd =~ /^\s*([^\s]+)\s*(.*)/; if ( !defined $command ) { print $EODATA; print "ERR Failed to decode line '$cmd'", $EOL; syslog('err', "Failed to decode: $cmd"); return 1; } my $is_binary = $command =~ s/^@// ? 1 : 0; syslog('debug', "Cmd Decode: $command"); $silent = $silent || $is_binary; print ".Command is '$command' binary mode: $is_binary", $EOL unless $silent; if ( $cmd eq 'quit' ) { print $EODATA; print "OK Bye Bye", $EOL; return 1; } $cmd = $CMD_lookup{$command}; if ( !defined $cmd ) { my ($plugin, $plugin_command ) = split /::/, $command; if ( !defined $plugin_command ) { print $EODATA; print "ERR Command unknown: '$command'", $EOL; return 0; } if ( !exists $modules_loaded{$plugin} ) { print $EODATA; print "ERR Plugin '$plugin' unknown", $EOL; return 0; } my $str = "\$${plugin}::cmd_lookup{'$plugin_command'}"; $cmd = eval ( $str ); if ( !defined $cmd ) { print $EODATA; print "ERR Plugin '$plugin' command unknown: '$plugin_command'", $EOL; return 0; } } my %opts; unshift @$cmd_list, $args if $args ne ''; my $status = ArgDecode($cmd_list, \%opts); if ( $status ne "ok" ) { print $EODATA; print "ERR $status", $EOL; return 0; } foreach my $key ( keys %opts ) { my $value = $opts{$key}; if ( ref $value eq "ARRAY" ) { foreach my $line ( @{$value} ) { print ".Key: '$key', value: '$line'", $EOL unless $silent; } } else { print ".Key: '$key', value: '$value'", $EOL unless $silent; } } my $socket = *STDOUT; &$cmd($socket, \%opts); return $is_binary; } # End of CmdDecode sub ArgDecode { my $arg_lines = shift; my $optref = shift; foreach my $arg ( @$arg_lines ) { my ($key, $value) = $arg =~ /\s*([^\s]+)\s*=\s*(.*)\s*/; if ( !defined $value || $key !~ /^[\._\w]\w[\w\-_]+/ ) { syslog('err', "Key format error for '$arg'"); return "key format error"; } if ( length($value) > 10240 ) { syslog('err', "Argument too long - length check failed."); return "value too long."; } if ( $key =~ /^_(.+)/ ) { $key = $1; if ( defined $$optref{$key} && ref $$optref{$key} ne 'ARRAY' ) { syslog('warning', "tried to assign an array entry to a scalar element for arg: '$arg'"); return "tried to assign an array entry to a scalar element"; } push @{$$optref{$key}}, $value; } else { if ( ref $$optref{$key} eq 'ARRAY' ) { syslog('warning', "tried to assign a scalar entry to an array entry for arg '$arg'"); return "tried to assign a scalar entry to an array entry"; } $$optref{$key} = $value; } } return "ok"; } # End of ArgDecode # opts: # POST_varname => array( # "required" => 1, , 0 or 1 must exists in $opts, must not be undef # "allow_undef"=> 1, , 0 or 1 allow value to be undef # "default" => undef, , if not exists or not defined use this default, maybe undef # "match" => "/[^A-Za-z0-9\-+_]+/" , value must satify this reges, may be undef # "validate" => undef), , additional validate function to call for further processing, may be undef # "scrub" -> 0 , 0 or 1 strip leading/trailing white spaces # sub ParseOpts { my $opts = shift; my $parse_opts = shift; my $messages = shift; my $form_data = {}; my $has_errors = 0; foreach my $varname ( keys %$parse_opts ) { # set the default my $value = $$parse_opts{$varname}{'default'}; if ( !exists $$opts{"$varname"} ) { if ( $$parse_opts{$varname}{'required'} == 1 ) { $has_errors = 1; push @$messages, "Required key '$varname' not found"; $$form_data{$varname} = $$parse_opts{$varname}{'default'}; next; } elsif ( !defined $value ) { next; # skip this value in list - not required, no default } } else { $value = $$opts{$varname}; } if ( !defined $value ) { if ( $$parse_opts{$varname}{'allow_undef'} ) { $$form_data{$varname} = $value; } else { $$form_data{$varname} = $$parse_opts{$varname}{'default'}; $has_errors = 1; push @$messages, "undef for key '$varname' not allowed"; next; } } else { if ( $$parse_opts{$varname}{'scrub'} ) { $value =~ s/^\s+//; $value =~ s/\s+$//; } } if ( $$parse_opts{$varname}{'numeric'} ) { if ( $value =~ /^\D$/ ) { $has_errors = 1; $$form_data{$varname} = $$parse_opts{$varname}{'default'}; push @$messages, "Value '$value' for key '$varname' not numeric"; next; } } # the value is set here if ( defined $$parse_opts{$varname}{'match'} && defined $value && ref($value) ne 'ARRAY') { if ( ref($$parse_opts{$varname}{'match'}) eq 'ARRAY' ) { my $matched = 0; foreach my $item ( @{$$parse_opts{$varname}{'match'}} ) { print "'$item' "; if ( $$parse_opts{$varname}{'numeric'} ) { if ( $item == $value ) { $matched = 1; } } else { if ( $item eq $value ) { $matched = 1; } } } if ( $matched == 0 ) { $has_errors = 1; push @$messages, "Value '$value' not allowed for key '$varname'"; $$form_data{$varname} = $$parse_opts{$varname}{'default'}; next; } } else { if ( $value !~ m/$$parse_opts{$varname}{'match'}/ ) { $has_errors = 1; push @$messages, "Value '$value' not allowed for key '$varname'"; $$form_data{$varname} = $$parse_opts{$varname}{'default'}; next; } } } # survived match - do we have a validate function? if ( defined $$parse_opts{$varname}{'validate'} ) { my $validatefunc = $$parse_opts{$varname}{'validate'}; my $err = &$validatefunc( \$value, $parse_opts); if ($err == 0 ) { $has_errors = 0; } elsif ( $err == 1 ) { push @$messages, "Value '$value' not allowed for key '$varname'"; $has_errors = 1; $value = $$parse_opts{$varname}{'default'}; } elsif ( $err == 2 ) { push @$messages, "Value '$value' not allowed for key '$varname'"; $has_errors = 1; } } # put it in array $$form_data{$varname} = $value; } return ( $form_data, $has_errors); } # End of ParseOpts sub RunServer { my $server = shift; my $paddr; my $timeout = 10; my $silent = 0; my $alarm = 0; my $SIGpipe = 0; $SIG{ALRM} = sub { $alarm = 1; }; $SIG{PIPE} = sub { $SIGpipe = 1 }; while ( !$done ) { $paddr = accept(Client,$server); if ( !$paddr ) { if ( $sigchld == 0 ) { print "Unexpected return of accept()\n"; sleep(1); } else { $sigchld = 0; } next; } # my($iport,$iaddr) = sockaddr_in($paddr); # my $name = gethostbyaddr($iaddr,AF_INET); $num_childs++; if ( $num_childs >= $MAX_CHILDS ) { syslog('warning', "Too many childs. Limit: $MAX_CHILDS"); print Client "550 ERR too many open connections.", $EOL; close Client; $num_childs--; next; } syslog('debug', "connection on UNIX socket "); spawn sub { $|=1; my $quit = 0; print "220 ", time(), " nfsend v0.1 ready ", $EOL; while ( !$quit && !$done ) { my @input; my $line; eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{ALRM} = sub { die "Timeout reading from socket!"; }; local $SIG{PIPE} = sub { die "Broken PIPE while reading"; }; my $done = 0; # read multi line command and args # command is terminated with a single '.' on a line while ( $done == 0 ) { alarm $timeout; $line = <STDIN>; alarm 0; die "Failed to read from socket: $!" unless defined $line; $line =~ s/$EOL$|\n$//; ## the following block is for debugging purpose only if ( $line =~ /^\.(\w.+)$/ ) { my $internal = $1; if ( $internal =~/^timeout=(\d+)$/ ) { $timeout = $1; print "INFO Set timeout to $timeout", $EOL unless $silent; } elsif ( $DEBUGENABLED && $internal =~/^silent=(\d+)$/ ) { $silent = $1; } elsif ( $DEBUGENABLED && $internal =~/^debug=(\d+)$/ ) { $PRINT_DEBUG = $1 == 1 ? 1 : 0; print "INFO Set debug to $PRINT_DEBUG", $EOL unless $silent; } else { print "INFO Unknown internal: '$internal'", $EOL unless $silent; } next; } if ( $line eq '.' ) { $done = 1; } else { # a single '.' on a line is doubled # most likely not used, but for clean programming do it anyway if ( $line eq '..' ) { $line = '.'; } push @input, $line; } } }; if ($@) { print $EODATA; print "OK $@", $EOL; syslog('debug', "Failed: $@"); $quit = 1; } else { if ( !defined $line ) { $quit = 1; } else { $quit = CmdDecode(\@input, $silent); } } } if ( $cleanup_trigger ) { $cleanup_trigger = 0; syslog('debug', "Cleanup Routine"); NfProfile::DeleteDelayed(); } return 0; } # End of anonymous sub ; close Client; } print "Quit Server: $waitedpid !: $! \@: $@\n"; syslog('info', "Quit comm server."); } # end of RunServer sub Close_server { my $server = shift; close $server; unlink $NfConf::COMMSOCKET; } # End of Close_server sub nfsend_connect { my $timeout = shift; my $socket_path = $NfConf::COMMSOCKET; my $nfsen_sock; if ( !socket($nfsen_sock, PF_UNIX, SOCK_STREAM, 0) ) { print "Can not create socket: $!\n"; return undef; } if ( !connect($nfsen_sock, sockaddr_un($socket_path)) ) { print "Can not connect to nfsend: $!\n"; return undef; } eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{ALRM} = sub { die "Timeout nfsend_connect"; }; local $SIG{PIPE} = sub { die "Signal PIPE nfsend_connect"; }; alarm 30; my $greeting = <$nfsen_sock>; alarm 0; if ( $greeting !~ /^220/ ) { print "Communication nfsend failed: $greeting\n"; close($nfsen_sock); return undef; } if ( defined $timeout ) { send $nfsen_sock, ".timeout=$timeout\n", 0; my $ans = <$nfsen_sock>; if ( $ans !~ /INFO Set timeout/ ) { print "Failed to set timeout to $timeout: $ans\n"; send $nfsen_sock, "quit\n.\n", 0; close($nfsen_sock); return undef; } } }; if ($@) { print "Communication nfsend failed. $@\n"; close($nfsen_sock); return undef; } return $nfsen_sock; } # End of nfsend_connect sub nfsend_disconnect { my $sock = shift; my $status; eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{ALRM} = sub { die; }; # send quit command # print "Send: quit\n"; send $sock, "quit\n", 0; send $sock, ".\n", 0; # read response alarm(30); my $line; while ( $line = <$sock> ) { # Debug output from nfsend if ( $line =~ /^\..+/ ) { print "DEBUG: $line" if $PRINT_DEBUG; next; } # End of Data if ( $line =~ /^\.$/ ) { $status = <$sock>; last; } last if $line =~ /^ERR|OK/; } alarm(0); }; if ($@) { return "ERR Communication nfsend failed. $@\n"; } # we are done close $sock; return $status; } # End of nfsend_disconnect sub nfsend_comm { my $sock = shift; my $command = shift; my $cmd_opts = shift; my $out_list = shift; my $comm_opts = shift; my $timeout = 30; if ( defined $comm_opts && defined $$comm_opts{'timeout'} ) { $timeout = $$comm_opts{'timeout'}; } my $status = ''; eval { local $SIG{'__DIE__'} = 'DEFAULT'; local $SIG{ALRM} = sub { die "Timeout on socket"; }; local $SIG{PIPE} = sub { die "Broken Pipe"; }; # send command and options # print "Send: $command\n"; send $sock, "$command\n", 0; foreach my $key ( keys %$cmd_opts ) { if ( ref $$cmd_opts{$key} eq "ARRAY" ) { foreach my $line ( @{$$cmd_opts{$key}} ) { send $sock, "_$key=$line\n", 0; } } else { # print "Send: $key=$$cmd_opts{$key}\n"; send $sock, "$key=$$cmd_opts{$key}\n", 0; } } # print "Send: EODATA\n"; send $sock,".\n", 0; # read response alarm($timeout); while ( my $line = <$sock> ) { # Debug output from nfsend if ( $line =~ /^\..+/ ) { print "DEBUG: $line" if $PRINT_DEBUG; if ( defined $comm_opts && defined $$comm_opts{'info'} && $line =~ /^\.info /) { $line =~ s/\.info //; # cut header $line =~ s/\n//; # cut potential EOL print "Info: $line\n"; } next; } # End of Data if ( $line =~ /^\.$/ ) { # print "Received EODATA\n"; $status = <$sock>; last; } my ($key, $value) = $line =~ /\s*([^=]+)=(.*)$/; if ( !defined $key ) { # print "Could not decode: $line"; next; } if ( $key =~ /^_(.*)$/ ) { $key = $1; if ( exists $$out_list{"$key"} ) { push @{$$out_list{"$key"}}, $value; } else { my $anon = []; push @{$anon}, $value; $$out_list{"$key"} = $anon; } } else { $$out_list{"$key"} = $value; } print "DEBUG: Key: $key, value: $value\n" if $PRINT_DEBUG; } alarm(0); }; if ($@) { return "ERR Communication nfsend failed. $@\n"; } return $status; } # End of nfsend_comm sub socket_send_ok { my $socket = shift; my $args = shift; foreach my $key ( keys %$args ) { if ( ref $$args{$key} eq 'ARRAY' ) { foreach my $elem ( @{$$args{$key}} ) { print $socket "_$key=$elem\n"; } } else { print $socket "$key=$$args{$key}\n"; } } print $socket $EODATA; print $socket "OK command completed.\n"; } # End of socket_send_ok sub socket_send_error { my $socket = shift; my $error = shift; print $socket $EODATA; print $socket "ERR $error\n"; } # End of socket_send_error 1;
millingworth/nfsen
libexec/Nfcomm.pm
Perl
bsd-3-clause
36,590
=pod =head1 NAME SSL_key_update, SSL_get_key_update_type, SSL_renegotiate, SSL_renegotiate_abbreviated, SSL_renegotiate_pending - initiate and obtain information about updating connection keys =head1 SYNOPSIS #include <openssl/ssl.h> int SSL_key_update(SSL *s, int updatetype); int SSL_get_key_update_type(const SSL *s); int SSL_renegotiate(SSL *s); int SSL_renegotiate_abbreviated(SSL *s); int SSL_renegotiate_pending(const SSL *s); =head1 DESCRIPTION SSL_key_update() schedules an update of the keys for the current TLS connection. If the B<updatetype> parameter is set to B<SSL_KEY_UPDATE_NOT_REQUESTED> then the sending keys for this connection will be updated and the peer will be informed of the change. If the B<updatetype> parameter is set to B<SSL_KEY_UPDATE_REQUESTED> then the sending keys for this connection will be updated and the peer will be informed of the change along with a request for the peer to additionally update its sending keys. It is an error if B<updatetype> is set to B<SSL_KEY_UPDATE_NONE>. SSL_key_update() must only be called after the initial handshake has been completed and TLSv1.3 has been negotiated. The key update will not take place until the next time an IO operation such as SSL_read_ex() or SSL_write_ex() takes place on the connection. Alternatively SSL_do_handshake() can be called to force the update to take place immediately. SSL_get_key_update_type() can be used to determine whether a key update operation has been scheduled but not yet performed. The type of the pending key update operation will be returned if there is one, or SSL_KEY_UPDATE_NONE otherwise. SSL_renegotiate() and SSL_renegotiate_abbreviated() should only be called for connections that have negotiated TLSv1.2 or less. Calling them on any other connection will result in an error. When called from the client side, SSL_renegotiate() schedules a completely new handshake over an existing SSL/TLS connection. The next time an IO operation such as SSL_read_ex() or SSL_write_ex() takes place on the connection a check will be performed to confirm that it is a suitable time to start a renegotiation. If so, then it will be initiated immediately. OpenSSL will not attempt to resume any session associated with the connection in the new handshake. When called from the client side, SSL_renegotiate_abbreviated() works in the same was as SSL_renegotiate() except that OpenSSL will attempt to resume the session associated with the current connection in the new handshake. When called from the server side, SSL_renegotiate() and SSL_renegotiate_abbreviated() behave identically. They both schedule a request for a new handshake to be sent to the client. The next time an IO operation is performed then the same checks as on the client side are performed and then, if appropriate, the request is sent. The client may or may not respond with a new handshake and it may or may not attempt to resume an existing session. If a new handshake is started then this will be handled transparently by calling any OpenSSL IO function. If an OpenSSL client receives a renegotiation request from a server then again this will be handled transparently through calling any OpenSSL IO function. For a TLS connection the client will attempt to resume the current session in the new handshake. For historical reasons, DTLS clients will not attempt to resume the session in the new handshake. The SSL_renegotiate_pending() function returns 1 if a renegotiation or renegotiation request has been scheduled but not yet acted on, or 0 otherwise. =head1 RETURN VALUES SSL_key_update(), SSL_renegotiate() and SSL_renegotiate_abbreviated() return 1 on success or 0 on error. SSL_get_key_update_type() returns the update type of the pending key update operation or SSL_KEY_UPDATE_NONE if there is none. SSL_renegotiate_pending() returns 1 if a renegotiation or renegotiation request has been scheduled but not yet acted on, or 0 otherwise. =head1 SEE ALSO L<ssl(7)>, L<SSL_read_ex(3)>, L<SSL_write_ex(3)>, L<SSL_do_handshake(3)> =head1 HISTORY The SSL_key_update() and SSL_get_key_update_type() functions were added in OpenSSL 1.1.1. =head1 COPYRIGHT Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
kipid/blog
nodejs/openssl-master/doc/man3/SSL_key_update.pod
Perl
mit
4,487
#!/usr/bin/perl #Permission:android.permission.CHANGE_WIFI_STATE #643 Callers: %mapcount = (); $currentperm = ""; open FILE, "<pcm" or die $!; while (<FILE>) { chomp($_); if ($_ =~ m/^Permission:(.*)$/) { $currentperm = $1; } elsif ($_ =~ m/^([^\s]*) Callers:/) { $mapcount{$currentperm} = $1; } } close FILE; foreach $k (keys %mapcount) { $l = $k; $l =~ s/=/\t/; print "$l\t".$mapcount{$k}."\n"; }
USC-NSL/SIF
lib/PScout/bin/countmapping.pl
Perl
apache-2.0
413
package # Date::Manip::Offset::off147; # Copyright (c) 2008-2014 Sullivan Beck. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # This file was automatically generated. Any changes to this file will # be lost the next time 'tzdata' is run. # Generated on: Fri Nov 21 11:03:45 EST 2014 # Data version: tzdata2014j # Code version: tzcode2014j # This module contains data from the zoneinfo time zone database. The original # data was obtained from the URL: # ftp://ftp.iana.orgtz use strict; use warnings; require 5.010000; our ($VERSION); $VERSION='6.48'; END { undef $VERSION; } our ($Offset,%Offset); END { undef $Offset; undef %Offset; } $Offset = '+07:36:42'; %Offset = ( 0 => [ 'asia/hong_kong', ], ); 1;
nriley/Pester
Source/Manip/Offset/off147.pm
Perl
bsd-2-clause
852
#!/usr/bin/env perl use strict; use warnings; use Carp; use Getopt::Long qw(:config no_ignore_case bundling); use File::Basename; use FindBin; use lib ("$FindBin::RealBin/../../PerlLib"); use CanvasXpress::Heatmap; use CGI; use CGI::Carp qw(fatalsToBrowser); my $usage = <<__EOUSAGE__; ################################################################################### # # -R <string> the filename for the stored RData (file.all.RData) # ################################################################################### __EOUSAGE__ ; my $help_flag = 0; my $R_data_file; &GetOptions ( 'h' => \$help_flag, 'R=s' => \$R_data_file, ); if ($help_flag) { die $usage; } unless ($R_data_file) { die $usage; } #### sub process_cmd { my ($cmd) = @_; print STDERR "CMD: $cmd\n"; my $ret = system($cmd); if ($ret) { die "Error, cmd $cmd died with ret $ret"; } return; } main: { unless (-s $R_data_file) { die "Error, cannot find pre-existing R-session data as file: $R_data_file"; } my $matrix_data = "$R_data_file.ordered_gene_matrix"; my $gene_tree = "$R_data_file.gene_nodist_tree"; my $gene_tree_text; if (! (-s $matrix_data && -s $gene_tree)) { # generate required files. my $R_script = "__tmp_write_heatmap_html.R"; open (my $ofh, ">$R_script") or die "Error, cannot write to file $R_script"; print $ofh "source(\"$FindBin::RealBin/R/get_cluster_info.R\")\n"; print $ofh "get_cluster_info(\"$R_data_file\")\n"; close $ofh; &process_cmd("R --vanilla -q --slave < $R_script"); open (my $fh, $matrix_data) or die "Error, cannot open file $matrix_data"; my $header = <$fh>; chomp $header; my @gene_ids; my $counter = 0; while (<$fh>) { chomp; my ($gene_id, @expr_vals) = split(/\t/); push (@gene_ids, $gene_id); } close $fh; $gene_tree_text = `cat $gene_tree`; $gene_tree_text =~ s/;\s+$//g; $gene_tree_text = &convert_ids($gene_tree_text, \@gene_ids); open ($ofh, ">$gene_tree.ids_converted") or die $!; print $ofh $gene_tree_text; close $ofh; } else { $gene_tree_text = `cat $gene_tree.ids_converted`; } ############################################# ## Generate HTML Heatmap ################### ############################################# print "<html>\n"; my @sample_ids; my @feature_matrix; open (my $fh, $matrix_data) or die "Error, cannot open file $matrix_data"; my $header = <$fh>; chomp $header; @sample_ids = split(/\t/, $header); my $counter = 0; while (<$fh>) { chomp; my ($gene_id, @expr_vals) = split(/\t/); push (@feature_matrix, [$gene_id, @expr_vals]); $counter++; # if ($counter > 10) { last; } } close $fh; my %heatmap_inputs = ( samples => [@sample_ids], value_matrix => [@feature_matrix], feature_tree => $gene_tree_text, ); print &CanvasXpress::Heatmap::draw(%heatmap_inputs); #print "cx.clusterVariables();\n"; #print "cx.clusterSamples();\n"; print "</html>\n"; exit(0); } #### sub convert_ids { my ($gene_tree_text, $gene_ids_aref) = @_; my $counter = 0; foreach my $gene_id (@$gene_ids_aref) { $counter++; $gene_tree_text =~ s/([\(,])$counter([\),])/$1$gene_id$2/ or die "Error, no replacement for identifier $counter, $gene_id"; } return($gene_tree_text); }
mr-c/trinityrnaseq
Analysis/DifferentialExpression/diff_expr_analysis_to_heatmap_html.pl
Perl
bsd-3-clause
3,868
:- local struct(pci_driver( binary, % Name of driver binary supported_cards, % List of cards this binary supports core_hint, % Preferred core to start the driver core_offset, % Core offset where to start the drivers (multi instance) multi_instance, % Allow multi instances of the driver interrupt_load, % Expected Interrupt load platforms % List of architectures the driver runs on )). :- local struct(cpu_driver( binary, % Name of driver binary platforms % List of architectures the driver runs on )). :- local struct(bus_driver( binary, % Name of driver binary core_hint, % Preferred core to start the driver platforms % List of architectures the driver runs on )). :- local struct(pci_card( vendor, % PCI Vendor ID device, % PCI Device ID function, subvendor, subdevice )). % % Driver entries % pci_driver{ binary: "e1000n", supported_cards: [ pci_card{ vendor: 16'8086, device: 16'1521, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'107d, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'107e, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'107f, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'10b9, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'1096, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'100e, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'10d3, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'10c9, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'10a7, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'1533, function: _, subvendor: _, subdevice: _ } ], core_hint: 2, core_offset: 0, multi_instance: 0, interrupt_load: 0.75, platforms: ['x86_64', 'x86_32'] }. pci_driver{ binary: "rtl8029", supported_cards: [ pci_card{ vendor: 16'10ec, device: 16'8029, function: _, subvendor: _, subdevice: _ } ], core_hint: 0, core_offset: 0, multi_instance: 0, interrupt_load: 0.5, platforms: ['x86_64', 'x86_32'] }. pci_driver{ binary: "xeon_phi", supported_cards: [ pci_card{ vendor: 16'8086, device: 16'225e, function: _, subvendor: _, subdevice: _ } ], core_hint: 2, core_offset: 20, multi_instance: 1, interrupt_load: 0.5, platforms: ['x86_64'] }. pci_driver{ binary: "ioat_dma", supported_cards: [ pci_card{ vendor: 16'8086, device: 16'0e20, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'2f20, function: _, subvendor: _, subdevice: _ } ], core_hint: 4, core_offset: 20, multi_instance: 1, interrupt_load: 0.5, platforms: ['x86_64'] }. pci_driver{ binary: "ahcid", supported_cards: [ pci_card{ vendor: 16'8086, device: 16'2922, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'8086, device: 16'3a22, function: _, subvendor: _, subdevice: _ }, pci_card{ vendor: 16'1002, device: 16'4390, function: _, subvendor: _, subdevice: _ } ], core_hint: 0, core_offset: 0, multi_instance: 0, interrupt_load: 0.5, platforms: ['x86_64', 'x86_32'] }. cpu_driver{ binary: "cpu", platforms: ['x86_64', 'x86_32'] }. bus_driver{ binary: "ioapic", core_hint: 0, platforms: ['x86_64', 'x86_32'] }. % % Driver selection logic % find_pci_driver(PciInfo, DriverInfo) :- PciInfo = pci_card{vendor:VId, device: DId, function: Fun, subvendor: SVId, subdevice: SDId}, pci_driver{binary: Binary, supported_cards: Cards, core_hint: Core, core_offset: Offset, multi_instance: Multi, interrupt_load: IRQLoad, platforms: Platforms}, member(PciInfo, Cards), % TODO: Find best match or rely on order how facts are added !, % TODO: Core Selection based on PCI Info, core_hint, irqload, platforms, % (+ may need to pass bus number here as well?) DriverInfo = driver(Core, Multi, Offset, Binary). find_cpu_driver(ApicId, DriverInfo) :- cpu_driver{binary: Binary, platforms: Platforms}, % TODO: In future use ApicId to select cpu driver that has listed the correct % platform DriverInfo = driver(Binary). find_ioapic_driver(IOApicId, DriverInfo) :- bus_driver{binary: Binary, core_hint: Core, platforms: Platforms}, % TODO: Select appropriate Core based on core_hint, platform, ioapic id DriverInfo = driver(Core, Binary).
utsav2601/cmpe295A
usr/skb/programs/device_db.pl
Perl
mit
4,849
#!/usr/bin/perl # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. =head1 NAME html2mdtext.pl - Convert HTML to mdtext for the Apache CMS =head1 SYNOPSIS html2mdtext.pl =head1 DESCRIPTION This script creates mdtext files from HTML. It must be run in the C<c> directory and scans all .html files found in C<autogen/share/doc/clownfish>. The resulting mdtext files are stored in a directory named C<mdtext>. =cut use strict; use warnings; use utf8; use File::Find; use File::Path qw( make_path ); use File::Slurp; my $src_dir = 'autogen/share/doc/clownfish'; my $out_root = 'mdtext'; find( { wanted => \&process_file, no_chdir => 1 }, $src_dir ); sub process_file { my $filename = $_; my $dir = $File::Find::topdir; return if -d $filename || $filename !~ /\.html\z/; $filename =~ s|^$dir/||; html2mdtext( $dir, $filename ); }; sub html2mdtext { my ( $base_dir, $filename ) = @_; my $content = read_file( "$base_dir/$filename", binmode => ':utf8' ); if ($content !~ m|<title>([^<]+)</title>|) { warn("No title found in $filename"); return; } my $title = $1; if ($content !~ m|<body>\s*(.+?)\s*</body>|s) { warn("No body found in $filename"); return; } $content = $1; # Increase header level. $content =~ s{(</?h)(\d)>}{ $1 . ($2 + 1) . '>' }ge; $content = <<"EOF"; Title: $title <div class="c-api"> $content </div> EOF my @path_comps = split('/', $filename); pop(@path_comps); my $out_dir = join('/', $out_root, @path_comps); make_path($out_dir); my $out_filename = "$out_root/$filename"; $out_filename =~ s|(\.[^/.]*)?\z|.mdtext|; write_file( $out_filename, { binmode => ':utf8' }, \$content ); }
nwellnhof/lucy-clownfish
devel/bin/html2mdtext.pl
Perl
apache-2.0
2,484
# 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/asia. Olson data version 2012c # # Do not edit this file directly. # package DateTime::TimeZone::Asia::Seoul; { $DateTime::TimeZone::Asia::Seoul::VERSION = '1.46'; } use strict; use Class::Singleton 1.03; use DateTime::TimeZone; use DateTime::TimeZone::OlsonDB; @DateTime::TimeZone::Asia::Seoul::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' ); my $spans = [ [ DateTime::TimeZone::NEG_INFINITY, 59611131128, DateTime::TimeZone::NEG_INFINITY, 59611161600, 30472, 0, 'LMT' ], [ 59611131128, 60081751800, 59611161728, 60081782400, 30600, 0, 'KST' ], [ 60081751800, 60810188400, 60081784200, 60810220800, 32400, 0, 'KST' ], [ 60810188400, 60936420600, 60810219000, 60936451200, 30600, 0, 'KST' ], [ 60936420600, 61637554800, 60936453000, 61637587200, 32400, 0, 'KST' ], [ 61637554800, 61831699200, 61637583600, 61831728000, 28800, 0, 'KST' ], [ 61831699200, 61842150000, 61831731600, 61842182400, 32400, 1, 'KDT' ], [ 61842150000, 61870752000, 61842178800, 61870780800, 28800, 0, 'KST' ], [ 61870752000, 62096167800, 61870782600, 62096198400, 30600, 0, 'KST' ], [ 62096167800, 62683254000, 62096200200, 62683286400, 32400, 0, 'KST' ], [ 62683254000, 62696556000, 62683290000, 62696592000, 36000, 1, 'KDT' ], [ 62696556000, 62714703600, 62696588400, 62714736000, 32400, 0, 'KST' ], [ 62714703600, 62728005600, 62714739600, 62728041600, 36000, 1, 'KDT' ], [ 62728005600, DateTime::TimeZone::INFINITY, 62728038000, DateTime::TimeZone::INFINITY, 32400, 0, 'KST' ], ]; sub olson_version { '2012c' } sub has_dst_changes { 3 } sub _max_year { 2022 } sub _new_instance { return shift->_init( @_, spans => $spans ); } 1;
leighpauls/k2cro4
third_party/perl/perl/vendor/lib/DateTime/TimeZone/Asia/Seoul.pm
Perl
bsd-3-clause
1,969
#------------------------------------------------------------------------------ # File: Sanyo.pm # # Description: Sanyo EXIF maker notes tags # # Revisions: 04/06/2004 - P. Harvey Created # # Reference: http://www.exif.org/makernotes/SanyoMakerNote.html #------------------------------------------------------------------------------ package Image::ExifTool::Sanyo; use strict; use vars qw($VERSION); use Image::ExifTool::Exif; $VERSION = '1.16'; my %offOn = ( 0 => 'Off', 1 => 'On', ); %Image::ExifTool::Sanyo::Main = ( WRITE_PROC => \&Image::ExifTool::Exif::WriteExif, CHECK_PROC => \&Image::ExifTool::Exif::CheckExif, WRITABLE => 1, GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, 0x00ff => { # this is an absolute offset in the JPG file... odd - PH Name => 'MakerNoteOffset', Writable => 'int32u', }, 0x0100 => { Name => 'SanyoThumbnail', Groups => { 2 => 'Preview' }, Writable => 'undef', WriteCheck => '$self->CheckImage(\$val)', RawConv => '$self->ValidateImage(\$val,$tag)', }, 0x0200 => { Name => 'SpecialMode', Writable => 'int32u', Count => 3, }, 0x0201 => { Name => 'SanyoQuality', Flags => 'PrintHex', Writable => 'int16u', PrintConv => { 0x0000 => 'Normal/Very Low', 0x0001 => 'Normal/Low', 0x0002 => 'Normal/Medium Low', 0x0003 => 'Normal/Medium', 0x0004 => 'Normal/Medium High', 0x0005 => 'Normal/High', 0x0006 => 'Normal/Very High', 0x0007 => 'Normal/Super High', # have seen 0x11 with HD2000 in '8M-H JPEG' mode - PH 0x0100 => 'Fine/Very Low', 0x0101 => 'Fine/Low', 0x0102 => 'Fine/Medium Low', 0x0103 => 'Fine/Medium', 0x0104 => 'Fine/Medium High', 0x0105 => 'Fine/High', 0x0106 => 'Fine/Very High', 0x0107 => 'Fine/Super High', 0x0200 => 'Super Fine/Very Low', 0x0201 => 'Super Fine/Low', 0x0202 => 'Super Fine/Medium Low', 0x0203 => 'Super Fine/Medium', 0x0204 => 'Super Fine/Medium High', 0x0205 => 'Super Fine/High', 0x0206 => 'Super Fine/Very High', 0x0207 => 'Super Fine/Super High', }, }, 0x0202 => { Name => 'Macro', Writable => 'int16u', PrintConv => { 0 => 'Normal', 1 => 'Macro', 2 => 'View', 3 => 'Manual', }, }, 0x0204 => { Name => 'DigitalZoom', Writable => 'rational64u', }, 0x0207 => 'SoftwareVersion', 0x0208 => 'PictInfo', 0x0209 => 'CameraID', 0x020e => { Name => 'SequentialShot', Writable => 'int16u', PrintConv => { 0 => 'None', 1 => 'Standard', 2 => 'Best', 3 => 'Adjust Exposure', }, }, 0x020f => { Name => 'WideRange', Writable => 'int16u', PrintConv => \%offOn, }, 0x0210 => { Name => 'ColorAdjustmentMode', Writable => 'int16u', PrintConv => \%offOn, }, 0x0213 => { Name => 'QuickShot', Writable => 'int16u', PrintConv => \%offOn, }, 0x0214 => { Name => 'SelfTimer', Writable => 'int16u', PrintConv => \%offOn, }, # 0x0215 - Flash? 0x0216 => { Name => 'VoiceMemo', Writable => 'int16u', PrintConv => \%offOn, }, 0x0217 => { Name => 'RecordShutterRelease', Writable => 'int16u', PrintConv => { 0 => 'Record while down', 1 => 'Press start, press stop', }, }, 0x0218 => { Name => 'FlickerReduce', Writable => 'int16u', PrintConv => \%offOn, }, 0x0219 => { Name => 'OpticalZoomOn', Writable => 'int16u', PrintConv => \%offOn, }, 0x021b => { Name => 'DigitalZoomOn', Writable => 'int16u', PrintConv => \%offOn, }, 0x021d => { Name => 'LightSourceSpecial', Writable => 'int16u', PrintConv => \%offOn, }, 0x021e => { Name => 'Resaved', Writable => 'int16u', PrintConv => { 0 => 'No', 1 => 'Yes', }, }, 0x021f => { Name => 'SceneSelect', Writable => 'int16u', PrintConv => { 0 => 'Off', 1 => 'Sport', 2 => 'TV', 3 => 'Night', 4 => 'User 1', 5 => 'User 2', 6 => 'Lamp', #PH }, }, 0x0223 => [ { Name => 'ManualFocusDistance', Condition => '$format eq "rational64u"', Writable => 'rational64u', }, { #PH Name => 'FaceInfo', SubDirectory => { TagTable => 'Image::ExifTool::Sanyo::FaceInfo' }, }, ], 0x0224 => { Name => 'SequenceShotInterval', Writable => 'int16u', PrintConv => { 0 => '5 frames/s', 1 => '10 frames/s', 2 => '15 frames/s', 3 => '20 frames/s', }, }, 0x0225 => { Name => 'FlashMode', Writable => 'int16u', PrintConv => { 0 => 'Auto', 1 => 'Force', 2 => 'Disabled', 3 => 'Red eye', }, }, 0x0e00 => { Name => 'PrintIM', Description => 'Print Image Matching', Writable => 0, SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main', }, }, 0x0f00 => { Name => 'DataDump', Writable => 0, Binary => 1, }, ); # face detection information (ref PH) %Image::ExifTool::Sanyo::FaceInfo = ( PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, WRITE_PROC => \&Image::ExifTool::WriteBinaryData, CHECK_PROC => \&Image::ExifTool::CheckBinaryData, GROUPS => { 0 => 'MakerNotes', 2 => 'Image' }, WRITABLE => 1, FORMAT => 'int32u', FIRST_ENTRY => 0, 0 => 'FacesDetected', 4 => { Name => 'FacePosition', Format => 'int32u[4]', Notes => q{ left, top, right and bottom coordinates of detected face in an unrotated 640-pixel-wide image, with increasing Y downwards }, }, ); # tags in Sanyo MOV videos (PH - observations from an E6 sample) # (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos) %Image::ExifTool::Sanyo::MOV = ( PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, NOTES => 'This information is found in Sanyo MOV videos.', 0x00 => { Name => 'Make', Format => 'string[24]', }, 0x18 => { Name => 'Model', Description => 'Camera Model Name', Format => 'string[8]', }, # (01 00 at offset 0x20) 0x26 => { Name => 'ExposureTime', Format => 'int32u', ValueConv => '$val ? 10 / $val : 0', PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)', }, 0x2a => { Name => 'FNumber', Format => 'int32u', ValueConv => '$val / 10', PrintConv => 'sprintf("%.1f",$val)', }, 0x32 => { Name => 'ExposureCompensation', Format => 'int32s', ValueConv => '$val / 10', PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)', }, 0x44 => { Name => 'WhiteBalance', Format => 'int16u', PrintConv => { 0 => 'Auto', 1 => 'Daylight', 2 => 'Shade', 3 => 'Fluorescent', #2 4 => 'Tungsten', 5 => 'Manual', }, }, 0x48 => { Name => 'FocalLength', Format => 'int32u', ValueConv => '$val / 10', PrintConv => 'sprintf("%.1f mm",$val)', }, ); # tags in Sanyo MP4 videos (PH - from C4, C5 and HD1A samples) # --> very similar to Samsung MP4 information # (there is still a lot more information here that could be decoded!) %Image::ExifTool::Sanyo::MP4 = ( PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, NOTES => 'This information is found in Sanyo MP4 videos.', 0x00 => { Name => 'Make', Format => 'string[5]', PrintConv => 'ucfirst(lc($val))', }, 0x18 => { Name => 'Model', Description => 'Camera Model Name', Format => 'string[8]', }, # (01 00 at offset 0x28) # (0x2e has values 0x31, 0x33 and 0x3c in my samples, but # some of the shutter speeds should be around 1/500 or so) 0x32 => { Name => 'FNumber', Format => 'rational64u', PrintConv => 'sprintf("%.1f",$val)', }, 0x3a => { # (NC) Name => 'ExposureCompensation', Format => 'rational64s', PrintConv => '$val ? sprintf("%+.1f", $val) : 0', }, 0x6a => { Name => 'ISO', Format => 'int32u', }, 0xd1 => { Name => 'Software', Notes => 'these tags are shifted up by 1 byte for some models like the HD1A', Format => 'undef[32]', RawConv => q{ $val =~ /^SANYO/ or return undef; $val =~ tr/\0//d; $$self{SanyoSledder0xd1} = 1; return $val; }, }, 0xd2 => { Name => 'Software', Format => 'undef[32]', RawConv => q{ $val =~ /^SANYO/ or return undef; $val =~ tr/\0//d; $$self{SanyoSledder0xd2} = 1; return $val; }, }, 0xf1 => { Name => 'Thumbnail', Condition => '$$self{SanyoSledder0xd1}', SubDirectory => { TagTable => 'Image::ExifTool::Sanyo::Thumbnail', Base => '$start', }, }, 0xf2 => { Name => 'Thumbnail', Condition => '$$self{SanyoSledder0xd2}', SubDirectory => { TagTable => 'Image::ExifTool::Sanyo::Thumbnail', Base => '$start', }, }, ); # thumbnail image information found in MP4 videos (similar in Olympus,Samsung,Sanyo) %Image::ExifTool::Sanyo::Thumbnail = ( PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, FIRST_ENTRY => 0, FORMAT => 'int32u', 1 => 'ThumbnailWidth', 2 => 'ThumbnailHeight', 3 => 'ThumbnailLength', 4 => { Name => 'ThumbnailOffset', IsOffset => 1 }, ); #------------------------------------------------------------------------------ # Patch incorrect offsets in J1, J2, J4, S1, S3 and S4 maker notes # Inputs: 0) valuePtr, 1) end of previous value, 2) value size, 3) tag ID, 4) write flag sub FixOffsets($$$$;$) { my ($valuePtr, $valEnd, $size, $tagID, $wFlag) = @_; # ignore existing offsets and calculate reasonable values instead if ($tagID == 0x100) { # just ignore the SanyoThumbnail when writing (pointer is garbage) $_[0] = undef if $wFlag; } else { $_[0] = $valEnd; # set value pointer to next logical location ++$size if $size & 0x01; $_[1] += $size; # update end-of-value pointer } } 1; # end __END__ =head1 NAME Image::ExifTool::Sanyo - Sanyo EXIF maker notes tags =head1 SYNOPSIS This module is loaded automatically by Image::ExifTool when required. =head1 DESCRIPTION This module contains definitions required by Image::ExifTool to interpret Sanyo maker notes in EXIF information. =head1 AUTHOR Copyright 2003-2015, Phil Harvey (phil at owl.phy.queensu.ca) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 REFERENCES =over 4 =item L<http://www.exif.org/makernotes/SanyoMakerNote.html> =back =head1 SEE ALSO L<Image::ExifTool::TagNames/Sanyo Tags>, L<Image::ExifTool(3pm)|Image::ExifTool> =cut
mudasobwa/exifice
vendor/Image-ExifTool-10.02/lib/Image/ExifTool/Sanyo.pm
Perl
mit
12,117
=head1 NAME memcapable - Check memcached server capabilities =head1 SYNOPSIS memcat [-h hostname] [-p port] [-c] [-v] [-t n] =head1 DESCRIPTION B<memcapable> connects to the specified memcached server and tries to determine its capabilities by running the various commands and verifying the response. =head1 OPTIONS The following options are supported: =over 3 =item -h hostname Specify the hostname to connect to. The default is I<localhost> =item -p port Specify the port number to connect to. The default is I<11211> =item -c Generate a coredump when it detects an error from the server. =item -v Print out the comparison when it detects an error from the server. =item -t n Set the timeout from an IO operation to/from the server to I<n> seconds. =back =head1 LIMITATIONS The current version of memcapable will only verify the binary protocol. =head1 HOME To find out more information please check: L<https://launchpad.net/libmemcached> =head1 AUTHOR Trond Norbye, E<lt>trond.norbye@gmail.comE<gt> =head1 SEE ALSO memcached(1) libmemcached(3) =cut
simplegeo/libmemcached
docs/memcapable.pod
Perl
bsd-3-clause
1,083
# -*- Perl -*- use strict; use warnings; use v5.10; package ZCME::Facebook::Graph::TestUser; use base qw(ZCME::REST::Object); use Carp qw(carp croak); our $VERBOSE = 0; sub new { my $class = shift; my $self=$class->SUPER::new(shift); $self->{_content} = shift; return $self; } sub access_token { my $self = shift; return $self->{_content}->{access_token}; } sub login_url { my $self = shift; return $self->{_content}->{login_url}; } sub id { my $self = shift; return $self->{_content}->{id}; } sub _flatten { my @flat = (); foreach my $val (@_) { if(ref($val) eq 'ARRAY') { push(@flat, _flatten(@$val)); } else { push(@flat, $val); } } return @flat; } sub _comma { return join(',', _flatten(shift)); } sub install { my $self = shift; my %params = @_; my $access_token = $self->rest_object()->oauth()->app_access_token(); my $data = { installed => 'true', owner_access_token => $access_token, access_token => $access_token, uid => $self->id(), }; if(defined($params{-permissions})) { $data->{permissions} = _comma($params{-permissions}); } if(defined($params{-name})) { $data->{name} = $params{-name}; } my $app_id = $self->rest_object()->oauth()->client_id(); $self->{_content} = $self->rest("POST", "$app_id/accounts/test-users", $data); } 1;
zarfmouse/zcme-lib-perl
lib/ZCME/Facebook/Graph/TestUser.pm
Perl
mit
1,413
package # Date::Manip::TZ::eutall00; # Copyright (c) 2008-2015 Sullivan Beck. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # This file was automatically generated. Any changes to this file will # be lost the next time 'tzdata' is run. # Generated on: Wed Nov 25 11:33:44 EST 2015 # Data version: tzdata2015g # Code version: tzcode2015g # This module contains data from the zoneinfo time zone database. The original # data was obtained from the URL: # ftp://ftp.iana.org/tz use strict; use warnings; require 5.010000; our (%Dates,%LastRule); END { undef %Dates; undef %LastRule; } our ($VERSION); $VERSION='6.52'; END { undef $VERSION; } %Dates = ( 1 => [ [ [1,1,2,0,0,0],[1,1,2,1,39,0],'+01:39:00',[1,39,0], 'LMT',0,[1879,12,31,22,20,59],[1879,12,31,23,59,59], '0001010200:00:00','0001010201:39:00','1879123122:20:59','1879123123:59:59' ], ], 1879 => [ [ [1879,12,31,22,21,0],[1880,1,1,0,0,0],'+01:39:00',[1,39,0], 'TMT',0,[1918,1,31,22,20,59],[1918,1,31,23,59,59], '1879123122:21:00','1880010100:00:00','1918013122:20:59','1918013123:59:59' ], ], 1918 => [ [ [1918,1,31,22,21,0],[1918,1,31,23,21,0],'+01:00:00',[1,0,0], 'CET',0,[1918,4,15,0,59,59],[1918,4,15,1,59,59], '1918013122:21:00','1918013123:21:00','1918041500:59:59','1918041501:59:59' ], [ [1918,4,15,1,0,0],[1918,4,15,3,0,0],'+02:00:00',[2,0,0], 'CEST',1,[1918,9,16,0,59,59],[1918,9,16,2,59,59], '1918041501:00:00','1918041503:00:00','1918091600:59:59','1918091602:59:59' ], [ [1918,9,16,1,0,0],[1918,9,16,2,0,0],'+01:00:00',[1,0,0], 'CET',0,[1919,6,30,22,59,59],[1919,6,30,23,59,59], '1918091601:00:00','1918091602:00:00','1919063022:59:59','1919063023:59:59' ], ], 1919 => [ [ [1919,6,30,23,0,0],[1919,7,1,0,39,0],'+01:39:00',[1,39,0], 'TMT',0,[1921,4,30,22,20,59],[1921,4,30,23,59,59], '1919063023:00:00','1919070100:39:00','1921043022:20:59','1921043023:59:59' ], ], 1921 => [ [ [1921,4,30,22,21,0],[1921,5,1,0,21,0],'+02:00:00',[2,0,0], 'EET',0,[1940,8,5,21,59,59],[1940,8,5,23,59,59], '1921043022:21:00','1921050100:21:00','1940080521:59:59','1940080523:59:59' ], ], 1940 => [ [ [1940,8,5,22,0,0],[1940,8,6,1,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1941,9,14,20,59,59],[1941,9,14,23,59,59], '1940080522:00:00','1940080601:00:00','1941091420:59:59','1941091423:59:59' ], ], 1941 => [ [ [1941,9,14,21,0,0],[1941,9,14,23,0,0],'+02:00:00',[2,0,0], 'CEST',1,[1942,11,2,0,59,59],[1942,11,2,2,59,59], '1941091421:00:00','1941091423:00:00','1942110200:59:59','1942110202:59:59' ], ], 1942 => [ [ [1942,11,2,1,0,0],[1942,11,2,2,0,0],'+01:00:00',[1,0,0], 'CET',0,[1943,3,29,0,59,59],[1943,3,29,1,59,59], '1942110201:00:00','1942110202:00:00','1943032900:59:59','1943032901:59:59' ], ], 1943 => [ [ [1943,3,29,1,0,0],[1943,3,29,3,0,0],'+02:00:00',[2,0,0], 'CEST',1,[1943,10,4,0,59,59],[1943,10,4,2,59,59], '1943032901:00:00','1943032903:00:00','1943100400:59:59','1943100402:59:59' ], [ [1943,10,4,1,0,0],[1943,10,4,2,0,0],'+01:00:00',[1,0,0], 'CET',0,[1944,4,3,0,59,59],[1944,4,3,1,59,59], '1943100401:00:00','1943100402:00:00','1944040300:59:59','1944040301:59:59' ], ], 1944 => [ [ [1944,4,3,1,0,0],[1944,4,3,3,0,0],'+02:00:00',[2,0,0], 'CEST',1,[1944,9,21,21,59,59],[1944,9,21,23,59,59], '1944040301:00:00','1944040303:00:00','1944092121:59:59','1944092123:59:59' ], [ [1944,9,21,22,0,0],[1944,9,22,1,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1981,3,31,20,59,59],[1981,3,31,23,59,59], '1944092122:00:00','1944092201:00:00','1981033120:59:59','1981033123:59:59' ], ], 1981 => [ [ [1981,3,31,21,0,0],[1981,4,1,1,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1981,9,30,19,59,59],[1981,9,30,23,59,59], '1981033121:00:00','1981040101:00:00','1981093019:59:59','1981093023:59:59' ], [ [1981,9,30,20,0,0],[1981,9,30,23,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1982,3,31,20,59,59],[1982,3,31,23,59,59], '1981093020:00:00','1981093023:00:00','1982033120:59:59','1982033123:59:59' ], ], 1982 => [ [ [1982,3,31,21,0,0],[1982,4,1,1,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1982,9,30,19,59,59],[1982,9,30,23,59,59], '1982033121:00:00','1982040101:00:00','1982093019:59:59','1982093023:59:59' ], [ [1982,9,30,20,0,0],[1982,9,30,23,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1983,3,31,20,59,59],[1983,3,31,23,59,59], '1982093020:00:00','1982093023:00:00','1983033120:59:59','1983033123:59:59' ], ], 1983 => [ [ [1983,3,31,21,0,0],[1983,4,1,1,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1983,9,30,19,59,59],[1983,9,30,23,59,59], '1983033121:00:00','1983040101:00:00','1983093019:59:59','1983093023:59:59' ], [ [1983,9,30,20,0,0],[1983,9,30,23,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1984,3,31,20,59,59],[1984,3,31,23,59,59], '1983093020:00:00','1983093023:00:00','1984033120:59:59','1984033123:59:59' ], ], 1984 => [ [ [1984,3,31,21,0,0],[1984,4,1,1,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1984,9,29,22,59,59],[1984,9,30,2,59,59], '1984033121:00:00','1984040101:00:00','1984092922:59:59','1984093002:59:59' ], [ [1984,9,29,23,0,0],[1984,9,30,2,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1985,3,30,22,59,59],[1985,3,31,1,59,59], '1984092923:00:00','1984093002:00:00','1985033022:59:59','1985033101:59:59' ], ], 1985 => [ [ [1985,3,30,23,0,0],[1985,3,31,3,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1985,9,28,22,59,59],[1985,9,29,2,59,59], '1985033023:00:00','1985033103:00:00','1985092822:59:59','1985092902:59:59' ], [ [1985,9,28,23,0,0],[1985,9,29,2,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1986,3,29,22,59,59],[1986,3,30,1,59,59], '1985092823:00:00','1985092902:00:00','1986032922:59:59','1986033001:59:59' ], ], 1986 => [ [ [1986,3,29,23,0,0],[1986,3,30,3,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1986,9,27,22,59,59],[1986,9,28,2,59,59], '1986032923:00:00','1986033003:00:00','1986092722:59:59','1986092802:59:59' ], [ [1986,9,27,23,0,0],[1986,9,28,2,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1987,3,28,22,59,59],[1987,3,29,1,59,59], '1986092723:00:00','1986092802:00:00','1987032822:59:59','1987032901:59:59' ], ], 1987 => [ [ [1987,3,28,23,0,0],[1987,3,29,3,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1987,9,26,22,59,59],[1987,9,27,2,59,59], '1987032823:00:00','1987032903:00:00','1987092622:59:59','1987092702:59:59' ], [ [1987,9,26,23,0,0],[1987,9,27,2,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1988,3,26,22,59,59],[1988,3,27,1,59,59], '1987092623:00:00','1987092702:00:00','1988032622:59:59','1988032701:59:59' ], ], 1988 => [ [ [1988,3,26,23,0,0],[1988,3,27,3,0,0],'+04:00:00',[4,0,0], 'MSD',1,[1988,9,24,22,59,59],[1988,9,25,2,59,59], '1988032623:00:00','1988032703:00:00','1988092422:59:59','1988092502:59:59' ], [ [1988,9,24,23,0,0],[1988,9,25,2,0,0],'+03:00:00',[3,0,0], 'MSK',0,[1989,3,25,22,59,59],[1989,3,26,1,59,59], '1988092423:00:00','1988092502:00:00','1989032522:59:59','1989032601:59:59' ], ], 1989 => [ [ [1989,3,25,23,0,0],[1989,3,26,2,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1989,9,23,23,59,59],[1989,9,24,2,59,59], '1989032523:00:00','1989032602:00:00','1989092323:59:59','1989092402:59:59' ], [ [1989,9,24,0,0,0],[1989,9,24,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1990,3,24,23,59,59],[1990,3,25,1,59,59], '1989092400:00:00','1989092402:00:00','1990032423:59:59','1990032501:59:59' ], ], 1990 => [ [ [1990,3,25,0,0,0],[1990,3,25,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1990,9,29,23,59,59],[1990,9,30,2,59,59], '1990032500:00:00','1990032503:00:00','1990092923:59:59','1990093002:59:59' ], [ [1990,9,30,0,0,0],[1990,9,30,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1991,3,30,23,59,59],[1991,3,31,1,59,59], '1990093000:00:00','1990093002:00:00','1991033023:59:59','1991033101:59:59' ], ], 1991 => [ [ [1991,3,31,0,0,0],[1991,3,31,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1991,9,28,23,59,59],[1991,9,29,2,59,59], '1991033100:00:00','1991033103:00:00','1991092823:59:59','1991092902:59:59' ], [ [1991,9,29,0,0,0],[1991,9,29,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1992,3,28,23,59,59],[1992,3,29,1,59,59], '1991092900:00:00','1991092902:00:00','1992032823:59:59','1992032901:59:59' ], ], 1992 => [ [ [1992,3,29,0,0,0],[1992,3,29,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1992,9,26,23,59,59],[1992,9,27,2,59,59], '1992032900:00:00','1992032903:00:00','1992092623:59:59','1992092702:59:59' ], [ [1992,9,27,0,0,0],[1992,9,27,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1993,3,27,23,59,59],[1993,3,28,1,59,59], '1992092700:00:00','1992092702:00:00','1993032723:59:59','1993032801:59:59' ], ], 1993 => [ [ [1993,3,28,0,0,0],[1993,3,28,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1993,9,25,23,59,59],[1993,9,26,2,59,59], '1993032800:00:00','1993032803:00:00','1993092523:59:59','1993092602:59:59' ], [ [1993,9,26,0,0,0],[1993,9,26,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1994,3,26,23,59,59],[1994,3,27,1,59,59], '1993092600:00:00','1993092602:00:00','1994032623:59:59','1994032701:59:59' ], ], 1994 => [ [ [1994,3,27,0,0,0],[1994,3,27,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1994,9,24,23,59,59],[1994,9,25,2,59,59], '1994032700:00:00','1994032703:00:00','1994092423:59:59','1994092502:59:59' ], [ [1994,9,25,0,0,0],[1994,9,25,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1995,3,25,23,59,59],[1995,3,26,1,59,59], '1994092500:00:00','1994092502:00:00','1995032523:59:59','1995032601:59:59' ], ], 1995 => [ [ [1995,3,26,0,0,0],[1995,3,26,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1995,9,23,23,59,59],[1995,9,24,2,59,59], '1995032600:00:00','1995032603:00:00','1995092323:59:59','1995092402:59:59' ], [ [1995,9,24,0,0,0],[1995,9,24,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1996,3,30,23,59,59],[1996,3,31,1,59,59], '1995092400:00:00','1995092402:00:00','1996033023:59:59','1996033101:59:59' ], ], 1996 => [ [ [1996,3,31,0,0,0],[1996,3,31,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1996,10,26,23,59,59],[1996,10,27,2,59,59], '1996033100:00:00','1996033103:00:00','1996102623:59:59','1996102702:59:59' ], [ [1996,10,27,0,0,0],[1996,10,27,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1997,3,29,23,59,59],[1997,3,30,1,59,59], '1996102700:00:00','1996102702:00:00','1997032923:59:59','1997033001:59:59' ], ], 1997 => [ [ [1997,3,30,0,0,0],[1997,3,30,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1997,10,25,23,59,59],[1997,10,26,2,59,59], '1997033000:00:00','1997033003:00:00','1997102523:59:59','1997102602:59:59' ], [ [1997,10,26,0,0,0],[1997,10,26,2,0,0],'+02:00:00',[2,0,0], 'EET',0,[1998,3,28,23,59,59],[1998,3,29,1,59,59], '1997102600:00:00','1997102602:00:00','1998032823:59:59','1998032901:59:59' ], ], 1998 => [ [ [1998,3,29,0,0,0],[1998,3,29,3,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1998,10,25,0,59,59],[1998,10,25,3,59,59], '1998032900:00:00','1998032903:00:00','1998102500:59:59','1998102503:59:59' ], [ [1998,10,25,1,0,0],[1998,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[1999,3,28,0,59,59],[1999,3,28,2,59,59], '1998102501:00:00','1998102503:00:00','1999032800:59:59','1999032802:59:59' ], ], 1999 => [ [ [1999,3,28,1,0,0],[1999,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[1999,10,31,0,59,59],[1999,10,31,3,59,59], '1999032801:00:00','1999032804:00:00','1999103100:59:59','1999103103:59:59' ], [ [1999,10,31,1,0,0],[1999,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2002,3,31,0,59,59],[2002,3,31,2,59,59], '1999103101:00:00','1999103103:00:00','2002033100:59:59','2002033102:59:59' ], ], 2002 => [ [ [2002,3,31,1,0,0],[2002,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2002,10,27,0,59,59],[2002,10,27,3,59,59], '2002033101:00:00','2002033104:00:00','2002102700:59:59','2002102703:59:59' ], [ [2002,10,27,1,0,0],[2002,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2003,3,30,0,59,59],[2003,3,30,2,59,59], '2002102701:00:00','2002102703:00:00','2003033000:59:59','2003033002:59:59' ], ], 2003 => [ [ [2003,3,30,1,0,0],[2003,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2003,10,26,0,59,59],[2003,10,26,3,59,59], '2003033001:00:00','2003033004:00:00','2003102600:59:59','2003102603:59:59' ], [ [2003,10,26,1,0,0],[2003,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2004,3,28,0,59,59],[2004,3,28,2,59,59], '2003102601:00:00','2003102603:00:00','2004032800:59:59','2004032802:59:59' ], ], 2004 => [ [ [2004,3,28,1,0,0],[2004,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2004,10,31,0,59,59],[2004,10,31,3,59,59], '2004032801:00:00','2004032804:00:00','2004103100:59:59','2004103103:59:59' ], [ [2004,10,31,1,0,0],[2004,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2005,3,27,0,59,59],[2005,3,27,2,59,59], '2004103101:00:00','2004103103:00:00','2005032700:59:59','2005032702:59:59' ], ], 2005 => [ [ [2005,3,27,1,0,0],[2005,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2005,10,30,0,59,59],[2005,10,30,3,59,59], '2005032701:00:00','2005032704:00:00','2005103000:59:59','2005103003:59:59' ], [ [2005,10,30,1,0,0],[2005,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2006,3,26,0,59,59],[2006,3,26,2,59,59], '2005103001:00:00','2005103003:00:00','2006032600:59:59','2006032602:59:59' ], ], 2006 => [ [ [2006,3,26,1,0,0],[2006,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2006,10,29,0,59,59],[2006,10,29,3,59,59], '2006032601:00:00','2006032604:00:00','2006102900:59:59','2006102903:59:59' ], [ [2006,10,29,1,0,0],[2006,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2007,3,25,0,59,59],[2007,3,25,2,59,59], '2006102901:00:00','2006102903:00:00','2007032500:59:59','2007032502:59:59' ], ], 2007 => [ [ [2007,3,25,1,0,0],[2007,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2007,10,28,0,59,59],[2007,10,28,3,59,59], '2007032501:00:00','2007032504:00:00','2007102800:59:59','2007102803:59:59' ], [ [2007,10,28,1,0,0],[2007,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2008,3,30,0,59,59],[2008,3,30,2,59,59], '2007102801:00:00','2007102803:00:00','2008033000:59:59','2008033002:59:59' ], ], 2008 => [ [ [2008,3,30,1,0,0],[2008,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2008,10,26,0,59,59],[2008,10,26,3,59,59], '2008033001:00:00','2008033004:00:00','2008102600:59:59','2008102603:59:59' ], [ [2008,10,26,1,0,0],[2008,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2009,3,29,0,59,59],[2009,3,29,2,59,59], '2008102601:00:00','2008102603:00:00','2009032900:59:59','2009032902:59:59' ], ], 2009 => [ [ [2009,3,29,1,0,0],[2009,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2009,10,25,0,59,59],[2009,10,25,3,59,59], '2009032901:00:00','2009032904:00:00','2009102500:59:59','2009102503:59:59' ], [ [2009,10,25,1,0,0],[2009,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2010,3,28,0,59,59],[2010,3,28,2,59,59], '2009102501:00:00','2009102503:00:00','2010032800:59:59','2010032802:59:59' ], ], 2010 => [ [ [2010,3,28,1,0,0],[2010,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2010,10,31,0,59,59],[2010,10,31,3,59,59], '2010032801:00:00','2010032804:00:00','2010103100:59:59','2010103103:59:59' ], [ [2010,10,31,1,0,0],[2010,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2011,3,27,0,59,59],[2011,3,27,2,59,59], '2010103101:00:00','2010103103:00:00','2011032700:59:59','2011032702:59:59' ], ], 2011 => [ [ [2011,3,27,1,0,0],[2011,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2011,10,30,0,59,59],[2011,10,30,3,59,59], '2011032701:00:00','2011032704:00:00','2011103000:59:59','2011103003:59:59' ], [ [2011,10,30,1,0,0],[2011,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2012,3,25,0,59,59],[2012,3,25,2,59,59], '2011103001:00:00','2011103003:00:00','2012032500:59:59','2012032502:59:59' ], ], 2012 => [ [ [2012,3,25,1,0,0],[2012,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2012,10,28,0,59,59],[2012,10,28,3,59,59], '2012032501:00:00','2012032504:00:00','2012102800:59:59','2012102803:59:59' ], [ [2012,10,28,1,0,0],[2012,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2013,3,31,0,59,59],[2013,3,31,2,59,59], '2012102801:00:00','2012102803:00:00','2013033100:59:59','2013033102:59:59' ], ], 2013 => [ [ [2013,3,31,1,0,0],[2013,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2013,10,27,0,59,59],[2013,10,27,3,59,59], '2013033101:00:00','2013033104:00:00','2013102700:59:59','2013102703:59:59' ], [ [2013,10,27,1,0,0],[2013,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2014,3,30,0,59,59],[2014,3,30,2,59,59], '2013102701:00:00','2013102703:00:00','2014033000:59:59','2014033002:59:59' ], ], 2014 => [ [ [2014,3,30,1,0,0],[2014,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2014,10,26,0,59,59],[2014,10,26,3,59,59], '2014033001:00:00','2014033004:00:00','2014102600:59:59','2014102603:59:59' ], [ [2014,10,26,1,0,0],[2014,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2015,3,29,0,59,59],[2015,3,29,2,59,59], '2014102601:00:00','2014102603:00:00','2015032900:59:59','2015032902:59:59' ], ], 2015 => [ [ [2015,3,29,1,0,0],[2015,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2015,10,25,0,59,59],[2015,10,25,3,59,59], '2015032901:00:00','2015032904:00:00','2015102500:59:59','2015102503:59:59' ], [ [2015,10,25,1,0,0],[2015,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2016,3,27,0,59,59],[2016,3,27,2,59,59], '2015102501:00:00','2015102503:00:00','2016032700:59:59','2016032702:59:59' ], ], 2016 => [ [ [2016,3,27,1,0,0],[2016,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2016,10,30,0,59,59],[2016,10,30,3,59,59], '2016032701:00:00','2016032704:00:00','2016103000:59:59','2016103003:59:59' ], [ [2016,10,30,1,0,0],[2016,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2017,3,26,0,59,59],[2017,3,26,2,59,59], '2016103001:00:00','2016103003:00:00','2017032600:59:59','2017032602:59:59' ], ], 2017 => [ [ [2017,3,26,1,0,0],[2017,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2017,10,29,0,59,59],[2017,10,29,3,59,59], '2017032601:00:00','2017032604:00:00','2017102900:59:59','2017102903:59:59' ], [ [2017,10,29,1,0,0],[2017,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2018,3,25,0,59,59],[2018,3,25,2,59,59], '2017102901:00:00','2017102903:00:00','2018032500:59:59','2018032502:59:59' ], ], 2018 => [ [ [2018,3,25,1,0,0],[2018,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2018,10,28,0,59,59],[2018,10,28,3,59,59], '2018032501:00:00','2018032504:00:00','2018102800:59:59','2018102803:59:59' ], [ [2018,10,28,1,0,0],[2018,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2019,3,31,0,59,59],[2019,3,31,2,59,59], '2018102801:00:00','2018102803:00:00','2019033100:59:59','2019033102:59:59' ], ], 2019 => [ [ [2019,3,31,1,0,0],[2019,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2019,10,27,0,59,59],[2019,10,27,3,59,59], '2019033101:00:00','2019033104:00:00','2019102700:59:59','2019102703:59:59' ], [ [2019,10,27,1,0,0],[2019,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2020,3,29,0,59,59],[2020,3,29,2,59,59], '2019102701:00:00','2019102703:00:00','2020032900:59:59','2020032902:59:59' ], ], 2020 => [ [ [2020,3,29,1,0,0],[2020,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2020,10,25,0,59,59],[2020,10,25,3,59,59], '2020032901:00:00','2020032904:00:00','2020102500:59:59','2020102503:59:59' ], [ [2020,10,25,1,0,0],[2020,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2021,3,28,0,59,59],[2021,3,28,2,59,59], '2020102501:00:00','2020102503:00:00','2021032800:59:59','2021032802:59:59' ], ], 2021 => [ [ [2021,3,28,1,0,0],[2021,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2021,10,31,0,59,59],[2021,10,31,3,59,59], '2021032801:00:00','2021032804:00:00','2021103100:59:59','2021103103:59:59' ], [ [2021,10,31,1,0,0],[2021,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2022,3,27,0,59,59],[2022,3,27,2,59,59], '2021103101:00:00','2021103103:00:00','2022032700:59:59','2022032702:59:59' ], ], 2022 => [ [ [2022,3,27,1,0,0],[2022,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2022,10,30,0,59,59],[2022,10,30,3,59,59], '2022032701:00:00','2022032704:00:00','2022103000:59:59','2022103003:59:59' ], [ [2022,10,30,1,0,0],[2022,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2023,3,26,0,59,59],[2023,3,26,2,59,59], '2022103001:00:00','2022103003:00:00','2023032600:59:59','2023032602:59:59' ], ], 2023 => [ [ [2023,3,26,1,0,0],[2023,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2023,10,29,0,59,59],[2023,10,29,3,59,59], '2023032601:00:00','2023032604:00:00','2023102900:59:59','2023102903:59:59' ], [ [2023,10,29,1,0,0],[2023,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2024,3,31,0,59,59],[2024,3,31,2,59,59], '2023102901:00:00','2023102903:00:00','2024033100:59:59','2024033102:59:59' ], ], 2024 => [ [ [2024,3,31,1,0,0],[2024,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2024,10,27,0,59,59],[2024,10,27,3,59,59], '2024033101:00:00','2024033104:00:00','2024102700:59:59','2024102703:59:59' ], [ [2024,10,27,1,0,0],[2024,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2025,3,30,0,59,59],[2025,3,30,2,59,59], '2024102701:00:00','2024102703:00:00','2025033000:59:59','2025033002:59:59' ], ], 2025 => [ [ [2025,3,30,1,0,0],[2025,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2025,10,26,0,59,59],[2025,10,26,3,59,59], '2025033001:00:00','2025033004:00:00','2025102600:59:59','2025102603:59:59' ], [ [2025,10,26,1,0,0],[2025,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2026,3,29,0,59,59],[2026,3,29,2,59,59], '2025102601:00:00','2025102603:00:00','2026032900:59:59','2026032902:59:59' ], ], 2026 => [ [ [2026,3,29,1,0,0],[2026,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2026,10,25,0,59,59],[2026,10,25,3,59,59], '2026032901:00:00','2026032904:00:00','2026102500:59:59','2026102503:59:59' ], [ [2026,10,25,1,0,0],[2026,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2027,3,28,0,59,59],[2027,3,28,2,59,59], '2026102501:00:00','2026102503:00:00','2027032800:59:59','2027032802:59:59' ], ], 2027 => [ [ [2027,3,28,1,0,0],[2027,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2027,10,31,0,59,59],[2027,10,31,3,59,59], '2027032801:00:00','2027032804:00:00','2027103100:59:59','2027103103:59:59' ], [ [2027,10,31,1,0,0],[2027,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2028,3,26,0,59,59],[2028,3,26,2,59,59], '2027103101:00:00','2027103103:00:00','2028032600:59:59','2028032602:59:59' ], ], 2028 => [ [ [2028,3,26,1,0,0],[2028,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2028,10,29,0,59,59],[2028,10,29,3,59,59], '2028032601:00:00','2028032604:00:00','2028102900:59:59','2028102903:59:59' ], [ [2028,10,29,1,0,0],[2028,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2029,3,25,0,59,59],[2029,3,25,2,59,59], '2028102901:00:00','2028102903:00:00','2029032500:59:59','2029032502:59:59' ], ], 2029 => [ [ [2029,3,25,1,0,0],[2029,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2029,10,28,0,59,59],[2029,10,28,3,59,59], '2029032501:00:00','2029032504:00:00','2029102800:59:59','2029102803:59:59' ], [ [2029,10,28,1,0,0],[2029,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2030,3,31,0,59,59],[2030,3,31,2,59,59], '2029102801:00:00','2029102803:00:00','2030033100:59:59','2030033102:59:59' ], ], 2030 => [ [ [2030,3,31,1,0,0],[2030,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2030,10,27,0,59,59],[2030,10,27,3,59,59], '2030033101:00:00','2030033104:00:00','2030102700:59:59','2030102703:59:59' ], [ [2030,10,27,1,0,0],[2030,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2031,3,30,0,59,59],[2031,3,30,2,59,59], '2030102701:00:00','2030102703:00:00','2031033000:59:59','2031033002:59:59' ], ], 2031 => [ [ [2031,3,30,1,0,0],[2031,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2031,10,26,0,59,59],[2031,10,26,3,59,59], '2031033001:00:00','2031033004:00:00','2031102600:59:59','2031102603:59:59' ], [ [2031,10,26,1,0,0],[2031,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2032,3,28,0,59,59],[2032,3,28,2,59,59], '2031102601:00:00','2031102603:00:00','2032032800:59:59','2032032802:59:59' ], ], 2032 => [ [ [2032,3,28,1,0,0],[2032,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2032,10,31,0,59,59],[2032,10,31,3,59,59], '2032032801:00:00','2032032804:00:00','2032103100:59:59','2032103103:59:59' ], [ [2032,10,31,1,0,0],[2032,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2033,3,27,0,59,59],[2033,3,27,2,59,59], '2032103101:00:00','2032103103:00:00','2033032700:59:59','2033032702:59:59' ], ], 2033 => [ [ [2033,3,27,1,0,0],[2033,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2033,10,30,0,59,59],[2033,10,30,3,59,59], '2033032701:00:00','2033032704:00:00','2033103000:59:59','2033103003:59:59' ], [ [2033,10,30,1,0,0],[2033,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2034,3,26,0,59,59],[2034,3,26,2,59,59], '2033103001:00:00','2033103003:00:00','2034032600:59:59','2034032602:59:59' ], ], 2034 => [ [ [2034,3,26,1,0,0],[2034,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2034,10,29,0,59,59],[2034,10,29,3,59,59], '2034032601:00:00','2034032604:00:00','2034102900:59:59','2034102903:59:59' ], [ [2034,10,29,1,0,0],[2034,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2035,3,25,0,59,59],[2035,3,25,2,59,59], '2034102901:00:00','2034102903:00:00','2035032500:59:59','2035032502:59:59' ], ], 2035 => [ [ [2035,3,25,1,0,0],[2035,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2035,10,28,0,59,59],[2035,10,28,3,59,59], '2035032501:00:00','2035032504:00:00','2035102800:59:59','2035102803:59:59' ], [ [2035,10,28,1,0,0],[2035,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2036,3,30,0,59,59],[2036,3,30,2,59,59], '2035102801:00:00','2035102803:00:00','2036033000:59:59','2036033002:59:59' ], ], 2036 => [ [ [2036,3,30,1,0,0],[2036,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2036,10,26,0,59,59],[2036,10,26,3,59,59], '2036033001:00:00','2036033004:00:00','2036102600:59:59','2036102603:59:59' ], [ [2036,10,26,1,0,0],[2036,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2037,3,29,0,59,59],[2037,3,29,2,59,59], '2036102601:00:00','2036102603:00:00','2037032900:59:59','2037032902:59:59' ], ], 2037 => [ [ [2037,3,29,1,0,0],[2037,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2037,10,25,0,59,59],[2037,10,25,3,59,59], '2037032901:00:00','2037032904:00:00','2037102500:59:59','2037102503:59:59' ], [ [2037,10,25,1,0,0],[2037,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2038,3,28,0,59,59],[2038,3,28,2,59,59], '2037102501:00:00','2037102503:00:00','2038032800:59:59','2038032802:59:59' ], ], 2038 => [ [ [2038,3,28,1,0,0],[2038,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2038,10,31,0,59,59],[2038,10,31,3,59,59], '2038032801:00:00','2038032804:00:00','2038103100:59:59','2038103103:59:59' ], [ [2038,10,31,1,0,0],[2038,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2039,3,27,0,59,59],[2039,3,27,2,59,59], '2038103101:00:00','2038103103:00:00','2039032700:59:59','2039032702:59:59' ], ], 2039 => [ [ [2039,3,27,1,0,0],[2039,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2039,10,30,0,59,59],[2039,10,30,3,59,59], '2039032701:00:00','2039032704:00:00','2039103000:59:59','2039103003:59:59' ], [ [2039,10,30,1,0,0],[2039,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2040,3,25,0,59,59],[2040,3,25,2,59,59], '2039103001:00:00','2039103003:00:00','2040032500:59:59','2040032502:59:59' ], ], 2040 => [ [ [2040,3,25,1,0,0],[2040,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2040,10,28,0,59,59],[2040,10,28,3,59,59], '2040032501:00:00','2040032504:00:00','2040102800:59:59','2040102803:59:59' ], [ [2040,10,28,1,0,0],[2040,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2041,3,31,0,59,59],[2041,3,31,2,59,59], '2040102801:00:00','2040102803:00:00','2041033100:59:59','2041033102:59:59' ], ], 2041 => [ [ [2041,3,31,1,0,0],[2041,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2041,10,27,0,59,59],[2041,10,27,3,59,59], '2041033101:00:00','2041033104:00:00','2041102700:59:59','2041102703:59:59' ], [ [2041,10,27,1,0,0],[2041,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2042,3,30,0,59,59],[2042,3,30,2,59,59], '2041102701:00:00','2041102703:00:00','2042033000:59:59','2042033002:59:59' ], ], 2042 => [ [ [2042,3,30,1,0,0],[2042,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2042,10,26,0,59,59],[2042,10,26,3,59,59], '2042033001:00:00','2042033004:00:00','2042102600:59:59','2042102603:59:59' ], [ [2042,10,26,1,0,0],[2042,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2043,3,29,0,59,59],[2043,3,29,2,59,59], '2042102601:00:00','2042102603:00:00','2043032900:59:59','2043032902:59:59' ], ], 2043 => [ [ [2043,3,29,1,0,0],[2043,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2043,10,25,0,59,59],[2043,10,25,3,59,59], '2043032901:00:00','2043032904:00:00','2043102500:59:59','2043102503:59:59' ], [ [2043,10,25,1,0,0],[2043,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2044,3,27,0,59,59],[2044,3,27,2,59,59], '2043102501:00:00','2043102503:00:00','2044032700:59:59','2044032702:59:59' ], ], 2044 => [ [ [2044,3,27,1,0,0],[2044,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2044,10,30,0,59,59],[2044,10,30,3,59,59], '2044032701:00:00','2044032704:00:00','2044103000:59:59','2044103003:59:59' ], [ [2044,10,30,1,0,0],[2044,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2045,3,26,0,59,59],[2045,3,26,2,59,59], '2044103001:00:00','2044103003:00:00','2045032600:59:59','2045032602:59:59' ], ], 2045 => [ [ [2045,3,26,1,0,0],[2045,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2045,10,29,0,59,59],[2045,10,29,3,59,59], '2045032601:00:00','2045032604:00:00','2045102900:59:59','2045102903:59:59' ], [ [2045,10,29,1,0,0],[2045,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2046,3,25,0,59,59],[2046,3,25,2,59,59], '2045102901:00:00','2045102903:00:00','2046032500:59:59','2046032502:59:59' ], ], 2046 => [ [ [2046,3,25,1,0,0],[2046,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2046,10,28,0,59,59],[2046,10,28,3,59,59], '2046032501:00:00','2046032504:00:00','2046102800:59:59','2046102803:59:59' ], [ [2046,10,28,1,0,0],[2046,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2047,3,31,0,59,59],[2047,3,31,2,59,59], '2046102801:00:00','2046102803:00:00','2047033100:59:59','2047033102:59:59' ], ], 2047 => [ [ [2047,3,31,1,0,0],[2047,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2047,10,27,0,59,59],[2047,10,27,3,59,59], '2047033101:00:00','2047033104:00:00','2047102700:59:59','2047102703:59:59' ], [ [2047,10,27,1,0,0],[2047,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2048,3,29,0,59,59],[2048,3,29,2,59,59], '2047102701:00:00','2047102703:00:00','2048032900:59:59','2048032902:59:59' ], ], 2048 => [ [ [2048,3,29,1,0,0],[2048,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2048,10,25,0,59,59],[2048,10,25,3,59,59], '2048032901:00:00','2048032904:00:00','2048102500:59:59','2048102503:59:59' ], [ [2048,10,25,1,0,0],[2048,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2049,3,28,0,59,59],[2049,3,28,2,59,59], '2048102501:00:00','2048102503:00:00','2049032800:59:59','2049032802:59:59' ], ], 2049 => [ [ [2049,3,28,1,0,0],[2049,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2049,10,31,0,59,59],[2049,10,31,3,59,59], '2049032801:00:00','2049032804:00:00','2049103100:59:59','2049103103:59:59' ], [ [2049,10,31,1,0,0],[2049,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2050,3,27,0,59,59],[2050,3,27,2,59,59], '2049103101:00:00','2049103103:00:00','2050032700:59:59','2050032702:59:59' ], ], 2050 => [ [ [2050,3,27,1,0,0],[2050,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2050,10,30,0,59,59],[2050,10,30,3,59,59], '2050032701:00:00','2050032704:00:00','2050103000:59:59','2050103003:59:59' ], [ [2050,10,30,1,0,0],[2050,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2051,3,26,0,59,59],[2051,3,26,2,59,59], '2050103001:00:00','2050103003:00:00','2051032600:59:59','2051032602:59:59' ], ], 2051 => [ [ [2051,3,26,1,0,0],[2051,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2051,10,29,0,59,59],[2051,10,29,3,59,59], '2051032601:00:00','2051032604:00:00','2051102900:59:59','2051102903:59:59' ], [ [2051,10,29,1,0,0],[2051,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2052,3,31,0,59,59],[2052,3,31,2,59,59], '2051102901:00:00','2051102903:00:00','2052033100:59:59','2052033102:59:59' ], ], 2052 => [ [ [2052,3,31,1,0,0],[2052,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2052,10,27,0,59,59],[2052,10,27,3,59,59], '2052033101:00:00','2052033104:00:00','2052102700:59:59','2052102703:59:59' ], [ [2052,10,27,1,0,0],[2052,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2053,3,30,0,59,59],[2053,3,30,2,59,59], '2052102701:00:00','2052102703:00:00','2053033000:59:59','2053033002:59:59' ], ], 2053 => [ [ [2053,3,30,1,0,0],[2053,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2053,10,26,0,59,59],[2053,10,26,3,59,59], '2053033001:00:00','2053033004:00:00','2053102600:59:59','2053102603:59:59' ], [ [2053,10,26,1,0,0],[2053,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2054,3,29,0,59,59],[2054,3,29,2,59,59], '2053102601:00:00','2053102603:00:00','2054032900:59:59','2054032902:59:59' ], ], 2054 => [ [ [2054,3,29,1,0,0],[2054,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2054,10,25,0,59,59],[2054,10,25,3,59,59], '2054032901:00:00','2054032904:00:00','2054102500:59:59','2054102503:59:59' ], [ [2054,10,25,1,0,0],[2054,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2055,3,28,0,59,59],[2055,3,28,2,59,59], '2054102501:00:00','2054102503:00:00','2055032800:59:59','2055032802:59:59' ], ], 2055 => [ [ [2055,3,28,1,0,0],[2055,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2055,10,31,0,59,59],[2055,10,31,3,59,59], '2055032801:00:00','2055032804:00:00','2055103100:59:59','2055103103:59:59' ], [ [2055,10,31,1,0,0],[2055,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2056,3,26,0,59,59],[2056,3,26,2,59,59], '2055103101:00:00','2055103103:00:00','2056032600:59:59','2056032602:59:59' ], ], 2056 => [ [ [2056,3,26,1,0,0],[2056,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2056,10,29,0,59,59],[2056,10,29,3,59,59], '2056032601:00:00','2056032604:00:00','2056102900:59:59','2056102903:59:59' ], [ [2056,10,29,1,0,0],[2056,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2057,3,25,0,59,59],[2057,3,25,2,59,59], '2056102901:00:00','2056102903:00:00','2057032500:59:59','2057032502:59:59' ], ], 2057 => [ [ [2057,3,25,1,0,0],[2057,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2057,10,28,0,59,59],[2057,10,28,3,59,59], '2057032501:00:00','2057032504:00:00','2057102800:59:59','2057102803:59:59' ], [ [2057,10,28,1,0,0],[2057,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2058,3,31,0,59,59],[2058,3,31,2,59,59], '2057102801:00:00','2057102803:00:00','2058033100:59:59','2058033102:59:59' ], ], 2058 => [ [ [2058,3,31,1,0,0],[2058,3,31,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2058,10,27,0,59,59],[2058,10,27,3,59,59], '2058033101:00:00','2058033104:00:00','2058102700:59:59','2058102703:59:59' ], [ [2058,10,27,1,0,0],[2058,10,27,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2059,3,30,0,59,59],[2059,3,30,2,59,59], '2058102701:00:00','2058102703:00:00','2059033000:59:59','2059033002:59:59' ], ], 2059 => [ [ [2059,3,30,1,0,0],[2059,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2059,10,26,0,59,59],[2059,10,26,3,59,59], '2059033001:00:00','2059033004:00:00','2059102600:59:59','2059102603:59:59' ], [ [2059,10,26,1,0,0],[2059,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2060,3,28,0,59,59],[2060,3,28,2,59,59], '2059102601:00:00','2059102603:00:00','2060032800:59:59','2060032802:59:59' ], ], 2060 => [ [ [2060,3,28,1,0,0],[2060,3,28,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2060,10,31,0,59,59],[2060,10,31,3,59,59], '2060032801:00:00','2060032804:00:00','2060103100:59:59','2060103103:59:59' ], [ [2060,10,31,1,0,0],[2060,10,31,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2061,3,27,0,59,59],[2061,3,27,2,59,59], '2060103101:00:00','2060103103:00:00','2061032700:59:59','2061032702:59:59' ], ], 2061 => [ [ [2061,3,27,1,0,0],[2061,3,27,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2061,10,30,0,59,59],[2061,10,30,3,59,59], '2061032701:00:00','2061032704:00:00','2061103000:59:59','2061103003:59:59' ], [ [2061,10,30,1,0,0],[2061,10,30,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2062,3,26,0,59,59],[2062,3,26,2,59,59], '2061103001:00:00','2061103003:00:00','2062032600:59:59','2062032602:59:59' ], ], 2062 => [ [ [2062,3,26,1,0,0],[2062,3,26,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2062,10,29,0,59,59],[2062,10,29,3,59,59], '2062032601:00:00','2062032604:00:00','2062102900:59:59','2062102903:59:59' ], [ [2062,10,29,1,0,0],[2062,10,29,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2063,3,25,0,59,59],[2063,3,25,2,59,59], '2062102901:00:00','2062102903:00:00','2063032500:59:59','2063032502:59:59' ], ], 2063 => [ [ [2063,3,25,1,0,0],[2063,3,25,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2063,10,28,0,59,59],[2063,10,28,3,59,59], '2063032501:00:00','2063032504:00:00','2063102800:59:59','2063102803:59:59' ], [ [2063,10,28,1,0,0],[2063,10,28,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2064,3,30,0,59,59],[2064,3,30,2,59,59], '2063102801:00:00','2063102803:00:00','2064033000:59:59','2064033002:59:59' ], ], 2064 => [ [ [2064,3,30,1,0,0],[2064,3,30,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2064,10,26,0,59,59],[2064,10,26,3,59,59], '2064033001:00:00','2064033004:00:00','2064102600:59:59','2064102603:59:59' ], [ [2064,10,26,1,0,0],[2064,10,26,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2065,3,29,0,59,59],[2065,3,29,2,59,59], '2064102601:00:00','2064102603:00:00','2065032900:59:59','2065032902:59:59' ], ], 2065 => [ [ [2065,3,29,1,0,0],[2065,3,29,4,0,0],'+03:00:00',[3,0,0], 'EEST',1,[2065,10,25,0,59,59],[2065,10,25,3,59,59], '2065032901:00:00','2065032904:00:00','2065102500:59:59','2065102503:59:59' ], [ [2065,10,25,1,0,0],[2065,10,25,3,0,0],'+02:00:00',[2,0,0], 'EET',0,[2066,3,28,0,59,59],[2066,3,28,2,59,59], '2065102501:00:00','2065102503:00:00','2066032800:59:59','2066032802:59:59' ], ], ); %LastRule = ( 'zone' => { 'dstoff' => '+03:00:00', 'stdoff' => '+02:00:00', }, 'rules' => { '03' => { 'flag' => 'last', 'dow' => '7', 'num' => '0', 'type' => 'u', 'time' => '01:00:00', 'isdst' => '1', 'abb' => 'EEST', }, '10' => { 'flag' => 'last', 'dow' => '7', 'num' => '0', 'type' => 'u', 'time' => '01:00:00', 'isdst' => '0', 'abb' => 'EET', }, }, ); 1;
jkb78/extrajnm
local/lib/perl5/Date/Manip/TZ/eutall00.pm
Perl
mit
43,231
=head1 NAME dot - manages symbolic links for dotfiles =head1 SYNOPSIS B<dot> [B<-h>|B<--help>][B<-c> I<configfile>] I<command> [I<args>] =head1 DESCRIPTION This script makes it easy to manage your dotfiles. Script is written in bash, and very configurable. =head1 COMMANDS =over 10 =item B<clone> Clone dotfile repository on your computer with git. =item B<pull> Pull the repository from the remote dotfiles repository. =item B<update> Combined command of B<pull> and B<set> commands. =item B<cd> Change directory to F<dotdir>. =item B<list> Show the list which files will be managed by B<dot>. =item B<check> Check the files are correctly linked to the right places. =item B<set> Set the symbolic links interactively. This command sets symbolic links configured in F<dotlink>. =item B<add> Move the file to the dotfile dir and make its symbolic link to that place. =item B<edit> Edit dotlink file F<dotlink>. =item B<unlink> Unlink the selected symbolic links and copy from its original files in the dotfiles repository. =item B<clear> Remove the all symbolic links in F<dotlink>. =item B<config> Edit (or create if the file doesn't exist) rcfile F<dotrc>. =back =head1 OPTION =over 10 =item B<-h>, B<--help> Show the help message. =item B<-H>, B<--help-all> Show man page. =item B<-c> I<configfile>, B<--config> I<configfile> Specify configuration file to overload. (default: I<~/.config/dot/dotrc>) =back =head1 COMMAND OPTIONS =over 4 =item B<clone> [I<dir>] Clone I<clone_repository> onto the specified direction. (default: I<~/.dotfiles>) =over 6 =item B<-f>, B<--force> Never prompt. =back =item B<pull> [B<--self>] With --self option, update B<dot> itself. =item B<set> =over 6 =item B<-i>, B<--ignore> No interaction mode (skip all conflicts and do nothing). =item B<-f>, B<--force> Ignore conflicts and force make symbolic links. =item B<-b>, B<--backup> Ignore conflicts, make symbolic links and create its original backup. =item B<-v>, B<--verbose> Print verbose messages. =back =item B<update> Combined command of B<pull> and B<set> commands. Options are same as B<set> commnad ones. =item B<add> [B<-m> I<message>] I<original_file> [I<dotfile_direction>] =over 12 =item B<-m> I<message> Add your comment for dotlink file. =back =back =head1 ENVIRONMENT VARIABLE =over 10 =item B<DOT_REPO> Dotfiles repository to manage with this program. You may should change this environment variable. (default: I<https://github.com/ssh0/dotfiles.git>) =item B<DOT_DIR> Directory for dotfiles (default: I<$HOME/.dotfiles>) =item B<DOT_LINK> Text file to save symbolic links information (default: I<$DOT_DIR/dotlink>) =back =head1 CONFIGURATION Configuration file is B<$HOME/.config/dot/dotrc> and symbolic information is in B<$DOT_DIR/dotlink>. =head1 AUTHOR ssh0 (Shotaro Fujimoto L<https://github.com/ssh0>) Report bugs here: L<https://github.com/ssh0/dot/issues> =head1 LICENSE This is free software; you may redistribute it and/or modify it under the MIT Lisence.
ssh0/dot
doc/dot.pod
Perl
mit
3,069
% agent.pl % An agent that plays the board-game Clue. % % Copyright (c) 2014 Chris Barrick % % 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. :- module('agent', [ agent/1 ]). :- use_module(library('ansi_term')). :- use_module(library('clpfd')). :- use_module(library('readutil')). :- use_module('cards'). :- use_module('map'). :- use_module('parser'). :- use_module('util'). % Agent Constructor % ================================================== %% agent(?A) % A is an agent. agent(agent{ self: _, cards: _, case: _, players: _, player_count: _, order: _, full_search: _, cache: _, current_suggestion: _, shown_counts: _ }). %% +Agent.initialize(+PlayerCount, +Order) := true % Initializes an agent. PlayerCount is the number of players and Order is the % play order of the agent, e.g. id Order is 3, the agent is the third player. Agent.initialize(N, Order) := true :- % Sanity check agent(Agent), between(3, 6, N), between(1, N, Order), % Create the case file from one suspect, one weapon, and one room % The goal of the agent is to discover these cards Killer in 1..6, Weapon in 7..12, Room in 13..21, Case = [Killer, Weapon, Room], % Create a list of players % Each player has a turn order and a hand of cards length(AllCardsInHands, 18), % 21 cards minus 3 in the case partition(N, AllCardsInHands, Hands), make_players(Hands, Players), % Collect all the cards used in players' hands and the case file % All cards must be unique from 1 to 21 append([Case, AllCardsInHands], AllCards), length(AllCards, 21), AllCards ins 1..21, all_distinct(AllCards), % Find the player that represents the agent itself nth1(Order, Players, Self), Agent.case = Case, Agent.cards = AllCards, Agent.players = Players, Agent.player_count = N, Agent.self = Self, Agent.order = Order, Agent.full_search = false, length(Agent.self.hand, NumberOfCards), length(Agent.shown_counts, NumberOfCards), Agent.shown_counts ins 0, % Unifies all members to 0 !. %% player(?P) % True when P is a player. Players are objects refering to players of the game. player(player{ id: _, name: _, hand: _ }). %% make_players % A helper predicate to construct players given lists of hands. make_players(Hands, Players) :- make_players_(Hands, Players, 1). make_players_([], [], _). make_players_([H|Hands], [P|Players], ID) :- player(P), P = player{ id: ID, name: Name, hand: H }, chain(H, #<), ID1 is ID + 1, atom_concat(p, ID, Name), make_players_(Hands, Players, ID1). % Main Loop % ================================================== %% +Agent.play() := true % Starts the agent. A read-eval-print loop is presented to the user. The user % uses the terminal to inform the agent of events in the game through English % sentences. See `Agent.interpret()` for details on which sentences are % understood by the agent. Agent.play() := true :- catch(( % The main interface is a simple read, eval, print loop. % Printing happens during the interpret call. ( CMD = Agent.get_user_input(), NewState = Agent.interpret(CMD) ; ansi_format([fg(red)], "That doesn't make sense to me.\n", []), NewState = Agent ), !, % If our certainty is over 50%, we can make an accusation. Otherwise we % loop to keep listening for input. The only time the certainty is over % 50% is when there is exactly 1 solution (i.e. the certainty is 100%), but % this may change in the future. NewState.get_theory() = case(Certainty, [Suspect, Weapon, Room]), (Certainty > 0.5 -> write("I accuse "), print_card(Suspect), write(" with the "), print_card(Weapon), write(" in the "), print_card(Room), write("!\n") ; true), NewState.play() ), user_quit, true). %% +Agent.get_user_input() := -Statement % Reads and parses input from the user. Agent.get_user_input() := Statement :- write("> "), read_line_to_codes(user_input, Line), % Add the line to the readline history. % http://www.swi-prolog.org/pldoc/man?section=readline atom_codes(LineAtom, Line), rl_add_history(LineAtom), parse(Agent, Line, Statement). % Interpreter % ================================================== %% +Agent.interpret(+Statement) := -NewState % Given a Statement from the user, the agent records that information and takes % appropriate action. Below is a list of statements understood by the Agent. % Capital words are variables subject to interpretation by the parser, while % lowercase words appear literally in the statement. % % "Player suggests Suspect in Room with Weapon.": % The agent commits to memory the current suggestion. % % "Player has Card.": % The agent takes note that the card is possesed by the given player. % The conjugated form "You have Card." should be used at the start of the % game to tell the agent which cards it posseses. % % "Player has a card.": % The agent take note that the player posseses at least one of the cards % from the current suggestion. % % "Player passes.": % The agent takes note that the player does not have any cards in the % current suggestion. % % "show a card.": % This statement alerts the agent that it is its turn to reveal a card. The % agent either responds with the card it wishes to reveal or responds that % it has no cards from the current suggestion. % % "show cases.": % This statement instructs the agent to reveal its current cases on the % game. The cases consist of possible solutions and the agent's certainty % about each one. % % "show status.": % This statement instructs the agent to reveal various information about the % current status of the game, including what the most recent suggestion was % and the contents of opponents hands. % % "move Distance from Location.": % This statement alerts the agent that it is its turn to move, and that it % may move a certain distance from the given location. If the agent can make % a suggestion after moving, it will do so. Agent.interpret(Statement) := NewState :- agent(Agent), TmpState = Agent.interpret_(Statement), % If the current best theory has a certainty over 1%, % switch to full search mode. CurrentTheory = case(Certainty, _), CurrentTheory = TmpState.get_theory(), (Certainty > 0.01 -> NewState = TmpState.put(full_search, true) ; NewState = TmpState ). % `Player suggests Suspect in Room with Weapon.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Player, suggests, suspect(_,SID), [ in(room(_,RID)), with(weapon(_,WID)) ] ), % Set the current suggestion. NewState = Agent.put(current_suggestion, suggestion(Player, SID, WID, RID)), !. % `Player has Card.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Player, has, Card, [] ), card(Card, ID), % Constrain the hand of player P to contain Card. element(_, Player.hand, ID), % We must clear the cache since we have new constraints. NewState = Agent.clear_cache().put(current_suggestion, _), !. % `Player has a card.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Player, has, card, [] ), % Constrain the hand of player P to contain at least one of the cards. Agent.current_suggestion = suggestion(_, SID, WID, RID), nonempty_intersection(Player.hand, [SID, WID, RID]), % We must clear the cache since we have new constraints. NewState = Agent.clear_cache().put(current_suggestion, _), !. % `Player passes.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Player, passes, '', [] ), Agent.current_suggestion = suggestion(_, SID, WID, RID), empty_intersection(Player.hand, [SID,WID,RID]), % We must clear the cache since we have new constraints. NewState = Agent.clear_cache(), !. % `show a card.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Agent.self, shows, card, [] ), % Reveal the card which has been already been revealed the most. nonvar(Agent.current_suggestion), Agent.current_suggestion = suggestion(_, S, W, R), label(Agent.self.hand), findall([Count,Card], ( member(Card, [S,W,R]), nth1(Index, Agent.self.hand, Card), nth1(Index, Agent.shown_counts, Count) ), Unsorted), sort(Unsorted, Backwards), reverse(Backwards, Sorted), Sorted = [[BestCount,_]|_], findall(Card, ( member([BestCount,Card], Sorted) ), Cards), random_select(Card, Cards, _), write("I reveal "), print_card(Card), write(".\n"), % Increment the count of times the card has been shown findall(Count, ( nth1(Index, Agent.self.hand, X), (X = Card -> Count is BestCount + 1 ; nth1(Index, Agent.shown_counts, Count) ) ), NewCounts), NewState = Agent.put(shown_counts, NewCounts), !. Agent.interpret_(Statement) := Agent :- Statement = statement( Agent.self, shows, card, [] ), % SInce the previouse case didn't work, the agent hasn't anything to show. write("I have nothing to show.\n"), !. % `show cases.` % -------------------------------------------------- Agent.interpret_(Statement) := Agent :- Statement = statement( Agent.self, shows, cases, [] ), Cases = Agent.findall_cases(), foreach(member(Case, Cases), ( print_case(Case) )), !. % `show status.` % -------------------------------------------------- Agent.interpret_(Statement) := Agent :- Statement = statement( Agent.self, shows, status, [] ), % Show the most recent suggestion if one exists. (nonvar(Agent.current_suggestion) -> Agent.current_suggestion = suggestion(P,S,W,R), (P = Agent.self -> write("I am suggesting ") ; format("~w is suggesting ", [P.name]) ), print_card(S), write(" with "), print_card(W), write(" in "), print_card(R), write(".\n") ; true), % If the entire contents of a player's hand is known, print it. forall(member(Player, Agent.players), ( Hand = Player.hand, findnsols(2, Hand, label(Hand), Hands), length(Hands, L), (L = 1 -> label(Hand), (Player = Agent.self -> write("I have ") ; format("~w has ", [Player.name]) ), print_hand(Hand), nl ; true) )), !. % `move Distance from Node.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Agent.self, moves, Distance, [ from(Node) ] ), between(2, 12, Distance), node(Node), Cases = Agent.findall_cases(), findall(Destination, reachable(Destination, Node, Distance), Dests), ( % The case where we can move to a room that could be a solution. member(case(BestCertainty,[_,_,RoomID]), Cases), member(room(_,RoomID), Dests) -> write("I move to "), print_card(RoomID), findall(case(BestCertainty,[S,W,RoomID]), ( member(case(BestCertainty,[S,W,RoomID]), Cases) ), GoodCases), random_select(Case, GoodCases, _), Case = case(_,[SuspectID,WeaponID,RoomID]), write(".\nI suggest "), print_card(SuspectID), write(" with "), print_card(WeaponID), write(" in "), print_card(RoomID), write(".\n"), NewState = Agent.put( current_suggestion, suggestion(Agent.self, SuspectID, WeaponID, RoomID) ), ! ; % The case where we have at least one room into which we can move. findall(room(Name,RoomID), member(room(Name,RoomID),Dests), RoomDests), length(RoomDests, NumRoomDests), NumRoomDests > 0 -> Rotation is Agent.order - 1, rotate(Rotation, Agent.players, PlayersByPenalty), findall([NegativePenalty,RoomID], ( member(room(_,RoomID), RoomDests), nth0(PositivePenalty, PlayersByPenalty, Player), Hand = Player.hand, forall(labeling([ffc], Hand), ( member(RoomID, Hand) )), NegativePenalty is 0 - PositivePenalty ), RoomRanks), sort(RoomRanks, [[_Penalty,RoomID]|_]), write("I move to "), print_card(RoomID), Case = Agent.get_theory(), Case = case(_,[SuspectID,WeaponID,_]), write(".\nI suggest "), print_card(SuspectID), write(" with "), print_card(WeaponID), write(" in "), print_card(RoomID), write(".\n"), NewState = Agent.put( current_suggestion, suggestion(Agent.self, SuspectID, WeaponID, RoomID) ), ! ; % The case where we must move into the open area. Agent.get_theory() = case(_,[_,_,TargetID]), TargetRoom = room(_,TargetID), call(TargetRoom), % Fill in the var in the compound term. path(Node, TargetRoom, Path), findall([InverseDistance,CommonNode], ( member(CommonNode, Path), reachable(CommonNode, Node, Distance), distance_estimate(Node, CommonNode, DistEstimate), InverseDistance is 0 - DistEstimate ), CommonNodes), sort(CommonNodes, [[_,point(X,Y)]|_]), format("I move to (~w,~w).\n", [X,Y]), NewState = Agent, ! ). % `refer to Player as Alias.` % -------------------------------------------------- Agent.interpret_(Statement) := NewState :- Statement = statement( Agent.self, refers, '', [ as(Alias), to(Player) ] ), NewPlayer = Player.put(name, Alias), Player = Agent.select_player(_,OtherPlayers), NewState = Agent.put(players, [NewPlayer|OtherPlayers]), !. % `quit.` % -------------------------------------------------- Agent.interpret_(Statement) := Agent :- Statement = statement( Agent.self, quits, '', [] ), !, throw(user_quit). % `debug.` % -------------------------------------------------- Agent.interpret_(Statement) := Agent :- Statement = statement( Agent.self, debugs, '', [] ), write(Agent.current_suggestion), nl, !, trace. % Helper Methods % ================================================== %% +Agent.findall_cases() := -Cases % Gets the list of all possible solutions sorted by certainty. Solutions are % represented by compound terms of the form % `case(Certainty, [Suspect,Weapon,Room])` % The solutions are cached, and the cache must be cleared when new information % is given to the user. See `Agent.clear_cache()`. Agent.findall_cases() := Agent.cache :- agent(Agent), nonvar(Agent.cache), !. Agent.findall_cases() := Agent.cache :- agent(Agent), var(Agent.cache), % Find all combinations findall([S,W,R], ( Agent.case = [S,W,R], ( Agent.full_search -> labeling([ffc], Agent.cards) ; label(Agent.case) ) ), Cases), % Calculate the certainty for each case. % Store the results in `Agent.cache`. length(Cases, NumCases), findall(S, member([S,_,_], Cases), Suspects), findall(W, member([_,W,_], Cases), Weapons), findall(R, member([_,_,R], Cases), Rooms), counts(Suspects, SuspectCounts), counts(Weapons, WeaponCounts), counts(Rooms, RoomCounts), findall(case(Certainty, [S,W,R]), ( member([S,SuspectCount], SuspectCounts), member([W,WeaponCount], WeaponCounts), member([R,RoomCount], RoomCounts), member([S,W,R], Cases), Certainty is (SuspectCount/NumCases) * (WeaponCount/NumCases) * (RoomCount/NumCases) ), CacheUnsorted), sort(CacheUnsorted, CacheBackwards), reverse(CacheBackwards, Agent.cache). %% +Agent.select_player(?NameOrID, ?Rest) := ?Player % True when Player is a member of Agent.players with the given NameOrID and Rest % is the list of other players. Agent.select_player(Ref, Rest) := P :- agent(Agent), player(P), (P.id = Ref ; P.name = Ref), select(P, Agent.players, Rest). %% +Agent.get_theory() := -Case % Returns the current solution with the highest certainty. Agent.get_theory() := Case :- agent(Agent), [Case|_] = Agent.findall_cases(). %% +Agent.get_certainty(+Suspect, +Weapon, +Room) := -Certainty % Get the certainty of a solution. This fully populates the solution cache. Agent.get_certainty(S, W, R) := Certainty :- agent(Agent), Cases = Agent.findall_cases(), member(case(Certainty, [S, W, R]), Cases). %% +Agent.clear_cache() := -NewState % Clears the solution cache. Agent.clear_cache() := Agent.put(cache, _) :- agent(Agent). %% print_case(+Case) % Prints a solution of the form `case(Certainty, [Suspect,Weapon,Room])`. print_case(case(Certainty, [SID,WID,RID])) :- CertaintyPercent is Certainty * 100, suspect(S, SID), weapon(W, WID), room(R, RID), write("I am "), ansi_format([fg(cyan)], "~3f%", [CertaintyPercent]), write(" certain it was "), print_card(S), write(" with "), print_card(W), write(" in "), print_card(R), write(".\n"). %% print_hand(+Hand) % Prints a list of cards. print_hand([X]) :- write("and "), print_card(X), !. print_hand([H|T]) :- print_card(H), write(", "), print_hand(T).
cbarrick/plum
src/agent.pl
Perl
mit
17,685
package AccessCounter::L10N::ja; use strict; use base 'AccessCounter::L10N::en_us'; use vars qw( %Lexicon ); %Lexicon = ( ## plugins/AccessCounter/AccessCounter.pl '<p>This plugin enables Access Ranking: tally up the accessed count. Additionally, you can sort entries by their accessed count.</p><pre><code>&#60;mt:Entries <strong>sort_by=&#34;accessed_count&#34;</strong>&#62;<br />...<br />&#60;/mt:Entries&#62;</code></pre>' => '<p>アクセスランキングを表示できます。ブログ記事のアクセス数をカウントします。アクセス数順で指定した数のブログ記事を一覧することができます。</p><p>ブログ記事のランキング表示は、MTEntries のモディファイア sort_by に accessed_count を指定します。</p><pre><code>&#60;mt:Entries <strong>sort_by=&#34;accessed_count&#34;</strong>&#62;<br />...<br />&#60;/mt:Entries&#62;</code></pre>', 'Accessed Count' => 'アクセスカウント', 'Counts' => 'アクセス数', 'Last Accessed' => '最終アクセス日時', ## plugins/AccessCounter/tmpl/config.tmpl 'Tracking' => 'トラッキング', 'Start Tracking your Blog' => 'このブログのトラッキングを開始します', 'Deny IP Addresses' => '除外IPアドレス', ); 1;
morimasato/mt-plugin-accesscounter
plugins/AccessCounter/lib/AccessCounter/L10N/ja.pm
Perl
mit
1,268
use Bio::KBase::KIDL::typedoc; use strict; use POSIX; use Data::Dumper; use Template; use File::Slurp; use File::Basename; use File::Path 'make_path'; use Bio::KBase::KIDL::KBT; use Getopt::Long; =head1 NAME compile_typespec =head1 SYNOPSIS compile_typespec [arguments] spec-file output-dir =head1 DESCRIPTION compile_typespec is the KBase type compiler. It reads a KBase Interface Description Language (KIDL) file and generates the client and server interface code for it. =head1 COMMAND-LINE OPTIONS Usage: compile_typespec [arguments] spec-file output-dir Arguments: --scripts dir Generate simple wrapper scripts --impl name Use name as the classname for the generated perl implementation module --service name Use name as the classname for the generated service module --psgi name Write a PSGI file as name --client name Use name as the classname for the generated client module --js name Use name as the basename for the generated Javascript client module --py name Use name as the basename for the generated Python client module --url URL Use URL as the default service URL in the generated clients --dump Dump the parsed type specification file to stdout --enable-retries Enable client-side retries to services. =head1 AUTHORS Robert Olson, Argonne National Laboratory olson@mcs.anl.gov =cut my $scripts_dir; my $impl_module_base; my $service_module; my $client_module; my $psgi; my $js_module; my $py_module; my $py_server_module; my $py_impl_module; my $default_service_url; my $dump_parsed; my $test_script; my $help; my $enable_retries; my $rc = GetOptions("scripts=s" => \$scripts_dir, "impl=s" => \$impl_module_base, "service=s" => \$service_module, "psgi=s" => \$psgi, "client=s" => \$client_module, "test=s" => \$test_script, "js=s" => \$js_module, "py=s" => \$py_module, "pyserver=s"=> \$py_server_module, "pyimpl=s" => \$py_impl_module, "url=s" => \$default_service_url, "dump" => \$dump_parsed, "enable-retries" => \$enable_retries, "help|h" => \$help, ); if (!$rc || $help || @ARGV < 2) { seek(DATA, 0, 0); while (<DATA>) { last if /^=head1 COMMAND-LINE /; } while (<DATA>) { last if /^=/; print $_; } exit($help ? 0 : 1); } ($rc && @ARGV >= 2) or die "Usage: $0 [--psgi psgi-file] [--impl impl-module] [--service service-module] [--client client-module] [--scripts script-dir] [--py python-module ] [--pyserver python-server-module] [--pyimpl python-implementation-module][--js js-module] [--url default-service-url] [--test test-script] typespec [typespec...] output-dir\n"; my $output_dir = pop; my @spec_files = @ARGV; if ($scripts_dir && ! -d $scripts_dir) { die "Script output directory $scripts_dir does not exist\n"; } my $parser = typedoc->new(); # # Read and parse all the given documents. We collect all documents # that comprise each service, and process the services as units. # my %services; my $errors_found; for my $spec_file (@spec_files) { my $txt = read_file($spec_file) or die "Cannot read $spec_file: $!"; my($modules, $errors) = $parser->parse($txt, $spec_file); #print Dumper($modules); my $type_info = assemble_types($parser); if ($errors) { print STDERR "$errors errors were found in $spec_file\n"; $errors_found += $errors; } for my $mod (@$modules) { my $mod_name = $mod->module_name; my $serv_name = $mod->service_name; print STDERR "$spec_file: module $mod_name service $serv_name\n"; push(@{$services{$serv_name}}, [$mod, $type_info, $parser->YYData->{type_table}]); } } if ($errors_found) { exit 1; } # # Determine if we have any authentication-optional or -required methods. If any of # these exist, then we need to compile in the authentication support. # my $need_auth = check_for_authentication(\%services); print STDERR Dumper(\%services) if $dump_parsed; while (my($service, $modules) = each %services) { write_service_stubs($service, $modules, $output_dir, $need_auth->{$service}); } sub setup_impl_data { my($impl_module_base, $module, $ext) = @_; my $imod; if ($impl_module_base) { $imod = sprintf $impl_module_base, $module->module_name; } else { $imod = $module->module_name . "Impl"; } my $ifile = $imod; $ifile =~ s,::,/,g; #convert perl module separators to / $ifile =~ s,\.,/,g; #convert py module separators to / $ifile .= $ext; return $imod, $ifile; } # Given one more more modules that implement a service, write a single # psgi, client and service stub for the service, and one impl stub per module. # # The service stubs include a mapping from the function name in a module # to the impl module for that function. # # need_auth is a hash with keys of "required", "optional", "none" # with counts of methods with that attribute. # sub write_service_stubs { my($service, $modules, $output_dir, $need_auth) = @_; my $tmpl = Template->new( { OUTPUT_PATH => $output_dir, ABSOLUTE => 1, }); my %service_options; my %module_impl_file; my %module_info; my @modules; for my $module_ent (@$modules) { my($module, $type_info, $type_table) = @$module_ent; # print Dumper($module); my($imod, $ifile) = setup_impl_data($impl_module_base, $module, ".pm"); my($pymod, $pyfile) = setup_impl_data($py_impl_module, $module, ".py"); $module_info{$module->module_name} = { module => $imod, file => $ifile, pymodule => $pymod, pyfile => $pyfile }; $service_options{$_} = 1 foreach @{$module->options}; my $data = compute_module_data($module, $imod, $ifile, $pymod, $pyfile, $type_info, $type_table); push(@modules, $data); } my $client_package_name = $client_module || ($service . "Client"); my $server_package_name = $service_module || ($service . "Server"); my $python_server_name = $py_server_module || ($service . "Server"); my $client_package_file = $client_package_name; $client_package_file =~ s,::,/,g; $client_package_file .= ".pm"; make_path($output_dir . "/" . dirname($client_package_file)); my $server_package_file = $server_package_name; $server_package_file =~ s,::,/,g; $server_package_file .= ".pm"; make_path($output_dir . "/" . dirname($server_package_file)); my $python_server_file = $python_server_name; $python_server_file =~ s,\.,/,g; $python_server_file =~ s,::,/,g; $python_server_file .= ".py"; make_path($output_dir . "/" . dirname($python_server_file)); my $js_file = $js_module || ($service . "Client"); $js_file .= ".js"; my $py_file = $py_module || ($service . "Client"); $py_file =~ s,\.,/,g; $py_file .= ".py"; # don't create psgi if not requested # my $psgi_file = $psgi || ($service . ".psgi"); my $psgi_file = $psgi; # # We define two different flags: "authenticated" is true # if any funcdef has authenticated required or optional. This # causes the authentication code to be brought in. # # Flag "authenticated_only" is set if *all* funcdefs # in the module require authentication. In this case we # force authentication to succeed in the client object # constructor. # my $vars = { client_package_name => $client_package_name, server_package_name => $server_package_name, python_server_name => $python_server_name, service_name => $service, modules => \@modules, module_info => \%module_info, service_options => \%service_options, default_service_url => $default_service_url, authenticated => (($need_auth->{required} || $need_auth->{optional}) ? 1 : 0), authenticated_only => (($need_auth->{required} && (!$need_auth->{optional}) && (!$need_auth->{none})) ? 1 : 0), psgi_file => $psgi_file, enable_client_retry => $enable_retries, }; # print Dumper($vars); my $tmpl_dir = Bio::KBase::KIDL::KBT->install_path; $tmpl->process("$tmpl_dir/js.tt", $vars, $js_file) || die Template->error; $tmpl->process("$tmpl_dir/python_client.tt", $vars, $py_file) || die Template->error; $tmpl->process("$tmpl_dir/python_server.tt", $vars, $python_server_file) || die Template->error; $tmpl->process("$tmpl_dir/client_stub.tt", $vars, $client_package_file) || die Template->error; $tmpl->process("$tmpl_dir/server_stub.tt", $vars, $server_package_file) || die Template->error; if ($psgi_file) { $tmpl->process("$tmpl_dir/psgi_stub.tt", $vars, $psgi_file) || die Template->error; } if ($test_script) { $tmpl->process("$tmpl_dir/client_test.tt", $vars, $test_script) || die Template->error; } for my $module_ent (@$modules) { my($module, $type_info) = @$module_ent; my($ifile, $imod) = @{$module_info{$module->module_name}}{'file', 'module'}; my($pyfile, $pymod) = @{$module_info{$module->module_name}}{'pyfile', 'pymodule'}; write_module_stubs($service, $imod, $ifile, $module, $type_info, $vars, $output_dir); write_module_stubs($service, $pymod, $pyfile, $module, $type_info, $vars, $output_dir, 'python_impl.tt'); write_scripts($scripts_dir, $module, $vars, $output_dir); } } sub parse_old_client { my($mod_file) = @_; my %saved_stub; my $saved_header; my $saved_const; my $saved_cls_hdr; if (open(my $fh, "<", "$output_dir/$mod_file")) { # # Collect old client implementation code. # my $cur_rtn; my $cur_hdr; my $cur_const; my $cur_clshdr; while (<$fh>) { if (/^\s*\#BEGIN\s+(\S+)/) { $cur_rtn = $1; } elsif (/^\s*\#END\s+(\S+)/) { undef $cur_rtn; } elsif ($cur_rtn) { $saved_stub{$cur_rtn} .= $_; } elsif (/^\s*\#BEGIN_HEADER\s*$/) { $cur_hdr = 1; } elsif (/^\s*\#END_HEADER\s*$/) { $cur_hdr = 0; } elsif (/^\s*\#BEGIN_CLASS_HEADER\s*$/) { $cur_clshdr = 1; } elsif (/^\s*\#END_CLASS_HEADER\s*$/) { $cur_clshdr = 0; } elsif (/^\s*\#BEGIN_CONSTRUCTOR\s*$/) { $cur_const = 1; } elsif (/^\s*\#END_CONSTRUCTOR\s*$/) { $cur_const = 0; } elsif ($cur_hdr) { $saved_header .= $_; } elsif ($cur_clshdr) { $saved_cls_hdr .= $_; } elsif ($cur_const) { $saved_const .= $_; } } close($fh); } return $saved_header, $saved_cls_hdr, $saved_const, \%saved_stub; } sub get_type_names { my($type) = @_; my $typedef = $type->as_string(); $typedef =~ m/^\s*(\w+)\s*(?:[<{].+)?$/; #this is a bit hacky, maybe add a method to each type - should ask Bob my $baretype = $1; return $typedef, $baretype; } sub compute_module_data { my($module, $impl_module_name, $impl_module_file, $py_impl_mod, $py_impl_file, $type_info, $type_table) = @_; my $doc = $module->comment; $doc =~ s/^\s*\*\s?//mg; my($saved_header, $saved_cls_hdr, $saved_const, $saved_stub) = parse_old_client($impl_module_file); my %saved_stub = %$saved_stub; my($py_saved_header, $py_saved_clshdr, $py_saved_const, $py_saved_stub) = parse_old_client($py_impl_file); my %py_saved_stub = %$py_saved_stub; my $methods = []; my $vars = { impl_package_name => $impl_module_name, py_impl_package_name => $py_impl_mod, module_name => $module->module_name, module => $module, module_doc => $doc, methods => $methods, types => $type_info, module_header => $saved_header, module_constructor => $saved_const, py_module_header => $py_saved_header, py_module_class_header => $py_saved_clshdr, py_module_constructor => $py_saved_const, }; for my $comp (@{$module->module_components}) { next unless $comp->isa('Bio::KBase::KIDL::KBT::Funcdef'); my $params = $comp->parameters; my @args; my @arg_types; my @arg_validators; my %ncount; my @param_dat; my @return_dat; for my $i (0..$#$params) { my $p = $params->[$i]; my $name; if ($p->{name}) { $name = $p->{name}; } else { # # if we didn't pass in a name, and if # this parameter is a typedef, use the type name. # if (ref($p->{type}) && $p->{type}->can('alias_type')) { $name = $p->{type}->name; } else { $name = "arg_" . ($i + 1); } } push(@args, $name); $ncount{$name}++; } # # Scan args for duplicates and disambiguate. # for my $argi (0..$#args) { if ($ncount{$args[$argi]} > 1) { $args[$argi] .= "_" . ($argi + 1); } } # # Generate english type descriptions. # my %types_seen; my $typenames = []; my @english; for my $argi (0..$#args) { my $name = $args[$argi]; my $p = $params->[$argi]; my $type = $p->{type}; my $eng = $type->english(1); my $tn = $type->subtypes(\%types_seen); # print "arg $argi $type subtypes @$tn\n"; push(@$typenames, @$tn); push(@english, "\$$name is $eng"); my $perl_var = "\$$name"; my($typedef, $baretype) = get_type_names($type); my $validator = $type->get_validation_routine($perl_var); push(@arg_validators, $validator); $param_dat[$argi] = { index => ($argi + 1), name => $name, perl_var => '$' . $name, english => $eng, type => $type, validator => $validator, typedef => $typedef, baretype => $baretype, }; } my $args = join(", ", @args); my $arg_vars = join(", ", map { "\$$_" } @args); my $returns = $comp->return_type; my @rets; if (@$returns == 1) { my $p = $returns->[0]; my $name = $p->{name} // "return"; push(@rets, $name); my $tn = $p->{type}->subtypes(\%types_seen); push(@$typenames, @$tn); my $eng = $p->{type}->english(1); push(@english, "\$$name is $eng"); } else { for my $i (0..$#$returns) { my $p = $returns->[$i]; my $name = $p->{name} // "return_" . ($i + 1); push(@rets, $name); my $tn = $p->{type}->subtypes(\%types_seen); push(@$typenames, @$tn); my $eng = $p->{type}->english(1); push(@english, "\$$name is $eng"); } } for my $i (0..$#$returns) { my $name = $rets[$i]; my $perl_var = "\$$name"; my $type = $returns->[$i]->{type}; my $validator = $type->get_validation_routine($perl_var); my($typedef, $baretype) = get_type_names($type); $return_dat[$i] = { name => $name, perl_var => '$' . $name, english => $english[$i], type => $type, validator => $validator, typedef => $typedef, baretype => $baretype, }; } my $rets = join(", ", @rets); my $ret_vars = join(", ", map { "\$$_" } @rets); for my $tn (@$typenames) { my $type = $type_table->{$tn}; if (!defined($type)) { die "Type $tn is not defined in module " . $module->module_name . "\n"; } push(@english, "$tn is " . $type->alias_type->english(1)); } my $doc = $comp->comment; $doc =~ s/^\s*\*\s?//mg; chomp @english; my $meth = { name => $comp->name, arg_doc => [grep { !/^\s*$/ } @english], doc => $doc, args => $args, arg_vars => $arg_vars, arg_types => \@arg_types, arg_validators => \@arg_validators, params => \@param_dat, returns => \@return_dat, rets => $rets, ret_vars => $ret_vars, arg_count => scalar @args, ret_count => scalar @rets, user_code => $saved_stub{$comp->name}, py_user_code => $py_saved_stub{$comp->name}, authentication => $comp->authentication, }; push(@$methods, $meth); } return $vars; } sub get_module_script_info { my($module, $vars, $output_dir) = @_; my($my_module) = grep { $_->{module_name} eq $module->module_name } @{$vars->{modules}}; my $tmpl = Template->new( { OUTPUT_PATH => $output_dir, ABSOLUTE => 1, }); my $tmpl_dir = Bio::KBase::KIDL::KBT->install_path; return $my_module, $tmpl, $tmpl_dir; } sub write_module_stubs { my($service, $impl_module_name, $impl_module_file, $module, $type_info, $vars, $output_dir, $template) = @_; if (!(defined $template)) { $template = 'impl_stub.tt'; } my($my_module, $tmpl, $tmpl_dir) = get_module_script_info($module, $vars, $output_dir); my $impl_file = "$output_dir/$impl_module_file"; make_path(dirname($impl_file), { verbose => 1 }); if (-f $impl_file) { my $ts = strftime("%Y-%m-%d-%H-%M-%S", localtime); my $bak = "$impl_file.bak-$ts"; rename($impl_file, $bak); } my $mvars = { %$vars, module => $my_module, }; open(IM, ">", $impl_file) or die "Cannot write $impl_file: $!"; $tmpl->process("$tmpl_dir/$template", $mvars, \*IM) || die Template->error; close(IM); } sub write_scripts { my($scripts_dir, $module, $vars, $output_dir) = @_; my($my_module, $tmpl, $tmpl_dir) = get_module_script_info($module, $vars, $output_dir); if ($scripts_dir) { for my $method (@{$my_module->{methods}}) { my %d = %$vars; $d{method} = $method; my $name = $method->{name}; if (0) { # don't write the api scripts since they confuse people my $fh; if (!open($fh, ">", "$scripts_dir/$name.pl")) { die "Cannot write $scripts_dir/$name.pl: $!"; } $tmpl->process("$tmpl_dir/api_script.tt", \%d, $fh) || die Template->error; } # # Determine if the signature of this method allows the creation of a simple script. # my $ok = 1; for my $param (@{$method->{params}}) { # # Resolve type. # my $type = $param->{type}; while ($type->can('alias_type')) { $type = $type->alias_type; } if (!$type->isa('Bio::KBase::KIDL::KBT::Scalar')) { $ok = 0; last; } } if ($ok) { my $fh; my $file = "$scripts_dir/simple_$name.pl"; if (-f $file) { warn "Not overwriting existing file $file\n"; } else { if (!open($fh, ">", $file)) { die "Cannot write $file: $!"; } $tmpl->process("$tmpl_dir/simple_cmd.tt", \%d, $fh) || die Template->error; close($fh); } } } } } sub assemble_types { my($parser) = @_; my $types = []; for my $type (@{$parser->types()}) { my $name = $type->name; my $ref = $type->alias_type; my $eng = $ref->english(0); push(@$types, { name => $name, ref => $ref, english => $eng, comment => $type->comment, }); } return $types; } sub check_for_authentication { my($services) = @_; my $out = {}; SVC: while (my($service, $modules) = each %$services) { $out->{$service}->{$_} = 0 foreach qw(required optional none);; for my $module_ent (@$modules) { my($module, $type_info, $type_table) = @$module_ent; for my $comp (@{$module->module_components}) { next unless $comp->isa('Bio::KBase::KIDL::KBT::Funcdef'); $out->{$service}->{$comp->authentication}++; } } } return $out; } __DATA__
kbase/typecomp
scripts/compile_typespec.pl
Perl
mit
22,199
#!/usr/bin/perl #Radio Parser by Stephen Wetzel June 26 2013 #grabs recently played list from WMGK site #run daily at midnight #uses lynx use strict; use warnings; use autodie; use Cwd 'abs_path'; abs_path($0) =~ m/(.*\/)/; my $dir = $1; #directory path of script #$|++; #autoflush disk buffer my ($secnow,$minnow,$hrnow,$daynow,$monnow,$yearnow,$wday,$yday,$isdst)=localtime(time); my $date = sprintf("%4d-%02d-%02d", $yearnow+1900, $monnow+1, $daynow); print "\nDate: $date"; my $debug = 0; # set to 1 to avoid downloading, give extra output my $linxdump = $dir."data/wmgk.$date.txt"; my $outputfile = $dir."data/allsongs.txt"; #main file with a record of each play my $url = "http://www.wmgk.com/broadcasthistory.aspx"; my @filearray; #stores lines of input files my $fileline; #store individual lines of input file in for loops my $temp; my $hour; my $min; my $ampm; my $song; my $band; my $tempdate; #lynx -dump -width=9999 -nolist "http://www.wmgk.com/broadcasthistory.aspx" >dump.txt $temp = "lynx -dump -width=9999 -nolist \"$url\" > $linxdump"; #print "\n$temp\n"; if (!$debug) {system($temp);} #download page when not debug if ($debug) {$linxdump = "dump.txt";} #if debug use saved page open my $ifile, '<', $linxdump; @filearray = <$ifile>; #put the wmgk page into an array for processing close $ifile; open my $ofile, '>>', $outputfile; foreach $fileline (@filearray) {#go through the linx dump, gather data # Played on [7/10/2013] if ($fileline =~ m/\s*Played on\s+\[(\d{1,2})\/(\d{1,2})\/(\d{4}).*\]/) {#this line should contain date #1: month, 2: day, 3: year $tempdate = sprintf("%4d-%02d-%02d", $3, $1, $2); print "\ndate: $date tempdate: $tempdate"; $date = $tempdate; #always use date from wmgk file, script is ran just after midnight #if ($tempdate ne $date) #{#wrong day, panic # print "\nWrong Day"; # print "\t$date vs $3-$1-$2"; # #die("\nWrong Day \t$date vs $3-$1-$2"); # $date = $tempdate; #} } # 1:40 PM "DON'T STOP BELIEVING" - JOURNEY # 10:05 AM "LONELY OL' NIGHT" - JOHN MELLENCAMP buy on iTunes if ($fileline =~ m/\s*(\d{1,2}):(\d{2})\s(AM|PM)\s+\"(.+)\"\s-\s(.+)/) {#this line should contain a song $hour = $1; $min = $2; $ampm = $3; $song = $4; $band = $5; if ($hour == 12) {$hour -= 12;} if ($ampm eq "PM") {$hour += 12;} $band =~ s/\s+buy on iTunes.*//; #strip ending $band =~ s/\s+$//; #strip trailing spaces $band =~ s/(['|\w]+)/\u\L$1/g; #Title Case $song =~ s/(['|\w]+)/\u\L$1/g; #Title Case unless ($band =~ m/shoes/i || $band eq '' || $band =~ m/PUBLICAFFAIRS/i|| $band =~ m/wmgk/i) {#strip out some non-song entries print $ofile "\n$date;$hour:$min;$band;$song"; } } } close $ofile; print "\nDone\n\n";
StephenWetzel/wmgk
radio.pl
Perl
mit
2,767
#!/bin/perl -00 # datesort - sort mbox by subject then date use strict; use Date::Manip; my @msgs = (); while (<>) { next unless /^From/m; my $date = ''; if (/^Date:\s*(.*)/m) { ($date = $1) =~ s/\s+\(.*//; $date = ParseDate($date); } push @msgs, { SUBJECT => /^Subject:\s*(?:Re:\s*)*(.*)/mi, DATE => $date, NUMBER => scalar @msgs, TEXT => '', }; } continue { $msgs[-1]{TEXT} .= $_; } for my $msg ( sort { $a->{SUBJECT} cmp $b->{SUBJECT} || $a->{DATE} cmp $b->{DATE} || $a->{NUMBER} <=> $b->{NUMBER} } @msgs) { print $msg->{TEXT}; }
jmcveigh/perl-cookbook-bins
datesort.pl
Perl
mit
631
:-use_module(library(clpb)). :-use_module(library(clpfd)). % A small example pos(Ps):- Ps=[[0,1,0,1], [0,1,0,1], [1,0,0,1]]. neg(Ns):- Ns=[[1,0,1,0], [1,0,1,0], [0,1,1,0]]. %A larger example database(D):- %Eduction= primary,Education=University,Education=Secondary,MS=Single,MS=married,MS=Divorced,Sex=Male,Sex=Female,Children=yes,Children=No,Approved=yes,Approved=No D=[ [1,0,0,1,0,0,1,0,0,1,0,1],%1 [1,0,0,1,0,0,1,0,1,0,0,1],%2 [1,0,0,0,1,0,1,0,0,1,1,0],%3 [0,1,0,0,0,1,0,1,0,1,1,0],%4 [0,1,0,0,1,0,0,1,1,0,1,0],%5 [0,0,1,1,0,0,1,0,0,1,0,1],%6 [0,1,0,1,0,0,0,1,0,1,1,0],%7 [0,0,1,0,0,1,0,1,0,1,1,0],%8 [0,0,1,1,0,0,0,1,1,0,1,0],%9 [0,0,1,0,1,0,1,0,1,0,1,0],%10 [1,0,0,0,1,0,0,1,0,1,1,0],%11 [0,0,1,0,0,1,1,0,1,0,0,1],%12 [0,1,0,0,0,1,0,1,1,0,0,1],%13 [0,0,1,0,0,1,1,0,0,1,1,0]%14 ]. approved(As):- database(D), findall([F1,F2,F3,F4,F5,F6,F7,F8,F9,F10],(member([F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,C1,_],D),C1=1),As). notapproved(NAs):- database(D), findall([F1,F2,F3,F4,F5,F6,F7,F8,F9,F10],(member([F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,C1,_],D),C1=0),NAs). %To translate the binary vectors to the features on the larger example. binary_to_features(Binary,Features):- FeatureList =['Eduction= primary','Education=University','Education=Secondary','MS=Single','MS=married','MS=Divorced','Sex=Male','Sex=Female','Children=yes','Children=no'], findall(F,(pairmember_list_list(B-F,Binary,FeatureList),B=1),Features). binary_to_features_with_class(Binary,Features):- FeatureList =['Eduction= primary','Education=University','Education=Secondary','MS=Single','MS=married','MS=Divorced','Sex=Male','Sex=Female','Children=yes','Children=no','class=yes','class=no'], findall(F,(pairmember_list_list(B-F,Binary,FeatureList),B=1),Features). pairmember_list_list(H1-H2,[H1|_T1],[H2|_T2]). pairmember_list_list(H1-H2,[_|T1],[_|T2]):- pairmember_list_list(H1-H2,T1,T2). %?-pairmember_list_list(X-X2,[1,2,3],[a,b,c]). %@ X = 1, %@ X2 = a ; %@ X = 2, %@ X2 = b ; %@ X = 3, %@ X2 = c ; %@ false. %To generate random examples. eg. ?- random_binary_matrix_x_y(9,20,Pos). random_binary_vector_n(N,R):- length(R,N),maplist(random_between(0,1),R). random_binary_matrix_x_y(X,Y,R):- length(R,Y), maplist(random_binary_vector_n(X),R). %coverage checking predicates covers_number(Features, Examples, Number):- maplist(my_covers_(Features), Examples, Numbers), sat(card([Number], Numbers)). my_covers_(FeatureList,ExampleList,Covered):- build_structure(FeatureList,ExampleList,Structure), sat(Covered =:= *(Structure)). build_structure([],[],[]). build_structure([H1|T1],[H2|T2],[(H1=:=(H1*H2))|Structure]):- build_structure(T1,T2,Structure). %exhaustive search method start_exhaustive_search(Positives,Negatives,Features, Value,TP,FP):- length(Positives,PL), length(Negatives,NL), MaxL is max(PL,NL), member(Me,Positives), same_length(Features, Me), [TP,FP] ins 0..MaxL, % (in this case) Value #= NL*TP-FP*PL, labeling([max(Value)], [TP,FP]), covers_number(Features, Positives, TP), covers_number(Features, Negatives, FP), labeling(Features). %Heuristic Search specialise(Input,Output):- select(0,Input,1,Output). search(NL,PL,Ps,Ns,Start,TP,FP,[r(Special,Value,cm(TP,FP))|Result]):- FP\==0, %Stop TP #>0, Value #>0, %what is this heuristic I am using heuristic_stats_value(unknown,pl_nl(PL-NL)-tp_fp(TP-FP),Value), labeling([max(Value)],[Value]), specialise(Start,Special), label([TP,FP]), covers_number(Special,Ps,TP), covers_number(Special,Ns,FP), TP1 in 0..TP, FP1 in 0..FP, search(NL,PL,Ps,Ns,Special,TP1,FP1,Result). search(_,_,_,_,_,_,0,[]). start_search(Ps,Ns,Result):- Ns=[Example|_], length(Example,Size), length(Ps,PL), length(Ns,NL), TP in 0..PL, FP in 0..NL, length(Start,Size), Start ins 0..0, search(NL,PL,Ps,Ns,Start,TP,FP,Result). %How to deal with integers. Can I multiply by 1000 or 10000? heuristic_stats_value(unknown,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value #= NL*TP-FP*PL. /*Elementry Heuristics */ heuristic_stats_value(unCovNeg,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value #= NL - FP. %True Negatives %specificity is also known as true negative rate heuristic_stats_value(specificity,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- TN #= NL-FP, Value is TN/NL. %equivlant to recall and cov diff heuristic_stats_value(covPos,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value = TP. %recall aka sensitivity is equivlant to covpos for the purpose of ordering rules heuristic_stats_value(recall,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is TP/PL. %also equivlant to recall and cov pos heuristic_stats_value(support,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is TP/(PL+NL). /*End elementry heuristics */ heuristic_stats_value(cov_diff,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value #= TP -FP. heuristic_stats_value(accuracy,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is (Tp+(NL-FP))/(PL+NL). heuristic_stats_value(coverage,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is (TP+FP)/(PL+NL). heuristic_stats_value(rate_diff,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is (TP/PL)-(FP/NL). heuristic_stats_value(wra,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is ((TP*FP)/(PL+NL))*((TP/(TP+FP))-(PL/(PL+NL))). heuristic_stats_value(lincost,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- throw("Error lin cost not implemented yet-requires parameters"). heuristic_stats_value(rellincost,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- throw("Error rel lin cost not implemented yet-requires parameters"). heuristic_stats_value(precision,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- Value is TP/(TP+FP). /*From Peters book not 100% sure this is correct*/ heuristic_stats_value(avg_recall,pl_nl(PL-NL)-tp_fp(TP-FP),Value):- TN #= NL-FP, %True negative rate is covered negatives /number of negatives TNR is TN/NL, TPR is TP/PL, Value is (TPR +TNR)/2. %?-approved(As),notapproved(NAs),start_search(As,NAs,Result).
samwalrus/machine_learning
classifiers/rule2.pl
Perl
mit
5,933
:- module(causes,[rel_causes/2]). :- use_module(db). src(wn(db/wn_cs)). load :- src(Src), ensure_loaded(Src). rel_causes(EffectId, CauseId) :- src(Src), call_ensuring_src_loaded(cs(EffectId, CauseId), Src).
aBathologist/borgmanities
prolog/wn/causes.pl
Perl
mit
227
#!perl # # Usage: perl sync_control.pl {reload|rerun|suspend} # send {HUP,USR1,QUIT} signal to all perl program. # if ( $#ARGV < 0 ) { $ARGV[0] = "reload"; } my $signal = "HUP"; if ( $ARGV[0] eq "reload" ) { $signal = "HUP"; } elsif ( $ARGV[0] eq "rerun") { $signal = "USR1"; } elsif ( $ARGV[0] eq "suspend") { $signal = "QUIT"; } system( q!/usr/bin/ps | /usr/bin/awk '/cons/ && /perl/ { print $1;}' | /usr/bin/xargs /usr/bin/kill ! . "-$signal" ); #<>;
halueda/auto-sync
misc/sync_control.pl
Perl
apache-2.0
467
# # 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::microsoft::activedirectory::local::mode::netdom; use base qw(centreon::plugins::mode); use strict; use warnings; use centreon::plugins::misc; use Win32; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $options{options}->add_options(arguments => { 'domain:s' => { name => 'domain' }, 'workstation:s' => { name => 'workstation' }, 'timeout:s' => { name => 'timeout', default => 30 } }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); } sub netdom { my ($self, %options) = @_; my $netdom_cmd = 'netdom verify '; $netdom_cmd .= ' /Domain:' . $self->{option_results}->{domain} if (defined($self->{option_results}->{domain}) && $self->{option_results}->{domain} ne ''); if (defined($self->{option_results}->{workstation})) { $netdom_cmd .= ' ' . $self->{option_results}->{workstation}; } else { $netdom_cmd .= ' ' . Win32::NodeName(); } my ($stdout, $exit_code) = centreon::plugins::misc::windows_execute(output => $self->{output}, timeout => $self->{option_results}->{timeout}, command => $netdom_cmd, command_path => undef, command_options => undef, no_quit => 1); $self->{output}->output_add(severity => 'OK', short_msg => 'Secure channel has been verified.'); if ($exit_code != 0) { $self->{output}->output_add(long_msg => $stdout); $self->{output}->output_add(severity => 'CRITICAL', short_msg => 'Secure channel had a problem (see additional info).'); } } sub run { my ($self, %options) = @_; $self->netdom(); $self->{output}->display(); $self->{output}->exit(); } 1; __END__ =head1 MODE Check the secure connection between a workstation and a domain controller (use 'netdom' command). =over 8 =item B<--workstation> Set the name of the workstation (Default: current hostname) =item B<--domain> Set the name of the domain (Default: current domain of the workstation) =item B<--timeout> Set timeout time for command execution (Default: 30 sec) =back =cut
Tpo76/centreon-plugins
apps/microsoft/activedirectory/local/mode/netdom.pm
Perl
apache-2.0
3,301
# # 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 storage::quantum::dxi::ssh::plugin; use strict; use warnings; use base qw(centreon::plugins::script_simple); sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '0.1'; %{$self->{modes}} = ( 'compaction' => 'storage::quantum::dxi::ssh::mode::compaction', 'dedupnas' => 'storage::quantum::dxi::ssh::mode::dedupnas', 'dedupvtl' => 'storage::quantum::dxi::ssh::mode::dedupvtl', 'disk-usage' => 'storage::quantum::dxi::ssh::mode::diskusage', 'health' => 'storage::quantum::dxi::ssh::mode::health', 'hostbus-adapter-status' => 'storage::quantum::dxi::ssh::mode::hostbusadapterstatus', 'memory' => 'storage::quantum::dxi::ssh::mode::memory', 'network' => 'storage::quantum::dxi::ssh::mode::network', 'reclamation' => 'storage::quantum::dxi::ssh::mode::reclamation', 'reduction' => 'storage::quantum::dxi::ssh::mode::reduction', 'storage-array-status' => 'storage::quantum::dxi::ssh::mode::storagearraystatus', 'system-status' => 'storage::quantum::dxi::ssh::mode::systemstatus', 'throughput' => 'storage::quantum::dxi::ssh::mode::throughput', ); return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check Quantum DXi series appliances through SSH commands. =cut
Sims24/centreon-plugins
storage/quantum/dxi/ssh/plugin.pm
Perl
apache-2.0
2,620
# # 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 apps::protocols::ospf::snmp::mode::neighbor; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use Digest::MD5 qw(md5_hex); use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); sub custom_status_output { my ($self, %options) = @_; my $msg = 'state : ' . $self->{result_values}->{NbrState}; return $msg; } sub custom_status_calc { my ($self, %options) = @_; $self->{result_values}->{NbrState} = $options{new_datas}->{$self->{instance} . '_NbrState'}; $self->{result_values}->{NbrIpAddr} = $options{new_datas}->{$self->{instance} . '_NbrIpAddr'}; $self->{result_values}->{NbrRtrId} = $options{new_datas}->{$self->{instance} . '_NbrRtrId'}; return 0; } sub custom_change_output { my ($self, %options) = @_; my $msg = 'Neighbors current : ' . $self->{result_values}->{Total} . ' (last : ' . $self->{result_values}->{TotalLast} . ')'; return $msg; } sub custom_change_calc { my ($self, %options) = @_; $self->{result_values}->{TotalLast} = $options{old_datas}->{$self->{instance} . '_total'}; $self->{result_values}->{Total} = $options{new_datas}->{$self->{instance} . '_total'}; return 0; } sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'global', type => 0, message_separator => ' - ' }, { name => 'nb', type => 1, cb_prefix_output => 'prefix_nb_output', message_multiple => 'All neighbor relations are ok' } ]; $self->{maps_counters}->{global} = [ { label => 'total', set => { key_values => [ { name => 'total' } ], output_template => 'Total neighbors : %s', perfdatas => [ { label => 'total', value => 'total_absolute', template => '%s', min => 0 }, ], } }, { label => 'total-change', threshold => 0, set => { key_values => [ { name => 'total', diff => 1 } ], closure_custom_calc => $self->can('custom_change_calc'), closure_custom_output => $self->can('custom_change_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold, } }, ]; $self->{maps_counters}->{nb} = [ { label => 'status', threshold => 0, set => { key_values => [ { name => 'NbrIpAddr' }, { name => 'NbrRtrId' }, { name => 'NbrState' } ], 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 => \&catalog_status_threshold, } }, ]; } sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; $options{options}->add_options(arguments => { "warning-status:s" => { name => 'warning_status', default => '' }, "critical-status:s" => { name => 'critical_status', default => '%{NbrState} =~ /down/i' }, "warning-total-change:s" => { name => 'warning_total_change', default => '' }, "critical-total-change:s" => { name => 'critical_total_change', default => '' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); $self->change_macros(macros => ['warning_status', 'critical_status', 'warning_total_change', 'critical_total_change']); } sub prefix_nb_output { my ($self, %options) = @_; return "Neighbor '" . $options{instance_value}->{NbrIpAddr} . "/" . $options{instance_value}->{NbrRtrId} . "' "; } my %map_state = ( 1 => 'down', 2 => 'attempt', 3 => 'init', 4 => 'twoWay', 5 => 'exchangeStart', 6 => 'exchange', 7 => 'loading', 8 => 'full', ); my $mapping = { NbrIpAddr => { oid => '.1.3.6.1.2.1.14.10.1.1' }, NbrRtrId => { oid => '.1.3.6.1.2.1.14.10.1.3' }, NbrState => { oid => '.1.3.6.1.2.1.14.10.1.6', map => \%map_state }, }; my $oid_ospfNbrEntry = '.1.3.6.1.2.1.14.10.1'; sub manage_selection { my ($self, %options) = @_; $self->{nb} = {}; $self->{global} = { total => 0 }; my $snmp_result = $options{snmp}->get_table(oid => $oid_ospfNbrEntry, nothing_quit => 1); foreach my $oid (keys %{$snmp_result}) { next if ($oid !~ /^$mapping->{NbrState}->{oid}\.(.*)$/); my $instance = $1; my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance); $self->{global}->{total}++; $self->{nb}->{$instance} = { %$result }; } if (scalar(keys %{$self->{nb}}) <= 0) { $self->{output}->add_option_msg(short_msg => "No neighbors found."); $self->{output}->option_exit(); } $self->{cache_name} = "ospf_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); } 1; __END__ =head1 MODE Check neighbor relations. =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. Can used special variables like: %{NbrState}, %{NbrRtrId}, %{NbrIpAddr} =item B<--critical-status> Set critical threshold for status (Default: '%{NbrState} =~ /down/i'). Can used special variables like: %{NbrState}, %{NbrRtrId}, %{NbrIpAddr} =item B<--warning-total-change> Set warning threshold. Should be used if there is a difference of total neighbors between two checks. Example: %{TotalLast} != %{Total} =item B<--critical-total-change> Set critical threshold. Should be used if there is a difference of total neighbors between two checks. Example: %{TotalLast} != %{Total} =item B<--warning-*> Threshold warning. Can be: 'total'. =item B<--critical-*> Threshold critical. Can be: 'total'. =back =cut
Sims24/centreon-plugins
apps/protocols/ospf/snmp/mode/neighbor.pm
Perl
apache-2.0
7,284
#!/usr/bin/perl -w # # Copyright 2017, Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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. # # This code example adds an AdWords conversion tracker and an upload conversion # tracker. use strict; use lib "../../../lib"; use utf8; use Google::Ads::AdWords::Client; use Google::Ads::AdWords::Logging; use Google::Ads::AdWords::v201809::AdWordsConversionTracker; use Google::Ads::AdWords::v201809::ConversionTrackerOperation; use Google::Ads::AdWords::v201809::UploadConversion; use Cwd qw(abs_path); use Data::Uniqid qw(uniqid); # Example main subroutine. sub add_conversion_trackers { my $client = shift; my @conversion_trackers = (); # Create AdWords conversion tracker. my $adwords_conversion_tracker = Google::Ads::AdWords::v201809::AdWordsConversionTracker->new({ name => "Earth to Mars Cruises Conversion #" . uniqid(), # Additional properties (non-required). status => "ENABLED", category => "DEFAULT", viewthroughLookbackWindow => 15, defaultRevenueValue => 23.41, alwaysUseDefaultRevenueValue => 1 }); push @conversion_trackers, $adwords_conversion_tracker; # Create an upload conversion for offline conversion imports. my $upload_conversion_tracker = Google::Ads::AdWords::v201809::UploadConversion->new({ # Set an appropriate category. This field is optional, and will be set to # DEFAULT if not mentioned. category => "LEAD", name => "Upload Conversion #" . uniqid(), viewthroughLookbackWindow => 30, ctcLookbackWindow => 90, # Optional: Set the default currency code to use for conversions # that do not specify a conversion currency. This must be an ISO 4217 # 3-character currency code such as "EUR" or "USD". # If this field is not set on this UploadConversion, AdWords will use # the account's currency. defaultRevenueCurrencyCode => "EUR", # Optional: Set the default revenue value to use for conversions # that do not specify a conversion value. Note that this value # should NOT be in micros. defaultRevenueValue => 2.50, # Optional: To upload fractional conversion credits, mark the upload conversion # as externally attributed. See # https://developers.google.com/adwords/api/docs/guides/conversion-tracking#importing_externally_attributed_conversions # to learn more about importing externally attributed conversions. # isExternallyAttributed => true }); push @conversion_trackers, $upload_conversion_tracker; my @operations = (); for my $conversion_tracker (@conversion_trackers) { # Create operation. my $conversion_operation = Google::Ads::AdWords::v201809::ConversionTrackerOperation->new({ operator => "ADD", operand => $conversion_tracker }); push @operations, $conversion_operation; } # Add conversion trackers. my $result = $client->ConversionTrackerService() ->mutate({operations => \@operations}); # Display conversion tracker. if ($result->get_value()) { foreach my $conversion_tracker (@{$result->get_value()}) { printf "Conversion tracker with ID %d, name \"%s\", status \"%s\" " . "and category \"%s\" was added.\n", $conversion_tracker->get_id(), $conversion_tracker->get_name(), $conversion_tracker->get_status(), $conversion_tracker->get_category(); if ($conversion_tracker ->isa("Google::Ads::AdWords::v201809::AdWordsConversionTracker")) { printf("Google global site tag:\n%s\n\n", $conversion_tracker->get_googleGlobalSiteTag()); printf("Google event snippet:\n%s\n\n", $conversion_tracker->get_googleEventSnippet()); } } } else { print "No conversion tracker was added."; } return 1; } # Don't run the example if the file is being included. if (abs_path($0) ne abs_path(__FILE__)) { return 1; } # Log SOAP XML request, response and API errors. Google::Ads::AdWords::Logging::enable_all_logging(); # Get AdWords Client, credentials will be read from ~/adwords.properties. my $client = Google::Ads::AdWords::Client->new({version => "v201809"}); # By default examples are set to die on any server returned fault. $client->set_die_on_faults(1); # Call the example add_conversion_trackers($client);
googleads/googleads-perl-lib
examples/v201809/remarketing/add_conversion_trackers.pl
Perl
apache-2.0
5,032
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package network::freebox::restapi::mode::system; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'global', type => 0 }, { name => 'wifi', type => 1, cb_prefix_output => 'prefix_wifi_output', message_multiple => 'All wifis are ok' } ]; $self->{maps_counters}->{global} = [ { label => 'temperature-cpum', set => { key_values => [ { name => 'temp_cpum' } ], output_template => 'Temperature cpum : %s C', perfdatas => [ { label => 'temp_cpum', value => 'temp_cpum', template => '%s', unit => 'C' } ] } }, { label => 'temperature-cpub', set => { key_values => [ { name => 'temp_cpub' } ], output_template => 'Temperature cpub : %s C', perfdatas => [ { label => 'temp_cpub', value => 'temp_cpub', template => '%s', unit => 'C' } ] } }, { label => 'temperature-switch', set => { key_values => [ { name => 'temp_sw' } ], output_template => 'Temperature switch : %s C', perfdatas => [ { label => 'temp_sw', value => 'temp_sw', template => '%s', unit => 'C' } ] } }, { label => 'fan-speed', set => { key_values => [ { name => 'fan_rpm' } ], output_template => 'fan speed : %s rpm', perfdatas => [ { label => 'fan_rpm', value => 'fan_rpm', template => '%s', min => 0, unit => 'rpm' } ] } }, { label => 'disk-status', threshold => 0, set => { key_values => [ { name => 'disk_status' } ], closure_custom_calc => $self->can('custom_disk_status_calc'), closure_custom_output => $self->can('custom_disk_status_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold } } ]; $self->{maps_counters}->{wifi} = [ { label => 'wifi-status', threshold => 0, set => { key_values => [ { name => 'wifi_status' }, { name => 'display' } ], closure_custom_calc => $self->can('custom_wifi_status_calc'), closure_custom_output => $self->can('custom_wifi_status_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold } } ]; } sub custom_disk_status_output { my ($self, %options) = @_; return 'Disk status : ' . $self->{result_values}->{status}; } sub custom_disk_status_calc { my ($self, %options) = @_; $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_disk_status'}; return 0; } sub custom_wifi_status_output { my ($self, %options) = @_; return "Wifi '" . $self->{result_values}->{display} . "' status : " . $self->{result_values}->{status}; } sub custom_wifi_status_calc { my ($self, %options) = @_; $self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'}; $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_wifi_status'}; return 0; } sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $options{options}->add_options(arguments => { 'warning-wifi-status:s' => { name => 'warning_wifi_status', default => '%{status} =~ /bad_param/i' }, 'critical-wifi-status:s' => { name => 'critical_wifi_status', default => '%{status} =~ /failed/i' }, 'warning-disk-status:s' => { name => 'warning_disk_status', default => '' }, 'critical-disk-status:s' => { name => 'critical_disk_status', default => '%{status} =~ /error/i' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); $self->change_macros( macros => [ 'warning_wifi_status', 'critical_wifi_status', 'warning_disk_status', 'critical_disk_status' ] ); } sub manage_selection { my ($self, %options) = @_; my $result = $options{custom}->get_data(path => 'system/'); $self->{global} = { %{$result} }; $result = $options{custom}->get_data(path => 'wifi/ap/'); $self->{wifi} = {}; $result = [$result] if (ref($result) ne 'ARRAY'); foreach (@$result) { $self->{wifi}->{$_->{id}} = { display => $_->{name}, wifi_status => $_->{status}->{state}, }; } } 1; __END__ =head1 MODE Check system. =over 8 =item B<--filter-counters> Only display some counters (regexp can be used). Example: --filter-counters='^temperature-cpum$' =item B<--warning-wifi-status> Set warning threshold for wifi status (Default: '%{status} =~ /bad_param/i'). Can used special variables like: %{status}, %{display} =item B<--critical-wifi-status> Set critical threshold for wifi status (Default: '%{status} =~ /failed/i'). Can used special variables like: %{status}, %{display} =item B<--warning-disk-status> Set warning threshold for disk status. Can used special variables like: %{status} =item B<--critical-disk-status> Set critical threshold for disk status (Default: '%{status} =~ /error/i'). Can used special variables like: %{status} =item B<--warning-*> B<--critical-*> Thresholds. Can be: 'temperature-cpum', 'temperature-cpub', 'temperature-switch', 'fan-speed'. =back =cut
centreon/centreon-plugins
network/freebox/restapi/mode/system.pm
Perl
apache-2.0
6,738
package Paws::StorageGateway::TapeInfo; use Moose; has GatewayARN => (is => 'ro', isa => 'Str'); has TapeARN => (is => 'ro', isa => 'Str'); has TapeBarcode => (is => 'ro', isa => 'Str'); has TapeSizeInBytes => (is => 'ro', isa => 'Int'); has TapeStatus => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::StorageGateway::TapeInfo =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::StorageGateway::TapeInfo object: $service_obj->Method(Att1 => { GatewayARN => $value, ..., TapeStatus => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::StorageGateway::TapeInfo object: $result = $service_obj->Method(...); $result->Att1->GatewayARN =head1 DESCRIPTION Describes a virtual tape. =head1 ATTRIBUTES =head2 GatewayARN => Str The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to return a list of gateways for your account and region. =head2 TapeARN => Str The Amazon Resource Name (ARN) of a virtual tape. =head2 TapeBarcode => Str The barcode that identifies a specific virtual tape. =head2 TapeSizeInBytes => Int The size, in bytes, of a virtual tape. =head2 TapeStatus => Str The status of the tape. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::StorageGateway> =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/StorageGateway/TapeInfo.pm
Perl
apache-2.0
1,867
#!/usr/bin/perl package CQS::CQSChromosomeTable; use strict; use warnings; use File::Basename; use CQS::PBS; use CQS::ConfigUtils; use CQS::SystemUtils; use CQS::FileUtils; use CQS::NGSCommon; use CQS::StringUtils; use CQS::UniqueTask; our @ISA = qw(CQS::UniqueTask); sub new { my ($class) = @_; my $self = $class->SUPER::new(); $self->{_name} = __PACKAGE__; $self->{_suffix} = "_ct"; bless $self, $class; return $self; } sub perform { my ( $self, $config, $section ) = @_; my ( $task_name, $path_file, $pbs_desc, $target_dir, $log_dir, $pbs_dir, $result_dir, $option, $sh_direct, $cluster ) = $self->init_parameter( $config, $section ); $self->{_task_prefix} = get_option( $config, $section, "prefix", "" ); $self->{_task_suffix} = get_option( $config, $section, "suffix", "" ); my %raw_files = %{ get_raw_files( $config, $section ) }; my $pbs_file = $self->get_pbs_filename( $pbs_dir, $task_name ); my $pbs_name = basename($pbs_file); my $log = $self->get_log_filename( $log_dir, $task_name ); my $log_desc = $cluster->get_log_description($log); if ( defined $config->{$section}{groups} || defined $config->{$section}{groups_ref} ) { my $pbs = $self->open_pbs( $pbs_file, $pbs_desc, $log_desc, $path_file, $result_dir ); my $groups = get_raw_files( $config, $section, "groups" ); for my $group_name ( sort keys %{$groups} ) { my @samples = @{ $groups->{$group_name} }; my $filelist = $self->get_file( $pbs_dir, "${task_name}_${group_name}", ".filelist", 0 ); my $outputfile = $self->get_file( $result_dir, "${task_name}_${group_name}", ".count", 0 ); my $outputname = basename($outputfile); open( FL, ">$filelist" ) or die "Cannot create $filelist"; for my $sample_name ( sort @samples ) { my @count_files = @{ $raw_files{$sample_name} }; my $countFile = $count_files[0]; print FL $sample_name, "\t", $countFile, "\n"; } close(FL); print $pbs " if [ ! -s $outputname ]; then cqstools chromosome_table $option -o $outputname -l $filelist fi "; } $self->close_pbs( $pbs, $pbs_file ); } else { my $filelist = $self->get_file( $pbs_dir, ${task_name}, ".filelist", 0 ); my $outputfile = $self->get_file( $result_dir, ${task_name}, ".count", 0 ); my $outputname = basename($outputfile); my $pbs = $self->open_pbs( $pbs_file, $pbs_desc, $log_desc, $path_file, $result_dir, $outputname ); open( FL, ">$filelist" ) or die "Cannot create $filelist"; for my $sample_name ( sort keys %raw_files ) { my @count_files = @{ $raw_files{$sample_name} }; my $countFile = $count_files[0]; print FL $sample_name, "\t", $countFile, "\n"; } close(FL); print $pbs " cqstools chromosome_table $option -o $outputname -l $filelist "; $self->close_pbs( $pbs, $pbs_file ); } } sub result { my ( $self, $config, $section, $pattern ) = @_; my ( $task_name, $path_file, $pbs_desc, $target_dir, $log_dir, $pbs_dir, $result_dir, $option, $sh_direct ) = $self->init_parameter( $config, $section, 0 ); $self->{_task_prefix} = get_option( $config, $section, "prefix", "" ); $self->{_task_suffix} = get_option( $config, $section, "suffix", "" ); my $result = {}; my $has_category = $option =~ /--categoryMapFile/; my $has_read_count = $option =~ /--outputReadTable/; my $has_contig = $option =~ /--outputReadContigTable/; my @result_files = (); if ( defined $config->{$section}{groups} || defined $config->{$section}{groups_ref} ) { my $groups = get_raw_files( $config, $section, "groups" ); for my $group_name ( sort keys %{$groups} ) { push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".count", 0 ) ); push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".count.xml", 0 ) ); if ($has_category) { push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".category.count", 0 ) ); } if ($has_read_count) { push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".read.count", 0 ) ); } if ($has_contig) { push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".contig.count", 0 ) ); push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".contig.count.details", 0 ) ); push( @result_files, $self->get_file( $result_dir, "${task_name}_${group_name}", ".contig.count.details.depth", 0 ) ); } push( @result_files, $self->get_file( $pbs_dir, "${task_name}_${group_name}", ".filelist", 0 ) ); } } else { push( @result_files, $self->get_file( $result_dir, $task_name, ".count", 0 ) ); push( @result_files, $self->get_file( $result_dir, $task_name, ".count.xml", 0 ) ); if ($has_category) { push( @result_files, $self->get_file( $result_dir, $task_name, ".category.count", 0 ) ); } if ($has_read_count) { push( @result_files, $self->get_file( $result_dir, $task_name, ".read.count", 0 ) ); } if ($has_contig) { push( @result_files, $self->get_file( $result_dir, $task_name, ".contig.count", 0 ) ); push( @result_files, $self->get_file( $result_dir, $task_name, ".contig.count.details", 0 ) ); push( @result_files, $self->get_file( $result_dir, $task_name, ".contig.count.details.depth", 0 ) ); } push( @result_files, $self->get_file( $pbs_dir, $task_name, ".filelist", 0 ) ); } $result->{$task_name} = filter_array( \@result_files, $pattern ); return $result; } 1;
shengqh/ngsperl
lib/CQS/CQSChromosomeTable.pm
Perl
apache-2.0
5,688
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2020] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =head1 AUTHOR Juguang Xiao <juguang@tll.org.sg> =cut =head1 NAME Bio::EnsEMBL::Utils::Converter::bio_ens_seqFeature =head1 SYNOPISIS Please read Bio::EnsEMBL::Utils::Converter =head1 DESCRIPTION =head1 METHODS =cut package Bio::EnsEMBL::Utils::Converter::bio_ens_seqFeature; use strict; use vars qw(@ISA); use Bio::EnsEMBL::SeqFeature; use Bio::EnsEMBL::SimpleFeature; use Bio::EnsEMBL::Exon; use Bio::EnsEMBL::Utils::Converter::bio_ens; @ISA = qw(Bio::EnsEMBL::Utils::Converter::bio_ens); sub _convert_single { my ($self, $in) = @_; unless($in && defined($in) && $in->isa('Bio::SeqFeature::Generic')){ $self->throw("a Bio::SeqFeature::Generic object needed"); } my $seqFeature = $in; my $seq_id = $seqFeature->seq_id; unless(defined($seq_id) && $seq_id){ $self->warn("No seq_id value. EnsEMBL SeqFeature will validate it"); $seq_id = 'Unknown'; } # Debated issue here. There are p_value and percent_id in EnsEMBL API and DB # schema, but not in bioperl. If in bioperl there are tags called p_value or # percent_id, then the values are passed, otherwise set the default 1. # # the problem arise when I try to converter the seqfeature for tmhmm to # EnsEMBL seqFeature. # -- Juguang, 11 July '03 my $score = $in->score || 0; my $percent_id; if($in->has_tag('percent_id')){ ($percent_id) = $in->get_tag_values('percent_id'); }else{ $percent_id ||= 0; } my $p_value; if($in->has_tag('p_value')){ ($p_value) = $in->get_tag_values('p_value'); }elsif($in->has_tag('evalue')){ ($p_value) = $in->get_tag_values('evalue'); }else{ $p_value ||= 1; } my $ens_seqFeature; my %args = ( -start => $in->start, -end => $in->end, -strand => $in->strand, -score => $score, -analysis => $self->analysis, -source_tag => $in->source_tag, -seqname => $seq_id, -percent_id => $percent_id, -p_value => $p_value ); my $output_module = $self->out; if($output_module eq 'Bio::EnsEMBL::SeqFeature'){ $ens_seqFeature = new Bio::EnsEMBL::SeqFeature(%args); }elsif($self->out eq 'Bio::EnsEMBL::SimpleFeature'){ $ens_seqFeature = new Bio::EnsEMBL::SimpleFeature(%args); # The field that there is in SimpleFeature, but not in SeqFeature. $ens_seqFeature->display_label('__NONE__'); }elsif($self->out eq 'Bio::EnsEMBL::Exon'){ $ens_seqFeature = Bio::EnsEMBL::Exon->new_fast( $self->contig, $seqFeature->start, $seqFeature->end, $seqFeature->strand); }elsif($self->out eq 'Bio::EnsEMBL::ProteinFeature'){ my $seq_id2 = $self->analysis->logic_name; unless(defined $self->translation_id){ $self->throw('translation_id unset, in ProteinFeature conversion'); } $args{'-seqname'} = $self->translation_id; $ens_seqFeature = Bio::EnsEMBL::ProteinFeature->new( -feature1 => Bio::EnsEMBL::SeqFeature->new(%args), -feature2 => Bio::EnsEMBL::SeqFeature->new( -start => 0, -end => 0, -seqname => $seq_id2 ) ); }else{ $self->throw("[$output_module] as -out, not supported"); } $ens_seqFeature->attach_seq($self->contig); return $ens_seqFeature; } 1;
james-monkeyshines/ensembl
modules/Bio/EnsEMBL/Utils/Converter/bio_ens_seqFeature.pm
Perl
apache-2.0
4,404
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % 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 27, 2012 % % Original Unicode file header comments follow /* # DerivedNormalizationProps-6.1.0.txt # Date: 2011-07-26, 04:18:07 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/ */ % ================================================ % Derived Property: FC_NFKC_Closure (DEPRECATED as of Unicode 6.0.0) % Generated from computing: b = NFKC(Fold(a)); c = NFKC(Fold(b)); % Then if (c != b) add the mapping from a to c to the set of % mappings that constitute the FC_NFKC_Closure list % Uses the full case folding from CaseFolding.txt, without the T option. unicode_fc_nfkc(0x037A, [0x0020, 0x03B9]). % Lm GREEK YPOGEGRAMMENI unicode_fc_nfkc(0x03D2, [0x03C5]). % L& GREEK UPSILON WITH HOOK SYMBOL unicode_fc_nfkc(0x03D3, [0x03CD]). % L& GREEK UPSILON WITH ACUTE AND HOOK SYMBOL unicode_fc_nfkc(0x03D4, [0x03CB]). % L& GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL unicode_fc_nfkc(0x03F2, [0x03C3]). % L& GREEK LUNATE SIGMA SYMBOL unicode_fc_nfkc(0x03F9, [0x03C3]). % L& GREEK CAPITAL LUNATE SIGMA SYMBOL unicode_fc_nfkc(0x1D2C, [0x0061]). % Lm MODIFIER LETTER CAPITAL A unicode_fc_nfkc(0x1D2D, [0x00E6]). % Lm MODIFIER LETTER CAPITAL AE unicode_fc_nfkc(0x1D2E, [0x0062]). % Lm MODIFIER LETTER CAPITAL B unicode_fc_nfkc(0x1D30, [0x0064]). % Lm MODIFIER LETTER CAPITAL D unicode_fc_nfkc(0x1D31, [0x0065]). % Lm MODIFIER LETTER CAPITAL E unicode_fc_nfkc(0x1D32, [0x01DD]). % Lm MODIFIER LETTER CAPITAL REVERSED E unicode_fc_nfkc(0x1D33, [0x0067]). % Lm MODIFIER LETTER CAPITAL G unicode_fc_nfkc(0x1D34, [0x0068]). % Lm MODIFIER LETTER CAPITAL H unicode_fc_nfkc(0x1D35, [0x0069]). % Lm MODIFIER LETTER CAPITAL I unicode_fc_nfkc(0x1D36, [0x006A]). % Lm MODIFIER LETTER CAPITAL J unicode_fc_nfkc(0x1D37, [0x006B]). % Lm MODIFIER LETTER CAPITAL K unicode_fc_nfkc(0x1D38, [0x006C]). % Lm MODIFIER LETTER CAPITAL L unicode_fc_nfkc(0x1D39, [0x006D]). % Lm MODIFIER LETTER CAPITAL M unicode_fc_nfkc(0x1D3A, [0x006E]). % Lm MODIFIER LETTER CAPITAL N unicode_fc_nfkc(0x1D3C, [0x006F]). % Lm MODIFIER LETTER CAPITAL O unicode_fc_nfkc(0x1D3D, [0x0223]). % Lm MODIFIER LETTER CAPITAL OU unicode_fc_nfkc(0x1D3E, [0x0070]). % Lm MODIFIER LETTER CAPITAL P unicode_fc_nfkc(0x1D3F, [0x0072]). % Lm MODIFIER LETTER CAPITAL R unicode_fc_nfkc(0x1D40, [0x0074]). % Lm MODIFIER LETTER CAPITAL T unicode_fc_nfkc(0x1D41, [0x0075]). % Lm MODIFIER LETTER CAPITAL U unicode_fc_nfkc(0x1D42, [0x0077]). % Lm MODIFIER LETTER CAPITAL W unicode_fc_nfkc(0x20A8, [0x0072, 0x0073]). % Sc RUPEE SIGN unicode_fc_nfkc(0x2102, [0x0063]). % L& DOUBLE-STRUCK CAPITAL C unicode_fc_nfkc(0x2103, [0x00B0, 0x0063]). % So DEGREE CELSIUS unicode_fc_nfkc(0x2107, [0x025B]). % L& EULER CONSTANT unicode_fc_nfkc(0x2109, [0x00B0, 0x0066]). % So DEGREE FAHRENHEIT unicode_fc_nfkc(0x210B, [0x0068]). % L& SCRIPT CAPITAL H unicode_fc_nfkc(0x210C, [0x0068]). % L& BLACK-LETTER CAPITAL H unicode_fc_nfkc(0x210D, [0x0068]). % L& DOUBLE-STRUCK CAPITAL H unicode_fc_nfkc(0x2110, [0x0069]). % L& SCRIPT CAPITAL I unicode_fc_nfkc(0x2111, [0x0069]). % L& BLACK-LETTER CAPITAL I unicode_fc_nfkc(0x2112, [0x006C]). % L& SCRIPT CAPITAL L unicode_fc_nfkc(0x2115, [0x006E]). % L& DOUBLE-STRUCK CAPITAL N unicode_fc_nfkc(0x2116, [0x006E, 0x006F]). % So NUMERO SIGN unicode_fc_nfkc(0x2119, [0x0070]). % L& DOUBLE-STRUCK CAPITAL P unicode_fc_nfkc(0x211A, [0x0071]). % L& DOUBLE-STRUCK CAPITAL Q unicode_fc_nfkc(0x211B, [0x0072]). % L& SCRIPT CAPITAL R unicode_fc_nfkc(0x211C, [0x0072]). % L& BLACK-LETTER CAPITAL R unicode_fc_nfkc(0x211D, [0x0072]). % L& DOUBLE-STRUCK CAPITAL R unicode_fc_nfkc(0x2120, [0x0073, 0x006D]). % So SERVICE MARK unicode_fc_nfkc(0x2121, [0x0074, 0x0065, 0x006C]). % So TELEPHONE SIGN unicode_fc_nfkc(0x2122, [0x0074, 0x006D]). % So TRADE MARK SIGN unicode_fc_nfkc(0x2124, [0x007A]). % L& DOUBLE-STRUCK CAPITAL Z unicode_fc_nfkc(0x2128, [0x007A]). % L& BLACK-LETTER CAPITAL Z unicode_fc_nfkc(0x212C, [0x0062]). % L& SCRIPT CAPITAL B unicode_fc_nfkc(0x212D, [0x0063]). % L& BLACK-LETTER CAPITAL C unicode_fc_nfkc(0x2130, [0x0065]). % L& SCRIPT CAPITAL E unicode_fc_nfkc(0x2131, [0x0066]). % L& SCRIPT CAPITAL F unicode_fc_nfkc(0x2133, [0x006D]). % L& SCRIPT CAPITAL M unicode_fc_nfkc(0x213B, [0x0066, 0x0061, 0x0078]). % So FACSIMILE SIGN unicode_fc_nfkc(0x213E, [0x03B3]). % L& DOUBLE-STRUCK CAPITAL GAMMA unicode_fc_nfkc(0x213F, [0x03C0]). % L& DOUBLE-STRUCK CAPITAL PI unicode_fc_nfkc(0x2145, [0x0064]). % L& DOUBLE-STRUCK ITALIC CAPITAL D unicode_fc_nfkc(0x2C7D, [0x0076]). % Lm MODIFIER LETTER CAPITAL V unicode_fc_nfkc(0x3250, [0x0070, 0x0074, 0x0065]). % So PARTNERSHIP SIGN unicode_fc_nfkc(0x32CC, [0x0068, 0x0067]). % So SQUARE HG unicode_fc_nfkc(0x32CE, [0x0065, 0x0076]). % So SQUARE EV unicode_fc_nfkc(0x32CF, [0x006C, 0x0074, 0x0064]). % So LIMITED LIABILITY SIGN unicode_fc_nfkc(0x3371, [0x0068, 0x0070, 0x0061]). % So SQUARE HPA unicode_fc_nfkc(0x3373, [0x0061, 0x0075]). % So SQUARE AU unicode_fc_nfkc(0x3375, [0x006F, 0x0076]). % So SQUARE OV unicode_fc_nfkc(0x337A, [0x0069, 0x0075]). % So SQUARE IU unicode_fc_nfkc(0x3380, [0x0070, 0x0061]). % So SQUARE PA AMPS unicode_fc_nfkc(0x3381, [0x006E, 0x0061]). % So SQUARE NA unicode_fc_nfkc(0x3382, [0x03BC, 0x0061]). % So SQUARE MU A unicode_fc_nfkc(0x3383, [0x006D, 0x0061]). % So SQUARE MA unicode_fc_nfkc(0x3384, [0x006B, 0x0061]). % So SQUARE KA unicode_fc_nfkc(0x3385, [0x006B, 0x0062]). % So SQUARE KB unicode_fc_nfkc(0x3386, [0x006D, 0x0062]). % So SQUARE MB unicode_fc_nfkc(0x3387, [0x0067, 0x0062]). % So SQUARE GB unicode_fc_nfkc(0x338A, [0x0070, 0x0066]). % So SQUARE PF unicode_fc_nfkc(0x338B, [0x006E, 0x0066]). % So SQUARE NF unicode_fc_nfkc(0x338C, [0x03BC, 0x0066]). % So SQUARE MU F unicode_fc_nfkc(0x3390, [0x0068, 0x007A]). % So SQUARE HZ unicode_fc_nfkc(0x3391, [0x006B, 0x0068, 0x007A]). % So SQUARE KHZ unicode_fc_nfkc(0x3392, [0x006D, 0x0068, 0x007A]). % So SQUARE MHZ unicode_fc_nfkc(0x3393, [0x0067, 0x0068, 0x007A]). % So SQUARE GHZ unicode_fc_nfkc(0x3394, [0x0074, 0x0068, 0x007A]). % So SQUARE THZ unicode_fc_nfkc(0x33A9, [0x0070, 0x0061]). % So SQUARE PA unicode_fc_nfkc(0x33AA, [0x006B, 0x0070, 0x0061]). % So SQUARE KPA unicode_fc_nfkc(0x33AB, [0x006D, 0x0070, 0x0061]). % So SQUARE MPA unicode_fc_nfkc(0x33AC, [0x0067, 0x0070, 0x0061]). % So SQUARE GPA unicode_fc_nfkc(0x33B4, [0x0070, 0x0076]). % So SQUARE PV unicode_fc_nfkc(0x33B5, [0x006E, 0x0076]). % So SQUARE NV unicode_fc_nfkc(0x33B6, [0x03BC, 0x0076]). % So SQUARE MU V unicode_fc_nfkc(0x33B7, [0x006D, 0x0076]). % So SQUARE MV unicode_fc_nfkc(0x33B8, [0x006B, 0x0076]). % So SQUARE KV unicode_fc_nfkc(0x33B9, [0x006D, 0x0076]). % So SQUARE MV MEGA unicode_fc_nfkc(0x33BA, [0x0070, 0x0077]). % So SQUARE PW unicode_fc_nfkc(0x33BB, [0x006E, 0x0077]). % So SQUARE NW unicode_fc_nfkc(0x33BC, [0x03BC, 0x0077]). % So SQUARE MU W unicode_fc_nfkc(0x33BD, [0x006D, 0x0077]). % So SQUARE MW unicode_fc_nfkc(0x33BE, [0x006B, 0x0077]). % So SQUARE KW unicode_fc_nfkc(0x33BF, [0x006D, 0x0077]). % So SQUARE MW MEGA unicode_fc_nfkc(0x33C0, [0x006B, 0x03C9]). % So SQUARE K OHM unicode_fc_nfkc(0x33C1, [0x006D, 0x03C9]). % So SQUARE M OHM unicode_fc_nfkc(0x33C3, [0x0062, 0x0071]). % So SQUARE BQ unicode_fc_nfkc(0x33C6, [0x0063, 0x2215, 0x006B, 0x0067]). % So SQUARE C OVER KG unicode_fc_nfkc(0x33C7, [0x0063, 0x006F, 0x002E]). % So SQUARE CO unicode_fc_nfkc(0x33C8, [0x0064, 0x0062]). % So SQUARE DB unicode_fc_nfkc(0x33C9, [0x0067, 0x0079]). % So SQUARE GY unicode_fc_nfkc(0x33CB, [0x0068, 0x0070]). % So SQUARE HP unicode_fc_nfkc(0x33CD, [0x006B, 0x006B]). % So SQUARE KK unicode_fc_nfkc(0x33CE, [0x006B, 0x006D]). % So SQUARE KM CAPITAL unicode_fc_nfkc(0x33D7, [0x0070, 0x0068]). % So SQUARE PH unicode_fc_nfkc(0x33D9, [0x0070, 0x0070, 0x006D]). % So SQUARE PPM unicode_fc_nfkc(0x33DA, [0x0070, 0x0072]). % So SQUARE PR unicode_fc_nfkc(0x33DC, [0x0073, 0x0076]). % So SQUARE SV unicode_fc_nfkc(0x33DD, [0x0077, 0x0062]). % So SQUARE WB unicode_fc_nfkc(0x33DE, [0x0076, 0x2215, 0x006D]). % So SQUARE V OVER M unicode_fc_nfkc(0x33DF, [0x0061, 0x2215, 0x006D]). % So SQUARE A OVER M unicode_fc_nfkc(0xA7F8, [0x0127]). % Lm MODIFIER LETTER CAPITAL H WITH STROKE unicode_fc_nfkc(0x1D400, [0x0061]). % L& MATHEMATICAL BOLD CAPITAL A unicode_fc_nfkc(0x1D401, [0x0062]). % L& MATHEMATICAL BOLD CAPITAL B unicode_fc_nfkc(0x1D402, [0x0063]). % L& MATHEMATICAL BOLD CAPITAL C unicode_fc_nfkc(0x1D403, [0x0064]). % L& MATHEMATICAL BOLD CAPITAL D unicode_fc_nfkc(0x1D404, [0x0065]). % L& MATHEMATICAL BOLD CAPITAL E unicode_fc_nfkc(0x1D405, [0x0066]). % L& MATHEMATICAL BOLD CAPITAL F unicode_fc_nfkc(0x1D406, [0x0067]). % L& MATHEMATICAL BOLD CAPITAL G unicode_fc_nfkc(0x1D407, [0x0068]). % L& MATHEMATICAL BOLD CAPITAL H unicode_fc_nfkc(0x1D408, [0x0069]). % L& MATHEMATICAL BOLD CAPITAL I unicode_fc_nfkc(0x1D409, [0x006A]). % L& MATHEMATICAL BOLD CAPITAL J unicode_fc_nfkc(0x1D40A, [0x006B]). % L& MATHEMATICAL BOLD CAPITAL K unicode_fc_nfkc(0x1D40B, [0x006C]). % L& MATHEMATICAL BOLD CAPITAL L unicode_fc_nfkc(0x1D40C, [0x006D]). % L& MATHEMATICAL BOLD CAPITAL M unicode_fc_nfkc(0x1D40D, [0x006E]). % L& MATHEMATICAL BOLD CAPITAL N unicode_fc_nfkc(0x1D40E, [0x006F]). % L& MATHEMATICAL BOLD CAPITAL O unicode_fc_nfkc(0x1D40F, [0x0070]). % L& MATHEMATICAL BOLD CAPITAL P unicode_fc_nfkc(0x1D410, [0x0071]). % L& MATHEMATICAL BOLD CAPITAL Q unicode_fc_nfkc(0x1D411, [0x0072]). % L& MATHEMATICAL BOLD CAPITAL R unicode_fc_nfkc(0x1D412, [0x0073]). % L& MATHEMATICAL BOLD CAPITAL S unicode_fc_nfkc(0x1D413, [0x0074]). % L& MATHEMATICAL BOLD CAPITAL T unicode_fc_nfkc(0x1D414, [0x0075]). % L& MATHEMATICAL BOLD CAPITAL U unicode_fc_nfkc(0x1D415, [0x0076]). % L& MATHEMATICAL BOLD CAPITAL V unicode_fc_nfkc(0x1D416, [0x0077]). % L& MATHEMATICAL BOLD CAPITAL W unicode_fc_nfkc(0x1D417, [0x0078]). % L& MATHEMATICAL BOLD CAPITAL X unicode_fc_nfkc(0x1D418, [0x0079]). % L& MATHEMATICAL BOLD CAPITAL Y unicode_fc_nfkc(0x1D419, [0x007A]). % L& MATHEMATICAL BOLD CAPITAL Z unicode_fc_nfkc(0x1D434, [0x0061]). % L& MATHEMATICAL ITALIC CAPITAL A unicode_fc_nfkc(0x1D435, [0x0062]). % L& MATHEMATICAL ITALIC CAPITAL B unicode_fc_nfkc(0x1D436, [0x0063]). % L& MATHEMATICAL ITALIC CAPITAL C unicode_fc_nfkc(0x1D437, [0x0064]). % L& MATHEMATICAL ITALIC CAPITAL D unicode_fc_nfkc(0x1D438, [0x0065]). % L& MATHEMATICAL ITALIC CAPITAL E unicode_fc_nfkc(0x1D439, [0x0066]). % L& MATHEMATICAL ITALIC CAPITAL F unicode_fc_nfkc(0x1D43A, [0x0067]). % L& MATHEMATICAL ITALIC CAPITAL G unicode_fc_nfkc(0x1D43B, [0x0068]). % L& MATHEMATICAL ITALIC CAPITAL H unicode_fc_nfkc(0x1D43C, [0x0069]). % L& MATHEMATICAL ITALIC CAPITAL I unicode_fc_nfkc(0x1D43D, [0x006A]). % L& MATHEMATICAL ITALIC CAPITAL J unicode_fc_nfkc(0x1D43E, [0x006B]). % L& MATHEMATICAL ITALIC CAPITAL K unicode_fc_nfkc(0x1D43F, [0x006C]). % L& MATHEMATICAL ITALIC CAPITAL L unicode_fc_nfkc(0x1D440, [0x006D]). % L& MATHEMATICAL ITALIC CAPITAL M unicode_fc_nfkc(0x1D441, [0x006E]). % L& MATHEMATICAL ITALIC CAPITAL N unicode_fc_nfkc(0x1D442, [0x006F]). % L& MATHEMATICAL ITALIC CAPITAL O unicode_fc_nfkc(0x1D443, [0x0070]). % L& MATHEMATICAL ITALIC CAPITAL P unicode_fc_nfkc(0x1D444, [0x0071]). % L& MATHEMATICAL ITALIC CAPITAL Q unicode_fc_nfkc(0x1D445, [0x0072]). % L& MATHEMATICAL ITALIC CAPITAL R unicode_fc_nfkc(0x1D446, [0x0073]). % L& MATHEMATICAL ITALIC CAPITAL S unicode_fc_nfkc(0x1D447, [0x0074]). % L& MATHEMATICAL ITALIC CAPITAL T unicode_fc_nfkc(0x1D448, [0x0075]). % L& MATHEMATICAL ITALIC CAPITAL U unicode_fc_nfkc(0x1D449, [0x0076]). % L& MATHEMATICAL ITALIC CAPITAL V unicode_fc_nfkc(0x1D44A, [0x0077]). % L& MATHEMATICAL ITALIC CAPITAL W unicode_fc_nfkc(0x1D44B, [0x0078]). % L& MATHEMATICAL ITALIC CAPITAL X unicode_fc_nfkc(0x1D44C, [0x0079]). % L& MATHEMATICAL ITALIC CAPITAL Y unicode_fc_nfkc(0x1D44D, [0x007A]). % L& MATHEMATICAL ITALIC CAPITAL Z unicode_fc_nfkc(0x1D468, [0x0061]). % L& MATHEMATICAL BOLD ITALIC CAPITAL A unicode_fc_nfkc(0x1D469, [0x0062]). % L& MATHEMATICAL BOLD ITALIC CAPITAL B unicode_fc_nfkc(0x1D46A, [0x0063]). % L& MATHEMATICAL BOLD ITALIC CAPITAL C unicode_fc_nfkc(0x1D46B, [0x0064]). % L& MATHEMATICAL BOLD ITALIC CAPITAL D unicode_fc_nfkc(0x1D46C, [0x0065]). % L& MATHEMATICAL BOLD ITALIC CAPITAL E unicode_fc_nfkc(0x1D46D, [0x0066]). % L& MATHEMATICAL BOLD ITALIC CAPITAL F unicode_fc_nfkc(0x1D46E, [0x0067]). % L& MATHEMATICAL BOLD ITALIC CAPITAL G unicode_fc_nfkc(0x1D46F, [0x0068]). % L& MATHEMATICAL BOLD ITALIC CAPITAL H unicode_fc_nfkc(0x1D470, [0x0069]). % L& MATHEMATICAL BOLD ITALIC CAPITAL I unicode_fc_nfkc(0x1D471, [0x006A]). % L& MATHEMATICAL BOLD ITALIC CAPITAL J unicode_fc_nfkc(0x1D472, [0x006B]). % L& MATHEMATICAL BOLD ITALIC CAPITAL K unicode_fc_nfkc(0x1D473, [0x006C]). % L& MATHEMATICAL BOLD ITALIC CAPITAL L unicode_fc_nfkc(0x1D474, [0x006D]). % L& MATHEMATICAL BOLD ITALIC CAPITAL M unicode_fc_nfkc(0x1D475, [0x006E]). % L& MATHEMATICAL BOLD ITALIC CAPITAL N unicode_fc_nfkc(0x1D476, [0x006F]). % L& MATHEMATICAL BOLD ITALIC CAPITAL O unicode_fc_nfkc(0x1D477, [0x0070]). % L& MATHEMATICAL BOLD ITALIC CAPITAL P unicode_fc_nfkc(0x1D478, [0x0071]). % L& MATHEMATICAL BOLD ITALIC CAPITAL Q unicode_fc_nfkc(0x1D479, [0x0072]). % L& MATHEMATICAL BOLD ITALIC CAPITAL R unicode_fc_nfkc(0x1D47A, [0x0073]). % L& MATHEMATICAL BOLD ITALIC CAPITAL S unicode_fc_nfkc(0x1D47B, [0x0074]). % L& MATHEMATICAL BOLD ITALIC CAPITAL T unicode_fc_nfkc(0x1D47C, [0x0075]). % L& MATHEMATICAL BOLD ITALIC CAPITAL U unicode_fc_nfkc(0x1D47D, [0x0076]). % L& MATHEMATICAL BOLD ITALIC CAPITAL V unicode_fc_nfkc(0x1D47E, [0x0077]). % L& MATHEMATICAL BOLD ITALIC CAPITAL W unicode_fc_nfkc(0x1D47F, [0x0078]). % L& MATHEMATICAL BOLD ITALIC CAPITAL X unicode_fc_nfkc(0x1D480, [0x0079]). % L& MATHEMATICAL BOLD ITALIC CAPITAL Y unicode_fc_nfkc(0x1D481, [0x007A]). % L& MATHEMATICAL BOLD ITALIC CAPITAL Z unicode_fc_nfkc(0x1D49C, [0x0061]). % L& MATHEMATICAL SCRIPT CAPITAL A unicode_fc_nfkc(0x1D49E, [0x0063]). % L& MATHEMATICAL SCRIPT CAPITAL C unicode_fc_nfkc(0x1D49F, [0x0064]). % L& MATHEMATICAL SCRIPT CAPITAL D unicode_fc_nfkc(0x1D4A2, [0x0067]). % L& MATHEMATICAL SCRIPT CAPITAL G unicode_fc_nfkc(0x1D4A5, [0x006A]). % L& MATHEMATICAL SCRIPT CAPITAL J unicode_fc_nfkc(0x1D4A6, [0x006B]). % L& MATHEMATICAL SCRIPT CAPITAL K unicode_fc_nfkc(0x1D4A9, [0x006E]). % L& MATHEMATICAL SCRIPT CAPITAL N unicode_fc_nfkc(0x1D4AA, [0x006F]). % L& MATHEMATICAL SCRIPT CAPITAL O unicode_fc_nfkc(0x1D4AB, [0x0070]). % L& MATHEMATICAL SCRIPT CAPITAL P unicode_fc_nfkc(0x1D4AC, [0x0071]). % L& MATHEMATICAL SCRIPT CAPITAL Q unicode_fc_nfkc(0x1D4AE, [0x0073]). % L& MATHEMATICAL SCRIPT CAPITAL S unicode_fc_nfkc(0x1D4AF, [0x0074]). % L& MATHEMATICAL SCRIPT CAPITAL T unicode_fc_nfkc(0x1D4B0, [0x0075]). % L& MATHEMATICAL SCRIPT CAPITAL U unicode_fc_nfkc(0x1D4B1, [0x0076]). % L& MATHEMATICAL SCRIPT CAPITAL V unicode_fc_nfkc(0x1D4B2, [0x0077]). % L& MATHEMATICAL SCRIPT CAPITAL W unicode_fc_nfkc(0x1D4B3, [0x0078]). % L& MATHEMATICAL SCRIPT CAPITAL X unicode_fc_nfkc(0x1D4B4, [0x0079]). % L& MATHEMATICAL SCRIPT CAPITAL Y unicode_fc_nfkc(0x1D4B5, [0x007A]). % L& MATHEMATICAL SCRIPT CAPITAL Z unicode_fc_nfkc(0x1D4D0, [0x0061]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL A unicode_fc_nfkc(0x1D4D1, [0x0062]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL B unicode_fc_nfkc(0x1D4D2, [0x0063]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL C unicode_fc_nfkc(0x1D4D3, [0x0064]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL D unicode_fc_nfkc(0x1D4D4, [0x0065]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL E unicode_fc_nfkc(0x1D4D5, [0x0066]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL F unicode_fc_nfkc(0x1D4D6, [0x0067]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL G unicode_fc_nfkc(0x1D4D7, [0x0068]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL H unicode_fc_nfkc(0x1D4D8, [0x0069]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL I unicode_fc_nfkc(0x1D4D9, [0x006A]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL J unicode_fc_nfkc(0x1D4DA, [0x006B]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL K unicode_fc_nfkc(0x1D4DB, [0x006C]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL L unicode_fc_nfkc(0x1D4DC, [0x006D]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL M unicode_fc_nfkc(0x1D4DD, [0x006E]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL N unicode_fc_nfkc(0x1D4DE, [0x006F]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL O unicode_fc_nfkc(0x1D4DF, [0x0070]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL P unicode_fc_nfkc(0x1D4E0, [0x0071]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL Q unicode_fc_nfkc(0x1D4E1, [0x0072]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL R unicode_fc_nfkc(0x1D4E2, [0x0073]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL S unicode_fc_nfkc(0x1D4E3, [0x0074]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL T unicode_fc_nfkc(0x1D4E4, [0x0075]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL U unicode_fc_nfkc(0x1D4E5, [0x0076]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL V unicode_fc_nfkc(0x1D4E6, [0x0077]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL W unicode_fc_nfkc(0x1D4E7, [0x0078]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL X unicode_fc_nfkc(0x1D4E8, [0x0079]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL Y unicode_fc_nfkc(0x1D4E9, [0x007A]). % L& MATHEMATICAL BOLD SCRIPT CAPITAL Z unicode_fc_nfkc(0x1D504, [0x0061]). % L& MATHEMATICAL FRAKTUR CAPITAL A unicode_fc_nfkc(0x1D505, [0x0062]). % L& MATHEMATICAL FRAKTUR CAPITAL B unicode_fc_nfkc(0x1D507, [0x0064]). % L& MATHEMATICAL FRAKTUR CAPITAL D unicode_fc_nfkc(0x1D508, [0x0065]). % L& MATHEMATICAL FRAKTUR CAPITAL E unicode_fc_nfkc(0x1D509, [0x0066]). % L& MATHEMATICAL FRAKTUR CAPITAL F unicode_fc_nfkc(0x1D50A, [0x0067]). % L& MATHEMATICAL FRAKTUR CAPITAL G unicode_fc_nfkc(0x1D50D, [0x006A]). % L& MATHEMATICAL FRAKTUR CAPITAL J unicode_fc_nfkc(0x1D50E, [0x006B]). % L& MATHEMATICAL FRAKTUR CAPITAL K unicode_fc_nfkc(0x1D50F, [0x006C]). % L& MATHEMATICAL FRAKTUR CAPITAL L unicode_fc_nfkc(0x1D510, [0x006D]). % L& MATHEMATICAL FRAKTUR CAPITAL M unicode_fc_nfkc(0x1D511, [0x006E]). % L& MATHEMATICAL FRAKTUR CAPITAL N unicode_fc_nfkc(0x1D512, [0x006F]). % L& MATHEMATICAL FRAKTUR CAPITAL O unicode_fc_nfkc(0x1D513, [0x0070]). % L& MATHEMATICAL FRAKTUR CAPITAL P unicode_fc_nfkc(0x1D514, [0x0071]). % L& MATHEMATICAL FRAKTUR CAPITAL Q unicode_fc_nfkc(0x1D516, [0x0073]). % L& MATHEMATICAL FRAKTUR CAPITAL S unicode_fc_nfkc(0x1D517, [0x0074]). % L& MATHEMATICAL FRAKTUR CAPITAL T unicode_fc_nfkc(0x1D518, [0x0075]). % L& MATHEMATICAL FRAKTUR CAPITAL U unicode_fc_nfkc(0x1D519, [0x0076]). % L& MATHEMATICAL FRAKTUR CAPITAL V unicode_fc_nfkc(0x1D51A, [0x0077]). % L& MATHEMATICAL FRAKTUR CAPITAL W unicode_fc_nfkc(0x1D51B, [0x0078]). % L& MATHEMATICAL FRAKTUR CAPITAL X unicode_fc_nfkc(0x1D51C, [0x0079]). % L& MATHEMATICAL FRAKTUR CAPITAL Y unicode_fc_nfkc(0x1D538, [0x0061]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL A unicode_fc_nfkc(0x1D539, [0x0062]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL B unicode_fc_nfkc(0x1D53B, [0x0064]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL D unicode_fc_nfkc(0x1D53C, [0x0065]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL E unicode_fc_nfkc(0x1D53D, [0x0066]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL F unicode_fc_nfkc(0x1D53E, [0x0067]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL G unicode_fc_nfkc(0x1D540, [0x0069]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL I unicode_fc_nfkc(0x1D541, [0x006A]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL J unicode_fc_nfkc(0x1D542, [0x006B]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL K unicode_fc_nfkc(0x1D543, [0x006C]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL L unicode_fc_nfkc(0x1D544, [0x006D]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL M unicode_fc_nfkc(0x1D546, [0x006F]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL O unicode_fc_nfkc(0x1D54A, [0x0073]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL S unicode_fc_nfkc(0x1D54B, [0x0074]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL T unicode_fc_nfkc(0x1D54C, [0x0075]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL U unicode_fc_nfkc(0x1D54D, [0x0076]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL V unicode_fc_nfkc(0x1D54E, [0x0077]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL W unicode_fc_nfkc(0x1D54F, [0x0078]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL X unicode_fc_nfkc(0x1D550, [0x0079]). % L& MATHEMATICAL DOUBLE-STRUCK CAPITAL Y unicode_fc_nfkc(0x1D56C, [0x0061]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL A unicode_fc_nfkc(0x1D56D, [0x0062]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL B unicode_fc_nfkc(0x1D56E, [0x0063]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL C unicode_fc_nfkc(0x1D56F, [0x0064]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL D unicode_fc_nfkc(0x1D570, [0x0065]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL E unicode_fc_nfkc(0x1D571, [0x0066]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL F unicode_fc_nfkc(0x1D572, [0x0067]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL G unicode_fc_nfkc(0x1D573, [0x0068]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL H unicode_fc_nfkc(0x1D574, [0x0069]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL I unicode_fc_nfkc(0x1D575, [0x006A]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL J unicode_fc_nfkc(0x1D576, [0x006B]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL K unicode_fc_nfkc(0x1D577, [0x006C]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL L unicode_fc_nfkc(0x1D578, [0x006D]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL M unicode_fc_nfkc(0x1D579, [0x006E]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL N unicode_fc_nfkc(0x1D57A, [0x006F]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL O unicode_fc_nfkc(0x1D57B, [0x0070]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL P unicode_fc_nfkc(0x1D57C, [0x0071]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL Q unicode_fc_nfkc(0x1D57D, [0x0072]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL R unicode_fc_nfkc(0x1D57E, [0x0073]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL S unicode_fc_nfkc(0x1D57F, [0x0074]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL T unicode_fc_nfkc(0x1D580, [0x0075]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL U unicode_fc_nfkc(0x1D581, [0x0076]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL V unicode_fc_nfkc(0x1D582, [0x0077]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL W unicode_fc_nfkc(0x1D583, [0x0078]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL X unicode_fc_nfkc(0x1D584, [0x0079]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL Y unicode_fc_nfkc(0x1D585, [0x007A]). % L& MATHEMATICAL BOLD FRAKTUR CAPITAL Z unicode_fc_nfkc(0x1D5A0, [0x0061]). % L& MATHEMATICAL SANS-SERIF CAPITAL A unicode_fc_nfkc(0x1D5A1, [0x0062]). % L& MATHEMATICAL SANS-SERIF CAPITAL B unicode_fc_nfkc(0x1D5A2, [0x0063]). % L& MATHEMATICAL SANS-SERIF CAPITAL C unicode_fc_nfkc(0x1D5A3, [0x0064]). % L& MATHEMATICAL SANS-SERIF CAPITAL D unicode_fc_nfkc(0x1D5A4, [0x0065]). % L& MATHEMATICAL SANS-SERIF CAPITAL E unicode_fc_nfkc(0x1D5A5, [0x0066]). % L& MATHEMATICAL SANS-SERIF CAPITAL F unicode_fc_nfkc(0x1D5A6, [0x0067]). % L& MATHEMATICAL SANS-SERIF CAPITAL G unicode_fc_nfkc(0x1D5A7, [0x0068]). % L& MATHEMATICAL SANS-SERIF CAPITAL H unicode_fc_nfkc(0x1D5A8, [0x0069]). % L& MATHEMATICAL SANS-SERIF CAPITAL I unicode_fc_nfkc(0x1D5A9, [0x006A]). % L& MATHEMATICAL SANS-SERIF CAPITAL J unicode_fc_nfkc(0x1D5AA, [0x006B]). % L& MATHEMATICAL SANS-SERIF CAPITAL K unicode_fc_nfkc(0x1D5AB, [0x006C]). % L& MATHEMATICAL SANS-SERIF CAPITAL L unicode_fc_nfkc(0x1D5AC, [0x006D]). % L& MATHEMATICAL SANS-SERIF CAPITAL M unicode_fc_nfkc(0x1D5AD, [0x006E]). % L& MATHEMATICAL SANS-SERIF CAPITAL N unicode_fc_nfkc(0x1D5AE, [0x006F]). % L& MATHEMATICAL SANS-SERIF CAPITAL O unicode_fc_nfkc(0x1D5AF, [0x0070]). % L& MATHEMATICAL SANS-SERIF CAPITAL P unicode_fc_nfkc(0x1D5B0, [0x0071]). % L& MATHEMATICAL SANS-SERIF CAPITAL Q unicode_fc_nfkc(0x1D5B1, [0x0072]). % L& MATHEMATICAL SANS-SERIF CAPITAL R unicode_fc_nfkc(0x1D5B2, [0x0073]). % L& MATHEMATICAL SANS-SERIF CAPITAL S unicode_fc_nfkc(0x1D5B3, [0x0074]). % L& MATHEMATICAL SANS-SERIF CAPITAL T unicode_fc_nfkc(0x1D5B4, [0x0075]). % L& MATHEMATICAL SANS-SERIF CAPITAL U unicode_fc_nfkc(0x1D5B5, [0x0076]). % L& MATHEMATICAL SANS-SERIF CAPITAL V unicode_fc_nfkc(0x1D5B6, [0x0077]). % L& MATHEMATICAL SANS-SERIF CAPITAL W unicode_fc_nfkc(0x1D5B7, [0x0078]). % L& MATHEMATICAL SANS-SERIF CAPITAL X unicode_fc_nfkc(0x1D5B8, [0x0079]). % L& MATHEMATICAL SANS-SERIF CAPITAL Y unicode_fc_nfkc(0x1D5B9, [0x007A]). % L& MATHEMATICAL SANS-SERIF CAPITAL Z unicode_fc_nfkc(0x1D5D4, [0x0061]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL A unicode_fc_nfkc(0x1D5D5, [0x0062]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL B unicode_fc_nfkc(0x1D5D6, [0x0063]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL C unicode_fc_nfkc(0x1D5D7, [0x0064]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL D unicode_fc_nfkc(0x1D5D8, [0x0065]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL E unicode_fc_nfkc(0x1D5D9, [0x0066]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL F unicode_fc_nfkc(0x1D5DA, [0x0067]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL G unicode_fc_nfkc(0x1D5DB, [0x0068]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL H unicode_fc_nfkc(0x1D5DC, [0x0069]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL I unicode_fc_nfkc(0x1D5DD, [0x006A]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL J unicode_fc_nfkc(0x1D5DE, [0x006B]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL K unicode_fc_nfkc(0x1D5DF, [0x006C]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL L unicode_fc_nfkc(0x1D5E0, [0x006D]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL M unicode_fc_nfkc(0x1D5E1, [0x006E]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL N unicode_fc_nfkc(0x1D5E2, [0x006F]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL O unicode_fc_nfkc(0x1D5E3, [0x0070]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL P unicode_fc_nfkc(0x1D5E4, [0x0071]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL Q unicode_fc_nfkc(0x1D5E5, [0x0072]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL R unicode_fc_nfkc(0x1D5E6, [0x0073]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL S unicode_fc_nfkc(0x1D5E7, [0x0074]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL T unicode_fc_nfkc(0x1D5E8, [0x0075]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL U unicode_fc_nfkc(0x1D5E9, [0x0076]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL V unicode_fc_nfkc(0x1D5EA, [0x0077]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL W unicode_fc_nfkc(0x1D5EB, [0x0078]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL X unicode_fc_nfkc(0x1D5EC, [0x0079]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL Y unicode_fc_nfkc(0x1D5ED, [0x007A]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL Z unicode_fc_nfkc(0x1D608, [0x0061]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL A unicode_fc_nfkc(0x1D609, [0x0062]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL B unicode_fc_nfkc(0x1D60A, [0x0063]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL C unicode_fc_nfkc(0x1D60B, [0x0064]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL D unicode_fc_nfkc(0x1D60C, [0x0065]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL E unicode_fc_nfkc(0x1D60D, [0x0066]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL F unicode_fc_nfkc(0x1D60E, [0x0067]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL G unicode_fc_nfkc(0x1D60F, [0x0068]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL H unicode_fc_nfkc(0x1D610, [0x0069]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL I unicode_fc_nfkc(0x1D611, [0x006A]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL J unicode_fc_nfkc(0x1D612, [0x006B]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL K unicode_fc_nfkc(0x1D613, [0x006C]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL L unicode_fc_nfkc(0x1D614, [0x006D]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL M unicode_fc_nfkc(0x1D615, [0x006E]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL N unicode_fc_nfkc(0x1D616, [0x006F]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL O unicode_fc_nfkc(0x1D617, [0x0070]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL P unicode_fc_nfkc(0x1D618, [0x0071]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL Q unicode_fc_nfkc(0x1D619, [0x0072]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL R unicode_fc_nfkc(0x1D61A, [0x0073]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL S unicode_fc_nfkc(0x1D61B, [0x0074]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL T unicode_fc_nfkc(0x1D61C, [0x0075]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL U unicode_fc_nfkc(0x1D61D, [0x0076]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL V unicode_fc_nfkc(0x1D61E, [0x0077]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL W unicode_fc_nfkc(0x1D61F, [0x0078]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL X unicode_fc_nfkc(0x1D620, [0x0079]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL Y unicode_fc_nfkc(0x1D621, [0x007A]). % L& MATHEMATICAL SANS-SERIF ITALIC CAPITAL Z unicode_fc_nfkc(0x1D63C, [0x0061]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL A unicode_fc_nfkc(0x1D63D, [0x0062]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL B unicode_fc_nfkc(0x1D63E, [0x0063]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL C unicode_fc_nfkc(0x1D63F, [0x0064]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL D unicode_fc_nfkc(0x1D640, [0x0065]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL E unicode_fc_nfkc(0x1D641, [0x0066]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL F unicode_fc_nfkc(0x1D642, [0x0067]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL G unicode_fc_nfkc(0x1D643, [0x0068]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL H unicode_fc_nfkc(0x1D644, [0x0069]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL I unicode_fc_nfkc(0x1D645, [0x006A]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL J unicode_fc_nfkc(0x1D646, [0x006B]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL K unicode_fc_nfkc(0x1D647, [0x006C]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL L unicode_fc_nfkc(0x1D648, [0x006D]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL M unicode_fc_nfkc(0x1D649, [0x006E]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL N unicode_fc_nfkc(0x1D64A, [0x006F]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL O unicode_fc_nfkc(0x1D64B, [0x0070]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL P unicode_fc_nfkc(0x1D64C, [0x0071]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Q unicode_fc_nfkc(0x1D64D, [0x0072]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL R unicode_fc_nfkc(0x1D64E, [0x0073]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL S unicode_fc_nfkc(0x1D64F, [0x0074]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL T unicode_fc_nfkc(0x1D650, [0x0075]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL U unicode_fc_nfkc(0x1D651, [0x0076]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL V unicode_fc_nfkc(0x1D652, [0x0077]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL W unicode_fc_nfkc(0x1D653, [0x0078]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL X unicode_fc_nfkc(0x1D654, [0x0079]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Y unicode_fc_nfkc(0x1D655, [0x007A]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Z unicode_fc_nfkc(0x1D670, [0x0061]). % L& MATHEMATICAL MONOSPACE CAPITAL A unicode_fc_nfkc(0x1D671, [0x0062]). % L& MATHEMATICAL MONOSPACE CAPITAL B unicode_fc_nfkc(0x1D672, [0x0063]). % L& MATHEMATICAL MONOSPACE CAPITAL C unicode_fc_nfkc(0x1D673, [0x0064]). % L& MATHEMATICAL MONOSPACE CAPITAL D unicode_fc_nfkc(0x1D674, [0x0065]). % L& MATHEMATICAL MONOSPACE CAPITAL E unicode_fc_nfkc(0x1D675, [0x0066]). % L& MATHEMATICAL MONOSPACE CAPITAL F unicode_fc_nfkc(0x1D676, [0x0067]). % L& MATHEMATICAL MONOSPACE CAPITAL G unicode_fc_nfkc(0x1D677, [0x0068]). % L& MATHEMATICAL MONOSPACE CAPITAL H unicode_fc_nfkc(0x1D678, [0x0069]). % L& MATHEMATICAL MONOSPACE CAPITAL I unicode_fc_nfkc(0x1D679, [0x006A]). % L& MATHEMATICAL MONOSPACE CAPITAL J unicode_fc_nfkc(0x1D67A, [0x006B]). % L& MATHEMATICAL MONOSPACE CAPITAL K unicode_fc_nfkc(0x1D67B, [0x006C]). % L& MATHEMATICAL MONOSPACE CAPITAL L unicode_fc_nfkc(0x1D67C, [0x006D]). % L& MATHEMATICAL MONOSPACE CAPITAL M unicode_fc_nfkc(0x1D67D, [0x006E]). % L& MATHEMATICAL MONOSPACE CAPITAL N unicode_fc_nfkc(0x1D67E, [0x006F]). % L& MATHEMATICAL MONOSPACE CAPITAL O unicode_fc_nfkc(0x1D67F, [0x0070]). % L& MATHEMATICAL MONOSPACE CAPITAL P unicode_fc_nfkc(0x1D680, [0x0071]). % L& MATHEMATICAL MONOSPACE CAPITAL Q unicode_fc_nfkc(0x1D681, [0x0072]). % L& MATHEMATICAL MONOSPACE CAPITAL R unicode_fc_nfkc(0x1D682, [0x0073]). % L& MATHEMATICAL MONOSPACE CAPITAL S unicode_fc_nfkc(0x1D683, [0x0074]). % L& MATHEMATICAL MONOSPACE CAPITAL T unicode_fc_nfkc(0x1D684, [0x0075]). % L& MATHEMATICAL MONOSPACE CAPITAL U unicode_fc_nfkc(0x1D685, [0x0076]). % L& MATHEMATICAL MONOSPACE CAPITAL V unicode_fc_nfkc(0x1D686, [0x0077]). % L& MATHEMATICAL MONOSPACE CAPITAL W unicode_fc_nfkc(0x1D687, [0x0078]). % L& MATHEMATICAL MONOSPACE CAPITAL X unicode_fc_nfkc(0x1D688, [0x0079]). % L& MATHEMATICAL MONOSPACE CAPITAL Y unicode_fc_nfkc(0x1D689, [0x007A]). % L& MATHEMATICAL MONOSPACE CAPITAL Z unicode_fc_nfkc(0x1D6A8, [0x03B1]). % L& MATHEMATICAL BOLD CAPITAL ALPHA unicode_fc_nfkc(0x1D6A9, [0x03B2]). % L& MATHEMATICAL BOLD CAPITAL BETA unicode_fc_nfkc(0x1D6AA, [0x03B3]). % L& MATHEMATICAL BOLD CAPITAL GAMMA unicode_fc_nfkc(0x1D6AB, [0x03B4]). % L& MATHEMATICAL BOLD CAPITAL DELTA unicode_fc_nfkc(0x1D6AC, [0x03B5]). % L& MATHEMATICAL BOLD CAPITAL EPSILON unicode_fc_nfkc(0x1D6AD, [0x03B6]). % L& MATHEMATICAL BOLD CAPITAL ZETA unicode_fc_nfkc(0x1D6AE, [0x03B7]). % L& MATHEMATICAL BOLD CAPITAL ETA unicode_fc_nfkc(0x1D6AF, [0x03B8]). % L& MATHEMATICAL BOLD CAPITAL THETA unicode_fc_nfkc(0x1D6B0, [0x03B9]). % L& MATHEMATICAL BOLD CAPITAL IOTA unicode_fc_nfkc(0x1D6B1, [0x03BA]). % L& MATHEMATICAL BOLD CAPITAL KAPPA unicode_fc_nfkc(0x1D6B2, [0x03BB]). % L& MATHEMATICAL BOLD CAPITAL LAMDA unicode_fc_nfkc(0x1D6B3, [0x03BC]). % L& MATHEMATICAL BOLD CAPITAL MU unicode_fc_nfkc(0x1D6B4, [0x03BD]). % L& MATHEMATICAL BOLD CAPITAL NU unicode_fc_nfkc(0x1D6B5, [0x03BE]). % L& MATHEMATICAL BOLD CAPITAL XI unicode_fc_nfkc(0x1D6B6, [0x03BF]). % L& MATHEMATICAL BOLD CAPITAL OMICRON unicode_fc_nfkc(0x1D6B7, [0x03C0]). % L& MATHEMATICAL BOLD CAPITAL PI unicode_fc_nfkc(0x1D6B8, [0x03C1]). % L& MATHEMATICAL BOLD CAPITAL RHO unicode_fc_nfkc(0x1D6B9, [0x03B8]). % L& MATHEMATICAL BOLD CAPITAL THETA SYMBOL unicode_fc_nfkc(0x1D6BA, [0x03C3]). % L& MATHEMATICAL BOLD CAPITAL SIGMA unicode_fc_nfkc(0x1D6BB, [0x03C4]). % L& MATHEMATICAL BOLD CAPITAL TAU unicode_fc_nfkc(0x1D6BC, [0x03C5]). % L& MATHEMATICAL BOLD CAPITAL UPSILON unicode_fc_nfkc(0x1D6BD, [0x03C6]). % L& MATHEMATICAL BOLD CAPITAL PHI unicode_fc_nfkc(0x1D6BE, [0x03C7]). % L& MATHEMATICAL BOLD CAPITAL CHI unicode_fc_nfkc(0x1D6BF, [0x03C8]). % L& MATHEMATICAL BOLD CAPITAL PSI unicode_fc_nfkc(0x1D6C0, [0x03C9]). % L& MATHEMATICAL BOLD CAPITAL OMEGA unicode_fc_nfkc(0x1D6D3, [0x03C3]). % L& MATHEMATICAL BOLD SMALL FINAL SIGMA unicode_fc_nfkc(0x1D6E2, [0x03B1]). % L& MATHEMATICAL ITALIC CAPITAL ALPHA unicode_fc_nfkc(0x1D6E3, [0x03B2]). % L& MATHEMATICAL ITALIC CAPITAL BETA unicode_fc_nfkc(0x1D6E4, [0x03B3]). % L& MATHEMATICAL ITALIC CAPITAL GAMMA unicode_fc_nfkc(0x1D6E5, [0x03B4]). % L& MATHEMATICAL ITALIC CAPITAL DELTA unicode_fc_nfkc(0x1D6E6, [0x03B5]). % L& MATHEMATICAL ITALIC CAPITAL EPSILON unicode_fc_nfkc(0x1D6E7, [0x03B6]). % L& MATHEMATICAL ITALIC CAPITAL ZETA unicode_fc_nfkc(0x1D6E8, [0x03B7]). % L& MATHEMATICAL ITALIC CAPITAL ETA unicode_fc_nfkc(0x1D6E9, [0x03B8]). % L& MATHEMATICAL ITALIC CAPITAL THETA unicode_fc_nfkc(0x1D6EA, [0x03B9]). % L& MATHEMATICAL ITALIC CAPITAL IOTA unicode_fc_nfkc(0x1D6EB, [0x03BA]). % L& MATHEMATICAL ITALIC CAPITAL KAPPA unicode_fc_nfkc(0x1D6EC, [0x03BB]). % L& MATHEMATICAL ITALIC CAPITAL LAMDA unicode_fc_nfkc(0x1D6ED, [0x03BC]). % L& MATHEMATICAL ITALIC CAPITAL MU unicode_fc_nfkc(0x1D6EE, [0x03BD]). % L& MATHEMATICAL ITALIC CAPITAL NU unicode_fc_nfkc(0x1D6EF, [0x03BE]). % L& MATHEMATICAL ITALIC CAPITAL XI unicode_fc_nfkc(0x1D6F0, [0x03BF]). % L& MATHEMATICAL ITALIC CAPITAL OMICRON unicode_fc_nfkc(0x1D6F1, [0x03C0]). % L& MATHEMATICAL ITALIC CAPITAL PI unicode_fc_nfkc(0x1D6F2, [0x03C1]). % L& MATHEMATICAL ITALIC CAPITAL RHO unicode_fc_nfkc(0x1D6F3, [0x03B8]). % L& MATHEMATICAL ITALIC CAPITAL THETA SYMBOL unicode_fc_nfkc(0x1D6F4, [0x03C3]). % L& MATHEMATICAL ITALIC CAPITAL SIGMA unicode_fc_nfkc(0x1D6F5, [0x03C4]). % L& MATHEMATICAL ITALIC CAPITAL TAU unicode_fc_nfkc(0x1D6F6, [0x03C5]). % L& MATHEMATICAL ITALIC CAPITAL UPSILON unicode_fc_nfkc(0x1D6F7, [0x03C6]). % L& MATHEMATICAL ITALIC CAPITAL PHI unicode_fc_nfkc(0x1D6F8, [0x03C7]). % L& MATHEMATICAL ITALIC CAPITAL CHI unicode_fc_nfkc(0x1D6F9, [0x03C8]). % L& MATHEMATICAL ITALIC CAPITAL PSI unicode_fc_nfkc(0x1D6FA, [0x03C9]). % L& MATHEMATICAL ITALIC CAPITAL OMEGA unicode_fc_nfkc(0x1D70D, [0x03C3]). % L& MATHEMATICAL ITALIC SMALL FINAL SIGMA unicode_fc_nfkc(0x1D71C, [0x03B1]). % L& MATHEMATICAL BOLD ITALIC CAPITAL ALPHA unicode_fc_nfkc(0x1D71D, [0x03B2]). % L& MATHEMATICAL BOLD ITALIC CAPITAL BETA unicode_fc_nfkc(0x1D71E, [0x03B3]). % L& MATHEMATICAL BOLD ITALIC CAPITAL GAMMA unicode_fc_nfkc(0x1D71F, [0x03B4]). % L& MATHEMATICAL BOLD ITALIC CAPITAL DELTA unicode_fc_nfkc(0x1D720, [0x03B5]). % L& MATHEMATICAL BOLD ITALIC CAPITAL EPSILON unicode_fc_nfkc(0x1D721, [0x03B6]). % L& MATHEMATICAL BOLD ITALIC CAPITAL ZETA unicode_fc_nfkc(0x1D722, [0x03B7]). % L& MATHEMATICAL BOLD ITALIC CAPITAL ETA unicode_fc_nfkc(0x1D723, [0x03B8]). % L& MATHEMATICAL BOLD ITALIC CAPITAL THETA unicode_fc_nfkc(0x1D724, [0x03B9]). % L& MATHEMATICAL BOLD ITALIC CAPITAL IOTA unicode_fc_nfkc(0x1D725, [0x03BA]). % L& MATHEMATICAL BOLD ITALIC CAPITAL KAPPA unicode_fc_nfkc(0x1D726, [0x03BB]). % L& MATHEMATICAL BOLD ITALIC CAPITAL LAMDA unicode_fc_nfkc(0x1D727, [0x03BC]). % L& MATHEMATICAL BOLD ITALIC CAPITAL MU unicode_fc_nfkc(0x1D728, [0x03BD]). % L& MATHEMATICAL BOLD ITALIC CAPITAL NU unicode_fc_nfkc(0x1D729, [0x03BE]). % L& MATHEMATICAL BOLD ITALIC CAPITAL XI unicode_fc_nfkc(0x1D72A, [0x03BF]). % L& MATHEMATICAL BOLD ITALIC CAPITAL OMICRON unicode_fc_nfkc(0x1D72B, [0x03C0]). % L& MATHEMATICAL BOLD ITALIC CAPITAL PI unicode_fc_nfkc(0x1D72C, [0x03C1]). % L& MATHEMATICAL BOLD ITALIC CAPITAL RHO unicode_fc_nfkc(0x1D72D, [0x03B8]). % L& MATHEMATICAL BOLD ITALIC CAPITAL THETA SYMBOL unicode_fc_nfkc(0x1D72E, [0x03C3]). % L& MATHEMATICAL BOLD ITALIC CAPITAL SIGMA unicode_fc_nfkc(0x1D72F, [0x03C4]). % L& MATHEMATICAL BOLD ITALIC CAPITAL TAU unicode_fc_nfkc(0x1D730, [0x03C5]). % L& MATHEMATICAL BOLD ITALIC CAPITAL UPSILON unicode_fc_nfkc(0x1D731, [0x03C6]). % L& MATHEMATICAL BOLD ITALIC CAPITAL PHI unicode_fc_nfkc(0x1D732, [0x03C7]). % L& MATHEMATICAL BOLD ITALIC CAPITAL CHI unicode_fc_nfkc(0x1D733, [0x03C8]). % L& MATHEMATICAL BOLD ITALIC CAPITAL PSI unicode_fc_nfkc(0x1D734, [0x03C9]). % L& MATHEMATICAL BOLD ITALIC CAPITAL OMEGA unicode_fc_nfkc(0x1D747, [0x03C3]). % L& MATHEMATICAL BOLD ITALIC SMALL FINAL SIGMA unicode_fc_nfkc(0x1D756, [0x03B1]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL ALPHA unicode_fc_nfkc(0x1D757, [0x03B2]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL BETA unicode_fc_nfkc(0x1D758, [0x03B3]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL GAMMA unicode_fc_nfkc(0x1D759, [0x03B4]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL DELTA unicode_fc_nfkc(0x1D75A, [0x03B5]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL EPSILON unicode_fc_nfkc(0x1D75B, [0x03B6]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL ZETA unicode_fc_nfkc(0x1D75C, [0x03B7]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL ETA unicode_fc_nfkc(0x1D75D, [0x03B8]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA unicode_fc_nfkc(0x1D75E, [0x03B9]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL IOTA unicode_fc_nfkc(0x1D75F, [0x03BA]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL KAPPA unicode_fc_nfkc(0x1D760, [0x03BB]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL LAMDA unicode_fc_nfkc(0x1D761, [0x03BC]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL MU unicode_fc_nfkc(0x1D762, [0x03BD]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL NU unicode_fc_nfkc(0x1D763, [0x03BE]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL XI unicode_fc_nfkc(0x1D764, [0x03BF]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL OMICRON unicode_fc_nfkc(0x1D765, [0x03C0]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL PI unicode_fc_nfkc(0x1D766, [0x03C1]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL RHO unicode_fc_nfkc(0x1D767, [0x03B8]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA SYMBOL unicode_fc_nfkc(0x1D768, [0x03C3]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL SIGMA unicode_fc_nfkc(0x1D769, [0x03C4]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL TAU unicode_fc_nfkc(0x1D76A, [0x03C5]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL UPSILON unicode_fc_nfkc(0x1D76B, [0x03C6]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL PHI unicode_fc_nfkc(0x1D76C, [0x03C7]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL CHI unicode_fc_nfkc(0x1D76D, [0x03C8]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL PSI unicode_fc_nfkc(0x1D76E, [0x03C9]). % L& MATHEMATICAL SANS-SERIF BOLD CAPITAL OMEGA unicode_fc_nfkc(0x1D781, [0x03C3]). % L& MATHEMATICAL SANS-SERIF BOLD SMALL FINAL SIGMA unicode_fc_nfkc(0x1D790, [0x03B1]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ALPHA unicode_fc_nfkc(0x1D791, [0x03B2]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL BETA unicode_fc_nfkc(0x1D792, [0x03B3]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL GAMMA unicode_fc_nfkc(0x1D793, [0x03B4]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL DELTA unicode_fc_nfkc(0x1D794, [0x03B5]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL EPSILON unicode_fc_nfkc(0x1D795, [0x03B6]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ZETA unicode_fc_nfkc(0x1D796, [0x03B7]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ETA unicode_fc_nfkc(0x1D797, [0x03B8]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA unicode_fc_nfkc(0x1D798, [0x03B9]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL IOTA unicode_fc_nfkc(0x1D799, [0x03BA]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL KAPPA unicode_fc_nfkc(0x1D79A, [0x03BB]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL LAMDA unicode_fc_nfkc(0x1D79B, [0x03BC]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL MU unicode_fc_nfkc(0x1D79C, [0x03BD]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL NU unicode_fc_nfkc(0x1D79D, [0x03BE]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL XI unicode_fc_nfkc(0x1D79E, [0x03BF]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMICRON unicode_fc_nfkc(0x1D79F, [0x03C0]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PI unicode_fc_nfkc(0x1D7A0, [0x03C1]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL RHO unicode_fc_nfkc(0x1D7A1, [0x03B8]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA SYMBOL unicode_fc_nfkc(0x1D7A2, [0x03C3]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL SIGMA unicode_fc_nfkc(0x1D7A3, [0x03C4]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL TAU unicode_fc_nfkc(0x1D7A4, [0x03C5]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL UPSILON unicode_fc_nfkc(0x1D7A5, [0x03C6]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PHI unicode_fc_nfkc(0x1D7A6, [0x03C7]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL CHI unicode_fc_nfkc(0x1D7A7, [0x03C8]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PSI unicode_fc_nfkc(0x1D7A8, [0x03C9]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMEGA unicode_fc_nfkc(0x1D7BB, [0x03C3]). % L& MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL FINAL SIGMA unicode_fc_nfkc(0x1D7CA, [0x03DD]). % L& MATHEMATICAL BOLD CAPITAL DIGAMMA unicode_fc_nfkc(0x1F110, [0x0028, 0x0061, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER A unicode_fc_nfkc(0x1F111, [0x0028, 0x0062, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER B unicode_fc_nfkc(0x1F112, [0x0028, 0x0063, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER C unicode_fc_nfkc(0x1F113, [0x0028, 0x0064, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER D unicode_fc_nfkc(0x1F114, [0x0028, 0x0065, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER E unicode_fc_nfkc(0x1F115, [0x0028, 0x0066, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER F unicode_fc_nfkc(0x1F116, [0x0028, 0x0067, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER G unicode_fc_nfkc(0x1F117, [0x0028, 0x0068, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER H unicode_fc_nfkc(0x1F118, [0x0028, 0x0069, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER I unicode_fc_nfkc(0x1F119, [0x0028, 0x006A, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER J unicode_fc_nfkc(0x1F11A, [0x0028, 0x006B, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER K unicode_fc_nfkc(0x1F11B, [0x0028, 0x006C, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER L unicode_fc_nfkc(0x1F11C, [0x0028, 0x006D, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER M unicode_fc_nfkc(0x1F11D, [0x0028, 0x006E, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER N unicode_fc_nfkc(0x1F11E, [0x0028, 0x006F, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER O unicode_fc_nfkc(0x1F11F, [0x0028, 0x0070, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER P unicode_fc_nfkc(0x1F120, [0x0028, 0x0071, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER Q unicode_fc_nfkc(0x1F121, [0x0028, 0x0072, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER R unicode_fc_nfkc(0x1F122, [0x0028, 0x0073, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER S unicode_fc_nfkc(0x1F123, [0x0028, 0x0074, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER T unicode_fc_nfkc(0x1F124, [0x0028, 0x0075, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER U unicode_fc_nfkc(0x1F125, [0x0028, 0x0076, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER V unicode_fc_nfkc(0x1F126, [0x0028, 0x0077, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER W unicode_fc_nfkc(0x1F127, [0x0028, 0x0078, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER X unicode_fc_nfkc(0x1F128, [0x0028, 0x0079, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER Y unicode_fc_nfkc(0x1F129, [0x0028, 0x007A, 0x0029]). % So PARENTHESIZED LATIN CAPITAL LETTER Z unicode_fc_nfkc(0x1F12A, [0x3014, 0x0073, 0x3015]). % So TORTOISE SHELL BRACKETED LATIN CAPITAL LETTER S unicode_fc_nfkc(0x1F12B, [0x0063]). % So CIRCLED ITALIC LATIN CAPITAL LETTER C unicode_fc_nfkc(0x1F12C, [0x0072]). % So CIRCLED ITALIC LATIN CAPITAL LETTER R unicode_fc_nfkc(0x1F12D, [0x0063, 0x0064]). % So CIRCLED CD unicode_fc_nfkc(0x1F12E, [0x0077, 0x007A]). % So CIRCLED WZ unicode_fc_nfkc(0x1F130, [0x0061]). % So SQUARED LATIN CAPITAL LETTER A unicode_fc_nfkc(0x1F131, [0x0062]). % So SQUARED LATIN CAPITAL LETTER B unicode_fc_nfkc(0x1F132, [0x0063]). % So SQUARED LATIN CAPITAL LETTER C unicode_fc_nfkc(0x1F133, [0x0064]). % So SQUARED LATIN CAPITAL LETTER D unicode_fc_nfkc(0x1F134, [0x0065]). % So SQUARED LATIN CAPITAL LETTER E unicode_fc_nfkc(0x1F135, [0x0066]). % So SQUARED LATIN CAPITAL LETTER F unicode_fc_nfkc(0x1F136, [0x0067]). % So SQUARED LATIN CAPITAL LETTER G unicode_fc_nfkc(0x1F137, [0x0068]). % So SQUARED LATIN CAPITAL LETTER H unicode_fc_nfkc(0x1F138, [0x0069]). % So SQUARED LATIN CAPITAL LETTER I unicode_fc_nfkc(0x1F139, [0x006A]). % So SQUARED LATIN CAPITAL LETTER J unicode_fc_nfkc(0x1F13A, [0x006B]). % So SQUARED LATIN CAPITAL LETTER K unicode_fc_nfkc(0x1F13B, [0x006C]). % So SQUARED LATIN CAPITAL LETTER L unicode_fc_nfkc(0x1F13C, [0x006D]). % So SQUARED LATIN CAPITAL LETTER M unicode_fc_nfkc(0x1F13D, [0x006E]). % So SQUARED LATIN CAPITAL LETTER N unicode_fc_nfkc(0x1F13E, [0x006F]). % So SQUARED LATIN CAPITAL LETTER O unicode_fc_nfkc(0x1F13F, [0x0070]). % So SQUARED LATIN CAPITAL LETTER P unicode_fc_nfkc(0x1F140, [0x0071]). % So SQUARED LATIN CAPITAL LETTER Q unicode_fc_nfkc(0x1F141, [0x0072]). % So SQUARED LATIN CAPITAL LETTER R unicode_fc_nfkc(0x1F142, [0x0073]). % So SQUARED LATIN CAPITAL LETTER S unicode_fc_nfkc(0x1F143, [0x0074]). % So SQUARED LATIN CAPITAL LETTER T unicode_fc_nfkc(0x1F144, [0x0075]). % So SQUARED LATIN CAPITAL LETTER U unicode_fc_nfkc(0x1F145, [0x0076]). % So SQUARED LATIN CAPITAL LETTER V unicode_fc_nfkc(0x1F146, [0x0077]). % So SQUARED LATIN CAPITAL LETTER W unicode_fc_nfkc(0x1F147, [0x0078]). % So SQUARED LATIN CAPITAL LETTER X unicode_fc_nfkc(0x1F148, [0x0079]). % So SQUARED LATIN CAPITAL LETTER Y unicode_fc_nfkc(0x1F149, [0x007A]). % So SQUARED LATIN CAPITAL LETTER Z unicode_fc_nfkc(0x1F14A, [0x0068, 0x0076]). % So SQUARED HV unicode_fc_nfkc(0x1F14B, [0x006D, 0x0076]). % So SQUARED MV unicode_fc_nfkc(0x1F14C, [0x0073, 0x0064]). % So SQUARED SD unicode_fc_nfkc(0x1F14D, [0x0073, 0x0073]). % So SQUARED SS unicode_fc_nfkc(0x1F14E, [0x0070, 0x0070, 0x0076]). % So SQUARED PPV unicode_fc_nfkc(0x1F14F, [0x0077, 0x0063]). % So SQUARED WC unicode_fc_nfkc(0x1F16A, [0x006D, 0x0063]). % So RAISED MC SIGN unicode_fc_nfkc(0x1F16B, [0x006D, 0x0064]). % So RAISED MD SIGN unicode_fc_nfkc(0x1F190, [0x0064, 0x006A]). % So SQUARE DJ % Total code points: 633
LogtalkDotOrg/logtalk3
library/unicode_data/unicode_derived_normalization_props/unicode_fc_nfkc.pl
Perl
apache-2.0
52,791
# # COPYRIGHT NOTICE. Copyright (C) 2007 Siemens Corporate Research, # Inc. ("caBIG(tm) Participant"). The eXtensible Imaging Platform # (XIP) was created with NCI funding and is part of the caBIG(tm) # initiative. The software subject to this notice and license # includes both human readable source code form and machine # readable, binary, object code form (the "caBIG(tm) Software"). # # This caBIG(tm) Software License (the "License") is between # caBIG(tm) Participant and You. "You (or "Your") shall mean a # person or an entity, and all other entities that control, are # controlled by, or are under common control with the entity. # "Control" for purposes of this definition means (i) the direct or # indirect power to cause the direction or management of such # entity, whether by contract or otherwise, or (ii) ownership of # fifty percent (50%) or more of the outstanding shares, or (iii) # beneficial ownership of such entity. # # LICENSE. Provided that You agree to the conditions described # below, caBIG(tm) Participant grants You a non-exclusive, # worldwide, perpetual, fully-paid-up, no-charge, irrevocable, # transferable and royalty-free right and license in its rights in # the caBIG(tm) Software, including any copyright or patent rights # therein that may be infringed by the making, using, selling, # offering for sale, or importing of caBIG(tm) Software, to (i) # use, install, access, operate, execute, reproduce, copy, modify, # translate, market, publicly display, publicly perform, and # prepare derivative works of the caBIG(tm) Software; (ii) make, # have made, use, practice, sell, and offer for sale, and/or # otherwise dispose of caBIG(tm) Software (or portions thereof); # (iii) distribute and have distributed to and by third parties the # caBIG(tm) Software and any modifications and derivative works # thereof; and (iv) sublicense the foregoing rights set out in (i), # (ii) and (iii) to third parties, including the right to license # such rights to further third parties. For sake of clarity, and # not by way of limitation, caBIG(tm) Participant shall have no # right of accounting or right of payment from You or Your # sublicensees for the rights granted under this License. This # License is granted at no charge to You. Your downloading, # copying, modifying, displaying, distributing or use of caBIG(tm) # Software constitutes acceptance of all of the terms and # conditions of this Agreement. If you do not agree to such terms # and conditions, you have no right to download, copy, modify, # display, distribute or use the caBIG(tm) Software. # # 1. Your redistributions of the source code for the caBIG(tm) # Software must retain the above copyright notice, this list # of conditions and the disclaimer and limitation of # liability of Article 6 below. Your redistributions in # object code form must reproduce the above copyright notice, # this list of conditions and the disclaimer of Article 6 in # the documentation and/or other materials provided with the # distribution, if any. # 2. Your end-user documentation included with the # redistribution, if any, must include the following # acknowledgment: "This product includes software developed # by Siemens Corporate Research Inc." If You do not include # such end-user documentation, You shall include this # acknowledgment in the caBIG(tm) Software itself, wherever # such third-party acknowledgments normally appear. # 3. You may not use the names "Siemens Corporate Research, # Inc.", "The National Cancer Institute", "NCI", "Cancer # Bioinformatics Grid" or "caBIG(tm)" to endorse or promote # products derived from this caBIG(tm) Software. This # License does not authorize You to use any trademarks, # service marks, trade names, logos or product names of # either caBIG(tm) Participant, NCI or caBIG(tm), except as # required to comply with the terms of this License. # 4. For sake of clarity, and not by way of limitation, You may # incorporate this caBIG(tm) Software into Your proprietary # programs and into any third party proprietary programs. # However, if You incorporate the caBIG(tm) Software into # third party proprietary programs, You agree that You are # solely responsible for obtaining any permission from such # third parties required to incorporate the caBIG(tm) # Software into such third party proprietary programs and for # informing Your sublicensees, including without limitation # Your end-users, of their obligation to secure any required # permissions from such third parties before incorporating # the caBIG(tm) Software into such third party proprietary # software programs. In the event that You fail to obtain # such permissions, You agree to indemnify caBIG(tm) # Participant for any claims against caBIG(tm) Participant by # such third parties, except to the extent prohibited by law, # resulting from Your failure to obtain such permissions. # 5. For sake of clarity, and not by way of limitation, You may # add Your own copyright statement to Your modifications and # to the derivative works, and You may provide additional or # different license terms and conditions in Your sublicenses # of modifications of the caBIG(tm) Software, or any # derivative works of the caBIG(tm) Software as a whole, # provided Your use, reproduction, and distribution of the # Work otherwise complies with the conditions stated in this # License. # 6. THIS caBIG(tm) SOFTWARE IS PROVIDED "AS IS" AND ANY # EXPRESSED OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON- # INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE) ARE # DISCLAIMED. IN NO EVENT SHALL SIEMENS CORPORATE RESEARCH # INC. OR ITS AFFILIATES 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 caBIG(tm) SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. # ############################################################################### package Filter::Field::Input; require Filter::Field; @ISA = qw(Filter::Field); sub new() { my ( $that, $name, $type, $value ) = @_; my $class = ref($that) || $that; my $self = { NAME => $name, TYPE => $type, VALUE => $value, OWNER => undef, ENABLED => 1, NUM => 1 }; # Transform $self into an object of class $class return bless $self, $class; } sub is_input() { return 1; } sub is_arg() { return 0; } sub num() { my $self = shift; $self->{NUM} = shift if( @_ ); return $self->{NUM}; } sub serialize() { my $self = shift; my $value = $self->value() eq "" ? "" : " value = \"" . $self->value() . "\""; my $enable = $self->enable() ? "" : " enabled = \"false\""; my $num = $self->num() eq 1 ? "" : " num = \"" . $self->num() . "\""; return "<input id = \"" . $self->name() . "\" type = \"" . $self->type() . "\"" . $value . $enable . $num . "/>"; }
OpenXIP/xip-libraries
src/wrap/itk/modules/Filter/Field/Input.pm
Perl
apache-2.0
7,841
# 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::V9::Services::OfflineUserDataJobService::AddOfflineUserDataJobOperationsResponse; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = { partialFailureError => $args->{partialFailureError}, warning => $args->{warning}}; # 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/V9/Services/OfflineUserDataJobService/AddOfflineUserDataJobOperationsResponse.pm
Perl
apache-2.0
1,144
# # 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::dell::compellent::local::mode::volumeusage; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use centreon::plugins::misc; use centreon::common::powershell::dell::compellent::volumeusage; sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'sc', type => 1, cb_prefix_output => 'prefix_sc_output', message_multiple => 'All storage centers are ok', cb_init => 'sc_init' }, { name => 'volume', type => 1, cb_prefix_output => 'prefix_volume_output', message_multiple => 'All volumes are ok' } ]; $self->{maps_counters}->{sc} = [ { label => 'sc-total', set => { key_values => [ { name => 'display' }, { name => 'used' }, { name => 'total' }, { name => 'type' } ], closure_custom_calc => $self->can('custom_usage_calc'), 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'), } }, ]; $self->{maps_counters}->{volume} = [ { label => 'volume-usage', set => { key_values => [ { name => 'display' }, { name => 'used' }, { name => 'total' }, { name => 'type' } ], closure_custom_calc => $self->can('custom_usage_calc'), 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 => 'volume-overhead', set => { key_values => [ { name => 'overhead' }, { name => 'display' } ], output_template => 'Raid Overhead : %s %s', output_change_bytes => 1, perfdatas => [ { label => 'volume_overhead', value => 'overhead', template => '%d', unit => 'B', min => 0, label_extra_instance => 1, instance_use => 'display' }, ], } }, { label => 'volume-replay', set => { key_values => [ { name => 'replay' }, { name => 'display' } ], output_template => 'Replay : %s %s', output_change_bytes => 1, perfdatas => [ { label => 'volume_replay', value => 'replay', template => '%d', unit => 'B', min => 0, label_extra_instance => 1, instance_use => 'display' }, ], } }, ]; } sub prefix_sc_output { my ($self, %options) = @_; return "Storage center '" . $options{instance_value}->{display} . "' "; } sub prefix_volume_output { my ($self, %options) = @_; return "Volume '" . $options{instance_value}->{display} . "' "; } sub sc_init { my ($self, %options) = @_; if (defined($self->{option_results}->{ps_sc_volume}) && $self->{option_results}->{ps_sc_volume} ne '') { return 1; } return 0; } sub custom_usage_perfdata { my ($self, %options) = @_; my $label = $self->{result_values}->{type} . '_used'; my $value_perf = $self->{result_values}->{used}; if (defined($self->{instance_mode}->{option_results}->{free})) { $label = $self->{result_values}->{type} . '_free'; $value_perf = $self->{result_values}->{free}; } my %total_options = (); if ($self->{instance_mode}->{option_results}->{units} eq '%') { $total_options{total} = $self->{result_values}->{total}; $total_options{cast_int} = 1; } $self->{output}->perfdata_add( label => $label, unit => 'B', instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef, value => $value_perf, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}, %total_options), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}, %total_options), min => 0, max => $self->{result_values}->{total} ); } sub custom_usage_threshold { my ($self, %options) = @_; my ($exit, $threshold_value); $threshold_value = $self->{result_values}->{used}; $threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free})); if ($self->{instance_mode}->{option_results}->{units} eq '%') { $threshold_value = $self->{result_values}->{prct_used}; $threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free})); } $exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{thlabel}, 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( "Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $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}->{display} = $options{new_datas}->{$self->{instance} . '_display'}; $self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'}; $self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'}; $self->{result_values}->{type} = $options{new_datas}->{$self->{instance} . '_type'}; $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total}; $self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used}; $self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used}; # snapshot can be over 100% if ($self->{result_values}->{free} < 0) { $self->{result_values}->{free} = 0; $self->{result_values}->{prct_free} = 0; } return 0; } sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $options{options}->add_options(arguments => { 'cem-host:s' => { name => 'cem_host' }, 'cem-user:s' => { name => 'cem_user' }, 'cem-password:s' => { name => 'cem_password' }, 'cem-port:s' => { name => 'cem_port', default => 3033 }, 'sdk-path-dll:s' => { name => 'sdk_path_dll' }, 'timeout:s' => { name => 'timeout', default => 50 }, 'command:s' => { name => 'command', default => 'powershell.exe' }, 'command-path:s' => { name => 'command_path' }, 'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' }, 'no-ps' => { name => 'no_ps' }, 'ps-exec-only' => { name => 'ps_exec_only' }, 'ps-display' => { name => 'ps_display' }, 'ps-sc-filter:s' => { name => 'ps_sc_filter' }, 'ps-sc-volume:s' => { name => 'ps_sc_volume' }, 'units:s' => { name => 'units', default => '%' }, 'free' => { name => 'free' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); foreach my $label (('cem_host', 'cem_user', 'cem_password', 'cem_port', 'sdk_path_dll')) { if (!defined($self->{option_results}->{$label}) || $self->{option_results}->{$label} eq '') { my ($label_opt) = $label; $label_opt =~ tr/_/-/; $self->{output}->add_option_msg(short_msg => "Need to specify --" . $label_opt . " option."); $self->{output}->option_exit(); } } } sub manage_selection { my ($self, %options) = @_; if (!defined($self->{option_results}->{no_ps})) { my $ps = centreon::common::powershell::dell::compellent::volumeusage::get_powershell( cem_host => $self->{option_results}->{cem_host}, cem_user => $self->{option_results}->{cem_user}, cem_password => $self->{option_results}->{cem_password}, cem_port => $self->{option_results}->{cem_port}, sdk_path_dll => $self->{option_results}->{sdk_path_dll}, filter_sc => $self->{option_results}->{ps_sc_filter}, filter_vol => $self->{option_results}->{ps_sc_volume} ); if (defined($self->{option_results}->{ps_display})) { $self->{output}->output_add( severity => 'OK', short_msg => $ps ); $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); $self->{output}->exit(); } $self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps); } my ($stdout) = centreon::plugins::misc::windows_execute( output => $self->{output}, timeout => $self->{option_results}->{timeout}, command => $self->{option_results}->{command}, command_path => $self->{option_results}->{command_path}, command_options => $self->{option_results}->{command_options} ); if (defined($self->{option_results}->{ps_exec_only})) { $self->{output}->output_add( severity => 'OK', short_msg => $stdout ); $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); $self->{output}->exit(); } # [sc=PRD-SAN-01][volume=SC-S06][configuredSpace=xxxxx][freeSpace=xxxxx][activeSpace=xxxxx][raidOverhead=xxx][totalDiskSpace=xxxx][replaySpace=xxxx] $self->{volume} = {}; $self->{sc} = {}; while ($stdout =~ /^\[sc=(.*?)\]\[volume=(.*?)\]\[configuredSpace=(.*?)\]\[freeSpace=(.*?)\]\[activeSpace=(.*?)\]\[raidOverhead=(.*?)\]\[totalDiskSpace=(.*?)\]\[replaySpace=(.*?)\]/mig) { my ($sc, $volume, $configured_space, $free_space, $active_space, $raid_overhead, $total_disk_space, $replay_space) = ($1, $2, $3, $4, $5, $6, $7, $8); my $name = $sc . '/' . $volume; $self->{volume}->{$name} = { display => $name, total => $configured_space, type => 'volume', used => $active_space + $raid_overhead + $replay_space, overhead => $raid_overhead, replay => $replay_space }; $self->{sc}->{$sc} = { display => $sc, total => 0, used => 0, type => 'sc' } if (!defined($self->{sc}->{$sc})); $self->{sc}->{$sc}->{used} += $active_space + $raid_overhead + $replay_space; } # [sc=PRD-SAN-01][disk=01-01][spare=False][allocatedSpace=960195723264] while ($stdout =~ /^\[sc=(.*?)\]\[disk=(.*?)\]\[spare=(.*?)\]\[allocatedSpace=(.*?)\]/mig) { my ($sc, $disk, $spare, $allocated_space) = ($1, $2, $3, $4); $self->{sc}->{$sc}->{total} += $allocated_space; } } 1; __END__ =head1 MODE Check storage center and volume usages. =over 8 =item B<--cem-host> Compellent Entreprise Manager hostname (Required). =item B<--cem-user> Compellent Entreprise Manager username (Required). =item B<--cem-password> Compellent Entreprise Manager password (Required). =item B<--cem-port> Compellent Entreprise Manager port (Default: 3033). =item B<--sdk-path-dll> Path to 'DellStorage.ApiCommandSet.dll' (Required). =item B<--timeout> Set timeout time for command execution (Default: 50 sec) =item B<--no-ps> Don't encode powershell. To be used with --command and 'type' command. =item B<--command> Command to get information (Default: 'powershell.exe'). Can be changed if you have output in a file. To be used with --no-ps option!!! =item B<--command-path> Command path (Default: none). =item B<--command-options> Command options (Default: '-InputFormat none -NoLogo -EncodedCommand'). =item B<--ps-display> Display powershell script. =item B<--ps-exec-only> Print powershell output. =item B<--ps-sc-filter> Filter Storage Center (only wilcard '*' can be used. In Powershell). =item B<--ps-sc-volume> Filter Volume Name to display. =item B<--units> Units of thresholds (Default: '%') ('%', 'B'). =item B<--free> Thresholds are on free space left. =item B<--filter-counters> Only display some counters (regexp can be used). Example: --filter-counters='^sc-total$' =item B<--warning-*> Threshold warning. Can be: 'sc-total', 'volume-usage', 'volume-overhead', 'volume-replay'. =item B<--critical-*> Threshold critical. Can be: 'sc-total', 'volume-usage', 'volume-overhead', 'volume-replay'. =back =cut
centreon/centreon-plugins
storage/dell/compellent/local/mode/volumeusage.pm
Perl
apache-2.0
14,109
package Paws::ELBv2::DeleteLoadBalancer; use Moose; has LoadBalancerArn => (is => 'ro', isa => 'Str', required => 1); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'DeleteLoadBalancer'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::ELBv2::DeleteLoadBalancerOutput'); class_has _result_key => (isa => 'Str', is => 'ro', default => 'DeleteLoadBalancerResult'); 1; ### main pod documentation begin ### =head1 NAME Paws::ELBv2::DeleteLoadBalancer - Arguments for method DeleteLoadBalancer on Paws::ELBv2 =head1 DESCRIPTION This class represents the parameters used for calling the method DeleteLoadBalancer on the Elastic Load Balancing service. Use the attributes of this class as arguments to method DeleteLoadBalancer. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to DeleteLoadBalancer. As an example: $service_obj->DeleteLoadBalancer(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> LoadBalancerArn => Str The Amazon Resource Name (ARN) of the load balancer. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method DeleteLoadBalancer in L<Paws::ELBv2> =head1 BUGS and CONTRIBUTIONS The source code is located here: https://github.com/pplu/aws-sdk-perl Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues =cut
ioanrogers/aws-sdk-perl
auto-lib/Paws/ELBv2/DeleteLoadBalancer.pm
Perl
apache-2.0
1,696
# # 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 database::couchdb::restapi::mode::server; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc); use JSON::XS; sub custom_server_output { my ($self, %options) = @_; my $msg = 'server status is ' . $self->{result_values}->{status}; return $msg; } sub custom_compaction_output { my ($self, %options) = @_; my $msg = "compaction status is '" . $self->{result_values}->{compaction_status} . "'"; return $msg; } sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'global', type => 0 }, { name => 'database', type => 1, cb_prefix_output => 'prefix_db_output', message_multiple => 'All databases are ok', skipped_code => { -10 => 1 } }, ]; $self->{maps_counters}->{global} = [ { label => 'status', threshold => 0, set => { key_values => [ { name => 'status' } ], closure_custom_calc => \&catalog_status_calc, closure_custom_output => $self->can('custom_server_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold, } }, ]; $self->{maps_counters}->{database} = [ { label => 'compaction-status', threshold => 0, set => { key_values => [ { name => 'compaction_status' }, { name => 'display' } ], closure_custom_calc => \&catalog_status_calc, closure_custom_output => $self->can('custom_compaction_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold, } }, { label => 'database-size-active', nlabel => 'server.database.size.active.bytes', set => { key_values => [ { name => 'sizes_active' }, { name => 'display' } ], output_template => 'live data size: %s %s', output_change_bytes => 1, perfdatas => [ { value => 'sizes_active', template => '%d', min => 0, unit => 'B', label_extra_instance => 1, instance_use => 'display' } ], } }, { label => 'database-size-file', nlabel => 'server.database.size.file.bytes', set => { key_values => [ { name => 'sizes_file' }, { name => 'display' } ], output_template => 'file size: %s %s', output_change_bytes => 1, perfdatas => [ { value => 'sizes_file', template => '%d', min => 0, unit => 'B', label_extra_instance => 1, instance_use => 'display' } ], } }, { label => 'database-documents-current', nlabel => 'server.database.documents.currrent.count', display_ok => 0, set => { key_values => [ { name => 'doc_count' }, { name => 'display' } ], output_template => 'number of documents: %s', perfdatas => [ { value => 'doc_count', template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ], } }, { label => 'database-documents-deleted', nlabel => 'server.database.documents.deleted.count', display_ok => 0, set => { key_values => [ { name => 'doc_del_count' }, { name => 'display' } ], output_template => 'number of deleted documents: %s', perfdatas => [ { value => 'doc_del_count', template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ], } }, ]; } 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-db-name:s' => { name => 'filter_db_name' }, 'unknown-status:s' => { name => 'unknown_status', default => '' }, 'warning-status:s' => { name => 'warning_status', default => '' }, 'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /^ok/i' }, 'unknown-compaction-status:s' => { name => 'unknown_compaction_status', default => '' }, 'warning-compaction-status:s' => { name => 'warning_compaction_status', default => '' }, 'critical-compaction-status:s' => { name => 'critical_compaction_status', default => '' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); $self->change_macros(macros => [ 'warning_status', 'critical_status', 'unknown_status', 'warning_compaction_status', 'critical_compaction_status', 'unknown_compaction_status' ]); } sub prefix_db_output { my ($self, %options) = @_; return "Database '" . $options{instance_value}->{display} . "' "; } sub manage_selection { my ($self, %options) = @_; my $results = $options{custom}->request_api(url_path => '/_up'); $self->{global} = { status => $results->{status} }; $results = $options{custom}->request_api(url_path => '/_all_dbs'); my $db = { keys => $results }; my $encoded; eval { $encoded = JSON::XS->new->utf8->encode($db); }; if ($@) { $self->{output}->add_option_msg(short_msg => "Cannot encode json request"); $self->{output}->option_exit(); } $results = $options{custom}->request_api( method => 'POST', url_path => '/_dbs_info', query_form_post => $encoded ); $self->{database} = {}; foreach (@$results) { if (defined($self->{option_results}->{filter_db_name}) && $self->{option_results}->{filter_db_name} ne '' && $_->{info}->{db_name} !~ /$self->{option_results}->{filter_db_name}/) { $self->{output}->output_add(long_msg => "skipping database '" . $_->{info}->{db_name} . "': no matching filter.", debug => 1); next; } $self->{database}->{$_->{info}->{db_name}} = { display => $_->{info}->{db_name}, compaction_status => $_->{info}->{compact_running} ? 'running' : 'notRunning', doc_count => $_->{info}->{doc_count}, doc_del_count => $_->{info}->{doc_del_count}, sizes_active => $_->{info}->{sizes}->{active}, sizes_file => $_->{info}->{sizes}->{file} }; } } 1; __END__ =head1 MODE Check server status and database stastistics. =over 8 =item B<--filter-counters> Only display some counters (regexp can be used). Example: --filter-counters='^status$' =item B<--filter-db-name> Filter database name (can be a regexp). =item B<--unknown-status> Set unknown threshold for status (Default: ''). Can used special variables like: %{status} =item B<--warning-status> Set warning threshold for status (Default: ''). Can used special variables like: %{status} =item B<--critical-status> Set critical threshold for status (Default: '%{status} !~ /^ok/i'). Can used special variables like: %{status} =item B<--unknown-compaction-status> Set unknown threshold for status (Default: ''). Can used special variables like: %{compaction_status}, %{display} =item B<--warning-compaction-status> Set warning threshold for status (Default: ''). Can used special variables like: %{compaction_status}, %{display} =item B<--critical-compaction-status> Set critical threshold for status (Default: ''). Can used special variables like: %{compaction_status}, %{display} =item B<--warning-*> B<--critical-*> Thresholds. Can be: 'database-size-active' (B), 'database-size-file' (B), 'database-documents-deleted', 'database-documents-current'. =back =cut
Tpo76/centreon-plugins
database/couchdb/restapi/mode/server.pm
Perl
apache-2.0
8,804
# # 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 network::stonesoft::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} = '1.0'; %{$self->{modes}} = ( 'memory' => 'network::stonesoft::snmp::mode::memory', 'cpu' => 'network::stonesoft::snmp::mode::cpu', 'connections' => 'network::stonesoft::snmp::mode::connections', 'interfaces' => 'snmp_standard::mode::interfaces', 'storage' => 'network::stonesoft::snmp::mode::storage', 'cluster-state' => 'network::stonesoft::snmp::mode::clusterstate', 'cluster-load' => 'network::stonesoft::snmp::mode::clusterload', 'rejected-packets' => 'network::stonesoft::snmp::mode::rejectedpackets', 'dropped-packets' => 'network::stonesoft::snmp::mode::droppedpackets', 'list-interfaces' => 'snmp_standard::mode::listinterfaces', ); return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check Stonesoft firewall in SNMP. =cut
golgoth31/centreon-plugins
network/stonesoft/snmp/plugin.pm
Perl
apache-2.0
2,193
=pod =head1 NAME crypto - OpenSSL cryptographic library =head1 SYNOPSIS See the individual manual pages for details. =head1 DESCRIPTION The OpenSSL crypto library (C<libcrypto>) implements a wide range of cryptographic algorithms used in various Internet standards. The services provided by this library are used by the OpenSSL implementations of TLS and CMS, and they have also been used to implement many other third party products and protocols. The functionality includes symmetric encryption, public key cryptography, key agreement, certificate handling, cryptographic hash functions, cryptographic pseudo-random number generators, message authentication codes (MACs), key derivation functions (KDFs), and various utilities. =head2 Algorithms Cryptographic primitives such as the SHA256 digest, or AES encryption are referred to in OpenSSL as "algorithms". Each algorithm may have multiple implementations available for use. For example the RSA algorithm is available as a "default" implementation suitable for general use, and a "fips" implementation which has been validated to FIPS standards for situations where that is important. It is also possible that a third party could add additional implementations such as in a hardware security module (HSM). =head2 Operations Different algorithms can be grouped together by their purpose. For example there are algorithms for encryption, and different algorithms for digesting data. These different groups are known as "operations" in OpenSSL. Each operation has a different set of functions associated with it. For example to perform an encryption operation using AES (or any other encryption algorithm) you would use the encryption functions detailed on the L<EVP_EncryptInit(3)> page. Or to perform a digest operation using SHA256 then you would use the digesting functions on the L<EVP_DigestInit(3)> page. =head2 Providers A provider in OpenSSL is a component that collects together algorithm implementations. In order to use an algorithm you must have at least one provider loaded that contains an implementation of it. OpenSSL comes with a number of providers and they may also be obtained from third parties. If you don't load a provider explicitly (either in program code or via config) then the OpenSSL built-in "default" provider will be automatically loaded. =head2 Library contexts A library context can be thought of as a "scope" within which configuration options take effect. When a provider is loaded, it is only loaded within the scope of a given library context. In this way it is possible for different components of a complex application to each use a different library context and have different providers loaded with different configuration settings. If an application does not explicitly create a library context then the "default" library context will be used. Library contexts are represented by the B<OSSL_LIB_CTX> type. Many OpenSSL API functions take a library context as a parameter. Applications can always pass B<NULL> for this parameter to just use the default library context. The default library context is automatically created the first time it is needed. This will automatically load any available configuration file and will initialise OpenSSL for use. Unlike in earlier versions of OpenSSL (prior to 1.1.0) no explicit initialisation steps need to be taken. Similarly when the application exits the default library context is automatically destroyed. No explicit de-initialisation steps need to be taken. See L<OSSL_LIB_CTX(3)> for more information about library contexts. See also L</ALGORITHM FETCHING>. =head2 Multi-threaded applications As long as OpenSSL has been built with support for threads (the default case on most platforms) then most OpenSSL I<functions> are thread-safe in the sense that it is safe to call the same function from multiple threads at the same time. However most OpenSSL I<data structures> are not thread-safe. For example the L<BIO_write(3)> and L<BIO_read(3)> functions are thread safe. However it would not be thread safe to call BIO_write() from one thread while calling BIO_read() in another where both functions are passed the same B<BIO> object since both of them may attempt to make changes to the same B<BIO> object. There are exceptions to these rules. A small number of functions are not thread safe at all. Where this is the case this restriction should be noted in the documentation for the function. Similarly some data structures may be partially or fully thread safe. For example it is safe to use an B<OSSL_LIB_CTX> in multiple threads. See L<openssl-threads(7)> for a more detailed discussion on OpenSSL threading support. =head1 ALGORITHM FETCHING In order to use an algorithm an implementation for it must first be "fetched". Fetching is the process of looking through the available implementations, applying selection criteria (via a property query string), and finally choosing the implementation that will be used. Two types of fetching are supported by OpenSSL - explicit fetching and implicit fetching. =head2 Property query strings When fetching an algorithm it is possible to specify a property query string to guide the selection process. For example a property query string of "provider=default" could be used to force the selection to only consider algorithm implementations in the default provider. Property query strings can be specified explicitly as an argument to a function. It is also possible to specify a default property query string for the whole library context using the L<EVP_set_default_properties(3)> function. Where both default properties and function specific properties are specified then they are combined. Function specific properties will override default properties where there is a conflict. See L<property(7)> for more information about properties. =head2 Explicit fetching Users of the OpenSSL libraries never query a provider directly for an algorithm implementation. Instead, the diverse OpenSSL APIs often have explicit fetching functions that do the work, and they return an appropriate algorithm object back to the user. These functions usually have the name C<APINAME_fetch>, where C<APINAME> is the name of the operation. For example L<EVP_MD_fetch(3)> can be used to explicitly fetch a digest algorithm implementation. The user is responsible for freeing the object returned from the C<APINAME_fetch> function using C<APINAME_free> when it is no longer needed. These fetching functions follow a fairly common pattern, where three arguments are passed: =over 4 =item The library context See L<OSSL_LIB_CTX(3)> for a more detailed description. This may be NULL to signify the default (global) library context, or a context created by the user. Only providers loaded in this library context (see L<OSSL_PROVIDER_load(3)>) will be considered by the fetching function. In case no provider has been loaded in this library context then the default provider will be loaded as a fallback (see L<OSSL_PROVIDER-default(7)>). =item An identifier For all currently implemented fetching functions this is the algorithm name. =item A property query string The property query string used to guide selection of the algorithm implementation. =back The algorithm implementation that is fetched can then be used with other diverse functions that use them. For example the L<EVP_DigestInit_ex(3)> function takes as a parameter an B<EVP_MD> object which may have been returned from an earlier call to L<EVP_MD_fetch(3)>. =head2 Implicit fetch OpenSSL has a number of functions that return an algorithm object with no associated implementation, such as L<EVP_sha256(3)>, L<EVP_aes_128_cbc(3)>, L<EVP_get_cipherbyname(3)> or L<EVP_get_digestbyname(3)>. These are present for compatibility with OpenSSL before version 3.0 where explicit fetching was not available. When they are used with functions like L<EVP_DigestInit_ex(3)> or L<EVP_CipherInit_ex(3)>, the actual implementation to be used is fetched implicitly using default search criteria. In some cases implicit fetching can also occur when a NULL algorithm parameter is supplied. In this case an algorithm implementation is implicitly fetched using default search criteria and an algorithm name that is consistent with the context in which it is being used. Functions that revolve around B<EVP_PKEY_CTX> and L<EVP_PKEY(3)>, such as L<EVP_DigestSignInit(3)> and friends, all fetch the implementations implicitly. Because these functions involve both an operation type (such as L<EVP_SIGNATURE(3)>) and an L<EVP_KEYMGMT(3)> for the L<EVP_PKEY(3)>, they try the following: =over 4 =item 1. Fetch the operation type implementation from any provider given a library context and property string stored in the B<EVP_PKEY_CTX>. If the provider of the operation type implementation is different from the provider of the L<EVP_PKEY(3)>'s L<EVP_KEYMGMT(3)> implementation, try to fetch a L<EVP_KEYMGMT(3)> implementation in the same provider as the operation type implementation and export the L<EVP_PKEY(3)> to it (effectively making a temporary copy of the original key). If anything in this step fails, the next step is used as a fallback. =item 2. As a fallback, try to fetch the operation type implementation from the same provider as the original L<EVP_PKEY(3)>'s L<EVP_KEYMGMT(3)>, still using the property string from the B<EVP_PKEY_CTX>. =back =head1 FETCHING EXAMPLES The following section provides a series of examples of fetching algorithm implementations. Fetch any available implementation of SHA2-256 in the default context. Note that some algorithms have aliases. So "SHA256" and "SHA2-256" are synonymous: EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", NULL); ... EVP_MD_free(md); Fetch any available implementation of AES-128-CBC in the default context: EVP_CIPHER *cipher = EVP_CIPHER_fetch(NULL, "AES-128-CBC", NULL); ... EVP_CIPHER_free(cipher); Fetch an implementation of SHA2-256 from the default provider in the default context: EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", "provider=default"); ... EVP_MD_free(md); Fetch an implementation of SHA2-256 that is not from the default provider in the default context: EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", "provider!=default"); ... EVP_MD_free(md); Fetch an implementation of SHA2-256 from the default provider in the specified context: EVP_MD *md = EVP_MD_fetch(ctx, "SHA2-256", "provider=default"); ... EVP_MD_free(md); Load the legacy provider into the default context and then fetch an implementation of WHIRLPOOL from it: /* This only needs to be done once - usually at application start up */ OSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, "legacy"); EVP_MD *md = EVP_MD_fetch(NULL, "WHIRLPOOL", "provider=legacy"); ... EVP_MD_free(md); Note that in the above example the property string "provider=legacy" is optional since, assuming no other providers have been loaded, the only implementation of the "whirlpool" algorithm is in the "legacy" provider. Also note that the default provider should be explicitly loaded if it is required in addition to other providers: /* This only needs to be done once - usually at application start up */ OSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, "legacy"); OSSL_PROVIDER *default = OSSL_PROVIDER_load(NULL, "default"); EVP_MD *md_whirlpool = EVP_MD_fetch(NULL, "whirlpool", NULL); EVP_MD *md_sha256 = EVP_MD_fetch(NULL, "SHA2-256", NULL); ... EVP_MD_free(md_whirlpool); EVP_MD_free(md_sha256); =head1 OPENSSL PROVIDERS OpenSSL comes with a set of providers. The algorithms available in each of these providers may vary due to build time configuration options. The L<openssl-list(1)> command can be used to list the currently available algorithms. The names of the algorithms shown from L<openssl-list(1)> can be used as an algorithm identifier to the appropriate fetching function. Also see the provider specific manual pages linked below for further details about using the algorithms available in each of the providers. As well as the OpenSSL providers third parties can also implement providers. For information on writing a provider see L<provider(7)>. =head2 Default provider The default provider is built in as part of the F<libcrypto> library and contains all of the most commonly used algorithm implementations. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string "provider=default" can be used as a search criterion for these implementations. The default provider includes all of the functionality in the base provider below. If you don't load any providers at all then the "default" provider will be automatically loaded. If you explicitly load any provider then the "default" provider would also need to be explicitly loaded if it is required. See L<OSSL_PROVIDER-default(7)>. =head2 Base provider The base provider is built in as part of the F<libcrypto> library and contains algorithm implementations for encoding and decoding for OpenSSL keys. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string "provider=base" can be used as a search criterion for these implementations. Some encoding and decoding algorithm implementations are not FIPS algorithm implementations in themselves but support algorithms from the FIPS provider and are allowed for use in "FIPS mode". The property query string "fips=yes" can be used to select such algorithms. See L<OSSL_PROVIDER-base(7)>. =head2 FIPS provider The FIPS provider is a dynamically loadable module, and must therefore be loaded explicitly, either in code or through OpenSSL configuration (see L<config(5)>). It contains algorithm implementations that have been validated according to the FIPS 140-2 standard. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string "provider=fips" can be used as a search criterion for these implementations. All approved algorithm implementations in the FIPS provider can also be selected with the property "fips=yes". The FIPS provider may also contain non-approved algorithm implementations and these can be selected with the property "fips=no". See L<OSSL_PROVIDER-FIPS(7)> and L<fips_module(7)>. =head2 Legacy provider The legacy provider is a dynamically loadable module, and must therefore be loaded explicitly, either in code or through OpenSSL configuration (see L<config(5)>). It contains algorithm implementations that are considered insecure, or are no longer in common use such as MD2 or RC4. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property "provider=legacy" can be used as a search criterion for these implementations. See L<OSSL_PROVIDER-legacy(7)>. =head2 Null provider The null provider is built in as part of the F<libcrypto> library. It contains no algorithms in it at all. When fetching algorithms the default provider will be automatically loaded if no other provider has been explicitly loaded. To prevent that from happening you can explicitly load the null provider. See L<OSSL_PROVIDER-null(7)>. =head1 USING ALGORITHMS IN APPLICATIONS Cryptographic algorithms are made available to applications through use of the "EVP" APIs. Each of the various operations such as encryption, digesting, message authentication codes, etc., have a set of EVP function calls that can be invoked to use them. See the L<evp(7)> page for further details. Most of these follow a common pattern. A "context" object is first created. For example for a digest operation you would use an B<EVP_MD_CTX>, and for an encryption/decryption operation you would use an B<EVP_CIPHER_CTX>. The operation is then initialised ready for use via an "init" function - optionally passing in a set of parameters (using the B<OSSL_PARAM> type) to configure how the operation should behave. Next data is fed into the operation in a series of "update" calls. The operation is finalised using a "final" call which will typically provide some kind of output. Finally the context is cleaned up and freed. The following shows a complete example for doing this process for digesting data using SHA256. The process is similar for other operations such as encryption/decryption, signatures, message authentication codes, etc. #include <stdio.h> #include <openssl/evp.h> #include <openssl/bio.h> #include <openssl/err.h> int main(void) { EVP_MD_CTX *ctx = NULL; EVP_MD *sha256 = NULL; const unsigned char msg[] = { 0x00, 0x01, 0x02, 0x03 }; unsigned int len = 0; unsigned char *outdigest = NULL; int ret = 1; /* Create a context for the digest operation */ ctx = EVP_MD_CTX_new(); if (ctx == NULL) goto err; /* * Fetch the SHA256 algorithm implementation for doing the digest. We're * using the "default" library context here (first NULL parameter), and * we're not supplying any particular search criteria for our SHA256 * implementation (second NULL parameter). Any SHA256 implementation will * do. */ sha256 = EVP_MD_fetch(NULL, "SHA256", NULL); if (sha256 == NULL) goto err; /* Initialise the digest operation */ if (!EVP_DigestInit_ex(ctx, sha256, NULL)) goto err; /* * Pass the message to be digested. This can be passed in over multiple * EVP_DigestUpdate calls if necessary */ if (!EVP_DigestUpdate(ctx, msg, sizeof(msg))) goto err; /* Allocate the output buffer */ outdigest = OPENSSL_malloc(EVP_MD_get_size(sha256)); if (outdigest == NULL) goto err; /* Now calculate the digest itself */ if (!EVP_DigestFinal_ex(ctx, outdigest, &len)) goto err; /* Print out the digest result */ BIO_dump_fp(stdout, outdigest, len); ret = 0; err: /* Clean up all the resources we allocated */ OPENSSL_free(outdigest); EVP_MD_free(sha256); EVP_MD_CTX_free(ctx); if (ret != 0) ERR_print_errors_fp(stderr); return ret; } =head1 CONFIGURATION By default OpenSSL will load a configuration file when it is first used. This will set up various configuration settings within the default library context. Applications that create their own library contexts may optionally configure them with a config file using the L<OSSL_LIB_CTX_load_config(3)> function. The configuration file can be used to automatically load providers and set up default property query strings. For information on the OpenSSL configuration file format see L<config(5)>. =head1 ENCODING AND DECODING KEYS Many algorithms require the use of a key. Keys can be generated dynamically using the EVP APIs (for example see L<EVP_PKEY_Q_keygen(3)>). However it is often necessary to save or load keys (or their associated parameters) to or from some external format such as PEM or DER (see L<openssl-glossary(7)>). OpenSSL uses encoders and decoders to perform this task. Encoders and decoders are just algorithm implementations in the same way as any other algorithm implementation in OpenSSL. They are implemented by providers. The OpenSSL encoders and decoders are available in the default provider. They are also duplicated in the base provider. For information about encoders see L<OSSL_ENCODER_CTX_new_for_pkey(3)>. For information about decoders see L<OSSL_DECODER_CTX_new_for_pkey(3)>. =head1 LIBRARY CONVENTIONS Many OpenSSL functions that "get" or "set" a value follow a naming convention using the numbers B<0> and B<1>, i.e. "get0", "get1", "set0" and "set1". This can also apply to some functions that "add" a value to an existing set, i.e. "add0" and "add1". For example the functions: int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); In the B<0> version the ownership of the object is passed to (for an add or set) or retained by (for a get) the parent object. For example after calling the X509_CRL_add0_revoked() function above, ownership of the I<rev> object is passed to the I<crl> object. Therefore, after calling this function I<rev> should not be freed directly. It will be freed implicitly when I<crl> is freed. In the B<1> version the ownership of the object is not passed to or retained by the parent object. Instead a copy or "up ref" of the object is performed. So after calling the X509_add1_trust_object() function above the application will still be responsible for freeing the I<obj> value where appropriate. =head1 SEE ALSO L<openssl(1)>, L<ssl(7)>, L<evp(7)>, L<OSSL_LIB_CTX(3)>, L<openssl-threads(7)>, L<property(7)>, L<OSSL_PROVIDER-default(7)>, L<OSSL_PROVIDER-base(7)>, L<OSSL_PROVIDER-FIPS(7)>, L<OSSL_PROVIDER-legacy(7)>, L<OSSL_PROVIDER-null(7)>, L<openssl-glossary(7)>, L<provider(7)> =head1 COPYRIGHT Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
openssl/openssl
doc/man7/crypto.pod
Perl
apache-2.0
21,320
#!/usr/bin/perl # Input parameters from loxberryupdate.pl: # release: the final version update is going to (not the version of the script) # logfilename: The filename of LoxBerry::Log where the script can append # updatedir: The directory where the update resides # cron: If 1, the update was triggered automatically by cron use LoxBerry::System; use LoxBerry::Log; use CGI; my $cgi = CGI->new; # Initialize logfile and parameters my $logfilename; if ($cgi->param('logfilename')) { $logfilename = $cgi->param('logfilename'); } my $log = LoxBerry::Log->new( package => 'LoxBerry Update', name => 'update', filename => $logfilename, logdir => "$lbslogdir/loxberryupdate", loglevel => 7, stderr => 1, append => 1, ); $logfilename = $log->filename; if ($cgi->param('updatedir')) { $updatedir = $cgi->param('updatedir'); } my $release = $cgi->param('release'); # Finished initializing # Start program here ######################################################################## my $errors = 0; LOGOK "Update script $0 started."; ## Commented, possibly re-use in 1.4? (from 1.2.5 updatescript) LOGINF "Clean up apt databases and update"; my $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -y --fix-broken install }; $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -y autoremove }; $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -y clean }; $output = qx { rm -r /var/cache/apt/archives/* }; $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/dpkg --configure -a }; my $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error configuring dkpg with /usr/bin/dpkg --configure -a - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "Configuring dpkg successfully."; } $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q -y update }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error updating apt database - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "Apt database updated successfully."; } LOGINF "Installing jq (json parser for shell)..."; $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get --no-install-recommends -q -y --fix-broken --reinstall install jq }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error installing jq - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "jq package successfully installed"; } LOGINF "Installing openvpn (for Remote Support Widget)..."; $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get --no-install-recommends -q -y --fix-broken --reinstall install openvpn }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error installing openvpn - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "openvpn package successfully installed"; } LOGINF "Installing watchdog..."; $output = qx { DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get --no-install-recommends -q -y --fix-broken --reinstall install watchdog }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error installing watchdog - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "watchdog package successfully installed"; } # Diable it by default: watchdog $output = qx { systemctl disable watchdog.service }; $output = qx { systemctl stop watchdog.service }; # Installing default config: watchdog copy_to_loxberry("/system/watchdog", "root"); copy_to_loxberry("/system/watchdog/watchdog.conf", "loxberry"); $output = qx { mv /etc/watchdog.conf /etc/watchdog.bkp }; $output = qx { ln -f -s $lbhomedir/system/watchdog/watchdog.conf /etc/watchdog.conf }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error creating symlink $lbhomedir/system/watchdog/watchdog.conf - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "Symlink $lbhomedir/system/watchdog/watchdog.conf created successfully"; } system("/bin/sed -i 's:REPLACELBHOMEDIR:$lbhomedir:g' $lbhomedir/system/watchdog/rsyslog.conf"); $output = qx ( cat /etc/default/watchdog | grep -q -e "watchdog_options" ); $exitcode = $? >> 8; if ($exitcode != 0) { qx (echo 'watchdog_options=""' >> /etc/default/watchdog); } system("/bin/sed -i 's:watchdog_options=\"\\(.*\\)\":watchdog_options=\"\\1 -v\":g' /etc/default/watchdog"); $output = qx { ln -f -s $lbhomedir/system/watchdog/rsyslog.conf /etc/rsyslog.d/10-watchdog.conf }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error creating symlink $lbhomedir/system/watchdog/rsyslog.conf - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "Symlink $lbhomedir/system/watchdog/rsyslog.conf created successfully"; } system("systemctl restart rsyslog.service"); LOGINF "Converting mail.cfg to mail.json"; $oldmailfile = $lbsconfigdir . "/mail.cfg"; $newmailfile = $lbsconfigdir . "/mail.json"; if (! -e $oldmailfile) { LOGWARN "No mail configuration found to migrate - skipping migration"; } else { unlink $newmailfile; require LoxBerry::JSON; LOGDEB "Loading mail.cfg"; Config::Simple->import_from($oldmailfile, \%oldmcfg); LOGDEB "Creating mail.json"; my $newmailobj = LoxBerry::JSON->new(); my $newmcfg = $newmailobj->open(filename => $newmailfile); LOGDEB "Migrating settings..."; foreach my $key (sort keys %oldmcfg) { my ($section, $param) = split('\.', $key, 2); #LOGDEB "ref $param is " . ref($oldmcfg{$key}); if(ref($oldmcfg{$key}) eq 'ARRAY') { LOGWARN "Parameter $param had commas in it's field. Migration has tried to"; LOGWARN "restore the value, but you should check the Mailserver widget settings and"; LOGWARN "save it's settings again."; my $tmpfield = join(',', @{$oldmcfg{$key}}); $oldmcfg{$key} = $tmpfield; } # LOGDEB "$section $param = " . $oldmcfg{$key}; $newmcfg->{$section}->{$param} = %oldmcfg{$key}; my $logline = index(lc($key), 'pass') != -1 ? "Migrated $section.$param = *****" : "Migrated $section.$param = $oldmcfg{$key}"; LOGINF $logline; } if ( $newmcfg->{SMTP}->{EMAIL} and $newmcfg->{SMTP}->{SMTPSERVER} and $newmcfg->{SMTP}->{PORT} ) { # Enable mail by default if settings are made $newmcfg->{SMTP}->{ACTIVATE_MAIL} = "1"; } $newmailobj->write(); `chown loxberry:loxberry $newmailfile`; `chmod 0600 $newmailfile`; LOGINF "Deleting old mail settings file..."; unlink $oldmailfile; LOGOK "Migrated your mail settings. Check your settings in the Mailserver widget."; } # Some new files from ~/system LOGINF "Installing some new system configs..."; copy_to_loxberry("/system/sudoers/lbdefaults", "root"); copy_to_loxberry("/system/supportvpn", "loxberry"); copy_to_loxberry("/system/daemons/system/04-remotesupport", "root"); copy_to_loxberry("/system/network/interfaces.eth_dhcp", "loxberry"); copy_to_loxberry("/system/network/interfaces.eth_static", "loxberry"); copy_to_loxberry("/system/network/interfaces.wlan_dhcp", "loxberry"); copy_to_loxberry("/system/network/interfaces.wlan_static", "loxberry"); LOGINF "Installing daily cronjob for plugin update checks..."; $output = qx { rm -f $lbhomedir/system/cron/cron.weekly/pluginsupdate.pl }; $output = qx { ln -f -s $lbhomedir/sbin/pluginsupdate.pl $lbhomedir/system/cron/cron.daily/02-pluginsupdate.pl }; # Upgrade Raspbian on next reboot LOGINF "Upgrading system to latest Raspbian release ON NEXT REBOOT."; my $logfilename_wo_ext = $logfilename; $logfilename_wo_ext =~ s{\.[^.]+$}{}; open(F,">$lbhomedir/system/daemons/system/99-updaterebootv140"); print F <<EOF; #!/bin/bash perl $lbhomedir/sbin/loxberryupdate/updatereboot_v1.4.0.pl logfilename=$logfilename_wo_ext-reboot 2>&1 EOF close (F); qx { chmod +x $lbhomedir/system/daemons/system/99-updaterebootv140 }; # Update Kernel and Firmware if (-e "$lbhomedir/config/system/is_raspberry.cfg" && !-e "$lbhomedir/config/system/is_odroidxu3xu4.cfg") { LOGINF "Preparing Guru Meditation..."; LOGINF "This will take some time now. We suggest getting a coffee or a second beer :-)"; LOGINF "Upgrading system kernel and firmware. Takes up to 10 minutes or longer! Be patient and do NOT reboot!"; my $output = qx { SKIP_WARNING=1 SKIP_BACKUP=1 BRANCH=stable /usr/bin/rpi-update 3678d3dba62d8d4ad9cce5ceeab3b377e0ee059d }; my $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error upgrading kernel and firmware - Error $exitcode"; LOGDEB $output; $errors++; } else { LOGOK "Upgrading kernel and firmware successfully."; } } ## If this script needs a reboot, a reboot.required file will be created or appended LOGWARN "Update file $0 requests a reboot of LoxBerry. Please reboot your LoxBerry after the installation has finished."; reboot_required("LoxBerry Update requests a reboot."); LOGOK "Update script $0 finished." if ($errors == 0); LOGERR "Update script $0 finished with errors." if ($errors != 0); # End of script exit($errors); sub delete_directory { require File::Path; my $delfolder = shift; if (-d $delfolder) { File::Path::rmtree($delfolder, {error => \my $err}); if (@$err) { for my $diag (@$err) { my ($file, $message) = %$diag; if ($file eq '') { LOGERR " Delete folder: general error: $message"; } else { LOGERR " Delete folder: problem unlinking $file: $message"; } } return undef; } } return 1; } #################################################################### # Copy a file or dir from updatedir to lbhomedir including error handling # Parameter: # file/dir starting from ~ # (without /opt/loxberry, with leading /) # owner #################################################################### sub copy_to_loxberry { my ($destparam, $destowner) = @_; my $destfile = $lbhomedir . $destparam; my $srcfile = $updatedir . $destparam; if (!$destowner) {$destowner = "root"}; if (! -e $srcfile) { LOGINF "$srcfile does not exist - This file might have been removed in a later LoxBerry verion. No problem."; return; } my $output = qx { cp -rf $srcfile $destfile 2>&1 }; my $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error copying $destparam - Error $exitcode"; LOGINF "Message: $output"; $errors++; } else { LOGOK "$destparam installed."; } $output = qx { chown -R $destowner:$destowner $destfile 2>&1 }; $exitcode = $? >> 8; if ($exitcode != 0) { LOGERR "Error changing owner to $destowner for $destfile - Error $exitcode"; LOGINF "Message: $output"; $errors++; } else { LOGOK "$destfile owner changedi to $destowner."; } }
mschlenstedt/Loxberry
sbin/loxberryupdate/update_v1.4.pl
Perl
apache-2.0
10,452
:- include('../user_and_password.pl').
leuschel/ecce
www/CiaoDE/ciao/library/persdb_mysql/examples/small_examples/user_and_password.pl
Perl
apache-2.0
39
package VMOMI::ScheduledTaskEmailFailedEvent; use parent 'VMOMI::ScheduledTaskEvent'; use strict; use warnings; our @class_ancestors = ( 'ScheduledTaskEvent', 'Event', 'DynamicData', ); our @class_members = ( ['to', undef, 0, ], ['reason', 'LocalizedMethodFault', 0, ], ); 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/ScheduledTaskEmailFailedEvent.pm
Perl
apache-2.0
515
package VMOMI::ArrayOfNetIpConfigInfoIpAddress; use parent 'VMOMI::ComplexType'; use strict; use warnings; our @class_ancestors = ( ); our @class_members = ( ['NetIpConfigInfoIpAddress', 'NetIpConfigInfoIpAddress', 1, 1], ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
stumpr/p5-vmomi
lib/VMOMI/ArrayOfNetIpConfigInfoIpAddress.pm
Perl
apache-2.0
450
#!/usr/bin/env perl use strict; use warnings; use Tags::Element qw(element); use Tags::Output::Raw; # Get example element. my @tags = element('div', { 'id' => 'foo', 'class' => 'bar', }, 'Foo', 'Bar'); # Serialize by Tags. my $tags = Tags::Output::Raw->new; $tags->put(@tags); print $tags->flush."\n"; # Output. # <div class="bar" id="foo">FooBar</div>
tupinek/Tags-Element
examples/ex2.pl
Perl
bsd-2-clause
373
package MemberSite::Model::Utils; use base 'Catalyst::Model::Adaptor'; __PACKAGE__->config({ class => 'MemberSite::Model::Utils' }); sub add_flag { my $self = shift; my $flagstr = shift; my $flag_to_add = shift; return(_add_letter($flag_to_add, $flagstr)); } sub add_achievment { my $self = shift; my $achievmentstr = shift; my $achievment_to_add = shift; return(_add_letter($achievment_to_add, $achievmentstr)); } sub del_flag { my $self = shift; my $flagstr = shift; my $flag_to_del = shift; return(_del_letter($flag_to_del, $flagstr)); } sub del_achievment { my $self = shift; my $achievmentstr = shift; my $achievment_to_del = shift; return(_del_letter($achievment_to_del, $achievmentstr)); } sub _add_letter { my $self = shift; my $atom_to_add = shift; my $atomstr = shift; @atoms = sort split(//, $atomstr . $atom_to_add); return "@atoms"; } sub _del_letter { my $self = shift; my $atom_to_del = shift; my $str = shift; my $ret = $str; $ret =~ s/$atom_to_del//; return $ret; } 1;
jmcveigh/komodo-tools
templates/Perl/Catalyst/Ufimisms/Member Site/Utils/Utils.pm
Perl
bsd-2-clause
1,131
#!/usr/bin/env perl package Interhack::Plugin::InGame::Foodless; use Calf::Role; our $VERSION = '1.99_01'; # deps {{{ sub depend { qw/Debug Util/ } # }}} # attributes {{{ has confirm_eat => ( isa => 'Bool', lazy => 1, default => 1, ); # }}} # method modifiers {{{ guard 'check_input' => sub { my ($self, $input) = @_; return 1 if !defined($input); if ($self->confirm_eat && $input =~ /^e/ && $self->expecting_command) { my $ynq = $self->force_tab_ynq("Press tab or q to eat, q to stop asking, any other key to cancel."); if ($ynq == 0) { return } if ($ynq == -1) { $self->debug("Disabled 'eat' confirmations."); $self->confirm_eat(0); } } return 1; }; # }}} # methods {{{ # }}} 1;
TAEB/Interhack2
lib/Interhack/Plugin/InGame/Foodless.pm
Perl
bsd-3-clause
786
package Cpanel::Security::Advisor::Assessors::Kernel; # Copyright (c) 2014, cPanel, Inc. # All rights reserved. # http://cpanel.net # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the owner 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 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. use strict; use base 'Cpanel::Security::Advisor::Assessors'; use Cpanel::SafeRun::Errors (); use Cpanel::Kernel (); use Cpanel::OSSys::Env (); my $kc_kernelversion = kcare_kernel_version("uname"); sub version { return '1.02'; } sub generate_advice { my ($self) = @_; $self->_check_for_kernel_version; return 1; } sub _check_for_kernel_version { my ($self) = @_; my %kernel_update = kernel_updates(); my @kernel_update = (); if ( ( keys %kernel_update ) ) { foreach my $update ( keys %kernel_update ) { unshift( @kernel_update, $kernel_update{$update} ); } } my $boot_kernelversion = Cpanel::Kernel::get_default_boot_version(); my $running_kernelversion = Cpanel::Kernel::get_running_version(); my $environment = Cpanel::OSSys::Env::get_envtype(); if ( $running_kernelversion =~ m/\.(?:noarch|x86_64|i.86).+$/ ) { $self->add_info_advice( 'key' => 'Kernel_can_not_check', 'text' => $self->_lh->maketext( 'Custom kernel version cannot be checked to see if it is up to date: [_1]', $running_kernelversion ) ); } elsif ( ( $environment eq 'virtuozzo' ) || ( $environment eq 'lxc' ) ) { $self->add_info_advice( 'key' => 'Kernel_unsupported_environment', 'text' => $self->_lh->maketext('Kernel updates are not supported on this virtualization platform. Be sure to keep the host’s kernel up to date.') ); } elsif ( (@kernel_update) && ($kc_kernelversion) ) { if ( kcare_kernel_version("check") eq "New version available" ) { $self->add_bad_advice( 'key' => 'Kernel_kernelcare_update_available', 'text' => $self->_lh->maketext( 'Kernel patched with KernelCare, but out of date. running kernel: [_1], most recent kernel: [list_and,_2]', $kc_kernelversion, \@kernel_update, ), 'suggestion' => $self->_lh->maketext('This can be resolved either by running ’/usr/bin/kcarectl --update’ from the command line to begin an update of the KernelCare kernel version, or by running ’yum update’ from the command line and rebooting the system.'), ); } else { $self->add_info_advice( 'key' => 'Kernel_waiting_for_kernelcare_update', 'text' => $self->_lh->maketext( 'Kernel patched with KernelCare, but awaiting further updates. running kernel: [_1], most recent kernel: [list_and,_2]', $kc_kernelversion, \@kernel_update, ), 'suggestion' => $self->_lh->maketext('The kernel will likely be patched to the current version within the next few days. If this delay is unacceptable, update the system’s software by running ’yum update’ from the command line and reboot the system.'), ); } } elsif ( (@kernel_update) ) { $self->add_bad_advice( 'key' => 'Kernel_outdated', 'text' => $self->_lh->maketext( 'Current kernel version is out of date. running kernel: [_1], most recent kernel: [list_and,_2]', $running_kernelversion, \@kernel_update, ), 'suggestion' => $self->_lh->maketext('Update the system’s software by running ’yum update’ from the command line and reboot the system.'), ); } elsif ($kc_kernelversion) { $self->add_good_advice( 'key' => 'Kernel_kernelcare_is_current', 'text' => $self->_lh->maketext( 'KernelCare is installed and current running kernel version is up to date: [_1]', $kc_kernelversion ) ); } elsif ( ( $running_kernelversion ne $boot_kernelversion ) ) { $self->add_bad_advice( 'key' => 'Kernel_boot_running_mismatch', 'text' => $self->_lh->maketext( 'Current kernel version does not match the kernel version for boot. running kernel: [_1], boot kernel: [_2]', $running_kernelversion, $boot_kernelversion ), 'suggestion' => $self->_lh->maketext( 'Reboot the system in the "[output,url,_1,Graceful Server Reboot,_2,_3]" area. Check the boot configuration in grub.conf if the new kernel is not loaded after a reboot.', $self->base_path('scripts/dialog?dialog=reboot'), 'target', '_blank' ), ); } else { $self->add_good_advice( 'key' => 'Kernel_running_is_current', 'text' => $self->_lh->maketext( 'Current running kernel version is up to date: [_1]', $running_kernelversion ) ); } return 1; } sub kernel_updates { my %kernel_update; my @args = qw(yum -d 0 info updates kernel); my @yum_response = Cpanel::SafeRun::Errors::saferunnoerror(@args); my ( $rpm, $arch, $version, $release ); foreach my $element ( 0 .. $#yum_response ) { $rpm = ( split( /:/, $yum_response[$element] ) )[1] if ( ( $yum_response[$element] =~ m/^Name/ ) ); $arch = ( split( /:/, $yum_response[$element] ) )[1] if ( ( $yum_response[$element] =~ m/^Arch/ ) ); $version = ( split( /:/, $yum_response[$element] ) )[1] if ( ( $yum_response[$element] =~ m/^Version/ ) ); $release = ( split( /:/, $yum_response[$element] ) )[1] if ( ( $yum_response[$element] =~ m/^Release/ ) ); if ( ( ($rpm) && ($arch) && ($version) && ($release) ) ) { s/\s//g foreach ( $rpm, $arch, $version, $release ); if ( $kc_kernelversion ne ( $version . "-" . $release . "." . $arch ) && $kc_kernelversion ne ( $version . "-" . $release ) ) { $kernel_update{ $rpm . " " . $version . "-" . $release } = $version . "-" . $release . "." . $arch; $rpm = undef; $arch = undef; $version = undef; $release = undef; } } } return %kernel_update; } # end of sub sub kcare_kernel_version { my @args; my $kc_response = ""; if ( -f "/usr/bin/kcarectl" ) { @args = ( "/usr/bin/kcarectl", "--" . "$_[0]" ); $kc_response = Cpanel::SafeRun::Errors::saferunnoerror(@args); $kc_response =~ s/\+$//; chomp $kc_response; } return $kc_response; } 1; __END__
edwbuck/addon_securityadvisor
pkg/Cpanel/Security/Advisor/Assessors/Kernel.pm
Perl
bsd-3-clause
8,329
use POSIX qw(strftime); use Digest::MD5 (); # sort files { my @package_xml = grep(/package\.xml\.tmpl$/, @$files); my @other = grep(!/package\.xml\.tmpl$/, @$files); push(@other, @package_xml); @$files = @other; } sub package_name { return sprintf("Services_%s_%s", $tmpl->get('company_name'), $tmpl->get('service_name')); } sub package_dir { return sprintf("Services/%s/%s", $tmpl->get('company_name'), $tmpl->get('service_name')); } sub php_license_uri { return $schema->{php_license_uri} || { 'PHP' => 'http://www.php.net/license/', 'Apache' => 'http://www.apache.org/licenses/', 'LGPL' => 'http://www.gnu.org/copyleft/lesser.html', 'BSD style' => 'http://www.opensource.org/licenses/bsd-license.php', 'BSD' => 'http://www.opensource.org/licenses/bsd-license.php', 'MIT' => 'http://www.opensource.org/licenses/mit-license.html', }->{$tmpl->get('license')}; } sub php_channel { return $schema->{php_channel} || "__uri"; } sub php_copyright { return $schema->{php_copyright} || ""; } sub php_link { return $schema->{php_link} || sprintf("http://localhost/%s", &package_name); } sub php_license_abstract { return $schema->{php_license_abstract} || ""; } sub make_params_conf { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $conf = {}; foreach my $param (@{$method->{params}}) { next if $param->{fixed}; push(@{$conf->{'keys'}}, $param->{name}); } foreach my $param (@{$method->{params}}) { if ($param->{'require'}) { $conf->{'notnull'}->{$param->{name}}++; } if ($param->{default}) { $conf->{defaults}->{$param->{name}} = $param->{default}; } if ($param->{fixed}) { $conf->{fixed}->{$param->{name}} = $param->{fixed}; } } if (exists $conf->{'notnull'}) { $conf->{'notnull'} = [sort keys %{$conf->{'notnull'}}]; } my $result = make_php_array($conf, $indent, $indstr); $result =~ s/^\s+//; return $result; } sub make_response_conf { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $conf = {}; my $que = [[$method->{'return'}]]; while (@$que) { my $node = shift(@$que); foreach my $n (@$node) { if (exists $n->{children}) { push(@$que, $n->{children}); } if ($n->{multiple}) { $conf->{'force_array'}->{$n->{name}}++; } } } if (exists $conf->{'force_array'}) { $conf->{'force_array'} = [sort keys %{$conf->{'force_array'}}]; } if (exists $method->{'error_status'}) { $conf->{'error_status'} = [@{$method->{'error_status'}}]; } my $result = make_php_array($conf, $indent, $indstr); $result =~ s/^\s+//; return $result; } sub make_php_array { my ($data, $indent, $indstr, $join) = @_; $indent ||= 0; $indstr ||= " "; $join ||= "\n"; sub rec_func { my ($dd, $ii, $is) = @_; my $pf = $is x $ii; my $ref = ref $dd; if ($ref eq 'HASH') { my $res = []; push(@$res, "${pf}array("); foreach my $ddd (sort keys %$dd) { my $dddd = rec_func($dd->{$ddd}, $ii+1, $is); $dddd =~ s/^$pf$is//; push(@$res, "$pf$is'$ddd' => $dddd,"); } push(@$res, "${pf})"); return join($join, @$res); } elsif ($ref eq 'ARRAY') { my $res = []; push(@$res, "${pf}array("); foreach my $ddd (@$dd) { push(@$res, rec_func($ddd, $ii+1, $is) . ","); } push(@$res, "${pf})"); return join($join, @$res); } return "$pf'$dd'"; } return rec_func($data, $indent, $indstr); } sub make_package_contents { my $strs = []; my $md5 = Digest::MD5->new(); foreach my $file (@$result) { my $cfile = $file; $cfile =~ s#^\Q$odir\E/##; my $md5sum = ""; if (open(IN, $file)) { $md5->addfile(\*IN); $md5sum = sprintf(' md5sum="%s"', $md5->hexdigest); $md5->reset(); close(IN); } my $role = 'php'; $role = 'test' if $cfile =~ /tests/; $role = 'doc' if $cfile =~ /docs/; my $bid = "Services/" . $tmpl->get('company_name'); my $ostr =<<EOS; <file baseinstalldir="$bid"$md5sum name="$cfile" role="$role"> <tasks:replace from="\@package_version\@" to="version" type="package-info" /> </file> EOS push(@$strs, $ostr); } my $str = join("", @$strs); $str =~ s/\s+$//; return $str; } sub make_is_error { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; return "return false;" unless $method->{'error'}; my $strs = []; push(@$strs, "\$data =& \$this->getData();"); my $ret_test = [map {['', $_]} @{$method->{'error'}->{children}}]; while (my $ret = shift(@$ret_test)) { next if $ret->[1]->{nullable}; my $php_var = sprintf('$data%s->%s', $ret->[0], $ret->[1]->{name}); push(@$strs, ($indstr x $indent) . "if (!isset($php_var)) {"); push(@$strs, ($indstr x ($indent + 1)) . "return false;"); if ($ret->[1]->{'values'}) { my $php_array = sprintf('array(%s)', join(", ", map {qq|"$_"|} @{$ret->[1]->{'values'}})); push(@$strs, ($indstr x ($indent)) . "} elseif (!in_array($php_var, $php_array)) {"); push(@$strs, ($indstr x ($indent + 1)) . "return false;"); } push(@$strs, ($indstr x $indent) . "}"); next unless $ret->[1]->{children}; my $next_node = $ret->[0].'->'.$ret->[1]->{name}; $next_node .= '[0]' if $ret->[1]->{multiple}; push(@$ret_test, map {[$next_node, $_]} @{$ret->[1]->{children}}); } push(@$strs, ($indstr x $indent) . "return true;"); return join("\n", @$strs); } sub make_error_message { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $ret_test = [map {['', $_]} @{$method->{'error'}->{children}}]; while (my $ret = shift(@$ret_test)) { next if $ret->[1]->{nullable}; if ($ret->[1]->{error_message}) { my $strs = []; push(@$strs, "\$data =& \$this->getData();"); my $php_var = sprintf('$data%s->%s', $ret->[0], $ret->[1]->{name}); if ($ret->[1]->{error_message_map}) { my $msg_map = $ret->[1]->{error_message_map}; my $php_array = make_php_array($msg_map, $indent, $indstr); $php_array =~ s/^\s+//; push(@$strs, ($indstr x $indent) . "\$msg_map = $php_array;"); push(@$strs, ($indstr x $indent) . "\$val = $php_var;"); push(@$strs, ($indstr x $indent) . "if (array_key_exists(\$val, \$msg_map)) {"); push(@$strs, ($indstr x ($indent + 1)) . "return \$msg_map[\$val];"); push(@$strs, ($indstr x $indent) . "}"); push(@$strs, ($indstr x ($indent)) . "return \$val;"); } else { push(@$strs, ($indstr x $indent) . "return $php_var;"); } return join("\n", @$strs); } next unless $ret->[1]->{children}; my $next_node = $ret->[0].'->'.$ret->[1]->{name}; $next_node .= '[0]' if $ret->[1]->{multiple}; push(@$ret_test, map {[$next_node, $_]} @{$ret->[1]->{children}}); } return "return 'Unknown error';"; } sub make_total_entries { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $ret_test = [map {['', $_]} @{$method->{'return'}->{children}}]; while (my $ret = shift(@$ret_test)) { next if $ret->[1]->{nullable}; if ($ret->[1]->{page_total_entries}) { my $strs = []; push(@$strs, "\$data =& \$this->getData();"); my $php_var = sprintf('$data%s->%s', $ret->[0], $ret->[1]->{name}); push(@$strs, ($indstr x $indent) . "return $php_var;"); return join("\n", @$strs); } next unless $ret->[1]->{children}; my $next_node = $ret->[0].'->'.$ret->[1]->{name}; $next_node .= '[0]' if $ret->[1]->{multiple}; push(@$ret_test, map {[$next_node, $_]} @{$ret->[1]->{children}}); } return "return 0;"; } sub make_entries_per_page { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $ret_test = [map {['', $_]} @{$method->{'return'}->{children}}]; while (my $ret = shift(@$ret_test)) { next if $ret->[1]->{nullable}; if ($ret->[1]->{page_entries_per_page}) { my $strs = []; push(@$strs, "\$data =& \$this->getData();"); my $php_var = sprintf('$data%s->%s', $ret->[0], $ret->[1]->{name}); push(@$strs, ($indstr x $indent) . "return $php_var;"); return join("\n", @$strs); } next unless $ret->[1]->{children}; my $next_node = $ret->[0].'->'.$ret->[1]->{name}; $next_node .= '[0]' if $ret->[1]->{multiple}; push(@$ret_test, map {[$next_node, $_]} @{$ret->[1]->{children}}); } return "return 0;"; } sub make_current_page { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $ret_test = [map {['', $_]} @{$method->{'return'}->{children}}]; while (my $ret = shift(@$ret_test)) { next if $ret->[1]->{nullable}; if ($ret->[1]->{page_current_page}) { my $strs = []; push(@$strs, "\$data =& \$this->getData();"); my $php_var = sprintf('$data%s->%s', $ret->[0], $ret->[1]->{name}); push(@$strs, ($indstr x $indent) . "return $php_var;"); return join("\n", @$strs); } elsif ($ret->[1]->{page_current_offset}) { my $orig = $ret->[1]->{page_current_offset_origin} ? " - $ret->[1]->{page_current_offset_origin}" : ""; my $strs = []; push(@$strs, "\$data =& \$this->getData();"); push(@$strs, ($indstr x $indent) . "\$epp = \$this->getEntriesPerPage();"); push(@$strs, ($indstr x $indent) . "if (\$epp == 0) {"); push(@$strs, ($indstr x ($indent + 1)) . "return 0;"); push(@$strs, ($indstr x $indent) . "}"); my $php_var = sprintf('$data%s->%s', $ret->[0], $ret->[1]->{name}); push(@$strs, ($indstr x $indent) . "return (($php_var$orig) / \$epp) + 1;"); return join("\n", @$strs); } next unless $ret->[1]->{children}; my $next_node = $ret->[0].'->'.$ret->[1]->{name}; $next_node .= '[0]' if $ret->[1]->{multiple}; push(@$ret_test, map {[$next_node, $_]} @{$ret->[1]->{children}}); } return "return 0;"; } sub make_page_param { my ($method, $indent, $indstr) = @_; $indent ||= 0; $indstr ||= " "; my $strs = []; foreach my $param (@{$method->{params}}) { if ($param->{page_param_number}) { push(@$strs, ($indstr x $indent) . "\$params['$param->{name}'] = \$page;"); } elsif ($param->{page_param_offset}) { my $orig = $param->{page_param_offset_origin} ? " + $param->{page_param_offset_origin}" : ""; push(@$strs, ($indstr x $indent) . "\$params['$param->{name}'] = (\$page - 1) * \$size$orig;"); } elsif ($param->{page_param_size}) { push(@$strs, ($indstr x $indent) . "\$params['$param->{name}'] = \$size;"); } } my $str = join("\n", @$strs); $str =~ s/^\s+//; return $str; } sub sort_keys { my $hashref = shift; return sort keys %$hashref; } sub env_param { return sub { my $val = shift; unless ($val =~ s/^\$(.*)$/getenv('$1')/) { $val = "'$val'"; } return $val; }; } sub node_nullable { my $node = shift; my $path = $node->path; foreach my $p (@$path) { return 1 if $p->nullable; } return 0; } sub node_access { my $node = shift; my $with_array = shift; return "" if $node->depth < 2; my $path = $node->path(2); my $access = [""]; foreach my $p (@$path) { push(@$access, $p->name); $access->[-1] .= "[0]" if $p->multiple && ($with_array || $p != $node); } return join("->", @$access); } sub author_name { return sub { my $author = shift; my ($name, $email) = ($author =~ /^(.*?)\s+<(.*?)>$/); my $user = (split(/\@/, $email))[0]; return $name; }; } sub author_user { return sub { my $author = shift; my ($name, $email) = ($author =~ /^(.*?)\s+<(.*?)>$/); my $user = (split(/\@/, $email))[0]; return $user; }; } sub author_email { return sub { my $author = shift; my ($name, $email) = ($author =~ /^(.*?)\s+<(.*?)>$/); my $user = (split(/\@/, $email))[0]; return $email; }; } sub now_strftime { my $fmt = shift; return strftime($fmt, localtime()); } 1;
gitpan/WSST
lib/WSST/Templates/php/lib.pm
Perl
bsd-3-clause
13,583
/* Part of dcgutils Copyright 2012-2015 Samer Abdallah (Queen Mary University of London; UCL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ :- module(dcg_shell, [ dcgshell/2 , dcgshell/3 , dcgshell/4 , make//0 , help/3 , time//1, time//2, time//3 , profile_phrase//1 , trace//1 , catch//3 ]). :- module_transparent dcgshell/2, dcgshell/3, dcgshell/4, dcgshell_x/6, shell_prompt/4, make//0. :- use_module(library(termutils), [get_key/2]). %% dcgshell( +Interp, +Id, ?S1, ?S2) is semidet. %% dcgshell( +Id, ?S1, ?S2) is semidet. %% dcgshell( ?S1, ?S2) is semidet. % % Runs an interactive shell where typed commands are interepreted % as DCG phrases. The cumulative result of all these phrases takes % the DCG state from S1 to S2. If present, Id is used to identify % the shell and is written as part of the prompt. The default prompt % is 'dcg'. % % Pressing Ctrl-D at the prompt or typing 'halt' or 'end_of_file' % terminates the shell unifying S2 with the final state. The command % 'fail' terminates the shell and causes dcgshell/2 or dcgshell/3 as % a whole to fail, without leaving any choice points. % % dcgshell/4 allows the specification of an alternate interpreter % other than call_dcg/3, which is the default in the other forms. % % Special commands % * module(M) % Switches context module of interpreter to M. % * interp(I) % Change to a new interpreter. Eg, interp(time) will % cause timing information to be printed after each % command is interpreted. % * X^Phrase % Causes Phrase to be interpreted after binding X to the % id of the current interpreter. Since the id can be any % term, you can use it as simple sort of environment in which % you can keep data that might be useful later on. dcgshell(S1,S2) :- dcgshell(call_dcg,dcg,S1,S2). dcgshell(Id,S1,S2) :- dcgshell(call_dcg,Id,S1,S2). dcgshell(Interp,Id,S1,S2) :- !, shell_prompt(Id,Interp,Goal,Bindings), dcgshell_x(Goal,Bindings,Interp,Id,S1,S2). shell_prompt(Id,Interp,Goal,Bindings) :- context_module(Mod), format(atom(NA),'~p: ~p (~W) >> ',[Mod,Interp,Id,[portray(true),quoted(true),max_depth(3)]]), read_history(h,'!h',[trace,end_of_file],NA, Goal, Bindings). dcgshell_x(fail,_,_,_,_,_) :- !, fail. dcgshell_x(halt,_,_,_,S,S) :- !, nl. dcgshell_x(end_of_file,_,_,_,S,S) :- !, nl. dcgshell_x(module(Mod),_,Interp,Id,S1,S2) :- !, @(dcgshell(Interp,Id,S1,S2), Mod). dcgshell_x(interp(Int2),_,Int1,Id,S1,S2) :- !, format('Changing interpreter from ~w to ~w.\n',[Int1,Int2]), dcgshell(Int2,Id,S1,S2). dcgshell_x(X^Goal,Bindings,Interp,Id,S1,S2) :- !, X=Id, dcgshell_x(Goal,Bindings,Interp,Id,S1,S2). dcgshell_x(Goal,Bindings,Interp,Id,S0,S2) :- !, catch( ( current_prolog_flag(prompt_alternatives_on,PromptOn), call(Interp,Goal,S0,S1), include(dcg_shell:bound,Bindings,BoundBindings), ( BoundBindings=[] -> ( PromptOn=determinism -> write('\nok? [.,<return>=yes,;=no] '), dcg_shell:get_key([';','\r','.'],K), (K='\r';K='.'), nl ; true) ; dcg_shell:check_bindings(BoundBindings) ), write(' Yes.\n\n') ; write('\n No.\n'), S0=S1 ), Exception, ( Exception=dcg_shell:escape(Ex) -> throw(Ex) ; nl, print_message(error,Exception), S1=S0, nl) ), !, dcgshell(Interp,Id,S1,S2). bound(_=Value) :- nonvar(Value). % useful DCG shell commands %% make// is det. % % DCG shell command to update loaded files, just as with make/0. make --> {make}. %% help(+Topic)// is det. % % Look-up help on Topic, just as with help/1. help(A) --> {help(A)}. %% time( +G:phrase(S))// is semidet. %% time( +G:pred(A,S,S), ?X:A)// is semidet. %% time( +G:pred(A,B,S,S), ?X:A, ?Y:B)// is semidet. % % Time execution of DCG phrase G. Any extra arguments are passed % to G as in call/N. :- meta_predicate time(//,?,?), time(3,?,?,?), time(4,?,?,?,?). time(G,A,B) :- time(call_dcg(G,A,B)). time(G,A,B,C) :- time(call(G,A,B,C)). time(G,A,B,C,D) :- time(call(G,A,B,C,D)). %% profile_phrase( +G:phrase(_))// is semidet. % % Profile execution of DCG phrase G. :- meta_predicate profile_phrase(//,?,?). profile_phrase(G,A,B) :- profile(call_dcg(G,A,B)). :- meta_predicate catch(//,?,//,?,?). catch(Phrase,Ex,Handler,S1,S2) :- catch(call_dcg(Phrase,S1,S2), Ex, call_dcg(Handler,S1,S2)). :- meta_predicate trace(//,?,?). trace(Goal,S1,S2) :- setup_call_cleanup( trace, call_dcg(Goal,S1,S2), notrace). % ----------------------------- Extract from meta.pl ------------------------ %% check_bindings( +Bindings:list(binding)) is semidet. % % Allow user to review variable bindings. Fails if the % user rejects the current set of values. % Bindings is a list of Name=Value pairs, ie % == % binding ---> (atom=term). % == % % The current Prolog flags are used to determine the print format % (see answer_write_options in current_prolog_flag/2). check_bindings([]) :- nl. % !! Do we always want this? check_bindings([B|BT]) :- current_prolog_flag(answer_write_options,Opts), write_bindings(Opts,[B|BT]), get_key([';','\r','.'],K), (K='\r';K='.'), nl. %% write_bindings( +Bindings:list(binding)) is semidet. % % Allow user to view variable bindings without any interaction. % Bindings is a list of Name=Value pairs. % % The current Prolog flags are used to determine the print format % (see answer_write_options in current_prolog_flag/2). write_bindings([]) :- !. % !! Do we always want this? write_bindings(B) :- current_prolog_flag(answer_write_options,Opts), write_bindings(Opts,B), nl, nl. write_bindings(Opts,[N=V]) :- ( true % nonvar(V) -> format('\n ~w = ~@ ',[N,write_term(V,Opts)]) ; true ). write_bindings(Opts,[N=V,X|T]) :- ( true % nonvar(V) -> format('\n ~w = ~@ ',[N,write_term(V,Opts)]) ; true ), write_bindings(Opts,[X|T]).
TeamSPoon/logicmoo_workspace
packs_lib/dcgutils/prolog/dcg_shell.pl
Perl
mit
6,415
package Bootylite::Renderer::Markdown; use Mojo::Base 'Bootylite::Renderer'; use Text::Markdown; has extension => 'md'; has parser => sub { Text::Markdown->new(empty_element_suffix => '>') }; sub render { shift->parser->markdown(shift) }; !! 42; __END__
Real-Currents/bootylite
lib/Bootylite/Renderer/Markdown.pm
Perl
mit
259
package # Date::Manip::TZ::etgmt00; # Copyright (c) 2008-2014 Sullivan Beck. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # This file was automatically generated. Any changes to this file will # be lost the next time 'tzdata' is run. # Generated on: Fri Nov 21 10:41:37 EST 2014 # Data version: tzdata2014j # Code version: tzcode2014j # This module contains data from the zoneinfo time zone database. The original # data was obtained from the URL: # ftp://ftp.iana.org/tz use strict; use warnings; require 5.010000; our (%Dates,%LastRule); END { undef %Dates; undef %LastRule; } our ($VERSION); $VERSION='6.48'; END { undef $VERSION; } %Dates = ( 1 => [ [ [1,1,2,0,0,0],[1,1,2,0,0,0],'+00:00:00',[0,0,0], 'GMT',0,[9999,12,31,0,0,0],[9999,12,31,0,0,0], '0001010200:00:00','0001010200:00:00','9999123100:00:00','9999123100:00:00' ], ], ); %LastRule = ( ); 1;
nriley/Pester
Source/Manip/TZ/etgmt00.pm
Perl
bsd-2-clause
1,032
package Mo::chain;my$M="Mo::"; $VERSION=0.31; *{$M.'chain::e'}=sub{my($P,$e,$o)=@_;$o->{chain}=sub{my($m,$n,%a)=@_;$a{chain}or return$m;sub{$#_?($m->(@_),return$_[0]):$m->(@_)}}};
bdurrow/design-center
tools/cf-sketch/perl-lib/Mo-0.31/lib/Mo/chain.pm
Perl
mit
180
package DDG::Goodie::Anagram; # ABSTRACT: Returns an anagram based on the supplied query. use strict; use DDG::Goodie; use List::Util qw( shuffle ); my @keywords = qw(anagram anagrams); my @connectors = qw(of for); my @commands = qw(find show); my @triggers; foreach my $kw (@keywords) { foreach my $con (@connectors) { push @triggers, join(' ', $kw, $con); # anagram for, anagrams of, etc. foreach my $com (@commands) { push @triggers, join(' ', $com, $kw, $con); # find anagram of, show anagrams for, etc. } } push @triggers, $kw; # Trigger order appears to matter, so the bare keywords after the others } triggers start => @triggers; zci answer_type => "anagram"; zci is_cached => 1; primary_example_queries "anagram of filter"; secondary_example_queries "find anagram for partial men"; description "find the anagram(s) of your query"; name "Anagram"; code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Anagram.pm"; category "transformations"; topics "words_and_games"; attribution github => ["https://github.com/loganom", 'loganom'], github => ["https://github.com/beardlybread", "beardlybread"], github => ['https://github.com/gdrooid', 'gdrooid'], email => ['gdrooid@openmailbox.org', 'gdrooid'], github => ["https://github.com/Mailkov", "Melchiorre Alastra"]; # Calculate the frequency of the characters in a string sub calc_freq { my ($str) = @_; my %freqs; for (split //, lc $str) { $freqs{$_} += 1; } return \%freqs; } my %words = map { chomp; ($_ => undef); } share('words')->slurp; # This will cache letter frequencies as they get used. my %easter_eggs = (voldemort => 'Tom Riddle'); handle remainder => sub { my $word = $_; $word =~ s/^"(.*)"$/$1/; return unless $word; # Need a word. # Do some normalization to allow for multi-word matches. my $match_word = lc $word; $match_word =~ s/[^a-z]//g; return unless $match_word; # Still need a word! my $len = length $match_word; my @output; if (my $egg = $easter_eggs{lc $word}) { push @output, $egg; } unless (@output) { my $query_freq = calc_freq($match_word); # Calculate the letter-freq of the query foreach (keys %words) { if (/^[$match_word]{$len}$/i) { my $w = lc; next if $w eq $match_word; # Skip word if it's the same as the query my $f = $words{$w} // calc_freq($w); # Use cached word letter-freq or calculate new $words{$w} //= $f; # Cache word letter-freq if we didn't have it. my $is_anagram = 1; for (keys %$f) { if ($f->{$_} != $query_freq->{$_}) { # The letter-freq in a dictionary word must equal that of the query $is_anagram = 0; last; } } push(@output, $_) if $is_anagram; } } } my ($response, $operation); if (@output) { $response = join ', ', sort { $a cmp $b } @output; $operation = 'Anagrams of'; } else { return; } return $response, structured_answer => { input => [html_enc($word)], operation => $operation, result => html_enc($response) }; }; 1;
shyamalschandra/zeroclickinfo-goodies
lib/DDG/Goodie/Anagram.pm
Perl
apache-2.0
3,490
#! /usr/bin/perl use strict; use File::Copy qw(copy); use File::Temp qw(tempfile tempdir); use Test::More; my @tests = (); my $current_test = ""; my $test_exec = "./import-cred-test"; sub test_import_data { my $data = ""; my ($cert, $key); open($cert, "testcred.cert"); $data .= join("", <$cert>); open($key, "testcred.key"); $data .= join("", <$key>); ok(system($test_exec, "-o", "0", "-i", $data) == 0, "$current_test"); } sub test_import_file { my ($fh, $tempfile); my $data = ""; my ($cert, $key); ($fh, $tempfile) = tempfile(); open($cert, "testcred.cert"); $data .= join("", <$cert>); open($key, "testcred.key"); $data .= join("", <$key>); $fh->write($data); ok(system($test_exec, "-o", "1", "-i", "p=$tempfile") == 0, "$current_test"); } sub test_import_dir { my $tempdir = tempdir(CLEANUP => 1); my $data = ""; copy("testcred.cert", "$tempdir/hostcert.pem"); chmod(0644, "$tempdir/hostcert.pem"); copy("testcred.key", "$tempdir/hostkey.pem"); chmod(0600, "$tempdir/hostkey.pem"); ok(system($test_exec, "-o", "1", "-i", "p=$tempdir") == 0, "$current_test"); } push(@tests, 'test_import_data'); push(@tests, 'test_import_file'); push(@tests, 'test_import_dir'); plan tests => scalar(@tests); foreach (@tests) { $current_test = $_; eval $current_test; }
gridcf/gct
gsi/gssapi/source/test/import-cred-test.pl
Perl
apache-2.0
1,398
package OpenResty::QuasiQuote::Validator::Compiler; use Parse::RecDescent; { my $ERRORS; package Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler; use strict; use vars qw($skip $AUTOLOAD ); $skip = '\s*'; { local $SIG{__WARN__} = sub {0}; # PRETEND TO BE IN Parse::RecDescent NAMESPACE *Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::AUTOLOAD = sub { no strict 'refs'; $AUTOLOAD =~ s/^Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler/Parse::RecDescent/; goto &{$AUTOLOAD}; } } push @Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::ISA, 'Parse::RecDescent'; # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::scalar { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"scalar"}; Parse::RecDescent::_trace(q{Trying rule: [scalar]}, Parse::RecDescent::_tracefirst($_[1]), q{scalar}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [type <commit> attr]}, Parse::RecDescent::_tracefirst($_[1]), q{scalar}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{scalar}); %item = (__RULE__ => q{scalar}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [type]}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [type]>>}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [type]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $item{q{type}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying repeated subrule: [attr]}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $expectation->is(q{attr})->at($text); unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::attr, 0, 100000000, $_noactions,$expectation,undef))) { Parse::RecDescent::_trace(q{<<Didn't match repeated subrule: [attr]>>}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched repeated subrule: [attr]<< (} . @$_tok . q{ times)}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $item{q{attr(s?)}} = $_tok; push @item, $_tok; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $attrs = { map { @$_ } @{ $item[3] } }; my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; my $code; my $code2 = $item[1]; my $required; if (delete $attrs->{required}) { $code .= <<"_EOC_"; defined or die qq{Value$for_topic required.\\n}; _EOC_ $required = 1; } if (my $args = delete $attrs->{match}) { my ($pat, $desc) = @$args; $desc = eval $desc; $code2 .= "$pat or die qq{Invalid value$for_topic: $desc expected.\\n};\n"; } if (delete $attrs->{nonempty}) { $code2 .= "length or die qq{Invalid value$for_topic: Nonempty scalar expected.\\n};\n"; } if (my $args = delete $attrs->{allowed}) { my $values = join ', ', @$args; my $expr = join ' or ', map { "\$_ eq $_" } @$args; $code2 .= "$expr or die qq{Invalid value$for_topic: Allowed values are $values.\\n};\n"; } if ($required) { $code .= $code2; } else { $code .= "if (defined) {\n$code2}\n"; } if (my $args = delete $attrs->{default}) { if ($required) { die "validator: Required scalar cannot take default value at the same time.\n"; } my $default = $args->[0] or die "validator: :default attribute takes one argument.\n"; $code .= <<"_EOC_"; else { \$_ = $default; } _EOC_ } if (my $args = delete $attrs->{to}) { my $var = $args->[0]; $code .= "$var = \$_;\n"; } if (%$attrs) { die "validator: Bad attribute for scalar: ", join(" ", keys %$attrs), "\n"; } #$code . $code2; $code; }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [type <commit> attr]<<}, Parse::RecDescent::_tracefirst($text), q{scalar}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{scalar}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{scalar}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{scalar}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{scalar}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::variable { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"variable"}; Parse::RecDescent::_trace(q{Trying rule: [variable]}, Parse::RecDescent::_tracefirst($_[1]), q{variable}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: []}, Parse::RecDescent::_tracefirst($_[1]), q{variable}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{variable}); %item = (__RULE__ => q{variable}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{variable}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { Text::Balanced::extract_variable($text) }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: []<<}, Parse::RecDescent::_tracefirst($text), q{variable}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{variable}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{variable}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{variable}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{variable}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::value { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"value"}; Parse::RecDescent::_trace(q{Trying rule: [value]}, Parse::RecDescent::_tracefirst($_[1]), q{value}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [hash]}, Parse::RecDescent::_tracefirst($_[1]), q{value}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{value}); %item = (__RULE__ => q{value}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [hash]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::hash($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [hash]>>}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [hash]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $item{q{hash}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{>>Matched production: [hash]<<}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [array]}, Parse::RecDescent::_tracefirst($_[1]), q{value}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; $text = $_[1]; my $_savetext; @item = (q{value}); %item = (__RULE__ => q{value}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [array]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::array($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [array]>>}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [array]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $item{q{array}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{>>Matched production: [array]<<}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [scalar]}, Parse::RecDescent::_tracefirst($_[1]), q{value}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[2]; $text = $_[1]; my $_savetext; @item = (q{value}); %item = (__RULE__ => q{value}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [scalar]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::scalar($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [scalar]>>}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [scalar]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $item{q{scalar}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{>>Matched production: [scalar]<<}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error...>]}, Parse::RecDescent::_tracefirst($_[1]), q{value}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[3]; my $_savetext; @item = (q{value}); %item = (__RULE__ => q{value}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error...>]}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if (1) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error...>]<<}, Parse::RecDescent::_tracefirst($text), q{value}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{value}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{value}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{value}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{value}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::lhs { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"lhs"}; Parse::RecDescent::_trace(q{Trying rule: [lhs]}, Parse::RecDescent::_tracefirst($_[1]), q{lhs}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [variable '~~']}, Parse::RecDescent::_tracefirst($_[1]), q{lhs}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{lhs}); %item = (__RULE__ => q{lhs}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [variable]}, Parse::RecDescent::_tracefirst($text), q{lhs}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::variable($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [variable]>>}, Parse::RecDescent::_tracefirst($text), q{lhs}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [variable]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{lhs}, $tracelevel) if defined $::RD_TRACE; $item{q{variable}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying terminal: ['~~']}, Parse::RecDescent::_tracefirst($text), q{lhs}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{'~~'})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\~\~//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{lhs}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { "{\nlocal *_ = \\( $item[1] );\n" }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [variable '~~']<<}, Parse::RecDescent::_tracefirst($text), q{lhs}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{lhs}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{lhs}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{lhs}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{lhs}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::attr { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"attr"}; Parse::RecDescent::_trace(q{Trying rule: [attr]}, Parse::RecDescent::_tracefirst($_[1]), q{attr}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [':' ident '(' <commit> <leftop: argument /,/ argument> ')']}, Parse::RecDescent::_tracefirst($_[1]), q{attr}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{attr}); %item = (__RULE__ => q{attr}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: [':']}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\://) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying subrule: [ident]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{ident})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::ident($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [ident]>>}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [ident]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $item{q{ident}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying terminal: ['(']}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{'('})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING2__}=$&; Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying operator: [<leftop: argument /,/ argument>]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $expectation->is(q{<leftop: argument /,/ argument>})->at($text); $_tok = undef; OPLOOP: while (1) { $repcount = 0; my @item; # MATCH LEFTARG Parse::RecDescent::_trace(q{Trying subrule: [argument]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{argument})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::argument($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [argument]>>}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [argument]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $item{q{argument}} = $_tok; push @item, $_tok; } $repcount++; my $savetext = $text; my $backtrack; # MATCH (OP RIGHTARG)(s) while ($repcount < 100000000) { $backtrack = 0; Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{/,/})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) { $expectation->failed(); Parse::RecDescent::_trace(q{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__PATTERN1__}=$&; pop @item; if (defined $1) {push @item, $item{'argument(s)'}=$1; $backtrack=1;} Parse::RecDescent::_trace(q{Trying subrule: [argument]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{argument})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::argument($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [argument]>>}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [argument]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $item{q{argument}} = $_tok; push @item, $_tok; } $savetext = $text; $repcount++; } $text = $savetext; pop @item if $backtrack; unless (@item) { undef $_tok; last } $_tok = [ @item ]; last; } unless ($repcount>=1) { Parse::RecDescent::_trace(q{<<Didn't match operator: [<leftop: argument /,/ argument>]>>}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched operator: [<leftop: argument /,/ argument>]<< (return value: [} . qq{@{$_tok||[]}} . q{]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; push @item, $item{'argument(s)'}=$_tok||[]; Parse::RecDescent::_trace(q{Trying terminal: [')']}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{')'})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING3__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { [ $item[2] => [ @{ $item[5] } ] ] }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [':' ident '(' <commit> <leftop: argument /,/ argument> ')']<<}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [':' <commit> ident]}, Parse::RecDescent::_tracefirst($_[1]), q{attr}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; $text = $_[1]; my $_savetext; @item = (q{attr}); %item = (__RULE__ => q{attr}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: [':']}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\://) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying subrule: [ident]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{ident})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::ident($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [ident]>>}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [ident]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $item{q{ident}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { [ $item[3] => 1 ] }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [':' <commit> ident]<<}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error?:...> <reject>]}, Parse::RecDescent::_tracefirst($_[1]), q{attr}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[2]; my $_savetext; @item = (q{attr}); %item = (__RULE__ => q{attr}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error?:...>]}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if ($commit) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Rejecting production<< (found <reject>)}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; undef $return; $_tok = undef; last unless defined $_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error?:...> <reject>]<<}, Parse::RecDescent::_tracefirst($text), q{attr}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{attr}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{attr}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{attr}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{attr}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::ident { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"ident"}; Parse::RecDescent::_trace(q{Trying rule: [ident]}, Parse::RecDescent::_tracefirst($_[1]), q{ident}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [/^[A-Za-z]\\w*/]}, Parse::RecDescent::_tracefirst($_[1]), q{ident}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{ident}); %item = (__RULE__ => q{ident}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: [/^[A-Za-z]\\w*/]}, Parse::RecDescent::_tracefirst($text), q{ident}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^[A-Za-z]\w*)//) { $expectation->failed(); Parse::RecDescent::_trace(q{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__PATTERN1__}=$&; Parse::RecDescent::_trace(q{>>Matched production: [/^[A-Za-z]\\w*/]<<}, Parse::RecDescent::_tracefirst($text), q{ident}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{ident}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{ident}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{ident}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{ident}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::key { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"key"}; Parse::RecDescent::_trace(q{Trying rule: [key]}, Parse::RecDescent::_tracefirst($_[1]), q{key}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: []}, Parse::RecDescent::_tracefirst($_[1]), q{key}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{key}); %item = (__RULE__ => q{key}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { extract_delimited($text, '"') }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { eval $item[1] }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION2__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: []<<}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [ident]}, Parse::RecDescent::_tracefirst($_[1]), q{key}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; $text = $_[1]; my $_savetext; @item = (q{key}); %item = (__RULE__ => q{key}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [ident]}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::ident($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [ident]>>}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [ident]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; $item{q{ident}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{>>Matched production: [ident]<<}, Parse::RecDescent::_tracefirst($text), q{key}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{key}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{key}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{key}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{key}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::validator { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"validator"}; Parse::RecDescent::_trace(q{Trying rule: [validator]}, Parse::RecDescent::_tracefirst($_[1]), q{validator}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [lhs value <commit> eofile]}, Parse::RecDescent::_tracefirst($_[1]), q{validator}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{validator}); %item = (__RULE__ => q{validator}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying repeated subrule: [lhs]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $expectation->is(q{})->at($text); unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::lhs, 0, 1, $_noactions,$expectation,undef))) { Parse::RecDescent::_trace(q{<<Didn't match repeated subrule: [lhs]>>}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched repeated subrule: [lhs]<< (} . @$_tok . q{ times)}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $item{q{lhs(?)}} = $_tok; push @item, $_tok; Parse::RecDescent::_trace(q{Trying subrule: [value]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{value})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::value($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [value]>>}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [value]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $item{q{value}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying subrule: [eofile]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{eofile})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::eofile($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [eofile]>>}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [eofile]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $item{q{eofile}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { if (@{$item[1]}) { $item[1][0] . $item[2] . "}\n"; } else { $item[2] } }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [lhs value <commit> eofile]<<}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error...>]}, Parse::RecDescent::_tracefirst($_[1]), q{validator}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; my $_savetext; @item = (q{validator}); %item = (__RULE__ => q{validator}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error...>]}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if (1) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error...>]<<}, Parse::RecDescent::_tracefirst($text), q{validator}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{validator}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{validator}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{validator}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{validator}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::argument { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"argument"}; Parse::RecDescent::_trace(q{Trying rule: [argument]}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [/^\\d+/]}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{argument}); %item = (__RULE__ => q{argument}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: [/^\\d+/]}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^\d+)//) { $expectation->failed(); Parse::RecDescent::_trace(q{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__PATTERN1__}=$&; Parse::RecDescent::_trace(q{>>Matched production: [/^\\d+/]<<}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['[]']}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; $text = $_[1]; my $_savetext; @item = (q{argument}); %item = (__RULE__ => q{argument}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['[]']}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\[\]//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{>>Matched production: ['[]']<<}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [variable]}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[2]; $text = $_[1]; my $_savetext; @item = (q{argument}); %item = (__RULE__ => q{argument}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [variable]}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::variable($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [variable]>>}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [variable]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $item{q{variable}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{>>Matched production: [variable]<<}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: []}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[3]; $text = $_[1]; my $_savetext; @item = (q{argument}); %item = (__RULE__ => q{argument}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { extract_quotelike($text) }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { $item[1] }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION2__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: []<<}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: []}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[4]; $text = $_[1]; my $_savetext; @item = (q{argument}); %item = (__RULE__ => q{argument}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { extract_codeblock($text) }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { "do $item[1]" }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION2__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: []<<}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error...>]}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[5]; my $_savetext; @item = (q{argument}); %item = (__RULE__ => q{argument}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error...>]}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if (1) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error...>]<<}, Parse::RecDescent::_tracefirst($text), q{argument}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{argument}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{argument}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{argument}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{argument}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::array { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"array"}; Parse::RecDescent::_trace(q{Trying rule: [array]}, Parse::RecDescent::_tracefirst($_[1]), q{array}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['[' <commit> array_elem ']' attr]}, Parse::RecDescent::_tracefirst($_[1]), q{array}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{array}); %item = (__RULE__ => q{array}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['[']}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\[//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying subrule: [array_elem]}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{array_elem})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::array_elem($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [array_elem]>>}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [array_elem]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $item{q{array_elem}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying terminal: [']']}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{']'})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\]//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING2__}=$&; Parse::RecDescent::_trace(q{Trying repeated subrule: [attr]}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $expectation->is(q{attr})->at($text); unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::attr, 0, 100000000, $_noactions,$expectation,undef))) { Parse::RecDescent::_trace(q{<<Didn't match repeated subrule: [attr]>>}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched repeated subrule: [attr]<< (} . @$_tok . q{ times)}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $item{q{attr(s?)}} = $_tok; push @item, $_tok; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $attrs = { map { @$_ } @{ $item[5] } }; my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; my $required; my ($code, $code2); if ($required = delete $attrs->{required}) { $code .= <<"_EOC_"; defined or die qq{Value$for_topic required.\\n}; _EOC_ #$required = 1; } my $code3 = ''; if (my $args = delete $attrs->{nonempty}) { $code3 .= <<"_EOC_"; \@\$_ or die qq{Array cannot be empty$for_topic.\\n}; _EOC_ } $code2 .= <<"_EOC_"; ref and ref eq 'ARRAY' or die qq{Invalid value$for_topic: Array expected.\\n}; ${code3}for (\@\$_) \{ $item[3]} _EOC_ if ($required) { $code .= $code2; } else { $code .= "if (defined) {\n$code2}\n"; } if (my $args = delete $attrs->{default}) { if ($required) { die "validator: Required array cannot take default value at the same time.\n"; } my $default = $args->[0] or die "validator: :default attribute takes one argument.\n"; $code .= <<"_EOC_"; else { \$_ = $default; } _EOC_ } if (my $args = delete $attrs->{to}) { my $var = $args->[0]; $code .= "$var = \$_;\n"; } if (%$attrs) { die "Bad attribute for array: ", join(" ", keys %$attrs), "\n"; } $code; }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['[' <commit> array_elem ']' attr]<<}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error?:...> <reject>]}, Parse::RecDescent::_tracefirst($_[1]), q{array}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; my $_savetext; @item = (q{array}); %item = (__RULE__ => q{array}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error?:...>]}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if ($commit) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Rejecting production<< (found <reject>)}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; undef $return; $_tok = undef; last unless defined $_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error?:...> <reject>]<<}, Parse::RecDescent::_tracefirst($text), q{array}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{array}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{array}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{array}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{array}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::hash { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"hash"}; Parse::RecDescent::_trace(q{Trying rule: [hash]}, Parse::RecDescent::_tracefirst($_[1]), q{hash}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['\{' <commit> <leftop: pair /,/ pair> /,?/ '\}' attr]}, Parse::RecDescent::_tracefirst($_[1]), q{hash}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{hash}); %item = (__RULE__ => q{hash}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['\{']}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\{//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying operator: [<leftop: pair /,/ pair>]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $expectation->is(q{<leftop: pair /,/ pair>})->at($text); $_tok = undef; OPLOOP: while (1) { $repcount = 0; my @item; # MATCH LEFTARG Parse::RecDescent::_trace(q{Trying subrule: [pair]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{pair})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::pair($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [pair]>>}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [pair]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $item{q{pair}} = $_tok; push @item, $_tok; } $repcount++; my $savetext = $text; my $backtrack; # MATCH (OP RIGHTARG)(s) while ($repcount < 100000000) { $backtrack = 0; Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{/,/})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) { $expectation->failed(); Parse::RecDescent::_trace(q{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__PATTERN1__}=$&; pop @item; if (defined $1) {push @item, $item{'pair(s?)'}=$1; $backtrack=1;} Parse::RecDescent::_trace(q{Trying subrule: [pair]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{pair})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::pair($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [pair]>>}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [pair]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $item{q{pair}} = $_tok; push @item, $_tok; } $savetext = $text; $repcount++; } $text = $savetext; pop @item if $backtrack; $_tok = [ @item ]; last; } unless ($repcount>=0) { Parse::RecDescent::_trace(q{<<Didn't match operator: [<leftop: pair /,/ pair>]>>}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched operator: [<leftop: pair /,/ pair>]<< (return value: [} . qq{@{$_tok||[]}} . q{]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; push @item, $item{'pair(s?)'}=$_tok||[]; Parse::RecDescent::_trace(q{Trying terminal: [/,?/]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{/,?/})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,?)//) { $expectation->failed(); Parse::RecDescent::_trace(q{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__PATTERN2__}=$&; Parse::RecDescent::_trace(q{Trying terminal: ['\}']}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{'\}'})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\}//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING2__}=$&; Parse::RecDescent::_trace(q{Trying repeated subrule: [attr]}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $expectation->is(q{attr})->at($text); unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::attr, 0, 100000000, $_noactions,$expectation,undef))) { Parse::RecDescent::_trace(q{<<Didn't match repeated subrule: [attr]>>}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched repeated subrule: [attr]<< (} . @$_tok . q{ times)}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $item{q{attr(s?)}} = $_tok; push @item, $_tok; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $attrs = { map { @$_ } @{ $item[6] } }; my $pairs = $item[3]; my $topic = $arg{topic}; ### $attrs my $for_topic = $topic ? " for $topic" : ""; my ($code, $code2); my $required; if (delete $attrs->{required}) { $code .= <<"_EOC_"; defined or die qq{Value$for_topic required.\\n}; _EOC_ $required = 1; } my $code3 = ''; if (delete $attrs->{nonempty}) { $code3 .= <<"_EOC_"; \%\$_ or die qq{Hash cannot be empty$for_topic.\\n}; _EOC_ } $code2 .= <<"_EOC_" . $code3 . join('', map { $_->[1] } @$pairs); ref and ref eq 'HASH' or die qq{Invalid value$for_topic: Hash expected.\\n}; _EOC_ my @keys = map { $_->[0] } @$pairs; my $cond = join ' or ', map { '$_ eq "' . quotemeta($_) . '"' } @keys; $code2 .= <<"_EOC_"; for (keys \%\$_) { $cond or die qq{Unrecognized key in hash$for_topic: \$_\\n}; } _EOC_ if ($required) { $code .= $code2 } else { $code .= "if (defined) {\n$code2}\n"; } if (my $args = delete $attrs->{to}) { my $var = $args->[0]; $code .= "$var = \$_;\n"; } if (%$attrs) { die "Bad attribute for hash: ", join(" ", keys %$attrs), "\n"; } $code; }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['\{' <commit> <leftop: pair /,/ pair> /,?/ '\}' attr]<<}, Parse::RecDescent::_tracefirst($text), q{hash}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{hash}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{hash}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{hash}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{hash}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::array_elem { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"array_elem"}; Parse::RecDescent::_trace(q{Trying rule: [array_elem]}, Parse::RecDescent::_tracefirst($_[1]), q{array_elem}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [value]}, Parse::RecDescent::_tracefirst($_[1]), q{array_elem}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{array_elem}); %item = (__RULE__ => q{array_elem}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{array_elem}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { if ($arg{topic}) { $arg{topic} . " " } else { "" } }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{Trying subrule: [value]}, Parse::RecDescent::_tracefirst($text), q{array_elem}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{value})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::value($thisparser,$text,$repeating,$_noactions,sub { return [topic => $item[1] . 'array element'] }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [value]>>}, Parse::RecDescent::_tracefirst($text), q{array_elem}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [value]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{array_elem}, $tracelevel) if defined $::RD_TRACE; $item{q{value}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{>>Matched production: [value]<<}, Parse::RecDescent::_tracefirst($text), q{array_elem}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{array_elem}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{array_elem}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{array_elem}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{array_elem}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::pair { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"pair"}; Parse::RecDescent::_trace(q{Trying rule: [pair]}, Parse::RecDescent::_tracefirst($_[1]), q{pair}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [key <commit> ':' value]}, Parse::RecDescent::_tracefirst($_[1]), q{pair}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{pair}); %item = (__RULE__ => q{pair}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying subrule: [key]}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::key($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [key]>>}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [key]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $item{q{key}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying directive: [<commit>]}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $_tok = do { $commit = 1 }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{Trying terminal: [':']}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{':'})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\://) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying subrule: [value]}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; if (1) { no strict qw{refs}; $expectation->is(q{value})->at($text); unless (defined ($_tok = Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::value($thisparser,$text,$repeating,$_noactions,sub { return [ topic => qq{"$item[1]"} . ($arg{topic} ? " for $arg{topic}" : '') ] }))) { Parse::RecDescent::_trace(q{<<Didn't match subrule: [value]>>}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $expectation->failed(); last; } Parse::RecDescent::_trace(q{>>Matched subrule: [value]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $item{q{value}} = $_tok; push @item, $_tok; } Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $quoted_key = quotemeta($item[1]); [$item[1], <<"_EOC_" . $item[4] . "}\n"] { local *_ = \\( \$_->{"$quoted_key"} ); _EOC_ }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [key <commit> ':' value]<<}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error?:...> <reject>]}, Parse::RecDescent::_tracefirst($_[1]), q{pair}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; my $_savetext; @item = (q{pair}); %item = (__RULE__ => q{pair}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error?:...>]}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if ($commit) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Rejecting production<< (found <reject>)}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; undef $return; $_tok = undef; last unless defined $_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error?:...> <reject>]<<}, Parse::RecDescent::_tracefirst($text), q{pair}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{pair}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{pair}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{pair}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{pair}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::eofile { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"eofile"}; Parse::RecDescent::_trace(q{Trying rule: [eofile]}, Parse::RecDescent::_tracefirst($_[1]), q{eofile}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: [/^\\Z/]}, Parse::RecDescent::_tracefirst($_[1]), q{eofile}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{eofile}); %item = (__RULE__ => q{eofile}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: [/^\\Z/]}, Parse::RecDescent::_tracefirst($text), q{eofile}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^\Z)//) { $expectation->failed(); Parse::RecDescent::_trace(q{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__PATTERN1__}=$&; Parse::RecDescent::_trace(q{>>Matched production: [/^\\Z/]<<}, Parse::RecDescent::_tracefirst($text), q{eofile}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{eofile}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{eofile}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{eofile}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{eofile}, $tracelevel) } $_[1] = $text; return $return; } # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) sub Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler::type { my $thisparser = $_[0]; use vars q{$tracelevel}; local $tracelevel = ($tracelevel||0)+1; $ERRORS = 0; my $thisrule = $thisparser->{"rules"}{"type"}; Parse::RecDescent::_trace(q{Trying rule: [type]}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $err_at = @{$thisparser->{errors}}; my $score; my $score_return; my $_tok; my $return = undef; my $_matched=0; my $commit=0; my @item = (); my %item = (); my $repeating = defined($_[2]) && $_[2]; my $_noactions = defined($_[3]) && $_[3]; my @arg = defined $_[4] ? @{ &{$_[4]} } : (); my %arg = ($#arg & 01) ? @arg : (@arg, undef); my $text; my $lastsep=""; my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); $expectation->at($_[1]); my $thisline; tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['STRING']}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[0]; $text = $_[1]; my $_savetext; @item = (q{type}); %item = (__RULE__ => q{type}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['STRING']}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\ASTRING//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; !ref or die qq{Bad value$for_topic: String expected.\\n}; _EOC_ }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['STRING']<<}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['INT']}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[1]; $text = $_[1]; my $_savetext; @item = (q{type}); %item = (__RULE__ => q{type}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['INT']}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\AINT//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; /^[-+]?\\d+\$/ or die qq{Bad value$for_topic: Integer expected.\\n}; _EOC_ }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['INT']<<}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['BOOL']}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[2]; $text = $_[1]; my $_savetext; @item = (q{type}); %item = (__RULE__ => q{type}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['BOOL']}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\ABOOL//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; JSON::XS::is_bool(\$_) or die qq{Bad value$for_topic: Boolean expected.\\n}; _EOC_ }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['BOOL']<<}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['IDENT']}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[3]; $text = $_[1]; my $_savetext; @item = (q{type}); %item = (__RULE__ => q{type}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['IDENT']}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\AIDENT//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; /^[A-Za-z]\\w*\$/ or die qq{Bad value$for_topic: Identifier expected.\\n}; _EOC_ }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['IDENT']<<}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched && !$commit) { Parse::RecDescent::_trace(q{Trying production: ['ANY']}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[4]; $text = $_[1]; my $_savetext; @item = (q{type}); %item = (__RULE__ => q{type}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying terminal: ['ANY']}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $lastsep = ""; $expectation->is(q{})->at($text); unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\AANY//) { $expectation->failed(); Parse::RecDescent::_trace(qq{<<Didn't match terminal>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $item{__STRING1__}=$&; Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_tok = ($_noactions) ? 0 : do { '' }; unless (defined $_tok) { Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])}) if defined $::RD_TRACE; last; } Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; push @item, $_tok; $item{__ACTION1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: ['ANY']<<}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } while (!$_matched) { Parse::RecDescent::_trace(q{Trying production: [<error...>]}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; my $thisprod = $thisrule->{"prods"}[5]; my $_savetext; @item = (q{type}); %item = (__RULE__ => q{type}); my $repcount = 0; Parse::RecDescent::_trace(q{Trying directive: [<error...>]}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_tok = do { if (1) { do { my $rule = $item[0]; $rule =~ s/_/ /g; #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; } unless $_noactions; undef } else {0} }; if (defined($_tok)) { Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } else { Parse::RecDescent::_trace(q{<<Didn't match directive>>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; } last unless defined $_tok; push @item, $item{__DIRECTIVE1__}=$_tok; Parse::RecDescent::_trace(q{>>Matched production: [<error...>]<<}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) if defined $::RD_TRACE; $_matched = 1; last; } unless ( $_matched || defined($return) || defined($score) ) { $_[1] = $text; # NOT SURE THIS IS NEEDED Parse::RecDescent::_trace(q{<<Didn't match rule>>}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) if defined $::RD_TRACE; return undef; } if (!defined($return) && defined($score)) { Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{type}, $tracelevel) if defined $::RD_TRACE; $return = $score_return; } splice @{$thisparser->{errors}}, $err_at; $return = $item[$#item] unless defined $return; if (defined $::RD_TRACE) { Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{type}, $tracelevel); Parse::RecDescent::_trace(q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, Parse::RecDescent::_tracefirst($text), , q{type}, $tracelevel) } $_[1] = $text; return $return; } } package OpenResty::QuasiQuote::Validator::Compiler; sub new { my $self = bless( { '_AUTOTREE' => undef, 'localvars' => '', 'startcode' => '', '_check' => { 'thisoffset' => '', 'itempos' => '', 'prevoffset' => '', 'prevline' => '', 'prevcolumn' => '', 'thiscolumn' => '' }, 'namespace' => 'Parse::RecDescent::OpenResty::QuasiQuote::Validator::Compiler', '_AUTOACTION' => undef, 'rules' => { 'scalar' => bless( { 'impcount' => 0, 'calls' => [ 'type', 'attr' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 1, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'subrule' => 'type', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 84 }, 'Parse::RecDescent::Subrule' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 84, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'subrule' => 'attr', 'expected' => undef, 'min' => 0, 'argcode' => undef, 'max' => 100000000, 'matchrule' => 0, 'repspec' => 's?', 'lookahead' => 0, 'line' => 84 }, 'Parse::RecDescent::Repetition' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 85, 'code' => '{ my $attrs = { map { @$_ } @{ $item[3] } }; my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; my $code; my $code2 = $item[1]; my $required; if (delete $attrs->{required}) { $code .= <<"_EOC_"; defined or die qq{Value$for_topic required.\\\\n}; _EOC_ $required = 1; } if (my $args = delete $attrs->{match}) { my ($pat, $desc) = @$args; $desc = eval $desc; $code2 .= "$pat or die qq{Invalid value$for_topic: $desc expected.\\\\n};\\n"; } if (delete $attrs->{nonempty}) { $code2 .= "length or die qq{Invalid value$for_topic: Nonempty scalar expected.\\\\n};\\n"; } if (my $args = delete $attrs->{allowed}) { my $values = join \', \', @$args; my $expr = join \' or \', map { "\\$_ eq $_" } @$args; $code2 .= "$expr or die qq{Invalid value$for_topic: Allowed values are $values.\\\\n};\\n"; } if ($required) { $code .= $code2; } else { $code .= "if (defined) {\\n$code2}\\n"; } if (my $args = delete $attrs->{default}) { if ($required) { die "validator: Required scalar cannot take default value at the same time.\\n"; } my $default = $args->[0] or die "validator: :default attribute takes one argument.\\n"; $code .= <<"_EOC_"; else { \\$_ = $default; } _EOC_ } if (my $args = delete $attrs->{to}) { my $var = $args->[0]; $code .= "$var = \\$_;\\n"; } if (%$attrs) { die "validator: Bad attribute for scalar: ", join(" ", keys %$attrs), "\\n"; } #$code . $code2; $code; }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'scalar', 'vars' => '', 'line' => 84 }, 'Parse::RecDescent::Rule' ), 'variable' => bless( { 'impcount' => 0, 'calls' => [], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 12, 'code' => '{ Text::Balanced::extract_variable($text) }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'variable', 'vars' => '', 'line' => 12 }, 'Parse::RecDescent::Rule' ), 'value' => bless( { 'impcount' => 0, 'calls' => [ 'hash', 'array', 'scalar' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'subrule' => 'hash', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 14 }, 'Parse::RecDescent::Subrule' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'subrule' => 'array', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 15 }, 'Parse::RecDescent::Subrule' ) ], 'line' => 15 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '2', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'subrule' => 'scalar', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 16 }, 'Parse::RecDescent::Subrule' ) ], 'line' => 16 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '3', 'strcount' => 0, 'dircount' => 1, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '', 'lookahead' => 0, 'line' => 17 }, 'Parse::RecDescent::Error' ) ], 'line' => 17 }, 'Parse::RecDescent::Production' ) ], 'name' => 'value', 'vars' => '', 'line' => 14 }, 'Parse::RecDescent::Rule' ), 'lhs' => bless( { 'impcount' => 0, 'calls' => [ 'variable' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'subrule' => 'variable', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 10 }, 'Parse::RecDescent::Subrule' ), bless( { 'pattern' => '~~', 'hashname' => '__STRING1__', 'description' => '\'~~\'', 'lookahead' => 0, 'line' => 10 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 10, 'code' => '{ "{\\nlocal *_ = \\\\( $item[1] );\\n" }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'lhs', 'vars' => '', 'line' => 10 }, 'Parse::RecDescent::Rule' ), 'attr' => bless( { 'impcount' => 0, 'calls' => [ 'ident', 'argument' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 3, 'dircount' => 2, 'uncommit' => undef, 'error' => undef, 'patcount' => 1, 'actcount' => 1, 'op' => [], 'items' => [ bless( { 'pattern' => ':', 'hashname' => '__STRING1__', 'description' => '\':\'', 'lookahead' => 0, 'line' => 246 }, 'Parse::RecDescent::Literal' ), bless( { 'subrule' => 'ident', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 246 }, 'Parse::RecDescent::Subrule' ), bless( { 'pattern' => '(', 'hashname' => '__STRING2__', 'description' => '\'(\'', 'lookahead' => 0, 'line' => 246 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 246, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'expected' => '<leftop: argument /,/ argument>', 'min' => 1, 'name' => '\'argument(s)\'', 'max' => 100000000, 'leftarg' => bless( { 'subrule' => 'argument', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 246 }, 'Parse::RecDescent::Subrule' ), 'rightarg' => bless( { 'subrule' => 'argument', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 246 }, 'Parse::RecDescent::Subrule' ), 'hashname' => '__DIRECTIVE2__', 'type' => 'leftop', 'op' => bless( { 'pattern' => ',', 'hashname' => '__PATTERN1__', 'description' => '/,/', 'lookahead' => 0, 'rdelim' => '/', 'line' => 246, 'mod' => '', 'ldelim' => '/' }, 'Parse::RecDescent::Token' ) }, 'Parse::RecDescent::Operator' ), bless( { 'pattern' => ')', 'hashname' => '__STRING3__', 'description' => '\')\'', 'lookahead' => 0, 'line' => 246 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 247, 'code' => '{ [ $item[2] => [ @{ $item[5] } ] ] }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 1, 'dircount' => 1, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => ':', 'hashname' => '__STRING1__', 'description' => '\':\'', 'lookahead' => 0, 'line' => 248 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 248, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'subrule' => 'ident', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 248 }, 'Parse::RecDescent::Subrule' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 249, 'code' => '{ [ $item[3] => 1 ] }' }, 'Parse::RecDescent::Action' ) ], 'line' => 248 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '2', 'strcount' => 0, 'dircount' => 2, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '?', 'lookahead' => 0, 'line' => 250 }, 'Parse::RecDescent::Error' ), bless( { 'hashname' => '__DIRECTIVE2__', 'name' => '<reject>', 'lookahead' => 0, 'line' => 250 }, 'Parse::RecDescent::UncondReject' ) ], 'line' => 250 }, 'Parse::RecDescent::Production' ) ], 'name' => 'attr', 'vars' => '', 'line' => 246 }, 'Parse::RecDescent::Rule' ), 'ident' => bless( { 'impcount' => 0, 'calls' => [], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 1, 'actcount' => 0, 'items' => [ bless( { 'pattern' => '^[A-Za-z]\\w*', 'hashname' => '__PATTERN1__', 'description' => '/^[A-Za-z]\\\\w*/', 'lookahead' => 0, 'rdelim' => '/', 'line' => 82, 'mod' => '', 'ldelim' => '/' }, 'Parse::RecDescent::Token' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'ident', 'vars' => '', 'line' => 82 }, 'Parse::RecDescent::Rule' ), 'key' => bless( { 'impcount' => 0, 'calls' => [ 'ident' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 2, 'items' => [ bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 79, 'code' => '{ extract_delimited($text, \'"\') }' }, 'Parse::RecDescent::Action' ), bless( { 'hashname' => '__ACTION2__', 'lookahead' => 0, 'line' => 79, 'code' => '{ eval $item[1] }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'subrule' => 'ident', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 80 }, 'Parse::RecDescent::Subrule' ) ], 'line' => 80 }, 'Parse::RecDescent::Production' ) ], 'name' => 'key', 'vars' => '', 'line' => 79 }, 'Parse::RecDescent::Rule' ), 'validator' => bless( { 'impcount' => 0, 'calls' => [ 'lhs', 'value', 'eofile' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 1, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'subrule' => 'lhs', 'expected' => undef, 'min' => 0, 'argcode' => undef, 'max' => 1, 'matchrule' => 0, 'repspec' => '?', 'lookahead' => 0, 'line' => 1 }, 'Parse::RecDescent::Repetition' ), bless( { 'subrule' => 'value', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 1 }, 'Parse::RecDescent::Subrule' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 1, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'subrule' => 'eofile', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 1 }, 'Parse::RecDescent::Subrule' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 2, 'code' => '{ if (@{$item[1]}) { $item[1][0] . $item[2] . "}\\n"; } else { $item[2] } }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 0, 'dircount' => 1, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '', 'lookahead' => 0, 'line' => 8 }, 'Parse::RecDescent::Error' ) ], 'line' => 8 }, 'Parse::RecDescent::Production' ) ], 'name' => 'validator', 'vars' => '', 'line' => 1 }, 'Parse::RecDescent::Rule' ), 'argument' => bless( { 'impcount' => 0, 'calls' => [ 'variable' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 1, 'actcount' => 0, 'items' => [ bless( { 'pattern' => '^\\d+', 'hashname' => '__PATTERN1__', 'description' => '/^\\\\d+/', 'lookahead' => 0, 'rdelim' => '/', 'line' => 252, 'mod' => '', 'ldelim' => '/' }, 'Parse::RecDescent::Token' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'pattern' => '[]', 'hashname' => '__STRING1__', 'description' => '\'[]\'', 'lookahead' => 0, 'line' => 253 }, 'Parse::RecDescent::Literal' ) ], 'line' => 253 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '2', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'subrule' => 'variable', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 254 }, 'Parse::RecDescent::Subrule' ) ], 'line' => 254 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '3', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 2, 'items' => [ bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 255, 'code' => '{ extract_quotelike($text) }' }, 'Parse::RecDescent::Action' ), bless( { 'hashname' => '__ACTION2__', 'lookahead' => 0, 'line' => 255, 'code' => '{ $item[1] }' }, 'Parse::RecDescent::Action' ) ], 'line' => 255 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '4', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 2, 'items' => [ bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 256, 'code' => '{ extract_codeblock($text) }' }, 'Parse::RecDescent::Action' ), bless( { 'hashname' => '__ACTION2__', 'lookahead' => 0, 'line' => 256, 'code' => '{ "do $item[1]" }' }, 'Parse::RecDescent::Action' ) ], 'line' => 256 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '5', 'strcount' => 0, 'dircount' => 1, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '', 'lookahead' => 0, 'line' => 257 }, 'Parse::RecDescent::Error' ) ], 'line' => 257 }, 'Parse::RecDescent::Production' ) ], 'name' => 'argument', 'vars' => '', 'line' => 252 }, 'Parse::RecDescent::Rule' ), 'array' => bless( { 'impcount' => 0, 'calls' => [ 'array_elem', 'attr' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 2, 'dircount' => 1, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => '[', 'hashname' => '__STRING1__', 'description' => '\'[\'', 'lookahead' => 0, 'line' => 145 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 145, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'subrule' => 'array_elem', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 145 }, 'Parse::RecDescent::Subrule' ), bless( { 'pattern' => ']', 'hashname' => '__STRING2__', 'description' => '\']\'', 'lookahead' => 0, 'line' => 145 }, 'Parse::RecDescent::Literal' ), bless( { 'subrule' => 'attr', 'expected' => undef, 'min' => 0, 'argcode' => undef, 'max' => 100000000, 'matchrule' => 0, 'repspec' => 's?', 'lookahead' => 0, 'line' => 145 }, 'Parse::RecDescent::Repetition' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 146, 'code' => '{ my $attrs = { map { @$_ } @{ $item[5] } }; my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; my $required; my ($code, $code2); if ($required = delete $attrs->{required}) { $code .= <<"_EOC_"; defined or die qq{Value$for_topic required.\\\\n}; _EOC_ #$required = 1; } my $code3 = \'\'; if (my $args = delete $attrs->{nonempty}) { $code3 .= <<"_EOC_"; \\@\\$_ or die qq{Array cannot be empty$for_topic.\\\\n}; _EOC_ } $code2 .= <<"_EOC_"; ref and ref eq \'ARRAY\' or die qq{Invalid value$for_topic: Array expected.\\\\n}; ${code3}for (\\@\\$_) \\{ $item[3]} _EOC_ if ($required) { $code .= $code2; } else { $code .= "if (defined) {\\n$code2}\\n"; } if (my $args = delete $attrs->{default}) { if ($required) { die "validator: Required array cannot take default value at the same time.\\n"; } my $default = $args->[0] or die "validator: :default attribute takes one argument.\\n"; $code .= <<"_EOC_"; else { \\$_ = $default; } _EOC_ } if (my $args = delete $attrs->{to}) { my $var = $args->[0]; $code .= "$var = \\$_;\\n"; } if (%$attrs) { die "Bad attribute for array: ", join(" ", keys %$attrs), "\\n"; } $code; }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 0, 'dircount' => 2, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '?', 'lookahead' => 0, 'line' => 200 }, 'Parse::RecDescent::Error' ), bless( { 'hashname' => '__DIRECTIVE2__', 'name' => '<reject>', 'lookahead' => 0, 'line' => 200 }, 'Parse::RecDescent::UncondReject' ) ], 'line' => 200 }, 'Parse::RecDescent::Production' ) ], 'name' => 'array', 'vars' => '', 'line' => 145 }, 'Parse::RecDescent::Rule' ), 'hash' => bless( { 'impcount' => 0, 'calls' => [ 'pair', 'attr' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 2, 'dircount' => 2, 'uncommit' => undef, 'error' => undef, 'patcount' => 2, 'actcount' => 1, 'op' => [], 'items' => [ bless( { 'pattern' => '{', 'hashname' => '__STRING1__', 'description' => '\'\\{\'', 'lookahead' => 0, 'line' => 19 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 19, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'expected' => '<leftop: pair /,/ pair>', 'min' => 0, 'name' => '\'pair(s?)\'', 'max' => 100000000, 'leftarg' => bless( { 'subrule' => 'pair', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 19 }, 'Parse::RecDescent::Subrule' ), 'rightarg' => bless( { 'subrule' => 'pair', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 19 }, 'Parse::RecDescent::Subrule' ), 'hashname' => '__DIRECTIVE2__', 'type' => 'leftop', 'op' => bless( { 'pattern' => ',', 'hashname' => '__PATTERN1__', 'description' => '/,/', 'lookahead' => 0, 'rdelim' => '/', 'line' => 19, 'mod' => '', 'ldelim' => '/' }, 'Parse::RecDescent::Token' ) }, 'Parse::RecDescent::Operator' ), bless( { 'pattern' => ',?', 'hashname' => '__PATTERN2__', 'description' => '/,?/', 'lookahead' => 0, 'rdelim' => '/', 'line' => 19, 'mod' => '', 'ldelim' => '/' }, 'Parse::RecDescent::Token' ), bless( { 'pattern' => '}', 'hashname' => '__STRING2__', 'description' => '\'\\}\'', 'lookahead' => 0, 'line' => 19 }, 'Parse::RecDescent::Literal' ), bless( { 'subrule' => 'attr', 'expected' => undef, 'min' => 0, 'argcode' => undef, 'max' => 100000000, 'matchrule' => 0, 'repspec' => 's?', 'lookahead' => 0, 'line' => 19 }, 'Parse::RecDescent::Repetition' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 20, 'code' => '{ my $attrs = { map { @$_ } @{ $item[6] } }; my $pairs = $item[3]; my $topic = $arg{topic}; ### $attrs my $for_topic = $topic ? " for $topic" : ""; my ($code, $code2); my $required; if (delete $attrs->{required}) { $code .= <<"_EOC_"; defined or die qq{Value$for_topic required.\\\\n}; _EOC_ $required = 1; } my $code3 = \'\'; if (delete $attrs->{nonempty}) { $code3 .= <<"_EOC_"; \\%\\$_ or die qq{Hash cannot be empty$for_topic.\\\\n}; _EOC_ } $code2 .= <<"_EOC_" . $code3 . join(\'\', map { $_->[1] } @$pairs); ref and ref eq \'HASH\' or die qq{Invalid value$for_topic: Hash expected.\\\\n}; _EOC_ my @keys = map { $_->[0] } @$pairs; my $cond = join \' or \', map { \'$_ eq "\' . quotemeta($_) . \'"\' } @keys; $code2 .= <<"_EOC_"; for (keys \\%\\$_) { $cond or die qq{Unrecognized key in hash$for_topic: \\$_\\\\n}; } _EOC_ if ($required) { $code .= $code2 } else { $code .= "if (defined) {\\n$code2}\\n"; } if (my $args = delete $attrs->{to}) { my $var = $args->[0]; $code .= "$var = \\$_;\\n"; } if (%$attrs) { die "Bad attribute for hash: ", join(" ", keys %$attrs), "\\n"; } $code; }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'hash', 'vars' => '', 'line' => 19 }, 'Parse::RecDescent::Rule' ), 'array_elem' => bless( { 'impcount' => 0, 'calls' => [ 'value' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 202, 'code' => '{ if ($arg{topic}) { $arg{topic} . " " } else { "" } }' }, 'Parse::RecDescent::Action' ), bless( { 'subrule' => 'value', 'matchrule' => 0, 'implicit' => undef, 'argcode' => '[topic => $item[1] . \'array element\']', 'lookahead' => 0, 'line' => 208 }, 'Parse::RecDescent::Subrule' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'array_elem', 'vars' => '', 'line' => 202 }, 'Parse::RecDescent::Rule' ), 'pair' => bless( { 'impcount' => 0, 'calls' => [ 'key', 'value' ], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 1, 'dircount' => 1, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'subrule' => 'key', 'matchrule' => 0, 'implicit' => undef, 'argcode' => undef, 'lookahead' => 0, 'line' => 69 }, 'Parse::RecDescent::Subrule' ), bless( { 'hashname' => '__DIRECTIVE1__', 'name' => '<commit>', 'lookahead' => 0, 'line' => 69, 'code' => '$commit = 1' }, 'Parse::RecDescent::Directive' ), bless( { 'pattern' => ':', 'hashname' => '__STRING1__', 'description' => '\':\'', 'lookahead' => 0, 'line' => 69 }, 'Parse::RecDescent::Literal' ), bless( { 'subrule' => 'value', 'matchrule' => 0, 'implicit' => undef, 'argcode' => '[ topic => qq{"$item[1]"} . ($arg{topic} ? " for $arg{topic}" : \'\') ]', 'lookahead' => 0, 'line' => 69 }, 'Parse::RecDescent::Subrule' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 70, 'code' => '{ my $quoted_key = quotemeta($item[1]); [$item[1], <<"_EOC_" . $item[4] . "}\\n"] { local *_ = \\\\( \\$_->{"$quoted_key"} ); _EOC_ }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 0, 'dircount' => 2, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '?', 'lookahead' => 0, 'line' => 77 }, 'Parse::RecDescent::Error' ), bless( { 'hashname' => '__DIRECTIVE2__', 'name' => '<reject>', 'lookahead' => 0, 'line' => 77 }, 'Parse::RecDescent::UncondReject' ) ], 'line' => 77 }, 'Parse::RecDescent::Production' ) ], 'name' => 'pair', 'vars' => '', 'line' => 69 }, 'Parse::RecDescent::Rule' ), 'eofile' => bless( { 'impcount' => 0, 'calls' => [], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 0, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 1, 'actcount' => 0, 'items' => [ bless( { 'pattern' => '^\\Z', 'hashname' => '__PATTERN1__', 'description' => '/^\\\\Z/', 'lookahead' => 0, 'rdelim' => '/', 'line' => 259, 'mod' => '', 'ldelim' => '/' }, 'Parse::RecDescent::Token' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ) ], 'name' => 'eofile', 'vars' => '', 'line' => 259 }, 'Parse::RecDescent::Rule' ), 'type' => bless( { 'impcount' => 0, 'calls' => [], 'changed' => 0, 'opcount' => 0, 'prods' => [ bless( { 'number' => '0', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => 'STRING', 'hashname' => '__STRING1__', 'description' => '\'STRING\'', 'lookahead' => 0, 'line' => 210 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 211, 'code' => '{ my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; !ref or die qq{Bad value$for_topic: String expected.\\\\n}; _EOC_ }' }, 'Parse::RecDescent::Action' ) ], 'line' => undef }, 'Parse::RecDescent::Production' ), bless( { 'number' => '1', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => 'INT', 'hashname' => '__STRING1__', 'description' => '\'INT\'', 'lookahead' => 0, 'line' => 218 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 219, 'code' => '{ my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; /^[-+]?\\\\d+\\$/ or die qq{Bad value$for_topic: Integer expected.\\\\n}; _EOC_ }' }, 'Parse::RecDescent::Action' ) ], 'line' => 218 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '2', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => 'BOOL', 'hashname' => '__STRING1__', 'description' => '\'BOOL\'', 'lookahead' => 0, 'line' => 226 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 227, 'code' => '{ my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; JSON::XS::is_bool(\\$_) or die qq{Bad value$for_topic: Boolean expected.\\\\n}; _EOC_ }' }, 'Parse::RecDescent::Action' ) ], 'line' => 226 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '3', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => 'IDENT', 'hashname' => '__STRING1__', 'description' => '\'IDENT\'', 'lookahead' => 0, 'line' => 234 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 235, 'code' => '{ my $topic = $arg{topic}; my $for_topic = $topic ? " for $topic" : ""; <<"_EOC_"; /^[A-Za-z]\\\\w*\\$/ or die qq{Bad value$for_topic: Identifier expected.\\\\n}; _EOC_ }' }, 'Parse::RecDescent::Action' ) ], 'line' => 234 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '4', 'strcount' => 1, 'dircount' => 0, 'uncommit' => undef, 'error' => undef, 'patcount' => 0, 'actcount' => 1, 'items' => [ bless( { 'pattern' => 'ANY', 'hashname' => '__STRING1__', 'description' => '\'ANY\'', 'lookahead' => 0, 'line' => 242 }, 'Parse::RecDescent::Literal' ), bless( { 'hashname' => '__ACTION1__', 'lookahead' => 0, 'line' => 243, 'code' => '{ \'\' }' }, 'Parse::RecDescent::Action' ) ], 'line' => 242 }, 'Parse::RecDescent::Production' ), bless( { 'number' => '5', 'strcount' => 0, 'dircount' => 1, 'uncommit' => 0, 'error' => 1, 'patcount' => 0, 'actcount' => 0, 'items' => [ bless( { 'msg' => '', 'hashname' => '__DIRECTIVE1__', 'commitonly' => '', 'lookahead' => 0, 'line' => 244 }, 'Parse::RecDescent::Error' ) ], 'line' => 244 }, 'Parse::RecDescent::Production' ) ], 'name' => 'type', 'vars' => '', 'line' => 210 }, 'Parse::RecDescent::Rule' ) } }, 'Parse::RecDescent' ); }
beni55/old-openresty
lib/OpenResty/QuasiQuote/Validator/Compiler.pm
Perl
bsd-3-clause
248,415
#!/usr/bin/perl -w- # # Copyright 2017 Google Inc. # # 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. use strict; use FindBin; use Getopt::Long; use File::Basename; use lib $FindBin::Bin; use AssetGen; my $help = 0; our $thiscommand = "@ARGV"; sub usage() { die "usage: $FindBin::Script <.srcfile> <outputfile>\n"; } GetOptions("help|?" => \$help) || usage(); usage() if $help; my $srcfile = shift; if (!$srcfile) { warn "No .srcfile specified\n"; usage(); } my $daemon_h = shift; if (!$daemon_h) { warn "No output file specified\n"; usage(); } # **************************************************************************** # *** Read .src file # **************************************************************************** my %config; ReadSrcFile($srcfile, \%config); # **************************************************************************** # *** Augment the supplied content with standard pieces # **************************************************************************** my %extra; my ($template); $template = ""; if ($base eq 'Composite') { if ($singleFormalExtraUpdateArg) { $template = " template <typename ProductAssetVersion>"; $singleFormalExtraUpdateArg =~ s/ExtraUpdateArg/ExtraUpdateArg\<ProductAssetVersion\>/; $formalExtraUpdateArg =~ s/ExtraUpdateArg/ExtraUpdateArg\<ProductAssetVersion\>/; } $extra{"${name}AssetVersionImplD"} = $template . " void UpdateChildren($singleFormalExtraUpdateArg);\n"; } else { $extra{"${name}AssetVersionImplD"} = " virtual void DoSubmitTask(void);\n"; } # ***************************************************************************** # *** ${name}AssetImplD.h # ****************************************************************************# EnsureDirExists($daemon_h); my $fh; my $hprot = basename($daemon_h); $hprot =~ tr/./_/; chmod 0777, $daemon_h; open($fh, "> $daemon_h") || die "Unable to open $daemon_h: $!\n"; EmitAutoGeneratedWarning($fh); my $header; if ($deprecated) { $header = "autoingest/plugins/deprecated/${name}Asset.h" } else { $header = "autoingest/plugins/${name}Asset.h" } print $fh <<EOF; #ifndef __$hprot #define __$hprot #include <$header> #include <sysman/AssetD.h> // **************************************************************************** // *** Supplied from ${name}.src // **************************************************************************** $config{"AssetD.h"} class ${name}AssetImplD; /****************************************************************************** *** ${name}AssetVersionImplD ******************************************************************************/ class ${name}AssetVersionImplD : public ${name}AssetVersionImpl, public ${base}AssetVersionImplD { friend class ${name}AssetVersionImpl; friend class ${name}AssetImplD; friend class DerivedAssetHandleD_<${name}AssetVersion, AssetVersionD, ${name}AssetVersionImplD>; virtual bool Save(const std::string &filename) const; protected: static khRefGuard<${name}AssetVersionImplD> Load(const std::string &ref); // Only used when constructing a new version from an asset. // The decision to use the raw ImplD* here was a tough one. // Originally it had an asset handle, but the call point is a member // function in ${name}AssetImplD that didn't already have a handle // So I either needed a way to create a handle from a already existent // ImplD* (as opposed to a newly created one) or make this routine // deal with a raw ImplD* instead. Since the end code never uses this // class directly, I figured it was the safer one to open up a bit. EOF if ($haveBindConfig) { print $fh <<EOF; ${name}AssetVersionImplD(${name}AssetImplD *asset, const Config &bound_config); EOF } else { print $fh <<EOF; ${name}AssetVersionImplD(${name}AssetImplD *asset); EOF } print $fh <<EOF; ${name}AssetVersionImplD(const AssetVersionStorage &storage, const Config& config_) : AssetVersionImpl(storage), ${base}AssetVersionImpl(), ${name}AssetVersionImpl(config_), ${base}AssetVersionImplD() { } $extra{"${name}AssetVersionImplD"} // supplied from ${name}.src ---v $config{"${name}AssetVersionImplD"} // supplied from ${name}.src ---^ }; typedef DerivedAssetHandleD_<${name}AssetVersion, AssetVersionD, ${name}AssetVersionImplD> ${name}AssetVersionD; typedef MutableDerivedAssetHandleD_<${name}AssetVersionD, MutableAssetVersionD> Mutable${name}AssetVersionD; /****************************************************************************** *** ${name}AssetImplD ******************************************************************************/ class ${name}AssetImplD : public ${name}AssetImpl, public AssetImplD { friend class ${name}AssetImpl; friend class ${name}Factory; friend class DerivedAssetHandleD_<${name}Asset, AssetD, ${name}AssetImplD>; virtual bool Save(const std::string &filename) const; public: void Modify($formalinputarg const khMetaData & meta_, const Config &config_); EOF if ($haveBindConfig) { print $fh <<EOF; virtual bool IsUpToDate(const Config &bound_config $formalcachedinputarg) const; EOF } else { print $fh <<EOF; virtual bool IsUpToDate($singleformalcachedinputarg) const; EOF } print $fh <<EOF; virtual AssetVersionD Update(bool &needed) const; protected: static khRefGuard<${name}AssetImplD> Load(const std::string &ref); $template ${name}AssetVersionD MyUpdate(bool &needed $formalcachedinputarg $formalExtraUpdateArg) const; ${name}AssetImplD(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const Config& config_) : AssetImpl(AssetStorage::MakeStorage(ref_, $actualtypearg, "$subtype", $actualinputarg, meta_)), ${name}AssetImpl(config_), AssetImplD() { } ${name}AssetImplD(const AssetStorage &storage, const Config& config_) : AssetImpl(storage), ${name}AssetImpl(config_), AssetImplD() { } EOF if ($haveBindConfig) { print $fh <<EOF; Mutable${name}AssetVersionD MakeNewVersion(const Config &bound_config); EOF } else { print $fh <<EOF; Mutable${name}AssetVersionD MakeNewVersion(void); EOF } print $fh <<EOF; // supplied from ${name}.src ---v $config{"${name}AssetImplD"} // supplied from ${name}.src ---^ }; typedef DerivedAssetHandleD_<${name}Asset, AssetD, ${name}AssetImplD> ${name}AssetD; typedef MutableDerivedAssetHandleD_<${name}AssetD, MutableAssetD> Mutable${name}AssetD; // **************************************************************************** // *** ${name}VersionImplD -- out of line so it can be defined // *** after ${name}AssetImplD // **************************************************************************** EOF if ($haveBindConfig) { print $fh <<EOF; inline ${name}AssetVersionImplD::${name}AssetVersionImplD (${name}AssetImplD *asset, const Config &bound_config) : AssetVersionImpl(MakeStorageFromAsset(*asset)), ${base}AssetVersionImpl(), ${name}AssetVersionImpl(bound_config), ${base}AssetVersionImplD(asset->inputs) { } EOF } else { print $fh <<EOF; inline ${name}AssetVersionImplD::${name}AssetVersionImplD(${name}AssetImplD *asset) : AssetVersionImpl(MakeStorageFromAsset(*asset)), ${base}AssetVersionImpl(), ${name}AssetVersionImpl(asset->config), ${base}AssetVersionImplD(asset->inputs) { } EOF } print $fh <<EOF; // **************************************************************************** // *** ${name}Factory // **************************************************************************** class ${name}Factory { public: static ${name}AssetD Find(const std::string &ref_ $formaltypearg); static ${name}AssetVersionD FindVersion(const std::string &ref_ $formaltypearg); static void ValidateRefForInput(const std::string &ref $formaltypearg); static std::string SubAssetName(const std::string &parentAssetRef $formaltypearg, const std::string &basename); static Mutable${name}AssetD Make(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const $config& config_); static Mutable${name}AssetD FindMake(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const $config& config_); static Mutable${name}AssetD FindAndModify(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const $config& config_); static Mutable${name}AssetD MakeNew(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const $config& config_); $template static Mutable${name}AssetVersionD FindMakeAndUpdate(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const $config& config_ $formalcachedinputarg $formalExtraUpdateArg); $template static Mutable${name}AssetVersionD FindMakeAndUpdateSubAsset(const std::string &parentAssetRef $formaltypearg, const std::string &basename, $formalinputarg const khMetaData &meta_, const $config& config_ $formalcachedinputarg $formalExtraUpdateArg); EOF if ($withreuse) { print $fh <<EOF; $template static Mutable${name}AssetVersionD ReuseOrMakeAndUpdate(const std::string &ref_ $formaltypearg, $formalinputarg const khMetaData &meta_, const $config& config_ $formalcachedinputarg $formalExtraUpdateArg); $template static Mutable${name}AssetVersionD ReuseOrMakeAndUpdateSubAsset(const std::string &parentAssetRef $formaltypearg, const std::string &basename, $formalinputarg const khMetaData &meta_, const $config& config_ $formalcachedinputarg $formalExtraUpdateArg); EOF } print $fh <<EOF; }; #endif /* __$hprot */ EOF close($fh); chmod 0444, $daemon_h;
daydayuplo/gee
earth_enterprise/src/fusion/autoingest/AssetGenDaemonH.pl
Perl
apache-2.0
10,719
package WebComponent::Comments; # #=============================================================================== # # FILE: Comments.pm # # DESCRIPTION: Access to the commenting system # # FILES: --- # BUGS: --- # NOTES: Now implementing PPO. # AUTHOR: Scott Devoid (devoid@uchicago.edu) # COMPANY: University of Chicago, Argonne # VERSION: 0.5 # CREATED: 06/23/09 14:54:10 # REVISION: --- #=============================================================================== #use strict; use warnings; use URI::Escape; use DBMaster; use base qw( WebComponent ); use FIGMODEL; use Conf; 1; $DEBUG = 1; =pod =head1 NAME Comments =head1 DESCRIPTION View, Add, Edit, Remove comments from the commenting system. =head1 PUBLIC METHODS =over 4 =item * B<new> () Called when the object is initialized. Expands SUPER::new. =cut sub new { my $self = shift->SUPER::new(@_); my $dbMaster = DBMaster->new(-database => 'WebComments', -host => $Conf::webapplication_host, -user => $Conf::webapplication_user, -backend => 'MySQL'); $self->{'db'} = $dbMaster; return $self; } sub title { my ($self, $title) = @_; if(defined($title)) { $self->{'title'} = $title; } return $self->{'title'}; } sub sortOrder { my ($self, $sortOrder) = @_; if(defined($sortOrder)) { $self->{'sortOrder'} = $sortOrder; } return $self->{'sortOrder'}; } sub width { my ($self, $width) = @_; if(defined($width)) { $self->{'width'} = $width; } return $self->{'title'}; } sub ajax { my ($self, $ajaxComponent) = @_; if(defined($ajaxComponent)) { $self->{'ajax'} = $ajaxComponent; } return $self->{'ajax'}; } sub _set_defaults { my ($self) = @_; $self->title($self->{'title'} || 'Comments'); $self->sortOrder($self->{'sortOrder'} || 'oldestToNewest'); $self->width($self->{'width'} || 600); } sub output { my ($self, $ID) = @_; my $output; $self->_set_defaults(); unless(defined($ID)) { $self->application()->add_message('warning', "The conversation specified does not exist."); } unless(defined($self->ajax())) { $self->application()->add_message('warning', "Missing Ajax backend."); } return $self->DisplayConversation($ID); } =item * B<add> () Takes: $ID the reference to the comment element $COMNUM the comment number to edit (-1 if SINGLE COMMENT system, -2 if it is a new comment, otherwise the comment number (0..)) $COMMENT the comment string $DISPLAYTYPE how to format the returned view and stores comment. =cut sub add { my ($self) = @_; my $cgi = $self->application()->cgi(); my $ID = $cgi->param('id'); my $COMNUM = $cgi->param('comnum'); my $COMMENT = $cgi->param('comment'); unless(defined($ID) && defined($COMNUM) && defined($COMMENT)) { return $self->DisplayError("There was an error in saving your comment."); } my $DATE = _timestamp(); my $USER = $self->application()->session()->user(); unless(defined($USER)) { return $self->DisplayError("You must be logged in to comment."); } my $commentHash = { ReferenceObject => $ID, _id => $COMNUM, Text => $COMMENT, Date => $DATE, User => $USER, Cgi => $cgi }; my @ErrorStrings; my $CommentObj; # Now set the comment. Return error on failure. unless(defined($CommentObj = $self->setComment($commentHash))) { return $self->DisplayError("There was an error in saving your comment."); } return $self->DisplayCommentContents($CommentObj); } =item * B<edit> () Takes: $ID the reference to the comment element $COMNUM the comment number to edit (-1 if SINGLE COMMENT system, -2 if it is a new comment, otherwise the comment number (0..)) $COMMENT the comment string $DISPLAYTYPE how to format the returned view and returns a view to edit that comment; privileges are handled on comment addtion (but views should present users with edit fields only when they SHOULD have edit permissions). =cut sub edit { my ($self) = @_; my $cgi = $self->application()->cgi(); my $ID = $cgi->param('conv'); my $COMNUM = $cgi->param('comnum'); # my $DISPLAYTYPE = $cgi->param('display'); unless(defined($ID) && defined($COMNUM)) { return $self->DisplayError("Unable to edit this comment at this time."); } return $self->DisplayEdit($ID, $COMNUM); } sub cancel { my ($self) = @_; my $cgi = $self->application()->cgi(); my $ID = $cgi->param('id'); my $COMNUM = $cgi->param('comnum'); my $oldComment = $self->getCommentById($ID, $COMNUM); if(defined($oldComment)) { return $self->DisplayCommentContents($oldComment);} else { return $self->DisplayError("Comment not found.");} } ### Add/Edit Permission Methods ### =item * B<canEdit> () Returns 1 if the login user has edit permissions on the specified comment. Otherwise, returns 0. =cut sub canEdit { my ($self, $CommentObj) = @_; my $UserObj = $self->application()->session()->user(); # The user must be logged in to edit or post. unless(defined($UserObj)) { return 0; } # Now if the User is an Admin, allow them to edit the comment my $admin_access = $UserObj->has_right($self->application(), 'edit', 'user', '*'); if($admin_access) { return 1; } # If no comment is passed, post permission is allowed for all logged in users. unless(defined($CommentObj)) { return 1; } # If current user owns Comment Object, they can edit. my $CommentOwner = $CommentObj->User()->login(); if( $CommentOwner eq $UserObj->login() ) { return 1; } else { return 0; } } ### Display Methods ### =item * B<DisplayEdit> () Takes: $ID, $COMNUM, $COMMENT =cut sub DisplayEdit { my ($self, $ID, $COMNUM) = @_; my $componentID = $self->{_id}; my $COMMENT; my $outstr; if(defined($COMNUM) && $COMNUM eq '-2') { $COMMENT = ""; } else { my $Comment = $self->getCommentById($ID, $COMNUM); unless(defined($Comment)) { return $self->DisplayError("No comment found."); } my $escapedComment = $Comment->Text(); $COMMENT = uri_unescape($escapedComment); } my $genericDivID = $self->id.'_'.$COMNUM; my $CommentID = 'c_'.$genericDivID; my $BlockTextareaID = 'cb_ta_'.$genericDivID; my $BlockSubmitID = 'cb_act_'.$genericDivID; my $CommentFormID = 'c_f_'.$genericDivID; my $TempOutputID = 'c_tmp_'.$genericDivID; my $buttons; if($COMNUM ne '-2') { $buttons = '<a href="javascript:execute_ajax('."'cancel', '$CommentID', ". "'$CommentFormID', 'Loading...', '0', postedit,". " 'Comment|$componentID');".'">Cancel</a>'. ' <a href="javascript:execute_ajax('."'add',". " '$CommentID', '$CommentFormID', 'Loading...', '0',". " postedit, 'Comment|$componentID');". '"/>Save</a>'; } else { $buttons = ' <a href="javascript:prehook('."'$CommentID', 'add',". " 'TmpComment', '$CommentFormID', 'Loading...', '0',". " postadd, 'Comment|$componentID');". '"/>Save</a>'; } $outstr .= "<div class='CommentBlock'> <form id='$CommentFormID'>". "<input type='hidden' name='id' value='$ID' />". "<input type='hidden' name='comnum' value='$COMNUM' />". "<div class='CommentBlock_Textarea' id='$BlockTextareaID'>". "<TEXTAREA name='comment' wrap='soft' rows='15' cols='40'>$COMMENT". "</TEXTAREA></div><div class='CommentBlock_EditSubmit' id='$BlockSubmitID'>". "</form>".$buttons.'</div></div>'; return $outstr; } =item * B<DisplayLinkBadage> () Takes: $self, $ID, [$link] where $link = page to goto when clicked =cut sub DisplayLinkBadge { my ($self, $ID, $link) = @_; my $Comments = $self->getCommentsByReferenceObject($ID); my $CommentCount = 0; if(defined($Comments) && @{$Comments}) { $CommentCount = @{$Comments}; } my $outstr = "<a href='$link' class='ConversationBadge'>". "<div class='CommentCount'>$CommentCount</div><div>comments</div></a>"; return $outstr; } sub DisplayLinkInlineBadge { my ($self, $ID, $link) = @_; my $NumberOfComments = $self->getNumberOfComments($ID); my $outstr = "<a href='$link' class='ConversationInlineBadge'>". "<div class='CommentCount'>$NumberOfComments</div><div>comments</div></a>"; return $outstr; } =item * B<DisplayConversation> () Takes: $ID =cut sub DisplayConversation { my ($self, $ReferenceObj) = @_; my $cvDiv = 'cv_'.$ReferenceObj; my $title = $self->title(); my $ID = $self->id; my $outstr = "<div class='Conversation' id='$ID'>"; $outstr .= "<div class='ConversationHeader' onClick='CommentsToggle();'>". "$title</div>"; my $Comments = $self->getCommentsByReferenceObject($ReferenceObj); foreach my $Comment (@{$Comments}) { $outstr .= $self->DisplayComment($Comment); } my $USEROBJ = $self->application()->session()->user(); if(defined($USEROBJ)) { my $USER = $USEROBJ->login(); if( $self->canEdit() ) { $outstr .= "<div class='Comment' id='c_$ID"."_-2'>"; $outstr .= $self->DisplayEdit($ReferenceObj, '-2'); $outstr .= "</div>"; } } else { $outstr .= "<div class='Comment' id='none'><div class=CommentBlock> You must login to comment.</div></div>"; } $outstr .= "</div>"; return $outstr; } =item * B<DisplayComment> () Takes: $ID, $USER, $COMNUM, $COMMENT Displays the Comment Item div =cut sub DisplayComment { my ($self, $CommentObj) = @_; my $ID = $self->id; my $genericDivID = $ID.'_'.$CommentObj->_id(); my $CommentID = 'c_'.$genericDivID; my $outstr = "<div class='Comment' id='$CommentID'>"; $outstr .= $self->DisplayCommentContents($CommentObj); $outstr .= "</div>"; return $outstr; } =item * B<DisplayCommentContents> () Takes: $ID, $USER, $COMNUM, $COMMENT Displays the contents of the Comment Item div =cut sub DisplayCommentContents { my ($self, $CommentObj) = @_; my $ID = $self->id; my $genericDivID = $ID.'_'.$CommentObj->_id(); my $CommentID = 'c_'.$genericDivID; my $CommentEditID = 'c_es_'.$genericDivID; my $outstr = $self->DisplayCommentBlock($CommentObj); my $Username = $CommentObj->User()->login(); $outstr .= "<div class='CommentInfo'> <span class='CommentName'>Posted by $Username</span>"; $outstr .= $self->DisplayTime($CommentObj->Date()); if($self->canEdit($CommentObj)) { $outstr .= "<span class='CommentEdit' id='".$CommentEditID. "'> | <a href='".'javascript:execute_ajax("edit", "'. $CommentID.'", "conv='.$CommentObj->ReferenceObject().'&comnum='. $CommentObj->_id().'", "Loading...", 0, postedit, "Comments|'. $self->{_id}.'");'."'>Edit</a></span>"; } $outstr .= "</div>"; return $outstr; } =item * B<DisplayCommentBlock> () Takes: $ID, $USER, $COMNUM, $COMMENT =cut sub DisplayCommentBlock { my ($self, $CommentObj) = @_; my $ID = $self->id; my $CommentText = uri_unescape($CommentObj->Text()); my $genericDivID = $ID.'_'.$CommentObj->_id(); my $CommentBlockID = 'c_cb_'.$genericDivID; my $outstr = "<div class='CommentBlock' id='".$CommentBlockID."'>$CommentText</div>"; return $outstr; } # year-month-day hour:minute:second sub DisplayTime { my ($self, $timestamp) = @_; $timestamp =~ /^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/; my $month_name = (January, February, March, April, May, June, July, August, September, October, November, December)[$2-1]; my $ISO8601_str = "$1-$2-$3"."T".$4.":".$5.":".$6."Z"; my $date_str = "$month_name $3, $1"; return " <span class='CommentTime' title='$ISO8601_str'>$date_str</span>"; } sub DisplayError { my ($self, $errorStr) = @_; if($DEBUG) { die $errorStr; } else { return "<div class='CommentError'>Error: " . $errorStr . "</div>"; } } ### Database METHODS ### # Returns the comment type of the ID where # CommentNumber for all rows of Single-Comment IDs is -1 # Returns either: SINGLE COMMENT or MULTI COMMENT sub getConversationDB { my ($self) = @_; return $self->{'db'}; } sub setComment { my ($self, $cHash) = @_; unless(defined($cHash)) { $self->DisplayError("failed to process comment"); } my $db = $self->getConversationDB(); unless($cHash->{'_id'} == -2) { my $OldComment = $db->Comment->get_objects( { ReferenceObject => $cHash->{'ReferenceObject'}, _id => $cHash->{'_id'} } ); unless(defined($OldComment)) { return undef; } $OldComment = $OldComment->[0]; $OldComment->Date( _timestamp() ); $OldComment->Text( $cHash->{'Text'} ); $OldComment->Page( $self->application->cgi->param('page') ); $OldComment->Cgi( '' ); return $OldComment; } my $user = $self->application->session->user(); my $NewComment = $db->Comment->create( { ReferenceObject => $cHash->{'ReferenceObject'}, User => $user, Date => _timestamp(), Text => $cHash->{'Text'}, Page => $Page, Cgi => $Cgi }); return $NewComment; } # Returns a DBTable row (hash of lists) on input items # or returns undef if it couldn't find or found more than one. sub getCommentById { my ($self, $ReferenceObject, $id) = @_; unless(defined($id)) { return undef; } unless(defined($ReferenceObject)) { return undef; } my $db = $self->getConversationDB(); my $comment = $db->Comment->get_objects( { ReferenceObject => $ReferenceObject, _id => $id } ); unless(defined($comment)) { return undef; } return $comment->[0]; } sub getCommentsByURL { my ($self, $Page, $Cgi) = @_; my $db = $self->getConversationDB(); my $Comments = $db->Comment->get_objects({ Page => $Page, Cgi => $Cgi}); unless(defined($Comments)) { return undef} return $self->myComments($Comments); } sub getCommentsByReferenceObject { my ($self, $ReferenceObject) = @_; my $db = $self->getConversationDB(); my $Comments = $db->Comment->get_objects({ ReferenceObject => $ReferenceObject }); unless(defined($Comments)) { return []; } return $self->myComments($Comments); } sub myComments { my ($self, $Comments) = @_; my $db = $self->getConversationDB(); my $User = $self->application()->session()->user(); my $viewable; for(my $i=0; $i < @{$Comments}; $i++) { unless(defined($Comments->[$i])) { next; } if($Comments->[$i]->Private()) { if(defined($db->CommentDirectedAt->get_objects( { Comment => $Comments->[$i], User => $User }))) { push(@{$viewable}, $Comments->[$i]); } } else { push(@{$viewable}, $Comments->[$i]); } } return $viewable; } sub _timestamp { my $self = shift; my ($sec,$min,$hour,$day,$month,$year) = gmtime(time()); $year += 1900; $month += 1; return $year."-".$month."-".$day.' '.$hour.':'.$min.':'.$sec; } sub require_javascript { return ['./Html/Comments.js', './Html/jquery.timeago.js', './Html/jquery-1.3.2.min.js']; } sub require_css { return './Html/Comments.css'; }
teharrison/MG-RAST
src/WebApplication/WebComponent/Comments.pm
Perl
bsd-2-clause
14,301
%query: balance(i,o). balance(T,TB) :- balance55(T,XX0,XX1,[],[(nil,XX0-XX0)|XX1],[],[(TB,I-[])|X],X,I,[]). balance55(nil,C,T,T,A,B,A,B,X,X). balance55(tree(L,V,R),XX0,XX1,NT,HR,TR,[(tree(LB,VB,RB),A-D)|H],[(LB,A-[VB|X]),(RB,X-D)|T],IH,IT) :- balance55(L,XX0,XX1,[(nil,XX2-XX2)|XX3],HR1,TR1,H,T,IH,[V|IT1]), balance55(R,XX2,XX3,NT,HR,TR,HR1,TR1,IT1,IT). balance5(nil,C,T,T,A,B,A,B,X,X) :- balance55(nil,C,T,T,A,B,A,B,X,X). balance5(tree(L,V,R),XX0,XX1,NT,HR,TR,[(tree(LB,VB,RB),A-D)|H],[(LB,A-[VB|X]),(RB,X-D)|T],IH,IT) :- balance55(tree(L,V,R),XX0,XX1,NT,HR,TR,[(tree(LB,VB,RB),A-D)|H],[(LB,A-[VB|X]),(RB,X-D)|T],IH,IT). balance(nil,X-X,A-B,A-B,[(nil,C-C)|T]-T) :- balance5(nil,C,T,T,A,B,A,B,X,X). balance(tree(L,V,R),IH-IT,[(tree(LB,VB,RB),A-D)|H]-[(LB,A-[VB|X]),(RB,X-D)|T],HR-TR,[(nil,XX0-XX0)|XX1]-NT) :- balance5(tree(L,V,R),XX0,XX1,NT,HR,TR,[(tree(LB,VB,RB),A-D)|H],[(LB,A-[VB|X]),(RB,X-D)|T],IH,IT). /*TWDESC Untupled balance of binary tree. Try it if you have time. */
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Logic_Programming/terminweb_old/untupled_bal_tree.pl
Perl
mit
1,020
#!/usr/bin/env perl # # Report on data produced by wc.pl (output file: wordstats.json) # with search terms passed on the command line. # # 2013-12-21 Matthew Smith <matt@smiffytech.com> # use strict; use warnings; use JSON; use Data::Dumper; # Tweets file to process my $datafile = 'wordstats.json'; open IN, $datafile or die($!); my $json = join("", <IN>); close IN; my $jdata = decode_json $json; my @terms = @ARGV; unless (scalar @terms) { print "Usage: counter.pl term1 term2 term3 ... termN\n"; exit; } # First loop - add hashtags to any non-hashtag items. for my $term (@terms) { next if $term =~ /^[@#]/; push(@terms, '#' . $term); } my $total = 0; my $output = ''; for my $term (sort @terms) { if (defined $jdata->{$term}) { $output .= "$term: $jdata->{$term}\n"; $total += $jdata->{$term}; } } $output .= "\nTOTAL: $total\n"; print "\n\n" . $output . "\n\nReport length: " . length($output) . "\n";
smiffytech/twit-archive-tools
counter.pl
Perl
mit
944
use strict; use Data::Dumper; use Carp; # # This is a SAS Component # =head1 NAME all_entities_Regulator =head1 SYNOPSIS all_entities_Regulator [-a] [--fields fieldlist] > entity-data =head1 DESCRIPTION Return all instances of the Regulator entity. Example: all_entities_Regulator -a would retrieve all entities of type Regulator and include all fields in the entities in the output. =head2 Related entities The Regulator entity has the following relationship links: =over 4 =item IsRegulatorFor Regulog =item IsRegulatorForRegulon Regulon =back =head1 COMMAND-LINE OPTIONS Usage: all_entities_Regulator [arguments] > entity.data --fields list Choose a set of fields to return. List is a comma-separated list of strings. -a Return all available fields. --show-fields List the available fields. The following fields are available: =over 4 =item name A human-readable name for this Regulator. =item rfam_id If this regulator is an RNA regulator, the rfam-id field will contain the RFAM identifier corresponding to it. =item tf_family If this regulator is a transcription factor, then the tf-family field will contain the name of the transcription factor family. =item type Type of the regulator; currently either RNA or TF. =item taxonomy Type of the regulator; currently either RNA or TF. =back =head1 AUTHORS L<The SEED Project|http://www.theseed.org> =cut use Bio::KBase::CDMI::CDMIClient; use Getopt::Long; #Default fields my @all_fields = ( 'name', 'rfam_id', 'tf_family', 'type', 'taxonomy' ); my %all_fields = map { $_ => 1 } @all_fields; our $usage = <<'END'; Usage: all_entities_Regulator [arguments] > entity.data --fields list Choose a set of fields to return. List is a comma-separated list of strings. -a Return all available fields. --show-fields List the available fields. The following fields are available: name A human-readable name for this Regulator. rfam_id If this regulator is an RNA regulator, the rfam-id field will contain the RFAM identifier corresponding to it. tf_family If this regulator is a transcription factor, then the tf-family field will contain the name of the transcription factor family. type Type of the regulator; currently either RNA or TF. taxonomy Type of the regulator; currently either RNA or TF. END my $a; my $f; my @fields; my $show_fields; my $help; my $geO = Bio::KBase::CDMI::CDMIClient->new_get_entity_for_script("a" => \$a, "show-fields" => \$show_fields, "h" => \$help, "fields=s" => \$f); if ($help) { print $usage; exit 0; } if ($show_fields) { print "Available fields:\n"; print "\t$_\n" foreach @all_fields; exit 0; } if (@ARGV != 0 || ($a && $f)) { print STDERR $usage, "\n"; exit 1; } if ($a) { @fields = @all_fields; } elsif ($f) { my @err; for my $field (split(",", $f)) { if (!$all_fields{$field}) { push(@err, $field); } else { push(@fields, $field); } } if (@err) { print STDERR "all_entities_Regulator: unknown fields @err. Valid fields are: @all_fields\n"; exit 1; } } my $start = 0; my $count = 1_000_000; my $h = $geO->all_entities_Regulator($start, $count, \@fields ); while (%$h) { while (my($k, $v) = each %$h) { print join("\t", $k, map { ref($_) eq 'ARRAY' ? join(",", @$_) : $_ } @$v{@fields}), "\n"; } $start += $count; $h = $geO->all_entities_Regulator($start, $count, \@fields); }
kbase/kb_seed
scripts/all_entities_Regulator.pl
Perl
mit
3,576
/* Part of Extended Libraries for Prolog Author: Edison Mera Menendez E-mail: efmera@gmail.com WWW: https://github.com/edisonm/xlibrary Copyright (C): 2020, Process Design Center, Breda, The Netherlands. 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(concurrent_forall, [ concurrent_forall/2, concurrent_forall/3 ]). :- use_module(countsols). :- use_module(library(thread), []). :- use_module(library(ordsets)). :- use_module(library(debug)). :- use_module(library(lists)). :- meta_predicate handle_result(+, 0 ), concurrent_forall(0, 0 ), concurrent_forall(0, 0, 0 ). %! concurrent_forall(:Cond, :Action) is semidet. % % Concurrent version of forall/2. This predicate will prove several % alternatives of Cond with Action, using multiple threads. The maximum % number of threads defined is the amount of cores available. If the number % of pending jobs is greater than the number of workers, then the system will % wait until a job is finished before to process the next alternative, this is % done to avoid that the alternatives of Cond could overflow the memory. concurrent_forall(Cond, Action) :- concurrent_forall(Cond, Action, true). %! concurrent_forall(:Cond, :Action, :Join) is semidet. % % Join is called after the execution of Action in the main thread. Sometimes % we still need to execute a part of the code serialized. Is equivalent to % forall(Cond, (Action, ignore(Join))). concurrent_forall(Cond, Action, Join) :- current_prolog_flag(cpu_count, CPUCount), message_queue_create(Done), message_queue_create(Queue), ini_counter(0, Counter), SWorkers = workers(0, []), term_variables(Join, JoinVars), sort(JoinVars, OJoinVars), term_variables(Cond, CondVars), sort(CondVars, OCondVars), ord_subtract(OJoinVars, OCondVars, ExternVars), Templ =.. [v|JoinVars], copy_term(t(Join, Templ, ExternVars), t(Join2, Templ2, ExternVars)), forall(Cond, ( SWorkers = workers(WorkerCount, Workers), Counter = count(I1), concur(done(WorkerCount), I1, I2, Join2, Templ2, Done, cleanup(Workers, Queue), Result, [], Exitted), nb_setarg(1, Counter, I2), handle_result(Result, ( subtract(Workers, Exitted, RemainingWorkers), forall(member(_, RemainingWorkers), thread_send_message(Queue, done)), thread:concur_cleanup(Result, RemainingWorkers, [Queue, Done]) )), inc_counter(Counter, I), ( WorkerCount < CPUCount -> create_worker(Queue, Done, Id, []), succ(WorkerCount, WorkerCount2), nb_setarg(1, SWorkers, WorkerCount2), nb_setarg(2, SWorkers, [Id|Workers]) ; true ), thread_send_message(Queue, goal(I, Action, Templ)) )), SWorkers = workers(WorkerCount, Workers), forall(member(_, Workers), thread_send_message(Queue, done)), Counter = count(I), concur(wait, I, _, Join2, Templ2, Done, cleanup(Workers, Queue), Result, [], Exitted), subtract(Workers, Exitted, RemainingWorkers), thread:concur_cleanup(Result, RemainingWorkers, [Queue, Done]), handle_result(Result, true). handle_result(Result, FailHandler) :- ( Result == true -> true ; Result = false -> FailHandler, fail ; Result = exception(Error) -> throw(Error) ). create_worker(Queue, Done, Id, Options) :- thread_create(worker(Queue, Done), Id, [ at_exit(thread_send_message(Done, finished(Id))) | Options ]). %! worker(+WorkQueue, +DoneQueue) is det. % % Process jobs from WorkQueue and send the results to DoneQueue. worker(Queue, Done) :- thread_get_message(Queue, Message), debug(concurrent, 'Worker: received ~p', [Message]), ( Message = goal(Id, Goal, Vars) -> ( Goal -> thread_send_message(Done, done(Id, Vars)), worker(Queue, Done) ) ; true ). %! concur(+Wait, +N1, -N, :Join, +Vars, +Done:queue, +Cleanup, %! -Result, +Exitted0, -Exitted) is semidet. % % Wait for completion, failure or error. % % @arg Exited List of thread-ids with threads that completed % before all work was done. concur(done(NW), N, N, _, _, Done, _, true, Exitted, Exitted) :- message_queue_property(Done, size(0 )), N =< NW, !. concur(wait, 0, 0, _, _, _, _, true, Exitted, Exitted) :- !. concur(Wait, N1, N, Join, Vars, Done, Cleanup, Status, Exitted1, Exitted) :- debug(concurrent, 'Concurrent: waiting for workers ...', []), catch(thread_get_message(Done, Exit), Error, thread:concur_abort(Error, Cleanup, Done, Exitted1)), debug(concurrent, 'Waiting: received ~p', [Exit]), ( Exit = done(Id, Bind) -> debug(concurrent, 'Concurrent: Job ~p completed', [Id]), ignore(\+ ( Vars = Bind, Join )), N2 is N1 - 1, concur(Wait, N2, N, Join, Vars, Done, Cleanup, Status, Exitted1, Exitted) ; Exit = finished(Thread) -> thread_join(Thread, JoinStatus), debug(concurrent, 'Concurrent: waiter ~p joined: ~p', [Thread, JoinStatus]), ( JoinStatus == true -> concur(Wait, N1, N, Join, Vars, Done, Cleanup, Status, [Thread|Exitted1], Exitted) ; Status = JoinStatus, Exitted = [Thread|Exitted1] ) ).
TeamSPoon/logicmoo_workspace
packs_lib/xlibrary/prolog/concurrent_forall.pl
Perl
mit
7,055
package IF::Interface::Mapping; use strict; # TODO remove any of the goopy Asset stuff # Override where appropriate sub mappingTitle { my ($self) = @_; return $self->valueForKey("assetName") || $self->valueForKey("name"); } sub mappingDescription { my ($self) = @_; return $self->valueForKey("description") || $self->valueForKey("mission"); } sub mappingViewerUrl { my ($self, $context) = @_; if (UNIVERSAL::can($self, "assetExternalViewerUrl")) { return $self->assetExternalViewerUrl($context); } return $self->valueForKey("assetExternalViewerUrl"); } sub mappingAddressKeys { my ($self) = @_; return [ qw( add1 add2 city state country ) ]; } sub mappingAddress { my ($self, $context) = @_; my $keys = $self->mappingAddressKeys(); my $address = []; foreach my $key (@$keys) { my $v = $self->valueForKey($key); next unless $v; push (@$address, $v); } return join(", ", @$address); } # you could override these if you think you know better... sub mappingLatitude { my ($self) = @_; if ($self->valueForKey("geocodedAddressId")) { return $self->valueForKey("geocodedAddress.latitude"); } if ($self->valueForKey("geographicCityId")) { return $self->valueForKey("geographicCity.latitude"); } return undef; } sub mappingLongitude { my ($self) = @_; if ($self->valueForKey("geocodedAddressId")) { return $self->valueForKey("geocodedAddress.longitude"); } if ($self->valueForKey("geographicCityId")) { return $self->valueForKey("geographicCity.longitude"); } return undef; } sub mappingAssetType { my ($self) = @_; return $self->valueForKey("assetType"); } 1;
quile/if-framework
framework/lib/IF/Interface/Mapping.pm
Perl
mit
1,751
use strict; use warnings; use Carp; use Bio::SeqIO; use Bio::SeqI; use Data::Dumper; use File::Temp; use File::Copy; use File::Basename; my $n = 0; my %start; my %end; my %type; my %score; my %strand; my $r = 0; my %repeats; my $max = 0; my %BOX; my $boxstart; my $boxend; my $boxnum = 0; my $boxstrand; my %boxstart; my %boxstrand; my %boxend; my $A_start; my $A_end; my $A_score = 0; my $A_hitstrand; my $A_hitstart; my $A_hitend; my $B_start; my $B_end; my $B_score = 0; my $B_hitstrand; my $B_hitstart; my $B_hitend; my $in_box = 0; my $start; my $end; my $hitscore = 0; my $hitstart = 0; my $hitend = 0; my $hitstrand = 0; my %brokencoords; my %brokenscore; my %brokendisrupt; if (!exists($ENV{KB_TOP})) { die "$0: KB_TOP not set in environment - required for this application"; } my $HMM_DIR = "$ENV{KB_TOP}/libexec/strep_repeats/Repeat_HMMs"; -d $HMM_DIR || die "HMM dir $HMM_DIR not found"; my $HMMLS = "$ENV{KB_TOP}/libexec/strep_repeats/hmmls"; -x $HMMLS || die "hmmls not fount at $HMMLS"; my $tmpdir = File::Temp::tempdir(undef, CLEANUP => 1); my @repeats = ("boxA","boxB","boxC","boxD","boxE","boxF"); # repeats being analysed my %cutoffs = ( # cutoff scores for HMM analysis "boxA" => 60, "boxB" => 30, "boxC" => 30, "boxD" => 45, "boxE" => 80, "boxF" => 75, ); my %hmms = ( "boxA" => "$HMM_DIR/suis_boxA.hmm", # paths of HMM for analysis "boxB" => "$HMM_DIR/suis_boxB.hmm", "boxC" => "$HMM_DIR/suis_boxC.hmm", "boxD" => "$HMM_DIR/suis_boxD.hmm", "boxE" => "$HMM_DIR/suis_boxE.hmm", "boxF" => "$HMM_DIR/suis_boxF.hmm", ); my %input_files = ( "boxA" => "boxA.rep", # output files from HMM analysis "boxB" => "boxB.rep", "boxC" => "boxC.rep", "boxD" => "boxD.rep", "boxE" => "boxE.rep", "boxF" => "boxF.rep", ); # # Read from the one file if it is there, or STDIN otherwise. # my $input_file; if (@ARGV == 0) { $input_file = "$tmpdir/input_file"; copy(\*STDIN, $input_file); } elsif (@ARGV == 1) { $input_file = $ARGV[0]; } else { die "Usage: $0 [input-file] > output\n"; } { my $seq = $input_file; my $sbase = basename($seq); foreach my $repeat (@repeats) { print STDERR "Searching sequence $seq for repeat $repeat..."; run_system("$HMMLS -c -t $cutoffs{$repeat} $hmms{$repeat} $seq > $tmpdir/$sbase.$input_files{$repeat}"); print STDERR "done\n"; } } my %seen; open(OUT, ">&STDOUT") or confess "Cannot reopen STDOUT: $!"; { my $genome = $input_file; my $gbase = basename($genome); foreach my $repeat (sort keys %input_files) { open(IN, "<", "$tmpdir/$gbase.$input_files{$repeat}") or die print "Cannot open input file\n"; foreach (<IN>) { chomp; if (my ($score) = /^(\d+\.\d+)/) { $score = $1; my ($start, $end) = /\sf\:\s*(\d+)\s+t\:\s*(\d+)/; if (($score > $cutoffs{$repeat}) && $start && $end) { $start{$r} = $start; $end{$r} = $end; $type{$r} = $repeat; $score{$r} = $score; if ($end{$r} > $start{$r}) { $strand{$r} = 1; } else { $strand{$r} = -1; } } $r++; } } $max = 0; } print STDERR "Identified repeat units in sequence $genome\n"; foreach my $repeata (sort {$start{$a} <=> $start{$b}} keys %start) { # identify composite BOX elements from box modules unless (defined($seen{$repeata}) && $seen{$repeata} == 1) { $boxstrand = $strand{$repeata}; $boxstart = $start{$repeata}; @{$BOX{$boxnum}} = "$repeata"; if ($boxstrand == 1) { $boxend = $end{$repeata}+5; # five base leeway for finding the adjacent boxB element foreach my $repeatb (sort {$start{$a} <=> $start{$b}} keys %start) { if (($repeata != $repeatb) && ($start{$repeatb} <= $boxend && $start{$repeatb} >= $boxstart) && $strand{$repeatb} == $boxstrand) { $boxend = $end{$repeatb}+5; # need to stop BOX elements being added if already part of a BOX push(@{$BOX{$boxnum}},$repeatb); } } if ($#{$BOX{$boxnum}} > 0) { $boxstart{$boxnum} = $boxstart; $boxend{$boxnum} = $boxend-5; $boxstrand{$boxnum} = $boxstrand; foreach my $num (@{$BOX{$boxnum}}) { $seen{$num} = 1; } $boxnum++; } } } } foreach my $repeata (sort {$start{$b} <=> $start{$a}} keys %start) { # identify composite BOX elements from box modules unless (defined($seen{$repeata}) && $seen{$repeata} == 1) { $boxstrand = $strand{$repeata}; $boxstart = $start{$repeata}; @{$BOX{$boxnum}} = "$repeata"; if ($boxstrand == -1) { $boxend = $end{$repeata}-5; foreach my $repeatb (sort {$start{$b} <=> $start{$a}} keys %start) { if (($repeata != $repeatb) && ($start{$repeatb} >= $boxend && $start{$repeatb} <= $boxstart) && $strand{$repeatb} == $boxstrand) { $boxend = $end{$repeatb}-5; # greater leeway than with pneumo, HMMs not as well defined push(@{$BOX{$boxnum}},$repeatb); } } if ($#{$BOX{$boxnum}} > 0) { $boxstart{$boxnum} = $boxstart; $boxend{$boxnum} = $boxend+5; $boxstrand{$boxnum} = $boxstrand; foreach my $num (@{$BOX{$boxnum}}) { $seen{$num} = 1; } $boxnum++; } } } } $in_box = 0; print STDERR "Identified composite BOX elements\n"; delete($BOX{$boxnum}); my %overlaps; foreach my $repeata (sort keys %start) { # identify overlapping repeat elements, except BOX modules foreach my $repeatb (sort keys %start) { if (($start{$repeatb} <= $start{$repeata} && $end{$repeatb} >= $start{$repeata}) || ($start{$repeatb} <= $end{$repeata} && $end{$repeatb} >= $end{$repeata})) { unless (($type{$repeata} =~ /box/ && $type{$repeatb} =~ /box/) || ($repeata == $repeatb)) { my @unsorted = ($repeata,$repeatb); my @sorted = sort(@unsorted); $overlaps{$sorted[0]} = $sorted[1]; } } } } print STDERR "Printing output files\n"; foreach my $repeat (sort keys %start) { if ($start{$repeat} eq "BROKEN") { if ($strand{$repeat} == 1) { print OUT "FT repeat_unit order(${$brokencoords{$repeat}}[0]..${$brokencoords{$repeat}}[1],${$brokencoords{$repeat}}[2]..${$brokencoords{$repeat}}[3])\n"; } elsif ($strand{$repeat} == -1) { print OUT "FT repeat_unit complement(${$brokencoords{$repeat}}[0]..${$brokencoords{$repeat}}[1],${$brokencoords{$repeat}}[2]..${$brokencoords{$repeat}}[3])\n"; } print OUT "FT /colour=2\n"; print OUT "FT /label=$type{$repeat}\n"; print OUT "FT /note=Detected using HMMER hmmls; appears to have been disrupted through $brokendisrupt{$repeat} insertion\n"; print OUT "FT /note=Initial match of score $score{$repeat} to model $type{$repeat}; realignment score of $brokenscore{$repeat}\n"; } else { if ($strand{$repeat} == 1) { print OUT "FT repeat_unit $start{$repeat}..$end{$repeat}\n"; } elsif ($strand{$repeat} == -1) { print OUT "FT repeat_unit complement($start{$repeat}..$end{$repeat})\n"; } print OUT "FT /colour=2\n"; print OUT "FT /label=$type{$repeat}\n"; print OUT "FT /note=Detected using HMMER hmmls; match of score $score{$repeat} to model $type{$repeat}\n"; } } foreach my $boxnum (sort keys %BOX) { if ($boxstrand{$boxnum} == 1) { print OUT "FT repeat_unit $boxstart{$boxnum}..$boxend{$boxnum}\n"; } else { print OUT "FT repeat_unit complement($boxstart{$boxnum}..$boxend{$boxnum})\n"; } print OUT "FT /colour=4\n"; print OUT "FT /note=Composite BOX element\n"; print OUT "FT /label=BOX\n"; } undef(%start); undef(%end); undef(%type); undef(%score); undef(%strand); undef(%repeats); undef(%BOX); undef(%boxstart); undef(%boxstrand); undef(%boxend); undef(%brokencoords); undef(%brokenscore); undef(%brokendisrupt); } close OUT; print STDERR "Done\n"; sub boundaries { # subroutine for identifying repeat boundaries, esp BOX elements my $rep = shift; if ($type{$rep} =~ /box/) { foreach $boxnum (sort keys %BOX) { foreach my $module (@{$BOX{$boxnum}}) { if ($module == $rep) { my @unsorted = ("$boxstart{$boxnum}","$boxend{$boxnum}"); my @sorted = sort(@unsorted); $start = $sorted[0]; $end = $sorted[1]; $in_box = 1; } } } } if ($in_box == 0) { my @unsorted = ("$start{$rep}","$end{$rep}"); my @sorted = sort(@unsorted); $start = $sorted[0]; $end = $sorted[1]; } $in_box = 0; return($start,$end); } sub print_fasta { # subroutine for printing sequence in a suitable format for hmmls my $filename = shift; my $dna_string = shift; my $fh; open($fh, ">", $filename) or confess "Cannot write $filename: $!"; print $fh ">$filename\n"; my $offset = 0; while ($offset < 440) { my $line = substr($dna_string,$offset,60); print $fh "$line\n"; $offset+=60; } my $line = substr($dna_string,$offset,(500-$offset)); print $fh "$line\n"; close $fh; } sub hmm_results { # subroutine for picking the top hit from the hmmls results my $filename = shift; open(HMM, "<", $filename) or confess "Cannot open HMM file $filename: $!"; $hitscore = 0; foreach (<HMM>) { my @data = split(/\s+/,$_); if (substr($_,0,2) =~ /\d\d/) { if ($data[0] > $hitscore) { if ($data[3] < $data[5] && $data[3] <= 250 && $data[5] >= 250) { $hitstrand = 1; $hitscore = $data[0]; $hitstart = $data[3]; $hitend = $data[5]; } elsif ($data[5] < $data[3] && $data[3] >= 250 && $data[5] <= 250) { $hitstrand = -1; $hitscore = $data[0]; $hitstart = $data[3]; $hitend = $data[5]; } } } } close HMM; return($hitstart,$hitend,$hitscore,$hitstrand); } sub run_system { my(@cmd) = @_; my $rc = system(@cmd); if ($rc != 0) { confess "Command failed with rc=$rc: @cmd"; } }
kbase/strep_repeats
scripts/suis_repeat_annotation.pl
Perl
mit
10,015
#!/usr/bin/perl die "usage: $0 <file>" unless @ARGV >= 1; my $maxh = 0; my $o = 0; my $stat = 0; my $add_pixmap = ''; my (%pxm, %map_map); my @pxm; my $check_mask = ''; my $do_icon = 0; print "/*\n This file generated from ../gtk/pixmaps.c with xstatusbar.pl\n" . "*/\n\n"; my $pixmaps = shift; #xpm_read('abc_pixmap.dat', 'abc'); $do_icon = 1; xpm_read($pixmaps, 'icon'); foreach( sort keys %pxm ) { print $pxm{$_} . "\n"; push @pxm, $_ if($_ !~ /_mask$/); } #my $n = 0; #foreach( @pxm ) { # print "#define " . uc($_) . " $n\n"; # $n++; #} #print "\nstatic void *pixmaps[]= {\n"; #foreach( @pxm ) { # print " \&$_, " . (defined($map_map{$_ . '_mask'}) ? "\&" . $map_map{$_ . '_mask'} : "NULL") . ",\n"; #} #print "};\n"; my $xstates = join(', ', keys %xstates); my $idx = 1000; my $w; foreach(sort keys %xoverlay) { $idx--; $w = 900 if /^tape/; $w = 800 if /^mdr/; $w = 700 if /^disk/; $w = 600 if /^pause/; $w = 500 if /^mouse/; $overlay{sprintf('%04d', $idx - $w)} = $_; # print sprintf('%04d', $idx - $w) . " $_\n"; } foreach(sort keys %overlay) { my $n = $overlay{$_}; my $N = uc $n; $overlay .= <<EOS; switch( ${n}_state ) { case UI_STATUSBAR_STATE_ACTIVE: x = ${N}_ACTIVE_OFF; w = ${N}_ACTIVE_W; h = ${N}_ACTIVE_H; break; case UI_STATUSBAR_STATE_INACTIVE: x = ${N}_INACTIVE_OFF; w = ${N}_INACTIVE_W; h = ${N}_INACTIVE_H; break; case UI_STATUSBAR_STATE_NOT_AVAILABLE: w = 0; break; } if( w ) xstatusbar_put_icon( x, w, h ); EOS } print "#define PIXMAPS_W $offset\n#define PIXMAPS_H $maxh\n\n"; print <<EOS; static ui_statusbar_state $xstates; static int status_updated; static int icon_size = 0; static void xstatusbar_add_pixmap(int x, int pw, int h, libspectrum_word *colors) { int y = 3 * DISPLAY_SCREEN_HEIGHT; x *= icon_size; for( ; h > 0; h-- ) { int w = pw; for( ; w > 0; w-- ) { int i; for( i = icon_size; i > 0; i-- ) { xdisplay_putpixel( x, y, colors); if( icon_size > 1 ) xdisplay_putpixel( x, y + 1, colors); if( icon_size > 2 ) xdisplay_putpixel( x, y + 2, colors); x++; } colors++; } x -= pw * icon_size; y += icon_size; } } /* put status icons to X(Shm)Image extra area */ void xstatusbar_init( int size ) { if( icon_size == size ) return; icon_size = size; $add_pixmap} static void xstatusbar_put_icon( int x, int w, int h ) { static int dx = 0; static int dy = 0; w *= icon_size; x *= icon_size; h *= icon_size; if( x < 0 || dx == 0 ) { dx = ( DISPLAY_ASPECT_WIDTH - 2 ) * xdisplay_current_size; dy = ( DISPLAY_SCREEN_HEIGHT - 2 ) * xdisplay_current_size - PIXMAPS_H * icon_size; return; } dx -= w; if( shm_used ) { #ifdef X_USE_SHM /* FIXME: should wait for an ShmCompletion event here */ XShmPutImage( display, xui_mainWindow, gc, image, x, 3 * DISPLAY_SCREEN_HEIGHT, dx, dy, w, h, True ); #endif /* #ifdef X_USE_SHM */ } else { XPutImage( display, xui_mainWindow, gc, image, x, 3 * DISPLAY_SCREEN_HEIGHT, dx, dy, w, h ); } dx -= 4; /* 4px space */ } void xstatusbar_overlay( void ) { int x = 0, w = 0, h; xstatusbar_put_icon( -1, 0, 0 ); $overlay status_updated = 0; } EOS #static char* <variable_name>[] = { #<Values> #<Colors> #<Pixels> #<Extensions> sub xpm_read() { my $st = '<variable_name>'; my( $var_name, $width, $height, $colors, $depth, $char, $dim, $w, $h ); my %colors; my $col; my $def; my $do = $_[1]; my $mask; local $offset = 0; open FILE, '<', $_[0]; while(<FILE>) { s!/\*.*\*/!!g; if( $st eq '<variable_name>' ) { #static char * <pixmap_name>[] = { if( /\s*(static\s+)?char\s*\*\s*([^[]+)\[/ ) { $var_name = $2; next if($var_name =~ /tape_marker/); next if($var_name =~ /pause/); next if($var_name =~ /mouse/); $var_name =~ s/gtkpixmap/pixmap/; %colors = (); $def = ''; $col = 'AA'; $mask = $do eq 'icon' ? 'add mask' : ( $var_name =~ /_mask$/ ? 'mask' : 'no mask'); $st = '<Values>' } } elsif( $st eq '<Values>' ) { #<width><height><numcolors><cpp> [ <x_hotspot><y_hotspot> ] [ XPMEXT ] if( /\s*\x22\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/ ) { ($width, $height, $colors, $depth) = ($1, $2, $3, $4); ($w, $h) = ($width + 1, $height); # $dim = "$width, $height, \n"; $maxh = $height if( $do_icon && $mask ne 'mask' && $height > $maxh ); $st = '<Colors>' } } elsif( $st eq '<Colors>' ) { #<character> { <key> <color> } { <key> <color> } if( /\s*\x22\s*([ -~])\s+c\s+(\x23[0-9a-fA-F]{6}|None)/ ) { if( substr( $2, 0, 1 ) eq '#' ) { $_ = '0x' . sprintf('%04x', ((hex( substr( $2, 1, 2 ) ) >> 3) << 11) + ((hex( substr( $2, 3, 2 ) ) >> 2) << 5) + ((hex( substr( $2, 5, 2 ) ) >> 3)) ); # $colors{$1} .= sprintf('%04x', $_ ); $def .= "#define $col $_,\n"; $colors{$1} = $col; $mask{$1} = '1,'; $col++; } else { $colors{$1} = '__'; $mask{$1} = '0,'; $def = "#define __ 0x0,\n" . $def; } $colors--; $st = '<Pixels>' if( !$colors ) ; } } elsif( $st eq '<Pixels>' ) { #<width><height><numcolors><cpp> [ <x_hotspot><y_hotspot> ] [ XPMEXT ] if( /\s*\x22(.{$w})/ ) { $pxm{$var_name} .= ' ' . join( ' ', map { $colors{chr($_)} } unpack("C[$w]") ) . "\n" if( $mask ne 'mask'); # $pxm{$var_name . '_mask'} .= ' ' . join( ' ', map { $mask{chr($_)} } unpack("C[$w]") ) . "\n" if( $mask eq 'add mask'); # $pxm{$var_name} .= ' ' . join( ' ', map { $mask{chr($_)} } unpack("C[$w]") ) . "\n" if( $mask eq 'mask'); $h--; if( !$h ) { $st = '<variable_name>'; if( $mask ne 'no mask') { my $mask_name = $mask eq 'mask' ? $var_name : $var_name . '_mask'; $_ = $pxm{$mask_name}; if( ! /0/ ) { if( $mask eq 'add mask') { delete( $pxm{$var_name . '_mask'}); } if( $mask eq 'mask') { delete( $pxm{$var_name} ); next; } } elsif ($check_mask =~ /\n([^=]+?)=$_=/) { $map_map{$mask_name} = $1; if( $mask eq 'add mask') { delete( $pxm{$var_name . '_mask'}); } if( $mask eq 'mask') { delete( $pxm{$var_name} ); next; } } else { $map_map{$mask_name} = $mask_name; $check_mask .= "\n" . $mask_name . "=$_="; } } my $defdim = "#define " . uc($var_name) . "_OFF $offset\n" . "#define " . uc($var_name) . "_W $width\n" . "#define " . uc($var_name) . "_H $height"; if( $do eq 'icon' ) { $add_pixmap .= " xstatusbar_add_pixmap( " . uc($var_name) . "_OFF, " . uc($var_name) . "_W, " . uc($var_name) . "_H, ${var_name});\n"; my $name = $var_name; $name =~ s/_(in)?active$//i; $xstates{"${name}_state"} = 1; $xoverlay{$name} = 1; } $offset += $width if( $do eq 'icon' ); $pxm{$var_name} = "$def\n$defdim\nstatic libspectrum_word ${var_name}[] = {\n$dim" . $pxm{$var_name} if( $mask ne 'mask'); $def =~ s/\x23define (..).*/#undef $1/g; $pxm{$var_name} .= "};\n\n$def" if( $mask ne 'mask'); $pxm{$var_name . '_mask'} = "static libspectrum_byte ${var_name}_mask[] = {\n" . $pxm{$var_name . '_mask'} if( $mask eq 'add mask' and defined( $pxm{$var_name . '_mask'} ) ); $pxm{$var_name} = "static libspectrum_byte ${var_name}[] = {\n" . $pxm{$var_name} if( $mask eq 'mask'); $pxm{$var_name . '_mask'} .= "};\n" if( $mask ne 'no mask' and defined( $pxm{$var_name . '_mask'} )); $maxh = $h if( $do_icon && $mask ne 'mask' && $h > $maxh ); } } } } close FILE; };
FinnAngelo/Tomfoolery
ZX/Fuse-Spectrum/fuse/ui/xlib/xstatusbar.pl
Perl
mit
8,131
transfer_rule([[action, switch], [prep, on]], [[action, allumer]]). transfer_rule([[action, switch], [prep, off]], [[action, éteindre]]). transfer_rule([[tense, imperative]], []). transfer_rule([[tense, present]], []). transfer_rule([[spec, the_sing]], []). transfer_rule([[pronoun, you]], []). transfer_rule([[prep, in_loc]], []). transfer_rule([[voice, active]], []). transfer_lexicon([utterance_type, imp], [utterance_type, command]). transfer_lexicon([utterance_type, ynq], [utterance_type, query]). transfer_lexicon([verb, be], [state, être]). transfer_lexicon([action, dim], [action, baisser]). transfer_lexicon([device, light], [device, lampe]). transfer_lexicon([device, fan], [device, ventilateur]). transfer_lexicon([location, kitchen], [location, cuisine]). transfer_lexicon([location, living_room], [location, salon]). transfer_lexicon([prep, on], [onoff, allumé]). transfer_lexicon([prep, off], [onoff, éteint]). transfer_lexicon([adj, on], [onoff, allumé]). transfer_lexicon([adj, off], [onoff, éteint]). role_transfer_rule(null, null). role_transfer_rule(agent, agent). role_transfer_rule(object, object). role_transfer_rule(adj, adj). role_transfer_rule(in_loc, loc).
TeamSPoon/logicmoo_workspace
packs_sys/logicmoo_nlu/ext/regulus/Examples/Toy1RoleMarked/Prolog/eng_to_fre.pl
Perl
mit
1,204
package O2CMS::Template::Taglibs::O2CMS::Html; use strict; use O2 qw($context); #-------------------------------------------------------------------------------------------- sub register { # Method called by the tag-parser to see what and how methods should be called my ($package, %params) = @_; my $obj = bless { parser => $params{parser} }, $package; my %methods = ( cmsLink => 'postfix', ); return ($obj, %methods); } #-------------------------------------------------------------------------------------------- sub cmsLink { my ($obj, %params) = @_; my $url; if (my $editObject = delete $params{editObject}) { my $object = $obj->{parser}->findVar($editObject); my $name = $context->getSingleton('O2::Javascript::Data')->escapeForSingleQuotedString( $object->getMetaName() ); $url = sprintf "javascript: top.openObject('%s', '%d', '%s')", $object->getMetaClassName(), $object->getId(), $name; } elsif (my $className = delete $params{newObjectClass}) { my $urlMod = $context->getSingleton('O2::Util::UrlMod'); my $queryString = $urlMod->_updateQueryString('', %params); $url = "javascript: top.newObject('$className', '$params{parentId}', '$queryString')"; } elsif (my $startMenuItemId = delete $params{startMenuItem}) { my $menuItem = $obj->_getStartMenuItemHashById($startMenuItemId) or die "Didn't find start menu item: $startMenuItemId"; my $iconMgr = $context->getSingleton('O2::Image::IconManager'); my $iconSrc = $menuItem->{iconClass} ? $iconMgr->getIconUrl( $menuItem->{iconClass}, 24 ) : $menuItem->{icon}; my $name = $context->getLang()->getString( $menuItem->{name} ); $name = $context->getSingleton('O2::Javascript::Data')->escapeForSingleQuotedString($name); $url = "javascript: top.openInFrame('$menuItem->{action}', '$iconSrc', '$name')"; } return $obj->{parser}->getTaglibByName('Html')->link(%params, url => $url); } #-------------------------------------------------------------------------------------------- sub _getStartMenuItemHashById { my ($obj, $id) = @_; my @configFiles = ( $context->getCustomerPath() . '/etc/conf/startMenu.conf', $context->getCmsPath() . '/etc/conf/startMenu.conf', ); foreach my $file (@configFiles) { my $plds = do $file; if (ref $plds eq 'ARRAY') { ARRAY_ITEM: foreach my $hash (@{$plds}) { return $hash if $hash->{id} eq $id; my $subMenuItems = $hash->{subMenus} or next ARRAY_ITEM; my $item = $obj->_getStartMenuItemHashByIdAndSubMenuItems($id, $subMenuItems); return $item if $item; } } elsif (ref $plds eq 'HASH') { return $plds if $plds->{id} eq $id; my $subMenuItems = $plds->{subMenus} or next; my $item = $obj->_getStartMenuItemHashByIdAndSubMenuItems($id, $subMenuItems); return $item if $item; } } } #-------------------------------------------------------------------------------------------- sub _getStartMenuItemHashByIdAndSubMenuItems { my ($obj, $id, $subMenuItems) = @_; foreach my $item (@{$subMenuItems}) { return $item if $item->{id} eq $id; my $subMenuItems = $item->{subMenus}; $item = $obj->_getStartMenuItemHashByIdAndSubMenuItems($id, $subMenuItems); return $item if $item; } return; } #-------------------------------------------------------------------------------------------- 1;
haakonsk/O2-CMS
lib/O2CMS/Template/Taglibs/O2CMS/Html.pm
Perl
mit
3,435
package K; my $s = 2;
alehander42/pseudon-perl
example/assign.pl
Perl
mit
23
new13(A,B,C,D,E,F,G) :- B=0. new13(A,B,C,D,E,F,G) :- H=1+D, I=1+E, B=< -1, new4(A,C,H,I,F,G). new13(A,B,C,D,E,F,G) :- H=1+D, I=1+E, B>=1, new4(A,C,H,I,F,G). new12(A,B,C,D,E,F) :- G=1, C>=0, new13(A,G,B,C,D,E,F). new12(A,B,C,D,E,F) :- G=0, C=< -1, new13(A,G,B,C,D,E,F). new11(A,B,C,D,E,F) :- A=< -1, new12(A,B,C,D,E,F). new11(A,B,C,D,E,F) :- A>=1, new12(A,B,C,D,E,F). new11(A,B,C,D,E,F) :- G=2+C, H=3+D, A=0, new4(A,B,G,H,E,F). new9(A,B,C,D,E,F) :- new3(A,B,C,D,E,F). new8(A,B,C,D,E,F) :- B-C>=2, new11(A,B,C,D,E,F). new8(A,B,C,D,E,F) :- B-C=<1, new12(A,B,C,D,E,F). new6(A,B,C,D,E,F) :- new3(A,B,C,D,E,F). new5(A,B,C,D,E,F) :- D-F=< -1, new8(A,B,C,D,E,F). new5(A,B,C,D,E,F) :- D-F>=0, new9(A,B,C,D,E,F). new4(A,B,C,D,E,F) :- B-C>=1, new5(A,B,C,D,E,F). new4(A,B,C,D,E,F) :- B-C=<0, new6(A,B,C,D,E,F). new3(A,B,C,D,E,F) :- G=0, B-C>=1, new4(A,B,C,G,E,F). new2(A) :- B=0, C=4+D, new3(A,E,B,F,C,D). new1 :- new2(A). false :- new1.
bishoksan/RAHFT
benchmarks_scp/misc/programs-clp/INVGEN-SpamAssassin-loop_ok.map.c.map.pl
Perl
apache-2.0
926
package Paws::SimpleWorkflow::LambdaFunctionStartedEventAttributes; use Moose; has ScheduledEventId => (is => 'ro', isa => 'Int', request_name => 'scheduledEventId', traits => ['NameInRequest'], required => 1); 1; ### main pod documentation begin ### =head1 NAME Paws::SimpleWorkflow::LambdaFunctionStartedEventAttributes =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::SimpleWorkflow::LambdaFunctionStartedEventAttributes object: $service_obj->Method(Att1 => { ScheduledEventId => $value, ..., ScheduledEventId => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::SimpleWorkflow::LambdaFunctionStartedEventAttributes object: $result = $service_obj->Method(...); $result->Att1->ScheduledEventId =head1 DESCRIPTION Provides the details of the C<LambdaFunctionStarted> event. It isn't set for other event types. =head1 ATTRIBUTES =head2 B<REQUIRED> ScheduledEventId => Int The ID of the C<LambdaFunctionScheduled> event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::SimpleWorkflow> =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/SimpleWorkflow/LambdaFunctionStartedEventAttributes.pm
Perl
apache-2.0
1,761
=head1 LICENSE # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute # Copyright [2016-2017] EMBL-European Bioinformatics Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. =head1 CONTACT Please email comments or questions to the public Ensembl developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. Questions may also be sent to the Ensembl help desk at <http://www.ensembl.org/Help/Contact>. =cut =head1 NAME Bio::EnsEMBL::Analysis::Runnable::SamtoolsMerge - =head1 SYNOPSIS Do NOT instantiate this class directly: must be instantiated from a subclass (see ExonerateTranscript, for instance). =head1 DESCRIPTION =head1 APPENDIX The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ =cut package Bio::EnsEMBL::Analysis::Runnable::SamtoolsMerge; use warnings; use strict; use vars qw(@ISA); use Bio::EnsEMBL::Analysis::Runnable::BaseBamMerge; @ISA = qw(Bio::EnsEMBL::Analysis::Runnable::BaseBamMerge); sub new { my ($class,@args) = @_; my $self = $class->SUPER::new(@args); $self->samtools($self->program); return $self; } ############################################################ # # Analysis methods # ############################################################ =head2 run Usage : $obj->run($workdir, $args) Function: Runs exonerate script and puts the results into the file $self->results It calls $self->parse_results, and results are stored in $self->output =cut sub run { my ($self) = @_; my $input_files = $self->input_files; $input_files = $input_files->[0] if (scalar(@{$input_files}) == 1); $self->samtools->merge($self->options, $self->output_file, $input_files); $self->check_output_file; return 1; } 1;
james-monkeyshines/ensembl-analysis
modules/Bio/EnsEMBL/Analysis/Runnable/SamtoolsMerge.pm
Perl
apache-2.0
2,338
package UI::VisualStatus; # # Copyright 2015 Comcast Cable Communications Management, 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. # # # use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use Data::Dumper; use JSON; sub graphs { my $self = shift; my $match_string = $self->param('matchstring'); my @cdn_names; my ( $ds_name, $loc_name, $host_name ) = split( /:/, $match_string ); if ( $host_name ne 'all' ) { # we want a specific host, it has to be in only one CDN my $server = $self->db->resultset('Server')->search( { host_name => $host_name }, { prefetch => 'cdn' } )->single(); push( @cdn_names, $server->cdn->name ); } elsif ( $ds_name ne 'all' ) { # we want a specific DS, it has to be in only one CDN my $ds = $self->db->resultset('Deliveryservice')->search( { xml_id => $ds_name }, { prefetch => 'cdn' } )->single(); push( @cdn_names, $ds->cdn->name ); } else { # we want all the CDNs with edges @cdn_names = $self->db->resultset('Server')->search({ 'type.name' => 'EDGE' }, { prefetch => [ 'cdn', 'type' ], group_by => 'cdn.name' } )->get_column('cdn.name')->all(); } my $pparam = $self->db->resultset('ProfileParameter') ->search( { -and => [ 'parameter.name' => 'visual_status_panel_1', 'profile.name' => 'GLOBAL' ] }, { prefetch => [ 'parameter', 'profile' ] } )->single(); my $p1_url = defined($pparam) ? $pparam->parameter->value : undef; $pparam = $self->db->resultset('ProfileParameter') ->search( { -and => [ 'parameter.name' => 'visual_status_panel_2', 'profile.name' => 'GLOBAL' ] }, { prefetch => [ 'parameter', 'profile' ] } )->single(); my $p2_url = defined($pparam) ? $pparam->parameter->value : undef; $self->stash( cdn_names => \@cdn_names, panel_1_url => $p1_url, panel_2_url => $p2_url ); &navbarpage($self); } sub graphs_redis { my $self = shift; my $match_string = $self->param('matchstring'); my @cdn_names; my $ds_capacity = 0; my ( $ds_name, $loc_name, $host_name ) = split( /:/, $match_string ); if ( $host_name ne 'all' ) { # we want a specific host, it has to be in only one CDN my $server = $self->db->resultset('Server')->search( { host_name => $host_name }, { prefetch => 'cdn' } )->single(); push( @cdn_names, $server->cdn->name ); } elsif ( $ds_name ne 'all' ) { # we want a specific DS, it has to be in only one CDN my $ds = $self->db->resultset('Deliveryservice')->search( { xml_id => $ds_name }, { prefetch => 'cdn' } )->single(); push( @cdn_names, $ds->cdn->name ); $ds_capacity = $ds->global_max_mbps / 1000; # everything is in kbps in the stats } else { # we want all the CDNs with edges @cdn_names = $self->db->resultset('Server')->search({ 'type.name' => 'EDGE' }, { prefetch => [ 'cdn', 'type' ], group_by => 'cdn.name' } )->get_column('cdn.name')->all(); } $self->stash( cdn_names => \@cdn_names, graph_page => 1, matchstring => $match_string, ds_capacity => $ds_capacity, ); &navbarpage($self); } sub daily_summary { my $self = shift; my @cdn_names = $self->db->resultset('Server')->search({ 'type.name' => 'EDGE' }, { prefetch => [ 'cdn', 'type' ], group_by => 'cdn.name' } )->get_column('cdn.name')->all(); my $tool_instance = $self->db->resultset('Parameter')->search( { -and => [ name => 'tm.instance_name', config_file => 'global' ] } )->get_column('value')->single(); $self->stash( cdn_names => \@cdn_names, tool_instance => $tool_instance, graph_page => 1, ); &navbarpage($self); } 1;
hbeatty/traffic_control
traffic_ops/app/lib/UI/VisualStatus.pm
Perl
apache-2.0
4,076
=head1 LICENSE Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut =pod =head1 NAME Bio::EnsEMBL::Compara::RunnableDB::LoadMembersFromFiles =head1 DESCRIPTION This Runnable loads one entry into 'genome_db' table and passes on the genome_db_id. The format of the input_id follows the format of a Perl hash reference. Examples: { 'species_name' => 'Homo sapiens', 'assembly_name' => 'GRCh37' } { 'species_name' => 'Mus musculus' } supported keys: 'locator' => <string> one of the ways to specify the connection parameters to the core database (overrides 'species_name' and 'assembly_name') 'species_name' => <string> mandatory, but what would you expect? 'assembly_name' => <string> optional: in most cases it should be possible to find the species just by using 'species_name' 'genome_db_id' => <integer> optional, in case you want to specify it (otherwise it will be generated by the adaptor when storing) =cut package Bio::EnsEMBL::Compara::RunnableDB::LoadMembersFromFiles; use strict; use warnings; use Data::Dumper; use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable'); sub fetch_input { my $self = shift @_; # Loads the genome $self->param('genome_content', $self->compara_dba->get_GenomeDBAdaptor->fetch_by_dbID($self->param('genome_db_id'))->db_adaptor); } sub write_output { my $self = shift @_; my $genome_db_id = $self->param('genome_db_id'); my $compara_dba = $self->compara_dba(); my $sequence_adaptor = $compara_dba->get_SequenceAdaptor(); my $gene_member_adaptor = $compara_dba->get_GeneMemberAdaptor(); my $seq_member_adaptor = $compara_dba->get_SeqMemberAdaptor(); print Dumper($self->param('genome_content')) if $self->debug; my $prot_seq = $self->param('genome_content')->get_protein_sequences; my $cds_seq = $self->param('genome_content')->get_cds_sequences; my $gene_coordinates = $self->param('genome_content')->get_gene_coordinates; my $cds_coordinates = $self->param('genome_content')->get_cds_coordinates; my $taxon_id = $self->param('genome_content')->get_taxonomy_id; my $count = 0; foreach my $gene_name (keys %$prot_seq) { $count++; my $sequence = $prot_seq->{$gene_name}; print "sequence $count: name ", $sequence->id, "\n" if ($self->debug > 1); print "sequence $count: description ", $sequence->desc, "\n" if ($self->debug > 1); print "sequence $count: length ", $sequence->length, "\n" if ($self->debug > 1); my $gene_member = Bio::EnsEMBL::Compara::GeneMember->new( -stable_id => $gene_name, -source_name => 'ENSEMBLGENE', -taxon_id => $taxon_id, -description => $sequence->desc, -genome_db_id => $genome_db_id, ); $gene_member->display_label($sequence->id); if (exists $gene_coordinates->{$sequence->id}) { my $coord = $gene_coordinates->{$sequence->id}; $gene_member->chr_name($coord->[0]); $gene_member->dnafrag_start($coord->[1]); $gene_member->dnafrag_end($coord->[2]); $gene_member->dnafrag_strand($coord->[3]); } else { warn $sequence->id, " does not have gene coordinates\n"; } #print Dumper($gene_member); $gene_member_adaptor->store($gene_member); my $pep_member = Bio::EnsEMBL::Compara::SeqMember->new( -stable_id => $gene_name, -source_name => 'ENSEMBLPEP', -taxon_id => $taxon_id, -description => $sequence->desc, -genome_db_id => $genome_db_id, ); $pep_member->display_label($sequence->id); $pep_member->gene_member_id($gene_member->dbID); if (exists $cds_coordinates->{$sequence->id}) { my $coord = $cds_coordinates->{$sequence->id}; $pep_member->chr_name($coord->[0]); $pep_member->dnafrag_start($coord->[1]); $pep_member->dnafrag_end($coord->[2]); $pep_member->dnafrag_strand($coord->[3]); } else { warn $sequence->id, " does not have cds coordinates\n"; } my $seq = $sequence->seq; $seq =~ s/O/X/g; $pep_member->sequence($seq); $seq_member_adaptor->store($pep_member); $seq_member_adaptor->_set_member_as_canonical($pep_member); if (exists $cds_seq->{$sequence->id}) { $sequence_adaptor->store_other_sequence($pep_member, $cds_seq->{$sequence->id}->seq, 'cds'); } elsif ($self->param('need_cds_seq')) { die $sequence->id, " does not have cds sequence\n"; } else { warn $sequence->id, " does not have cds sequence\n"; } }; print "$count genes and peptides loaded\n" if ($self->debug); } 1;
dbolser-ebi/ensembl-compara
modules/Bio/EnsEMBL/Compara/RunnableDB/LoadMembersFromFiles.pm
Perl
apache-2.0
5,575
=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 =head1 NAME Bio::EnsEMBL::Utils::SeqDumper =head1 SYNOPSIS $seq_dumper = Bio::EnsEMBL::Utils::SeqDumper; # don't dump snps or repeats $seq_dumper->disable_feature_type('repeat'); $seq_dumper->disable_feature_type('variation'); # dump EMBL format to STDOUT $seq_dumper->dump( $slice, 'EMBL' ); # dump GENBANK format to a file $seq_dumper->dump( $slice, 'GENBANK', 'out.genbank' ); # dump FASTA format to a file $seq_dumper->dump( $slice, 'FASTA', 'out.fasta' ); =head1 DESCRIPTION A relatively simple and lite-weight flat file dumper for Ensembl slices. The memory efficiency could be improved and this is currently not very good for dumping very large sequences such as whole chromosomes. =head1 METHODS =cut package Bio::EnsEMBL::Utils::SeqDumper; use strict; use IO::File; use vars qw(@ISA); use Bio::EnsEMBL::Utils::Exception qw(throw warning); #keys must be uppercase my $DUMP_HANDLERS = { 'FASTA' => \&dump_fasta, 'EMBL' => \&dump_embl, 'GENBANK' => \&dump_genbank }; my @COMMENTS = ('This sequence was annotated by the Ensembl system. Please visit ' . 'the Ensembl web site, http://www.ensembl.org/ for more information.', 'All feature locations are relative to the first (5\') base ' . 'of the sequence in this file. The sequence presented is '. 'always the forward strand of the assembly. Features ' . 'that lie outside of the sequence contained in this file ' . 'have clonal location coordinates in the format: ' . '<clone accession>.<version>:<start>..<end>', 'The /gene indicates a unique id for a gene, /note="transcript_id=..."' . ' a unique id for a transcript, /protein_id a unique id for a peptide ' . 'and note="exon_id=..." a unique id for an exon. These ids are ' . 'maintained wherever possible between versions.', 'All the exons and transcripts in Ensembl are confirmed by ' . 'similarity to either protein or cDNA sequences.'); =head2 new Arg [1] : none Example : $seq_dumper = Bio::EnsEMBL::Utils::SeqDumper->new; Description: Creates a new SeqDumper Returntype : Bio::EnsEMBL::Utils::SeqDumper Exceptions : none Caller : general =cut sub new { my ($caller, $slice, $params) = @_; my $class = ref($caller) || $caller; my $feature_types = {'gene' => 1, 'genscan' => 1, 'repeat' => 1, 'similarity' => 1, 'variation' => 1, 'contig' => 1, 'marker' => 1, 'estgene' => 0, 'vegagene' => 0}; my $self = bless {'feature_types' => $feature_types}, $class; foreach my $p (sort keys %{$params || {}}) { $self->{$p} = $params->{$p}; } return $self; } =head2 enable_feature_type Arg [1] : string $type Example : $seq_dumper->enable_feature_type('similarity'); Description: Enables the dumping of a specific type of feature Returntype : none Exceptions : warn if invalid feature type is passed, thrown if no feature type is passed Caller : general =cut sub enable_feature_type { my ($self, $type) = @_; $type || throw("type arg is required"); if(exists($self->{'feature_types'}->{$type})) { $self->{'feature_types'}->{$type} = 1; } else { warning("unknown feature type '$type'\n" . "valid types are: " . join(',', keys %{$self->{'feature_types'}})); } } =head2 attach_database Arg [1] : string name Arg [2] : Bio::EnsEMBL::DBSQL::DBAdaptor Example : $seq_dumper->attach_database('estgene', $estgene_db); Description: Attaches a database to the seqdumper that can be used to dump data which is external to the ensembl core database. Currently this is necessary to dump est genes and vega genes Returntype : none Exceptions : thrown if incorrect argument is supplied Caller : general =cut sub attach_database { my ($self, $name, $db) = @_; $name || throw("name arg is required"); unless($db && ref($db) && $db->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')) { throw("db arg must be a Bio::EnsEMBL::DBSQL::DBAdaptor not a [$db]"); } $self->{'attached_dbs'}->{$name} = $db; } =head2 get_database Arg [1] : string $name Example : $db = $seq_dumper->get_database('vega'); Description: Retrieves a database that has been attached to the seqdumper via the attach database call. Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor Exceptions : thrown if incorrect argument is supplied Caller : dump_feature_table =cut sub get_database { my ($self, $name) = @_; $name || throw("name arg is required"); return $self->{'attached_dbs'}->{$name}; } =head2 remove_database Arg [1] : string $name Example : $db = $seq_dumper->remove_database('estgene'); Description: Removes a database that has been attached to the seqdumper via the attach database call. The database that is removed is returned (or undef if it did not exist). Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor Exceptions : thrown if incorrect argument is supplied Caller : general =cut sub remove_database { my ($self, $name) = @_; $name || throw("name arg is required"); if(exists $self->{'attached_dbs'}->{$name}) { return delete $self->{'attached_dbs'}->{$name}; } return undef; } =head2 disable_feature_type Arg [1] : string $type Example : $seq_dumper->disable_feature_type('genes'); Description: Disables the dumping of a specific type of feature Returntype : none Exceptions : warn if an invalid feature type is passed, thrown if no feature type is passed Caller : general =cut sub disable_feature_type { my ($self, $type) = @_; $type || throw("type arg is required"); if(exists($self->{'feature_types'}->{$type})) { $self->{'feature_types'}->{$type} = 0; } else { warning("unknown feature type '$type'\n" . "valid types are: " . join(',', keys %{$self->{'feature_types'}})); } } =head2 is_enabled Arg [1] : string $type Example : do_something() if($seq_dumper->is_enabled('gene')); Description: checks if a specific feature type is enabled Returntype : none Exceptions : warning if invalid type is passed, thrown if no type is passed Caller : general =cut sub is_enabled { my ($self, $type) = @_; $type || throw("type arg is required"); if(exists($self->{'feature_types'}->{$type})) { return $self->{'feature_types'}->{$type}; } else { warning("unknown feature type '$type'\n" . "valid types are: " . join(',', keys %{$self->{'feature_types'}})); } } =head2 dump Arg [1] : Bio::EnsEMBL::Slice slice The slice to dump Arg [1] : string $format The name of the format to dump Arg [2] : (optional) $outfile The name of the file to dump to. If no file is specified STDOUT is used Example : $seq_dumper->dump($slice, 'EMBL'); Description: Dumps a region of a genome specified by the slice argument into an outfile of the format $format Returntype : none Exceptions : thrown if slice or format args are not supplied Caller : general =cut sub dump { my ($self, $slice, $format, $outfile, $seq) = @_; $format || throw("format arg is required"); $slice || throw("slice arg is required"); my $dump_handler = $DUMP_HANDLERS->{uc($format)}; unless($dump_handler) { throw("No dump handler is defined for format $format\n"); } my $FH = IO::File->new;; if($outfile) { $FH->open(">>$outfile") or throw("Could not open file $outfile"); } else { $FH = \*STDOUT; #mod_perl did not like the following #$FH->fdopen(fileno(STDOUT), "w") # or throw("Could not open currently selected output filehandle " . # "for writing"); } &$dump_handler($self, $slice, $FH, $seq); $FH->close if ($outfile); #close if we were writing to a file } =head2 dump_embl Arg [1] : Bio::EnsEMBL::Slice Arg [2] : IO::File $FH Arg [3] : optional sequence string Example : $seq_dumper->dump_embl($slice, $FH); Description: Dumps an EMBL flat file to an open file handle Returntype : none Exceptions : none Caller : dump =cut sub dump_embl { my $self = shift; my $slice = shift; my $FH = shift; my $SEQ = shift; my $len = $slice->length; my $version; my $acc; my $cs = $slice->coord_system(); my $name_str = $cs->name() . ' ' . $slice->seq_region_name(); $name_str .= ' ' . $cs->version if($cs->version); my $start = $slice->start; my $end = $slice->end; #determine if this slice is the entire seq region #if it is then we just use the name as the id my $slice_adaptor = $slice->adaptor(); my $full_slice = $slice->adaptor->fetch_by_region($cs->name, $slice->seq_region_name, undef,undef,undef, $cs->version); my $entry_name = $slice->seq_region_name(); if($full_slice->name eq $slice->name) { $name_str .= ' full sequence'; $acc = $slice->seq_region_name(); my @acc_ver = split(/\./, $acc); if(@acc_ver == 2) { $acc = $acc_ver[0]; $version = $acc_ver[0] . '.'. $acc_ver[1]; } elsif(@acc_ver == 1 && $cs->version()) { $version = $acc . '.'. $cs->version(); } else { $version = $acc; } } else { $name_str .= ' partial sequence'; $acc = $slice->name(); $version = $acc; } $acc = $slice->name(); #line breaks are allowed near the end of the line on ' ', "\t", "\n", ',' $: = (" \t\n-,"); ############# # dump header ############# my $EMBL_HEADER = '@< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~ '; #ID and moltype # HTG = High Throughput Genome division, probably most suitable # and it would be hard to come up with another appropriate division # that worked for all organisms (e.g. plants are in PLN but human is # in HUM). my $VALUE = "$entry_name standard; DNA; HTG; $len BP."; $self->write($FH, $EMBL_HEADER, 'ID', $VALUE); $self->print( $FH, "XX\n" ); #Accession $self->write($FH, $EMBL_HEADER, 'AC', $acc); $self->print( $FH, "XX\n" ); #Version $self->write($FH, $EMBL_HEADER, 'SV', $version); $self->print( $FH, "XX\n" ); #Date $self->write($FH, $EMBL_HEADER, 'DT', $self->_date_string); $self->print( $FH, "XX\n" ); my $species = $slice->adaptor->db->get_MetaContainer->get_Species(); #Description $self->write($FH, $EMBL_HEADER, 'DE', $species->binomial . " $name_str $start..$end annotated by Ensembl"); $self->print( $FH, "XX\n" ); #key words $self->write($FH, $EMBL_HEADER, 'KW', '.'); $self->print( $FH, "XX\n" ); #Species my $species_name = $species->binomial(); if(my $cn = $species->common_name()) { $species_name .= " ($cn)"; } $self->write($FH, $EMBL_HEADER, 'OS', $species_name); #Classification my @cls = $species->classification; shift @cls; #shift off species name $self->write($FH, $EMBL_HEADER, 'OC', join('; ', reverse(@cls)) . '.'); $self->print( $FH, "XX\n" ); #References (we are not dumping refereneces) #Database References (we are not dumping these) #comments foreach my $comment (@COMMENTS) { $self->write($FH, $EMBL_HEADER, 'CC', $comment); $self->print( $FH, "XX\n" ); } #################### #DUMP FEATURE TABLE #################### $self->print( $FH, "FH Key Location/Qualifiers\n" ); my $FEATURE_TABLE = 'FT ^<<<<<<<<<<<<<<<^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~ '; $self->_dump_feature_table($slice, $FH, $FEATURE_TABLE); #write an XX after the feature tables $self->print( $FH, "XX\n" ); ################### #DUMP SEQUENCE ################### if(!defined($SEQ)){ $SEQ = $slice->seq(); } # my $SEQ = $slice->seq(); my $length = length($SEQ); my $a_count = $SEQ =~ tr/aA/aA/; my $c_count = $SEQ =~ tr/cC/cC/; my $t_count = $SEQ =~ tr/tT/tT/; my $g_count = $SEQ =~ tr/gG/gG/; my $other_count = $length - $a_count - $c_count - $t_count - $g_count; my $value = "Sequence $length BP; $a_count A; $c_count C; " . "$g_count G; $t_count T; $other_count other;"; $self->write($FH, $EMBL_HEADER, 'SQ', $value); $self->write_embl_seq($FH, \$SEQ); $self->print( $FH, "//\n" ); # Set formatting back to normal $: = " \n-"; } =head2 dump_genbank Arg [1] : Bio::EnsEMBL::Slice Arg [2] : IO::File $FH Example : $seq_dumper->dump_genbank($slice, $FH); Description: Dumps a GENBANK flat file to an open file handle Returntype : none Exceptions : none Caller : dump =cut sub dump_genbank { my ($self, $slice, $FH, $SEQ) = @_; #line breaks are allowed near the end of the line on ' ', "\t", "\n", ',' $: = " \t\n-,"; my $GENBANK_HEADER = '^<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ '; my $GENBANK_SUBHEADER = ' ^<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ '; my $GENBANK_FT = ' ^<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ '; my $version; my $acc; my $cs = $slice->coord_system(); my $name_str = $cs->name() . ' ' . $slice->seq_region_name(); $name_str .= ' ' . $cs->version if($cs->version); #determine if this slice is the entire seq region #if it is then we just use the name as the id my $slice_adaptor = $slice->adaptor(); my $full_slice = $slice->adaptor->fetch_by_region($cs->name, $slice->seq_region_name, undef,undef,undef, $cs->version); my $entry_name = $slice->seq_region_name(); if($full_slice->name eq $slice->name) { $name_str .= ' full sequence'; $acc = $slice->seq_region_name(); my @acc_ver = split(/\./, $acc); if(@acc_ver == 2) { $acc = $acc_ver[0]; $version = $acc_ver[0] . $acc_ver[1]; } elsif(@acc_ver == 1 && $cs->version()) { $version = $acc . $cs->version(); } else { $version = $acc; } } else { $name_str .= ' partial sequence'; $acc = $slice->name(); $version = $acc; } $acc = $slice->name(); # to keep format consistent for all my $length = $slice->length; my $start = $slice->start(); my $end = $slice->end(); my $date = $self->_date_string; my $species = $slice->adaptor->db->get_MetaContainer->get_Species; #LOCUS my $tag = 'LOCUS'; my $value = "$entry_name $length bp DNA HTG $date"; $self->write($FH, $GENBANK_HEADER, $tag, $value); #DEFINITION $tag = "DEFINITION"; $value = $species->binomial . " $name_str $start..$end reannotated via EnsEMBL"; $self->write($FH, $GENBANK_HEADER, $tag, $value); #ACCESSION $self->write($FH, $GENBANK_HEADER, 'ACCESSION', $acc); #VERSION $self->write($FH, $GENBANK_HEADER, 'VERSION', $version); # KEYWORDS $self->write($FH, $GENBANK_HEADER, 'KEYWORDS', '.'); # SOURCE $self->write($FH, $GENBANK_HEADER, 'SOURCE', $species->common_name()); #organism my @cls = $species->classification(); shift @cls; $self->write($FH, $GENBANK_SUBHEADER, 'ORGANISM', $species->binomial); $self->write($FH, $GENBANK_SUBHEADER, '', join('; ', reverse @cls) . "."); #refereneces #comments foreach my $comment (@COMMENTS) { $self->write($FH, $GENBANK_HEADER, 'COMMENT', $comment); } #################### # DUMP FEATURE TABLE #################### $self->print( $FH, "FEATURES Location/Qualifiers\n" ); $self->_dump_feature_table($slice, $FH, $GENBANK_FT); #################### # DUMP SEQUENCE #################### if(!defined($SEQ)){ $SEQ = $slice->seq(); } # my $SEQ = $slice->seq(); my $a_count = $SEQ =~ tr/aA/aA/; my $c_count = $SEQ =~ tr/cC/cC/; my $t_count = $SEQ =~ tr/tT/tT/; my $g_count = $SEQ =~ tr/gG/gG/; my $bp_length = length($SEQ); my $other_count = $bp_length - $a_count - $c_count - $t_count - $g_count; $tag = 'BASE COUNT'; $value = "$a_count a $c_count c $g_count g $t_count t"; $value .= " $other_count n" if($other_count); $self->write($FH, $GENBANK_HEADER, $tag, $value); $self->print( $FH, "ORIGIN\n" ); $self->write_genbank_seq($FH, \$SEQ); $self->print( $FH, "//\n" ); # Set formatting back to normal $: = " \n-"; } =head2 _dump_feature_table Arg [1] : Bio::EnsEMBL::Slice slice Example : none Description: Helper method used to dump feature tables used in EMBL, FASTA, GENBANK. Assumes formating of file handle has been setup already to use $FEAT and $VALUE values. Returntype : none Exceptions : none Caller : internal =cut sub _dump_feature_table { my $self = shift; my $slice = shift; my $FH = shift; my $FORMAT = shift; #use only the core database to dump features (except for bloody snps) my $lite = $slice->adaptor->db->remove_db_adaptor('lite'); my $meta = $slice->adaptor->db->get_MetaContainer; my $species = $meta->get_Species; #lump file handle and format string together for simpler method calls my @ff = ($FH, $FORMAT); my $value; #source my $classification = join(', ', $species->classification); $self->write(@ff,'source', "1.." . $slice->length()); $self->write(@ff,'' , '/organism="'.$species->binomial . '"'); $self->write(@ff,'' , '/db_xref="taxon:'.$meta->get_taxonomy_id().'"'); # # Transcripts & Genes # my @gene_slices; if($self->is_enabled('gene')) { push @gene_slices, $slice; } # Retrieve slices of other database where we need to pull genes from my $gene_dbs = {'vegagene' => 'vega', 'estgene' => 'estgene'}; foreach my $gene_type (keys %$gene_dbs) { if($self->is_enabled($gene_type)) { my $db = $self->get_database($gene_dbs->{$gene_type}); if($db) { my $sa = $db->get_SliceAdaptor(); push @gene_slices, $sa->fetch_by_name($slice->name()); } else { warning("A [". $gene_dbs->{$gene_type} ."] database must be " . "attached to this SeqDumper\n(via a call to " . "attach_database) to retrieve genes of type [$gene_type]"); } } } foreach my $gene_slice (@gene_slices) { foreach my $gene (@{$gene_slice->get_all_Genes(undef,undef, 1)}) { $value = $self->features2location( [$gene] ); $self->write( @ff, 'gene', $value ); $self->write( @ff, "", '/gene='.$gene->stable_id() ); if(defined($gene->display_xref)){ $self->write( @ff, "",'/locus_tag="'.$gene->display_xref->display_id.'"'); } my $desc = $gene->description; if(defined($desc) and $desc ne ""){ $desc =~ s/\"//; $self->write( @ff, "", '/note="'.$gene->description.'"'); } foreach my $transcript (@{$gene->get_all_Transcripts}) { my $translation = $transcript->translation; # normal transcripts get dumped differently than pseudogenes if($translation) { #normal transcript $value = $self->features2location($transcript->get_all_Exons); $self->write(@ff, 'mRNA', $value); $self->write(@ff,'' , '/gene="'.$gene->stable_id().'"'); $self->write(@ff,'' ,'/note="transcript_id='.$transcript->stable_id().'"'); # ...and a CDS section $value = $self->features2location($transcript->get_all_translateable_Exons); $self->write(@ff,'CDS', $value); $self->write(@ff,'' , '/gene="'.$gene->stable_id().'"'); $self->write(@ff,'', '/protein_id="'.$translation->stable_id().'"'); $self->write(@ff,'' ,'/note="transcript_id='.$transcript->stable_id().'"'); foreach my $dbl (@{$transcript->get_all_DBLinks}) { $value = '/db_xref="'.$dbl->dbname().':'.$dbl->display_id().'"'; $self->write(@ff, '', $value); } $value = '/translation="'.$transcript->translate()->seq().'"'; $self->write(@ff, '', $value); } else { #pseudogene $value = $self->features2location($transcript->get_all_Exons); $self->write(@ff, 'misc_RNA', $value); $self->write(@ff,'' , '/gene="'.$gene->stable_id().'"'); foreach my $dbl (@{$transcript->get_all_DBLinks}) { $value = '/db_xref="'.$dbl->dbname().':'.$dbl->primary_id().'"'; $self->write(@ff, '', $value); } $self->write(@ff,'' , '/note="'.$transcript->biotype().'"'); $self->write(@ff,'' ,'/note="transcript_id='.$transcript->stable_id().'"'); } } } # exons foreach my $gene (@{$gene_slice->get_all_Genes(undef,undef,1)}) { foreach my $exon (@{$gene->get_all_Exons}) { $self->write(@ff,'exon', $self->features2location([$exon])); $self->write(@ff,'' , '/note="exon_id='.$exon->stable_id().'"'); } } } # # genscans # if($self->is_enabled('genscan')) { my @genscan_exons; foreach my $transcript(@{$slice->get_all_PredictionTranscripts(undef,1)}) { my $exons = $transcript->get_all_Exons(); push @genscan_exons, @$exons; $self->write(@ff, 'mRNA', $self->features2location($exons)); $self->write(@ff, '', '/product="'.$transcript->translate()->seq().'"'); $self->write(@ff, '', '/note="identifier='.$transcript->stable_id.'"'); $self->write(@ff, '', '/note="Derived by automated computational' . ' analysis using gene prediction method:' . $transcript->analysis->logic_name . '"'); } } # # snps # if($self->is_enabled('variation') && $slice->can('get_all_VariationFeatures')) { # $slice->adaptor->db->add_db_adaptor('lite', $lite) if $lite; foreach my $snp (@{$slice->get_all_VariationFeatures}) { my $ss = $snp->start; my $se = $snp->end; #skip snps that hang off edge of slice next if($ss < 1 || $se > $slice->length); $self->write(@ff, 'variation', "$ss..$se"); $self->write(@ff, '' , '/replace="'.$snp->allele_string.'"'); #$self->write(@ff, '' , '/evidence="'.$snp->status.'"'); my $rs_id = $snp->variation_name(); my $db = $snp->source(); # foreach my $link ($snp->each_DBLink) { # my $id = $link->primary_id; # my $db = $link->database; $self->write(@ff, '', "/db_xref=\"$db:$rs_id\""); # } } # $slice->adaptor->db->remove_db_adaptor('lite') if $lite; } # # similarity features # if($self->is_enabled('similarity')) { foreach my $sim (@{$slice->get_all_SimilarityFeatures}) { $self->write(@ff, 'misc_feature', $self->features2location([$sim])); $self->write(@ff, '' , '/note="match: '.$sim->hseqname. ' : '.$sim->hstart.'..'.$sim->hend.'('.$sim->hstrand.')"'); } } # # repeats # if($self->is_enabled('repeat')) { my $rfs = $slice->get_all_RepeatFeatures(); foreach my $repeat (@$rfs) { $self->write(@ff, 'repeat_region', $self->features2location([$repeat])); $self->write(@ff, '' , '/note="' . $repeat->repeat_consensus->name. ' repeat: matches ' . $repeat->hstart.'..'.$repeat->hend . '('.$repeat->hstrand.') of consensus"'); } } # # markers # if($self->is_enabled('marker') && $slice->can('get_all_MarkerFeatures')) { foreach my $mf (@{$slice->get_all_MarkerFeatures}) { $self->write(@ff, 'STS', $self->features2location([$mf])); if($mf->marker->display_MarkerSynonym) { $self->write(@ff, '' , '/standard_name="' . $mf->marker->display_MarkerSynonym->name . '"'); } #grep out synonyms without a source my @synonyms = @{$mf->marker->get_all_MarkerSynonyms}; @synonyms = grep {$_->source } @synonyms; foreach my $synonym (@synonyms) { $self->write(@ff, '', '/db_xref="'.$synonym->source. ':'.$synonym->name.'"'); } $self->write(@ff, '', '/note="map_weight='.$mf->map_weight.'"'); } } # # contigs # if($self->is_enabled('contig')) { foreach my $segment (@{$slice->project('seqlevel')}) { my ($start, $end, $slice) = @$segment; $self->write(@ff, 'misc_feature', $start .'..'. $end); $self->write(@ff, '', '/note="contig '.$slice->seq_region_name . ' ' . $slice->start . '..' . $slice->end . '(' . $slice->strand . ')"'); } } $slice->adaptor->db->add_db_adaptor('lite', $lite) if $lite; } =head2 dump_fasta Arg [1] : Bio::EnsEMBL::Slice Arg [2] : IO::File $FH Example : $seq_dumper->dump_fasta($slice, $FH); Description: Dumps an FASTA flat file to an open file handle Returntype : none Exceptions : none Caller : dump =cut sub dump_fasta { my $self = shift; my $slice = shift; my $FH = shift; my $id = $slice->seq_region_name; my $seqtype = 'dna'; my $idtype = $slice->coord_system->name; my $location = $slice->name; my $start = 1; my $end = $slice->length(); my $header = ">$id $seqtype:$idtype $location\n"; $self->print( $FH, $header ); #set the formatting to FASTA my $FORMAT = '^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< '; #chunk the sequence in 60kb chunks to use less memory my $cur = $start; while($cur < $end) { my $to = $cur + 59_999; $to = $end if($to > $end); my $seq = $slice->subseq($cur, $to); $cur = $to + 1; $self->write($FH, $FORMAT, $seq); } } =head2 features2location Arg [1] : listref of Bio::EnsEMBL::SeqFeatures Example : $location = $self->features2location(\@features); Description: Constructs an EMBL location string from a list of features Returntype : string Exceptions : none Caller : internal =cut sub features2location { my $self = shift; my $features = shift; my @join = (); foreach my $f (@$features) { my $slice = $f->slice; my $start = $f->start(); my $end = $f->end(); my $strand = $f->strand(); if($start >= 1 && $end <= $slice->length) { #this feature in on a slice and doesn't lie outside the boundary if($strand == 1) { push @join, "$start..$end"; } else { push @join, "complement($start..$end)"; } } else { my @fs = (); #this feature is outside the boundary of the dump, # yet implemented and 'seqlevel' is guaranteed to be 1step my $projection = $f->project('seqlevel'); foreach my $segment (@$projection) { my $slice = $segment->[2]; my $slc_start = $slice->start(); my $slc_end = $slice->end(); my $seq_reg = $slice->seq_region_name(); if($slice->strand == 1) { push @join, "$seq_reg:$slc_start..$slc_end"; } else { push @join, "complement($seq_reg:$slc_start..$slc_end)"; } } } } my $out = join ',', @join; if(scalar @join > 1) { $out = "join($out)"; } return $out; } sub _date_string { my $self = shift; my ($sec, $min, $hour, $mday,$mon, $year) = localtime(time()); my $month = ('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC')[$mon]; $year += 1900; return "$mday-$month-$year"; } sub write { my ($self, $FH, $FORMAT, @values) = @_; #while the last value still contains something while($values[-1] ne '') { formline($FORMAT, @values); $self->print( $FH, $^A ); $^A = ''; } } sub write_genbank_seq { my $self = shift; my $FH = shift; my $seq = shift; my $base_total = shift; $base_total ||= 0; my $GENBANK_SEQ = '@>>>>>>>> ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<<~ '; my $total = -59 + $base_total; #keep track of total and print lines of 60 bases with spaces every 10bp while($$seq) { $total += 60; formline($GENBANK_SEQ,$total, $$seq, $$seq, $$seq, $$seq, $$seq, $$seq); $self->print( $FH, $^A ); $^A = ''; } } sub write_embl_seq { my $self = shift; my $FH = shift; my $seq = shift; my $base_total = shift; $base_total ||= 0; my $EMBL_SEQ = ' ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<< ^<<<<<<<<<@>>>>>>>>>~ '; #keep track of total and print lines of 60 bases with spaces every 10bp my $length = length($$seq); my $total = $length - $base_total; while($$seq) { $total -= 60; $total = 0 if($total < 0); formline($EMBL_SEQ, $$seq, $$seq, $$seq, $$seq, $$seq, $$seq, $length - $total); $self->print( $FH, $^A ); $^A = ''; } } sub print { my( $self, $FH, $string ) = @_; print $FH $string; } 1;
adamsardar/perl-libs-custom
EnsemblAPI/ensembl/modules/Bio/EnsEMBL/Utils/SeqDumper.pm
Perl
apache-2.0
29,518
# # 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 apps::nginx::serverstatus::plugin; use strict; use warnings; use base qw(centreon::plugins::script_custom); sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '0.1'; $self->{modes} = { 'connections' => 'apps::nginx::serverstatus::mode::connections', 'requests' => 'apps::nginx::serverstatus::mode::requests' }; $self->{custom_modes}->{api} = 'apps::nginx::serverstatus::custom::api'; return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check Nginx Web Servers through HttpStubStatusModule Module =cut
centreon/centreon-plugins
apps/nginx/serverstatus/plugin.pm
Perl
apache-2.0
1,422
# 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::V9::Services::UserListService; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseService); sub get { my $self = shift; my $request_body = shift; my $http_method = 'GET'; my $request_path = 'v9/{+resourceName}'; my $response_type = 'Google::Ads::GoogleAds::V9::Resources::UserList'; return $self->SUPER::call($http_method, $request_path, $request_body, $response_type); } sub mutate { my $self = shift; my $request_body = shift; my $http_method = 'POST'; my $request_path = 'v9/customers/{+customerId}/userLists:mutate'; my $response_type = 'Google::Ads::GoogleAds::V9::Services::UserListService::MutateUserListsResponse'; return $self->SUPER::call($http_method, $request_path, $request_body, $response_type); } 1;
googleads/google-ads-perl
lib/Google/Ads/GoogleAds/V9/Services/UserListService.pm
Perl
apache-2.0
1,398
#!/usr/bin/perl ## ## Copyright 2008 Adriana Lukas & Alec Muffett ## ## 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. ## # OSX kludge to open a browser pointing at the installed mine, # using the mine's own config file to save on typing... require "protomine-config.pl"; system("open", $MINE_HTTP_FULLPATH); exit 0;
alecmuffett/protomine
open-browser.pl
Perl
apache-2.0
821
use strict; package CPAN::Reporter::History; our $VERSION = '1.2011'; # VERSION use vars qw/@ISA @EXPORT_OK/; use Config; use Carp; use Fcntl qw/:flock/; use File::HomeDir (); use File::Path (qw/mkpath/); use File::Spec (); use IO::File (); use CPAN (); # for printing warnings use CPAN::Reporter::Config (); require Exporter; @ISA = qw/Exporter/; @EXPORT_OK = qw/have_tested/; #--------------------------------------------------------------------------# # Some platforms don't implement flock, so fake it if necessary #--------------------------------------------------------------------------# BEGIN { eval { my $temp_file = File::Spec->catfile( File::Spec->tmpdir(), $$ . time() ); my $fh = IO::File->new( $temp_file, "w" ); flock $fh, LOCK_EX; $fh->close; unlink $temp_file; }; if ( $@ ) { *CORE::GLOBAL::flock = sub (*$) { 1 }; } } #--------------------------------------------------------------------------# # Back-compatibility checks -- just once per load #--------------------------------------------------------------------------# # 0.99_08 changed the history file format and name # If an old file exists, convert it to the new name and format. Note -- # someone running multiple installations of CPAN::Reporter might have old # and new versions running so only convert in the case where the old file # exists and the new file does not { my $old_history_file = _get_old_history_file(); my $new_history_file = _get_history_file(); last if -f $new_history_file || ! -f $old_history_file; $CPAN::Frontend->mywarn("CPAN::Reporter: Your history file is in an old format. Upgrading automatically.\n"); # open old and new files my ($old_fh, $new_fh); if (! ( $old_fh = IO::File->new( $old_history_file ) ) ) { $CPAN::Frontend->mywarn("CPAN::Reporter: error opening old history file: $!\nContinuing without conversion.\n"); last; } if (! ($new_fh = IO::File->new( $new_history_file, "w" ) ) ) { $CPAN::Frontend->mywarn("CPAN::Reporter: error opening new history file: $!\nContinuing without conversion.\n"); last; } print {$new_fh} _generated_by(); while ( my $line = <$old_fh> ) { chomp $line; # strip off perl version and convert # try not to match 5.1 from "MSWin32-x86-multi-thread 5.1" # from really old CPAN::Reporter history formats my ($old_version, $perl_patch); if ( $line =~ m{ (5\.0\d{2,5}) ?(patch \d+)?\z} ) { ($old_version, $perl_patch) = ($1, $2); $line =~ s{ (5\.0\d{2,5}) ?(patch \d+)?\z}{}; } my $pv = $old_version ? "perl-" . _perl_version($old_version) : "unknown"; $pv .= " $perl_patch" if $perl_patch; my ($grade_dist, $arch_os) = ($line =~ /(\S+ \S+) (.+)/); print {$new_fh} "test $grade_dist ($pv) $arch_os\n"; } close $old_fh; close $new_fh; } #--------------------------------------------------------------------------# # Public methods #--------------------------------------------------------------------------# #--------------------------------------------------------------------------# # have_tested -- search for dist in history file #--------------------------------------------------------------------------# sub have_tested { ## no critic RequireArgUnpacking # validate arguments croak "arguments to have_tested() must be key value pairs" if @_ % 2; my $args = { @_ }; my @bad_params = grep { $_ !~ m{^(?:dist|phase|grade|perl|archname|osvers)$} } keys %$args; croak "bad parameters for have_tested(): " . join(q{, },@bad_params) if @bad_params; # DWIM: grades to upper case $args->{grade} = uc $args->{grade} if defined $args->{grade}; # default to current platform $args->{perl} = _format_perl_version() unless defined $args->{perl}; $args->{archname} = $Config{archname} unless defined $args->{archname}; $args->{osvers} = $Config{osvers} unless defined $args->{osvers}; my @found; my $history = _open_history_file('<') or return; flock $history, LOCK_SH; <$history>; # throw away format line while ( defined (my $line = <$history>) ) { my $fields = _split_history( $line ) or next; push @found, $fields if _match($fields, $args); } $history->close; return @found; } #--------------------------------------------------------------------------# # Private methods #--------------------------------------------------------------------------# #--------------------------------------------------------------------------# # _format_history -- # # phase grade dist-version (perl-version patchlevel) archname osvers #--------------------------------------------------------------------------# sub _format_history { my ($result) = @_; my $phase = $result->{phase}; my $grade = uc $result->{grade}; my $dist_name = $result->{dist_name}; my $perlver = "perl-" . _format_perl_version(); my $platform = "$Config{archname} $Config{osvers}"; return "$phase $grade $dist_name ($perlver) $platform\n"; } #--------------------------------------------------------------------------# # _format_perl_version #--------------------------------------------------------------------------# sub _format_perl_version { my $pv = _perl_version(); $pv .= " patch $Config{perl_patchlevel}" if $Config{perl_patchlevel}; return $pv; } sub _generated_by { return "# Generated by CPAN::Reporter " . "$CPAN::Reporter::History::VERSION\n"; } #--------------------------------------------------------------------------# # _get_history_file #--------------------------------------------------------------------------# sub _get_history_file { return File::Spec->catdir( CPAN::Reporter::Config::_get_config_dir(), "reports-sent.db" ); } #--------------------------------------------------------------------------# # _get_old_history_file -- prior to 0.99_08 #--------------------------------------------------------------------------# sub _get_old_history_file { return File::Spec->catdir( CPAN::Reporter::Config::_get_config_dir(), "history.db" ); } #--------------------------------------------------------------------------# # _is_duplicate #--------------------------------------------------------------------------# sub _is_duplicate { my ($result) = @_; my $log_line = _format_history( $result ); my $history = _open_history_file('<') or return; my $found = 0; flock $history, LOCK_SH; while ( defined (my $line = <$history>) ) { if ( $line eq $log_line ) { $found++; last; } } $history->close; return $found; } #--------------------------------------------------------------------------# # _match #--------------------------------------------------------------------------# sub _match { my ($fields, $search) = @_; for my $k ( keys %$search ) { next if $search->{$k} eq q{}; # empty string matches anything return unless $fields->{$k} eq $search->{$k}; } return 1; # all keys matched } #--------------------------------------------------------------------------# # _open_history_file #--------------------------------------------------------------------------# sub _open_history_file { my $mode = shift || '<'; my $history_filename = _get_history_file(); my $file_exists = -f $history_filename; # shortcut if reading and doesn't exist return if ( $mode eq '<' && ! $file_exists ); # open it in the desired mode my $history = IO::File->new( $history_filename, $mode ) or $CPAN::Frontend->mywarn("CPAN::Reporter: couldn't open history file " . "'$history_filename': $!\n"); # if writing and it didn't exist before, initialize with header if ( substr($mode,0,1) eq '>' && ! $file_exists ) { print {$history} _generated_by(); } return $history; } #--------------------------------------------------------------------------# # _perl_version #--------------------------------------------------------------------------# sub _perl_version { my $ver = shift || "$]"; $ver =~ qr/(\d)\.(\d{3})(\d{0,3})/; my ($maj,$min,$pat) = (0 + ($1||0), 0 + ($2||0), 0 + ($3||0)); my $pv; if ( $min < 6 ) { $pv = $ver; } else { $pv = "$maj\.$min\.$pat"; } return $pv; } #--------------------------------------------------------------------------# # _record_history #--------------------------------------------------------------------------# sub _record_history { my ($result) = @_; my $log_line = _format_history( $result ); my $history = _open_history_file('>>') or return; flock( $history, LOCK_EX ); seek( $history, 0, 2 ); # seek to end of file $history->print( $log_line ); flock( $history, LOCK_UN ); $history->close; return; } #--------------------------------------------------------------------------# # _split_history # # splits lines created with _format_history. Returns hash ref with # phase, grade, dist, perl, platform #--------------------------------------------------------------------------# sub _split_history { my ($line) = @_; chomp $line; my %fields; @fields{qw/phase grade dist perl archname osvers/} = $line =~ m{ ^(\S+) \s+ # phase (\S+) \s+ # grade (\S+) \s+ # dist \(perl- ([^)]+) \) \s+ # (perl-version-patchlevel) (\S+) \s+ # archname (.+)$ # osvers }xms; # return nothing if parse fails return if scalar keys %fields == 0;# grep { ! defined($_) } values %fields; # otherwise return hashref return \%fields; } 1; # ABSTRACT: Read or write a CPAN::Reporter history log __END__ =pod =encoding UTF-8 =head1 NAME CPAN::Reporter::History - Read or write a CPAN::Reporter history log =head1 VERSION version 1.2011 =head1 SYNOPSIS use CPAN::Reporter::History 'have_tested'; @results = have_tested( dist => 'Dist-Name-1.23' ); =head1 DESCRIPTION Interface for interacting with the CPAN::Reporter history file. Most methods are private for use only within CPAN::Reporter itself. However, a public function is provided to query the history file for results. =head1 USAGE The following function is available. It is not exported by default. =head2 C<<< have_tested() >>> # all reports for Foo-Bar-1.23 @results = have_tested( dist => 'Foo-Bar-1.23' ); # all NA reports @results = have_tested( grade => 'NA' ); # all reports on the current Perl/platform @results = have_tested(); Searches the CPAN::Reporter history file for records exactly matching search criteria, given as pairs of field-names and desired values. Ordinary search criteria include: =over =item * C<<< dist >>> -- the distribution tarball name without any filename suffix; from a C<<< CPAN::Distribution >>> object, this is provided by the C<<< base_id >>> method. =item * C<<< phase >>> -- phase the report was generated during: either 'PL', 'make' or 'test' =item * C<<< grade >>> -- CPAN Testers grade: 'PASS', 'FAIL', 'NA' or 'UNKNOWN'; Also may be 'DISCARD' for any failing reports not sent due to missing prerequisites =back Without additional criteria, a search will be limited to the current version of Perl and the current architecture and OS version. Additional criteria may be specified explicitly or, by specifying the empty string, C<<< q{} >>>, will match that field for I<any> record. # all reports for Foo-Bar-1.23 on any version of perl # on the current architecture and OS version @results = have_tested( dist => 'Foo-Bar-1.23', perl => q{} ); These additional criteria include: =over =item * C<<< perl >>> -- perl version and possible patchlevel; this will be dotted decimal (5.6.2) starting with version 5.6, or will be numeric style as given by C<<< $] >>> for older versions; if a patchlevel exists, it must be specified similar to "5.11.0 patch 12345" =item * C<<< archname >>> -- platform architecture name as given by $Config{archname} =item * C<<< osvers >>> -- operating system version as given by $Config{osvers} =back The function returns an array of hashes representing each test result, with all of the fields listed above. =head1 SEE ALSO =over =item * L<CPAN::Reporter> =item * L<CPAN::Reporter::FAQ> =back =head1 AUTHOR David Golden <dagolden@cpan.org> =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2006 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut
gitpan/CPAN-Reporter
lib/CPAN/Reporter/History.pm
Perl
apache-2.0
12,877
#!/usr/bin/env perl # 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 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 <helpdesk.org>. =cut ##### # Script for dumping out the genomic reference sequence for each variation # use strict; use warnings; use Bio::EnsEMBL::Registry; use FindBin qw( $Bin ); use Getopt::Long; # Define the options to the script my %options = (); my @option_defs = ( 'species=s', 'output_dir=s', 'seq_region=s', 'parallelize=i', 'registry_file=s', 'joblimit=i' ); # Parse the command line GetOptions(\%options,@option_defs); #ÊGet the options or die/set default options my $registryfile = $options{'registry_file'} || die("A registry file must be specified"); my $species = $options{'species'} || die("A species name must be specified"); my $output_dir = $options{'output_dir'} || '.'; my $joblimit = $options{'joblimit'}; $joblimit ||= 10; #ÊThe seq_region_id can be explicitly specified, or it will correspond to the LSB_JOBINDEX variable my $seq_region_id = $options{'seq_region'}; $seq_region_id ||= $ENV{'LSB_JOBINDEX'}; #ÊLoad the registry from the configuration file my $registry = 'Bio::EnsEMBL::Registry'; $registry->load_all($registryfile); my $dba = $registry->get_DBAdaptor("human","variation"); my $stmt; #ÊIf we are asked to parallelize, submit the parallel jobs, one for each seq_region in the variation database, and then exit when they have finished if ($options{'parallelize'}) { # Unset the parallelize option so we won't pass it to the subjobs delete($options{'parallelize'}); # Get all the seq_region_ids from the variation database $stmt = qq{ SELECT DISTINCT seq_region_id FROM variation_feature ORDER BY seq_region_id }; my @seq_region_ids = map {$_->[0]} @{$dba->dbc->db_handle->selectall_arrayref($stmt)}; # A comma-separated list of seq_region_ids to use as job array elements my $jobarray = join(",",@seq_region_ids); # The bsub command my $bsub_cmd = "bsub -J ref_seq_export[$jobarray]\%$joblimit -o $output_dir/ref_seq_export.\%J.\%I.out -e $output_dir/ref_seq_export.\%J.\%I.err perl $Bin/export_variation_reference_sequence.pl"; #ÊAdd the parameters while (my ($key,$value) = each(%options)) { $bsub_cmd .= " -$key $value"; } print $bsub_cmd; # Submit to the farm system($bsub_cmd); exit(0); } # First, create the necessary tables if they do not already exist $stmt = qq{ CREATE TABLE IF NOT EXISTS tmp_ref_allele_seq ( ref_allele_seq_id INTEGER NOT NULL AUTO_INCREMENT, ref_allele VARCHAR(25000) NOT NULL, PRIMARY KEY (ref_allele_seq_id) ) }; $dba->dbc->do($stmt); $stmt = qq{ CREATE TABLE IF NOT EXISTS tmp_ref_allele ( variation_feature_id INTEGER NOT NULL, ref_allele_seq_id INTEGER NOT NULL, seq_region_strand TINYINT NOT NULL, PRIMARY KEY (variation_feature_id) ) }; $dba->dbc->do($stmt); # Write the data to a temp file my $tempfile = "$output_dir/tmp_refseq_data_$seq_region_id\.txt"; open(DATA,">",$tempfile) or die ("Could not open tempfile $tempfile for writing"); # Fetch the seq_region slice from the core database my $slice_adaptor = $registry->get_adaptor($species,"core","slice"); my $slice = $slice_adaptor->fetch_by_seq_region_id($seq_region_id) or die ("Could not fetch slice for seq_region_id $seq_region_id"); # A hash to hold allele -> allele_id mapping my %allele_id; # Prepare a statement for looking up seqs $stmt = qq{ SELECT ref_allele_seq_id FROM tmp_ref_allele_seq WHERE ref_allele = ? }; my $fetch_sth = $dba->dbc->prepare($stmt); # Insert statement $stmt = qq{ INSERT INTO tmp_ref_allele_seq ( ref_allele ) VALUES ( ? ) }; my $insert_sth = $dba->dbc->prepare($stmt); # Get the variation_feature_id and position on the seq_region for all features on the seq_region_id $stmt = qq{ SELECT variation_feature_id, seq_region_start, seq_region_end, seq_region_strand FROM variation_feature FORCE INDEX (pos_idx) WHERE seq_region_id = ? }; my $sth = $dba->dbc->prepare($stmt); $sth->execute($seq_region_id); my ($vf_id,$start,$end,$strand,$seq,$id); $sth->bind_columns(\$vf_id,\$start,\$end,\$strand); #ÊLoop over the rows, print the data to the tempfile while ($sth->fetch()) { # If an insertion, the allele should be '-' if ($start <= $end) { $seq = $slice->subseq($start,$end,$strand); } else { $seq = '-'; } # Get the allele id for the sequence $id = $allele_id{$seq}; #ÊIf not defined, look it up (or insert) in the database unless (defined($id)) { $id = lookup_id($seq,$fetch_sth,$insert_sth,$dba); $allele_id{$seq} = $id; } # Push data onto array print DATA join("\t",($vf_id,$id,$strand)) . "\n"; } close(DATA); # Load the data into the table, disable keys first $stmt = qq{ ALTER TABLE tmp_ref_allele DISABLE KEYS }; $dba->dbc->do($stmt); $stmt = qq{ LOAD DATA LOCAL INFILE '$tempfile' INTO TABLE tmp_ref_allele ( variation_feature_id, ref_allele_seq_id, seq_region_strand ) }; $dba->dbc->do($stmt); # unlink($tempfile); sub lookup_id { my $seq = shift; my $fetch_sth = shift; my $insert_sth = shift; my $dba = shift; my $id; $fetch_sth->execute($seq); $fetch_sth->bind_columns(\$id); $fetch_sth->fetch(); # If id could not be found, insert it unless (defined($id)) { $insert_sth->execute($seq); $id = $dba->dbc->db_handle->selectall_arrayref(qq{SELECT LAST_INSERT_ID()})->[0][0]; } return $id; }
willmclaren/ensembl-variation
scripts/import/export_variation_reference_sequence.pl
Perl
apache-2.0
6,730
package Paws::EC2::DescribeReservedInstancesListings; use Moose; has Filters => (is => 'ro', isa => 'ArrayRef[Paws::EC2::Filter]', traits => ['NameInRequest'], request_name => 'Filter' ); has ReservedInstancesId => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'reservedInstancesId' ); has ReservedInstancesListingId => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'reservedInstancesListingId' ); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'DescribeReservedInstancesListings'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::EC2::DescribeReservedInstancesListingsResult'); class_has _result_key => (isa => 'Str', is => 'ro'); 1; ### main pod documentation begin ### =head1 NAME Paws::EC2::DescribeReservedInstancesListings - Arguments for method DescribeReservedInstancesListings on Paws::EC2 =head1 DESCRIPTION This class represents the parameters used for calling the method DescribeReservedInstancesListings on the Amazon Elastic Compute Cloud service. Use the attributes of this class as arguments to method DescribeReservedInstancesListings. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to DescribeReservedInstancesListings. As an example: $service_obj->DescribeReservedInstancesListings(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 Filters => ArrayRef[L<Paws::EC2::Filter>] One or more filters. =over =item * C<reserved-instances-id> - The ID of the Reserved Instances. =item * C<reserved-instances-listing-id> - The ID of the Reserved Instances listing. =item * C<status> - The status of the Reserved Instance listing (C<pending> | C<active> | C<cancelled> | C<closed>). =item * C<status-message> - The reason for the status. =back =head2 ReservedInstancesId => Str One or more Reserved Instance IDs. =head2 ReservedInstancesListingId => Str One or more Reserved Instance listing IDs. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method DescribeReservedInstancesListings 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/DescribeReservedInstancesListings.pm
Perl
apache-2.0
2,611
# # Copyright 2009-2013 MongoDB, Inc. # # 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 MongoDBTest::ShardedCluster; # ABSTRACT: a test sharded cluster use Moose; use Moose::Util::TypeConstraints; use MongoDB; use Carp 'carp', 'croak'; use File::Spec; use File::Path; has mongo_path => ( is => 'ro', isa => 'Str', required => 1, default => '~/10gen/mongo/' ); has dbpath => ( is => 'ro', isa => 'Str', required => 1, default => '/data/db/sharding' ); has port => ( is => 'ro', isa => 'Int', required => 1, default => 27017 ); has chunksize => ( is => 'ro', isa => 'Int', required => 1, default => 64 ); has shardns => ( is => 'ro', isa => 'Str', required => 1 ); has shardkey => ( is => 'ro', isa => 'HashRef', required => 1 ); has n_configs => ( is => 'ro', isa => 'Int', required => 1, default => 1 ); has n_shards => ( is => 'ro', isa => 'Int', required => 1, default => 3 ); has n_mongos => ( is => 'ro', isa => 'Int', required => 1, default => 1 ); has client => ( is => 'rw', isa => 'MongoDB::MongoClient' ); has _config_port => ( is => 'ro', isa => 'Int', required => 1, default => 20000 ); has _shard_port => ( is => 'ro', isa => 'Int', required => 1, default => 30000 ); has _nodes => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); sub BUILD { my ($self, $opts) = @_; my $mongod = File::Spec->catfile($self->mongo_path, 'mongod'); croak "can't find mongod" unless -e $mongod; my $mongos = File::Spec->catfile($self->mongo_path, 'mongos'); croak "can't find mongos" unless -e $mongos; if ($self->n_configs != 1 && $self->n_configs != 3) { croak "number of config servers must be one or three; " . "you specified " . $self->configs; } # wipe data if already there if (-e $self->dbpath) { File::Path->remove_tree($self->dbpath); } File::Path->make_path($self->dbpath); # set up config servers my @config_hosts; foreach (0..($self->n_configs - 1)) { my $path = File::Spec->catfile($self->dbpath, "config_$_"); mkdir $path; my $port = $self->_config_port + $_; my $host = "localhost:$port"; push @config_hosts, $host; my @command = ($mongod, '--configsvr'); push @command, ('--port', $port); push @command, ('--dbpath', $path); push @command, ('--bind_ip', '127.0.0.1'); my $pid = fork; if (!$pid) { # child process runs mongod exec join(' ', @command); } elsif ($pid > 0) { $self->_nodes->{$host} = $pid; } } # set up shard servers my @shard_hosts; foreach (0..($self->n_shards - 1)) { my $path = File::Spec->catfile($self->dbpath, "shard_$_"); mkdir $path; my $port = $self->_shard_port + $_; my $host = "localhost:$port"; push @shard_hosts, $host; my @command = ($mongod, '--shardsvr'); push @command, ('--port', $port); push @command, ('--dbpath', $path); push @command, ('--bind_ip', '127.0.0.1'); my $pid = fork; if (!$pid) { # child process runs mongod exec join(' ', @command); } elsif ($pid > 0) { $self->_nodes->{$host} = $pid; } } # wait, just to be safe sleep 2; # set chunksize foreach (@config_hosts) { if ($_ =~ /(\w+):(\d+)/) { my $client = MongoDB::MongoClient->new( host => "mongodb://localhost:$2" ); my $db = $client->get_database('config'); my $coll = $db->get_collection('settings'); $coll->save({_id => 'chunksize', 'value' => $self->chunksize}); undef $client; } } # wait, just to be safe sleep 2; # start mongos foreach (0..($self->n_mongos - 1)) { my @command = ($mongos, '--port', $self->port); push @command, ('--configdb', join(',', @config_hosts)); push @command, ('--bind_ip', '127.0.0.1'); my $pid = fork; if (!$pid) { # child process runs mongod exec join(' ', @command); } elsif ($pid > 0) { $self->_nodes->{'localhost:' . $self->port} = $pid; } } # wait, just to be safe sleep 2; my $client = MongoDB::MongoClient->new( host => 'mongodb://localhost:' . $self->port, find_master => 1 ); $self->client($client); my $admin = $client->get_database('admin'); # add shards foreach (@shard_hosts) { $admin->run_command({addShard => $_}); } # enable sharding my ($shard_db, $shard_coll) = ($self->shardns =~ /(\w+)\.(\S+)/); $admin->run_command({enableSharding => $shard_db}); $admin->run_command({shardCollection => $self->shardns, key => $self->shardkey}); # wait, just to be safe sleep 2; } sub shutdown { my ($self) = @_; my %nodes = %{$self->_nodes}; my $to_die = keys %nodes; my @pids = @nodes{keys %nodes}; my $dead = kill 'SIGTERM', @pids; if ($to_die != $dead) { warn "$dead out of $to_die RS members shutdown properly"; } } 1;
antonnik/code-classifier
naive_bayes/resources/perl/ShardedCluster.pm
Perl
apache-2.0
6,063
=head2 Wed Apr 17 16:20:10 2013: C<Module> L<SCST-SCST|SCST-SCST> =over 4 =item * C<installed into: /usr/local/share/perl/5.10.1> =item * C<LINKTYPE: dynamic> =item * C<VERSION: VERSION_MACRO = VERSION> =item * C<EXE_FILES: > =back
WhiteBearSolutions/WBSAirback
packages/wbsairback-iscsi-scst/wbsairback-iscsi-scst-2.2.0/debian/wbsairback-iscsi-scst/usr/local/lib/perl/5.10.1/perllocal.pod
Perl
apache-2.0
243
# # Copyright 2022 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package database::cassandra::jmx::plugin; use strict; use warnings; use base qw(centreon::plugins::script_custom); sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{version} = '0.1'; %{$self->{modes}} = ( 'caches-usage' => 'database::cassandra::jmx::mode::cachesusage', 'client-requests-usage' => 'database::cassandra::jmx::mode::clientrequestsusage', 'thread-pools-usage' => 'database::cassandra::jmx::mode::threadpoolsusage', ); $self->{custom_modes}{jolokia} = 'centreon::common::protocols::jmx::custom::jolokia'; return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check Cassandra in JMX. Need Jolokia agent. =cut
centreon/centreon-plugins
database/cassandra/jmx/plugin.pm
Perl
apache-2.0
1,538