hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
163 values
lang
stringclasses
53 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
112
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
113
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
116k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
113
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
3
1.05M
avg_line_length
float64
1
966k
max_line_length
int64
1
977k
alphanum_fraction
float64
0
1
ed1f1680e5ea55c4f0859d9be55189d3d1829ae4
1,074
pm
Perl
lib/Google/Ads/GoogleAds/V5/Services/ReachPlanService/ListPlannableProductsRequest.pm
PierrickVoulet/google-ads-perl
bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4
[ "Apache-2.0" ]
null
null
null
lib/Google/Ads/GoogleAds/V5/Services/ReachPlanService/ListPlannableProductsRequest.pm
PierrickVoulet/google-ads-perl
bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4
[ "Apache-2.0" ]
null
null
null
lib/Google/Ads/GoogleAds/V5/Services/ReachPlanService/ListPlannableProductsRequest.pm
PierrickVoulet/google-ads-perl
bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4
[ "Apache-2.0" ]
null
null
null
# 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::V5::Services::ReachPlanService::ListPlannableProductsRequest; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = {plannableLocationId => $args->{plannableLocationId}}; # Delete the unassigned fields in this object for a more concise JSON payload remove_unassigned_fields($self, $args); bless $self, $class; return $self; } 1;
30.685714
93
0.74581
73ff90b4df84a94a5d9d8319716c9458f430a657
1,360
t
Perl
xt/boilerplate.t
hadjiprocopis/Geo-OSM-Overpass-Plugin-FetchBusStops
47b7802d0860dcbef070851834b361dd56791c44
[ "Artistic-2.0", "Unlicense" ]
null
null
null
xt/boilerplate.t
hadjiprocopis/Geo-OSM-Overpass-Plugin-FetchBusStops
47b7802d0860dcbef070851834b361dd56791c44
[ "Artistic-2.0", "Unlicense" ]
null
null
null
xt/boilerplate.t
hadjiprocopis/Geo-OSM-Overpass-Plugin-FetchBusStops
47b7802d0860dcbef070851834b361dd56791c44
[ "Artistic-2.0", "Unlicense" ]
null
null
null
#!perl -T use 5.006; use strict; use warnings; use Test::More; plan tests => 3; sub not_in_file_ok { my ($filename, %regex) = @_; open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } TODO: { local $TODO = "Need to replace the boilerplate text"; not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); module_boilerplate_ok('lib/Geo/OSM/Overpass/Plugin/FetchBusStops.pm'); }
23.448276
78
0.564706
ed1bc1a3597bf406b414b9c109ddced7c1525960
2,194
pm
Perl
lib5/Perlito6/Lisp/Prelude.pm
lablua/Perlito
97c296f63f395ce6a9aa3cac1baeeed076b753a3
[ "Artistic-2.0" ]
279
2015-01-10T22:22:27.000Z
2022-03-11T00:00:26.000Z
lib5/Perlito6/Lisp/Prelude.pm
lablua/Perlito
97c296f63f395ce6a9aa3cac1baeeed076b753a3
[ "Artistic-2.0" ]
38
2015-07-12T20:06:59.000Z
2022-02-01T09:23:58.000Z
lib5/Perlito6/Lisp/Prelude.pm
lablua/Perlito
97c296f63f395ce6a9aa3cac1baeeed076b753a3
[ "Artistic-2.0" ]
31
2015-02-18T14:55:57.000Z
2022-02-24T16:53:19.000Z
# Do not edit this file - Generated by Perlito6 9.0 use v5; use utf8; use strict; use warnings; no warnings ('redefine', 'once', 'void', 'uninitialized', 'misc', 'recursion'); use Perlito6::Perl5::Runtime; use Perlito6::Perl5::Prelude; our $MATCH = Perlito6::Match->new(); { package GLOBAL; sub new { shift; bless { @_ }, "GLOBAL" } # use v6 ; { package Perlito6::Match; sub new { shift; bless { @_ }, "Perlito6::Match" } sub from { $_[0]->{from} }; sub to { $_[0]->{to} }; sub str { $_[0]->{str} }; sub bool { $_[0]->{bool} }; sub capture { $_[0]->{capture} }; sub scalar { my $self = $_[0]; if ($self->{bool}) { if (defined($self->{capture})) { return scalar ($self->{capture}) }; return scalar (substr($self->{str}, $self->{from}, (($self->{to} - $self->{from})))) } else { return scalar ('') } }; sub string { my $self = $_[0]; if ($self->{bool}) { if (defined($self->{capture})) { return scalar ($self->{capture}) }; return scalar (substr($self->{str}, $self->{from}, (($self->{to} - $self->{from})))) } else { return scalar ('') } } } ; { package Pair; sub new { shift; bless { @_ }, "Pair" } sub key { $_[0]->{key} }; sub value { $_[0]->{value} }; sub perl { my $self = $_[0]; return scalar (($self->{key} . ' ' . chr(61) . '> ' . Main::perl($self->{value}, ))) } } ; { package Main; sub new { shift; bless { @_ }, "Main" } sub to_lisp_identifier { my $ident = $_[0]; return scalar (('sv-' . $ident)) }; sub lisp_dump_object { my $class_name = $_[0]; my $data = $_[1]; return scalar (($class_name . '( ' . Main::join((bless [ map { Main::perl( $_, , ) } @{( $data )} ], "ARRAY"), ', ') . ' )')) } } } 1;
27.08642
137
0.4134
ed1fb892a7e1c36c0558a32f7e0b66714f5374bb
6,224
pm
Perl
storage/hp/eva/cli/mode/components/psu.pm
petneli/centreon-plugins
d131e60a1859fdd0e959623de56e6e7512c669af
[ "Apache-2.0" ]
316
2015-01-18T20:37:21.000Z
2022-03-27T00:20:35.000Z
storage/hp/eva/cli/mode/components/psu.pm
petneli/centreon-plugins
d131e60a1859fdd0e959623de56e6e7512c669af
[ "Apache-2.0" ]
2,333
2015-04-26T19:10:19.000Z
2022-03-31T15:35:21.000Z
storage/hp/eva/cli/mode/components/psu.pm
petneli/centreon-plugins
d131e60a1859fdd0e959623de56e6e7512c669af
[ "Apache-2.0" ]
371
2015-01-18T20:37:23.000Z
2022-03-22T10:10:16.000Z
# # Copyright 2021 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package storage::hp::eva::cli::mode::components::psu; use strict; use warnings; sub load { my ($self) = @_; $self->{ssu_commands}->{'ls diskshelf full xml'} = 1; $self->{ssu_commands}->{'ls controller full xml'} = 1; } sub psu_ctrl { my ($self) = @_; # <object> # <objecttype>controller</objecttype> # <objectname>\Hardware\Rack 1\Controller Enclosure 7\Controller B</objectname> # <powersources> # <powerlevel>12.32</powerlevel> # <source> # <type>powersupply0</type> # <state>good</state> # </source> foreach my $object (@{$self->{xml_result}->{object}}) { next if ($object->{objecttype} ne 'controller'); $object->{objectname} =~ s/\\/\//g; foreach my $result (@{$object->{powersources}->{source}}) { next if ($result->{type} eq ''); my $instance = $object->{objectname} . '/' . $result->{type}; next if ($self->check_filter(section => 'psu', instance => $instance)); next if ($result->{state} =~ /notinstalled/i && $self->absent_problem(section => 'psu', instance => $instance)); $self->{components}->{psu}->{total}++; $self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s]", $instance, $result->{state}, $instance, )); my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{state}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("Power supply '%s' status is '%s'", $instance, $result->{state})); } } } } sub psu_diskshelf { my ($self) = @_; # <object> # <objecttype>diskshelf</objecttype> # <objectname>\Hardware\Rack 1\Disk Enclosure 3</objectname> # <powersupplies> # <powersupply> # <name>powersupply1</name> # <operationalstate>good</operationalstate> # <failurepredicted>No</failurepredicted> # <vdcoutputs> # <vdcoutput> # <type>vdc5output</type> # <voltage>5.5</voltage> # <current>6.7</current> # </vdcoutput> # <vdcoutput> # <type>vdc12output</type> # <voltage>12.5</voltage> # <current>4.1</current> # </vdcoutput> # </vdcoutputs> foreach my $object (@{$self->{xml_result}->{object}}) { next if ($object->{objecttype} ne 'diskshelf'); $object->{objectname} =~ s/\\/\//g; foreach my $result (@{$object->{powersupplies}->{powersupply}}) { my $instance = $object->{objectname} . '/' . $result->{name}; next if ($self->check_filter(section => 'psu', instance => $instance)); next if ($result->{operationalstate} =~ /notinstalled/i && $self->absent_problem(section => 'psu', instance => $instance)); $self->{components}->{psu}->{total}++; $self->{output}->output_add(long_msg => sprintf("power suuply '%s' status is '%s' [instance = %s]", $instance, $result->{operationalstate}, $instance, )); my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{operationalstate}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("Power supply '%s' status is '%s'", $instance, $result->{operationalstate})); } foreach my $voltage (@{$result->{vdcoutputs}->{vdcoutput}}) { next if ($voltage->{current} !~ /[0-9]/); my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'psu', instance => $instance . '/' . $voltage->{type}, value => $voltage->{current}); if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit2, short_msg => sprintf("Power supply '%s' is %s V", $instance, $voltage->{current})); } $self->{output}->perfdata_add( label => 'voltage', unit => 'V', nlabel => 'hardware.powersupply.diskshelf.voltage.volt', instances => [$instance, $voltage->{type}], value => $voltage->{current}, warning => $warn, critical => $crit, ); } } } } sub check { my ($self) = @_; $self->{output}->output_add(long_msg => "Checking power supplies"); $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; return if ($self->check_filter(section => 'psu')); psu_ctrl($self); psu_diskshelf($self); } 1;
41.493333
186
0.510283
ed228eabdc10c8435e2c86764d01b53bc048b3f3
1,019
pm
Perl
lib/YaST/Firstboot/WelcomePage.pm
baierjan/os-autoinst-distri-opensuse
be744423c4a09ee5ce67e5fbf20021ec69def094
[ "FSFAP" ]
null
null
null
lib/YaST/Firstboot/WelcomePage.pm
baierjan/os-autoinst-distri-opensuse
be744423c4a09ee5ce67e5fbf20021ec69def094
[ "FSFAP" ]
1
2021-09-24T08:46:26.000Z
2021-09-24T09:13:01.000Z
lib/YaST/Firstboot/WelcomePage.pm
baierjan/os-autoinst-distri-opensuse
be744423c4a09ee5ce67e5fbf20021ec69def094
[ "FSFAP" ]
null
null
null
# SUSE's openQA tests # # Copyright © 2021 SUSE LLC # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. # Summary: The class introduces all accessing methods for Welcome dialog # in YaST Firstboot Configuration. # # Maintainer: QE YaST <qa-sle-yast@suse.de> package YaST::Firstboot::WelcomePage; use parent 'Installation::Navigation::NavigationBase'; use strict; use warnings; sub new { my ($class, $args) = @_; my $self = bless { app => $args->{app} }, $class; return $self->init(); } sub init { my ($self) = @_; $self->SUPER::init(); $self->{rt_welcome} = $self->{app}->richtext({id => 'welcome_text'}); return $self; } sub get_welcome_text { my ($self) = @_; return $self->{rt_welcome}->text(); } sub is_shown { my ($self) = @_; return $self->{rt_welcome}->exist(); } 1;
22.152174
73
0.654563
ed12c8b4acabf5dcd48e9405d3c3f26b112d1388
2,840
pl
Perl
docs/www/tools/dav.pl
EduardRosert/magics
2236652893cfe036af368eddde3d4e64435d510e
[ "ECL-2.0", "Apache-2.0" ]
41
2018-12-07T23:10:50.000Z
2022-02-19T03:01:49.000Z
docs/www/tools/dav.pl
EduardRosert/magics
2236652893cfe036af368eddde3d4e64435d510e
[ "ECL-2.0", "Apache-2.0" ]
59
2019-01-04T15:43:30.000Z
2022-03-31T09:48:15.000Z
docs/www/tools/dav.pl
EduardRosert/magics
2236652893cfe036af368eddde3d4e64435d510e
[ "ECL-2.0", "Apache-2.0" ]
13
2019-01-07T14:36:33.000Z
2021-09-06T14:48:36.000Z
#!/usr/local/bin/perl56 -I/home/systems/syb/work/publisher # (C) Copyright 1996-2016 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ###!/usr/local/share/perl -I/home/systems/syb/work/publisher ################################################################################### # Script modified from davtest.pl, probably originally by Daniel Varela Santoalla. # Modifications by Iain Russell, # December 2002 # # Takes one command-line parameter: the name/path of a file to be uploaded. # Strange behaviour: it actually requires a dummy command-line parameter # to be included after the real one. ################################################################################### use strict; use HTTP::DAV; # defined these if not intending to supply them through the GUI. # If the GUI does supply them (ie if they are specified on the command # line), then the hardcoded values will be overridden. my $username = ""; my $password = ""; my $bUsernameSupplied = 0; my $site = "w3ec2"; ################################ # Check command-line arguments # ################################ # print "Args: $#ARGV\n"; my $numArgs = $#ARGV + 1; if ($numArgs < 1) { print "\nDAV updater.\n"; print "Usage: dav.pl [path]<file> [username] [password] [site]\n"; exit -1; } # has a username & password been supplied? if ($numArgs >= 3) { $username = @ARGV[1]; $password = @ARGV[2]; $bUsernameSupplied = 1; } # how about a site? if ($numArgs == 4) { $site = @ARGV[3]; } # filename is the first on the command line my ($file) = @ARGV[0]; ################################## # Set up the paths to be updated # ################################## my $url; my $to; if ($site eq "w3ec2") { $url = "http://w3ec2.ecmwf.int:81/"; $to = $url . "/magics/magplus/" . $file; } elsif ($site eq "wedit") { $url = "http://wedit.ecmwf.int:81/"; $to = $url . "publications/manuals/magics/magplus/" .$file; } my $d = HTTP::DAV->new(); my $from = $ENV{'PWD'} . "/" . $file; print ("From: $from\n"); print ("To: $to\n"); ################### # Upload the file # ################### $d->DebugLevel(1); $d->credentials( -user=>$username,-pass =>$password,-url =>$url); $d->open( -url=>"$url" ); $d->lock( -url=>"$to", -timeout=>"10m" ) or die "Won't put unless I can lock\n"; if ( $d->put( -local=>"$from", -url=>"$to") ) { print "$from successfully uploaded to $to\n"; } else { print "put failed: " . $d->message . "\n"; } $d->unlock( -url=>"$to");
23.089431
83
0.558803
ed0c4ef87b54ef7b52e36db59af336348a0ad3c0
1,467
pm
Perl
auto-lib/Paws/MediaTailor/HlsConfiguration.pm
galenhuntington/aws-sdk-perl
13b775dcb5f0b3764f0a82f3679ed5c7721e67d3
[ "Apache-2.0" ]
null
null
null
auto-lib/Paws/MediaTailor/HlsConfiguration.pm
galenhuntington/aws-sdk-perl
13b775dcb5f0b3764f0a82f3679ed5c7721e67d3
[ "Apache-2.0" ]
1
2021-05-26T19:13:58.000Z
2021-05-26T19:13:58.000Z
auto-lib/Paws/MediaTailor/HlsConfiguration.pm
galenhuntington/aws-sdk-perl
13b775dcb5f0b3764f0a82f3679ed5c7721e67d3
[ "Apache-2.0" ]
null
null
null
package Paws::MediaTailor::HlsConfiguration; use Moose; has ManifestEndpointPrefix => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::MediaTailor::HlsConfiguration =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::MediaTailor::HlsConfiguration object: $service_obj->Method(Att1 => { ManifestEndpointPrefix => $value, ..., ManifestEndpointPrefix => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::MediaTailor::HlsConfiguration object: $result = $service_obj->Method(...); $result->Att1->ManifestEndpointPrefix =head1 DESCRIPTION The configuration for HLS content. =head1 ATTRIBUTES =head2 ManifestEndpointPrefix => Str The URL that is used to initiate a playback session for devices that support Apple HLS. The session uses server-side reporting. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::MediaTailor> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
25.293103
109
0.75392
73f03a286e56beebd782e4cef83bfc6eb6050656
2,607
pm
Perl
auto-lib/Paws/OpsWorksCM/DescribeBackups.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
164
2015-01-08T14:58:53.000Z
2022-02-20T19:16:24.000Z
auto-lib/Paws/OpsWorksCM/DescribeBackups.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
348
2015-01-07T22:08:38.000Z
2022-01-27T14:34:44.000Z
auto-lib/Paws/OpsWorksCM/DescribeBackups.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
87
2015-04-22T06:29:47.000Z
2021-09-29T14:45:55.000Z
package Paws::OpsWorksCM::DescribeBackups; use Moose; has BackupId => (is => 'ro', isa => 'Str'); has MaxResults => (is => 'ro', isa => 'Int'); has NextToken => (is => 'ro', isa => 'Str'); has ServerName => (is => 'ro', isa => 'Str'); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'DescribeBackups'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::OpsWorksCM::DescribeBackupsResponse'); class_has _result_key => (isa => 'Str', is => 'ro'); 1; ### main pod documentation begin ### =head1 NAME Paws::OpsWorksCM::DescribeBackups - Arguments for method DescribeBackups on L<Paws::OpsWorksCM> =head1 DESCRIPTION This class represents the parameters used for calling the method DescribeBackups on the L<AWS OpsWorks CM|Paws::OpsWorksCM> service. Use the attributes of this class as arguments to method DescribeBackups. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to DescribeBackups. =head1 SYNOPSIS my $opsworks-cm = Paws->service('OpsWorksCM'); my $DescribeBackupsResponse = $opsworks -cm->DescribeBackups( BackupId => 'MyBackupId', # OPTIONAL MaxResults => 1, # OPTIONAL NextToken => 'MyNextToken', # OPTIONAL ServerName => 'MyServerName', # OPTIONAL ); # Results: my $Backups = $DescribeBackupsResponse->Backups; my $NextToken = $DescribeBackupsResponse->NextToken; # Returns a L<Paws::OpsWorksCM::DescribeBackupsResponse> object. 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. For the AWS API documentation, see L<https://docs.aws.amazon.com/opsworks-cm/latest/APIReference/API_DescribeBackups.html> =head1 ATTRIBUTES =head2 BackupId => Str Describes a single backup. =head2 MaxResults => Int This is not currently implemented for C<DescribeBackups> requests. =head2 NextToken => Str This is not currently implemented for C<DescribeBackups> requests. =head2 ServerName => Str Returns backups for the server with the specified ServerName. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method DescribeBackups in L<Paws::OpsWorksCM> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
29.292135
249
0.709628
73f727997f21b7adcc1d9a486e68930a94b00462
3,358
t
Perl
S11-modules/import-multi.t
peschwa/roast
da6f66aab60fbf9c9d043a00d23fd7249912a87a
[ "Artistic-2.0" ]
null
null
null
S11-modules/import-multi.t
peschwa/roast
da6f66aab60fbf9c9d043a00d23fd7249912a87a
[ "Artistic-2.0" ]
null
null
null
S11-modules/import-multi.t
peschwa/roast
da6f66aab60fbf9c9d043a00d23fd7249912a87a
[ "Artistic-2.0" ]
1
2019-10-08T10:15:36.000Z
2019-10-08T10:15:36.000Z
use v6; use Test; BEGIN { @*INC.push('t/spec/packages/') }; use Test::Util; plan 19; # L<S11/Importing without loading> # without protos { module A { multi sub Afoo( Int $a ) is export { 'sub A::Afoo Int' }; multi sub Abar( Int $a ) { 'sub A::Abar Int' }; } import A; is Afoo( 7 ), 'sub A::Afoo Int', 'A) merge multis without protos'; dies_ok { EVAL 'Abar( 7 )' }, "A) doesn't import non-exported multis"; dies_ok { EVAL 'Afoo( "a" )' }, "A) doesn't dispatch to wrong signature"; } # with proto in module { module B { proto sub Bfoo( Mu ) is export { * }; multi sub Bfoo( Int $a ) is export { 'sub B::Bfoo Int' }; } import B; is Bfoo( 7 ), 'sub B::Bfoo Int', 'B) merge multis with proto in module'; } # with proto before import { proto sub Cfoo( Mu ) { * }; multi sub Cfoo( Str $a ) { 'sub C::Cfoo Str' }; module C { multi sub Cfoo( Int $a ) is export { 'sub C::Cfoo Int' }; } import C; is Cfoo( 7 ), 'sub C::Cfoo Int', 'C) merge multis with proto before import'; is Cfoo( 'a' ), 'sub C::Cfoo Str', 'C) our multi is still there'; } # with proto after import { module D { multi sub Dfoo( Int $a ) is export { 'sub D::Dfoo Int' }; } import D; #?rakudo todo "huh?" throws_like 'proto sub Dfoo( Mu ) { * }', X::Redeclaration, symbol => 'Dfoo'; multi sub Dfoo( Str $a ) { 'sub D::Dfoo Str' }; is Dfoo( 7 ), 'sub D::Dfoo Int', 'D) merge multis with proto after import'; is Dfoo( 'a' ), 'sub D::Dfoo Str', 'D) our multi is still there'; } # with proto before import and in module { proto sub Efoo( Mu ) { * }; multi sub Efoo( Str $a ) { 'sub E::Efoo Str' }; module E { proto sub Efoo( Mu ) is export { * }; multi sub Efoo( Int $a ) is export { 'sub E::Efoo Int' }; } import E; is Efoo( 7 ), 'sub E::Efoo Int', 'E) merge multis with proto before import and in module'; is Efoo( 'a' ), 'sub E::Efoo Str', 'E) our multi is still there'; } # with proto after import and in module { module F { proto sub Ffoo( Mu ) is export { * }; multi sub Ffoo( Int $a ) is export { 'sub F::Ffoo Int' }; } import F; #?rakudo skip "it just dies, can't check using throws_like" throws_like 'proto sub Ffoo( Mu ) { * }', X::Redeclaration, symbol => 'Ffoo'; multi sub Ffoo( Str $a ) { 'sub F::Ffoo Str' }; is Ffoo( 7 ), 'sub F::Ffoo Int', 'F) merge multis with proto after import and in module'; is Ffoo( 'a' ), 'sub F::Ffoo Str', 'F) our multi is still there'; } #?rakudo skip 'A symbol "&Gfoo" has already been exported' { module G1 { multi sub Gfoo( Int $a ) is export { 'sub G1::Gfoo Int' }; } import G1; module G2 { multi sub Gfoo( Str $a ) is export { 'sub G2::Gfoo Str' }; } import G2; is Gfoo( 7 ), 'sub G::Gfoo', 'G) merge multis'; } # trait_mod:<is> { role Awesome-Things { }; multi trait_mod:<is> ( Routine $r, :$awesome! ) { $r does Awesome-Things }; module H { sub Hfoo is awesome is export { 'sub H::Hfoo' }; } import H; ok &Hfoo ~~ Awesome-Things, 'H) trait "is awesome" applied'; is Hfoo(), 'sub H::Hfoo', 'H) standard traits like "is export" still work'; } # vim: ft=perl6
27.300813
96
0.552412
73f0f4c7de910dd3d1595cf9772f6533c9c8e54e
10,113
t
Perl
t/apicast-policy-3scale-referrer.t
rafiu007/APIcast
7f947541d9f5426ffa76da18a124b23ee00ba652
[ "Apache-2.0" ]
141
2016-10-06T19:15:44.000Z
2019-03-05T13:27:33.000Z
t/apicast-policy-3scale-referrer.t
rafiu007/APIcast
7f947541d9f5426ffa76da18a124b23ee00ba652
[ "Apache-2.0" ]
494
2016-10-03T13:21:16.000Z
2019-03-14T07:16:18.000Z
t/apicast-policy-3scale-referrer.t
rafiu007/APIcast
7f947541d9f5426ffa76da18a124b23ee00ba652
[ "Apache-2.0" ]
80
2019-03-19T08:32:47.000Z
2022-03-31T02:18:00.000Z
use lib 't'; use Test::APIcast::Blackbox 'no_plan'; run_tests(); __DATA__ === TEST 1: Referrer sent in authrep call when policy after APIcast in the chain --- configuration { "services": [ { "id": 42, "backend_version": 1, "backend_authentication_type": "service_token", "backend_authentication_value": "token-value", "proxy": { "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", "proxy_rules": [ { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } ], "policy_chain": [ { "name": "apicast.policy.apicast" }, { "name": "apicast.policy.3scale_referrer", "configuration": {} } ] } } ] } --- upstream location / { content_by_lua_block { ngx.say('yay, api backend'); } } --- backend location /transactions/authrep.xml { content_by_lua_block { -- Notice that we're checking that the referrer receive is the one sent -- in the 'Referer' header of the query. -- We also check that the rest of the params are correct. require('luassert').equals('3scale.net', ngx.req.get_uri_args()['referrer']) require('luassert').equals('token-value', ngx.req.get_uri_args()['service_token']) require('luassert').equals('42', ngx.req.get_uri_args()['service_id']) require('luassert').equals('uk', ngx.req.get_uri_args()['user_key']) require('luassert').equals('2', ngx.req.get_uri_args()['usage[hits]']) } } --- request GET /?user_key=uk --- more_headers Referer: 3scale.net --- response_body yay, api backend --- error_code: 200 --- no_error_log [error] === TEST 2: Referrer sent in authrep call when policy before APIcast in the chain --- configuration { "services": [ { "id": 42, "backend_version": 1, "backend_authentication_type": "service_token", "backend_authentication_value": "token-value", "proxy": { "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", "proxy_rules": [ { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } ], "policy_chain": [ { "name": "apicast.policy.3scale_referrer", "configuration": {} }, { "name": "apicast.policy.apicast" } ] } } ] } --- upstream location / { content_by_lua_block { ngx.say('yay, api backend'); } } --- backend location /transactions/authrep.xml { content_by_lua_block { -- Notice that we're checking that the referrer receive is the one sent -- in the 'Referer' header of the query. -- We also check that the rest of the params are correct. require('luassert').equals('3scale.net', ngx.req.get_uri_args()['referrer']) require('luassert').equals('token-value', ngx.req.get_uri_args()['service_token']) require('luassert').equals('42', ngx.req.get_uri_args()['service_id']) require('luassert').equals('uk', ngx.req.get_uri_args()['user_key']) require('luassert').equals('2', ngx.req.get_uri_args()['usage[hits]']) } } --- request GET /?user_key=uk --- more_headers Referer: 3scale.net --- response_body yay, api backend --- error_code: 200 --- no_error_log [error] === TEST 3: Referrer header not sent Check that when the the 3scale_referrer policy is enabled, and the 'Referer' header is not sent, the rest of the parameters are correctly sent to backend. --- configuration { "services": [ { "id": 42, "backend_version": 1, "backend_authentication_type": "service_token", "backend_authentication_value": "token-value", "proxy": { "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", "proxy_rules": [ { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } ], "policy_chain": [ { "name": "apicast.policy.apicast" }, { "name": "apicast.policy.3scale_referrer", "configuration": {} } ] } } ] } --- upstream location / { content_by_lua_block { ngx.say('yay, api backend'); } } --- backend location /transactions/authrep.xml { content_by_lua_block { -- Notice that we're checking that the referrer receive is the one sent -- in the 'Referer' header of the query. -- We also check that the rest of the params are correct. require('luassert').equals('token-value', ngx.req.get_uri_args()['service_token']) require('luassert').equals('42', ngx.req.get_uri_args()['service_id']) require('luassert').equals('uk', ngx.req.get_uri_args()['user_key']) require('luassert').equals('2', ngx.req.get_uri_args()['usage[hits]']) } } --- request GET /?user_key=uk --- response_body yay, api backend --- error_code: 200 --- no_error_log [error] === TEST 4: Referrer sent in authrep call when using reporting threads Checks that the referrer policy works well when the out-of-band reporting to the 3scale backend is enabled (APICAST_REPORTING_THREADS > 0) --- env eval ("APICAST_REPORTING_THREADS", "2") --- configuration { "services": [ { "id": 42, "backend_version": 1, "backend_authentication_type": "service_token", "backend_authentication_value": "token-value", "proxy": { "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", "proxy_rules": [ { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } ], "policy_chain": [ { "name": "apicast.policy.apicast" }, { "name": "apicast.policy.3scale_referrer", "configuration": {} } ] } } ] } --- upstream location / { content_by_lua_block { ngx.say('yay, api backend'); } } --- backend location /transactions/authrep.xml { content_by_lua_block { -- Notice that we're checking that the referrer receive is the one sent -- in the 'Referer' header of the query. -- We also check that the rest of the params are correct. require('luassert').equals('3scale.net', ngx.req.get_uri_args()['referrer']) require('luassert').equals('token-value', ngx.req.get_uri_args()['service_token']) require('luassert').equals('42', ngx.req.get_uri_args()['service_id']) require('luassert').equals('uk', ngx.req.get_uri_args()['user_key']) require('luassert').equals('2', ngx.req.get_uri_args()['usage[hits]']) } } --- request GET /?user_key=uk --- more_headers Referer: 3scale.net --- response_body yay, api backend --- error_code: 200 --- no_error_log [error] === TEST 5: Referrer filters are taken into account in the APIcast auths cache In this test, we make a request with valid credentials, and a valid referrer filter. Then, we make a second one with the same credentials, but with an invalid referrer, and we check that we get and "Authorization denied" error. If the referrer filters were not taken into account in the auths cache, the second request would return OK. We need to check that referrer filters are taken into account. --- configuration { "services": [ { "id": 42, "backend_version": 1, "backend_authentication_type": "service_token", "backend_authentication_value": "token-value", "proxy": { "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", "proxy_rules": [ { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } ], "policy_chain": [ { "name": "apicast.policy.3scale_referrer", "configuration": {} }, { "name": "apicast.policy.apicast" } ] } } ] } --- upstream location / { content_by_lua_block { ngx.say('yay, api backend'); } } --- backend location /transactions/authrep.xml { content_by_lua_block { -- Verify just the referrer. Assume the rest of params are correct if ngx.req.get_uri_args()['referrer'] == '3scale.net' then ngx.exit(200) else ngx.exit(403) end } } --- request eval ["GET /?user_key=uk", "GET /?user_key=uk", "GET /?user_key=uk"] --- more_headers eval ["Referer: 3scale.net", "Referer: invalid", "Referer: 3scale.net"] --- response_body eval ["yay, api backend\x{0a}", "Authentication failed", "yay, api backend\x{0a}"] --- error_code eval [200, 403, 200] --- no_error_log [error] === TEST 6: Referrer filters taken into account in the auths cache when after APIcast in the chain Same test as the one above but placing the Referrer policy after the APIcast one in the chain. --- configuration { "services": [ { "id": 42, "backend_version": 1, "backend_authentication_type": "service_token", "backend_authentication_value": "token-value", "proxy": { "api_backend": "http://test:$TEST_NGINX_SERVER_PORT/", "proxy_rules": [ { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } ], "policy_chain": [ { "name": "apicast.policy.apicast" }, { "name": "apicast.policy.3scale_referrer", "configuration": {} } ] } } ] } --- upstream location / { content_by_lua_block { ngx.say('yay, api backend'); } } --- backend location /transactions/authrep.xml { content_by_lua_block { -- Verify just the referrer. Assume the rest of params are correct if ngx.req.get_uri_args()['referrer'] == '3scale.net' then ngx.exit(200) else ngx.exit(403) end } } --- request eval ["GET /?user_key=uk", "GET /?user_key=uk", "GET /?user_key=uk"] --- more_headers eval ["Referer: 3scale.net", "Referer: invalid", "Referer: 3scale.net"] --- response_body eval ["yay, api backend\x{0a}", "Authentication failed", "yay, api backend\x{0a}"] --- error_code eval [200, 403, 200] --- no_error_log [error]
29.744118
98
0.609018
73f9902ded629bbd64ccf85cdeeaf0bfc5d69e82
102
t
Perl
t/001-load.t
ReneNyffenegger/perl-Bible-TextualCriticism-API-NTVMR
f8a6187aa2c29f31dd08fa7502f6981bd4511c09
[ "Artistic-2.0", "Unlicense" ]
2
2021-04-20T22:45:16.000Z
2022-03-22T15:40:11.000Z
t/001-load.t
ReneNyffenegger/perl-Bible-TextualCriticism-API-NTVMR
f8a6187aa2c29f31dd08fa7502f6981bd4511c09
[ "Artistic-2.0", "Unlicense" ]
null
null
null
t/001-load.t
ReneNyffenegger/perl-Bible-TextualCriticism-API-NTVMR
f8a6187aa2c29f31dd08fa7502f6981bd4511c09
[ "Artistic-2.0", "Unlicense" ]
null
null
null
use warnings; use strict; use Test::More tests => 1; use_ok('Bible::TextualCriticism::API::NTVMR');
14.571429
46
0.705882
ed27fc8ac829c68f77f2496f5a631e05a2c9a736
3,605
pm
Perl
external/win_perl/lib/Class/MOP/Class/Immutable/Trait.pm
phixion/l0phtcrack
48ee2f711134e178dbedbd925640f6b3b663fbb5
[ "Apache-2.0", "MIT" ]
2
2021-10-20T00:25:39.000Z
2021-11-08T12:52:42.000Z
external/win_perl/lib/Class/MOP/Class/Immutable/Trait.pm
Brute-f0rce/l0phtcrack
25f681c07828e5e68e0dd788d84cc13c154aed3d
[ "Apache-2.0", "MIT" ]
null
null
null
external/win_perl/lib/Class/MOP/Class/Immutable/Trait.pm
Brute-f0rce/l0phtcrack
25f681c07828e5e68e0dd788d84cc13c154aed3d
[ "Apache-2.0", "MIT" ]
1
2022-03-14T06:41:16.000Z
2022-03-14T06:41:16.000Z
package Class::MOP::Class::Immutable::Trait; our $VERSION = '2.2009'; use strict; use warnings; use MRO::Compat; use Module::Runtime 'use_module'; # the original class of the metaclass instance sub _get_mutable_metaclass_name { $_[0]{__immutable}{original_class} } sub is_mutable { 0 } sub is_immutable { 1 } sub _immutable_metaclass { ref $_[1] } sub _immutable_read_only { my $name = shift; __throw_exception( CallingReadOnlyMethodOnAnImmutableInstance => method_name => $name ); } sub _immutable_cannot_call { my $name = shift; __throw_exception( CallingMethodOnAnImmutableInstance => method_name => $name ); } for my $name (qw/superclasses/) { no strict 'refs'; *{__PACKAGE__."::$name"} = sub { my $orig = shift; my $self = shift; _immutable_read_only($name) if @_; $self->$orig; }; } for my $name (qw/add_method alias_method remove_method add_attribute remove_attribute remove_package_symbol add_package_symbol/) { no strict 'refs'; *{__PACKAGE__."::$name"} = sub { _immutable_cannot_call($name) }; } sub class_precedence_list { my $orig = shift; my $self = shift; @{ $self->{__immutable}{class_precedence_list} ||= [ $self->$orig ] }; } sub linearized_isa { my $orig = shift; my $self = shift; @{ $self->{__immutable}{linearized_isa} ||= [ $self->$orig ] }; } sub get_all_methods { my $orig = shift; my $self = shift; @{ $self->{__immutable}{get_all_methods} ||= [ $self->$orig ] }; } sub get_all_method_names { my $orig = shift; my $self = shift; @{ $self->{__immutable}{get_all_method_names} ||= [ $self->$orig ] }; } sub get_all_attributes { my $orig = shift; my $self = shift; @{ $self->{__immutable}{get_all_attributes} ||= [ $self->$orig ] }; } sub get_meta_instance { my $orig = shift; my $self = shift; $self->{__immutable}{get_meta_instance} ||= $self->$orig; } sub _method_map { my $orig = shift; my $self = shift; $self->{__immutable}{_method_map} ||= $self->$orig; } # private method, for this file only - # if we declare a method here, it will behave differently depending on what # class this trait is applied to, so we won't have a reliable parameter list. sub __throw_exception { my ($exception_type, @args_to_exception) = @_; die use_module( "Moose::Exception::$exception_type" )->new( @args_to_exception ); } 1; # ABSTRACT: Implements immutability for metaclass objects __END__ =pod =encoding UTF-8 =head1 NAME Class::MOP::Class::Immutable::Trait - Implements immutability for metaclass objects =head1 VERSION version 2.2009 =head1 DESCRIPTION This class provides a pseudo-trait that is applied to immutable metaclass objects. In reality, it is simply a parent class. It implements caching and read-only-ness for various metaclass methods. =head1 AUTHORS =over 4 =item * Stevan Little <stevan.little@iinteractive.com> =item * Dave Rolsky <autarch@urth.org> =item * Jesse Luehrs <doy@tozt.net> =item * Shawn M Moore <code@sartak.org> =item * יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> =item * Karen Etheridge <ether@cpan.org> =item * Florian Ragwitz <rafl@debian.org> =item * Hans Dieter Pearcey <hdp@weftsoar.net> =item * Chris Prather <chris@prather.org> =item * Matt S Trout <mst@shadowcat.co.uk> =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2006 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut
20.83815
130
0.683773
ed0e8ac1d88b8059e4c808c0cd9aaff3cd68dd2c
2,954
pm
Perl
auto-lib/Azure/AnalysisServices.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
null
null
null
auto-lib/Azure/AnalysisServices.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
null
null
null
auto-lib/Azure/AnalysisServices.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
1
2021-04-08T15:26:39.000Z
2021-04-08T15:26:39.000Z
package Azure::AnalysisServices; use Moose; with 'Azure::API::Service', 'Azure::API::Caller', 'Azure::API::BearerAuth'; sub CheckNameAvailabilityServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::CheckNameAvailabilityServers', { @_ }); } sub CreateServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::CreateServers', { @_ }); } sub DeleteServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::DeleteServers', { @_ }); } sub DissociateGatewayServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::DissociateGatewayServers', { @_ }); } sub GetDetailsServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::GetDetailsServers', { @_ }); } sub ListByResourceGroupServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListByResourceGroupServers', { @_ }); } sub ListGatewayStatusServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListGatewayStatusServers', { @_ }); } sub ListOperationResultsServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListOperationResultsServers', { @_ }); } sub ListOperations { my $self = shift; return $self->do_call(undef,'Azure::AnalysisServices::ListOperations', { @_ }); } sub ListOperationStatusesServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListOperationStatusesServers', { @_ }); } sub ListServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListServers', { @_ }); } sub ListSkusForExistingServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListSkusForExistingServers', { @_ }); } sub ListSkusForNewServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ListSkusForNewServers', { @_ }); } sub ResumeServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::ResumeServers', { @_ }); } sub SuspendServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::SuspendServers', { @_ }); } sub UpdateServers { my $self = shift; return $self->do_call('subscriptionId','Azure::AnalysisServices::UpdateServers', { @_ }); } sub operations { qw/CheckNameAvailabilityServers CreateServers DeleteServers DissociateGatewayServers GetDetailsServers ListByResourceGroupServers ListGatewayStatusServers ListOperationResultsServers ListOperations ListOperationStatusesServers ListServers ListSkusForExistingServers ListSkusForNewServers ResumeServers SuspendServers UpdateServers / } 1;
39.918919
353
0.711578
73d58ccdcd818779753ba553d6eb341329c7bdda
316
pm
Perl
perl/builder/MyBuilder.pm
johnnychen94/libsixel
6a5be8b72d84037b83a5ea838e17bcf372ab1d5f
[ "MIT" ]
1,938
2015-01-26T00:59:18.000Z
2022-03-30T18:58:49.000Z
perl/builder/MyBuilder.pm
johnnychen94/libsixel
6a5be8b72d84037b83a5ea838e17bcf372ab1d5f
[ "MIT" ]
134
2015-01-25T10:53:44.000Z
2022-03-19T20:57:11.000Z
perl/builder/MyBuilder.pm
johnnychen94/libsixel
6a5be8b72d84037b83a5ea838e17bcf372ab1d5f
[ "MIT" ]
67
2016-02-27T04:55:42.000Z
2022-02-13T13:29:21.000Z
package MyBuilder; use strict; use warnings; use parent qw(Module::Build); use File::Copy; sub new { my ($self, %args) = @_; $self->SUPER::new( %args, extra_compiler_flags => [scalar `libsixel-config --cflags`], extra_linker_flags => [scalar `libsixel-config --libs`], ); } 1;
17.555556
68
0.60443
73f098fe3161de3f5292b7cebd20065f501e5cea
491
pm
Perl
auto-lib/Paws/CloudFormation/DescribeStackSetOperationOutput.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
164
2015-01-08T14:58:53.000Z
2022-02-20T19:16:24.000Z
auto-lib/Paws/CloudFormation/DescribeStackSetOperationOutput.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
348
2015-01-07T22:08:38.000Z
2022-01-27T14:34:44.000Z
auto-lib/Paws/CloudFormation/DescribeStackSetOperationOutput.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
87
2015-04-22T06:29:47.000Z
2021-09-29T14:45:55.000Z
package Paws::CloudFormation::DescribeStackSetOperationOutput; use Moose; has StackSetOperation => (is => 'ro', isa => 'Paws::CloudFormation::StackSetOperation'); has _request_id => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::CloudFormation::DescribeStackSetOperationOutput =head1 ATTRIBUTES =head2 StackSetOperation => L<Paws::CloudFormation::StackSetOperation> The specified stack set operation. =head2 _request_id => Str =cut
17.535714
90
0.729124
73e53d3ad54bb5b9ce3f50b9401c78b33405f4fb
97
t
Perl
frontend/_templates/route/new/ins.ejs.t
Dewyer/stragedy
13febb22bcf4a455b7b27c774e020fdcb5d59939
[ "MIT" ]
null
null
null
frontend/_templates/route/new/ins.ejs.t
Dewyer/stragedy
13febb22bcf4a455b7b27c774e020fdcb5d59939
[ "MIT" ]
null
null
null
frontend/_templates/route/new/ins.ejs.t
Dewyer/stragedy
13febb22bcf4a455b7b27c774e020fdcb5d59939
[ "MIT" ]
null
null
null
--- to: src/routes/mod.rs inject: true append: true --- pub mod <%= h.changeCase.snake(name) %>;
13.857143
40
0.639175
ed09f78f7e109a669a5c405c4a267f9eedd699ab
5,322
pm
Perl
lib/Test2/Harness/UI/Schema/Overlay/Run.pm
Test-More/Test2-Harness-UI
90ddc69266cc02a275cd95edc1a09af45fba324d
[ "Artistic-1.0", "MIT" ]
5
2018-04-25T15:39:52.000Z
2021-09-03T04:56:18.000Z
lib/Test2/Harness/UI/Schema/Overlay/Run.pm
Test-More/Test2-Harness-UI
90ddc69266cc02a275cd95edc1a09af45fba324d
[ "Artistic-1.0", "MIT" ]
24
2018-02-11T05:14:56.000Z
2022-01-09T18:31:47.000Z
lib/Test2/Harness/UI/Schema/Overlay/Run.pm
Test-More/Test2-Harness-UI
90ddc69266cc02a275cd95edc1a09af45fba324d
[ "Artistic-1.0", "MIT" ]
4
2020-01-23T11:27:20.000Z
2021-09-03T04:56:22.000Z
package Test2::Harness::UI::Schema::Result::Run; use utf8; use strict; use warnings; use Carp qw/confess/; our $VERSION = '0.000096'; BEGIN { return if $^C; confess "You must first load a Test2::Harness::UI::Schema::NAME module" unless $Test2::Harness::UI::Schema::LOADED; if ($Test2::Harness::UI::Schema::LOADED =~ m/postgresql/i) { require DateTime::Format::Pg; *DTF = sub() { 'DateTime::Format::Pg' }; } elsif ($Test2::Harness::UI::Schema::LOADED =~ m/mysql/i) { require DateTime::Format::MySQL; *DTF = sub() { 'DateTime::Format::MySQL' }; } else { die "Not sure what DateTime::Formatter to use"; } } __PACKAGE__->inflate_column( parameters => { inflate => DBIx::Class::InflateColumn::Serializer::JSON->get_unfreezer('parameters', {}), deflate => DBIx::Class::InflateColumn::Serializer::JSON->get_freezer('parameters', {}), }, ); # For joining __PACKAGE__->belongs_to( "user_join", "Test2::Harness::UI::Schema::Result::User", { user_id => "user_id" }, { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, ); my %COMPLETE_STATUS = (complete => 1, failed => 1, canceled => 1, broken => 1); sub complete { return $COMPLETE_STATUS{$_[0]->status} // 0 } sub sig { my $self = shift; return join ";" => ( (map {$self->$_ // ''} qw/status pinned passed failed retried concurrency/), (map {length($self->$_ // '')} qw/parameters/), ($self->run_fields->count), ); } sub short_run_fields { my $self = shift; return [ map { my $d = +{$_->get_columns}; $d->{data} = $d->{data} ? \'1' : \'0'; $d } $self->run_fields->search(undef, { remove_columns => ['data'], '+select' => ['data IS NOT NULL AS data'], '+as' => ['data'], })->all ]; } sub TO_JSON { my $self = shift; my %cols = $self->get_columns; # Just No. delete $cols{log_data}; # Inflate $cols{parameters} = $self->parameters; $cols{user} //= $self->user->username; $cols{project} //= $self->project->name; if ($cols{prefetched_fields}) { $cols{fields} = [ map { {$_->get_columns} } $self->run_fields ]; } else { $cols{fields} = $self->short_run_fields; } my $dt = DTF()->parse_datetime( $cols{added} ); $cols{added} = $dt->strftime("%Y-%m-%d %I:%M%P"); return \%cols; } sub normalize_to_mode { my $self = shift; my %params = @_; my $mode = $params{mode}; if ($mode) { $self->update({mode => $mode}); } else { $mode = $self->mode; } $_->normalize_to_mode(mode => $mode) for $self->jobs->all; } sub expanded_coverages { my $self = shift; my ($query) = @_; $self->coverages->search( $query, { order_by => [qw/test_file_id source_file_id source_sub_id/], join => [qw/test_file source_file source_sub coverage_manager/], '+columns' => { test_file => 'test_file.filename', source_file => 'source_file.filename', source_sub => 'source_sub.subname', manager => 'coverage_manager.package', }, }, ); } sub coverage_data { my $self = shift; my (%params) = @_; my $query = $params{query}; my $rs = $self->expanded_coverages($query); my $curr_test; my $data; my $end = 0; my $iterator = sub { while (1) { return undef if $end; my $out; my $item = $rs->next; if (!$item) { $end = 1; $out = $data; $data = undef; return $out; } my $fields = $item->human_fields; my $test = $fields->{test_file}; if (!$curr_test || $curr_test ne $test) { $out = $data; $data = undef; $curr_test = $test; $data = { test => $test, aggregator => 'Test2::Harness::Log::CoverageAggregator::ByTest', files => {}, }; $data->{manager} = $fields->{manager} if $fields->{manager}; } my $source = $fields->{source_file}; my $sub = $fields->{source_sub}; my $meta = $fields->{metadata}; $data->{files}->{$source}->{$sub} = $meta; return $out if $out; } }; return $iterator if $params{iterator}; my @out; while (my $item = $iterator->()) { push @out => $item; } return @out; } 1; __END__ =pod =head1 NAME Test2::Harness::UI::Schema::Result::Run =head1 METHODS =head1 SOURCE The source code repository for Test2-Harness-UI can be found at F<http://github.com/Test-More/Test2-Harness-UI/>. =head1 MAINTAINERS =over 4 =item Chad Granum E<lt>exodist@cpan.orgE<gt> =back =head1 AUTHORS =over 4 =item Chad Granum E<lt>exodist@cpan.orgE<gt> =back =head1 COPYRIGHT Copyright 2019 Chad Granum E<lt>exodist7@gmail.comE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See F<http://dev.perl.org/licenses/> =cut
22.939655
125
0.53044
ed0b4e018450d9ee75211a291c8255fc7b8576f9
77
pl
Perl
test/validation/complexType_nested.pl
steimann/xsd
b6e4dccd0687138fdc059a2cdbcc161f1fc52b7a
[ "MIT" ]
2
2017-07-05T11:29:11.000Z
2020-03-18T17:52:50.000Z
test/validation/complexType_nested.pl
steimann/xsd
b6e4dccd0687138fdc059a2cdbcc161f1fc52b7a
[ "MIT" ]
8
2017-07-07T16:49:32.000Z
2020-10-12T00:43:30.000Z
test/validation/complexType_nested.pl
fnogatz/xsd
000d94f345b12959d5235b349173d30b12450759
[ "MIT" ]
1
2020-10-07T13:15:07.000Z
2020-10-07T13:15:07.000Z
'Nested complexType definition': {|xml|| <parent> <child /> </parent> |}.
12.833333
32
0.61039
ed089c49e0df461e711e9d020883e72110f77e48
4,932
t
Perl
t/01-basics.t
gitpan/Complete-Module
14760a1a769b6535f275c37553c54684e2fd7467
[ "Artistic-1.0" ]
null
null
null
t/01-basics.t
gitpan/Complete-Module
14760a1a769b6535f275c37553c54684e2fd7467
[ "Artistic-1.0" ]
null
null
null
t/01-basics.t
gitpan/Complete-Module
14760a1a769b6535f275c37553c54684e2fd7467
[ "Artistic-1.0" ]
null
null
null
#!perl use 5.010; use strict; use warnings; use FindBin '$Bin'; use lib $Bin; require "testlib.pl"; use File::chdir; use Test::More 0.98; my $prefix = "Prefix" . int(rand()*900_000+100_000); my $dir = tempdir(CLEANUP => 1); { local $CWD = $dir; mkdir($prefix); $CWD = $prefix; write_file("Foo.pm", ""); mkdir("Foo"); mkdir("Bar"); mkdir("Bar/M1"); mkdir("Bar/M2"); write_file("Bar/Mod3.pm", ""); write_file("Baz.pm", ""); mkdir("Type"); write_file("Type/T1.pm", ""); write_file("Type/T1.pmc", ""); write_file("Type/T1.pod", ""); write_file("Type/T2.pm", ""); write_file("Type/T3.pmc", ""); write_file("Type/T4.pod", ""); mkdir("Type/T5"); } { local @INC = ($dir, @INC); subtest "basics" => sub { test_complete(args=>{word=>"$prefix"}, result=>[ "$prefix/", ]); test_complete(args=>{word=>"$prefix/"}, result=>[ "$prefix/Bar/", "$prefix/Baz", "$prefix/Foo", "$prefix/Foo/", "$prefix/Type/", ]); test_complete(args=>{word=>"$prefix/c"}, result=>[]); test_complete(args=>{word=>"$prefix/Foo"}, result=>[ "$prefix/Foo", "$prefix/Foo/", ]); test_complete(args=>{word=>"$prefix/Bar"}, result=>[ "$prefix/Bar/", ]); test_complete(args=>{word=>"$prefix\::Bar::"}, result=>[ "$prefix\::Bar::M1::", "$prefix\::Bar::M2::", "$prefix\::Bar::Mod3", ]); test_complete(args=>{word=>"$prefix\::Bar::Mod3"}, result=>[ "$prefix\::Bar::Mod3", ]); test_complete(args=>{word=>"$prefix\::Bar::Mod3::"}, result=>[]); test_complete(args=>{word=>"$prefix\::Bar::c"}, result=>[]); test_complete(args=>{word=>"$prefix\::Type::T"}, result=>[ "$prefix\::Type::T1", "$prefix\::Type::T2", "$prefix\::Type::T3", "$prefix\::Type::T4", "$prefix\::Type::T5::", ]); }; subtest "shortcut prefixes" => sub { no warnings 'once'; local $Complete::Module::OPT_SHORTCUT_PREFIXES = { 'abc' => "$prefix/Bar/", }; test_complete(args=>{word=>"abc"}, result=>[ "$prefix/Bar/M1/", "$prefix/Bar/M2/", "$prefix/Bar/Mod3", ]); }; subtest "opt: exp_im_path" => sub { test_complete(args=>{word=>"$prefix\::B::M", exp_im_path=>1}, result=>[ "$prefix\::Bar::M1::", "$prefix\::Bar::M2::", "$prefix\::Bar::Mod3", ]); }; subtest "opt: find_pm" => sub { test_complete(args=>{word=>"$prefix\::Type::T", find_pm=>0}, result=>[ "$prefix\::Type::T1", "$prefix\::Type::T3", "$prefix\::Type::T4", "$prefix\::Type::T5::", ]); }; subtest "opt: find_pmc" => sub { test_complete(args=>{word=>"$prefix\::Type::T", find_pmc=>0}, result=>[ "$prefix\::Type::T1", "$prefix\::Type::T2", "$prefix\::Type::T4", "$prefix\::Type::T5::", ]); }; subtest "opt: find_pod" => sub { test_complete(args=>{word=>"$prefix\::Type::T", find_pod=>0}, result=>[ "$prefix\::Type::T1", "$prefix\::Type::T2", "$prefix\::Type::T3", "$prefix\::Type::T5::", ]); }; subtest "opt: find_prefix" => sub { test_complete(args=>{word=>"$prefix\::Type::T", find_prefix=>0}, result=>[ "$prefix\::Type::T1", "$prefix\::Type::T2", "$prefix\::Type::T3", "$prefix\::Type::T4", ]); }; # XXX opt map_case is mostly irrelevant } DONE_TESTING: done_testing;
32.235294
72
0.357867
ed19d7db31f61ddd5039bf0345d94b0231a4d219
402
pm
Perl
auto-lib/Paws/EC2/CreateInstanceExportTaskResult.pm
cah-rfelsburg/paws
de9ffb8d49627635a2da588066df26f852af37e4
[ "Apache-2.0" ]
2
2016-09-22T09:18:33.000Z
2017-06-20T01:36:58.000Z
auto-lib/Paws/EC2/CreateInstanceExportTaskResult.pm
cah-rfelsburg/paws
de9ffb8d49627635a2da588066df26f852af37e4
[ "Apache-2.0" ]
null
null
null
auto-lib/Paws/EC2/CreateInstanceExportTaskResult.pm
cah-rfelsburg/paws
de9ffb8d49627635a2da588066df26f852af37e4
[ "Apache-2.0" ]
null
null
null
package Paws::EC2::CreateInstanceExportTaskResult; use Moose; has ExportTask => (is => 'ro', isa => 'Paws::EC2::ExportTask', xmlname => 'exportTask', traits => ['Unwrapped',]); 1; ### main pod documentation begin ### =head1 NAME Paws::EC2::CreateInstanceExportTaskResult =head1 ATTRIBUTES =head2 ExportTask => L<Paws::EC2::ExportTask> Information about the instance export task. =cut
15.461538
116
0.699005
ed1a5fafa8f82fdce22a3ef6e98afeacb58bb1fd
1,945
pl
Perl
chapter-08/ex08-01.pl
ruddystream/Intermediate-Perl
a0a92f55c8a0fcf648aff8b6398001915812c7c9
[ "Unlicense" ]
1
2020-09-17T00:54:13.000Z
2020-09-17T00:54:13.000Z
chapter-08/ex08-01.pl
ruddystream/Intermediate-Perl
a0a92f55c8a0fcf648aff8b6398001915812c7c9
[ "Unlicense" ]
2
2017-02-07T04:27:38.000Z
2017-03-28T01:33:29.000Z
chapter-08/ex08-01.pl
ruddystream/Intermediate-Perl
a0a92f55c8a0fcf648aff8b6398001915812c7c9
[ "Unlicense" ]
1
2020-09-17T00:55:33.000Z
2020-09-17T00:55:33.000Z
#!/usr/bin/perl ### # Chapter 08 Exercise 01 # ---------------------- # Write a program that prints the today’s date and the day of the week, # but allows the user to choose to send the output to a file, a scalar, # or both at the same time. No matter which one the user selects, send # the output with a single print statement. If the user chooses to send # the output to a scalar, at the end of the program print the scalar’s # value to standard output. # use strict; no warnings; use IO::File; use IO::Scalar; use IO::Tee; use v5.10.1; my $fh; my $day = (localtime)[3]; my $year = (localtime)[5]+1900; my $mon = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec )[(localtime)[4]]; my $dow = qw( Sun Mon Tue Wed Thu Fri Sat )[(localtime)[6]]; my $date = "$dow, $day $mon, $year"; my $choice; my $thedate = ''; print scalar localtime; die; print "I WILL OUTPUT THE DATE.\n"; print "But you need to tell me where:\n\n"; print " 1) A file named \"thedate.txt\",\n"; print " 2) A scalar variable named \"\$thedate\", or\n"; print " 3) Both!\n\n"; while ( 1 ) { print "CHOOSE WISELY: "; chomp ( $choice = <STDIN> ); given ( $choice ) { when ( ! /\d/ ) { print " THAT ANSWER IS SO BLANTANTLY WRONG IT MAKES ME -SICK-\n"; next; } when ( $_ == 1 ) { $fh = IO::File->new( 'thedate.txt', 'w' ) or die "Can't open thedate.txt for writing. Error was $!\n"; last; } when ( $_ == 2 ) { $fh = IO::Scalar->new( \$thedate ); last; } when ( $_ == 3 ) { my $file_fh = IO::File->new( 'thedate.txt', 'w' ) or die "Can't open thedate.txt for writing. Error was $!\n"; my $scalar_fh = IO::Scalar->new( \$thedate ); $fh = IO::Tee->new( $file_fh, $scalar_fh ); last; } default { print "\nTHAT ANSWER IS INCORRECT.\n"; } } } print $fh $date; print "The contents of \$thedate were ($thedate)\n" if ( $choice == 2 or $choice == 3 ) __END__
22.616279
88
0.589717
73dccb7a60d7f89b22287984090043ce12659c5b
198
plx
Perl
t/plx/subtests_have_plan.plx
lejeunerenard/Test-Pretty
132cb4a2af689a4ef6215ce0498808d04492ce40
[ "Artistic-1.0" ]
null
null
null
t/plx/subtests_have_plan.plx
lejeunerenard/Test-Pretty
132cb4a2af689a4ef6215ce0498808d04492ce40
[ "Artistic-1.0" ]
null
null
null
t/plx/subtests_have_plan.plx
lejeunerenard/Test-Pretty
132cb4a2af689a4ef6215ce0498808d04492ce40
[ "Artistic-1.0" ]
1
2019-10-01T19:05:31.000Z
2019-10-01T19:05:31.000Z
use strict; use warnings; use utf8; use Test::More; subtest 'x' => sub { plan tests => 4; ok 1 for 1..4; }; subtest 'y' => sub { plan tests => 4; ok 1 for 1..4; }; done_testing;
11
20
0.545455
73d82fe42f9ef7c3fe3690ba5b1cd398ccb0acc4
4,194
pl
Perl
examples/oauth_webapp.pl
castaway/Net-Twitter
aad194ea1371e9523c43cc7797e1995a08094f53
[ "Unlicense" ]
null
null
null
examples/oauth_webapp.pl
castaway/Net-Twitter
aad194ea1371e9523c43cc7797e1995a08094f53
[ "Unlicense" ]
null
null
null
examples/oauth_webapp.pl
castaway/Net-Twitter
aad194ea1371e9523c43cc7797e1995a08094f53
[ "Unlicense" ]
null
null
null
#!/usr/bin/perl # # Net::Twitter - OAuth webapp example # package MyWebApp; use warnings; use strict; use base qw/HTTP::Server::Simple::CGI/; use Net::Twitter; use Data::Dumper; # You can replace the consumer tokens with your own; # these tokens are for the Net::Twitter example app. my %consumer_tokens = ( consumer_key => 'v8t3JILkStylbgnxGLOQ', consumer_secret => '5r31rSMc0NPtBpHcK8MvnCLg2oAyFLx5eGOMkXM', ); my $server_port = 8080; sub twitter { shift->{twitter} ||= Net::Twitter->new(traits => [qw/API::REST OAuth/], %consumer_tokens) } my %dispatch = ( '/oauth_callback' => \&oauth_callback, '/' => \&my_last_tweet, ); # all request start here sub handle_request { my ($self, $q) = @_; my $request = $q->path_info; warn "Handling request for $request\n"; my $handler = $dispatch{$request} || \&not_found; $self->$handler($q); } # Display the authenicated user's last tweet in all its naked glory sub my_last_tweet { my ($self, $q) = @_; # if the user is authorized, we'll get access tokens from a cookie my %sess = $q->cookie('sess'); unless ( exists $sess{access_token_secret} ) { warn "User has no access_tokens\n"; return $self->authorize($q); } warn <<""; Using access tokens: access_token => $sess{access_token} access_token_secret => $sess{access_token_secret} my $nt = $self->twitter; # pass the access tokens to Net::Twitter $nt->access_token($sess{access_token}); $nt->access_token_secret($sess{access_token_secret}); # attempt to get the user's last tweet my $status = eval { $nt->user_timeline({ count => 1 }) }; if ( $@ ) { warn "$@\n"; # if we got a 401 response, our access tokens were invalid; get new ones return $self->authorize($q) if $@ =~ /\b401\b/; # something bad happened; show the user the error $status = $@; } print $q->header(-nph => 1), $q->start_html, $q->pre(Dumper $status), $q->end_html; } # send the user to Twitter to authorize us sub authorize { my ($self, $q) = @_; my $auth_url = $self->twitter->get_authorization_url(callback => "$ENV{SERVER_URL}oauth_callback"); # we'll store the request tokens in a session cookie my $cookie = $q->cookie(-name => 'sess', -value => { request_token => $self->twitter->request_token, request_token_secret => $self->twitter->request_token_secret, }); warn "Sending user to: $auth_url\n"; print $q->redirect(-nph => 1, -uri => $auth_url, -cookie => $cookie); } # Twitter returns the user here sub oauth_callback { my ($self, $q) = @_; my $request_token = $q->param('oauth_token'); my $verifier = $q->param('oauth_verifier'); my %sess = $q->cookie(-name => 'sess'); die "Something is horribly wrong" unless $sess{request_token} eq $request_token; $self->twitter->request_token($request_token); $self->twitter->request_token_secret($sess{request_token_secret}); warn <<""; User returned from Twitter with: oauth_token => $request_token oauth_verifier => $verifier # exchange the request token for access tokens my @access_tokens = $self->twitter->request_access_token(verifier => $verifier); warn <<""; Exchanged request tokens for access tokens: access_token => $access_tokens[0] access_token_secret => $access_tokens[1] # we'll store the access tokens in a session cookie my $cookie = $q->cookie(-name => 'sess', -value => { access_token => $access_tokens[0], access_token_secret => $access_tokens[1], }); warn "redirecting newly authorized user to $ENV{SERVER_URL}\n"; print $q->redirect(-nph => 1, -uri => "$ENV{SERVER_URL}", -cookie => $cookie); } # display a 404 Not found for any request we don't expect sub not_found { my ($self, $q) = @_; print $q->header(-nph => 1, -type => 'text/html', -status => '404 Not found'), $q->start_html, $q->h1('Not Found'), $q->p('You appear to be lost. Try going home.'); } my $app = MyWebApp->new($server_port); $app->run;
28.726027
105
0.623033
73d9a8f9fb1e9866e8ce3cb5b5b330cbd0d496ae
44,099
pm
Perl
misc-scripts/xref_mapping/XrefParser/BaseParser.pm
dbolser-ebi/ensembl
d60bb4562d2c82637a7befdee5a4ebe6b9795a3d
[ "Apache-2.0" ]
null
null
null
misc-scripts/xref_mapping/XrefParser/BaseParser.pm
dbolser-ebi/ensembl
d60bb4562d2c82637a7befdee5a4ebe6b9795a3d
[ "Apache-2.0" ]
null
null
null
misc-scripts/xref_mapping/XrefParser/BaseParser.pm
dbolser-ebi/ensembl
d60bb4562d2c82637a7befdee5a4ebe6b9795a3d
[ "Apache-2.0" ]
null
null
null
=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 package XrefParser::BaseParser; use strict; use warnings; use Bio::EnsEMBL::Utils::Exception; use XrefParser::FetchFiles; use XrefParser::Database; use Carp; use DBI; use Getopt::Long; my $base_dir = File::Spec->curdir(); my $add_xref_sth = undef; my %add_direct_xref_sth; my $add_dependent_xref_sth = undef; my $get_xref_sth = undef; my $add_synonym_sth = undef; my %xref_dependent_mapped; my $verbose; ################################################### # Create new object. # set global $verbose # Store the dbi form the database for easy access ################################################### sub new { my ($proto, $database, $is_verbose) = @_; if((!defined $database)){# or (!$database->isa(XrefPArserDatabase))) croak 'No database specfied'; } $verbose = $is_verbose; my $dbi = $database->dbi; my $class = ref $proto || $proto; my $self = bless {}, $class; $self->dbi($dbi); return $self; } ################################## # Getter/Setter for the dbi object ################################## sub dbi { my ($self, $arg) = @_; (defined $arg) && ($self->{_dbi} = $arg ); return $self->{_dbi}; } ####################################################################### # Given a file name, returns a IO::Handle object. If the file is # gzipped, the handle will be to an unseekable stream coming out of a # zcat pipe. If the given file name doesn't correspond to an existing # file, the routine will try to add '.gz' to the file name or to remove # any .'Z' or '.gz' and try again. Returns undef on failure and will # write a warning to stderr. ####################################################################### sub get_filehandle { my ($self, $file_name) = @_; my $io =undef; if(!(defined $file_name) or $file_name eq ''){ confess "No file name"; } my $alt_file_name = $file_name; $alt_file_name =~ s/\.(gz|Z)$//x; if ( $alt_file_name eq $file_name ) { $alt_file_name .= '.gz'; } if ( !-e $file_name ) { carp( "File '$file_name' does not exist, " . "will try '$alt_file_name'" ); $file_name = $alt_file_name; } if ( $file_name =~ /\.(gz|Z)$/x ) { # Read from zcat pipe $io = IO::File->new("zcat $file_name |") or carp("Can not open file '$file_name' with 'zcat'"); } else { # Read file normally $io = IO::File->new($file_name) or carp("Can not open file '$file_name'"); } if ( !defined $io ) { return } if ($verbose) { print "Reading from '$file_name'...\n" || croak 'Could not print out message'; } return $io; } ############################################# # Get source ID for a particular source name # # Arg[1] source name # Arg[2] priority description # # Returns source_id or -1 if not found ############################################# sub get_source_id_for_source_name { my ($self, $source_name,$priority_desc) = @_; my $low_name = lc $source_name; my $sql = "SELECT source_id FROM source WHERE LOWER(name)='$low_name'"; if(defined $priority_desc){ $low_name = lc $priority_desc; $sql .= " AND LOWER(priority_description)='$low_name'"; $source_name .= " ($priority_desc)"; } my $sth = $self->dbi->prepare($sql); $sth->execute(); my @row = $sth->fetchrow_array(); my $source_id; if (@row) { $source_id = $row[0]; } else { carp "WARNING: There is no entity $source_name in the source-table of the xref database.\n"; carp "WARNING:. The external db name ($source_name) is hardcoded in the parser\n"; carp "WARNING: Couldn't get source ID for source name $source_name\n"; $source_id = '-1'; } return $source_id; } ############################################################ # Get a set of source IDs matching a source name pattern # # Adds % to each end of the source name and doe a like query # to find all the matching source names source_ids. # # Returns an empty list if none found. ############################################################ sub get_source_ids_for_source_name_pattern { my ($self, $source_name) = @_; my $big_name = uc $source_name; my $sql = "SELECT source_id FROM source WHERE upper(name) LIKE '%${big_name}%'"; my $sth = $self->dbi->prepare($sql); my @sources; $sth->execute(); while(my @row = $sth->fetchrow_array()){ push @sources,$row[0]; } $sth->finish; return @sources; } ############################### # From a source_id get the name ############################### sub get_source_name_for_source_id { my ($self, $source_id) = @_; my $source_name; my $sql = "SELECT name FROM source WHERE source_id= '$source_id'"; my $sth = $self->dbi->prepare($sql); $sth->execute(); my @row = $sth->fetchrow_array(); if (@row) { $source_name = $row[0]; } else { carp "There is no entity with source-id $source_id in the source-table of the \n"; carp "xref-database. The source-id and the name of the source-id is hard-coded in populate_metadata.sql\n" ; carp "and in the parser\n"; carp "Couldn't get source name for source ID $source_id\n"; $source_name = '-1'; } return $source_name; } #################################################### # Get a hash to go from accession of a dependent xref # to master_xref_id for all of source names given ##################################################### sub get_valid_xrefs_for_dependencies{ my ($self, $dependent_name, @reverse_ordered_source_list) = @_; my %dependent_2_xref; my $sql = 'select source_id from source where LOWER(name) =?'; my $sth = $self->dbi->prepare($sql); my @dependent_sources; $sth->execute(lc $dependent_name); while(my @row = $sth->fetchrow_array()){ push @dependent_sources,$row[0]; } my @sources; foreach my $name (@reverse_ordered_source_list){ $sth->execute(lc $name); while(my @row = $sth->fetchrow_array()){ push @sources,$row[0]; } } $sth->finish; my $dep_sql = (<<'DSS'); SELECT d.master_xref_id, x2.accession FROM dependent_xref d, xref x1, xref x2 WHERE x1.xref_id = d.master_xref_id AND x1.source_id = ? AND x2.xref_id = d.dependent_xref_id AND x2.source_id = ? DSS $sth = $self->dbi->prepare($dep_sql); foreach my $d (@dependent_sources){ foreach my $s (@sources){ $sth->execute($s,$d); while(my @row = $sth->fetchrow_array()){ $dependent_2_xref{$row[1]} = $row[0]; } } } return \%dependent_2_xref; } #################################################### # Get a hash to go from accession of a direct xref # to master_xref_id for all of source names given ##################################################### sub get_valid_xrefs_for_direct_xrefs{ my ($self, $direct_name, $separator) = @_; my %direct_2_xref; my $sql = 'select source_id from source where name like ?'; my $sth = $self->dbi->prepare($sql); my @direct_sources; $sth->execute("${direct_name}%"); while(my @row = $sth->fetchrow_array()){ push @direct_sources,$row[0]; } my $gen_sql =(<<"GDS"); SELECT d.general_xref_id, d.ensembl_stable_id, 'TYPE', d.linkage_xref, x1.accession FROM TABLE_direct_xref d, xref x1 WHERE x1.xref_id = d.general_xref_id AND x1.source_id=? GDS my @sth; my $i=0; foreach my $type (qw(Gene Transcript Translation)){ my $t_sql = $gen_sql; my $table = lc $type; $t_sql =~ s/TABLE/$table/xsm; $t_sql =~ s/TYPE/$type/xsm; $sth[$i++] = $self->dbi->prepare($t_sql); } foreach my $d (@direct_sources){ for my $ii (0..2) { $sth[$ii]->execute($d); while(my ($gen_xref_id, $stable_id, $type, $link, $acc) = $sth[$ii]->fetchrow_array()){ $direct_2_xref{$acc} = $gen_xref_id.$separator.$stable_id.$separator.$type.$separator.$link; } } } return \%direct_2_xref; } ############################################# # Get a hash of label to acc for a particular # source name and species_id ############################################# sub label_to_acc{ my ($self,$source_name,$species_id) =@_; # First cache synonyms so we can quickly add them later my %synonyms; my $syn_sth = $self->dbi->prepare('SELECT xref_id, synonym FROM synonym'); $syn_sth->execute(); my ($xref_id, $synonym); $syn_sth->bind_columns(\$xref_id, \$synonym); while ($syn_sth->fetch()) { push @{$synonyms{$xref_id}}, $synonym; } my %valid_codes; my @sources; my $big_name = uc $source_name; my $sql = "select source_id from source where upper(name) like '%${big_name}%'"; my $sth = $self->dbi->prepare($sql); $sth->execute(); while(my @row = $sth->fetchrow_array()){ push @sources,$row[0]; } $sth->finish; foreach my $source (@sources){ $sql = "select label, xref_id from xref where species_id = $species_id and source_id = $source"; $sth = $self->dbi->prepare($sql); $sth->execute(); while(my @row = $sth->fetchrow_array()){ $valid_codes{$row[0]} =$row[1]; # add any synonyms for this xref as well foreach my $syn (@{$synonyms{$row[1]}}) { $valid_codes{$syn} = $row[1]; } } } return \%valid_codes; } #################################################### # get_valid_codes # # hash of accession to array of xrefs. # This is an array becouse more than one entry can # exist. i.e. for uniprot and refseq we have direct # and sequence match sets and we need to give both. #################################################### sub get_valid_codes{ my ($self,$source_name,$species_id) =@_; # First cache synonyms so we can quickly add them later my %synonyms; my $dbi = $self->dbi; my $syn_sth = $dbi->prepare('SELECT xref_id, synonym FROM synonym'); $syn_sth->execute(); my ($xref_id, $synonym); $syn_sth->bind_columns(\$xref_id, \$synonym); while ($syn_sth->fetch()) { push @{$synonyms{$xref_id}}, $synonym; } my %valid_codes; my @sources; my $big_name = uc $source_name; my $sql = "select source_id from source where upper(name) like '%$big_name%'"; my $sth = $dbi->prepare($sql); $sth->execute(); while(my @row = $sth->fetchrow_array()){ push @sources,$row[0]; } $sth->finish; foreach my $source (@sources){ $sql = "select accession, xref_id from xref where species_id = $species_id and source_id = $source"; $sth = $dbi->prepare($sql); $sth->execute(); while(my @row = $sth->fetchrow_array()){ push @{$valid_codes{$row[0]}}, $row[1]; # add any synonyms for this xref as well foreach my $syn (@{$synonyms{$row[1]}}) { push @{$valid_codes{$syn}}, $row[1]; } } } return \%valid_codes; } ############################## # Upload xrefs to the database ############################## sub upload_xref_object_graphs { my ($self, $rxrefs) = @_; my $count = scalar @{$rxrefs}; if($verbose) { print "count = $count\n" || croak 'Could not print out count'; } if ($count) { ################# # upload new ones ################## if ($verbose) { print "Uploading xrefs\n" || croak 'Could not print string'; } ################################################################################# # Start of sql needed to add xrefs, primary_xrefs, synonym, dependent_xrefs etc.. ################################################################################# my $dbi = $self->dbi; my $xref_sth = $dbi->prepare('INSERT INTO xref (accession,version,label,description,source_id,species_id, info_type) VALUES(?,?,?,?,?,?,?)'); my $pri_insert_sth = $dbi->prepare('INSERT INTO primary_xref VALUES(?,?,?,?)'); my $pri_update_sth = $dbi->prepare('UPDATE primary_xref SET sequence=? WHERE xref_id=?'); my $syn_sth = $dbi->prepare('INSERT INTO synonym VALUES(?,?)'); my $dep_sth = $dbi->prepare('INSERT INTO dependent_xref (master_xref_id, dependent_xref_id, linkage_annotation, linkage_source_id) VALUES(?,?,?,?)'); my $xref_update_label_sth = $dbi->prepare('UPDATE xref SET label=? WHERE xref_id=?'); my $xref_update_descr_sth = $dbi->prepare('UPDATE xref SET description=? WHERE xref_id=?'); my $pair_sth = $dbi->prepare('INSERT INTO pairs VALUES(?,?,?)'); # disable error handling here as we'll do it ourselves # reenabled it, as errorcodes are really unhelpful $xref_sth->{RaiseError} = 0; $xref_sth->{PrintError} = 0; ################################################################################# # End of sql needed to add xrefs, primary_xrefs, synonym, dependent_xrefs etc.. ################################################################################# foreach my $xref (@{$rxrefs}) { my $xref_id=undef; if(!(defined $xref->{ACCESSION} )){ print "Your xref does not have an accession-number,so it can't be stored in the database\n" || croak 'Could not write message'; return; } ######################################## # Create entry in xref table and note ID ######################################## if(! $xref_sth->execute($xref->{ACCESSION}, $xref->{VERSION} || 0, $xref->{LABEL}|| $xref->{ACCESSION}, $xref->{DESCRIPTION}, $xref->{SOURCE_ID}, $xref->{SPECIES_ID}, $xref->{INFO_TYPE} || 'MISC')){ # # if we failed to add the xref it must already exist so go find the xref_id for this # if(!(defined $xref->{SOURCE_ID})){ print "your xref: $xref->{ACCESSION} does not have a source-id\n"; return; } $xref_id = $self->get_xref_id({ sth => $xref_sth, error => $dbi->err, acc => $xref->{ACCESSION}, source_id => $xref->{SOURCE_ID}, species_id => $xref->{SPECIES_ID}} ); if(defined $xref->{LABEL} ) { $xref_update_label_sth->execute($xref->{LABEL},$xref_id) ; } if(defined $xref->{DESCRIPTION} ){ $xref_update_descr_sth->execute($xref->{DESCRIPTION},$xref_id); } } else{ # # get the xref_id for the newly created xref. # $xref_id = $self->get_xref_id({ sth => $xref_sth, error => $dbi->err, acc => $xref->{ACCESSION}, source_id => $xref->{SOURCE_ID}, species_id => $xref->{SPECIES_ID}} ); } ################ # Error checking ################ if(!((defined $xref_id) and $xref_id)){ print STDERR "xref_id is not set for :\n". "$xref->{ACCESSION}\n$xref->{LABEL}\n". "$xref->{DESCRIPTION}\n$xref->{SOURCE_ID}\n". "$xref->{SPECIES_ID}\n"; } ############################################################################# # create entry in primary_xref table with sequence; if this is a "cumulative" # entry it may already exist, and require an UPDATE rather than an INSERT ############################################################################# if(defined $xref->{SEQUENCE} ){ if ( $self->primary_xref_id_exists($xref_id) ) { $pri_update_sth->execute( $xref->{SEQUENCE}, $xref_id ) or croak( $dbi->errstr() ); } else { $pri_insert_sth->execute( $xref_id, $xref->{SEQUENCE}, $xref->{SEQUENCE_TYPE}, $xref->{STATUS} ) or croak( $dbi->errstr() ); } } ########################################################## # if there are synonyms, add entries in the synonym table ########################################################## foreach my $syn ( @{ $xref->{SYNONYMS} } ) { $syn_sth->execute( $xref_id, $syn ) or croak( $dbi->errstr() . "\n $xref_id\n $syn\n" ); } ####################################################################### # if there are dependent xrefs, add xrefs and dependent xrefs for them ####################################################################### foreach my $depref (@{$xref->{DEPENDENT_XREFS}}) { my %dep = %{$depref}; ################# # Insert the xref ################# # print "inserting $dep{ACCESSION},$dep{VERSION},$dep{LABEL},$dep{DESCRIPTION},$dep{SOURCE_ID},${\$xref->{SPECIES_ID}}\n"; $xref_sth->execute($dep{ACCESSION}, $dep{VERSION} || 0, $dep{LABEL} || $dep{ACCESSION}, $dep{DESCRIPTION} || '', $dep{SOURCE_ID}, $xref->{SPECIES_ID}, 'DEPENDENT'); ##################################### # find the xref_id for dependent xref ##################################### my $dep_xref_id = $self->get_xref_id({ sth => $xref_sth, error => $dbi->err, acc => $dep{ACCESSION}, source_id => $dep{SOURCE_ID}, species_id => $xref->{SPECIES_ID}} ); if(!(defined $dep_xref_id) || $dep_xref_id ==0 ){ print STDERR "acc = $dep{ACCESSION} \nlink = $dep{LINKAGE_SOURCE_ID} \n".$dbi->err."\n"; print STDERR "source = $dep{SOURCE_ID}\n"; } # # Add the linkage_annotation and source id it came from # $dep_sth->execute( $xref_id, $dep_xref_id, $dep{LINKAGE_ANNOTATION}, $dep{LINKAGE_SOURCE_ID} ) or croak( $dbi->errstr() ); ######################################################### # if there are synonyms, add entries in the synonym table ######################################################### foreach my $syn ( @{ $dep{SYNONYMS} } ) { $syn_sth->execute( $dep_xref_id, $syn ) or croak( $dbi->errstr() . "\n $xref_id\n $syn\n" ); } # foreach syn } # foreach dep ################################################# # Add the pair data. refseq dna/pep pairs usually ################################################# if(defined $xref_id and defined $xref->{PAIR} ){ $pair_sth->execute($xref->{SOURCE_ID},$xref->{ACCESSION},$xref->{PAIR}); } ########################### # tidy up statement handles ########################### if(defined $xref_sth) {$xref_sth->finish()}; if(defined $pri_insert_sth) {$pri_insert_sth->finish()} ; if(defined $pri_update_sth) {$pri_update_sth->finish()}; } # foreach xref } return 1; } ###################################################################################### # Add direct xref to the table XXX_direct_xref. (XXX -> Gene.Transcript or Translation # Xref has to exist already, this module just adds ot yo the direct_xref table. # $direct_xref is a reference to an array of hash objects. ###################################################################################### sub upload_direct_xrefs{ my ($self, $direct_xref) = @_; for my $dr(@{$direct_xref}) { ################################################ # Find the xref_id for this accession and source ################################################ my $general_xref_id = get_xref($dr->{ACCESSION},$dr->{SOURCE_ID},$dr->{SPECIES_ID}); ####################################################### # If found add the direct xref else write error message ####################################################### if ($general_xref_id){ $self->add_direct_xref($general_xref_id, $dr->{ENSEMBL_STABLE_ID},$dr->{ENSEMBL_TYPE},$dr->{LINKAGE_XREF}); } else{ print {*STDERR} 'Problem Could not find accession '.$dr->{ACCESSION}.' for source '.$dr->{SOURCE}. ' so not able to add direct xref to '.$dr->{ENSEMBL_STABLE_ID}."\n"; } } return; } ############################################### # Insert into the meta table the key and value. ############################################### sub add_meta_pair { my ($self, $key, $value) = @_; my $sth = $self->dbi->prepare('insert into meta (meta_key, meta_value, date) values("'.$key.'", "'.$value.'", now())'); $sth->execute; $sth->finish; return; } ################################################# # Create a hash of all the source names for xrefs ################################################# sub get_xref_sources { my $self = shift; my %sourcename_to_sourceid; my $dbi = $self->dbi; my $sth = $dbi->prepare('SELECT name,source_id FROM source'); $sth->execute() or croak( $dbi->errstr() ); while(my @row = $sth->fetchrow_array()) { my $source_name = $row[0]; my $source_id = $row[1]; $sourcename_to_sourceid{$source_name} = $source_id; } $sth->finish; return %sourcename_to_sourceid; } ######################################################################## # Create and return a hash that that goes from species_id to taxonomy_id ######################################################################## sub species_id2taxonomy { my $self = shift; my %species_id2taxonomy; my $dbi = $self->dbi; my $sth = $dbi->prepare('SELECT species_id, taxonomy_id FROM species'); $sth->execute() or croak( $dbi->errstr() ); while(my @row = $sth->fetchrow_array()) { my $species_id = $row[0]; my $taxonomy_id = $row[1]; if(defined $species_id2taxonomy{$species_id} ){ push @{$species_id2taxonomy{$species_id}}, $taxonomy_id; } else{ $species_id2taxonomy{$species_id} = [$taxonomy_id]; } } return %species_id2taxonomy; } ######################################################################### # Create and return a hash that that goes from species_id to species name ######################################################################### sub species_id2name { my $self = shift; my %species_id2name; my $dbi = $self->dbi; my $sth = $dbi->prepare('SELECT species_id, name FROM species'); $sth->execute() or croak( $dbi->errstr() ); while ( my @row = $sth->fetchrow_array() ) { my $species_id = $row[0]; my $name = $row[1]; $species_id2name{$species_id} = [ $name ]; } ############################################## # Also populate the hash with all the aliases. ############################################## $sth = $dbi->prepare('SELECT species_id, aliases FROM species'); $sth->execute() or croak( $dbi->errstr() ); while ( my @row = $sth->fetchrow_array() ) { my $species_id = $row[0]; foreach my $name ( split /,\s*/xms, $row[1] ) { $species_id2name{$species_id} ||= []; push @{$species_id2name{$species_id}}, $name; } } return %species_id2name; } ## end sub species_id2name ########################################################################### # If there was an error, an xref with the same acc & source already exists. # If so, find its ID, otherwise get ID of xref just inserted ########################################################################### sub get_xref_id { my ($self, $arg_ref) = @_; my $sth = $arg_ref->{sth} || croak 'Need a statement handle for get_xref_id'; my $acc = $arg_ref->{acc} || croak 'Need an accession for get_xref_id'; my $source = $arg_ref->{source_id} || croak 'Need an source_id for get_xref_id'; my $species = $arg_ref->{species_id} || confess 'Need an species_id for get_xref_id'; my $error = $arg_ref->{error}; my $id; if ($error and ($error eq '1062')) { # duplicate (okay so get the original) $id = $self->get_xref($acc, $source, $species); } elsif ($error){ croak "Error $error"; } else { $id = $sth->{'mysql_insertid'}; } return $id; } ################################################################## # If primary xref already exists for a partiuclar xref_id return 1 # else return 0; ################################################################## sub primary_xref_id_exists { my ($self, $xref_id) = @_; my $exists = 0; my $dbi = $self->dbi; my $sth = $dbi->prepare('SELECT xref_id FROM primary_xref WHERE xref_id=?'); $sth->execute($xref_id) or croak( $dbi->errstr() ); my @row = $sth->fetchrow_array(); my $result = $row[0]; if (defined $result) {$exists = 1; } return $exists; } ############################################ # Get the tax id for a particular species id ############################################ sub get_taxonomy_from_species_id{ my ($self,$species_id) = @_; my %hash; my $dbi= $self->dbi; my $sth = $dbi->prepare("SELECT taxonomy_id FROM species WHERE species_id = $species_id"); $sth->execute() or croak( $dbi->errstr() ); while(my @row = $sth->fetchrow_array()) { $hash{$row[0]} = 1; } $sth->finish; return \%hash; } ################################################ # xref_id for a given stable id and linkage_xref # Only used in GOParser at the moment ################################################ sub get_direct_xref{ my ($self,$stable_id,$type,$link) = @_; $type = lc $type; my $dbi = $self->dbi; my $sql = "select general_xref_id from ${type}_direct_xref d where ensembl_stable_id = ? and linkage_xref= ?"; my $direct_sth = $dbi->prepare($sql); $direct_sth->execute( $stable_id, $link ) or croak( $dbi->errstr() ); if(my @row = $direct_sth->fetchrow_array()) { return $row[0]; } return; } ################################################################### # return the xref_id for a particular accession, source and species # if not found return undef; ################################################################### sub get_xref{ my ($self,$acc,$source, $species_id) = @_; my $dbi = $self->dbi; # # If the statement handle does nt exist create it. # if(!(defined $get_xref_sth) ){ my $sql = 'select xref_id from xref where accession = ? and source_id = ? and species_id = ?'; $get_xref_sth = $dbi->prepare($sql); } # # Find the xref_id using the sql above # $get_xref_sth->execute( $acc, $source, $species_id ) or croak( $dbi->errstr() ); if(my @row = $get_xref_sth->fetchrow_array()) { return $row[0]; } return; } ########################################################### # Create an xref.. # If it already exists it return that xrefs xref_id # else creates it and return the new xre_id ########################################################### sub add_xref { my ( $self, $arg_ref) = @_; my $acc = $arg_ref->{acc} || croak 'add_xref needs aa acc'; my $source_id = $arg_ref->{source_id} || croak 'add_xref needs a source_id'; my $species_id = $arg_ref->{species_id} || croak 'add_xref needs a species_id'; my $label = $arg_ref->{label} || $acc; my $description = $arg_ref->{desc} || ''; my $version = $arg_ref->{version} || 0; my $info_type = $arg_ref->{info_type} || 'MISC'; ################################################################## # See if it already exists. It so return the xref_id for this one. ################################################################## my $xref_id = $self->get_xref($acc,$source_id, $species_id); if(defined $xref_id){ return $xref_id; } ####################################################################### # If the statement handle for the insertion of xrefs does not exist yet # then create it ####################################################################### if (!(defined $add_xref_sth) ) { $add_xref_sth = $self->dbi->prepare( 'INSERT INTO xref ' . '(accession,version,label,description,source_id,species_id, info_type) ' . 'VALUES(?,?,?,?,?,?,?)' ); } ###################################################################### # If the description is more than 255 characters, chop it off and add # an indication that it has been truncated to the end of it. ###################################################################### if (defined $description && ((length $description) > 255 ) ) { my $truncmsg = ' /.../'; substr $description, 255 - (length $truncmsg), length $truncmsg, $truncmsg; } #################################### # Add the xref and croak if it fails #################################### $add_xref_sth->execute( $acc, $version || 0, $label, $description, $source_id, $species_id, $info_type ) or croak("$acc\t$label\t\t$source_id\t$species_id\n"); return $add_xref_sth->{'mysql_insertid'}; } ## end sub add_xref ################################################################### # Create new xref if needed and add as a direct xref to a stable_id ################################################################### sub add_to_direct_xrefs{ my ($self, $arg_ref) = @_; my $stable_id = $arg_ref->{stable_id} || croak ('Need a direct_xref on which this xref linked too' ); my $type = $arg_ref->{type} || croak ('Need a table type on which to add'); my $acc = $arg_ref->{acc} || croak ('Need an accession of this direct xref' ); my $source_id = $arg_ref->{source_id} || croak ('Need a source_id for this direct xref' ); my $species_id = $arg_ref->{species_id} || croak ('Need a species_id for this direct xref' ); my $version = $arg_ref->{version} || 0; my $label = $arg_ref->{label} || $acc; my $description = $arg_ref->{desc}; my $linkage = $arg_ref->{linkage}; my $dbi= $self->dbi(); ###################### # Get statement handle ###################### if(!(defined $add_xref_sth)){ my $sql = (<<'AXX'); INSERT INTO xref (accession,version,label,description,source_id,species_id, info_type) VALUES (?,?,?,?,?,?,?) AXX $add_xref_sth = $dbi->prepare($sql); } ############################################################### # If the acc already has an xrefs find it else cretae a new one ############################################################### my $direct_id = $self->get_xref($acc, $source_id, $species_id); if(!(defined $direct_id)){ $add_xref_sth->execute( $acc, $version || 0, $label, $description, $source_id, $species_id, 'DIRECT' ) or croak("$acc\t$label\t\t$source_id\t$species_id\n"); } $direct_id = $self->get_xref($acc, $source_id, $species_id); ######################### # Now add the direct info ######################### $self->add_direct_xref($direct_id, $stable_id, $type, ''); return; } ################################################################## # Add a single record to the direct_xref table. # Note that an xref must already have been added to the xref table ################################################################## sub add_direct_xref { my ($self, $general_xref_id, $ensembl_stable_id, $ensembl_type, $linkage_type) = @_; my $dbi = $self->dbi; ####################################################### # Create statement handles if they do not exist already ######################################################## if (!(defined $add_direct_xref_sth{$ensembl_type})){ my $add_gene_direct_xref_sth = $dbi->prepare('INSERT INTO gene_direct_xref VALUES(?,?,?)'); my $add_tr_direct_xref_sth = $dbi->prepare('INSERT INTO transcript_direct_xref VALUES(?,?,?)'); my $add_tl_direct_xref_sth = $dbi->prepare('INSERT INTO translation_direct_xref VALUES(?,?,?)'); $add_direct_xref_sth{'gene'} = $add_gene_direct_xref_sth; $add_direct_xref_sth{'transcript'} = $add_tr_direct_xref_sth; $add_direct_xref_sth{'translation'} = $add_tl_direct_xref_sth; $add_direct_xref_sth{'Gene'} = $add_gene_direct_xref_sth; $add_direct_xref_sth{'Transcript'} = $add_tr_direct_xref_sth; $add_direct_xref_sth{'Translation'} = $add_tl_direct_xref_sth; } ############################## # Make sure type is recognised ############################## if(!(defined $add_direct_xref_sth{$ensembl_type})){ croak "ERROR add_direct_xref_sth does not exist for $ensembl_type ???"; } else{ ########################## # Add the direct xref data ########################## $add_direct_xref_sth{$ensembl_type}->execute($general_xref_id, $ensembl_stable_id, $linkage_type); } return; } ########################################################## # Create/Add xref and add it as a dependency of the master ########################################################## sub add_dependent_xref{ my ($self, $arg_ref) = @_; my $master_xref = $arg_ref->{master_xref_id} || croak( 'Need a master_xref_id on which this xref depends on' ); my $acc = $arg_ref->{acc} || croak( 'Need an accession of this dependent xref' ); my $source_id = $arg_ref->{source_id} || croak( 'Need a source_id for this dependent xref' ); my $species_id = $arg_ref->{species_id} || croak( 'Need a species_id for this dependent xref' ); my $version = $arg_ref->{version} || 0; my $label = $arg_ref->{label} || $acc; my $description = $arg_ref->{desc}; my $linkage = $arg_ref->{linkage}; my $dbi = $self->dbi; ######################################## # Create/Get the statement handle needed ######################################## if(!(defined $add_xref_sth)){ my $sql = (<<'IXR'); INSERT INTO xref (accession,version,label,description,source_id,species_id, info_type) VALUES (?,?,?,?,?,?,?) IXR $add_xref_sth = $dbi->prepare($sql); } if(!(defined $add_dependent_xref_sth)){ my $sql = (<<'ADX'); INSERT INTO dependent_xref (master_xref_id,dependent_xref_id,linkage_annotation,linkage_source_id) VALUES (?,?,?,?) ADX $add_dependent_xref_sth = $dbi->prepare($sql); } #################################################### # Does the xref already exist. If so get its xref_id # else create it and get the new xref_id #################################################### my $dependent_id = $self->get_xref($acc, $source_id, $species_id); if(!(defined $dependent_id)){ $add_xref_sth->execute( $acc, $version, $label, $description, $source_id, $species_id, 'DEPENDENT' ) or croak("$acc\t$label\t\t$source_id\t$species_id\n"); } $dependent_id = $self->get_xref($acc, $source_id, $species_id); ################################################ # Croak if we have failed to create.get the xref ################################################ if(!(defined $dependent_id)){ croak("$acc\t$label\t\t$source_id\t$species_id\n"); } ######################################################################################## # If the dependency has not already been set ( is already in hash xref_dependent_mapped) # then add it ######################################################################################## if(!(defined $xref_dependent_mapped{"$master_xref|$dependent_id"})){ $add_dependent_xref_sth->execute( $master_xref, $dependent_id, $linkage, $source_id ) or croak("$master_xref\t$dependent_id\t$linkage\t$source_id"); $xref_dependent_mapped{"$master_xref|$dependent_id"} = 1; } return $dependent_id; } ################################################################## # Add synonyms for a particular accession for one or more sources. # This is for priority xrefs where we have more than one source # but want to write synonyms for each with the same accession ################################################################## sub add_to_syn_for_mult_sources{ my ($self, $acc, $sources, $syn, $species_id) = @_; my $dbi = $self->dbi; if(!(defined $add_synonym_sth)){ $add_synonym_sth = $dbi->prepare('INSERT INTO synonym VALUES(?,?)'); } foreach my $source_id (@{$sources}){ my $xref_id = $self->get_xref($acc, $source_id, $species_id); if(defined $xref_id){ $add_synonym_sth->execute( $xref_id, $syn ) or croak( $dbi->errstr() . "\n $xref_id\n $syn\n" ); } } return; } ########################################################## # Add synomyn for an xref given by accession and source_id ########################################################## sub add_to_syn{ my ($self, $acc, $source_id, $syn, $species_id) = @_; my $dbi = $self->dbi; if(!(defined $add_synonym_sth)){ $add_synonym_sth = $dbi->prepare('INSERT INTO synonym VALUES(?,?)'); } my $xref_id = $self->get_xref($acc, $source_id, $species_id); if(defined $xref_id){ $add_synonym_sth->execute( $xref_id, $syn ) or croak( $dbi->errstr() . "\n $xref_id\n $syn\n" ); } else { carp ( "Could not find acc $acc in " . "xref table source = $source_id of species $species_id\n" ); } return; } ########################################## # Add synomyn for an xref given by xref_id ########################################## sub add_synonym{ my ($self, $xref_id, $syn) = @_; my $dbi=$self->dbi; if(!(defined $add_synonym_sth)){ $add_synonym_sth = $dbi->prepare('INSERT INTO synonym VALUES(?,?)'); } $add_synonym_sth->execute( $xref_id, $syn ) or croak( $dbi->errstr()."\n $xref_id\n $syn\n\n" ); return; } ######################################################## # Create a hash that uses the label as a key # and the acc as the value. Also add synonyms for these # as keys. ####################################################### sub get_label_to_acc{ my ($self, $name, $species_id, $prio_desc) = @_; my %hash1=(); my $sql =(<<"GLA"); SELECT xref.accession, xref.label FROM xref, source WHERE source.name LIKE '$name%' AND xref.source_id = source.source_id GLA if(defined $prio_desc){ $sql .= " and source.priority_description like '$prio_desc'"; } if(defined $species_id){ $sql .= " and xref.species_id = $species_id"; } my $sub_sth = $self->dbi->prepare($sql); $sub_sth->execute(); while(my @row = $sub_sth->fetchrow_array()) { $hash1{$row[1]} = $row[0]; } #################### # Remember synonyms #################### $sql =(<<"GLS"); SELECT xref.accession, synonym.synonym FROM xref, source, synonym WHERE synonym.xref_id = xref.xref_id AND source.name like '$name%' AND xref.source_id = source.source_id GLS if(defined $prio_desc){ $sql .= " AND source.priority_description LIKE '$prio_desc'"; } if(defined $species_id){ $sql .= " AND xref.species_id = $species_id"; } $sub_sth = $self->dbi->prepare($sql); $sub_sth->execute(); while(my @row = $sub_sth->fetchrow_array()) { $hash1{$row[1]} = $row[0]; } return \%hash1; } ######################################################## # Create a hash that uses the label as a key # and the desc as the value. Also add synonyms for these # as keys. ####################################################### sub get_label_to_desc{ my ($self, $name, $species_id, $prio_desc) = @_; my %hash1=(); my $sql =(<<"GDH"); SELECT xref.description, xref.label FROM xref, source WHERE source.name LIKE '$name%' AND xref.source_id = source.source_id GDH if(defined $prio_desc){ $sql .= " and source.priority_description like '$prio_desc'"; } if(defined $species_id){ $sql .= " and xref.species_id = $species_id"; } my $sub_sth = $self->dbi->prepare($sql); $sub_sth->execute(); while(my @row = $sub_sth->fetchrow_array()) { $hash1{$row[1]} = $row[0]; } ########################### # Also include the synonyms ########################### my $syn_sql =(<<"GDS"); SELECT xref.description, synonym.synonym FROM xref, source, synonym WHERE synonym.xref_id = xref.xref_id AND source.name like '$name%' AND xref.source_id = source.source_id GDS if(defined $prio_desc){ $syn_sql .= " AND source.priority_description LIKE '$prio_desc'"; } if(defined $species_id){ $syn_sql .= " AND xref.species_id = $species_id"; } $sub_sth = $self->dbi->prepare($syn_sql); $sub_sth->execute(); while(my @row = $sub_sth->fetchrow_array()) { $hash1{$row[1]} = $row[0]; } return \%hash1; } ######################################## # Set release for a particular source_id. ######################################## sub set_release{ my ($self, $source_id, $s_release ) = @_; my $sth = $self->dbi->prepare('UPDATE source SET source_release=? WHERE source_id=?'); if($verbose) { print "Setting release to '$s_release' for source ID '$source_id'\n"; } $sth->execute( $s_release, $source_id ); return; } ############################################################################# # create a hash of all the dependent mapping that exist for a given source_id # Of the format {master_xref_id|dependent_xref_id} ############################################################################# sub get_dependent_mappings { my $self = shift; my $source_id = shift; my $sql =(<<"GDM"); SELECT d.master_xref_id, d.dependent_xref_id FROM dependent_xref d, xref x WHERE x.xref_id = d.dependent_xref_id AND x.source_id = $source_id GDM my $sth = $self->dbi->prepare($sql); $sth->execute(); my $master_xref; my $dependent_xref; $sth->bind_columns(\$master_xref,\$dependent_xref); while($sth->fetch){ $xref_dependent_mapped{"$master_xref|$dependent_xref"}=1; } $sth->finish; return; } ########################################################## # Create a has that uses the accession and labels for keys # and an array of the synonyms as the vaules ########################################################## sub get_ext_synonyms{ my $self = shift; my $source_name = shift; my %ext_syns; my %seen; # can be in more than once fro each type of external source. my $separator = qw{:}; my $sql =(<<"GES"); SELECT x.accession, x.label, sy.synonym FROM xref x, source so, synonym sy WHERE x.xref_id = sy.xref_id AND so.source_id = x.source_id AND so.name like '$source_name' GES my $sth = $self->dbi->prepare($sql); $sth->execute; my ($acc, $label, $syn); $sth->bind_columns(\$acc, \$label, \$syn); my $count = 0; while($sth->fetch){ if(!(defined $seen{$acc.$separator.$syn})){ push @{$ext_syns{$acc}}, $syn; push @{$ext_syns{$label}}, $syn; $count++; } $seen{$acc.$separator.$syn} = 1; } $sth->finish; return \%ext_syns; } ###################################################################### # Store data needed to beable to revert to same stage as after parsing ###################################################################### sub parsing_finished_store_data { my $self = shift; # Store max id for # gene/transcript/translation_direct_xref general_xref_id #Does this change?? # xref xref_id # dependent_xref object_xref_id is all null # go_xref object_xref_id # object_xref object_xref_id # identity_xref object_xref_id my %table_and_key = ( 'xref' => 'xref_id', 'object_xref' => 'object_xref_id' ); foreach my $table ( keys %table_and_key ) { my $sth = $self->dbi->prepare( 'select MAX(' . $table_and_key{$table} . ") from $table" ); $sth->execute; my $max_val; $sth->bind_columns( \$max_val ); $sth->fetch; $sth->finish; $self->add_meta_pair( 'PARSED_' . $table_and_key{$table}, $max_val || 1 ); } return; } ## end sub parsing_finished_store_data sub get_meta_value { my ($self, $key) = @_; my $sth = $self->dbi->prepare('select meta_value from meta where meta_key like "'.$key.'" order by meta_id'); $sth->execute(); my $value; $sth->bind_columns(\$value); while($sth->fetch){ # get the last one } $sth->finish; return $value; } 1;
31.634864
153
0.527812
ed2157e871d0e0c216009e645343623ac2952a18
841
pl
Perl
src/syn.pl
toothedsword/.tmux
5b091b63e0bf72508d8cf77a9bd0f7c431c3ced1
[ "WTFPL", "MIT" ]
null
null
null
src/syn.pl
toothedsword/.tmux
5b091b63e0bf72508d8cf77a9bd0f7c431c3ced1
[ "WTFPL", "MIT" ]
null
null
null
src/syn.pl
toothedsword/.tmux
5b091b63e0bf72508d8cf77a9bd0f7c431c3ced1
[ "WTFPL", "MIT" ]
null
null
null
#!/usr/bin/env perl # /**--------------------------------------------------------------------------- # # File: syn.pl # # Usage: ./syn.pl # # Description: # # Options: --- # Requirements: --- # Bugs: --- # Notes: --- # Author: Liang Peng (...), pengliang@piesat # Organization: ... # Version: 1.0 # Created: 2021年02月27日 00时58分21秒 # Revision: --- # ----------------------------------------------------------------------------*/ use strict; use warnings; use utf8; my $m = shift; system("tmux set synchronize-panes"); if ($m) { system("tmux set pane-border-style 'fg=5 bg=default'"); system("tmux set window-style 'bg=default fg=5'"); } else { system("tmux set pane-border-style 'fg=#ff0000 bg=default'"); system("tmux set window-style 'bg=default fg=#888888'"); }
24.028571
80
0.463734
ed202d4389892c21f2be61489178077a41786654
6,760
pl
Perl
windows10/git-bash-zsh/usr/share/perl5/core_perl/unicore/lib/In/6_3.pl
Allen-LPL/dotfiles
9bc894fc6c9d32b1a0c84812c66fb5133484eff4
[ "MIT" ]
1,318
2019-07-11T10:34:39.000Z
2022-03-29T15:05:19.000Z
windows10/git-bash-zsh/usr/share/perl5/core_perl/unicore/lib/In/6_3.pl
Allen-LPL/dotfiles
9bc894fc6c9d32b1a0c84812c66fb5133484eff4
[ "MIT" ]
387
2019-09-05T16:33:09.000Z
2022-03-31T10:43:39.000Z
windows10/git-bash-zsh/usr/share/perl5/core_perl/unicore/lib/In/6_3.pl
Allen-LPL/dotfiles
9bc894fc6c9d32b1a0c84812c66fb5133484eff4
[ "MIT" ]
66
2019-11-11T15:33:12.000Z
2022-03-01T07:55:55.000Z
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! # This file is machine-generated by lib/unicore/mktables from the Unicode # database, Version 13.0.0. Any changes made here will be lost! # !!!!!!! INTERNAL PERL USE ONLY !!!!!!! # This file is for internal use by core Perl only. The format and even the # name or existence of this file are subject to change without notice. Don't # use it directly. Use Unicode::UCD to access the Unicode character data # base. return <<'END'; V1098 0 888 890 895 900 907 908 909 910 930 931 1320 1329 1367 1369 1376 1377 1416 1417 1419 1423 1424 1425 1480 1488 1515 1520 1525 1536 1541 1542 1565 1566 1806 1807 1867 1869 1970 1984 2043 2048 2094 2096 2111 2112 2140 2142 2143 2208 2209 2210 2221 2276 2303 2304 2424 2425 2432 2433 2436 2437 2445 2447 2449 2451 2473 2474 2481 2482 2483 2486 2490 2492 2501 2503 2505 2507 2511 2519 2520 2524 2526 2527 2532 2534 2556 2561 2564 2565 2571 2575 2577 2579 2601 2602 2609 2610 2612 2613 2615 2616 2618 2620 2621 2622 2627 2631 2633 2635 2638 2641 2642 2649 2653 2654 2655 2662 2678 2689 2692 2693 2702 2703 2706 2707 2729 2730 2737 2738 2740 2741 2746 2748 2758 2759 2762 2763 2766 2768 2769 2784 2788 2790 2802 2817 2820 2821 2829 2831 2833 2835 2857 2858 2865 2866 2868 2869 2874 2876 2885 2887 2889 2891 2894 2902 2904 2908 2910 2911 2916 2918 2936 2946 2948 2949 2955 2958 2961 2962 2966 2969 2971 2972 2973 2974 2976 2979 2981 2984 2987 2990 3002 3006 3011 3014 3017 3018 3022 3024 3025 3031 3032 3046 3067 3073 3076 3077 3085 3086 3089 3090 3113 3114 3124 3125 3130 3133 3141 3142 3145 3146 3150 3157 3159 3160 3162 3168 3172 3174 3184 3192 3200 3202 3204 3205 3213 3214 3217 3218 3241 3242 3252 3253 3258 3260 3269 3270 3273 3274 3278 3285 3287 3294 3295 3296 3300 3302 3312 3313 3315 3330 3332 3333 3341 3342 3345 3346 3387 3389 3397 3398 3401 3402 3407 3415 3416 3424 3428 3430 3446 3449 3456 3458 3460 3461 3479 3482 3506 3507 3516 3517 3518 3520 3527 3530 3531 3535 3541 3542 3543 3544 3552 3570 3573 3585 3643 3647 3676 3713 3715 3716 3717 3719 3721 3722 3723 3725 3726 3732 3736 3737 3744 3745 3748 3749 3750 3751 3752 3754 3756 3757 3770 3771 3774 3776 3781 3782 3783 3784 3790 3792 3802 3804 3808 3840 3912 3913 3949 3953 3992 3993 4029 4030 4045 4046 4059 4096 4294 4295 4296 4301 4302 4304 4681 4682 4686 4688 4695 4696 4697 4698 4702 4704 4745 4746 4750 4752 4785 4786 4790 4792 4799 4800 4801 4802 4806 4808 4823 4824 4881 4882 4886 4888 4955 4957 4989 4992 5018 5024 5109 5120 5789 5792 5873 5888 5901 5902 5909 5920 5943 5952 5972 5984 5997 5998 6001 6002 6004 6016 6110 6112 6122 6128 6138 6144 6159 6160 6170 6176 6264 6272 6315 6320 6390 6400 6429 6432 6444 6448 6460 6464 6465 6468 6510 6512 6517 6528 6572 6576 6602 6608 6619 6622 6684 6686 6751 6752 6781 6783 6794 6800 6810 6816 6830 6912 6988 6992 7037 7040 7156 7164 7224 7227 7242 7245 7296 7360 7368 7376 7415 7424 7655 7676 7958 7960 7966 7968 8006 8008 8014 8016 8024 8025 8026 8027 8028 8029 8030 8031 8062 8064 8117 8118 8133 8134 8148 8150 8156 8157 8176 8178 8181 8182 8191 8192 8293 8294 8306 8308 8335 8336 8349 8352 8379 8400 8433 8448 8586 8592 9204 9216 9255 9280 9291 9312 9984 9985 11085 11088 11098 11264 11311 11312 11359 11360 11508 11513 11558 11559 11560 11565 11566 11568 11624 11631 11633 11647 11671 11680 11687 11688 11695 11696 11703 11704 11711 11712 11719 11720 11727 11728 11735 11736 11743 11744 11836 11904 11930 11931 12020 12032 12246 12272 12284 12288 12352 12353 12439 12441 12544 12549 12590 12593 12687 12688 12731 12736 12772 12784 12831 12832 13055 13056 19894 19904 40909 40960 42125 42128 42183 42192 42540 42560 42648 42655 42744 42752 42895 42896 42900 42912 42923 43000 43052 43056 43066 43072 43128 43136 43205 43214 43226 43232 43260 43264 43348 43359 43389 43392 43470 43471 43482 43486 43488 43520 43575 43584 43598 43600 43610 43612 43644 43648 43715 43739 43767 43777 43783 43785 43791 43793 43799 43808 43815 43816 43823 43968 44014 44016 44026 44032 55204 55216 55239 55243 55292 55296 64110 64112 64218 64256 64263 64275 64280 64285 64311 64312 64317 64318 64319 64320 64322 64323 64325 64326 64450 64467 64832 64848 64912 64914 64968 64976 65022 65024 65050 65056 65063 65072 65107 65108 65127 65128 65132 65136 65141 65142 65277 65279 65280 65281 65471 65474 65480 65482 65488 65490 65496 65498 65501 65504 65511 65512 65519 65529 65548 65549 65575 65576 65595 65596 65598 65599 65614 65616 65630 65664 65787 65792 65795 65799 65844 65847 65931 65936 65948 66000 66046 66176 66205 66208 66257 66304 66335 66336 66340 66352 66379 66432 66462 66463 66500 66504 66518 66560 66718 66720 66730 67584 67590 67592 67593 67594 67638 67639 67641 67644 67645 67647 67670 67671 67680 67840 67868 67871 67898 67903 67904 67968 68024 68030 68032 68096 68100 68101 68103 68108 68116 68117 68120 68121 68148 68152 68155 68159 68168 68176 68185 68192 68224 68352 68406 68409 68438 68440 68467 68472 68480 68608 68681 69216 69247 69632 69710 69714 69744 69760 69826 69840 69865 69872 69882 69888 69941 69942 69956 70016 70089 70096 70106 71296 71352 71360 71370 73728 74607 74752 74851 74864 74868 77824 78895 92160 92729 93952 94021 94032 94079 94095 94112 110592 110594 118784 119030 119040 119079 119081 119262 119296 119366 119552 119639 119648 119666 119808 119893 119894 119965 119966 119968 119970 119971 119973 119975 119977 119981 119982 119994 119995 119996 119997 120004 120005 120070 120071 120075 120077 120085 120086 120093 120094 120122 120123 120127 120128 120133 120134 120135 120138 120145 120146 120486 120488 120780 120782 120832 126464 126468 126469 126496 126497 126499 126500 126501 126503 126504 126505 126515 126516 126520 126521 126522 126523 126524 126530 126531 126535 126536 126537 126538 126539 126540 126541 126544 126545 126547 126548 126549 126551 126552 126553 126554 126555 126556 126557 126558 126559 126560 126561 126563 126564 126565 126567 126571 126572 126579 126580 126584 126585 126589 126590 126591 126592 126602 126603 126620 126625 126628 126629 126634 126635 126652 126704 126706 126976 127020 127024 127124 127136 127151 127153 127167 127169 127184 127185 127200 127232 127243 127248 127279 127280 127340 127344 127387 127462 127491 127504 127547 127552 127561 127568 127570 127744 127777 127792 127798 127799 127869 127872 127892 127904 127941 127942 127947 127968 127985 128000 128063 128064 128065 128066 128248 128249 128253 128256 128318 128320 128324 128336 128360 128507 128577 128581 128592 128640 128710 128768 128884 131070 173783 173824 177973 177984 178206 194560 195102 196606 196608 262142 262144 327678 327680 393214 393216 458750 458752 524286 524288 589822 589824 655358 655360 720894 720896 786430 786432 851966 851968 917502 917504 917505 917506 917536 917632 917760 918000 983038 1114112 END
6.073675
77
0.814645
ed2a905f3a7cada98b2c6ee67c4ee68a7137a836
11,220
pm
Perl
lib/LANraragi/Utils/Archive.pm
Difegue/LANraragi
6c1b241d99d90cba669c89df9ca99b3ad4a5bfa4
[ "MIT" ]
806
2016-07-03T19:51:49.000Z
2022-03-31T17:40:27.000Z
lib/LANraragi/Utils/Archive.pm
Difegue/LANraragi
6c1b241d99d90cba669c89df9ca99b3ad4a5bfa4
[ "MIT" ]
414
2017-12-09T21:02:23.000Z
2022-03-24T20:35:07.000Z
lib/LANraragi/Utils/Archive.pm
Difegue/LANraragi
6c1b241d99d90cba669c89df9ca99b3ad4a5bfa4
[ "MIT" ]
120
2018-07-30T02:08:41.000Z
2022-03-31T16:45:18.000Z
package LANraragi::Utils::Archive; use strict; use warnings; use utf8; use feature qw(say); use Time::HiRes qw(gettimeofday); use File::Basename; use File::Path qw(remove_tree make_path); use File::Find qw(finddepth); use File::Copy qw(move); use Encode; use Encode::Guess qw/euc-jp shiftjis 7bit-jis/; use Redis; use Cwd; use Data::Dumper; use Image::Magick; use Archive::Libarchive qw( ARCHIVE_OK ); use Archive::Libarchive::Extract; use Archive::Libarchive::Peek; use File::Temp qw(tempfile tempdir); use LANraragi::Utils::TempFolder qw(get_temp); use LANraragi::Utils::Logging qw(get_logger); use LANraragi::Utils::Generic qw(is_image shasum); # Utilitary functions for handling Archives. # Relies on Libarchive, ImageMagick and GhostScript for PDFs. use Exporter 'import'; our @EXPORT_OK = qw(is_file_in_archive extract_file_from_archive extract_single_file extract_archive extract_thumbnail generate_thumbnail get_filelist); sub is_pdf { my ( $filename, $dirs, $suffix ) = fileparse( $_[0], qr/\.[^.]*/ ); return ( $suffix eq ".pdf" ); } # generate_thumbnail(original_image, thumbnail_location) # use ImageMagick to make a thumbnail, height = 500px (view in index is 280px tall) sub generate_thumbnail { my ( $orig_path, $thumb_path ) = @_; my $img = Image::Magick->new; # If the image is a gif, only take the first frame if ( $orig_path =~ /\.gif$/ ) { $img->Read( $orig_path . "[0]" ); } else { $img->Read($orig_path); } $img->Thumbnail( geometry => '500x1000' ); $img->Set( quality => "50", magick => "jpg" ); $img->Write($thumb_path); undef $img; } # extract_archive(path, archive_to_extract, force) # Extract the given archive to the given path. # This sub won't re-extract files already present in the destination unless force = 1. sub extract_archive { my ( $destination, $to_extract, $force_extract ) = @_; my $logger = get_logger( "Archive", "lanraragi" ); $logger->debug("Fully extracting archive $to_extract"); # PDFs are handled by Ghostscript (alas) if ( is_pdf($to_extract) ) { return extract_pdf( $destination, $to_extract ); } # Prepare libarchive with a callback to skip over existing files (unless force=1) my $ae = Archive::Libarchive::Extract->new( filename => $to_extract, entry => sub { my $e = shift; if ($force_extract) { return 1; } my $filename = $e->pathname; if ( -e "$destination/$filename" ) { $logger->debug("$filename already exists in $destination"); return 0; } $logger->debug("Extracting $filename"); # Pre-emptively create the file to signal we're working on it open( my $fh, ">", "$destination/$filename" ) or $logger->error("Couldn't create placeholder file $destination/$filename (might be a folder?), moving on nonetheless"); close $fh; return 1; } ); # Extract to $destination. This method throws if extraction fails. $ae->extract( to => $destination ); # Get extraction folder my $result_dir = $ae->to; my $cwd = getcwd(); # chdir back to the base cwd in case finddepth died midway chdir $cwd; # Return the directory we extracted the files to. return $result_dir; } sub extract_pdf { my ( $destination, $to_extract ) = @_; my $logger = get_logger( "Archive", "lanraragi" ); # Raw Perl strings won't necessarily work in a terminal command, so we must decode the filepath here $logger->debug("Decoding PDF filepath $to_extract before sending it to GhostScript"); eval { # Try a guess to regular japanese encodings first $to_extract = decode( "Guess", $to_extract ); }; # Fallback to utf8 $to_extract = decode_utf8($to_extract) if $@; make_path($destination); my $gscmd = "gs -dNOPAUSE -sDEVICE=jpeg -r200 -o '$destination/\%d.jpg' '$to_extract'"; $logger->debug("Sending PDF $to_extract to GhostScript..."); $logger->debug($gscmd); `$gscmd`; return $destination; } # extract_thumbnail(thumbnaildir, id, page) # Extracts a thumbnail from the specified archive ID and page. Returns the path to the thumbnail. # Non-cover thumbnails land in a folder named after the ID. Specify page=0 if you want the cover. sub extract_thumbnail { my ( $thumbdir, $id, $page ) = @_; my $logger = get_logger( "Archive", "lanraragi" ); # Another subfolder with the first two characters of the id is used for FS optimization. my $subfolder = substr( $id, 0, 2 ); my $thumbname = "$thumbdir/$subfolder/$id.jpg"; make_path("$thumbdir/$subfolder"); my $redis = LANraragi::Model::Config->get_redis; my $file = $redis->hget( $id, "file" ); my $temppath = tempdir(); # Get first image from archive using filelist my ( $images, $sizes ) = get_filelist($file); # Dereference arrays my @filelist = @$images; my $requested_image = $filelist[ $page > 0 ? $page - 1 : 0 ]; die "Requested image not found" unless $requested_image; $logger->debug("Extracting thumbnail for $id page $page from $requested_image"); # Extract first image to temp dir my $arcimg = extract_single_file( $file, $requested_image, $temppath ); if ( $page > 0 ) { # Non-cover thumbnails land in a dedicated folder. $thumbname = "$thumbdir/$subfolder/$id/$page.jpg"; make_path("$thumbdir/$subfolder/$id"); } else { # For cover thumbnails, grab the SHA-1 hash for tag research. # That way, no need to repeat a costly extraction later. my $shasum = shasum( $arcimg, 1 ); $redis->hset( $id, "thumbhash", $shasum ); $redis->quit(); } # Thumbnail generation generate_thumbnail( $arcimg, $thumbname ); # Clean up safe folder remove_tree($temppath); return $thumbname; } #magical sort function used below sub expand { my $file = shift; $file =~ s{(\d+)}{sprintf "%04d", $1}eg; return $file; } # get_filelist($archive) # Returns a list of all the files contained in the given archive. sub get_filelist { my $archive = $_[0]; my @files = (); my @sizes = (); if ( is_pdf($archive) ) { # For pdfs, extraction returns images from 1.jpg to x.jpg, where x is the pdf pagecount. # Using -dNOSAFER or --permit-file-read is required since GS 9.50, see https://github.com/doxygen/doxygen/issues/7290 my $pages = `gs -q -dNOSAFER -c "($archive) (r) file runpdfbegin pdfpagecount = quit"`; for my $num ( 1 .. $pages ) { push @files, "$num.jpg"; push @sizes, 0; } } else { my $r = Archive::Libarchive::ArchiveRead->new; $r->support_filter_all; $r->support_format_all; my $ret = $r->open_filename( $archive, 10240 ); die unless ( $ret == ARCHIVE_OK ); my $e = Archive::Libarchive::Entry->new; while ( $r->next_header($e) == ARCHIVE_OK ) { my $filesize = ( $e->size_is_set eq 64 ) ? $e->size : 0; my $filename = $e->pathname; if ( is_image($filename) ) { push @files, $filename; push @sizes, $filesize; } $r->read_data_skip; } } # TODO: @images = nsort(@images); would theorically be better, but Sort::Naturally's nsort puts letters before numbers, # which isn't what we want at all for pages in an archive. # To investigate further, perhaps with custom sorting algorithms? @files = sort { &expand($a) cmp &expand($b) } @files; # Return files and sizes in a hashref return ( \@files, \@sizes ); } # is_file_in_archive($archive, $file) # Uses libarchive::peek to figure out if $archive contains $file. # Returns the exact in-archive path of the file if it exists, undef otherwise. sub is_file_in_archive { my ( $archive, $wantedname ) = @_; my $logger = get_logger( "Archive", "lanraragi" ); if ( is_pdf($archive) ) { $logger->debug("$archive is a pdf, no sense looking for specific files"); return; } $logger->debug("Iterating files of archive $archive, looking for '$wantedname'"); $Data::Dumper::Useqq = 1; my $peek = Archive::Libarchive::Peek->new( filename => $archive ); my $found; my @files = $peek->files; for my $file (@files) { $logger->debug( "Found file " . Dumper($file) ); my ( $name, $path, $suffix ) = fileparse( $file, qr/\.[^.]*/ ); # If the end of the file contains $wantedname we're good if ( "$name$suffix" =~ /$wantedname$/ ) { $logger->debug("OK!"); $found = $file; last; } } return $found; } # extract_single_file ($archive, $file, $destination) # Extract $file from $archive to $destination and returns the filesystem path it's extracted to. # If the file doesn't exist in the archive, this will still create a file, but empty. sub extract_single_file { my ( $archive, $filepath, $destination ) = @_; my $logger = get_logger( "Archive", "lanraragi" ); my $outfile = "$destination/$filepath"; $logger->debug("Output for single file extraction: $outfile"); # Remove file from $outfile and hand the full directory to make_path my ( $name, $path, $suffix ) = fileparse( $outfile, qr/\.[^.]*/ ); make_path($path); if ( is_pdf($archive) ) { # For pdfs the filenames are always x.jpg, so we pull the page number from that my $page = $filepath; $page =~ s/^(\d+).jpg$/$1/; my $gscmd = "gs -dNOPAUSE -dFirstPage=$page -dLastPage=$page -sDEVICE=jpeg -r200 -o '$outfile' '$archive'"; $logger->debug("Extracting page $filepath from PDF $archive"); $logger->debug($gscmd); `$gscmd`; } else { my $contents = ""; my $peek = Archive::Libarchive::Peek->new( filename => $archive ); my @files = $peek->files; for my $name (@files) { my $decoded_name = LANraragi::Utils::Database::redis_decode($name); # This sub can receive either encoded or raw filenames, so we have to test for both. if ( $decoded_name eq $filepath || $name eq $filepath ) { $logger->debug("Found file $filepath in archive $archive"); $contents = $peek->file($name); last; } } open( my $fh, '>', $outfile ) or die "Could not open file '$outfile' $!"; print $fh $contents; close $fh; } return $outfile; } # extract_file_from_archive($archive, $file) # Variant for plugins. # Extracts the file with a timestamp to a folder in /temp/plugin. sub extract_file_from_archive { my ( $archive, $filename ) = @_; # Timestamp extractions in microseconds my ( $seconds, $microseconds ) = gettimeofday; my $stamp = "$seconds-$microseconds"; my $path = get_temp . "/plugin/$stamp"; mkdir get_temp . "/plugin"; mkdir $path; return extract_single_file( $archive, $filename, $path ); } 1;
32.057143
137
0.615597
ed0532938100679df77cbc709fd90da35c3eb4d0
465
pm
Perl
lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm
exodist/Moose
fadfec9e315aa33fb22c96982704c8c0d15e84c6
[ "Artistic-1.0" ]
null
null
null
lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm
exodist/Moose
fadfec9e315aa33fb22c96982704c8c0d15e84c6
[ "Artistic-1.0" ]
null
null
null
lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm
exodist/Moose
fadfec9e315aa33fb22c96982704c8c0d15e84c6
[ "Artistic-1.0" ]
null
null
null
package Moose::Exception::EnumCalledWithAnArrayRefAndAdditionalArgs; our $VERSION = '2.1605'; use Moose; extends 'Moose::Exception'; has 'array' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); sub _build_message { "enum called with an array reference and additional arguments. Did you mean to parenthesize the enum call's parameters?"; } 1;
19.375
125
0.612903
ed1ceeef7d517f61dc76b3acf966090467ec04e0
1,028
t
Perl
test/blackbox-tests/test-cases/default-implementation/package-mismatch1.t/run.t
mndrix/dune
30b84ff370351b13f05db34fd952dfe5d0249bcb
[ "MIT" ]
245
2016-12-02T14:13:32.000Z
2018-01-14T20:00:40.000Z
test/blackbox-tests/test-cases/default-implementation/package-mismatch1.t/run.t
mndrix/dune
30b84ff370351b13f05db34fd952dfe5d0249bcb
[ "MIT" ]
380
2017-01-28T18:46:52.000Z
2018-01-17T13:34:51.000Z
test/blackbox-tests/test-cases/default-implementation/package-mismatch1.t/run.t
mndrix/dune
30b84ff370351b13f05db34fd952dfe5d0249bcb
[ "MIT" ]
59
2016-12-02T13:58:19.000Z
2018-01-06T18:23:02.000Z
A default implementation of a library must belong to the same package $ echo "(lang dune 2.6)" > dune-project $ touch dummyfoo1.opam $ touch dummyfoo2.opam $ mkdir vlib impl $ touch vlib/vlib.mli impl/vlib.ml $ cat >vlib/dune <<EOF > (library > (name vlib) > (modules vlib) > (public_name dummyfoo1.bar) > (virtual_modules vlib) > (default_implementation def_i)) > EOF $ cat >impl/dune <<EOF > (library > (name def_i) > (public_name dummyfoo2.bar) > (implements dummyfoo1.bar)) > EOF $ dune build @install File "vlib/dune", line 6, characters 25-30: 6 | (default_implementation def_i)) ^^^^^ Error: default implementation belongs to package dummyfoo2 while virtual library belongs to package dummyfoo1. This is impossible. -> required by _build/default/vlib/.vlib.objs/byte/vlib.cmi -> required by _build/install/default/lib/dummyfoo1/bar/vlib.cmi -> required by _build/default/dummyfoo1.install -> required by alias install [1]
31.151515
74
0.675097
ed152ec7dee5993bfa912cf60a95d38436253327
3,464
pm
Perl
CSN.pm
ima23/VEP_plugins
8151a31a27d02d9baa4ecaa828f93cc3b9676422
[ "Apache-2.0" ]
null
null
null
CSN.pm
ima23/VEP_plugins
8151a31a27d02d9baa4ecaa828f93cc3b9676422
[ "Apache-2.0" ]
null
null
null
CSN.pm
ima23/VEP_plugins
8151a31a27d02d9baa4ecaa828f93cc3b9676422
[ "Apache-2.0" ]
null
null
null
=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 Ensembl <http://www.ensembl.org/info/about/contact/index.html> =cut =head1 NAME CSN =head1 SYNOPSIS mv CSN.pm ~/.vep/Plugins ./vep -i variations.vcf --cache --plugin CSN =head1 DESCRIPTION This is a plugin for the Ensembl Variant Effect Predictor (VEP) that reports Clinical Sequencing Nomenclature (CSN) for variants. Each notation is given with reference to the transcript identifier; specify "--plugin CSN,1" to remove this identifier from the CSN string. You may also wish to specify "--no_escape" to prevent the "=" in "p.=" notations being converted to the URI-escaped equivalent "p.%3D"; doing so may break parsers looking for "=" as a KEY=VALUE separator. See http://biorxiv.org/content/early/2015/03/21/016808.1 =cut package CSN; use strict; use warnings; use Bio::EnsEMBL::Variation::Utils::BaseVepPlugin; use Bio::EnsEMBL::Variation::DBSQL::TranscriptVariationAdaptor; use Bio::EnsEMBL::Variation::DBSQL::DBAdaptor; use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepPlugin); sub new { my $class = shift; my $self = $class->SUPER::new(@_); # check config is OK # FASTA file defined, optimal if(!defined($self->{config}->{fasta})) { # offline mode won't work without FASTA die("ERROR: Cannot generate CSN without either a FASTA file (--fasta) or a database connection (--cache or --database)\n") if defined($self->{config}->{offline}) and !defined($self->{config}->{quiet}); # cache mode will work, but DB will be accessed warn("WARNING: Database will be accessed using this plugin; use a FASTA file (--fasta) for optimal performance") if defined($self->{config}->{cache}) and !defined($self->{config}->{quiet}); } no warnings 'once'; $Bio::EnsEMBL::Variation::DBSQL::TranscriptVariationAdaptor::DEFAULT_SHIFT_HGVS_VARIANTS_3PRIME = 1; no warnings 'once'; $Bio::EnsEMBL::Variation::DBSQL::DBAdaptor::DEFAULT_SHIFT_HGVS_VARIANTS_3PRIME = 1; $self->{remove_transcript_ID} = $self->params->[0]; return $self; } sub feature_types { return ['Transcript']; } sub variant_feature_types { return ['VariationFeature']; } sub get_header_info { return { CSN => 'Clinical Sequencing Nomenclature'}; } sub run { my ($self, $tva) = @_; my ($hgvs_c, $hgvs_p) = ($tva->hgvs_transcript || '', $tva->hgvs_protein || ''); return {} unless $hgvs_c; # trim off transcript/protein ID $hgvs_c =~ s/.+\:// if $self->{remove_transcript_ID}; $hgvs_p =~ s/.+\://; # change Ter to X $hgvs_p =~ s/Ter/X/g; # leave just p.= $hgvs_p = 'p.=' if $hgvs_p =~ /p\.\=/; # escape $hgvs_p =~ s/\=/\%3D/g unless $self->{config}->{no_escape}; return { CSN => $hgvs_c.($hgvs_p ? '_'.$hgvs_p : '') }; } 1;
28.162602
205
0.696016
73d15e6b3f67f9eafe296ea46a2827cf62dc7a10
265
t
Perl
gnu/usr.bin/perl/dist/base/t/version.t
ArrogantWombatics/openbsd-src
75721e1d44322953075b7c4b89337b163a395291
[ "BSD-3-Clause" ]
2
2018-06-15T08:32:44.000Z
2019-01-12T03:20:41.000Z
openresty-win32-build/thirdparty/perl5-5.29.6/dist/base/t/version.t
nneesshh/openresty-win32-build
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
[ "MIT" ]
1
2018-08-21T03:56:33.000Z
2018-08-21T03:56:33.000Z
openresty-win32-build/thirdparty/perl5-5.29.6/dist/base/t/version.t
nneesshh/openresty-win32-build
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
[ "MIT" ]
null
null
null
#!/usr/bin/perl -w use strict; use Test::More tests => 1; # Here we emulate a bug with base.pm not finding the Exporter version # for some reason. use lib qw(t/lib); use base qw(Dummy); is( $Dummy::VERSION, 5.562, "base.pm doesn't confuse the version" );
20.384615
74
0.671698
73d89f43d30994aa191887c5535fdf73a8026c41
190
pl
Perl
Day-4/4-lower-to-upper.pl
Akash-manna/IT-701
34e9e63097705d02f43c38f428e3d2d213d066ba
[ "MIT" ]
null
null
null
Day-4/4-lower-to-upper.pl
Akash-manna/IT-701
34e9e63097705d02f43c38f428e3d2d213d066ba
[ "MIT" ]
1
2018-10-03T15:49:54.000Z
2018-10-03T15:49:54.000Z
Day-4/4-lower-to-upper.pl
Akash-manna/IT-701
34e9e63097705d02f43c38f428e3d2d213d066ba
[ "MIT" ]
null
null
null
#!/usr/bin/perl #Day-4|Question-4: Write a perl script to convert all lowercase letters to uppercase print "Enter the lowercase word: "; my $lower = <>; $upper = uc($lower); print $upper;
21.111111
84
0.7
ed217732144e4acb3fb64480bbe6f1f2b89cecc4
176
t
Perl
t/00-load.t
gitpan/Postfix-ContentFilter
4978217be2f64b583fdabd184ebce1684e0e7bea
[ "ISC" ]
null
null
null
t/00-load.t
gitpan/Postfix-ContentFilter
4978217be2f64b583fdabd184ebce1684e0e7bea
[ "ISC" ]
null
null
null
t/00-load.t
gitpan/Postfix-ContentFilter
4978217be2f64b583fdabd184ebce1684e0e7bea
[ "ISC" ]
1
2021-06-19T11:51:01.000Z
2021-06-19T11:51:01.000Z
#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'Postfix::ContentFilter' ); } diag( "Testing Postfix::ContentFilter $Postfix::ContentFilter::VERSION, Perl $], $^X" );
17.6
88
0.659091
73d5adb134225efac9e3a8a15e143870358b5f2e
857
pl
Perl
extensions/vscode-colorize-tests/test/colorize-fixtures/test.pl
elegantShock2258/UwUcode
ea238c0d96254eed673571e056603fe0c8d60c3d
[ "OML", "RSA-MD" ]
5
2021-09-23T08:47:23.000Z
2021-09-28T16:40:54.000Z
extensions/vscode-colorize-tests/test/colorize-fixtures/test.pl
elegantShock2258/UwUcode
ea238c0d96254eed673571e056603fe0c8d60c3d
[ "OML", "RSA-MD" ]
null
null
null
extensions/vscode-colorize-tests/test/colorize-fixtures/test.pl
elegantShock2258/UwUcode
ea238c0d96254eed673571e056603fe0c8d60c3d
[ "OML", "RSA-MD" ]
null
null
null
use stwict; my $badfound = 0; sub check_wine { my($fn, $wine) = @_; # Check fow that =. if($wine =~ /^\s*if\s*\(.*[^!<>=]=([^=].*\)|\))/) { if(!$badfound) { pwint("The fowwowing suspicious wines wewe found:\n"); $badfound = 1; } pwint "$fn:$.: $wine\n"; } } # # This function opens and weads one fiwe, and cawws # check_wine to anawyze each wine. Caww it with the # fiwe name. # sub check_fiwe { my($fn) = @_; if(!open(IN, $fn)) { pwint "Cannot wead $fn.\n"; wetuwn; } my($wine); whiwe($wine = <IN>) { chomp $wine; check_wine($fn,$wine); } cwose IN; } # # Go thwough the awgument wist and check each fiwe # whiwe(my $fn = shift @AWGV) { check_fiwe($fn); } if(!$badfound) { pwint "No suspicious wines wewe found.\n"; }
18.630435
66
0.511085
ed1ddb6b60cb4ca19819ca3a321166432b667bfc
1,968
pl
Perl
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
tsos7/postgres
f2690338814738967d75cc1e35cc1cfac1a40710
[ "PostgreSQL" ]
3,702
2019-09-17T13:49:56.000Z
2022-03-31T21:50:59.000Z
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
tsos7/postgres
f2690338814738967d75cc1e35cc1cfac1a40710
[ "PostgreSQL" ]
9,291
2019-09-16T21:47:07.000Z
2022-03-31T23:52:28.000Z
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
tsos7/postgres
f2690338814738967d75cc1e35cc1cfac1a40710
[ "PostgreSQL" ]
673
2019-09-16T21:27:53.000Z
2022-03-31T22:23:59.000Z
# # Test pg_rewind when the target's pg_wal directory is a symlink. # use strict; use warnings; use File::Copy; use File::Path qw(rmtree); use TestLib; use Test::More; if ($windows_os) { plan skip_all => 'symlinks not supported on Windows'; exit; } else { plan tests => 4; } use FindBin; use lib $FindBin::RealBin; use RewindTest; sub run_test { my $test_mode = shift; my $master_xlogdir = "${TestLib::tmp_check}/xlog_master"; rmtree($master_xlogdir); RewindTest::setup_cluster($test_mode); my $test_master_datadir = $node_master->data_dir; # turn pg_wal into a symlink print("moving $test_master_datadir/pg_wal to $master_xlogdir\n"); move("$test_master_datadir/pg_wal", $master_xlogdir) or die; symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die; RewindTest::start_master(); # Create a test table and insert a row in master. master_psql("CREATE TABLE tbl1 (d text)"); master_psql("INSERT INTO tbl1 VALUES ('in master')"); master_psql("CHECKPOINT"); RewindTest::create_standby($test_mode); # Insert additional data on master that will be replicated to standby master_psql("INSERT INTO tbl1 values ('in master, before promotion')"); master_psql('CHECKPOINT'); RewindTest::promote_standby(); # Insert a row in the old master. This causes the master and standby # to have "diverged", it's no longer possible to just apply the # standy's logs over master directory - you need to rewind. master_psql("INSERT INTO tbl1 VALUES ('in master, after promotion')"); # Also insert a new row in the standby, which won't be present in the # old master. standby_psql("INSERT INTO tbl1 VALUES ('in standby, after promotion')"); RewindTest::run_pg_rewind($test_mode); check_query( 'SELECT * FROM tbl1', qq(in master in master, before promotion in standby, after promotion ), 'table content'); RewindTest::clean_rewind_test(); return; } # Run the test in both modes run_test('local'); run_test('remote'); exit(0);
22.883721
73
0.730691
ed125406b5fea956e15b95efbd8f47a32448a1bf
3,842
pm
Perl
src/karma.pm
tune-it/jbot
237e7c8da9fac1e9c22de041d67d3c84b8a45843
[ "BSD-2-Clause" ]
10
2016-01-09T21:43:34.000Z
2017-12-15T00:09:24.000Z
src/karma.pm
tune-it/jbot
237e7c8da9fac1e9c22de041d67d3c84b8a45843
[ "BSD-2-Clause" ]
39
2016-01-10T00:54:53.000Z
2017-09-05T18:50:52.000Z
src/karma.pm
tune-it/jbot
237e7c8da9fac1e9c22de041d67d3c84b8a45843
[ "BSD-2-Clause" ]
4
2016-11-22T00:08:47.000Z
2017-08-23T11:13:02.000Z
#!/usr/bin/perl # made by: KorG use strict; use v5.18; use warnings; no warnings 'experimental'; use utf8; binmode STDOUT, ':utf8'; package karma; use File::Copy; use DB_File; use Encode qw;encode decode is_utf8;; my $karmafile = '/tmp/karma'; my %karma_db = (); my $karma_fh; my $reject_time = 7; my $last_like_max = 3; my %last_like; my $initialized = 0; # arg: self sub backup_karma($) { return unless $initialized; $karma_fh->sync() == 0 or die "karma sync != 0"; if (keys %karma_db > 0) { copy "$karmafile.db", "$karmafile.bak" or die $!; } print "Karma backed up to: $karmafile.bak\n"; } # arg: self sub shut_down($) { return unless $initialized; # just in case # Perl Core Modules, I do really believe in you, but... $karma_fh->sync() == 0 or die "karma sync != 0"; undef $karma_fh; untie %karma_db; } # arg: self cfg_file karma_file sub new($$;$) { my $self = shift; my $config_file = shift // die 'No karma config specified'; my $arg_file = shift; our %cfg; unless (my $rc = do $config_file) { warn "couldn't parse $config_file: $@" if $@; warn "couldn't do $config_file: $!" unless defined $rc; warn "couldn't run $config_file" unless $rc; } $karmafile = $cfg{karmafile} if defined $cfg{karmafile}; $karmafile = $arg_file if defined $arg_file; $last_like_max = $cfg{last_like_max} if defined $cfg{last_like_max}; $reject_time = $cfg{karma_reject_time} if defined $cfg{karma_reject_time}; $karma_fh = tie ( %karma_db, "DB_File", "$karmafile.db", O_CREAT | O_RDWR, 0666, $DB_BTREE ) or die $!; say "Karma records: " . keys %karma_db if scalar keys %karma_db; $initialized = 1; return bless {}, $self; } # arg: self top_count sub get_top($$) { my $top = ''; my $self = shift; my $topN = shift // 10; $topN = 10 if $topN eq "" || $topN < 1 || $topN > 25; $topN = keys %karma_db if $topN > keys %karma_db; $top .= "$_($karma_db{$_}), " for ( sort {$karma_db{$b} <=> $karma_db{$a}} keys %karma_db )[0..$topN-1]; $top =~ s/, $//; $top = decode('utf-8', $top) unless is_utf8($top); return $top; } # internal function # arg: src dst sub allowed_like { my ($src, $dst) = @_; return 0 unless defined $dst; $src = lc $src; $dst = lc $dst; # needs to be cleverer if (exists $last_like{$src}) { for (keys %{ $last_like{$src} }) { delete $last_like{$src}->{$_} if ( time - $last_like{$src}->{$_} > $reject_time ); } if ($last_like_max <= keys %{ $last_like{$src} }) { return 0; } else { my $rc = ! defined $last_like{$src}->{$dst}; $last_like{$src}->{$dst} = time; return $rc; } } else { $last_like{$src}->{$dst} = time; return 1; } return 0; # just because } # arg: self src dst sub get_karma($$;$) { my $self = shift; my $src = shift // return -1; my $dst = shift // $src; my $karma = $karma_db{encode 'utf-8', lc $dst} ||= 0; return "твоя карма: $karma" if $src eq $dst; return "карма $dst $karma"; } # arg: self src dst sub inc_karma($$$) { my $self = shift; my $src = shift; my $dst = shift // return -1; return "пффф" if $dst eq $src; # and memorize src -> dst return "нельзя изменять карму так часто!" unless allowed_like($src, $dst); my $rc = ++$karma_db{encode 'utf-8', lc $dst}; return "поднял карму $dst до $rc"; } # arg: self src dst sub dec_karma($$$) { my $self = shift; my $src = shift; my $dst = shift // return -1; return "пффф" if $dst eq $src; return "нельзя изменять карму так часто!" unless allowed_like($src, $dst); my $rc = --$karma_db{encode 'utf-8', lc $dst}; return "опустил карму $dst до $rc"; } 1;
21.58427
79
0.57444
ed1c5ce5da6d2c5ec429b049609c5cf5956d60ea
654
t
Perl
t/Catmandu/Bag/IdGenerator/Incremental.t
feldi-online/LibreCat
8704297793ca545d7cae185a9a36201d5e1ce182
[ "Artistic-1.0" ]
null
null
null
t/Catmandu/Bag/IdGenerator/Incremental.t
feldi-online/LibreCat
8704297793ca545d7cae185a9a36201d5e1ce182
[ "Artistic-1.0" ]
null
null
null
t/Catmandu/Bag/IdGenerator/Incremental.t
feldi-online/LibreCat
8704297793ca545d7cae185a9a36201d5e1ce182
[ "Artistic-1.0" ]
null
null
null
use strict; use warnings FATAL => "all"; use Catmandu; use Test::More; my $pkg; BEGIN { $pkg = 'Catmandu::Bag::IdGenerator::Incremental'; use_ok $pkg; } require_ok $pkg; Catmandu->config->{store} = { id_test => { "package" => "Hash", options => { bags => { data => {id_generator => "Incremental"} } } } }; { my $expected = [1 .. 10]; my $generated = []; my $bag = Catmandu->store('id_test')->bag('data'); push @$generated, map {$bag->generate_id} @$expected; is_deeply $generated, $expected, "generated ids correct"; } done_testing;
18.166667
57
0.525994
73ebef83cc2e0cca2bc8b499cb51fc1fca3ddaf3
6,018
pm
Perl
modules/EnsEMBL/Web/ViewConfig/Gene/ComparaTree.pm
thibauthourlier/ensembl-webcode
8c5008f4cb44f4430f47acade2aad23dd81c7068
[ "Apache-2.0" ]
null
null
null
modules/EnsEMBL/Web/ViewConfig/Gene/ComparaTree.pm
thibauthourlier/ensembl-webcode
8c5008f4cb44f4430f47acade2aad23dd81c7068
[ "Apache-2.0" ]
null
null
null
modules/EnsEMBL/Web/ViewConfig/Gene/ComparaTree.pm
thibauthourlier/ensembl-webcode
8c5008f4cb44f4430f47acade2aad23dd81c7068
[ "Apache-2.0" ]
null
null
null
=head1 LICENSE Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut package EnsEMBL::Web::ViewConfig::Gene::ComparaTree; use strict; use warnings; use parent qw(EnsEMBL::Web::ViewConfig); sub _new { ## @override ## Code depends upon referer ## TODO use of hub->referer should go away my $self = shift->SUPER::_new(@_); $self->{'function'} = $self->hub->referer->{'ENSEMBL_FUNCTION'}; $self->{'code'} = join '::', 'Gene::ComparaTree', $self->{'function'} || (); return $self; } sub init_cacheable { ## @override my $self = shift; my $defaults = { 'collapsability' => 'gene', 'clusterset_id' => 'default', 'colouring' => 'background', 'exons' => 'on', 'super_tree' => 'off', }; # This config is stored in DEFAULTS.ini my $species_defs = $self->hub->species_defs; my @bg_col = @{ $species_defs->TAXON_GENETREE_BGCOLOUR }; my @fg_col = @{ $species_defs->TAXON_GENETREE_FGCOLOUR }; foreach my $name ( @{ $species_defs->TAXON_ORDER } ) { my $this_bg_col = shift @bg_col || 0; my $this_fg_col = shift @fg_col || 0; $defaults->{"group_${name}_bgcolour"} = $this_bg_col if $this_bg_col ne '0'; $defaults->{"group_${name}_fgcolour"} = $this_fg_col if $this_fg_col ne '0'; $defaults->{"group_${name}_display"} = 'default'; } $self->set_default_options($defaults); $self->image_config_type('genetreeview'); $self->title('Gene Tree'); } sub field_order { ## Abstract method implementation my $self = shift; return qw(collapsability clusterset_id exons super_tree colouring), map sprintf('group_%s_display', $_), $self->_groups; } sub form_fields { ## Abstract method implementation my $self = shift; my $fields = {}; my $function = $self->{'function'}; $fields->{'collapsability'} = { 'type' => 'dropdown', 'select' => 'select', 'name' => 'collapsability', 'label' => 'Display options for tree image', 'values' => [ { 'value' => 'gene', 'caption' => 'Show current gene only' }, { 'value' => 'paralogs', 'caption' => 'Show paralogs of current gene' }, { 'value' => 'duplications', 'caption' => 'Show all duplication nodes' }, { 'value' => 'all', 'caption' => 'Show fully expanded tree' } ], }; $fields->{'clusterset_id'} = { 'type' => 'dropdown', 'name' => 'clusterset_id', 'label' => 'Model used for the tree reconstruction', 'values' => [ { 'value' => 'default', 'caption' => 'Final (merged) tree' } ], # more values inserted by init_form_non_cacheable method }; $fields->{'exons'} = { 'type' => 'checkbox', 'label' => 'Show exon boundaries', 'name' => 'exons', 'value' => 'on', }; $fields->{'super_tree'} = { 'type' => 'checkbox', 'label' => 'Show super-tree', 'name' => 'super_tree', 'value' => 'on', } if(!$self->hub->param('strain') && !$self->hub->species_defs->IS_STRAIN_OF); #hide this for strain view or strain species my @groups = ($self->hub->param('strain') || $self->hub->species_defs->IS_STRAIN_OF) ? () : $self->_groups; #hide these options for strain view or strain species if (@groups) { my $taxon_labels = $self->hub->species_defs->TAXON_LABEL; $fields->{'colouring'} = { 'type' => 'dropdown', 'select' => 'select', 'name' => 'colouring', 'label' => 'Colour tree according to taxonomy', 'values' => [ { 'value' => 'none', 'caption' => 'No colouring' }, { 'value' => 'background', 'caption' => 'Background' }, { 'value' => 'foreground', 'caption' => 'Foreground' } ], }; foreach my $group (@groups) { $fields->{"group_${group}_display"} = { 'type' => 'dropdown', 'select' => 'select', 'name' => "group_${group}_display", 'label' => "Display options for ".($taxon_labels && $taxon_labels->{$group} || $group), 'values' => [ { 'value' => 'default', 'caption' => 'Default behaviour' }, { 'value' => 'hide', 'caption' => 'Hide genes' }, { 'value' => 'collapse', 'caption' => 'Collapse genes' } ], }; } } return $fields; } sub init_form_non_cacheable { ## @override my $self = shift; my $hub = $self->hub; my $form = $self->SUPER::init_form_non_cacheable(@_); my %other_clustersets; if($hub->param('g')) { my $function = $hub->referer->{'ENSEMBL_FUNCTION'}; my $cdb = $function && $function eq 'pan_compara' ? 'compara_pan_ensembl' : 'compara'; my $database = $hub->database($cdb); my $member = $database->get_GeneMemberAdaptor->fetch_by_stable_id($hub->core_params->{'g'}); my $adaptor = $database->get_GeneTreeAdaptor; my $gene_tree = $adaptor->fetch_default_for_Member($member); %other_clustersets = map { $_->clusterset_id => 1 } @{$adaptor->fetch_all_linked_trees($gene_tree)}; delete $other_clustersets{'default'}; } if (my $dropdown = $form->get_elements_by_name('clusterset_id')->[0]) { $dropdown->add_option({ 'value' => $_, 'caption' => $_ }) for sort keys %other_clustersets; } return $form; } sub _groups { ## @private return (@{ $_[0]->species_defs->TAXON_ORDER }); } 1;
33.065934
163
0.595879
73da85d20666e63ab47a77d8cf83c58f50a74db0
1,537
pm
Perl
lib/XAO/DO/Context.pm
manwar/XAO-Web
85732ce2e933246e6ed58f69401d0be1f3fd5e7c
[ "Artistic-1.0-Perl" ]
null
null
null
lib/XAO/DO/Context.pm
manwar/XAO-Web
85732ce2e933246e6ed58f69401d0be1f3fd5e7c
[ "Artistic-1.0-Perl" ]
null
null
null
lib/XAO/DO/Context.pm
manwar/XAO-Web
85732ce2e933246e6ed58f69401d0be1f3fd5e7c
[ "Artistic-1.0-Perl" ]
null
null
null
=head1 NAME XAO::DO::Context - base class to access site context =head1 SYNOPSIS package XAO::DO::Blah; use XAO::Objects; use base XAO::Objects->load(objname => 'Context'); sub method() { my $self=shift; my $config=$self->siteconfig; my $cgi=$self->cgi; my $clipboard=$self->clipboard; } =head1 DESCRIPTION This is a convenience base class for accessing site configuration, clipboard, and CGI object. =over =cut ############################################################################### package XAO::DO::Context; use strict; use warnings; use XAO::Projects; use XAO::Objects; use base XAO::Objects->load(objname => 'Atom'); ############################################################################### =item cgi () Convenience shortcut to get CGI object from the site configuration. =cut sub cgi ($;@) { my $self=shift; return $self->siteconfig->cgi(@_); } ############################################################################### =item clipboard () Convenience shortcut to site configuration's clipboard() method. =cut sub clipboard (@) { my $self=shift; $self->siteconfig->clipboard(@_); } ############################################################################### =item siteconfig () Convenience shortcut to the current site configuration. =cut sub siteconfig ($) { my $self=shift; return XAO::Projects::get_current_project(); } ############################################################################### 1;
19.455696
79
0.489915
73f88a5f2fcd392dce4398b83fc31ca1e13a62d1
3,954
pl
Perl
scripts/run_spliced_aligners.pl
tomraulet/PASApipeline
19903caf1fd4295bf7593f5c7e847fadc31603c9
[ "BSD-3-Clause" ]
null
null
null
scripts/run_spliced_aligners.pl
tomraulet/PASApipeline
19903caf1fd4295bf7593f5c7e847fadc31603c9
[ "BSD-3-Clause" ]
null
null
null
scripts/run_spliced_aligners.pl
tomraulet/PASApipeline
19903caf1fd4295bf7593f5c7e847fadc31603c9
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env perl use strict; use warnings; use Carp; use Getopt::Long qw(:config no_ignore_case bundling pass_through); use FindBin; use threads; use File::Basename; use lib ("$FindBin::Bin/../PerlLib"); use Thread_helper; use Process_cmd; my $max_intron_length = 100000; my $usage = <<__EOUSAGE__; ######################################################################## # # --aligners <string> comma-delimited list of aligners to execute # Currently supported: gmap, blat # # --transcripts <string> transcript database in fasta format # # --genome <string> genome database in fasta format # # -I <int> maximum intron length (default: $max_intron_length) # # --CPU <int> max threads for each tool (default: 1) # # -N <int> number of top hits (default: 1) # ######################################################################### __EOUSAGE__ ; my $help_flag; my $aligners; my $transcripts_db; my $genome_db; my $CPU = 1; my $num_top_hits = 1; my %SUPPORTED_ALIGNERS = map { + $_ => 1 } qw(blat gmap); &GetOptions ( 'h' => \$help_flag, 'aligners=s' => \$aligners, 'transcripts=s' => \$transcripts_db, 'genome=s' => \$genome_db, 'I=i' => \$max_intron_length, 'CPU=i' => \$CPU, 'N=i' => \$num_top_hits, ); unless ($aligners && $transcripts_db && $genome_db) { die $usage; } main: { my $thread_helper = new Thread_helper($CPU); if ($aligners =~ /gmap/i) { my $thread = threads->create('run_gmap'); $thread_helper->add_thread($thread); } if ($aligners =~ /blat/i) { $thread_helper->wait_for_open_thread(); my $thread = threads->create('run_blat'); $thread_helper->add_thread($thread); } if ($aligners =~ /minimap2/i) { $thread_helper->wait_for_open_thread(); my $thread = threads->create('run_minimap2'); $thread_helper->add_thread($thread); } $thread_helper->wait_for_all_threads_to_complete(); my @failed_threads = $thread_helper->get_failed_threads(); if (@failed_threads) { die "Error, " . scalar(@failed_threads) . " threads failed.\n"; exit(1); } else { print STDERR "processes completed successfully.\n"; exit(0); } } #### sub run_gmap { my $cmd = "$FindBin::Bin/process_GMAP_alignments_gff3_chimeras_ok.pl --genome $genome_db " . " --transcripts $transcripts_db --CPU $CPU -N $num_top_hits -I $max_intron_length " . " > gmap.spliced_alignments.gff3"; my $checkpoint = "gmap.spliced_alignments.gff3.completed"; unless (-e $checkpoint) { &process_cmd($cmd); &process_cmd("touch $checkpoint"); } return; } #### sub run_blat { my $cmd = "$FindBin::Bin/process_PBLAT_alignments.pl -g $genome_db " . " -t $transcripts_db -I $max_intron_length -o blat.spliced_alignments.gff3 -N $num_top_hits --CPU $CPU "; ## checkpoints built-in to the blat runner already &process_cmd($cmd); return; } #### sub run_minimap2 { my $transcripts_basename = basename($transcripts_db); my $chckpt = "$transcripts_basename.mm2.bam.ok"; my $cmd = "$FindBin::Bin/process_minimap2_alignments.pl --genome $genome_db --transcripts $transcripts_db --CPU $CPU -I $max_intron_length -o $transcripts_basename.mm2.bam"; if (! -e $chckpt) { &process_cmd($cmd); &process_cmd("touch $chckpt"); } $cmd = "$FindBin::Bin/../misc_utilities/SAM_to_gff3.minimap2_path1only.pl $transcripts_basename.mm2.bam > minimap2.spliced_alignments.gff3"; $chckpt = "minimap2.splice_alignments.gff3.ok"; if (! -e $chckpt) { &process_cmd($cmd); &process_cmd("touch $chckpt"); } return; }
25.509677
177
0.575114
ed1d31b919d6fed306da6a240dc95b4340186df6
730
pm
Perl
auto-lib/Paws/Chime/GetAppInstanceRetentionSettingsResponse.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
164
2015-01-08T14:58:53.000Z
2022-02-20T19:16:24.000Z
auto-lib/Paws/Chime/GetAppInstanceRetentionSettingsResponse.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
348
2015-01-07T22:08:38.000Z
2022-01-27T14:34:44.000Z
auto-lib/Paws/Chime/GetAppInstanceRetentionSettingsResponse.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
87
2015-04-22T06:29:47.000Z
2021-09-29T14:45:55.000Z
package Paws::Chime::GetAppInstanceRetentionSettingsResponse; use Moose; has AppInstanceRetentionSettings => (is => 'ro', isa => 'Paws::Chime::AppInstanceRetentionSettings'); has InitiateDeletionTimestamp => (is => 'ro', isa => 'Str'); has _request_id => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::Chime::GetAppInstanceRetentionSettingsResponse =head1 ATTRIBUTES =head2 AppInstanceRetentionSettings => L<Paws::Chime::AppInstanceRetentionSettings> The retention settings for the C<AppInstance>. =head2 InitiateDeletionTimestamp => Str The timestamp representing the time at which the specified items are retained, in Epoch Seconds. =head2 _request_id => Str =cut
20.857143
103
0.742466
73ec3eb0c7ad5a5768e6c059c2849ffe9730d446
444
al
Perl
results/alignments_translated/Bo5g021060_exon2.al
naturalis/brassica-genes
e060d0938407566b6a7d0f30d61a61eea0c37f1c
[ "MIT" ]
null
null
null
results/alignments_translated/Bo5g021060_exon2.al
naturalis/brassica-genes
e060d0938407566b6a7d0f30d61a61eea0c37f1c
[ "MIT" ]
null
null
null
results/alignments_translated/Bo5g021060_exon2.al
naturalis/brassica-genes
e060d0938407566b6a7d0f30d61a61eea0c37f1c
[ "MIT" ]
null
null
null
>geneid:Bo5g021060;contig:C5;feature:exon2;seqstart:7326037;seqstop:7326530 MPTMLTDVFRGHPIHLPHSHQPDFTSLSELPDSYTWTPKDDPLLDAAPSPPAASENIPLI DLNHPDAANQIGSACRTWGAFQIANHGVPLELLQGIEFLTGSLFQLPVHRKLKAARSETG FSGYGVARISSFFNKQMWSEGFTITGSPLNDFRKLWPQHHLNNY >seqstart:7333046;seqstop7333539+ MPTMLTDVFRGHPIHLPHFHQPDFTSLSELPDSYTWTPKDDPLLDAAPSPPAASENIPLI DLNHPDAANQIGSACRTWGAFQIANHGVPLELLQGIEFLTGSLFQLPVHRKLKAARSETG FSGYGVARISSFFNKQMWSEGFTITGSPLNDFRKLWPQHHLNNY
49.333333
75
0.95045
ed24d1b8adfaad995491d98bc62cfe3932f290eb
3,061
t
Perl
t/030_kolon/026_constant.t
zanyou/p5-Text-Xslate
bb54e9868f21a1df885314eeddc734b9ddb964f4
[ "Artistic-1.0" ]
26
2015-01-19T14:31:24.000Z
2020-07-12T21:14:57.000Z
t/030_kolon/026_constant.t
zanyou/p5-Text-Xslate
bb54e9868f21a1df885314eeddc734b9ddb964f4
[ "Artistic-1.0" ]
57
2015-01-31T08:17:53.000Z
2021-11-01T10:42:09.000Z
t/030_kolon/026_constant.t
zanyou/p5-Text-Xslate
bb54e9868f21a1df885314eeddc734b9ddb964f4
[ "Artistic-1.0" ]
27
2015-01-30T23:47:55.000Z
2021-07-20T01:59:02.000Z
#!perl -w use strict; use Test::More; use Text::Xslate; use Text::Xslate::Util qw(p mark_raw); use lib "t/lib"; use Util; my $tx = Text::Xslate->new( path => [path], function => { format => sub{ my($fmt) = @_; return sub { mark_raw(sprintf $fmt, @_) } }, }, verbose => 2, ); my @set = ( [<<'T', { lang => 'Xslate' }, <<'X', 'literal'], : constant FOO = 42; <: FOO :> T 42 X [<<'T', { lang => 'Xslate' }, <<'X', 'str'], : constant FOO = "bar"; <: FOO :> T bar X [<<'T', { lang => 'Xslate' }, <<'X', 'expression'], : constant FOO = 40 + 2; <: FOO :> T 42 X [<<'T', { lang => 'Xslate' }, <<'X', 'var'], : constant FOO = $lang; <: FOO :> T Xslate X [<<'T', { lang => 'Xslate' }, <<'X', 'array'], : constant FOO = ["foo", "bar"]; <: FOO[0] :> <: FOO[1] :> T foo bar X [<<'T', { lang => 'Xslate' }, <<'X'], : constant make_em = format('<em>%s</em>'); <: "foo" | make_em :> <: "bar" | make_em :> T <em>foo</em> <em>bar</em> X [<<'T', { data => [qw(foo bar)] }, <<'X'], : for $data -> $i { : constant ITEM = $i; : constant INDEX = $~i.index; : constant COUNT = $~i.count; : constant BODY = $~i.body; <: INDEX :> <: COUNT :> <: BODY[$~i] :> <: ITEM :> : } T 0 1 foo foo 1 2 bar bar X [<<'T', { data => [qw(foo bar)] }, <<'X'], : if (constant FOO = 42) != 42 { UNLIKELY : } : else { <: FOO :> : } T 42 X [<<'T', { data => [qw(foo bar)] }, <<'X'], : if (constant FOO = 42) != 42 { UNLIKELY : } : else { : constant FOO = 100; <: FOO :> : } T 100 X [<<'T', { data => [qw(foo bar)] }, <<'X'], : if (constant FOO = 42) != 42 { UNLIKELY : } : else { : constant FOO = 100; <: FOO :> : } T 100 X [<<'T', { }, <<'X'], <: macro make_em -> $x { :><em><: $x :></em><: } -:> : constant EM = make_em; <: EM("foo") :> T <em>foo</em> X [<<'T', { }, <<'X'], <: macro make_em -> $x { :><em><: $x :></em><: } -:> : constant EM = [make_em]; <: EM[0]("foo") :> T <em>foo</em> X [<<'T', { a => 'foo', b => 'bar' }, <<'X'], <: macro foo -> { "foo" } macro bar -> { "bar" } constant DISPATCHER = { foo => foo, bar => bar, }; -:> <: DISPATCHER[$a]() :> <: DISPATCHER[$b]() :> T foo bar X [<<'T', { a => 'foo', b => 'bar' }, <<'X', 'constant after loop'], <: constant a = format('%d')(42); constant b = [format('%d')(43)]; constant c = { d => 44 }; macro foo -> $x { " foo\n" } for [1] -> $y { foo($y) | format('%s'); } -:> <: a :> <: b[0] :> <: c.d :> T foo 42 43 44 X ); foreach my $d(@set) { my($in, $vars, $out, $msg) = @$d; is $tx->render_string($in, $vars), $out, $msg or diag($in); while($in =~ s/\b constant \s* (\w+)/my $1/xms) { my $name = $1; $in =~ s/\b \Q$name\E \b/\$$name/xmsg; } $in =~ /\$/ or die "Oops: $in"; #note $in; is $tx->render_string($in, $vars), $out, or diag($in); } done_testing;
16.281915
70
0.411303
ed225d72f88fced436bc3ad3bf1bf94137e49203
4,809
pl
Perl
permissions.pl
luvaria/cpsc312-discordpermissions
329a7f8f93cc03c90bef750be3d2cce700b9f9d6
[ "BSD-3-Clause" ]
null
null
null
permissions.pl
luvaria/cpsc312-discordpermissions
329a7f8f93cc03c90bef750be3d2cce700b9f9d6
[ "BSD-3-Clause" ]
null
null
null
permissions.pl
luvaria/cpsc312-discordpermissions
329a7f8f93cc03c90bef750be3d2cce700b9f9d6
[ "BSD-3-Clause" ]
null
null
null
% based on https://discordapp.com/developers/docs/topics/permissions#permission-overwrites :- consult(flags). :- consult(data). % computes a member's base permissions integer % given member and guild base_permissions(Member, Guild, Permissions) :- guild_owner(Member, Guild, P1), flag("NONE", P2, _), Roles = Guild.roles, guild_roles(Member, Guild, Roles, P2, P3), guild_admin(P3, P4), Permissions is P1 \/ P4. % helpers for base_permissions: % member is guild owner guild_owner(Member, Guild, Permissions) :- Member.user.id = Guild.owner_id, flag("ALL", Permissions, _). % member is not guild owner guild_owner(Member, Guild, Permissions) :- Member.user.id \= Guild.owner_id, flag("NONE", Permissions, _). % given member and list of roles in guild, % produces combined permissions integer % guild_roles(Member, Guild, [Role], PermsIn, PermsOut). guild_roles(_, _, [], P, P). % @everyone has role.id = guild.id guild_roles(M, G, [H|T], P, R) :- H.id = G.id, P1 is P \/ H.permissions, guild_roles(M, G, T, P1, R). % member has role guild_roles(M, G, [H|T], P, R) :- memberchk(H.id, M.roles), P1 is P \/ H.permissions, guild_roles(M, G, T, P1, R). % member does not have role guild_roles(M, G, [H|T], P, R) :- H.id \= G.id, \+ memberchk(H.id, M.roles), guild_roles(M, G, T, P, R). % PermsIn has administrator % guild_admin(PermsIn, PermsOut). guild_admin(P, R) :- has_permission(P, "ADMINISTRATOR"), flag("ALL", R, _). % member is not administrator guild_admin(P, P) :- \+ has_permission(P, "ADMINISTRATOR"). % computes a member's permissions integer % given base permissions and channel % base is administrator overwrite_permissions(_, _, Base, Permissions) :- has_permission(Base, "ADMINISTRATOR"), flag("ALL", Permissions, _). % base is not administrator overwrite_permissions(Member, Channel, Base, Permissions) :- \+ has_permission(Base, "ADMINISTRATOR"), channel_everyone(Channel.permission_overwrites, Channel.guild_id, Base, P1), flag("NONE", N, _), channel_roles(Channel.permission_overwrites, Channel.guild_id, N, N, Deny, Allow), P2 is P1 /\ \Deny \/ Allow, channel_member(Channel.permission_overwrites, Member, P2, Permissions). % helpers for overwrite_permissions: % given a channel, applies @everyone overwrites % channel_everyone([Overwrite], GuildID, Base, Permissions). channel_everyone([], _, P, P). channel_everyone([H|T], GID, B, P) :- H.id \= GID, channel_everyone(T, GID, B, P). % @everyone overwrite found (assume @everyone only shows up once in overwrites) channel_everyone([H|_], GID, B, P) :- H.id = GID, D is B /\ \H.deny, P is D \/ H.allow. % given a list of overwrites and a channel, % produces combined permissions integers for roles % channel_roles([Overwrite], GuildID, DenyIn, AllowIn, Deny, Allow). channel_roles([], _, D, A, D, A). % ignore non-role overwrites channel_roles([H|T], GID, D1, A1, D2, A2) :- H.type \= "role", channel_roles(T, GID, D1, A1, D2, A2). % ignore @everyone overwrites channel_roles([H|T], GID, D1, A1, D2, A2) :- H.id = GID, channel_roles(T, GID, D1, A1, D2, A2). % role overwrites channel_roles([H|T], GID, D1, A1, D2, A2) :- H.type = "role", H.id \= GID, D3 is D1 \/ H.deny, A3 is A1 \/ H.allow, channel_roles(T, GID, D3, A3, D2, A2). % given a list of overwrites, member, and initial permissions, % produces combined permissions integer for members % channel_member([Overwrite], Member, PermsIn, PermsOut). channel_member([], _, P, P). % ignore non-member overwrites channel_member([H|T], M, PIn, POut) :- H.type \= "member", channel_member(T, M, PIn, POut). % overwrites doesn't match member id channel_member([H|T], M, PIn, POut) :- H.type = "member", H.id \= M.user.id, channel_member(T, M, PIn, POut). % overwrite matches member id channel_member([H|_], M, PIn, POut) :- H.type = "member", H.id = M.user.id, Deny is PIn /\ \H.deny, POut is Deny \/ H.allow. % given the IDs of a member of a guild and the guild itself, % produces the member's base (guild-wide) permissions % Permissions as integer 0x######## % try % guild_permissions("645375281124737025", "631724803203792896", P). guild_permissions(UserID, GuildID, Permissions) :- get_member(GuildID, UserID, Member), get_guild(GuildID, Guild), base_permissions(Member, Guild, Permissions). % given the IDs of a member of a guild and a channel in the guild, % produces the member's permissions considering overwrites % Permissions as integer 0x######## % try % channel_permissions("645375281124737025", "645434356680097812", P). channel_permissions(UserID, ChannelID, Permissions) :- get_channel(ChannelID, Channel), GuildID = Channel.guild_id, get_member(GuildID, UserID, Member), get_guild(GuildID, Guild), base_permissions(Member, Guild, Base), overwrite_permissions(Member, Channel, Base, Permissions).
31.431373
90
0.704096
ed121fccdbba810665047fd38761e50e48e4926d
1,643
t
Perl
t/release/scripts.t
oiami/cpan-api
141117f1f4bf451badaa6ea2034dd258bacd4d6f
[ "Artistic-1.0" ]
2
2020-06-11T12:34:28.000Z
2020-09-21T08:11:52.000Z
t/release/scripts.t
oiami/cpan-api
141117f1f4bf451badaa6ea2034dd258bacd4d6f
[ "Artistic-1.0" ]
null
null
null
t/release/scripts.t
oiami/cpan-api
141117f1f4bf451badaa6ea2034dd258bacd4d6f
[ "Artistic-1.0" ]
1
2020-06-11T12:34:40.000Z
2020-06-11T12:34:40.000Z
use strict; use warnings; use MetaCPAN::Server::Test; use Test::More; my $model = model(); my $idx = $model->index('cpan'); my $release = $idx->type('release')->get( { author => 'MO', name => 'Scripts-0.01' } ); is( $release->name, 'Scripts-0.01', 'name ok' ); is( $release->author, 'MO', 'author ok' ); is( $release->version, '0.01', 'version ok' ); { my @files = $idx->type('file')->filter( { and => [ { term => { mime => 'text/x-script.perl' } }, { term => { distribution => 'Scripts' } } ] } )->all; is( @files, 4, 'four scripts found' ); @files = sort { $a->name cmp $b->name } grep { $_->has_documentation } @files; is( @files, 2, 'two with documentation' ); is_deeply( [ map { { documentation => $_->documentation, indexed => $_->indexed, mime => $_->mime } } @files ], [ { documentation => 'catalyst', indexed => \1, mime => 'text/x-script.perl' }, { documentation => 'starman', indexed => \1, mime => 'text/x-script.perl' } ], 'what is to be expected' ); foreach my $file (@files) { like ${ $file->pod }, qr/\ANAME (catalyst|starman) - starter\z/, $file->path . ' pod text'; } } done_testing;
24.161765
69
0.399878
73e22af22a25651085dbcfac6d8362ad63bdb9b4
95,804
pm
Perl
include/6.2.0/FontCoverage.pm
xkr47/font-coverage
f35a597c8bd30433b8281102b4112b8cbee9d2e2
[ "BSD-2-Clause" ]
4
2019-07-28T23:52:55.000Z
2021-08-22T11:12:22.000Z
include/6.2.0/FontCoverage.pm
xkr47/font-coverage
f35a597c8bd30433b8281102b4112b8cbee9d2e2
[ "BSD-2-Clause" ]
1
2019-09-09T09:20:08.000Z
2019-09-09T09:20:08.000Z
include/6.2.0/FontCoverage.pm
xkr47/font-coverage
f35a597c8bd30433b8281102b4112b8cbee9d2e2
[ "BSD-2-Clause" ]
1
2019-09-09T07:22:40.000Z
2019-09-09T07:22:40.000Z
package FontCoverage; # # This is a generated file used for FontCoverage script # our $assign_map = [ ### 0x0 0x0 , 0xFF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 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , ### 0x2F800 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x3FFFFFFF, 0x0 , ]; our $block_list = { 'C0 Control Character' => { 'start' => 0x0000, 'end' => 0x001F, 'assigned_total' => 0 }, 'Basic Latin' => { 'start' => 0x0020, 'end' => 0x007F, 'assigned_total' => 95 }, 'C1 Control Character' => { 'start' => 0x0080, 'end' => 0x009F, 'assigned_total' => 0 }, 'Latin-1 Supplement' => { 'start' => 0x00A0, 'end' => 0x00FF, 'assigned_total' => 96 }, 'Latin Extended-A' => { 'start' => 0x0100, 'end' => 0x017F, 'assigned_total' => 128 }, 'Latin Extended-B' => { 'start' => 0x0180, 'end' => 0x024F, 'assigned_total' => 208 }, 'IPA Extensions' => { 'start' => 0x0250, 'end' => 0x02AF, 'assigned_total' => 96 }, 'Spacing Modifier Letters' => { 'start' => 0x02B0, 'end' => 0x02FF, 'assigned_total' => 80 }, 'Combining Diacritical Marks' => { 'start' => 0x0300, 'end' => 0x036F, 'assigned_total' => 112 }, 'Greek and Coptic' => { 'start' => 0x0370, 'end' => 0x03FF, 'assigned_total' => 134 }, 'Cyrillic' => { 'start' => 0x0400, 'end' => 0x04FF, 'assigned_total' => 256 }, 'Cyrillic Supplement' => { 'start' => 0x0500, 'end' => 0x052F, 'assigned_total' => 40 }, 'Armenian' => { 'start' => 0x0530, 'end' => 0x058F, 'assigned_total' => 87 }, 'Hebrew' => { 'start' => 0x0590, 'end' => 0x05FF, 'assigned_total' => 87 }, 'Arabic' => { 'start' => 0x0600, 'end' => 0x06FF, 'assigned_total' => 253 }, 'Syriac' => { 'start' => 0x0700, 'end' => 0x074F, 'assigned_total' => 77 }, 'Arabic Supplement' => { 'start' => 0x0750, 'end' => 0x077F, 'assigned_total' => 48 }, 'Thaana' => { 'start' => 0x0780, 'end' => 0x07BF, 'assigned_total' => 50 }, 'NKo' => { 'start' => 0x07C0, 'end' => 0x07FF, 'assigned_total' => 59 }, 'Samaritan' => { 'start' => 0x0800, 'end' => 0x083F, 'assigned_total' => 61 }, 'Mandaic' => { 'start' => 0x0840, 'end' => 0x085F, 'assigned_total' => 29 }, 'Arabic Extended-A' => { 'start' => 0x08A0, 'end' => 0x08FF, 'assigned_total' => 39 }, 'Devanagari' => { 'start' => 0x0900, 'end' => 0x097F, 'assigned_total' => 127 }, 'Bengali' => { 'start' => 0x0980, 'end' => 0x09FF, 'assigned_total' => 92 }, 'Gurmukhi' => { 'start' => 0x0A00, 'end' => 0x0A7F, 'assigned_total' => 79 }, 'Gujarati' => { 'start' => 0x0A80, 'end' => 0x0AFF, 'assigned_total' => 84 }, 'Oriya' => { 'start' => 0x0B00, 'end' => 0x0B7F, 'assigned_total' => 90 }, 'Tamil' => { 'start' => 0x0B80, 'end' => 0x0BFF, 'assigned_total' => 72 }, 'Telugu' => { 'start' => 0x0C00, 'end' => 0x0C7F, 'assigned_total' => 93 }, 'Kannada' => { 'start' => 0x0C80, 'end' => 0x0CFF, 'assigned_total' => 86 }, 'Malayalam' => { 'start' => 0x0D00, 'end' => 0x0D7F, 'assigned_total' => 98 }, 'Sinhala' => { 'start' => 0x0D80, 'end' => 0x0DFF, 'assigned_total' => 80 }, 'Thai' => { 'start' => 0x0E00, 'end' => 0x0E7F, 'assigned_total' => 87 }, 'Lao' => { 'start' => 0x0E80, 'end' => 0x0EFF, 'assigned_total' => 67 }, 'Tibetan' => { 'start' => 0x0F00, 'end' => 0x0FFF, 'assigned_total' => 211 }, 'Myanmar' => { 'start' => 0x1000, 'end' => 0x109F, 'assigned_total' => 160 }, 'Georgian' => { 'start' => 0x10A0, 'end' => 0x10FF, 'assigned_total' => 88 }, 'Hangul Jamo' => { 'start' => 0x1100, 'end' => 0x11FF, 'assigned_total' => 256 }, 'Ethiopic' => { 'start' => 0x1200, 'end' => 0x137F, 'assigned_total' => 358 }, 'Ethiopic Supplement' => { 'start' => 0x1380, 'end' => 0x139F, 'assigned_total' => 26 }, 'Cherokee' => { 'start' => 0x13A0, 'end' => 0x13FF, 'assigned_total' => 85 }, 'Unified Canadian Aboriginal Syllabics' => { 'start' => 0x1400, 'end' => 0x167F, 'assigned_total' => 640 }, 'Ogham' => { 'start' => 0x1680, 'end' => 0x169F, 'assigned_total' => 29 }, 'Runic' => { 'start' => 0x16A0, 'end' => 0x16FF, 'assigned_total' => 81 }, 'Tagalog' => { 'start' => 0x1700, 'end' => 0x171F, 'assigned_total' => 20 }, 'Hanunoo' => { 'start' => 0x1720, 'end' => 0x173F, 'assigned_total' => 23 }, 'Buhid' => { 'start' => 0x1740, 'end' => 0x175F, 'assigned_total' => 20 }, 'Tagbanwa' => { 'start' => 0x1760, 'end' => 0x177F, 'assigned_total' => 18 }, 'Khmer' => { 'start' => 0x1780, 'end' => 0x17FF, 'assigned_total' => 114 }, 'Mongolian' => { 'start' => 0x1800, 'end' => 0x18AF, 'assigned_total' => 156 }, 'Unified Canadian Aboriginal Syllabics Extended' => { 'start' => 0x18B0, 'end' => 0x18FF, 'assigned_total' => 70 }, 'Limbu' => { 'start' => 0x1900, 'end' => 0x194F, 'assigned_total' => 66 }, 'Tai Le' => { 'start' => 0x1950, 'end' => 0x197F, 'assigned_total' => 35 }, 'New Tai Lue' => { 'start' => 0x1980, 'end' => 0x19DF, 'assigned_total' => 83 }, 'Khmer Symbols' => { 'start' => 0x19E0, 'end' => 0x19FF, 'assigned_total' => 32 }, 'Buginese' => { 'start' => 0x1A00, 'end' => 0x1A1F, 'assigned_total' => 30 }, 'Tai Tham' => { 'start' => 0x1A20, 'end' => 0x1AAF, 'assigned_total' => 127 }, 'Balinese' => { 'start' => 0x1B00, 'end' => 0x1B7F, 'assigned_total' => 121 }, 'Sundanese' => { 'start' => 0x1B80, 'end' => 0x1BBF, 'assigned_total' => 64 }, 'Batak' => { 'start' => 0x1BC0, 'end' => 0x1BFF, 'assigned_total' => 56 }, 'Lepcha' => { 'start' => 0x1C00, 'end' => 0x1C4F, 'assigned_total' => 74 }, 'Ol Chiki' => { 'start' => 0x1C50, 'end' => 0x1C7F, 'assigned_total' => 48 }, 'Sundanese Supplement' => { 'start' => 0x1CC0, 'end' => 0x1CCF, 'assigned_total' => 8 }, 'Vedic Extensions' => { 'start' => 0x1CD0, 'end' => 0x1CFF, 'assigned_total' => 39 }, 'Phonetic Extensions' => { 'start' => 0x1D00, 'end' => 0x1D7F, 'assigned_total' => 128 }, 'Phonetic Extensions Supplement' => { 'start' => 0x1D80, 'end' => 0x1DBF, 'assigned_total' => 64 }, 'Combining Diacritical Marks Supplement' => { 'start' => 0x1DC0, 'end' => 0x1DFF, 'assigned_total' => 43 }, 'Latin Extended Additional' => { 'start' => 0x1E00, 'end' => 0x1EFF, 'assigned_total' => 256 }, 'Greek Extended' => { 'start' => 0x1F00, 'end' => 0x1FFF, 'assigned_total' => 233 }, 'General Punctuation' => { 'start' => 0x2000, 'end' => 0x206F, 'assigned_total' => 107 }, 'Superscripts and Subscripts' => { 'start' => 0x2070, 'end' => 0x209F, 'assigned_total' => 42 }, 'Currency Symbols' => { 'start' => 0x20A0, 'end' => 0x20CF, 'assigned_total' => 27 }, 'Combining Diacritical Marks for Symbols' => { 'start' => 0x20D0, 'end' => 0x20FF, 'assigned_total' => 33 }, 'Letterlike Symbols' => { 'start' => 0x2100, 'end' => 0x214F, 'assigned_total' => 80 }, 'Number Forms' => { 'start' => 0x2150, 'end' => 0x218F, 'assigned_total' => 58 }, 'Arrows' => { 'start' => 0x2190, 'end' => 0x21FF, 'assigned_total' => 112 }, 'Mathematical Operators' => { 'start' => 0x2200, 'end' => 0x22FF, 'assigned_total' => 256 }, 'Miscellaneous Technical' => { 'start' => 0x2300, 'end' => 0x23FF, 'assigned_total' => 244 }, 'Control Pictures' => { 'start' => 0x2400, 'end' => 0x243F, 'assigned_total' => 39 }, 'Optical Character Recognition' => { 'start' => 0x2440, 'end' => 0x245F, 'assigned_total' => 11 }, 'Enclosed Alphanumerics' => { 'start' => 0x2460, 'end' => 0x24FF, 'assigned_total' => 160 }, 'Box Drawing' => { 'start' => 0x2500, 'end' => 0x257F, 'assigned_total' => 128 }, 'Block Elements' => { 'start' => 0x2580, 'end' => 0x259F, 'assigned_total' => 32 }, 'Geometric Shapes' => { 'start' => 0x25A0, 'end' => 0x25FF, 'assigned_total' => 96 }, 'Miscellaneous Symbols' => { 'start' => 0x2600, 'end' => 0x26FF, 'assigned_total' => 256 }, 'Dingbats' => { 'start' => 0x2700, 'end' => 0x27BF, 'assigned_total' => 191 }, 'Miscellaneous Mathematical Symbols-A' => { 'start' => 0x27C0, 'end' => 0x27EF, 'assigned_total' => 48 }, 'Supplemental Arrows-A' => { 'start' => 0x27F0, 'end' => 0x27FF, 'assigned_total' => 16 }, 'Braille Patterns' => { 'start' => 0x2800, 'end' => 0x28FF, 'assigned_total' => 256 }, 'Supplemental Arrows-B' => { 'start' => 0x2900, 'end' => 0x297F, 'assigned_total' => 128 }, 'Miscellaneous Mathematical Symbols-B' => { 'start' => 0x2980, 'end' => 0x29FF, 'assigned_total' => 128 }, 'Supplemental Mathematical Operators' => { 'start' => 0x2A00, 'end' => 0x2AFF, 'assigned_total' => 256 }, 'Miscellaneous Symbols and Arrows' => { 'start' => 0x2B00, 'end' => 0x2BFF, 'assigned_total' => 87 }, 'Glagolitic' => { 'start' => 0x2C00, 'end' => 0x2C5F, 'assigned_total' => 94 }, 'Latin Extended-C' => { 'start' => 0x2C60, 'end' => 0x2C7F, 'assigned_total' => 32 }, 'Coptic' => { 'start' => 0x2C80, 'end' => 0x2CFF, 'assigned_total' => 123 }, 'Georgian Supplement' => { 'start' => 0x2D00, 'end' => 0x2D2F, 'assigned_total' => 40 }, 'Tifinagh' => { 'start' => 0x2D30, 'end' => 0x2D7F, 'assigned_total' => 59 }, 'Ethiopic Extended' => { 'start' => 0x2D80, 'end' => 0x2DDF, 'assigned_total' => 79 }, 'Cyrillic Extended-A' => { 'start' => 0x2DE0, 'end' => 0x2DFF, 'assigned_total' => 32 }, 'Supplemental Punctuation' => { 'start' => 0x2E00, 'end' => 0x2E7F, 'assigned_total' => 60 }, 'CJK Radicals Supplement' => { 'start' => 0x2E80, 'end' => 0x2EFF, 'assigned_total' => 115 }, 'Kangxi Radicals' => { 'start' => 0x2F00, 'end' => 0x2FDF, 'assigned_total' => 214 }, 'Ideographic Description Characters' => { 'start' => 0x2FF0, 'end' => 0x2FFF, 'assigned_total' => 12 }, 'CJK Symbols and Punctuation' => { 'start' => 0x3000, 'end' => 0x303F, 'assigned_total' => 64 }, 'Hiragana' => { 'start' => 0x3040, 'end' => 0x309F, 'assigned_total' => 93 }, 'Katakana' => { 'start' => 0x30A0, 'end' => 0x30FF, 'assigned_total' => 96 }, 'Bopomofo' => { 'start' => 0x3100, 'end' => 0x312F, 'assigned_total' => 41 }, 'Hangul Compatibility Jamo' => { 'start' => 0x3130, 'end' => 0x318F, 'assigned_total' => 94 }, 'Kanbun' => { 'start' => 0x3190, 'end' => 0x319F, 'assigned_total' => 16 }, 'Bopomofo Extended' => { 'start' => 0x31A0, 'end' => 0x31BF, 'assigned_total' => 27 }, 'CJK Strokes' => { 'start' => 0x31C0, 'end' => 0x31EF, 'assigned_total' => 36 }, 'Katakana Phonetic Extensions' => { 'start' => 0x31F0, 'end' => 0x31FF, 'assigned_total' => 16 }, 'Enclosed CJK Letters and Months' => { 'start' => 0x3200, 'end' => 0x32FF, 'assigned_total' => 254 }, 'CJK Compatibility' => { 'start' => 0x3300, 'end' => 0x33FF, 'assigned_total' => 256 }, 'CJK Unified Ideographs Extension A' => { 'start' => 0x3400, 'end' => 0x4DBF, 'assigned_total' => 6582 }, 'Yijing Hexagram Symbols' => { 'start' => 0x4DC0, 'end' => 0x4DFF, 'assigned_total' => 64 }, 'CJK Unified Ideographs' => { 'start' => 0x4E00, 'end' => 0x9FFF, 'assigned_total' => 20941 }, 'Yi Syllables' => { 'start' => 0xA000, 'end' => 0xA48F, 'assigned_total' => 1165 }, 'Yi Radicals' => { 'start' => 0xA490, 'end' => 0xA4CF, 'assigned_total' => 55 }, 'Lisu' => { 'start' => 0xA4D0, 'end' => 0xA4FF, 'assigned_total' => 48 }, 'Vai' => { 'start' => 0xA500, 'end' => 0xA63F, 'assigned_total' => 300 }, 'Cyrillic Extended-B' => { 'start' => 0xA640, 'end' => 0xA69F, 'assigned_total' => 89 }, 'Bamum' => { 'start' => 0xA6A0, 'end' => 0xA6FF, 'assigned_total' => 88 }, 'Modifier Tone Letters' => { 'start' => 0xA700, 'end' => 0xA71F, 'assigned_total' => 32 }, 'Latin Extended-D' => { 'start' => 0xA720, 'end' => 0xA7FF, 'assigned_total' => 134 }, 'Syloti Nagri' => { 'start' => 0xA800, 'end' => 0xA82F, 'assigned_total' => 44 }, 'Common Indic Number Forms' => { 'start' => 0xA830, 'end' => 0xA83F, 'assigned_total' => 10 }, 'Phags-pa' => { 'start' => 0xA840, 'end' => 0xA87F, 'assigned_total' => 56 }, 'Saurashtra' => { 'start' => 0xA880, 'end' => 0xA8DF, 'assigned_total' => 81 }, 'Devanagari Extended' => { 'start' => 0xA8E0, 'end' => 0xA8FF, 'assigned_total' => 28 }, 'Kayah Li' => { 'start' => 0xA900, 'end' => 0xA92F, 'assigned_total' => 48 }, 'Rejang' => { 'start' => 0xA930, 'end' => 0xA95F, 'assigned_total' => 37 }, 'Hangul Jamo Extended-A' => { 'start' => 0xA960, 'end' => 0xA97F, 'assigned_total' => 29 }, 'Javanese' => { 'start' => 0xA980, 'end' => 0xA9DF, 'assigned_total' => 91 }, 'Cham' => { 'start' => 0xAA00, 'end' => 0xAA5F, 'assigned_total' => 83 }, 'Myanmar Extended-A' => { 'start' => 0xAA60, 'end' => 0xAA7F, 'assigned_total' => 28 }, 'Tai Viet' => { 'start' => 0xAA80, 'end' => 0xAADF, 'assigned_total' => 72 }, 'Meetei Mayek Extensions' => { 'start' => 0xAAE0, 'end' => 0xAAFF, 'assigned_total' => 23 }, 'Ethiopic Extended-A' => { 'start' => 0xAB00, 'end' => 0xAB2F, 'assigned_total' => 32 }, 'Meetei Mayek' => { 'start' => 0xABC0, 'end' => 0xABFF, 'assigned_total' => 56 }, 'Hangul Syllables' => { 'start' => 0xAC00, 'end' => 0xD7AF, 'assigned_total' => 11172 }, 'Hangul Jamo Extended-B' => { 'start' => 0xD7B0, 'end' => 0xD7FF, 'assigned_total' => 72 }, 'High Surrogates' => { 'start' => 0xD800, 'end' => 0xDB7F, 'assigned_total' => 0 }, 'High Private Use Surrogates' => { 'start' => 0xDB80, 'end' => 0xDBFF, 'assigned_total' => 0 }, 'Low Surrogates' => { 'start' => 0xDC00, 'end' => 0xDFFF, 'assigned_total' => 0 }, 'Private Use Area' => { 'start' => 0xE000, 'end' => 0xF8FF, 'assigned_total' => 0 }, 'CJK Compatibility Ideographs' => { 'start' => 0xF900, 'end' => 0xFAFF, 'assigned_total' => 472 }, 'Alphabetic Presentation Forms' => { 'start' => 0xFB00, 'end' => 0xFB4F, 'assigned_total' => 58 }, 'Arabic Presentation Forms-A' => { 'start' => 0xFB50, 'end' => 0xFDFF, 'assigned_total' => 611 }, 'Variation Selectors' => { 'start' => 0xFE00, 'end' => 0xFE0F, 'assigned_total' => 16 }, 'Vertical Forms' => { 'start' => 0xFE10, 'end' => 0xFE1F, 'assigned_total' => 10 }, 'Combining Half Marks' => { 'start' => 0xFE20, 'end' => 0xFE2F, 'assigned_total' => 7 }, 'CJK Compatibility Forms' => { 'start' => 0xFE30, 'end' => 0xFE4F, 'assigned_total' => 32 }, 'Small Form Variants' => { 'start' => 0xFE50, 'end' => 0xFE6F, 'assigned_total' => 26 }, 'Arabic Presentation Forms-B' => { 'start' => 0xFE70, 'end' => 0xFEFF, 'assigned_total' => 141 }, 'Halfwidth and Fullwidth Forms' => { 'start' => 0xFF00, 'end' => 0xFFEF, 'assigned_total' => 225 }, 'Specials' => { 'start' => 0xFFF0, 'end' => 0xFFFF, 'assigned_total' => 5 }, 'Linear B Syllabary' => { 'start' => 0x10000, 'end' => 0x1007F, 'assigned_total' => 88 }, 'Linear B Ideograms' => { 'start' => 0x10080, 'end' => 0x100FF, 'assigned_total' => 123 }, 'Aegean Numbers' => { 'start' => 0x10100, 'end' => 0x1013F, 'assigned_total' => 57 }, 'Ancient Greek Numbers' => { 'start' => 0x10140, 'end' => 0x1018F, 'assigned_total' => 75 }, 'Ancient Symbols' => { 'start' => 0x10190, 'end' => 0x101CF, 'assigned_total' => 12 }, 'Phaistos Disc' => { 'start' => 0x101D0, 'end' => 0x101FF, 'assigned_total' => 46 }, 'Lycian' => { 'start' => 0x10280, 'end' => 0x1029F, 'assigned_total' => 29 }, 'Carian' => { 'start' => 0x102A0, 'end' => 0x102DF, 'assigned_total' => 49 }, 'Old Italic' => { 'start' => 0x10300, 'end' => 0x1032F, 'assigned_total' => 35 }, 'Gothic' => { 'start' => 0x10330, 'end' => 0x1034F, 'assigned_total' => 27 }, 'Ugaritic' => { 'start' => 0x10380, 'end' => 0x1039F, 'assigned_total' => 31 }, 'Old Persian' => { 'start' => 0x103A0, 'end' => 0x103DF, 'assigned_total' => 50 }, 'Deseret' => { 'start' => 0x10400, 'end' => 0x1044F, 'assigned_total' => 80 }, 'Shavian' => { 'start' => 0x10450, 'end' => 0x1047F, 'assigned_total' => 48 }, 'Osmanya' => { 'start' => 0x10480, 'end' => 0x104AF, 'assigned_total' => 40 }, 'Cypriot Syllabary' => { 'start' => 0x10800, 'end' => 0x1083F, 'assigned_total' => 55 }, 'Imperial Aramaic' => { 'start' => 0x10840, 'end' => 0x1085F, 'assigned_total' => 31 }, 'Phoenician' => { 'start' => 0x10900, 'end' => 0x1091F, 'assigned_total' => 29 }, 'Lydian' => { 'start' => 0x10920, 'end' => 0x1093F, 'assigned_total' => 27 }, 'Meroitic Hieroglyphs' => { 'start' => 0x10980, 'end' => 0x1099F, 'assigned_total' => 32 }, 'Meroitic Cursive' => { 'start' => 0x109A0, 'end' => 0x109FF, 'assigned_total' => 26 }, 'Kharoshthi' => { 'start' => 0x10A00, 'end' => 0x10A5F, 'assigned_total' => 65 }, 'Old South Arabian' => { 'start' => 0x10A60, 'end' => 0x10A7F, 'assigned_total' => 32 }, 'Avestan' => { 'start' => 0x10B00, 'end' => 0x10B3F, 'assigned_total' => 61 }, 'Inscriptional Parthian' => { 'start' => 0x10B40, 'end' => 0x10B5F, 'assigned_total' => 30 }, 'Inscriptional Pahlavi' => { 'start' => 0x10B60, 'end' => 0x10B7F, 'assigned_total' => 27 }, 'Old Turkic' => { 'start' => 0x10C00, 'end' => 0x10C4F, 'assigned_total' => 73 }, 'Rumi Numeral Symbols' => { 'start' => 0x10E60, 'end' => 0x10E7F, 'assigned_total' => 31 }, 'Brahmi' => { 'start' => 0x11000, 'end' => 0x1107F, 'assigned_total' => 108 }, 'Kaithi' => { 'start' => 0x11080, 'end' => 0x110CF, 'assigned_total' => 66 }, 'Sora Sompeng' => { 'start' => 0x110D0, 'end' => 0x110FF, 'assigned_total' => 35 }, 'Chakma' => { 'start' => 0x11100, 'end' => 0x1114F, 'assigned_total' => 67 }, 'Sharada' => { 'start' => 0x11180, 'end' => 0x111DF, 'assigned_total' => 83 }, 'Takri' => { 'start' => 0x11680, 'end' => 0x116CF, 'assigned_total' => 66 }, 'Cuneiform' => { 'start' => 0x12000, 'end' => 0x123FF, 'assigned_total' => 879 }, 'Cuneiform Numbers and Punctuation' => { 'start' => 0x12400, 'end' => 0x1247F, 'assigned_total' => 103 }, 'Egyptian Hieroglyphs' => { 'start' => 0x13000, 'end' => 0x1342F, 'assigned_total' => 1071 }, 'Bamum Supplement' => { 'start' => 0x16800, 'end' => 0x16A3F, 'assigned_total' => 569 }, 'Miao' => { 'start' => 0x16F00, 'end' => 0x16F9F, 'assigned_total' => 133 }, 'Kana Supplement' => { 'start' => 0x1B000, 'end' => 0x1B0FF, 'assigned_total' => 2 }, 'Byzantine Musical Symbols' => { 'start' => 0x1D000, 'end' => 0x1D0FF, 'assigned_total' => 246 }, 'Musical Symbols' => { 'start' => 0x1D100, 'end' => 0x1D1FF, 'assigned_total' => 220 }, 'Ancient Greek Musical Notation' => { 'start' => 0x1D200, 'end' => 0x1D24F, 'assigned_total' => 70 }, 'Tai Xuan Jing Symbols' => { 'start' => 0x1D300, 'end' => 0x1D35F, 'assigned_total' => 87 }, 'Counting Rod Numerals' => { 'start' => 0x1D360, 'end' => 0x1D37F, 'assigned_total' => 18 }, 'Mathematical Alphanumeric Symbols' => { 'start' => 0x1D400, 'end' => 0x1D7FF, 'assigned_total' => 996 }, 'Arabic Mathematical Alphabetic Symbols' => { 'start' => 0x1EE00, 'end' => 0x1EEFF, 'assigned_total' => 143 }, 'Mahjong Tiles' => { 'start' => 0x1F000, 'end' => 0x1F02F, 'assigned_total' => 44 }, 'Domino Tiles' => { 'start' => 0x1F030, 'end' => 0x1F09F, 'assigned_total' => 100 }, 'Playing Cards' => { 'start' => 0x1F0A0, 'end' => 0x1F0FF, 'assigned_total' => 59 }, 'Enclosed Alphanumeric Supplement' => { 'start' => 0x1F100, 'end' => 0x1F1FF, 'assigned_total' => 171 }, 'Enclosed Ideographic Supplement' => { 'start' => 0x1F200, 'end' => 0x1F2FF, 'assigned_total' => 57 }, 'Miscellaneous Symbols And Pictographs' => { 'start' => 0x1F300, 'end' => 0x1F5FF, 'assigned_total' => 533 }, 'Emoticons' => { 'start' => 0x1F600, 'end' => 0x1F64F, 'assigned_total' => 76 }, 'Transport And Map Symbols' => { 'start' => 0x1F680, 'end' => 0x1F6FF, 'assigned_total' => 70 }, 'Alchemical Symbols' => { 'start' => 0x1F700, 'end' => 0x1F77F, 'assigned_total' => 116 }, 'CJK Unified Ideographs Extension B' => { 'start' => 0x20000, 'end' => 0x2A6DF, 'assigned_total' => 42711 }, 'CJK Unified Ideographs Extension C' => { 'start' => 0x2A700, 'end' => 0x2B73F, 'assigned_total' => 4149 }, 'CJK Unified Ideographs Extension D' => { 'start' => 0x2B740, 'end' => 0x2B81F, 'assigned_total' => 222 }, 'CJK Compatibility Ideographs Supplement' => { 'start' => 0x2F800, 'end' => 0x2FA1F, 'assigned_total' => 542 }, 'Tags' => { 'start' => 0xE0000, 'end' => 0xE007F, 'assigned_total' => 0 }, 'Variation Selectors Supplement' => { 'start' => 0xE0100, 'end' => 0xE01EF, 'assigned_total' => 0 }, 'Supplementary Private Use Area-A' => { 'start' => 0xF0000, 'end' => 0xFFFFF, 'assigned_total' => 0 }, 'Supplementary Private Use Area-B' => { 'start' => 0x100000, 'end' => 0x10FFFF, 'assigned_total' => 0 }, }; 1;
72.799392
96
0.571939
73f60071c749fa4a14ee278766f04a729c70b062
3,881
pm
Perl
lib/Lingua/Stem/UniNE/BG.pm
patch/lingua-stem-unine-pm5
0795767ef8d1009bfc52a216d5c97058e330c75a
[ "Artistic-1.0" ]
1
2018-09-09T10:39:57.000Z
2018-09-09T10:39:57.000Z
lib/Lingua/Stem/UniNE/BG.pm
patch/lingua-stem-unine-pm5
0795767ef8d1009bfc52a216d5c97058e330c75a
[ "Artistic-1.0" ]
null
null
null
lib/Lingua/Stem/UniNE/BG.pm
patch/lingua-stem-unine-pm5
0795767ef8d1009bfc52a216d5c97058e330c75a
[ "Artistic-1.0" ]
1
2018-11-02T07:19:22.000Z
2018-11-02T07:19:22.000Z
package Lingua::Stem::UniNE::BG; use v5.8.1; use utf8; use strict; use warnings; use parent 'Exporter'; use Unicode::CaseFold qw( fc ); use Unicode::Normalize qw( NFC ); our $VERSION = '0.08'; our @EXPORT_OK = qw( stem stem_bg ); *stem_bg = \&stem; sub stem { my ($word) = @_; $word = NFC fc $word; my $length = length $word; return $word if $length < 4; if ($length > 5) { return $word if $word =~ s{ ища $}{}x; } $word = remove_article($word); $word = remove_plural($word); $length = length $word; if ($length > 3) { $word =~ s{ я $}{}x; # masculine # normalization (e.g., -а could be a definite article or plural form) $word =~ s{ [аео] $}{}x; $length = length $word; } if ($length > 4) { $word =~ s{ е (?= н $) }{}x; # -ен → -н $length = length $word; } if ($length > 5) { $word =~ s{ ъ (?= \p{Cyrl} $) }{}x; # -ъ� → -� } return $word; } sub remove_article { my ($word) = @_; my $length = length $word; if ($length > 6) { # definite article with adjectives and masculine return $word if $word =~ s{ ият $}{}x; } if ($length > 5) { return $word if $word =~ s{ (?: ия # definite articles for nouns: | ът # ∙ masculine | та # ∙ feminine | то # ∙ neutral | те # ∙ plural ) $}{}x; } if ($length > 4) { return $word if $word =~ s{ ят $}{}x; # article for masculine } return $word; } sub remove_plural { my ($word) = @_; my $length = length $word; # specific plural rules for some words (masculine) if ($length > 6) { return $word if $word =~ s{ ове $}{}x || $word =~ s{ еве $}{й}x || $word =~ s{ овци $}{о}x; } if ($length > 5) { return $word if $word =~ s{ зи $}{г}x || $word =~ s{ е ( \p{Cyrl} ) и $}{я$1}x # -е�и → -я� || $word =~ s{ ци $}{к}x || $word =~ s{ (?: та | ища ) $}{}x; } if ($length > 4) { return $word if $word =~ s{ си $}{х}x || $word =~ s{ и $}{}x; # plural for various nouns and adjectives } return $word; } 1; __END__ =encoding UTF-8 =head1 NAME Lingua::Stem::UniNE::BG - Bulgarian stemmer =head1 VERSION This document describes Lingua::Stem::UniNE::BG v0.08. =head1 SYNOPSIS use Lingua::Stem::UniNE::BG qw( stem_bg ); my $stem = stem_bg($word); # alternate syntax $stem = Lingua::Stem::UniNE::BG::stem($word); =head1 DESCRIPTION A stemmer for the Bulgarian language. This module provides the C<stem> and C<stem_bg> functions, which are synonymous and can optionally be exported. They accept a single word and return a single stem. =head1 SEE ALSO L<Lingua::Stem::UniNE> provides a stemming object with access to all of the implemented University of Neuchâtel stemmers including this one. It has additional features like stemming lists of words. L<Lingua::Stem::Any> provides a unified interface to any stemmer on CPAN, including this one, as well as additional features like normalization, casefolding, and in-place stemming. This module is based on a stemming algorithm defined in L<Searching Strategies for the Bulgarian Language|http://dl.acm.org/citation.cfm?id=1298736> (PDF) by Jacques Savoy of the University of Neuchâtel and implemented in a L<Perl script|http://members.unine.ch/jacques.savoy/clef/bulgarianStemmer.txt>. =head1 AUTHOR Nick Patch <patch@cpan.org> =head1 COPYRIGHT AND LICENSE © 2012–2014 Nick Patch This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
22.695906
92
0.555527
73e866d05e3c0a93f97606b6e9c87c25ad49ff6e
10,359
pm
Perl
fhem/core/contrib/YAF/FHEM/01_YAFWebserver.pm
opit7/fhem-docker
d44c9913155318eeae9500767f947a02bbcbac76
[ "MIT" ]
9
2018-02-06T11:57:50.000Z
2021-12-10T13:59:03.000Z
fhem/core/contrib/YAF/FHEM/01_YAFWebserver.pm
opit7/fhem-docker
d44c9913155318eeae9500767f947a02bbcbac76
[ "MIT" ]
null
null
null
fhem/core/contrib/YAF/FHEM/01_YAFWebserver.pm
opit7/fhem-docker
d44c9913155318eeae9500767f947a02bbcbac76
[ "MIT" ]
1
2020-03-20T18:04:49.000Z
2020-03-20T18:04:49.000Z
######################################################################################## # # YAFWebserver.pm # # YAF - Yet Another Floorplan # FHEM Projektgruppe Hochschule Karlsruhe, 2013 # Markus Mangei, Daniel Weisensee, Prof. Dr. Peter A. Henning # ######################################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################################## package main; use strict; use warnings; use FindBin; use lib "$FindBin::Bin/FHEM/YAF/libs"; use YAFWebserver; ######################################################################################## # # YAFWebserver_Initialize - register YAFWebserver with FHEM # # parameter hash # ######################################################################################## sub YAFWebserver_Initialize($) { my ($hash) = @_; $hash->{DefFn} = "YAFWebserver_Define"; $hash->{UndefFn} = "YAFWebserver_Undefine"; $hash->{ReadFn} = "YAFWebserver_Read"; # init new webserver instance $hash->{YAFWEBSERVER} = YAFWebserver->new; $hash->{HEADER_FIELD_HASHMAP} = (); } ######################################################################################## # # YAFWebserver_Define # # parameter hash, def # ######################################################################################## sub YAFWebserver_Define($@) { my ($hash, $def) = @_; my ($name, $type, $port) = split("[ \t]+", $def); # Open new tcp listening on defined port my $ret = TcpServer_Open($hash, $port, ""); return $ret; } ######################################################################################## # # YAFWebserver_Undefine # # parameter hash, arg # ######################################################################################## sub YAFWebserver_Undefine($@) { my ($hash, $arg) = @_; # Close tcp listening return TcpServer_Close($hash); } ######################################################################################## # # YAFWebserver_Read # # parameter hash # ######################################################################################## sub YAFWebserver_Read($) { my ($hash) = @_; my $requestedUrl; # Accept new server sockets if($hash->{SERVERSOCKET}) { TcpServer_Accept($hash, "YAFWebserver"); return; } # Received chars stored in $c my $c = $hash->{CD}; # Read 1024 byte of data my $buf; my $ret = sysread($hash->{CD}, $buf, 1024); # When there is an error in connection return if (!defined($ret) || $ret <= 0) { CommandDelete(undef, $hash->{NAME}); return; } ######## # State: new request / read header ######## if (!defined($hash->{HTTPSTATE}) || ($hash->{HTTPSTATE} eq "NewRequest")) { # Check if new Request is GET or POST else => break connection if (($buf =~ m/\n\n.*/) || ($buf =~ m/\r\n\r\n.*/)) { my $position = 0; # Search trim position,to cut header from content if ($buf =~ m/\n\n.*/) { $position = index($buf,"\n\n")+2; # +2 for \n\n } else { $position = index($buf, "\r\n\r\n")+4;# +4 for \r\n\r\n } # header is read. Remove header from buffer. $hash->{HTTPHEADER} .= substr($buf, 0, $position); $buf = substr($buf, $position); # split header in lines in hashmap # example header line: Accept-Encoding: gzip,deflate,sdch # $hash->{HTTPHEADER_VALUEMAP}->{key} => value my @header_field = split("[\r\n][\r\n]", $hash->{HTTPHEADER}); my @header_field_line_splitted; for (my $array_pos = 1; $array_pos < scalar(@header_field); $array_pos++) { @header_field_line_splitted = split(":",$header_field[$array_pos]); $hash->{HTTPHEADER_VALUEMAP}->{"$header_field_line_splitted[0]"} = trim($header_field_line_splitted[1]); } # look for request line # GET / HTTP/1.1 my @header_field_request_splitted = split(" ", $header_field[0]); $hash->{HTTPHEADER_METHOD} = $header_field_request_splitted[0]; $hash->{HTTPHEADER_URI} = $header_field_request_splitted[1]; $hash->{HTTPHEADER_VERSION} = $header_field_request_splitted[2]; # consume uri # \path\to\file.php ? test = 1 & test = 2 # $hash->{GET}->{key} => value my @header_field_uri_splitted = split(/\?/, $hash->{HTTPHEADER_URI}); if (scalar(@header_field_uri_splitted) > 1) { my @attributes_array = split("&",$header_field_uri_splitted[1]); my @attribute_pair; foreach (@attributes_array) { @attribute_pair = split("=",$_); $hash->{GET}->{"$attribute_pair[0]"} = $attribute_pair[1]; } } # cookie if ($hash->{HTTPHEADER_VALUEMAP}->{"Cookie"}) { my @cookies_array = split(";", $hash->{HTTPHEADER_VALUEMAP}->{"Cookie"}); my @cookies_array_pair; foreach (@cookies_array) { @cookies_array_pair = split("=",$_); my $name = trim($cookies_array_pair[0]); $hash->{COOKIE}->{"$name"} = $cookies_array_pair[1]; } } # set content-length if ($hash->{HTTPHEADER_VALUEMAP}->{"Content-Length"}) { $hash->{HTTPCONTENT_LENGTH} = $hash->{HTTPHEADER_VALUEMAP}->{"Content-Length"}; } else { $hash->{HTTPCONTENT_LENGTH} = 0; } # clear HTTPCONTENT $hash->{HTTPCONTENT} = ""; $hash->{HTTPSTATE} = "ReadData"; } else { $hash->{HTTPHEADER} .= $buf; return; } } ######## # State: consume content ######## if (defined($hash->{HTTPSTATE}) && ($hash->{HTTPSTATE} eq "ReadData")) { $hash->{HTTPCONTENT} .= $buf; # Read hole HTTPCONTENT if (length($hash->{HTTPCONTENT}) >= $hash->{HTTPCONTENT_LENGTH}) { $hash->{HTTPSTATE} = "DoResponse"; # content finish # prepare post var if (($hash->{HTTPHEADER_VALUEMAP}->{"Content-Type"}) && ($hash->{HTTPHEADER_VALUEMAP}->{"Content-Type"} eq "application/x-www-form-urlencoded")) { my @attributes_array = split("&",$hash->{HTTPCONTENT}); my @attribute_pair; foreach (@attributes_array) { @attribute_pair = split("=",$_); $hash->{POST}->{"$attribute_pair[0]"} = $attribute_pair[1]; } } elsif (($hash->{HTTPHEADER_VALUEMAP}->{"Content-Type"}) && ($hash->{HTTPHEADER_VALUEMAP}->{"Content-Type"} =~ m/multipart\/form-data; boundary=*/)) { $hash->{POST_DIVISOR} = $hash->{HTTPHEADER_VALUEMAP}->{"Content-Type"}; $hash->{POST_DIVISOR} =~ s/multipart\/form-data; boundary=//g; # add prefix $hash->{POST_DIVISOR} = "--".$hash->{POST_DIVISOR}; my @post_field_splitted = split($hash->{POST_DIVISOR},$hash->{HTTPCONTENT}); # for every post field for (my $array_pos = 1; $array_pos < scalar(@post_field_splitted)-1; $array_pos++) { my @entry_splitted = split("\r\n\r\n",$post_field_splitted[$array_pos]); # remove last return in value $entry_splitted[1] = substr($entry_splitted[1],0,length($entry_splitted[1])-2); # get name $entry_splitted[0] =~ m/.*name="(.*)".*/; $hash->{POST}->{"$1"} = $entry_splitted[1]; } } } else { return; } } ######## # State: do response ######## if (defined($hash->{HTTPSTATE}) && ($hash->{HTTPSTATE} eq "DoResponse")) { my $header = $hash->{HTTPHEADER}; my $content = $hash->{HTTPCONTENT}; my $test3 = "no"; my $response = "header lines: $hash->{HTTPCONTENT_LENGTH}\r\n####################\r\n$header####################\r\n$content\r\n##################\r\n$test3"; print $c "HTTP/1.1 200 OK\r\n", "Content-Type: text/plain\r\n", # "Set-Cookie: test=test4\r\n", "Content-Length: ".length($response)."\r\n\r\n", $response; # Waiting for new Request $hash->{HTTPHEADER} = ""; $hash->{HTTPCONTENT} = ""; $hash->{HTTPSTATE} = "NewRequest"; # End of Request } return; } 1;
40.944664
168
0.437784
73e26cafa8579035398bec41c1a13cb80e25e65b
8,457
pl
Perl
vendor/golang.org/x/sys/unix/mksyscall.pl
hobti01/traefik
6a92ac0b7b04ea69a995f7635c0a7fb81fdfc952
[ "MIT" ]
5,146
2017-02-10T14:26:53.000Z
2022-03-29T08:59:45.000Z
vendor/golang.org/x/sys/unix/mksyscall.pl
DeslumTeam/shkaff
e8c1540a528ded60120136befb22cff0eccbf3bf
[ "BSD-3-Clause" ]
515
2018-02-22T19:47:43.000Z
2019-12-26T14:25:08.000Z
vendor/golang.org/x/sys/unix/mksyscall.pl
DeslumTeam/shkaff
e8c1540a528ded60120136befb22cff0eccbf3bf
[ "BSD-3-Clause" ]
339
2016-06-03T22:12:21.000Z
2022-02-24T08:34:05.000Z
#!/usr/bin/env perl # Copyright 2009 The Go Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. # This program reads a file containing function prototypes # (like syscall_darwin.go) and generates system call bodies. # The prototypes are marked by lines beginning with "//sys" # and read like func declarations if //sys is replaced by func, but: # * The parameter lists must give a name for each argument. # This includes return parameters. # * The parameter lists must give a type for each argument: # the (x, y, z int) shorthand is not allowed. # * If the return parameter is an error number, it must be named errno. # A line beginning with //sysnb is like //sys, except that the # goroutine will not be suspended during the execution of the system # call. This must only be used for system calls which can never # block, as otherwise the system call could cause all goroutines to # hang. use strict; my $cmdline = "mksyscall.pl " . join(' ', @ARGV); my $errors = 0; my $_32bit = ""; my $plan9 = 0; my $openbsd = 0; my $netbsd = 0; my $dragonfly = 0; my $arm = 0; # 64-bit value should use (even, odd)-pair my $tags = ""; # build tags if($ARGV[0] eq "-b32") { $_32bit = "big-endian"; shift; } elsif($ARGV[0] eq "-l32") { $_32bit = "little-endian"; shift; } if($ARGV[0] eq "-plan9") { $plan9 = 1; shift; } if($ARGV[0] eq "-openbsd") { $openbsd = 1; shift; } if($ARGV[0] eq "-netbsd") { $netbsd = 1; shift; } if($ARGV[0] eq "-dragonfly") { $dragonfly = 1; shift; } if($ARGV[0] eq "-arm") { $arm = 1; shift; } if($ARGV[0] eq "-tags") { shift; $tags = $ARGV[0]; shift; } if($ARGV[0] =~ /^-/) { print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n"; exit 1; } # Check that we are using the new build system if we should if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") { if($ENV{'GOLANG_SYS_BUILD'} ne "docker") { print STDERR "In the new build system, mksyscall should not be called directly.\n"; print STDERR "See README.md\n"; exit 1; } } sub parseparamlist($) { my ($list) = @_; $list =~ s/^\s*//; $list =~ s/\s*$//; if($list eq "") { return (); } return split(/\s*,\s*/, $list); } sub parseparam($) { my ($p) = @_; if($p !~ /^(\S*) (\S*)$/) { print STDERR "$ARGV:$.: malformed parameter: $p\n"; $errors = 1; return ("xx", "int"); } return ($1, $2); } my $text = ""; while(<>) { chomp; s/\s+/ /g; s/^\s+//; s/\s+$//; my $nonblock = /^\/\/sysnb /; next if !/^\/\/sys / && !$nonblock; # Line must be of the form # func Open(path string, mode int, perm int) (fd int, errno error) # Split into name, in params, out params. if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) { print STDERR "$ARGV:$.: malformed //sys declaration\n"; $errors = 1; next; } my ($func, $in, $out, $sysname) = ($2, $3, $4, $5); # Split argument lists on comma. my @in = parseparamlist($in); my @out = parseparamlist($out); # Try in vain to keep people from editing this file. # The theory is that they jump into the middle of the file # without reading the header. $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; # Go function header. my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : ""; $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl; # Check if err return available my $errvar = ""; foreach my $p (@out) { my ($name, $type) = parseparam($p); if($type eq "error") { $errvar = $name; last; } } # Prepare arguments to Syscall. my @args = (); my $n = 0; foreach my $p (@in) { my ($name, $type) = parseparam($p); if($type =~ /^\*/) { push @args, "uintptr(unsafe.Pointer($name))"; } elsif($type eq "string" && $errvar ne "") { $text .= "\tvar _p$n *byte\n"; $text .= "\t_p$n, $errvar = BytePtrFromString($name)\n"; $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; push @args, "uintptr(unsafe.Pointer(_p$n))"; $n++; } elsif($type eq "string") { print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; $text .= "\tvar _p$n *byte\n"; $text .= "\t_p$n, _ = BytePtrFromString($name)\n"; push @args, "uintptr(unsafe.Pointer(_p$n))"; $n++; } elsif($type =~ /^\[\](.*)/) { # Convert slice into pointer, length. # Have to be careful not to take address of &a[0] if len == 0: # pass dummy pointer in that case. # Used to pass nil, but some OSes or simulators reject write(fd, nil, 0). $text .= "\tvar _p$n unsafe.Pointer\n"; $text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}"; $text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}"; $text .= "\n"; push @args, "uintptr(_p$n)", "uintptr(len($name))"; $n++; } elsif($type eq "int64" && ($openbsd || $netbsd)) { push @args, "0"; if($_32bit eq "big-endian") { push @args, "uintptr($name>>32)", "uintptr($name)"; } elsif($_32bit eq "little-endian") { push @args, "uintptr($name)", "uintptr($name>>32)"; } else { push @args, "uintptr($name)"; } } elsif($type eq "int64" && $dragonfly) { if ($func !~ /^extp(read|write)/i) { push @args, "0"; } if($_32bit eq "big-endian") { push @args, "uintptr($name>>32)", "uintptr($name)"; } elsif($_32bit eq "little-endian") { push @args, "uintptr($name)", "uintptr($name>>32)"; } else { push @args, "uintptr($name)"; } } elsif($type eq "int64" && $_32bit ne "") { if(@args % 2 && $arm) { # arm abi specifies 64-bit argument uses # (even, odd) pair push @args, "0" } if($_32bit eq "big-endian") { push @args, "uintptr($name>>32)", "uintptr($name)"; } else { push @args, "uintptr($name)", "uintptr($name>>32)"; } } else { push @args, "uintptr($name)"; } } # Determine which form to use; pad args with zeros. my $asm = "Syscall"; if ($nonblock) { if ($errvar ne "") { $asm = "RawSyscall"; } else { $asm = "RawSyscallNoError"; } } else { if ($errvar eq "") { $asm = "SyscallNoError"; } } if(@args <= 3) { while(@args < 3) { push @args, "0"; } } elsif(@args <= 6) { $asm .= "6"; while(@args < 6) { push @args, "0"; } } elsif(@args <= 9) { $asm .= "9"; while(@args < 9) { push @args, "0"; } } else { print STDERR "$ARGV:$.: too many arguments to system call\n"; } # System call number. if($sysname eq "") { $sysname = "SYS_$func"; $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar $sysname =~ y/a-z/A-Z/; } # Actual call. my $args = join(', ', @args); my $call = "$asm($sysname, $args)"; # Assign return values. my $body = ""; my @ret = ("_", "_", "_"); my $do_errno = 0; for(my $i=0; $i<@out; $i++) { my $p = $out[$i]; my ($name, $type) = parseparam($p); my $reg = ""; if($name eq "err" && !$plan9) { $reg = "e1"; $ret[2] = $reg; $do_errno = 1; } elsif($name eq "err" && $plan9) { $ret[0] = "r0"; $ret[2] = "e1"; next; } else { $reg = sprintf("r%d", $i); $ret[$i] = $reg; } if($type eq "bool") { $reg = "$reg != 0"; } if($type eq "int64" && $_32bit ne "") { # 64-bit number in r1:r0 or r0:r1. if($i+2 > @out) { print STDERR "$ARGV:$.: not enough registers for int64 return\n"; } if($_32bit eq "big-endian") { $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1); } else { $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i); } $ret[$i] = sprintf("r%d", $i); $ret[$i+1] = sprintf("r%d", $i+1); } if($reg ne "e1" || $plan9) { $body .= "\t$name = $type($reg)\n"; } } if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { $text .= "\t$call\n"; } else { if ($errvar ne "") { $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; } else { $text .= "\t$ret[0], $ret[1] := $call\n"; } } $text .= $body; if ($plan9 && $ret[2] eq "e1") { $text .= "\tif int32(r0) == -1 {\n"; $text .= "\t\terr = e1\n"; $text .= "\t}\n"; } elsif ($do_errno) { $text .= "\tif e1 != 0 {\n"; $text .= "\t\terr = errnoErr(e1)\n"; $text .= "\t}\n"; } $text .= "\treturn\n"; $text .= "}\n\n"; } chomp $text; chomp $text; if($errors) { exit 1; } print <<EOF; // $cmdline // Code generated by the command above; see README.md. DO NOT EDIT. // +build $tags package unix import ( "syscall" "unsafe" ) var _ syscall.Errno $text EOF exit 0;
24.800587
94
0.549959
ed16c607542e9ff0d66325edd15bc085afb59caa
5,928
pl
Perl
examples/inference/barabasiGraph.pl
friguzzi/swish
77a544ecfe4b4ac6585600850e5011ce625adfd5
[ "BSD-2-Clause" ]
9
2015-06-16T00:19:48.000Z
2020-07-13T15:03:29.000Z
examples/inference/barabasiGraph.pl
friguzzi/swish
77a544ecfe4b4ac6585600850e5011ce625adfd5
[ "BSD-2-Clause" ]
2
2016-11-15T17:47:13.000Z
2017-03-03T10:38:13.000Z
examples/inference/barabasiGraph.pl
friguzzi/swish
77a544ecfe4b4ac6585600850e5011ce625adfd5
[ "BSD-2-Clause" ]
6
2016-06-07T11:56:29.000Z
2020-07-13T12:57:19.000Z
:- use_module(library(mcintyre)). :- mc. :- begin_lpad. % The folllowing programs represents a % Barabási Albert preferential attachment model generated % with python library networkx % >>> import networkx as nx % >>> G= nx.barabasi_albert_graph(40,10) % ?- mc_gibbs_sample(path(0,39),path(0,19),1000,P,[mix(100),block(1)]), % P = 0.406 connected(A,B):- edge(A,B). connected(A,B):- edge(B,A). path(Start, End) :- path(Start, End, [Start]). path(End, End, _). path(Start, End, Visited) :- connected(Start, Next), \+ memberchk(Next, Visited), path(Next, End,[Next|Visited]). edge(0,10):0.1. edge(0,11):0.1. edge(0,12):0.1. edge(0,13):0.1. edge(0,14):0.1. edge(0,15):0.1. edge(0,18):0.1. edge(0,19):0.1. edge(0,22):0.1. edge(0,26):0.1. edge(0,27):0.1. edge(0,37):0.1. edge(0,38):0.1. edge(1,10):0.1. edge(1,11):0.1. edge(1,12):0.1. edge(1,13):0.1. edge(1,14):0.1. edge(1,16):0.1. edge(1,18):0.1. edge(1,31):0.1. edge(1,35):0.1. edge(2,10):0.1. edge(2,11):0.1. edge(2,13):0.1. edge(2,15):0.1. edge(2,20):0.1. edge(2,22):0.1. edge(2,25):0.1. edge(2,26):0.1. edge(2,28):0.1. edge(2,31):0.1. edge(2,35):0.1. edge(3,10):0.1. edge(3,11):0.1. edge(3,12):0.1. edge(3,14):0.1. edge(3,15):0.1. edge(3,17):0.1. edge(3,24):0.1. edge(3,30):0.1. edge(3,33):0.1. edge(3,34):0.1. edge(3,35):0.1. edge(3,36):0.1. edge(4,10):0.1. edge(4,11):0.1. edge(4,12):0.1. edge(4,13):0.1. edge(4,14):0.1. edge(4,15):0.1. edge(4,16):0.1. edge(4,17):0.1. edge(4,18):0.1. edge(4,19):0.1. edge(4,22):0.1. edge(4,27):0.1. edge(4,35):0.1. edge(4,39):0.1. edge(5,10):0.1. edge(5,12):0.1. edge(5,13):0.1. edge(5,15):0.1. edge(5,16):0.1. edge(5,17):0.1. edge(5,18):0.1. edge(5,20):0.1. edge(5,21):0.1. edge(5,26):0.1. edge(5,28):0.1. edge(5,30):0.1. edge(5,33):0.1. edge(6,10):0.1. edge(6,11):0.1. edge(6,12):0.1. edge(6,13):0.1. edge(6,14):0.1. edge(6,16):0.1. edge(6,17):0.1. edge(6,19):0.1. edge(6,22):0.1. edge(6,23):0.1. edge(6,24):0.1. edge(6,32):0.1. edge(6,35):0.1. edge(6,36):0.1. edge(6,37):0.1. edge(6,39):0.1. edge(7,10):0.1. edge(7,11):0.1. edge(7,12):0.1. edge(7,16):0.1. edge(7,20):0.1. edge(7,25):0.1. edge(7,26):0.1. edge(8,10):0.1. edge(8,11):0.1. edge(8,13):0.1. edge(8,15):0.1. edge(8,16):0.1. edge(8,17):0.1. edge(8,23):0.1. edge(9,10):0.1. edge(9,11):0.1. edge(9,12):0.1. edge(9,14):0.1. edge(9,15):0.1. edge(9,18):0.1. edge(9,19):0.1. edge(9,20):0.1. edge(9,22):0.1. edge(9,23):0.1. edge(9,24):0.1. edge(9,27):0.1. edge(9,29):0.1. edge(9,30):0.1. edge(9,33):0.1. edge(9,36):0.1. edge(9,38):0.1. edge(9,39):0.1. edge(10,11):0.1. edge(10,12):0.1. edge(10,13):0.1. edge(10,14):0.1. edge(10,15):0.1. edge(10,16):0.1. edge(10,17):0.1. edge(10,18):0.1. edge(10,19):0.1. edge(10,21):0.1. edge(10,23):0.1. edge(10,29):0.1. edge(10,30):0.1. edge(10,33):0.1. edge(10,34):0.1. edge(10,36):0.1. edge(10,37):0.1. edge(10,38):0.1. edge(11,12):0.1. edge(11,13):0.1. edge(11,14):0.1. edge(11,16):0.1. edge(11,17):0.1. edge(11,18):0.1. edge(11,19):0.1. edge(11,20):0.1. edge(11,21):0.1. edge(11,22):0.1. edge(11,23):0.1. edge(11,24):0.1. edge(11,25):0.1. edge(11,26):0.1. edge(11,27):0.1. edge(11,29):0.1. edge(11,30):0.1. edge(11,31):0.1. edge(11,32):0.1. edge(11,33):0.1. edge(12,13):0.1. edge(12,14):0.1. edge(12,15):0.1. edge(12,16):0.1. edge(12,17):0.1. edge(12,20):0.1. edge(12,23):0.1. edge(12,24):0.1. edge(12,25):0.1. edge(12,30):0.1. edge(12,31):0.1. edge(12,34):0.1. edge(12,36):0.1. edge(12,37):0.1. edge(12,39):0.1. edge(13,14):0.1. edge(13,15):0.1. edge(13,17):0.1. edge(13,19):0.1. edge(13,21):0.1. edge(13,24):0.1. edge(13,25):0.1. edge(13,29):0.1. edge(13,36):0.1. edge(13,39):0.1. edge(14,18):0.1. edge(14,19):0.1. edge(14,20):0.1. edge(14,23):0.1. edge(14,25):0.1. edge(14,26):0.1. edge(14,29):0.1. edge(14,32):0.1. edge(14,33):0.1. edge(14,35):0.1. edge(14,37):0.1. edge(14,38):0.1. edge(15,16):0.1. edge(15,18):0.1. edge(15,21):0.1. edge(15,24):0.1. edge(15,25):0.1. edge(15,27):0.1. edge(15,32):0.1. edge(15,34):0.1. edge(15,36):0.1. edge(15,38):0.1. edge(16,17):0.1. edge(16,18):0.1. edge(16,19):0.1. edge(16,20):0.1. edge(16,21):0.1. edge(16,22):0.1. edge(16,23):0.1. edge(16,27):0.1. edge(16,28):0.1. edge(16,31):0.1. edge(16,34):0.1. edge(17,19):0.1. edge(17,21):0.1. edge(17,22):0.1. edge(17,24):0.1. edge(17,26):0.1. edge(17,30):0.1. edge(17,32):0.1. edge(17,38):0.1. edge(18,20):0.1. edge(18,21):0.1. edge(18,22):0.1. edge(18,27):0.1. edge(18,28):0.1. edge(18,30):0.1. edge(18,32):0.1. edge(18,33):0.1. edge(18,35):0.1. edge(18,39):0.1. edge(19,20):0.1. edge(19,21):0.1. edge(19,24):0.1. edge(19,28):0.1. edge(19,29):0.1. edge(19,37):0.1. edge(19,38):0.1. edge(20,21):0.1. edge(20,23):0.1. edge(20,26):0.1. edge(20,27):0.1. edge(20,28):0.1. edge(20,29):0.1. edge(20,30):0.1. edge(20,31):0.1. edge(20,32):0.1. edge(20,37):0.1. edge(21,22):0.1. edge(21,23):0.1. edge(21,25):0.1. edge(21,27):0.1. edge(21,34):0.1. edge(21,35):0.1. edge(22,24):0.1. edge(22,25):0.1. edge(22,28):0.1. edge(22,29):0.1. edge(22,30):0.1. edge(22,34):0.1. edge(23,25):0.1. edge(23,26):0.1. edge(23,31):0.1. edge(23,34):0.1. edge(24,29):0.1. edge(24,33):0.1. edge(24,37):0.1. edge(24,39):0.1. edge(25,26):0.1. edge(25,27):0.1. edge(25,28):0.1. edge(25,29):0.1. edge(25,38):0.1. edge(26,28):0.1. edge(26,31):0.1. edge(26,32):0.1. edge(27,28):0.1. edge(27,31):0.1. edge(27,32):0.1. edge(27,39):0.1. edge(28,31):0.1. edge(28,34):0.1. edge(28,35):0.1. edge(28,36):0.1. edge(28,37):0.1. edge(29,32):0.1. edge(29,33):0.1. edge(29,36):0.1. edge(30,37):0.1. edge(32,33):0.1. edge(32,35):0.1. edge(32,36):0.1. edge(33,34):0.1. edge(33,38):0.1. edge(33,39):0.1. edge(37,38):0.1. edge(37,39):0.1. :- end_lpad.
17.909366
72
0.553644
ed102b732aedc1927f69a1424374f6cd57eff27c
1,981
pm
Perl
auto-lib/Paws/FraudDetector/DetectorVersionSummary.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
164
2015-01-08T14:58:53.000Z
2022-02-20T19:16:24.000Z
auto-lib/Paws/FraudDetector/DetectorVersionSummary.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
348
2015-01-07T22:08:38.000Z
2022-01-27T14:34:44.000Z
auto-lib/Paws/FraudDetector/DetectorVersionSummary.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
87
2015-04-22T06:29:47.000Z
2021-09-29T14:45:55.000Z
# Generated by default/object.tt package Paws::FraudDetector::DetectorVersionSummary; use Moose; has Description => (is => 'ro', isa => 'Str', request_name => 'description', traits => ['NameInRequest']); has DetectorVersionId => (is => 'ro', isa => 'Str', request_name => 'detectorVersionId', traits => ['NameInRequest']); has LastUpdatedTime => (is => 'ro', isa => 'Str', request_name => 'lastUpdatedTime', traits => ['NameInRequest']); has Status => (is => 'ro', isa => 'Str', request_name => 'status', traits => ['NameInRequest']); 1; ### main pod documentation begin ### =head1 NAME Paws::FraudDetector::DetectorVersionSummary =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::FraudDetector::DetectorVersionSummary object: $service_obj->Method(Att1 => { Description => $value, ..., Status => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::FraudDetector::DetectorVersionSummary object: $result = $service_obj->Method(...); $result->Att1->Description =head1 DESCRIPTION The summary of the detector version. =head1 ATTRIBUTES =head2 Description => Str The detector version description. =head2 DetectorVersionId => Str The detector version ID. =head2 LastUpdatedTime => Str Timestamp of when the detector version was last updated. =head2 Status => Str The detector version status. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::FraudDetector> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
25.727273
120
0.724382
73da0aa98c2f95f792ccfad214803cc62c7b7600
459
pl
Perl
tpch/tablescanquery.pl
JaySon-Huang/tidb-bench
6ba0931df7f6c00d546ee4aa0fdc5abf776cbd5a
[ "Apache-2.0" ]
107
2016-08-09T12:00:37.000Z
2022-03-05T06:08:36.000Z
tpch/tablescanquery.pl
JaySon-Huang/tidb-bench
6ba0931df7f6c00d546ee4aa0fdc5abf776cbd5a
[ "Apache-2.0" ]
38
2016-06-22T08:36:58.000Z
2021-08-10T05:53:01.000Z
tpch/tablescanquery.pl
JaySon-Huang/tidb-bench
6ba0931df7f6c00d546ee4aa0fdc5abf776cbd5a
[ "Apache-2.0" ]
81
2015-10-28T07:48:06.000Z
2022-03-29T05:54:03.000Z
#!/usr/bin/perl # # generate a workload with sequential reads by selecting all records from # the eight tables # my $output = "./tablescan.sqls"; open OUTPUT, '>', $output or die "failed to create output file\n$!\n"; print OUTPUT "START TRANSACTION;\n"; my @tables = ("customer", "region", "nation", "part", "partsupp", "supplier", "lineitem", "orders"); foreach my $table (@tables){ print OUTPUT "select * from $table;\n"; } print OUTPUT "COMMIT;\n";
24.157895
77
0.671024
ed19bfc98dde6f63bebafe6494de27b923954688
597
pl
Perl
categories/euler/prob034-quinny.pl
amit1999999/amit1
658755cf1fbfeaebc82124a93054e0695d087d1a
[ "Artistic-2.0" ]
198
2015-01-07T17:07:56.000Z
2019-12-26T17:15:33.000Z
categories/euler/prob034-quinny.pl
amit1999999/amit1
658755cf1fbfeaebc82124a93054e0695d087d1a
[ "Artistic-2.0" ]
44
2015-01-23T08:11:58.000Z
2020-01-12T13:18:02.000Z
categories/euler/prob034-quinny.pl
amit1999999/amit1
658755cf1fbfeaebc82124a93054e0695d087d1a
[ "Artistic-2.0" ]
84
2015-01-19T04:39:20.000Z
2019-12-18T18:02:45.000Z
use v6; =begin pod =TITLE Digit factorials =AUTHOR Quinn Perfetto L<https://projecteuler.net/problem=34> 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. =end pod sub fact ($n) { [*] 1..$n; } sub factDigits ($n is copy) { [+] gather while $n > 0 { take fact $n % 10; $n div= 10; } } say [+] gather for 3...40586 { take $_ if factDigits($_) == $_ } # vim: expandtab shiftwidth=4 ft=perl6
17.057143
88
0.60134
ed2da21e3dd2a877cb94a4b0a1eaae7dab9a2e33
4,392
pm
Perl
lib/MooseX/Role/AttributeOverride/Meta/Trait/Role/Composite.pm
git-the-cpan/MooseX-Role-AttributeOverride
3d07ca7b16418b15f3f25b21d853588e3b99be33
[ "Artistic-1.0" ]
null
null
null
lib/MooseX/Role/AttributeOverride/Meta/Trait/Role/Composite.pm
git-the-cpan/MooseX-Role-AttributeOverride
3d07ca7b16418b15f3f25b21d853588e3b99be33
[ "Artistic-1.0" ]
null
null
null
lib/MooseX/Role/AttributeOverride/Meta/Trait/Role/Composite.pm
git-the-cpan/MooseX-Role-AttributeOverride
3d07ca7b16418b15f3f25b21d853588e3b99be33
[ "Artistic-1.0" ]
null
null
null
# # This file is part of MooseX-Role-AttributeOverride # # This software is copyright (c) 2011 by Edward J. Allen III. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; package MooseX::Role::AttributeOverride::Meta::Trait::Role::Composite; BEGIN { $MooseX::Role::AttributeOverride::Meta::Trait::Role::Composite::VERSION = '0.0.9'; } BEGIN { $MooseX::Role::AttributeOverride::Meta::Trait::Role::Composite::AUTHORITY = 'cpan:EALLENIII'; } # ABSTRACT: Support Role for L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> use 5.008; use utf8; use Moose::Role; use Moose::Util::MetaRole; with 'MooseX::Role::AttributeOverride::Meta::Trait::Role'; around apply_params => sub { my $orig = shift; my $self = shift; $self->$orig(@_); ## no critic (ProhibitCallsToUnexportedSubs); $self = Moose::Util::MetaRole::apply_metaroles( for => $self, role_metaroles => { role => ['MooseX::Role::AttributeOverride::Meta::Trait::Role'], application_to_class => ['MooseX::Role::AttributeOverride::Meta::Trait::Role::ApplicationToClass'], application_to_role => ['MooseX::Role::AttributeOverride::Meta::Trait::Role::ApplicationToRole'], }, ); ## use critic; for my $role (@{$self->get_roles}) { if ($role->can('attribute_modifiers')) { $self->add_modifiers_from_role($role); } } return $self; }; no Moose::Role; 1; # Magic true value required at end of module =pod =for :stopwords Edward Allen <ealleniii_at_cpan_dot_org> J. III =encoding utf-8 =head1 NAME MooseX::Role::AttributeOverride::Meta::Trait::Role::Composite - Support Role for L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =head1 VERSION This document describes v0.0.9 of MooseX::Role::AttributeOverride::Meta::Trait::Role::Composite - released June 29, 2011 as part of MooseX-Role-AttributeOverride. =head1 SYNOPSIS See L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =head1 DESCRIPTION Apply this role to composite roles. =head1 DIAGNOSTICS See L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =head1 DEPENDENCIES See L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =head1 INCOMPATIBILITIES See L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =head1 BUGS AND LIMITATIONS See L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =head1 SEE ALSO Please see those modules/websites for more information related to this module. =over 4 =item * L<MooseX::Role::AttributeOverride|MooseX::Role::AttributeOverride> =back =head1 AUTHOR Edward Allen <ealleniii_at_cpan_dot_org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Edward J. Allen III. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut __END__
29.675676
164
0.73725
73e498de6e53099e54d31c9c733769ad7fa851dd
1,440
pm
Perl
storage/ibm/storwize/ssh/plugin.pm
alenorcy/centreon-plugins
d7603030c24766935ed07e6ebe1082e16d6fdb4a
[ "Apache-2.0" ]
null
null
null
storage/ibm/storwize/ssh/plugin.pm
alenorcy/centreon-plugins
d7603030c24766935ed07e6ebe1082e16d6fdb4a
[ "Apache-2.0" ]
null
null
null
storage/ibm/storwize/ssh/plugin.pm
alenorcy/centreon-plugins
d7603030c24766935ed07e6ebe1082e16d6fdb4a
[ "Apache-2.0" ]
null
null
null
# # 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::ibm::storwize::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} = '1.0'; %{$self->{modes}} = ( 'components' => 'storage::ibm::storwize::ssh::mode::hardware', 'eventlog' => 'storage::ibm::storwize::ssh::mode::eventlog', 'pool-usage' => 'storage::ibm::storwize::ssh::mode::poolusage', ); return $self; } 1; __END__ =head1 PLUGIN DESCRIPTION Check IBM Storwize (v3700, v5000, v7000, SAN Volume Controller) in SSH. =cut
28.235294
74
0.693056
73f1e0edcbb9859972b8393e96482e68a4581884
222
pl
Perl
about_logic_codes.pl
TrentonZero/prolog-koans
b5fa3b181fb4adfd98ab8713254c1661d1b7784f
[ "Apache-2.0" ]
9
2016-04-12T07:52:39.000Z
2021-11-02T05:42:14.000Z
about_logic_codes.pl
TrentonZero/prolog-koans
b5fa3b181fb4adfd98ab8713254c1661d1b7784f
[ "Apache-2.0" ]
null
null
null
about_logic_codes.pl
TrentonZero/prolog-koans
b5fa3b181fb4adfd98ab8713254c1661d1b7784f
[ "Apache-2.0" ]
9
2015-06-25T19:04:47.000Z
2021-03-12T21:52:03.000Z
:- module(about_logic_codes,[and/2, or/2, nand/2, nor/2, xor/2, impl/2, equ/2]). and(_,_) :- false. or(_,_) :- false. nand(_,_) :- false. nor(_,_) :- false. xor(_,_) :- false. impl(_,_) :- false. equ(_,_) :- false.
13.875
80
0.554054
73fa6e37fefd2a3d00659cd67bba68a19f8ede3c
1,808
pm
Perl
lib/Google/Ads/AdWords/v201809/AdGroupCriterionService/queryResponse.pm
googleads/googleads-perl-lib
69e66d7e46fbd8ad901581b108ea6c14212701cf
[ "Apache-2.0" ]
4
2015-04-23T01:59:40.000Z
2021-10-12T23:14:36.000Z
lib/Google/Ads/AdWords/v201809/AdGroupCriterionService/queryResponse.pm
googleads/googleads-perl-lib
69e66d7e46fbd8ad901581b108ea6c14212701cf
[ "Apache-2.0" ]
23
2015-02-19T17:03:58.000Z
2019-07-01T10:15:46.000Z
lib/Google/Ads/AdWords/v201809/AdGroupCriterionService/queryResponse.pm
googleads/googleads-perl-lib
69e66d7e46fbd8ad901581b108ea6c14212701cf
[ "Apache-2.0" ]
10
2015-08-03T07:51:58.000Z
2020-09-26T16:17:46.000Z
package Google::Ads::AdWords::v201809::AdGroupCriterionService::queryResponse; use strict; use warnings; { # BLOCK to scope variables sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201809' } __PACKAGE__->__set_name('queryResponse'); __PACKAGE__->__set_nillable(); __PACKAGE__->__set_minOccurs(); __PACKAGE__->__set_maxOccurs(); __PACKAGE__->__set_ref(); use base qw( SOAP::WSDL::XSD::Typelib::Element Google::Ads::SOAP::Typelib::ComplexType ); our $XML_ATTRIBUTE_CLASS; undef $XML_ATTRIBUTE_CLASS; sub __get_attr_class { return $XML_ATTRIBUTE_CLASS; } use Class::Std::Fast::Storable constructor => 'none'; use base qw(Google::Ads::SOAP::Typelib::ComplexType); { # BLOCK to scope variables my %rval_of :ATTR(:get<rval>); __PACKAGE__->_factory( [ qw( rval ) ], { 'rval' => \%rval_of, }, { 'rval' => 'Google::Ads::AdWords::v201809::AdGroupCriterionPage', }, { 'rval' => 'rval', } ); } # end BLOCK } # end of BLOCK 1; =pod =head1 NAME Google::Ads::AdWords::v201809::AdGroupCriterionService::queryResponse =head1 DESCRIPTION Perl data type class for the XML Schema defined element queryResponse from the namespace https://adwords.google.com/api/adwords/cm/v201809. =head1 PROPERTIES The following properties may be accessed using get_PROPERTY / set_PROPERTY methods: =over =item * rval $element->set_rval($data); $element->get_rval(); =back =head1 METHODS =head2 new my $element = Google::Ads::AdWords::v201809::AdGroupCriterionService::queryResponse->new($data); Constructor. The following data structure may be passed to new(): { rval => $a_reference_to, # see Google::Ads::AdWords::v201809::AdGroupCriterionPage }, =head1 AUTHOR Generated by SOAP::WSDL =cut
15.193277
97
0.69469
ed043af86e553f75c14d535b6e555e78dd43fc8f
498
pm
Perl
auto-lib/Paws/GroundStation/DataflowEndpointGroupIdResponse.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
164
2015-01-08T14:58:53.000Z
2022-02-20T19:16:24.000Z
auto-lib/Paws/GroundStation/DataflowEndpointGroupIdResponse.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
348
2015-01-07T22:08:38.000Z
2022-01-27T14:34:44.000Z
auto-lib/Paws/GroundStation/DataflowEndpointGroupIdResponse.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
87
2015-04-22T06:29:47.000Z
2021-09-29T14:45:55.000Z
package Paws::GroundStation::DataflowEndpointGroupIdResponse; use Moose; has DataflowEndpointGroupId => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'dataflowEndpointGroupId'); has _request_id => (is => 'ro', isa => 'Str'); 1; ### main pod documentation begin ### =head1 NAME Paws::GroundStation::DataflowEndpointGroupIdResponse =head1 ATTRIBUTES =head2 DataflowEndpointGroupId => Str UUID of a dataflow endpoint group. =head2 _request_id => Str =cut
17.785714
132
0.714859
73f32fecad2b1f1633bd6f3b0c76e0f88b5fdd4a
30,436
pm
Perl
perl-lib/OESS/lib/OESS/NSI/Reservation.pm
ayjazz/OESS
deadc504d287febc7cbd7251ddb102bb5c8b1f04
[ "Apache-2.0" ]
null
null
null
perl-lib/OESS/lib/OESS/NSI/Reservation.pm
ayjazz/OESS
deadc504d287febc7cbd7251ddb102bb5c8b1f04
[ "Apache-2.0" ]
null
null
null
perl-lib/OESS/lib/OESS/NSI/Reservation.pm
ayjazz/OESS
deadc504d287febc7cbd7251ddb102bb5c8b1f04
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/perl # ##----- D-Bus OESS NSI Reservation State Machine ##----- ##----- Handles NSI Reservation Requests #--------------------------------------------------------------------- # # Copyright 2015 Trustees of Indiana University # # 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 OESS::NSI::Reservation; $ENV{CRYPT_SSLEAY_CIPHER} = 'ALL'; use strict; use warnings; use SOAP::Lite on_action => sub { sprintf '"http://schemas.ogf.org/nsi/2013/12/connection/service/%s"', $_[1]}; use GRNOC::Log; use GRNOC::Config; use GRNOC::WebService::Client; use OESS::NSI::Constant; use OESS::NSI::Utils; use DateTime; use OESS::Database; use Data::Dumper; =head2 new =cut sub new { my $caller = shift; my $class = ref($caller); $class = $caller if(!$class); my $self = { 'config_file' => undef, @_ }; bless($self,$class); $self->_init(); return $self; } sub _parseTime{ my $time = shift; if(!defined($time) || $time eq ''){ return -1; } log_debug("parsingTime: " . $time); #here are some examples #2015-08-15T10:30:10.000Z #2015-10-22T20:33:00.000-07:00 $time =~ /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d)\:(\d\d):(\d\d)(.*)/; #\.\d\d\d(.*)/; my $year = $1; my $month = $2; my $day = $3; my $hour = $4; my $min = $5; my $sec = $6; log_debug("Time: " . $year . "-" . $month . "-" . $day . "T" . $hour . ":" . $min); my $tz = $7; log_debug("TZ: " . $tz); #handle the ms if they exist... $tz =~ s/\.\d\d\d//g; if($tz eq 'Z'){ $tz = "UTC"; }else{ $tz =~ s/\://g; } log_debug("Cleaned TZ: " .$tz); my $dt; eval{ $dt = DateTime->new( year => $year, month => $month, day => $day, hour => $hour, minute => $min, time_zone => $tz ); }; warn() if $@; log_debug("DateTime object created!"); return $dt->epoch(); } =head2 reserve =cut sub reserve { my ($self, $args) = @_; my $connection_id = $args->{'connectionId'}; my $gri = $args->{'gri'}; my $description = $args->{'description'}; my $start_time = _parseTime($args->{'criteria'}->{'schedule'}->{'startTime'}); my $end_time = _parseTime($args->{'criteria'}->{'schedule'}->{'endTime'}); my $source_stp = $args->{'criteria'}->{'p2ps'}->{'sourceSTP'}; my $dest_stp = $args->{'criteria'}->{'p2ps'}->{'destSTP'}; my $directionality = $args->{'criteria'}->{'p2ps'}->{'directionality'}; my $capacity = $args->{'criteria'}->{'p2ps'}->{'capacity'}; my $reply_to = $args->{'header'}->{'replyTo'}; log_info("new reservation request: Requester " . $args->{'header'}->{'requesterNSA'} . " sourceSTP: " . $source_stp . " destSTP: " . $dest_stp . " description: " . $description . " gri: " . $gri); if(!$description || !$source_stp || !$dest_stp || !$reply_to){ log_info("reservation request missing some parameters!"); push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::MISSING_REQUEST_PARAMETERS; } my $ep1 = $self->get_endpoint(stp => $source_stp); if(!defined($ep1)){ log_error("Unable to find sourceSTP: " . $source_stp . " in OESS"); $args->{'fail_text'} = "Unable to parse source STP"; push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::RESERVATION_FAIL; } my $ep2 = $self->get_endpoint(stp => $dest_stp); if(!defined($ep2)){ log_error("Unable to find destSTP: " . $dest_stp . " in OESS"); $args->{'fail_text'} = "Unable to parse dest STP"; push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::RESERVATION_FAIL; } if(!$self->validate_endpoint($ep1)){ log_error("sourceSTP $source_stp is not allowed for NSI"); $args->{'fail_text'} = "Source STP $source_stp not allowed for NSI workgroup"; push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::RESERVATION_FAIL; } if(!$self->validate_endpoint($ep2)){ log_error("destSTP $dest_stp is not allowed for NSI"); $args->{'fail_text'} = "destSTP $dest_stp is not allowed for NSI workgroup"; push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::RESERVATION_FAIL; } my $primary_path = $self->get_shortest_path($ep1, $ep2, []); if(!defined($primary_path)){ log_error("Unable to connect $source_stp and $dest_stp"); $args->{'fail_text'} = "no path exists connecting both source and destination STP"; push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::RESERVATION_FAIL; } my $backup_path = $self->get_shortest_path($ep1, $ep2, $primary_path); $self->{'websvc'}->set_url($self->{'websvc_location'} . "provisioning.cgi"); my $res = $self->{'websvc'}->foo( action => "provision_circuit", state => 'reserved', workgroup_id => $self->{'workgroup_id'}, external_identifier => $gri, description => $description, bandwidth => $capacity, provision_time => $start_time, remove_time => $end_time, link => $primary_path, backup_link => $backup_path, remote_url => $args->{'header'}->{'replyTo'}, remote_requester => $args->{'header'}->{'requesterNSA'}, node => [$ep1->{'node'}, $ep2->{'node'}], interface => [$ep1->{'port'}, $ep2->{'port'}], tag => [$ep1->{'vlan'}, $ep2->{'vlan'}]); log_error("Results of provision: " . Data::Dumper::Dumper($res)); if(defined($res->{'results'}) && $res->{'results'}->{'success'} == 1){ log_info("Successfully created reservation, connectionId: " . $res->{'results'}->{'circuit_id'}); $args->{'connection_id'} = $res->{'results'}->{'circuit_id'}; $args->{'criteria'}->{'p2ps'}->{'sourceSTP'} = $self->build_stp($ep1); $args->{'criteria'}->{'p2ps'}->{'destSTP'} = $self->build_stp($ep2); push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_SUCCESS, connection_id => $res->{'results'}->{'circuit_id'}, args => $args}); push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_TIMEOUT, connection_id => $res->{'results'}->{'circuit_id'}, args => $args, time => time() + OESS::NSI::Constant::RESERVATION_TIMEOUT_SEC}); return $res->{'results'}->{'circuit_id'}; }else{ log_error("Unable to reserve circuit: " . $res->{'error'}); $args->{'fail_text'} = "Error creating reservation record: " . $res->{'error'}; push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_FAIL, connection_id => 9999999, args => $args}); return OESS::NSI::Constant::RESERVATION_FAIL; } } =head2 reserveAbort =cut sub reserveAbort{ my ($self, $args) = @_; my $connection_id = $args->{'connectionId'}; if(!defined($connection_id) || $connection_id eq ''){ return OESS::NSI::Constant::MISSING_REQUEST_PARAMETERS; } push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::DO_RESERVE_ABORT, args => $args}); return OESS::NSI::Constant::SUCCESS; } sub _do_reserve_abort{ my ($self, $data) = @_; my $connection_id = $data->{'connectionId'}; log_info("reservationAbort: connectionId: " . $connection_id); $self->{'websvc'}->set_url($self->{'websvc_location'} . "/provisioning.cgi"); my $res = $self->{'websvc'}->foo( action => "remove_circuit", circuit_id => $connection_id, workgroup_id => $self->{'workgroup_id'}, remove_time => -1); if(defined($res) && defined($res->{'results'})){ log_info("reservationAbort successfull: connectionId: " . $connection_id); my $soap = OESS::NSI::Utils::build_client( proxy => $data->{'header'}->{'replyTo'}, ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); my $soap_response; eval{ $soap_response = $soap->reserveAbortConfirmed($nsiheader, SOAP::Data->name(connectionId => $connection_id)->type('')); }; log_debug("Response: " . Data::Dumper::Dumper($soap_response)); log_error("Error sending SOAP confirmation: " . Data::Dumper::Dumper($soap_response) . " " . Data::Dumper::Dumper($@)) if defined($@); return; } log_error("Unable to remove circuit: " . $res->{'error'}); return OESS::NSI::Constant::ERROR; } =head2 build_stp =cut sub build_stp{ my $self = shift; my $ep = shift; #example urn:ogf:network:nsi.nddi-dev.bldc.net.internet2.edu:2013::s1:1-0:+ my $str = "urn:ogf:network:nsi."; $str .= $self->{'db'}->get_local_domain_name(); $str .= ":2013::" . $ep->{'node'} . ":" . $ep->{'port'} . ":" . $ep->{'link'} . "?vlan=" . $ep->{'vlan'}; return $str; } =head2 get_endpoint =cut sub get_endpoint{ my $self = shift; my %params = @_; if(!defined($params{'stp'})){ log_error("get_endpoint: stp is undefined"); return; } my $stp = $params{'stp'}; #example URN urn:ogf:network:nsi.nddi-dev.bldc.net.internet2.edu:2013::s1:1-0:+ my @parts = split(':',$stp); my $domain = $parts[3]; my $node = $parts[6]; my $interface = $parts[7]; my $link = $parts[8]; $link =~ /(.*)\?vlan=(.*)/; $link = $1; my $vlan = $2; #lots of options here #1-2000,3000-4000 my @vlans = split(',',$vlan); my @tags; foreach my $vlan (@vlans){ if($vlan =~ /(\d+)-(\d+)/){ my $start = $1; my $end = $2; if($end > 4095){ log_error("VLAN tag " . $end . " is > max VLAN tag 4095"); return; } for(my $i=$start;$i<=$end;$i++){ push(@tags,int($i)); } }else{ log_error("VLAN: " . $vlan); push(@tags, int($vlan)); } } log_debug("Tags: " . Data::Dumper::Dumper(@tags)); if(!defined($domain) || !defined($node) || !defined($interface) || scalar(@tags) < 0){ log_error("Error processing URN $stp, missing some important pieces"); return; } return { node => $node, port => $interface, tags => \@tags, domain => $domain, link => $link }; } =head2 validate_endpoint =cut sub validate_endpoint{ my $self = shift; my $ep = shift; #need to verify this is part of our network and actually exists and that we have permission! $self->{'websvc'}->set_url($self->{'websvc_location'} . "data.cgi"); log_debug("Checking validity of EP: " . Data::Dumper::Dumper($ep)); log_debug("requesting all resources for NSI workgroup"); my $res = $self->{'websvc'}->foo( action => "get_all_resources_for_workgroup", workgroup_id => $self->{'workgroup_id'}); if(defined($res) && defined($res->{'results'})){ foreach my $resource (@{$res->{'results'}}){ if($resource->{'node_name'} eq $ep->{'node'}){ if($resource->{'interface_name'} eq $ep->{'port'}){ log_debug("Found interface for requested EP, requesting VLAN availability"); #made it this far! foreach my $tag (@{$ep->{'tags'}}){ my $valid_tag = $self->{'websvc'}->foo( action => "is_vlan_tag_available", interface => $ep->{'port'}, node => $ep->{'node'}, vlan => $tag, workgroup_id => $self->{'workgroup_id'}); log_debug("Results from is valid tag: " . Data::Dumper::Dumper($valid_tag)); if(defined($valid_tag) && $valid_tag->{'results'}){ log_debug("results from is_vlan_tag_available: " . Data::Dumper::Dumper($valid_tag->{'results'})); if($valid_tag->{'results'}->[0]->{'available'} == 1){ $ep->{'vlan'} = $tag; return 1; } } } return 0; } } } }else{ log_error("Unable to fetch workgroup resources" . Data::Dumper::Dumper($res)); return 0; } log_error("not a valid endpoint, or not allowed via NSI workgroup"); return 0; } =head2 get_shortest_path =cut sub get_shortest_path{ my $self = shift; my $ep1 = shift; my $ep2 = shift; my $links = shift; $self->{'websvc'}->set_url($self->{'websvc_location'} . "data.cgi"); my $shortest_path = $self->{'websvc'}->foo( action => "get_shortest_path", node => [$ep1->{'node'},$ep2->{'node'}], link => $links); log_debug("Shortest path: " . Data::Dumper::Dumper($shortest_path)); if(defined($shortest_path) && defined($shortest_path->{'results'})){ my @links = (); foreach my $link (@{$shortest_path->{'results'}}){ push(@links,$link->{'link'}); } return \@links; } log_error("unable to find path"); return; } =head2 reserveCommit =cut sub reserveCommit{ my ($self, $args) = @_; log_info("reserveCommit: connectionId: " . $args->{'connectionId'}); my $i=0; foreach my $event (@{$self->{'reservation_queue'}}){ if($event->{'type'} == OESS::NSI::Constant::RESERVATION_TIMEOUT && $event->{'connection_id'} == $args->{'connectionId'}){ my $res = splice(@{$self->{'reservation_queue'}}, $i, 1); push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_COMMIT_CONFIRMED, args => $args}); return OESS::NSI::Constant::SUCCESS; } $i++; } push(@{$self->{'reservation_queue'}}, {type => OESS::NSI::Constant::RESERVATION_COMMIT_FAILED, args => $args}); } =head2 process_queue =cut sub process_queue { my ($self) = @_; log_debug("Processing Reservation Queue"); my @still_needs_to_be_done; while(my $message = shift(@{$self->{'reservation_queue'}})){ my $type = $message->{'type'}; warn Data::Dumper::Dumper($message); #this is now a scheduler... skip the action if it has a time and we aren't past it yet if(defined($message->{'time'}) && time() < $message->{'time'}){ #log_error("TIME: " . $message->{'time'} . " vs. " . time()); push(@still_needs_to_be_done, $message); next; } #ok pull it off the array if($type == OESS::NSI::Constant::RESERVATION_SUCCESS){ log_debug("Handling Reservation Success Message"); my $connection_id = $message->{'connection_id'}; $self->_reserve_confirmed($message->{'args'}, $connection_id); next; }elsif($type == OESS::NSI::Constant::RESERVATION_FAIL){ log_debug("Handling Reservation Fail Message"); $self->_reserve_failed($message->{'args'}); next; }elsif($type == OESS::NSI::Constant::RESERVATION_TIMEOUT){ log_info("Reservation Timeout: " . $message->{'connection_id'}); $self->_reserve_timeout($message->{'args'}); }elsif($type == OESS::NSI::Constant::RESERVATION_COMMIT_CONFIRMED){ log_debug("handling reservation commit success"); $self->_reserve_commit_confirmed($message->{'args'}); next; }elsif($type == OESS::NSI::Constant::RESERVATION_COMMIT_FAILED){ log_debug("handling reservation commit failed"); $self->_reserve_commit_failed($message->{'args'}); next; }elsif($type == OESS::NSI::Constant::DO_RESERVE_ABORT){ log_debug("handling reservation abort"); $self->_do_reserve_abort($message->{'args'}); next; }else{ log_error("Unknown message type: " . $type); next; } } #anything that still needs to be done is pushed back onto the stack foreach my $event (@still_needs_to_be_done){ push(@{$self->{'reservation_queue'}}, $event); } } sub _reserve_commit_failed{ my ($self, $data) = @_; log_error("Error commiting reservation"); my $soap = OESS::NSI::Utils::build_client( proxy => $data->{'header'}->{'replyTo'}, ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); eval{ my $soap_response = $soap->reserveCommitFailed($nsiheader, SOAP::Data->name(connectionId => $data->{'connection_id'})->type(''), $self->_build_connection_states( reservationState => 'ReserveFailed', provisionState => 'released', lifecycleState => 'Created', dataPlaneStatus => { active => 'false', version => $data->{'criteria'}->{'version'}->{'version'}, versionConsistent => 'true'}), $self->_build_service_exception( nsaId => $data->{'header'}->{'providerNSI'}, connectionId => $data->{'connectionId'}, serviceType => $data->{'criteria'}->{'serviceType'}, errorId => 999, text => "reservation has already expired!")); }; log_error("Error sending reserveCommitFailed message: " . Data::Dumper::Dumper($@)) if $@; } sub _build_p2ps{ my $p2ps = shift; return SOAP::Data->name( p2ps => \SOAP::Data->value( SOAP::Data->name( capacity => $p2ps->{'capacity'} )->type(''), SOAP::Data->name( directionality => $p2ps->{'directionality'} )->type(''), SOAP::Data->name( sourceSTP => $p2ps->{'sourceSTP'} )->type(''), SOAP::Data->name( destSTP => $p2ps->{'destSTP'} )->type('')))->uri('http://schemas.ogf.org/nsi/2013/12/services/point2point'); } sub _build_schedule{ my $schedule = shift; if($schedule->{'startTime'} ne ''){ return SOAP::Data->name( schedule => \SOAP::Data->value( SOAP::Data->name( startTime => $schedule->{'startTime'})->type(''), SOAP::Data->name( endTime => $schedule->{'endTime'})->type(''))); } return SOAP::Data->name( schedule => \SOAP::Data->value( SOAP::Data->name( endTime => $schedule->{'endTime'} )->type(''))); } sub _build_criteria{ my $criteria = shift; return SOAP::Data->name(criteria => \SOAP::Data->value( _build_schedule( $criteria->{'schedule'}), SOAP::Data->name( serviceType => $criteria->{'serviceType'}->{'type'})->type(''), _build_p2ps( $criteria->{'p2ps'} ) ))->attr({ version => $criteria->{'version'}->{'version'}++}); } sub _reserve_confirmed { my ($self, $data, $connection_id) = @_; log_debug("Sending Reservation Confirmation"); my $soap = OESS::NSI::Utils::build_client( proxy => $data->{'header'}->{'replyTo'}, ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); eval{ my $soap_response = $soap->reserveConfirmed($nsiheader, SOAP::Data->name(connectionId => $connection_id)->type(''), SOAP::Data->name(globalReservationId => $data->{'globalReservationId'})->type(''), SOAP::Data->name(description => $data->{'description'})->type(''), _build_criteria($data->{'criteria'}) ); }; log_error("Error sending reserveConfirmed message: " .Data::Dumper::Dumper($@)) if $@; } sub _reserve_commit_confirmed{ my ($self, $data) = @_; my $soap = OESS::NSI::Utils::build_client( proxy =>$data->{'header'}->{'replyTo'},ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); eval{ my $soap_response = $soap->reserveCommitConfirmed($nsiheader, SOAP::Data->name(connectionId => $data->{'connectionId'})->type('')); }; log_error("Error sending reserveCommitConfirmed message: " .Data::Dumper::Dumper($@)) if $@; } sub _build_service_exception{ my $self = shift; my %params = @_; my $exception = SOAP::Data->name( serviceException => \SOAP::Data->value( SOAP::Data->name( nsaId => $params{'nsaid'})->type(''), SOAP::Data->name( connectionId => $params{'connectionId'})->type(''), SOAP::Data->name( serviceType => $params{'serviceType'}->{'type'})->type(''), SOAP::Data->name( errorId => $params{'errorId'})->type(''), SOAP::Data->name( text => $params{'text'})->type(''))); return $exception; } sub _build_connection_states{ my $self = shift; my %params = @_; my $connection_state = SOAP::Data->name( connectionStates => \SOAP::Data->value( SOAP::Data->name( reservationState => $params{'reservationState'})->type(''), SOAP::Data->name( provisionState => $params{'provisionState'})->type(''), SOAP::Data->name( lifecycleState => $params{'lifecycleState'})->type(''), SOAP::Data->name( dataPlaneStatus => \SOAP::Data->value( SOAP::Data->name( active => $params{'dataPlaneStatus'}->{'active'})->type(''), SOAP::Data->name( version => $params{'dataPlaneStatus'}->{'version'})->type(''), SOAP::Data->name( versionConsistent => $params{'dataPlaneStatus'}->{'versionConsistent'})->type(''))))); return $connection_state; } sub _reserve_failed { my ($self, $data) = @_; log_debug("Sending reserve Failed!\n"); log_error("Error reserving circuit... sending reserveFailed message"); my $soap = OESS::NSI::Utils::build_client( proxy =>$data->{'header'}->{'replyTo'},ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); eval{ my $soap_response = $soap->reserveFailed($nsiheader, SOAP::Data->name(connectionId => $data->{'connectionId'})->type(''), $self->_build_service_exception( nsaId => $data->{'header'}->{'providerNSI'}, connectionId => $data->{'connectionId'}, serviceType => $data->{'criteria'}->{'serviceType'}, errorId => 999, text => $data->{'fail_text'}), $self->_build_connection_states( reservationState => 'ReserveFailed', provisionState => 'released', lifecycleState => 'Created', dataPlaneStatus => { active => 'false', version => $data->{'criteria'}->{'version'}->{'version'}, versionConsistent => 'true'})); }; log_error("Error sending reserveFailed: " . Data::Dumper::Dumper($@)) if $@; } sub _init { my ($self) = @_; log_debug("Creating new Config object from $self->{'config_file'}"); my $config = new GRNOC::Config( 'config_file' => $self->{'config_file'}, 'force_array' => 0 ); $self->{'config'} = $config; log_debug("Creating new WebService Client object"); my $websvc = new GRNOC::WebService::Client( 'cookieJar' => '/tmp/oess-nsi-cookies.dat', 'debug' => $self->{'debug'} ); $self->{'websvc'} = $websvc; $self->{'websvc_user'} = $self->{'config'}->get('/config/oess-service/@username'); $self->{'websvc_pass'} = $self->{'config'}->get('/config/oess-service/@password'); $self->{'websvc_realm'} = $self->{'config'}->get('/config/oess-service/@realm'); $self->{'websvc_location'} = $self->{'config'}->get('/config/oess-service/@web-service'); $self->{'websvc'}->set_credentials( 'uid' => $self->{'websvc_user'}, 'passwd' => $self->{'websvc_pass'}, 'realm' => $self->{'websvc_realm'} ); $self->{'ssl'} = $self->{'config'}->get('/config/ssl'); if(defined($self->{'ssl'}->{'enabled'}) && $self->{'ssl'}->{'enabled'} ne '' && $self->{'ssl'}->{'enabled'} eq 'true'){ $self->{'ssl'}->{'enabled'} = 1; } $self->{'db'} = OESS::Database->new(); $self->{'workgroup_id'} = $self->{'config'}->get('/config/oess-service/@workgroup-id'); $self->{'reservation_queue'} = []; } sub _release_confirmed{ my ($self, $data) = @_; log_info(" releaseConfirmed: connectionId" . $data->{'connectionId'}); my $soap = OESS::NSI::Utils::build_client( proxy =>$data->{'header'}->{'replyTo'},ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); eval{ my $soap_response = $soap->releaseConfirmed($nsiheader, SOAP::Data->name(connectionId => $data->{'connectionId'})->type('')); }; log_error("Error sending releaseConfirmed: " . Data::Dumper::Dumper($@)) if $@; } sub _reserve_timeout{ my ($self, $data) = @_; $self->{'websvc'}->set_url($self->{'websvc_location'} . "provisioning.cgi"); my $res = $self->{'websvc'}->foo( action => "remove_circuit", circuit_id => $data->{'connection_id'}, workgroup_id => $self->{'workgroup_id'}); my $soap = OESS::NSI::Utils::build_client( proxy =>$data->{'header'}->{'replyTo'},ssl => $self->{'ssl'}); my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'}); eval{ my $soap_response = $soap->reserveTimeout($nsiheader, SOAP::Data->name( connectionId => $data->{'connection_id'})->type(''), SOAP::Data->name( notificationId => 0)->type(''), SOAP::Data->name( timeStamp => _timestampNow() )->type(''), SOAP::Data->name( originatingConnectionId => $data->{'connection_id'})->type(''), SOAP::Data->name( originatingNSA => $data->{'header'}->{'providerNSA'})->type('')); }; log_error("Error sending reserveTimeout: " . Data::Dumper::Dumper($@)) if $@; } sub _timestampNow{ my $dt = DateTime->now(); return $dt->strftime( "%F" ) . "T" . $dt->strftime( "%T" ) . "Z"; } 1;
40.527297
228
0.496879
ed2f183db07cb7afc5240f4e5469d20c2e6b332d
5,603
pm
Perl
lib/Moose/Meta/TypeCoercion.pm
gitpan/Moose
d9db9b5a8ad6b46c22f2032fc02cd03818a6cd1a
[ "Artistic-1.0" ]
null
null
null
lib/Moose/Meta/TypeCoercion.pm
gitpan/Moose
d9db9b5a8ad6b46c22f2032fc02cd03818a6cd1a
[ "Artistic-1.0" ]
null
null
null
lib/Moose/Meta/TypeCoercion.pm
gitpan/Moose
d9db9b5a8ad6b46c22f2032fc02cd03818a6cd1a
[ "Artistic-1.0" ]
null
null
null
package Moose::Meta::TypeCoercion; our $VERSION = '2.1403'; use strict; use warnings; use metaclass; use Moose::Meta::Attribute; use Moose::Util::TypeConstraints (); use Moose::Util 'throw_exception'; __PACKAGE__->meta->add_attribute('type_coercion_map' => ( reader => 'type_coercion_map', default => sub { [] }, Class::MOP::_definition_context(), )); __PACKAGE__->meta->add_attribute( Moose::Meta::Attribute->new('type_constraint' => ( reader => 'type_constraint', weak_ref => 1, Class::MOP::_definition_context(), )) ); # private accessor __PACKAGE__->meta->add_attribute('compiled_type_coercion' => ( accessor => '_compiled_type_coercion', Class::MOP::_definition_context(), )); sub new { my $class = shift; my $self = Class::MOP::class_of($class)->new_object(@_); $self->compile_type_coercion; return $self; } sub compile_type_coercion { my $self = shift; my @coercion_map = @{$self->type_coercion_map}; my @coercions; while (@coercion_map) { my ($constraint_name, $action) = splice(@coercion_map, 0, 2); my $type_constraint = ref $constraint_name ? $constraint_name : Moose::Util::TypeConstraints::find_or_parse_type_constraint($constraint_name); unless ( defined $type_constraint ) { throw_exception( CouldNotFindTypeConstraintToCoerceFrom => constraint_name => $constraint_name, instance => $self ); } push @coercions => [ $type_constraint->_compiled_type_constraint, $action ]; } $self->_compiled_type_coercion(sub { my $thing = shift; foreach my $coercion (@coercions) { my ($constraint, $converter) = @$coercion; if ($constraint->($thing)) { local $_ = $thing; return $converter->($thing); } } return $thing; }); } sub has_coercion_for_type { my ($self, $type_name) = @_; my %coercion_map = @{$self->type_coercion_map}; exists $coercion_map{$type_name} ? 1 : 0; } sub add_type_coercions { my ($self, @new_coercion_map) = @_; my $coercion_map = $self->type_coercion_map; my %has_coercion = @$coercion_map; while (@new_coercion_map) { my ($constraint_name, $action) = splice(@new_coercion_map, 0, 2); if ( exists $has_coercion{$constraint_name} ) { throw_exception( CoercionAlreadyExists => constraint_name => $constraint_name, instance => $self ); } push @{$coercion_map} => ($constraint_name, $action); } # and re-compile ... $self->compile_type_coercion; } sub coerce { $_[0]->_compiled_type_coercion->($_[1]) } 1; # ABSTRACT: The Moose Type Coercion metaclass __END__ =pod =encoding UTF-8 =head1 NAME Moose::Meta::TypeCoercion - The Moose Type Coercion metaclass =head1 VERSION version 2.1403 =head1 DESCRIPTION A type coercion object is basically a mapping of one or more type constraints and the associated coercions subroutines. It's unlikely that you will need to instantiate an object of this class directly, as it's part of the deep internals of Moose. =head1 METHODS =over 4 =item B<< Moose::Meta::TypeCoercion->new(%options) >> Creates a new type coercion object, based on the options provided. =over 8 =item * type_constraint This is the L<Moose::Meta::TypeConstraint> object for the type that is being coerced I<to>. =back =item B<< $coercion->type_coercion_map >> This returns the map of type constraints to coercions as an array reference. The values of the array alternate between type names and subroutine references which implement the coercion. The value is an array reference because coercions are tried in the order they are added. =item B<< $coercion->type_constraint >> This returns the L<Moose::Meta::TypeConstraint> that was passed to the constructor. =item B<< $coercion->has_coercion_for_type($type_name) >> Returns true if the coercion can coerce the named type. =item B<< $coercion->add_type_coercions( $type_name => $sub, ... ) >> This method takes a list of type names and subroutine references. If the coercion already has a mapping for a given type, it throws an exception. Coercions are actually =item B<< $coercion->coerce($value) >> This method takes a value and applies the first valid coercion it finds. This means that if the value could belong to more than type in the coercion object, the first coercion added is used. =item B<< Moose::Meta::TypeCoercion->meta >> This will return a L<Class::MOP::Class> instance for this class. =back =head1 BUGS See L<Moose/BUGS> for details on reporting bugs. =head1 AUTHORS =over 4 =item * Stevan Little <stevan.little@iinteractive.com> =item * Dave Rolsky <autarch@urth.org> =item * Jesse Luehrs <doy@tozt.net> =item * Shawn M Moore <code@sartak.org> =item * יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> =item * Karen Etheridge <ether@cpan.org> =item * Florian Ragwitz <rafl@debian.org> =item * Hans Dieter Pearcey <hdp@weftsoar.net> =item * Chris Prather <chris@prather.org> =item * Matt S Trout <mst@shadowcat.co.uk> =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2006 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut
22.963115
150
0.662859
ed1a5e1eb31cbbe71329ad8d0d81dfcf654cdf62
1,165
pm
Perl
deps/kb_meme/meme-5.0.1/scripts/HypergeometricDynProg.pm
kbasecollaborations/MotifFinderSampler
d4dc67aef5fb52990310c3811535bde405afae93
[ "MIT" ]
1
2019-07-19T04:33:41.000Z
2019-07-19T04:33:41.000Z
deps/kb_meme/meme-5.0.1/scripts/HypergeometricDynProg.pm
man4ish/MotifFinderMdscan
2cf60b028963be22389717329a7ed28e0a489274
[ "MIT" ]
1
2019-07-08T17:54:26.000Z
2019-07-08T17:54:26.000Z
deps/kb_meme/meme-5.0.1/scripts/HypergeometricDynProg.pm
man4ish/MotifFinderMdscan
2cf60b028963be22389717329a7ed28e0a489274
[ "MIT" ]
1
2021-03-13T15:12:52.000Z
2021-03-13T15:12:52.000Z
# AUTHOR: Timothy L. Bailey # CREATE DATE: 7-5-2005 # MODIFIER: Philip Machanick # MODIFIED DATE: 9-08-2009 # changed to use dynamic programming version of combinations package HypergeometricDynProg; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(hypergeometric_dp); use CombDynProg qw(log_comb_dp); ################################################################################ # hypergeometric # # # The probability of finding k red balls among n draws without # replacement from an urn with K red balls and N-K black ones. # # ################################################################################ sub hypergeometric_dp{ my( $k, # number of red balls drawn $n, # number of draws $K, # number of red balls in urn $N # number of balls in urn ) = @_; my $p; if ($k > $K) { $p = 0; } else { $p = exp(log_comb_dp($K, $k) + log_comb_dp($N-$K, $n-$k) - log_comb_dp($N, $n)); } return($p); } # hypergeometric
27.093023
84
0.477253
ed06d876233bd385313a4b553a03291e97eba702
420
pm
Perl
local/lib/perl5/x86_64-linux-thread-multi/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm
ray66rus/vndrv
196fd94a02dc2d41bd45a0cb22b53e00e6b23805
[ "Apache-2.0" ]
null
null
null
local/lib/perl5/x86_64-linux-thread-multi/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm
ray66rus/vndrv
196fd94a02dc2d41bd45a0cb22b53e00e6b23805
[ "Apache-2.0" ]
null
null
null
local/lib/perl5/x86_64-linux-thread-multi/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm
ray66rus/vndrv
196fd94a02dc2d41bd45a0cb22b53e00e6b23805
[ "Apache-2.0" ]
null
null
null
package Moose::Exception::MethodNameNotFoundInInheritanceHierarchy; our $VERSION = '2.1404'; use Moose; extends 'Moose::Exception'; with 'Moose::Exception::Role::Class'; has 'method_name' => ( is => 'ro', isa => 'Str', required => 1 ); sub _build_message { my $self = shift; "The method '".$self->method_name."' was not found in the inheritance hierarchy for ".$self->class_name; } 1;
21
108
0.645238
ed1f940a7b73e80d8f48da5c9e0a602638b790ec
430
t
Perl
t/all-zones/Atlantic-Azores.t
jonathanstowe/perl6-timezone
db85bb553103e0a3d1f1ff73c6a561e936edf09b
[ "Artistic-2.0" ]
null
null
null
t/all-zones/Atlantic-Azores.t
jonathanstowe/perl6-timezone
db85bb553103e0a3d1f1ff73c6a561e936edf09b
[ "Artistic-2.0" ]
null
null
null
t/all-zones/Atlantic-Azores.t
jonathanstowe/perl6-timezone
db85bb553103e0a3d1f1ff73c6a561e936edf09b
[ "Artistic-2.0" ]
null
null
null
use v6; use lib './lib'; use Test; use DateTime::TimeZone; use DateTime::TimeZone::Zone; plan 5; use DateTime::TimeZone::Zone::Atlantic::Azores; my $tz = DateTime::TimeZone::Zone::Atlantic::Azores.new; ok $tz, "timezone can be instantiated"; isnt $tz.rules, Empty, "timezone has rules"; is $tz.rules.WHAT, Hash, "rules is a Hash"; ok $tz.zonedata, "timezone has zonedata"; is $tz.zonedata.WHAT, Array, "zonedata is an Array";
23.888889
56
0.709302
ed113479b9a6f13b4156adb7996b6a34976520e7
5,239
t
Perl
t/Venus_Error.t
cpanery/venus
04242f9e7a65eccd32c45a123bb802b6b572ff56
[ "Apache-2.0" ]
17
2021-12-29T22:10:54.000Z
2022-03-29T16:21:05.000Z
t/Venus_Error.t
cpanery/venus
04242f9e7a65eccd32c45a123bb802b6b572ff56
[ "Apache-2.0" ]
68
2021-12-30T16:32:08.000Z
2022-03-09T14:59:19.000Z
t/Venus_Error.t
cpanery/venus
04242f9e7a65eccd32c45a123bb802b6b572ff56
[ "Apache-2.0" ]
1
2022-03-11T22:03:28.000Z
2022-03-11T22:03:28.000Z
package main; use 5.018; use strict; use warnings; use lib 't/lib'; use Test::More; use Test::Venus; my $test = test(__FILE__); =name Venus::Error =cut $test->for('name'); =tagline Error Class =cut $test->for('tagline'); =abstract Error Class for Perl 5 =cut $test->for('abstract'); =includes method: explain method: frames method: throw method: trace =cut $test->for('includes'); =synopsis package main; use Venus::Error; my $error = Venus::Error->new; # $error->throw; =cut $test->for('synopsis', sub { my ($tryable) = @_; ok my $result = $tryable->result; $result }); =description This package represents a context-aware error (exception object). =cut $test->for('description'); =inherits Venus::Kind::Utility =cut $test->for('inherits'); =integrates Venus::Role::Explainable Venus::Role::Stashable =cut $test->for('integrates'); =attributes context: rw, opt, Str, C<'(None)'> message: rw, opt, Str, C<'Exception!'> =cut $test->for('attributes'); =method explain The explain method returns the error message and is used in stringification operations. =signature explain explain() (Str) =metadata explain { since => '0.01', } =example-1 explain # given: synopsis; my $explain = $error->explain; # "Exception! in ... =cut $test->for('example', 1, 'explain', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result =~ /^Exception! /; $result }); =method frames The frames method returns the compiled and stashed stack trace data. =signature frames frames() (ArrayRef) =metadata frames { since => '0.01', } =example-1 frames # given: synopsis; my $frames = $error->frames; # [ # ... # [ # "main", # "t/Venus_Error.t", # ... # ], # ] =cut $test->for('example', 1, 'frames', sub { my ($tryable) = @_; ok my $result = $tryable->result; my $last_frame = $result->[-1]; ok $last_frame->[0] eq 'main'; ok $last_frame->[1] =~ m{t/Venus_Error.t$}; $result }); =method throw The throw method throws an error if the invocant is an object, or creates an error object using the arguments provided and throws the created object. =signature throw throw(Any @data) (Error) =metadata throw { since => '0.01', } =example-1 throw # given: synopsis; my $throw = $error->throw; # bless({ ... }, 'Venus::Error') =cut $test->for('example', 1, 'throw', sub { my ($tryable) = @_; ok my $result = $tryable->error(\my $error)->result; ok $error->isa('Venus::Error'); $result }); =method trace The trace method compiles a stack trace and returns the object. By default it skips the first frame. =signature trace trace(Int $offset, Int $limit) (Error) =metadata trace { since => '0.01', } =example-1 trace # given: synopsis; my $trace = $error->trace; # bless({ ... }, 'Venus::Error') =cut $test->for('example', 1, 'trace', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result->isa('Venus::Error'); ok @{$result->frames} > 0; $result }); =example-2 trace # given: synopsis; my $trace = $error->trace(0, 1); # bless({ ... }, 'Venus::Error') =cut $test->for('example', 2, 'trace', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result->isa('Venus::Error'); ok @{$result->frames} == 1; $result }); =example-3 trace # given: synopsis; my $trace = $error->trace(0, 2); # bless({ ... }, 'Venus::Error') =cut $test->for('example', 3, 'trace', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result->isa('Venus::Error'); ok @{$result->frames} == 2; $result }); =operator (.) This package overloads the C<.> operator. =cut $test->for('operator', '(.)'); =example-1 (.) # given: synopsis; my $string = $error . ' Unknown'; # "Exception! Unknown" =cut $test->for('example', 1, '(.)', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result eq "Exception! Unknown"; $result }); =operator (eq) This package overloads the C<eq> operator. =cut $test->for('operator', '(eq)'); =example-1 (eq) # given: synopsis; my $result = $error eq 'Exception!'; # 1 =cut $test->for('example', 1, '(eq)', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result == 1; $result }); =operator (ne) This package overloads the C<ne> operator. =cut $test->for('operator', '(ne)'); =example-1 (ne) # given: synopsis; my $result = $error ne 'exception!'; # 1 =cut $test->for('example', 1, '(ne)', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result == 1; $result }); =operator (qr) This package overloads the C<qr> operator. =cut $test->for('operator', '(qr)'); =example-1 (qr) # given: synopsis; my $test = 'Exception!' =~ qr/$error/; # 1 =cut $test->for('example', 1, '(qr)', sub { my ($tryable) = @_; ok my $result = $tryable->result; ok $result == 1; $result }); =license Copyright (C) 2021, Cpanery Read the L<"license"|https://github.com/cpanery/venus/blob/master/LICENSE> file. =cut =authors Cpanery, C<cpanery@cpan.org> =cut # END $test->render('lib/Venus/Error.pod') if $ENV{RENDER}; ok 1 and done_testing;
12.967822
80
0.603359
ed09e4952fcc1cf1c398e1d54df3b62c5546f646
7,603
t
Perl
S29-os/system.t
SirBogman/roast
0a0835a20951c93fea57a39dec1b2b8789d81fc5
[ "Artistic-2.0" ]
1
2019-11-06T05:07:10.000Z
2019-11-06T05:07:10.000Z
S29-os/system.t
SirBogman/roast
0a0835a20951c93fea57a39dec1b2b8789d81fc5
[ "Artistic-2.0" ]
null
null
null
S29-os/system.t
SirBogman/roast
0a0835a20951c93fea57a39dec1b2b8789d81fc5
[ "Artistic-2.0" ]
null
null
null
use v6; use Test; use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); use Test::Util; # L<S29/"OS"/"=item run"> # system is renamed to run, so link there. plan 41; my $res; $res = run($*EXECUTABLE.absolute,'-e', ''); ok($res,"run() to an existing program does not die (and returns something true)"); isa-ok($res, Proc, 'run() returns a Proc'); is($res.exitcode, 0, 'run() exit code when successful is zero'); is($res.signal, 0, 'run() signal after completion is zero'); is-deeply($res.command, ($*EXECUTABLE.absolute, '-e', ''), 'Proc returned from .run has correct command'); $res = shell("$*EXECUTABLE -e \"\""); ok($res, "shell() to an existing program does not die (and returns something true)"); isa-ok($res, Proc, 'shell() returns a Proc'); is($res.exitcode, 0, 'shell() exit code when successful is zero'); is($res.signal, 0, 'shell() signal after completion is zero'); is($res.command, "$*EXECUTABLE -e \"\"", 'Proc returned from shell() has correct command'); $res = run("program_that_does_not_exist_ignore_this_error_please.exe"); ok(!$res, "run() to a nonexisting program does not die (and returns something false)"); isa-ok($res, Proc, 'run() returns a Proc even when not successful'); ok($res.exitcode != 0, 'run() exit code is not zero on failure'); $res = run("program_that_does_not_exist_ignore_errors_please.exe","a","b"); ok(!$res, "run() to a nonexisting program with an argument list does not die (and returns something false)"); $res = shell("program_that_does_not_exist_ignore_this_error_please.exe"); ok(!$res, "shell() to a nonexisting program does not die (and returns something false)"); isa-ok($res, Proc, 'shell() returns a Proc even when not successful'); ok($res.exitcode != 0, 'shell() exit code is not zero on failure'); # RT #117039 throws-like { run("program_that_does_not_exist_ignore_errors_please.exe") }, X::Proc::Unsuccessful, 'run in sink context throws on unsuccessful exit'; throws-like { shell("program_that_does_not_exist_ignore_errors_please.exe") }, X::Proc::Unsuccessful, 'shell in sink context throws on unsuccessful exit'; # RT #104794 { is_run 'my $a = qx{echo woot>&2}; say "___ $a ___"', { out => "___ ___\n", err => / ^ "woot" [\r]? \n $ /, }, 'qx{} does not capture stderr'; } # RT #115390 { my $rt115390; for 1..100 -> $i { $rt115390 += $i.perl; run "$*EXECUTABLE", "-v"; 1; } is $rt115390, 5050, 'no crash with run() in loop; run() in sink context'; $rt115390 = 0; for 1..100 -> $i { $rt115390 += $i.perl; my $var = run "$*EXECUTABLE", "-v"; 1; } is $rt115390, 5050, 'no crash with run() in loop; run() not in sink context'; } # RT #128594 { for ^10 { is_run q{run("non-existent-program-RT128594", :merge).out.slurp}, { status => 0 }, ":merge with run on non-existent program does not crash [attempt $_]"; } } # RT #128398 #?rakudo.jvm skip 'hangs' { my $p = Proc::Async.new: :w, $*EXECUTABLE, "-ne", Q!last if /2/; .say; LAST { say "test worked" }!; my $stdout = ''; $p.stdout.tap: { $stdout ~= $^a }; my $prom = $p.start; await $p.write: "1\n2\n3\n4\n".encode; await $prom; #?rakudo.moar todo 'RT 128398' is $stdout, "1\ntest worked\n", 'LAST phaser gets triggered when using -n command line switch'; } subtest "run and shell's :cwd" => { plan 4; my @run-cmd = $*DISTRO.is-win ?? ('cmd.exe', '/C', 'echo %CD%') !! ('/bin/sh', '-c', 'echo $PWD'); my $shell-cmd = $*DISTRO.is-win ?? 'echo %CD%' !! 'echo $PWD'; indir (my $cwd = make-temp-dir.absolute), { (my $p = run @run-cmd, :!err, :out) ?? is $p.out.slurp(:close).trim, $cwd, 'run() defaults to $*CWD' !! skip "could not run @run-cmd[]"; (my $s = shell $shell-cmd, :!err, :out) ?? is $s.out.slurp(:close).trim, $cwd, 'shell() defaults to $*CWD' !! skip "could not shell $shell-cmd"; } (my $p = run @run-cmd, :!err, :out, :$cwd) ?? is $p.out.slurp(:close).trim, $cwd, 'run() accepts :cwd' !! skip "could not run :cwd, @run-cmd[]"; (my $s = shell $shell-cmd, :!err, :out, :$cwd) ?? is $s.out.slurp(:close).trim, $cwd, 'shell() accepts :cwd' !! skip "could not shell :cwd, $shell-cmd"; } subtest "run and shell's :env" => { plan 4; my $script = (make-temp-file :content('%*ENV<PERL6_RUN_SHELL_ENV_TEST>.print')).absolute; my @run-cmd = $*EXECUTABLE, $script; my $shell-cmd = ~@run-cmd; my $test-str = 'meows'; { (my $env := %*ENV.clone)<PERL6_RUN_SHELL_ENV_TEST> = $test-str; (my $p = run @run-cmd, :!err, :out, :$env) ?? is $p.out.slurp(:close).trim, $test-str, 'run() accepts :env' !! skip "could not run :env, @run-cmd[]"; (my $s = shell $shell-cmd, :!err, :out, :$env) ?? is $s.out.slurp(:close).trim, $test-str, 'shell() accepts :env' !! skip "could not shell :env, $shell-cmd"; } { temp %*ENV<PERL6_RUN_SHELL_ENV_TEST> = $test-str; (my $p = run @run-cmd, :!err, :out) ?? is $p.out.slurp(:close).trim, $test-str, 'run() defaults to %*ENV' !! skip "could not run @run-cmd[]"; (my $s = shell $shell-cmd, :!err, :out) ?? is $s.out.slurp(:close).trim, $test-str, 'shell() defaults to %*ENV' !! skip "could not shell $shell-cmd"; } } subtest '.out/.err proc pipes on failed command' => { plan 4; throws-like { run(:out, "meooooooows").out.close; Nil }, X::Proc::Unsuccessful, '.out.close Proc explodes when sunk'; throws-like { run(:err, "meooooooows").err.close; Nil }, X::Proc::Unsuccessful, '.err.close Proc explodes when sunk'; is-deeply run(:out, "meooooooows").out.slurp(:close), '', '.out.slurp is empty'; is-deeply run(:err, "meooooooows").err.slurp(:close), '', '.err.slurp is empty'; } subtest 'all Proc pipes return Proc on .close' => { plan 3; my $p = run :in, :out, :err, «$*EXECUTABLE -e 'exit 42'»; cmp-ok $p.in .close, '===', $p, 'in'; cmp-ok $p.out.close, '===', $p, 'out'; cmp-ok $p.err.close, '===', $p, 'err'; } # RT #129296 subtest 'Proc.encoding is set correctly' => { plan 2; my $p = run :out, $*EXECUTABLE, '-e', 'print 42'; is $p.out.encoding, 'utf8', '.encoding set correctly to utf8'; is $p.out.split(0.chr, :skip-empty), (“42”,), '.out is read correctly'; } # RT #126380 subtest 'Proc.pid is set correctly' => { plan 4; my $p = run $*EXECUTABLE, '-e', "print 42", :out; my $pid = $p.pid; cmp-ok $p.pid, '~~', Int:D, '.pid property exists with run()'; $p.shell: qq/$*EXECUTABLE -e "print 42"/; cmp-ok $p.pid, '~~', Int:D, '.pid property exists with shell()'; $pid = $p.pid; $p.spawn: 'meooooooows', :err; is $pid, $p.pid, '.pid property does not update on failed run()'; $pid = $p.pid; $p.shell: 'meooooooows', :err; isnt $pid, $p.pid, ".pid property updates with shell's PID on failed shell()"; } # https://github.com/rakudo/rakudo/issues/3149 { my $proc = run $*EXECUTABLE, ‘-e’, ‘use NativeCall; sub strdup(int64) is native(Str) {*}; strdup(0)’; throws-like { sink $proc }, X::Proc::Unsuccessful, 'Exit with a segfault makes the Proc throw in sink context'; nok $proc, 'Exit with a segfault makes the Proc false'; } # vim: ft=perl6
34.876147
109
0.573458
73dcbbaa637d544003a3a07f43d5b0de9925c018
7,188
pl
Perl
TAO/CIAO/connectors/dds4ccm/tests/CSLDeadline/descriptors/run_test.pl
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
36
2015-01-10T07:27:33.000Z
2022-03-07T03:32:08.000Z
TAO/CIAO/connectors/dds4ccm/tests/CSLDeadline/descriptors/run_test.pl
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
2
2018-08-13T07:30:51.000Z
2019-02-25T03:04:31.000Z
TAO/CIAO/connectors/dds4ccm/tests/CSLDeadline/descriptors/run_test.pl
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
38
2015-01-08T14:12:06.000Z
2022-01-19T08:33:00.000Z
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # $Id: run_test.pl 92258 2010-10-19 12:43:35Z johnnyw $ # -*- perl -*- use lib "$ENV{'ACE_ROOT'}/bin"; use PerlACE::TestTarget; $CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; $TAO_ROOT = "$ENV{'TAO_ROOT'}"; $DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; $daemons_running = 0; $em_running = 0; $ns_running = 0; $nr_daemon = 2; @ports = ( 60001, 60002 ); @iorbases = ( "NodeApp1.ior", "NodeApp2.ior" ); @iorfiles = 0; @nodenames = ( "SenderNode", "ReceiverNode" ); # ior files other than daemon $ior_nsbase = "ns.ior"; $ior_nsfile = 0; $ior_embase = "EM.ior"; $ior_emfile = 0; # Processes $E = 0; $EM = 0; $NS = 0; @DEAMONS = 0; # targets @tg_daemons = 0; $tg_naming = 0; $tg_exe_man = 0; $tg_executor = 0; $status = 0; $cdp_file = "Plan.cdp"; sub create_targets { # naming service $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; $tg_naming->AddLibPath ('../lib'); # daemon for ($i = 0; $i < $nr_daemon; ++$i) { $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; $tg_daemons[$i]->AddLibPath ('../lib'); } # execution manager $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; $tg_exe_man->AddLibPath ('../lib'); # executor (plan_launcher) $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; $tg_executor->AddLibPath ('../lib'); } sub init_ior_files { $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); for ($i = 0; $i < $nr_daemon; ++$i) { $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); } delete_ior_files (); } # Delete if there are any .ior files. sub delete_ior_files { for ($i = 0; $i < $nr_daemon; ++$i) { $tg_daemons[$i]->DeleteFile ($iorbases[$i]); } $tg_naming->DeleteFile ($ior_nsbase); $tg_exe_man->DeleteFile ($ior_embase); for ($i = 0; $i < $nr_daemon; ++$i) { $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); } } sub kill_node_daemon { for ($i = 0; $i < $nr_daemon; ++$i) { $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); } } sub kill_open_processes { if ($daemons_running == 1) { kill_node_daemon (); } if ($em_running == 1) { $EM->Kill (); $EM->TimedWait (1); } if ($ns_running == 1) { $NS->Kill (); $NS->TimedWait (1); } # in case shutdown did not perform as expected $tg_executor->KillAll ('dance_locality_manager'); } sub run_node_daemons { for ($i = 0; $i < $nr_daemon; ++$i) { $iorbase = $iorbases[$i]; $iorfile = $iorfiles[$i]; $port = $ports[$i]; $nodename = $nodenames[$i]; $iiop = "iiop://localhost:$port"; $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; print "Run dance_node_manager with $d_param\n"; $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); $DEAMONS[$i]->Spawn (); if ($tg_daemons[$i]->WaitForFileTimed($iorbase, $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { print STDERR "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; for (; $i >= 0; --$i) { $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); } return -1; } } return 0; } create_targets (); init_ior_files (); # Invoke naming service $NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); $ns_status = $NS->Spawn (); if ($ns_status != 0) { print STDERR "ERROR: Unable to execute the naming service\n"; kill_open_processes (); exit 1; } print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; if ($tg_naming->WaitForFileTimed ($ior_nsbase, $tg_naming->ProcessStartWaitInterval ()) == -1) { print STDERR "ERROR: cannot find naming service IOR file\n"; $NS->Kill (); $NS->TimedWait (1); exit 1; } $ns_running = 1; # Set up NamingService environment $ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; # Invoke node daemon. print "Invoking node daemon\n"; $status = run_node_daemons (); if ($status != 0) { print STDERR "ERROR: Unable to execute the node daemon\n"; kill_open_processes (); exit 1; } $daemons_running = 1; # Invoke execution manager. print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; $EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); $em_status = $EM->Spawn (); if ($em_status != 0) { print STDERR "ERROR: dance_execution_manager returned $em_status"; exit 1; } if ($tg_exe_man->WaitForFileTimed ($ior_embase, $tg_exe_man->ProcessStartWaitInterval ()) == -1) { print STDERR "ERROR: The ior file of execution manager could not be found\n"; kill_open_processes (); exit 1; } $em_running = 1; # Invoke executor - start the application -. print "Invoking executor - launch the application -\n"; print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", "-x $cdp_file -k file://$ior_emfile"); $pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); if ($pl_status != 0) { print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; kill_open_processes (); exit 1; } for ($i = 0; $i < $nr_daemon; ++$i) { if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { print STDERR "ERROR: The ior file of daemon $i could not be found\n"; kill_open_processes (); exit 1; } } print "Sleeping 10 seconds to allow task to complete\n"; sleep (10); # Invoke executor - stop the application -. print "Invoking executor - stop the application -\n"; print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", "-k file://$ior_emfile -x $cdp_file -s"); $pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); if ($pl_status != 0) { print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; kill_open_processes (); exit 1; } print "Executor returned.\n"; print "Shutting down rest of the processes.\n"; delete_ior_files (); kill_open_processes (); exit $status;
29.459016
138
0.610184
ed0042d864d779f04dee21255955b0645dd7345f
1,238
pm
Perl
lib/DateTime/TimeZone/Pacific/Wallis.pm
clayne/DateTime-TimeZone
01cdc9c009b9ceb02dfcc3ff4c58486520fd3da6
[ "Artistic-1.0" ]
4
2017-03-14T02:43:41.000Z
2021-09-22T05:31:24.000Z
lib/DateTime/TimeZone/Pacific/Wallis.pm
clayne/DateTime-TimeZone
01cdc9c009b9ceb02dfcc3ff4c58486520fd3da6
[ "Artistic-1.0" ]
38
2016-11-12T17:58:05.000Z
2022-02-09T22:02:42.000Z
lib/DateTime/TimeZone/Pacific/Wallis.pm
clayne/DateTime-TimeZone
01cdc9c009b9ceb02dfcc3ff4c58486520fd3da6
[ "Artistic-1.0" ]
17
2016-11-08T02:26:10.000Z
2021-05-04T12:09:48.000Z
# This file is auto-generated by the Perl DateTime Suite time zone # code generator (0.08) This code generator comes with the # DateTime::TimeZone module distribution in the tools/ directory # # Generated from /tmp/I058DLAWvC/australasia. Olson data version 2021e # # Do not edit this file directly. # package DateTime::TimeZone::Pacific::Wallis; use strict; use warnings; use namespace::autoclean; our $VERSION = '2.52'; use Class::Singleton 1.03; use DateTime::TimeZone; use DateTime::TimeZone::OlsonDB; @DateTime::TimeZone::Pacific::Wallis::ISA = ( 'Class::Singleton', 'DateTime::TimeZone' ); my $spans = [ [ DateTime::TimeZone::NEG_INFINITY, # utc_start 59958186280, # utc_end 1900-12-31 11:44:40 (Mon) DateTime::TimeZone::NEG_INFINITY, # local_start 59958230400, # local_end 1901-01-01 00:00:00 (Tue) 44120, 0, 'LMT', ], [ 59958186280, # utc_start 1900-12-31 11:44:40 (Mon) DateTime::TimeZone::INFINITY, # utc_end 59958229480, # local_start 1900-12-31 23:44:40 (Mon) DateTime::TimeZone::INFINITY, # local_end 43200, 0, '+12', ], ]; sub olson_version {'2021e'} sub has_dst_changes {0} sub _max_year {2031} sub _new_instance { return shift->_init( @_, spans => $spans ); } 1;
20.633333
89
0.697092
73f78f07fc01ab9fb1fc75f18378e71ef51a33b4
11,880
pl
Perl
check_ssl_cert.pl
pandian3k/Nagios-Plugins
3a946117f0e78443dc46cc7281043782e83bd6db
[ "IBM-pibs", "Apache-1.1" ]
null
null
null
check_ssl_cert.pl
pandian3k/Nagios-Plugins
3a946117f0e78443dc46cc7281043782e83bd6db
[ "IBM-pibs", "Apache-1.1" ]
null
null
null
check_ssl_cert.pl
pandian3k/Nagios-Plugins
3a946117f0e78443dc46cc7281043782e83bd6db
[ "IBM-pibs", "Apache-1.1" ]
3
2019-07-25T11:46:32.000Z
2019-12-17T05:01:03.000Z
#!/usr/bin/perl -T # nagios: -epn # # Author: Hari Sekhon # Date: 2010-08-11 17:12:01 +0000 (Wed, 11 Aug 2010) # # https://github.com/harisekhon/nagios-plugins # # License: see accompanying LICENSE file # $DESCRIPTION = "Nagios Plugin to check SSL Certificate Validity Checks: 1. Certificate Expiry in days 2. Chain of Trust 2a. Root CA certificate is trusted 2b. Any intermediate certificates are present, especially important for Mobile devices 3. Domain name on certificate (optional) 4. Subject Alternative Names supported by certificate (optional) 5. SNI - Server Name Identification - supply hostname identifier for servers that contain multiple certificates to tell the server which SSL certificate to use (optional)"; $VERSION = "0.9.18"; use warnings; use strict; BEGIN { use File::Basename; use lib dirname(__FILE__) . "/lib"; } use HariSekhonUtils qw/:DEFAULT :regex/; use POSIX 'floor'; my $openssl = "/usr/bin/openssl"; $port = 443; my $default_critical = 15; my $default_warning = 31; $critical = $default_critical; $warning = $default_warning; my $CApath; my $cmd; my $domain; my $sni_hostname; my $end_date; my $expected_domain; my $no_validate; my $cert_domain_invalid; # Worked on OpenSSL 0.98.x on RHEL5 and Mac OS X 10.6-10.9 #my $openssl_output_for_shell_regex = '[\w\s_:=@\*,\/\.\(\)\n+-]+'; # OpenSSL 1.0.x on RHEL6 outputs session tickets and prints hex which can include single quotes, and quotemeta breaks certificate interpretation so not using this now #my $openssl_output_for_shell_regex = qr/^[\w\s\_\:\;\=\@\*\.\,\/\(\)\{\}\<\>\[\]\r\n\#\^\$\&\%\~\|\\\!\"\`\+\-]+$/; # will be single quoted, don't allow single quotes in here my @subject_alt_names; my $subject_alt_names; my $verify_code = ""; my $verify_msg = ""; my @output; %options = ( "H|host=s" => [ \$host, "SSL host to check" ], "P|port=s" => [ \$port, "SSL port to check (defaults to port 443)" ], "d|domain=s" => [ \$expected_domain, "Expected domain/FQDN registered to the certificate" ], "s|subject-alternative-names=s" => [ \$subject_alt_names, "Additional FQDNs to require on the certificate (optional)" ], "S|SNI-hostname=s" => [ \$sni_hostname, "SNI hostname to tell a server with multiple certificates which one to use (eg. www.domain2.com, optional)" ], "w|warning=s" => [ \$warning, "The warning threshold in days before expiry (defaults to $default_warning)" ], "c|critical=s" => [ \$critical, "The critical threshold in days before expiry (defaults to $default_critical)" ], "C|CApath=s" => [ \$CApath, "Path to ssl root certs dir (will attempt to determine from openssl binary if not supplied)" ], "N|no-validate" => [ \$no_validate, "Do not validate the SSL certificate chain" ], "cert-domain-invalid" => [ \$cert_domain_invalid, "Do not check that the domain on the returned certicate is valid according to domain naming rules. This was added for Platfora which had 'localhost' as the domain name. An alternative is to add 'localhost' to lib/custom_tlds.txt" ] ); @usage_order = qw/host port domain subject-alternative-names SNI-hostname warning critical CApath no-validate cert-domain-invalid/; get_options(); $host = validate_host($host); $port = validate_port($port); $CApath = validate_dir($CApath, "CA path") if defined($CApath); $sni_hostname = validate_hostname($sni_hostname, "SNI") if $sni_hostname; validate_thresholds(1, 1, { "simple" => "lower", "integer" => 0, "positive" => 1 } ); if($expected_domain){ # Allow wildcard certs if(substr($expected_domain, 0 , 2) eq '*.'){ $expected_domain = "*." . validate_domain(substr($expected_domain, 2)); } else { $expected_domain = validate_domain($expected_domain); } } if($subject_alt_names){ @subject_alt_names = split(",", $subject_alt_names); foreach(@subject_alt_names){ validate_domain($_); } } vlog2; # pkill is available on Linux but not MAC by default, hence using pkill subroutine from my utils instead for portability set_timeout($timeout, sub { pkill("$openssl s_client -connect $host:$port", "-9") } ); $openssl = which($openssl, 1); # OpenSSL 1.0 / 1.1 on Ubuntu Trust 14.04 / Debian 9 Stetch shows /usr/lib/ssl/ but in fact requires /usr/lib/ssl/certs/, which caused # cert validation failure if using the inferred path location as newer OpenSSL appears to no longer recurse for CA certs, see: # # https://github.com/HariSekhon/nagios-plugins/issues/163 # # Originally commented this block out to leave openssl to use its default location and only use -CApath if the user has specifically requested changing the path # # However it turns out that openssl 1.0 on Ubuntu Trusty 14.04 does not infer the cert path properly and results in: # # CRITICAL: Certificate validation failed, returned 20 (unable to get local issuer certificate) # # so re-enabled now and added specific handling for this case to append /certs/ to the CApath when this otherwise pointing to only /usr/lib/ssl unless(defined($CApath)){ @output = cmd("$openssl version -a"); foreach(@output){ if (/^OPENSSLDIR: "($filename_regex)"\s*\n?$/) { $CApath = $1; vlog2 "Found CApath from openssl binary as: $CApath\n"; last; } } unless(defined($CApath)){ usage "CApath to root certs was not specified and could not be found from openssl binary"; } # fix for Debian / Alpine systems openssl binaries points to the base dir instead of the certs dir #if($CApath eq "/usr/lib/ssl" or $CApath eq "/etc/ssl"){ if($CApath =~ /\/ssl\/?$/ and -d "$CApath/certs"){ $CApath = "$CApath/certs/"; } # workaround for Fedora 29 in docker not working with CApath = /etc/pki/tls as found from openssl binary # openssl only works if you don't specify it, and doesn't work with /certs appended either like versions on Debian and Alpine # # https://github.com/HariSekhon/Nagios-Plugins/issues/205 # if ($CApath =~ /\/pki\/tls\/?/){ $CApath = undef; } } if(defined($CApath)){ $CApath = validate_dir($CApath, "CA path"); } vlog2; $status = "OK"; vlog2 "* checking validity of cert (chain of trust)"; $cmd = "echo | $openssl s_client -connect $host:$port"; $cmd .= " -CApath $CApath" if $CApath; $cmd .= " -servername $sni_hostname" if $sni_hostname; $cmd .= " 2>&1"; @output = cmd($cmd); foreach (@output){ if(/Connection refused/i){ quit "CRITICAL", "connection refused"; } elsif (/^\s*Verify return code: (\d+)\s\((.*)\)$/) { $verify_code = $1; $verify_msg = $2; } elsif (/^\s*verify error:num=((\d+):(.*))$/) { $verify_code = "$verify_code$2,"; $verify_msg = "$verify_msg$1, "; } elsif (/(.*error.*)/i) { $verify_code = 1; $verify_msg = "$verify_msg$1, "; } } ($verify_code ne "") or quit "UNKNOWN", "Certificate validation failed - failed to find verify code in openssl output - failed to get certificate correctly or possible code error. $nagios_plugins_support_msg"; $verify_code =~ s/,\s*$//; $verify_msg =~ s/,\s*$//; vlog2 "Verify return code: $verify_code ($verify_msg)\n"; if (not $no_validate and $verify_code ne 0){ # Don't handle expiry as part of the cert chain, we want nicer output with more details later if(not ( $verify_code eq 10 and $verify_msg =~ /certificate has expired/ ) ){ quit "CRITICAL", "Certificate validation failed, returned $verify_code ($verify_msg)"; } } #my $output = join("\n", @output); # This breaks session tickets which have an ascii dump of any char and seems to have changed recently on Linux #$output =~ /^($openssl_output_for_shell_regex)$/ or die "Error: unexpected/illegal chars in openssl output, refused to pass to shell for safety\n"; #$output = $1; # This breaks the certificate input #$output = quotemeta($output); vlog2 "* checking domain and expiry on cert"; #$cmd = "echo '$output' | $openssl x509 -noout -enddate -subject 2>&1"; #$cmd = "echo '$output' | $openssl x509 -noout -text 2>&1"; # Avoiding the IPC stuff as blocking is a problem, using extra openssl fetch, not ideal but a better fix than the alternatives # Could write this to a temporary file to avoid 1 round-trip but would need to be extremely robust and would break on things like /tmp filling up, this is a better trade off as is $cmd .= " | $openssl x509 -noout -text 2>&1"; @output = cmd($cmd); foreach (@output){ #if (/notAfter\=/) { if (/Not After\s*:\s*(\w+\s+\d+\s+\d+:\d+:\d+\s+\d+\s+\w+)/) { $end_date = $1; #defined($end_date) || quit "CRITICAL", "failed to determine certificate expiry date"; } #elsif (/subject=/) { # The * must be in there for wildcard certs elsif (/Subject:(?:.+,)?\s*CN\s*=\s*([\*\w\.-]+)/) { $domain = $1; #defined($domain) || quit "CRITICAL", "failed to determine certificate domain name"; last; } } sub is_cert_domain ($) { return 1 if $cert_domain_invalid; my $domain = shift; if($domain =~ /^\*\./){ $domain =~ s/^\*\.//; } isFqdn($domain) or isDomain($domain); } defined($domain) or quit "CRITICAL", "failed to determine certificate domain name"; defined($end_date) or quit "CRITICAL", "failed to determine certificate expiry date"; vlog2 "Domain: $domain"; vlog2 "Certificate Expires: $end_date\n"; is_cert_domain($domain) or quit "UNKNOWN", "invalid domain '$domain' return for certficate. If this is an internal domain not using an official IANA TLD then you can either add the TLD to lib/custom_tlds.txt to pass this validation, or use --cert-domain-invalid to skip this check entirely. $nagios_plugins_support_msg"; my ($month, $day, $time, $year, $tz) = split(/\s+/, $end_date); my ($hour, $min, $sec) = split(/\:/, $time); my $days_left = floor( timecomponents2days($year, $month, $day, $hour, $min, $sec) ); isInt($days_left, 1) or code_error "non-integer returned for days left calculation. $nagios_plugins_support_msg"; vlog2 "* checking expected domain name on cert\n"; if ($expected_domain and $domain ne $expected_domain) { critical; $msg .= "domain '$domain' did not match expected domain '$expected_domain'! "; } my $san_names_checked = 0; if($subject_alt_names){ vlog2 "* testing subject alternative names"; my @found_alt_names = (); my @missing_alt_names = (); foreach my $subject_alt_name (@subject_alt_names){ $san_names_checked += 1; vlog2 "* checking subject alternative name: '$subject_alt_name'"; foreach (@output){ if(/\bDNS:$subject_alt_name\b/){ push(@found_alt_names, $subject_alt_name); } } if (not grep { $_ eq $subject_alt_name } @found_alt_names){ push(@missing_alt_names, $subject_alt_name); critical; } } if(scalar @missing_alt_names){ plural scalar @missing_alt_names; $msg .= scalar @missing_alt_names . " SAN name$plural missing: " . join(",", @missing_alt_names) . "."; } vlog2; } if(!is_critical){ plural abs($days_left); if($days_left < 0){ critical; $days_left = abs($days_left); $msg .= "Certificate EXPIRED $days_left day$plural ago for '$domain'. Expiry Date: '$end_date'"; } else { $msg .= "$days_left day$plural remaining for '$domain'. Certificate Expires: '$end_date'"; check_thresholds($days_left); } } plural $san_names_checked; if($san_names_checked){ $msg .= " [$san_names_checked SAN name$plural checked]"; } quit $status, $msg;
41.538462
320
0.649327
ed21cd6f6e783c6feeba5d8d2b2275fc5f055686
15,127
perl
Perl
medpost/data/medtag/http/cgi-lib.perl
strayMat/bio-medical_ner
e76389515467402574254b2def2164a092b2aa19
[ "Apache-2.0" ]
1
2018-10-24T05:12:14.000Z
2018-10-24T05:12:14.000Z
medpost/data/medtag/http/cgi-lib.perl
strayMat/bio-medical_ner
e76389515467402574254b2def2164a092b2aa19
[ "Apache-2.0" ]
null
null
null
medpost/data/medtag/http/cgi-lib.perl
strayMat/bio-medical_ner
e76389515467402574254b2def2164a092b2aa19
[ "Apache-2.0" ]
null
null
null
# Perl Routines to Manipulate CGI input # cgi-lib@pobox.com # $Id: cgi-lib.pl,v 2.18 1999/02/23 08:16:43 brenner Exp $ # # Copyright (c) 1993-1999 Steven E. Brenner # Unpublished work. # Permission granted to use and modify this library so long as the # copyright above is maintained, modifications are documented, and # credit is given for any use of the library. # # Thanks are due to many people for reporting bugs and suggestions # For more information, see: # http://cgi-lib.stanford.edu/cgi-lib/ $cgi_lib'version = sprintf("%d.%02d", q$Revision: 2.18 $ =~ /(\d+)\.(\d+)/); # Parameters affecting cgi-lib behavior # User-configurable parameters affecting file upload. $cgi_lib'maxdata = 131072; # maximum bytes to accept via POST - 2^17 $cgi_lib'writefiles = 0; # directory to which to write files, or # 0 if files should not be written $cgi_lib'filepre = "cgi-lib"; # Prefix of file names, in directory above # Do not change the following parameters unless you have special reasons $cgi_lib'bufsize = 8192; # default buffer size when reading multipart $cgi_lib'maxbound = 100; # maximum boundary length to be encounterd $cgi_lib'headerout = 0; # indicates whether the header has been printed # ReadParse # Reads in GET or POST data, converts it to unescaped text, and puts # key/value pairs in %in, using "\0" to separate multiple selections # Returns >0 if there was input, 0 if there was no input # undef indicates some failure. # Now that cgi scripts can be put in the normal file space, it is useful # to combine both the form and the script in one place. If no parameters # are given (i.e., ReadParse returns FALSE), then a form could be output. # If a reference to a hash is given, then the data will be stored in that # hash, but the data from $in and @in will become inaccessable. # If a variable-glob (e.g., *cgi_input) is the first parameter to ReadParse, # information is stored there, rather than in $in, @in, and %in. # Second, third, and fourth parameters fill associative arrays analagous to # %in with data relevant to file uploads. # If no method is given, the script will process both command-line arguments # of the form: name=value and any text that is in $ENV{'QUERY_STRING'} # This is intended to aid debugging and may be changed in future releases sub ReadParse { $cgi_lib'headerout++; # Disable warnings as this code deliberately uses local and environment # variables which are preset to undef (i.e., not explicitly initialized) local ($perlwarn); $perlwarn = $^W; $^W = 0; local (*in) = shift if @_; # CGI input local (*incfn, # Client's filename (may not be provided) *inct, # Client's content-type (may not be provided) *insfn) = @_; # Server's filename (for spooled files) local ($len, $type, $meth, $errflag, $cmdflag, $got, $name); binmode(STDIN); # we need these for DOS-based systems binmode(STDOUT); # and they shouldn't hurt anything else binmode(STDERR); # Get several useful env variables $type = $ENV{'CONTENT_TYPE'}; $len = $ENV{'CONTENT_LENGTH'}; $meth = $ENV{'REQUEST_METHOD'}; if ($len > $cgi_lib'maxdata) { #' &CgiDie("cgi-lib.pl: Request to receive too much data: $len bytes\n"); } if (!defined $meth || $meth eq '' || $meth eq 'GET' || $meth eq 'HEAD' || $type eq 'application/x-www-form-urlencoded') { local ($key, $val, $i); # Read in text if (!defined $meth || $meth eq '') { $in = $ENV{'QUERY_STRING'}; $cmdflag = 1; # also use command-line options } elsif($meth eq 'GET' || $meth eq 'HEAD') { $in = $ENV{'QUERY_STRING'}; } elsif ($meth eq 'POST') { if (($got = read(STDIN, $in, $len) != $len)) {$errflag="Short Read: wanted $len, got $got\n";}; } else { &CgiDie("cgi-lib.pl: Unknown request method: $meth\n"); } @in = split(/[&;]/,$in); push(@in, @ARGV) if $cmdflag; # add command-line parameters foreach $i (0 .. $#in) { # Convert plus to space $in[$i] =~ s/\+/ /g; # Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; # Associate key and value $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator $in{$key} .= $val; } } elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) { # for efficiency, compile multipart code only if needed $errflag = !(eval <<'END_MULTIPART'); local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen); local ($bpos, $lpos, $left, $amt, $fn, $ser); local ($bufsize, $maxbound, $writefiles) = ($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles); # The following lines exist solely to eliminate spurious warning messages $buf = ''; ($boundary) = $type =~ /boundary="([^"]+)"/; #"; # find boundary ($boundary) = $type =~ /boundary=(\S+)/ unless $boundary; &CgiDie ("Boundary not provided: probably a bug in your server") unless $boundary; $boundary = "--" . $boundary; $blen = length ($boundary); if ($ENV{'REQUEST_METHOD'} ne 'POST') { &CgiDie("Invalid request method for multipart/form-data: $meth\n"); } if ($writefiles) { local($me); stat ($writefiles); $writefiles = "/tmp" unless -d _ && -w _; # ($me) = $0 =~ m#([^/]*)$#; $writefiles .= "/$cgi_lib'filepre"; } # read in the data and split into parts: # put headers in @in and data in %in # General algorithm: # There are two dividers: the border and the '\r\n\r\n' between # header and body. Iterate between searching for these # Retain a buffer of size(bufsize+maxbound); the latter part is # to ensure that dividers don't get lost by wrapping between two bufs # Look for a divider in the current batch. If not found, then # save all of bufsize, move the maxbound extra buffer to the front of # the buffer, and read in a new bufsize bytes. If a divider is found, # save everything up to the divider. Then empty the buffer of everything # up to the end of the divider. Refill buffer to bufsize+maxbound # Note slightly odd organization. Code before BODY: really goes with # code following HEAD:, but is put first to 'pre-fill' buffers. BODY: # is placed before HEAD: because we first need to discard any 'preface,' # which would be analagous to a body without a preceeding head. $left = $len; PART: # find each part of the multi-part while reading data while (1) { die $@ if $errflag; $amt = ($left > $bufsize+$maxbound-length($buf) ? $bufsize+$maxbound-length($buf): $left); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; $in{$name} .= "\0" if defined $in{$name}; $in{$name} .= $fn if $fn; $name=~/([-\w]+)/; # This allows $insfn{$name} to be untainted if (defined $1) { $insfn{$1} .= "\0" if defined $insfn{$1}; $insfn{$1} .= $fn if $fn; } BODY: while (($bpos = index($buf, $boundary)) == -1) { if ($left == 0 && $buf eq '') { foreach $value (values %insfn) { unlink(split("\0",$value)); } &CgiDie("cgi-lib.pl: reached end of input while seeking boundary " . "of multipart. Format of CGI input is wrong.\n"); } die $@ if $errflag; if ($name) { # if no $name, then it's the prologue -- discard if ($fn) { print FILE substr($buf, 0, $bufsize); } else { $in{$name} .= substr($buf, 0, $bufsize); } } $buf = substr($buf, $bufsize); $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; } if (defined $name) { # if no $name, then it's the prologue -- discard if ($fn) { print FILE substr($buf, 0, $bpos-2); } else { $in {$name} .= substr($buf, 0, $bpos-2); } # kill last \r\n } close (FILE); last PART if substr($buf, $bpos + $blen, 2) eq "--"; substr($buf, 0, $bpos+$blen+2) = ''; $amt = ($left > $bufsize+$maxbound-length($buf) ? $bufsize+$maxbound-length($buf) : $left); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; undef $head; undef $fn; HEAD: while (($lpos = index($buf, "\r\n\r\n")) == -1) { if ($left == 0 && $buf eq '') { foreach $value (values %insfn) { unlink(split("\0",$value)); } &CgiDie("cgi-lib: reached end of input while seeking end of " . "headers. Format of CGI input is wrong.\n$buf"); } die $@ if $errflag; $head .= substr($buf, 0, $bufsize); $buf = substr($buf, $bufsize); $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; } $head .= substr($buf, 0, $lpos+2); push (@in, $head); @heads = split("\r\n", $head); ($cd) = grep (/^\s*Content-Disposition:/i, @heads); ($ct) = grep (/^\s*Content-Type:/i, @heads); ($name) = $cd =~ /\bname="([^"]+)"/i; #"; ($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name; ($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be null-str ($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname; $incfn{$name} .= (defined $in{$name} ? "\0" : "") . (defined $fname ? $fname : ""); ($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i; #"; ($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defined $ctype; $inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype; if ($writefiles && defined $fname) { $ser++; $fn = $writefiles . ".$$.$ser"; open (FILE, ">$fn") || &CgiDie("Couldn't open $fn\n"); binmode (FILE); # write files accurately } substr($buf, 0, $lpos+4) = ''; undef $fname; undef $ctype; } 1; END_MULTIPART if ($errflag) { local ($errmsg, $value); $errmsg = $@ || $errflag; foreach $value (values %insfn) { unlink(split("\0",$value)); } &CgiDie($errmsg); } else { # everything's ok. } } else { &CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n"); } # no-ops to avoid warnings $insfn = $insfn; $incfn = $incfn; $inct = $inct; $^W = $perlwarn; return ($errflag ? undef : scalar(@in)); } # PrintHeader # Returns the magic line which tells WWW that we're an HTML document sub PrintHeader { return "Content-type: text/html\n\n"; } # HtmlTop # Returns the <head> of a document and the beginning of the body # with the title and a body <h1> header as specified by the parameter sub HtmlTop { local ($title) = @_; return <<END_OF_TEXT; <html> <head> <title>$title</title> </head> <body> <h1>$title</h1> END_OF_TEXT } # HtmlBot # Returns the </body>, </html> codes for the bottom of every HTML page sub HtmlBot { return "</body>\n</html>\n"; } # SplitParam # Splits a multi-valued parameter into a list of the constituent parameters sub SplitParam { local ($param) = @_; local (@params) = split ("\0", $param); return (wantarray ? @params : $params[0]); } # MethGet # Return true if this cgi call was using the GET request, false otherwise sub MethGet { return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "GET"); } # MethPost # Return true if this cgi call was using the POST request, false otherwise sub MethPost { return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "POST"); } # MyBaseUrl # Returns the base URL to the script (i.e., no extra path or query string) sub MyBaseUrl { local ($ret, $perlwarn); $perlwarn = $^W; $^W = 0; $ret = 'http://' . $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') . $ENV{'SCRIPT_NAME'}; $^W = $perlwarn; return $ret; } # MyFullUrl # Returns the full URL to the script (i.e., with extra path or query string) sub MyFullUrl { local ($ret, $perlwarn); $perlwarn = $^W; $^W = 0; $ret = 'http://' . $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') . $ENV{'SCRIPT_NAME'} . $ENV{'PATH_INFO'} . (length ($ENV{'QUERY_STRING'}) ? "?$ENV{'QUERY_STRING'}" : ''); $^W = $perlwarn; return $ret; } # MyURL # Returns the base URL to the script (i.e., no extra path or query string) # This is obsolete and will be removed in later versions sub MyURL { return &MyBaseUrl; } # CgiError # Prints out an error message which which containes appropriate headers, # markup, etcetera. # Parameters: # If no parameters, gives a generic error message # Otherwise, the first parameter will be the title and the rest will # be given as different paragraphs of the body sub CgiError { local (@msg) = @_; local ($i,$name); if (!@msg) { $name = &MyFullUrl; @msg = ("Error: script $name encountered fatal error\n"); }; if (!$cgi_lib'headerout) { #') print &PrintHeader; print "<html>\n<head>\n<title>$msg[0]</title>\n</head>\n<body>\n"; } print "<h1>$msg[0]</h1>\n"; foreach $i (1 .. $#msg) { print "<p>$msg[$i]</p>\n"; } $cgi_lib'headerout++; } # CgiDie # Identical to CgiError, but also quits with the passed error message. sub CgiDie { local (@msg) = @_; &CgiError (@msg); die @msg; } # PrintVariables # Nicely formats variables. Three calling options: # A non-null associative array - prints the items in that array # A type-glob - prints the items in the associated assoc array # nothing - defaults to use %in # Typical use: &PrintVariables() sub PrintVariables { local (*in) = @_ if @_ == 1; local (%in) = @_ if @_ > 1; local ($out, $key, $output); $output = "\n<dl compact>\n"; foreach $key (sort keys(%in)) { foreach (split("\0", $in{$key})) { ($out = $_) =~ s/\n/<br>\n/g; $output .= "<dt><b>$key</b>\n <dd>:<i>$out</i>:<br>\n"; } } $output .= "</dl>\n"; return $output; } # PrintEnv # Nicely formats all environment variables and returns HTML string sub PrintEnv { &PrintVariables(*ENV); } # The following lines exist only to avoid warning messages $cgi_lib'writefiles = $cgi_lib'writefiles; $cgi_lib'bufsize = $cgi_lib'bufsize ; $cgi_lib'maxbound = $cgi_lib'maxbound; $cgi_lib'version = $cgi_lib'version; $cgi_lib'filepre = $cgi_lib'filepre; 1; #return true
31.846316
80
0.591988
ed2dd077855a704558b57fd0043d4a105722a385
1,067
pl
Perl
external/win_perl/lib/unicore/lib/Age/V31.pl
phixion/l0phtcrack
48ee2f711134e178dbedbd925640f6b3b663fbb5
[ "Apache-2.0", "MIT" ]
2
2021-10-20T00:25:39.000Z
2021-11-08T12:52:42.000Z
external/win_perl/lib/unicore/lib/Age/V31.pl
Brute-f0rce/l0phtcrack
25f681c07828e5e68e0dd788d84cc13c154aed3d
[ "Apache-2.0", "MIT" ]
null
null
null
external/win_perl/lib/unicore/lib/Age/V31.pl
Brute-f0rce/l0phtcrack
25f681c07828e5e68e0dd788d84cc13c154aed3d
[ "Apache-2.0", "MIT" ]
1
2022-03-14T06:41:16.000Z
2022-03-14T06:41:16.000Z
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! # This file is machine-generated by ..\lib\unicore\mktables from the Unicode # database, Version 9.0.0. Any changes made here will be lost! # !!!!!!! INTERNAL PERL USE ONLY !!!!!!! # This file is for internal use by core Perl only. The format and even the # name or existence of this file are subject to change without notice. Don't # use it directly. Use Unicode::UCD to access the Unicode character data # base. return <<'END'; V72 1012 1014 64976 65008 66304 66335 66336 66340 66352 66379 66560 66598 66600 66638 118784 119030 119040 119079 119082 119262 119808 119893 119894 119965 119966 119968 119970 119971 119973 119975 119977 119981 119982 119994 119995 119996 119997 120001 120002 120004 120005 120070 120071 120075 120077 120085 120086 120093 120094 120122 120123 120127 120128 120133 120134 120135 120138 120145 120146 120484 120488 120778 120782 120832 131072 173783 194560 195102 917505 917506 917536 917632 END
12.264368
78
0.703843
ed2586527c3f41d5c3b09da28dff6bff39a2f37e
2,071
pm
Perl
lib/R/Http/Dispatcher.pm
darviarush/rubin-forms
d3b0d16f937c58439d4ab1be667e573ff5555f06
[ "BSD-2-Clause" ]
null
null
null
lib/R/Http/Dispatcher.pm
darviarush/rubin-forms
d3b0d16f937c58439d4ab1be667e573ff5555f06
[ "BSD-2-Clause" ]
null
null
null
lib/R/Http/Dispatcher.pm
darviarush/rubin-forms
d3b0d16f937c58439d4ab1be667e573ff5555f06
[ "BSD-2-Clause" ]
null
null
null
package R::Http::Dispatcher; # диспетчер - несёт всю информацию о диспетчере: # кто (форма, экшн-отображение или функция контроллера), откуда (файл, строка) use common::sense; use R::App; has qw/uri prefix controller action sub class file lineno olduri/; # конструктор sub new { my ($cls) = @_; bless { type => undef, # тип диспетчера uri => undef, # путь диспетчера olduri => undef, # путь диспетчера, который был до переименования prefix => undef, # путь контроллера controller => undef, # пакет контроллера action => undef, # имя экшена sub => undef, # функция экшена class => undef, # класс диспетчера (форма или страницы) file => undef, # файл с диспетчером lineno => undef, # номер строки в файле }, ref $cls || $cls; } our %TYPES = ( 0 => [":red", "<dispatcher>", "dispatcher"], # диспетчер 1 => [":red dark", "<% ACTION %>", "action"], 2 => [":green dark", "<on>", "on"], 3 => [":cyan dark", "<class>", "class"], 4 => [":magenta dark", "<controller/action>", "controller"], ); our %TYPES_BY_NAME = map { $TYPES{$_}[2] => $_ } keys %TYPES; # устанавливает тип как по имени, так и по номеру. Возвращает номер sub type { my $self = shift; if(@_) { my $type = shift; $type = $TYPES_BY_NAME{$type} if $type !~ /^\d+$/; die "тип $type не определён" if !exists $TYPES{$type}; $self->{type} = $type; $self } else { $self->{type} } } # переименовывает диспетчера sub rename { my ($self, $new) = @_; $self->olduri($self->uri); $self->uri($new); } # выводит цветовую составляющую sub color { my ($self) = @_; $TYPES{ $self->type }[0]; } # выводит именную составляющую sub name { my ($self) = @_; $TYPES{ $self->type }[1]; } # выводит мелкое имя sub nik { my ($self) = @_; $TYPES{ $self->type }[2]; } # выводит класс или nik sub cls { my ($self) = @_; $self->type==3? $self->class: $self->name; } # выводит controller/action или action sub action_name { my ($self) = @_; $self->controller && $self->action? $self->controller . "/" . $self->action: $self->action? $self->action: "" } 1;
22.51087
78
0.612747
ed248dba74bd47a04a9107d36cf0dcf638a02c76
6,502
pm
Perl
src/core/Buf.pm
NXTangl/rakudo
0bcaa3b7d0cdb23000c2422bf0525994d36bfd26
[ "Artistic-2.0" ]
6
2019-03-25T20:11:15.000Z
2019-04-01T09:23:14.000Z
src/core/Buf.pm
NXTangl/rakudo
0bcaa3b7d0cdb23000c2422bf0525994d36bfd26
[ "Artistic-2.0" ]
null
null
null
src/core/Buf.pm
NXTangl/rakudo
0bcaa3b7d0cdb23000c2422bf0525994d36bfd26
[ "Artistic-2.0" ]
null
null
null
role Buf[::T = Int] does Stringy does Positional { has T @.contents; multi method new(*@contents) { self.bless(*, :contents(@contents.list)); } multi method decode($encoding is copy = 'UTF-8') { $encoding .= lc; if $encoding eq 'utf-8' { $encoding = 'utf8'; } my @contents = @.contents; my $str = ~Q:PIR { $P0 = find_lex '@contents' .local pmc bb .local string s bb = new ['ByteBuffer'] .local pmc it .local int i it = iter $P0 i = 0 loop: unless it goto done $P1 = shift it $I1 = $P1 bb[i] = $I1 inc i goto loop done: $P1 = find_lex '$encoding' $S1 = $P1 s = bb.'get_string'($S1) %r = box s }; return $str; } multi method unpack($template) { my @bytes = @.contents; my @fields; for $template.comb(/<[a..zA..Z]>[\d+|'*']?/) -> $unit { my $directive = $unit.substr(0, 1); my $amount = $unit.substr(1); given $directive { when 'A' { my $asciistring; if $amount eq '*' { $amount = @bytes.elems; } for ^$amount { $asciistring ~= chr(shift @bytes); } @fields.push($asciistring); } when 'H' { my $hexstring; while @bytes { my $byte = shift @bytes; $hexstring ~= ($byte +> 4).fmt('%x') ~ ($byte % 16).fmt('%x'); } @fields.push($hexstring); } when 'x' { if $amount eq '*' { $amount = 0; } elsif $amount eq '' { $amount = 1; } splice @bytes, 0, $amount; } when 'C' { @fields.push: shift @bytes; } when 'S' | 'v' { @fields.push: shift(@bytes) + (shift(@bytes) +< 0x08); } when 'L' | 'V' { @fields.push: shift(@bytes) + (shift(@bytes) +< 0x08) + (shift(@bytes) +< 0x10) + (shift(@bytes) +< 0x18); } when 'n' { @fields.push: (shift(@bytes) +< 0x08) + shift(@bytes); } when 'N' { @fields.push: (shift(@bytes) +< 0x18) + (shift(@bytes) +< 0x10) + (shift(@bytes) +< 0x08) + shift(@bytes); } die "Unrecognized directive $directive"; } } return |@fields; } multi method elems() { @.contents.elems; } multi method postcircumfix:<[ ]>($index) { @.contents[$index]; } } our multi sub infix:<eqv>(Buf $a, Buf $b) { return $a.contents eqv $b.contents; } our multi sub prefix:<~^>(Buf $a) { my @inverted-contents = $a.contents »+^» 0xFF; Buf.new(|@inverted-contents); } our multi sub infix:<~&>(Buf $a, Buf $b) { my $minlen = $a.elems min $b.elems; my @anded-contents = $a.contents[^$minlen] «+&» $b.contents[^$minlen]; @anded-contents.push: 0 xx ($a.elems - @anded-contents.elems); @anded-contents.push: 0 xx ($b.elems - @anded-contents.elems); Buf.new(|@anded-contents); } our multi sub infix:<~|>(Buf $a, Buf $b) { my $minlen = $a.elems min $b.elems; my @ored-contents = $a.contents[^$minlen] «+|» $b.contents[^$minlen]; @ored-contents.push: $a.contents[@ored-contents.elems ..^ $a.elems]; @ored-contents.push: $b.contents[@ored-contents.elems ..^ $b.elems]; Buf.new(|@ored-contents); } our multi sub infix:<~^>(Buf $a, Buf $b) { my $minlen = $a.elems min $b.elems; my @xored-contents = $a.contents[^$minlen] «+^» $b.contents[^$minlen]; @xored-contents.push: $a.contents[@xored-contents.elems ..^ $a.elems]; @xored-contents.push: $b.contents[@xored-contents.elems ..^ $b.elems]; Buf.new(|@xored-contents); } our multi sub pack(Str $template, *@items) { my @bytes; for $template.comb(/<[a..zA..Z]>[\d+|'*']?/) -> $unit { my $directive = $unit.substr(0, 1); my $amount = $unit.substr(1); given $directive { when 'A' { my $ascii = shift @items // ''; for $ascii.comb -> $char { die "Non-ASCII character $char" if ord($char) > 0x7f; @bytes.push: ord($char); } if $amount ne '*' { @bytes.push: 0x20 xx ($amount - $ascii.chars); } } when 'H' { my $hexstring = shift @items // ''; if $hexstring % 2 { $hexstring ~= '0'; } @bytes.push: map { :16($_) }, $hexstring.comb(/../); } when 'C' { my $number = shift(@items); @bytes.push: $number % 0x100; } when 'S' | 'v' { my $number = shift(@items); @bytes.push: ($number, $number +> 0x08) >>%>> 0x100; } when 'L' | 'V' { my $number = shift(@items); @bytes.push: ($number, $number +> 0x08, $number +> 0x10, $number +> 0x18) >>%>> 0x100; } when 'n' { my $number = shift(@items); @bytes.push: ($number +> 0x08, $number) >>%>> 0x100; } when 'N' { my $number = shift(@items); @bytes.push: ($number +> 0x18, $number +> 0x10, $number +> 0x08, $number) >>%>> 0x100; } die "Unrecognized directive $directive"; } } return Buf.new(@bytes); }
32.51
76
0.389726
73d1684a0c94cef51af5e1c1ad860b0e56711e53
2,169
t
Perl
t/compile1.t
eserte/Template2
fde062c8249a67868eaaaade9092296a039c179f
[ "BSD-Source-Code" ]
1
2017-09-09T12:36:53.000Z
2017-09-09T12:36:53.000Z
t/compile1.t
eserte/Template2
fde062c8249a67868eaaaade9092296a039c179f
[ "BSD-Source-Code" ]
null
null
null
t/compile1.t
eserte/Template2
fde062c8249a67868eaaaade9092296a039c179f
[ "BSD-Source-Code" ]
null
null
null
#============================================================= -*-perl-*- # # t/compile1.t # # Test the facility for the Template::Provider to maintain a persistance # cache of compiled templates by writing generated Perl code to files. # # Written by Andy Wardley <abw@kfs.org> # # Copyright (C) 1996-2000 Andy Wardley. All Rights Reserved. # Copyright (C) 1998-2000 Canon Research Centre Europe Ltd. # # This is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # $Id$ # #======================================================================== use strict; use warnings; use lib qw( ./lib ../lib ); use Template::Test; use File::Spec; # declare extra tests to follow test_expect(); $Template::Test::EXTRA = 2; # script may be being run in distribution root or 't' directory my @dir = -d 't' ? qw(t test src) : qw(test src); my $dir = File::Spec->catfile(@dir); my $zero = File::Spec->catfile(@dir, 'divisionbyzero'); my $ttcfg = { POST_CHOMP => 1, INCLUDE_PATH => $dir, COMPILE_EXT => '.ttc', EVAL_PERL => 1, CONSTANTS => { zero => $zero, }, }; # delete any existing files foreach my $f ( "$dir/foo.ttc", "$dir/complex.ttc", "$dir/divisionbyzero.ttc" ) { ok( unlink($f) ) if -f $f; } test_expect(\*DATA, $ttcfg); # $EXTRA tests ok( -f "$dir/foo.ttc" ); ok( -f "$dir/complex.ttc" ); __DATA__ -- test -- [% INCLUDE evalperl %] -- expect -- This file includes a perl block. -- test -- [% TRY %] [% INCLUDE foo %] [% CATCH file %] Error: [% error.type %] - [% error.info %] [% END %] -- expect -- This is the foo file, a is -- test -- [% META author => 'abw' version => 3.14 %] [% INCLUDE complex %] -- expect -- This is the header, title: Yet Another Template Test This is a more complex file which includes some BLOCK definitions This is the footer, author: abw, version: 3.14 - 3 - 2 - 1 -- test -- [% INCLUDE baz %] -- expect -- This is the baz file, a: -- test -- [%- # first pass, writes the compiled code to cache -%] [% INCLUDE divisionbyzero -%] -- expect -- -- process -- undef error - Illegal division by zero at [% constants.zero %] line 1.
23.835165
81
0.591056
73d6655f803968c5f60df117e40a9ff07d7b4dbd
1,731
al
Perl
Apps/W1/Shopify/app/src/Gift Cards/Pages/ShpfyGiftCards.Page.al
manjulchauhan/ALAppExtensions
3f2f1d6e5337188b1af9c0275420f1c1de036a7f
[ "MIT" ]
127
2018-04-17T18:03:03.000Z
2019-05-06T18:54:17.000Z
Apps/W1/Shopify/app/src/Gift Cards/Pages/ShpfyGiftCards.Page.al
manjulchauhan/ALAppExtensions
3f2f1d6e5337188b1af9c0275420f1c1de036a7f
[ "MIT" ]
2,279
2018-09-12T12:01:49.000Z
2019-05-06T13:59:35.000Z
Apps/W1/Shopify/app/src/Gift Cards/Pages/ShpfyGiftCards.Page.al
Enavate-EPS-Product/ALAppExtensions
20136cf2ef6589ff3ce7b16776aed5e8823b76f2
[ "MIT" ]
41
2018-05-17T11:19:52.000Z
2019-04-30T17:30:38.000Z
/// <summary> /// Page Shpfy Gift Cards (ID 30110). /// </summary> page 30110 "Shpfy Gift Cards" { ApplicationArea = All; Caption = 'Shopify Gift Cards'; PageType = List; SourceTable = "Shpfy Gift Card"; UsageCategory = Documents; layout { area(content) { repeater(General) { field(Id; Rec.Id) { ApplicationArea = All; ToolTip = 'Specifies the id of the Shopify gift card.'; } field(LastCharacters; Rec."Last Characters") { ApplicationArea = All; ToolTip = 'Specifies the last characters of the gift card code.'; } field(Amount; Rec.Amount) { ApplicationArea = All; ToolTip = 'Specifies the amount of the Shopify gift card.'; } field(KnownUsedAmount; Rec."Known Used Amount") { ApplicationArea = All; ToolTip = 'Specifies the balance of the gift card.'; } } part(Transaction; "Shpfy Gift Card Transactions") { ApplicationArea = All; Caption = 'Known Transactions'; SubPageLink = "Gift Card Id" = field(Id); } } area(factboxes) { systempart(Links; Links) { ApplicationArea = All; Visible = false; } systempart(Notes; Notes) { ApplicationArea = All; } } } }
27.919355
85
0.437319
ed2bad6ed31893de92f38d36b98e580757613901
7,277
t
Perl
t/make_targets.t
wu-lee/module-release
18d25aca184362e99e61ffd6189339db5bcc60f8
[ "Artistic-2.0" ]
null
null
null
t/make_targets.t
wu-lee/module-release
18d25aca184362e99e61ffd6189339db5bcc60f8
[ "Artistic-2.0" ]
null
null
null
t/make_targets.t
wu-lee/module-release
18d25aca184362e99e61ffd6189339db5bcc60f8
[ "Artistic-2.0" ]
null
null
null
#!/usr/bin/perl use strict; use warnings; use Test::More 'no_plan'; use Test::Output; use Cwd; my $class = 'Module::Release'; my $file = ".releaserc"; use_ok( $class ); can_ok( $class, 'new' ); BEGIN { use File::Spec; my $file = File::Spec->catfile( qw(t lib setup_common.pl) ); require $file; } my @makefile_pl_targets = qw( build_makefile ); my @makefile_targets = qw( clean make dist distclean test disttest ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Create test object my $release = $class->new; isa_ok( $release, $class ); can_ok( $release, @makefile_pl_targets, @makefile_targets ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # API change { can_ok( $release, 'dist_test' ); stderr_like { $release->dist_test } qr/deprecated/i, 'dist_test gives deprecation warning'; } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Replace run() with a mock. We don't want to actually do anything. # Just return whatever is in $output our $run_output = ''; { no warnings; no strict; *{"${class}::run"} = sub { $run_output }; } can_ok( $release, 'run' ); is( $release->run, '', "Mock run starts off as empty string" ); is( $release->run, $run_output, "Mock run() returns value of \$run_output" ); $run_output = 'Hello there!'; is( $release->run, $run_output, "Mock run() returns value of \$run_output" ); is( $release->run( qw(a b ) ), $run_output, "Mock run(a,b) returns value of \$run_output" ); $run_output = ''; # run doesn't output anything $release->turn_quiet_off; $release->turn_debug_off; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # No Makefile or Makefile.PL present, so skipping ok( ! -e 'Makefile', 'Makefile is not there (good)' ); ok( ! -e 'Makefile.PL', 'Makefile.PL is not there (good)' ); foreach my $target ( @makefile_targets, @makefile_pl_targets ) { stdout_like { eval { $release->$target() } } qr/no Makefile.*skipping/, "Skipping $target with no Makefile" } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # No Makefile, but Makefile.PL present { END { unlink 'Makefile.PL' } open my($fh), ">", "Makefile.PL"; close $fh; } foreach my $target ( @makefile_targets ) { next if $target eq 'dist'; # this one recreates it ok( ! -e 'Makefile', 'Makefile is not there (good)' ); stdout_like { eval { $release->$target() } } qr/no Makefile.*skipping/, "Skipping $target with no Makefile" } foreach my $target ( @makefile_pl_targets ) { ok( -e 'Makefile.PL', 'Makefile.PL is not there' ); stdout_like { eval { $release->$target() } } qr/done/, "Target $target completes" } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Makefile and Makefile.PL present, for simple targets { END { unlink 'Makefile' } open my($fh), ">", "Makefile"; close $fh; } my %target_needs_more = map { $_, 1 } qw(dist test disttest); foreach my $target ( @makefile_targets, @makefile_pl_targets ) { next if exists $target_needs_more{$target}; ok( -e 'Makefile', 'Makefile is there' ); ok( -e 'Makefile.PL', 'Makefile.PL is not there' ); stdout_like { eval { $release->$target() } } qr/done/, "Target $target completes" } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # test and dist_test needs output from run to see if # all tests were successful foreach my $target ( qw(test disttest ) ) { stdout_like { eval { $release->$target() } } qr/Checking make $target.../, "Target test runs"; { local $run_output = ''; my $rc = eval { $release->turn_quiet_on; $release->$target(); 1 }; my $at = $@; ok( ! defined $rc, "make test fails" ); like( $at, qr/Tests failed/i, "make test dies because tests did not pass" ); $release->turn_quiet_off; } { local $run_output = 'All tests successful'; stdout_like { eval { $release->$target() } } qr/pass/, "All tests pass with right run output"; } } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # dist needs output from run to see if all tests were successful # It also needs to see an archive file after it is done ok( -e 'Makefile', 'Makefile is there' ); ok( -e 'Makefile.PL', 'Makefile.PL is not there' ); $release->turn_quiet_off; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # First, try it without a local file name (will try to guess) # no output from run # should fail when guessing fails { $release->local_file( undef ); ok( ! defined $release->local_file, "Local file is not defined (good)" ); { local $run_output = ''; $release->turn_quiet_on; my $rc = eval { $release->dist; 1 }; my $at = $@; ok( ! defined $rc, "make dist dies when local file is missing" ); like( $at, qr/Couldn't guess/i, "dist fails whenit can't guess local name" ); $release->turn_quiet_off; } is( $release->local_file, undef, "Local file is undef (good)" ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Second, try it without a local file name (will try to guess) # expected output from run # should fail because guessed file doesn't exist { local $run_output = 'gzip foo.tar'; { # make sure we know where we are no warnings 'uninitialized'; $release->local_file( undef ); ok( ! defined $release->local_file, "Local file is not defined (good)" ); ok( ! -e $release->local_file, "Local file does not exist (good)" ); } { $release->turn_quiet_on; my $rc = eval { $release->dist; 1 }; my $at = $@; is( $release->local_file, 'foo.tar.gz', 'file name has right name' ); is( $release->local_file, $release->remote_file, 'local and remote are the same' ); ok( ! -e $release->local_file, "Local file does not exist (good)" ); ok( ! defined $rc, "make dist dies when missing local file" ); like( $at, qr/ does not exist/i, "dist claims local file does not exist" ); $release->turn_quiet_off; } is( $release->local_file, 'foo.tar.gz', "Local file guessed from output" ); } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Next, try it with a local file name, but with a file does not exist # should fail because set file name does not exist { $release->local_file('not_there'); ok( defined $release->local_file, "Local file is defined" ); ok( ! -e $release->local_file, "Local file does not exist (good)" ); stdout_like { eval{ $release->dist } } qr/Making dist/, "Target dist runs"; { local $run_output = ''; $release->turn_quiet_on; my $rc = eval { $release->dist; 1 }; my $at = $@; ok( ! defined $rc, "make dist fails when local file is missing" ); like( $at, qr/does not exist/i, "make test dies because local file does not exist" ); $release->turn_quiet_off; } } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Finally, everything should work # guess the name, the file is there { { END { unlink 'foo.tar.gz' } open my($fh), ">", "foo.tar.gz"; close $fh; } ok( -e 'foo.tar.gz', 'mock distro foo.tar.gz exists' ); local $run_output = 'gzip foo.tar'; $release->local_file( undef ); ok( ! defined $release->local_file, "Local file is not defined (good)" ); stdout_like { eval{ $release->dist } } qr/done/, "Target dist runs and finishes"; is( $release->local_file, 'foo.tar.gz', "Local file guessed from output" ); }
25.896797
92
0.587605
73da8d4160e275fd016e863f9fcaecb0e2b3ff3f
12,728
pm
Perl
lib/Biber/Output/dot.pm
debian-janitor/biber
8ced5ed847324239220f8105909154dc9255eeaf
[ "ClArtistic" ]
null
null
null
lib/Biber/Output/dot.pm
debian-janitor/biber
8ced5ed847324239220f8105909154dc9255eeaf
[ "ClArtistic" ]
null
null
null
lib/Biber/Output/dot.pm
debian-janitor/biber
8ced5ed847324239220f8105909154dc9255eeaf
[ "ClArtistic" ]
2
2020-05-04T19:20:47.000Z
2021-09-01T04:55:04.000Z
package Biber::Output::dot; use v5.24; use strict; use warnings; use parent qw(Biber::Output::base); use Biber::Config; use Biber::Constants; use Biber::Entry; use Biber::Utils; use List::AllUtils qw( :all ); use IO::File; use Log::Log4perl qw( :no_extra_logdie_message ); use Unicode::Normalize; my $logger = Log::Log4perl::get_logger('main'); =encoding utf-8 =head1 NAME Biber::Output::dot - class for Biber output of GraphViz .dot files =cut =head2 new Initialize a Biber::Output::dot object =cut my $graph; # accumulator for .dot string my $graph_edges = ''; # accumulator for .dot string. Initialise as can be empty my $state; # some state information for building output my $in; # indentation string my $i; # indentation level my $gopts = Biber::Config->getoption('dot_include'); my $linknode; # node to use to do cluster links sub new { my $class = shift; my $obj = shift; my $self = $class->SUPER::new($obj); $self->{output_data}{HEAD} = <<~EOF; digraph Biberdata { compound = true; edge [ arrowhead=open ]; graph [ style=filled, rankdir=LR ]; node [ fontsize=10, fillcolor=white, style=filled, shape=box ]; EOF return $self; } =head2 set_output_target_file Set the output target file of a Biber::Output::dot object A convenience around set_output_target so we can keep track of the filename =cut sub set_output_target_file { my $self = shift; my $dotfile = shift; $self->{output_target_file} = $dotfile; return IO::File->new($dotfile, '>:encoding(UTF-8)'); } =head2 set_output_entry We don't use this, we output everything in one go at the end =cut sub set_output_entry { return; } =head2 create_output_section We don't use this, we output everything in one go at the end =cut sub create_output_section { return; } =head2 output Create a graph of the required things and save to .dot format =cut sub output { my $self = shift; my $biber = $Biber::MASTER; my $data = $self->{output_data}; my $target = $self->{output_target}; my $target_string = "Target"; # Default if ($self->{output_target_file}) { $target_string = $self->{output_target_file}; } # for debugging mainly unless ($target) { $target = new IO::File '>-'; } if ($logger->is_debug()) {# performance tune $logger->debug('Preparing final output using class ' . __PACKAGE__ . '...'); } $logger->info("Writing '$target_string' with encoding 'UTF-8'"); out($target, $data->{HEAD}); $in = 2; # indentation $i = ' '; # starting indentation # Loop over sections, sort so we can run tests foreach my $section (sort {$a->number <=> $b->number} $biber->sections->get_sections->@*) { my $secnum = $section->number; if ($gopts->{section}) { $graph .= $i x $in . "subgraph \"cluster_section${secnum}\" {\n"; $in += 2; $graph .= $i x $in . "label=\"Section $secnum\";\n"; $graph .= $i x $in . "tooltip=\"Section $secnum\";\n"; $graph .= $i x $in . "fontsize=\"10\";\n"; $graph .= $i x $in . "fontname=serif;\n"; $graph .= $i x $in . "fillcolor=\"#fce3fa\";\n"; $graph .= "\n"; } # First create nodes/groups for entries foreach my $be (sort {$a->get_field('citekey') cmp $b->get_field('citekey')} $section->bibentries->entries) { my $citekey = $be->get_field('citekey'); $state->{$secnum}{"${secnum}/${citekey}"} = 1; my $et = uc($be->get_field('entrytype')); # colour depends on whether cited, uncited, dataonly or key alias my $c = $section->has_citekey($citekey) ? '#a0d0ff' : '#deefff'; if (my $options = $be->get_field('options')) { $c = '#fdffd9' if $options =~ m/skip(?:bib|biblist|lab)/o; } $c = '#a1edec' if $section->get_citekey_alias($citekey); # make a set subgraph if a set member # This will make identically named subgraph sections for # every element in a set but dot is clever enough to merge them by # ID. if (my $sets = Biber::Config->get_graph('set')) { if (my $set = $sets->{memtoset}{$citekey}) { # entry is a set member $graph .= $i x $in . "subgraph \"cluster_${secnum}/set_${set}\" {\n"; $in += 2; $graph .= $i x $in . "label=\"$set (SET)\";\n"; $graph .= $i x $in . "tooltip=\"$set (SET)\";\n"; $graph .= $i x $in . "fontsize=\"10\";\n"; $graph .= $i x $in . "fontname=serif;\n"; $graph .= $i x $in . "fillcolor=\"#e3dadc\";\n"; $graph .= "\n"; } next if $sets->{settomem}{$citekey}; # Don't make normal nodes for sets } # Citekey aliases my $aliases = ''; foreach my $alias (sort $section->get_citekey_aliases) { my $realkey = $section->get_citekey_alias($alias); if ($realkey eq $citekey) { $aliases .= "\\n$alias (alias)"; } } if ($gopts->{field}) { # If granularity is at the level of fields $graph .= $i x $in . "subgraph \"cluster_section${secnum}/${citekey}\" {\n"; $in += 2; $graph .= $i x $in . "fontsize=\"10\";\n"; $graph .= $i x $in . "label=\"$citekey ($et)$aliases\";\n"; $graph .= $i x $in . "tooltip=\"$citekey ($et)\";\n"; $graph .= $i x $in . "fillcolor=\"$c\";\n"; $graph .= "\n"; foreach my $field (sort $be->datafields) { $graph .= $i x $in . "\"section${secnum}/${citekey}/${field}\" [ label=\"" . uc($field) . "\" ]\n"; } $in -= 2; $graph .= $i x $in . "}\n\n"; # link node for cluster->cluster links my $middle = int($be->count_datafields / 2); $state->{$secnum}{$citekey}{linknode} = ($be->datafields)[$middle]; } else { # Granularity is at the level of entries $graph .= $i x $in . "\"section${secnum}/${citekey}\" [ label=\"$citekey ($et)$aliases\", fillcolor=\"$c\", tooltip=\"$citekey ($et)\" ]\n"; } # Close set subgraph if necessary if (my $sets = Biber::Config->get_graph('set')) { if ($sets->{memtoset}{$citekey}) { # entry is a set member $graph .= $i x $in . "}\n\n"; $in -= 2; } } } # Then add the requested links # crossrefs _graph_inheritance('crossref', $secnum) if $gopts->{crossref}; # xdata _graph_inheritance('xdata', $secnum) if $gopts->{xdata}; # xref _graph_xref($secnum) if $gopts->{xref}; # related _graph_related($secnum) if $gopts->{related}; # Close the section, if any if ($gopts->{section}) { $graph .= $i x $in . "}\n\n"; $in -= 2; } } $graph .= "\n\n${graph_edges}"; $graph .= "\n}\n"; out($target, $graph); $logger->info("Output to $target_string"); close $target; return; } # Graph related entries sub _graph_related { my $secnum = shift; if (my $gr = Biber::Config->get_graph('related')) { # related links foreach my $f_entry (sort keys $gr->{clonetotarget}->%*) { my $m = $gr->{clonetotarget}{$f_entry}; foreach my $t_entry (sort keys $m->%*) { next unless $state->{$secnum}{"${secnum}/${f_entry}"}; next unless $state->{$secnum}{"${secnum}/${t_entry}"}; if ($gopts->{field}) { # links between clusters my $f_linknode = $state->{$secnum}{$f_entry}{linknode}; my $t_linknode = $state->{$secnum}{$t_entry}{linknode}; $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}/${f_linknode}\" -> \"section${secnum}/${t_entry}/${t_linknode}\" [ penwidth=\"2.0\", color=\"#ad1741\", ltail=\"cluster_section${secnum}/${f_entry}\", lhead=\"cluster_section${secnum}/${t_entry}\", tooltip=\"${f_entry} is a related entry of ${t_entry}\" ]\n"; } else { # links between nodes $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}\" -> \"section${secnum}/${t_entry}\" [ penwidth=\"2.0\", color=\"#ad1741\", tooltip=\"${f_entry} is a related entry of ${t_entry}\" ]\n"; } } } # clone links foreach my $f_entry (sort keys $gr->{reltoclone}->%*) { my $m = $gr->{reltoclone}{$f_entry}; foreach my $t_entry (sort keys $m->%*) { next unless $state->{$secnum}{"${secnum}/${f_entry}"}; next unless $state->{$secnum}{"${secnum}/${t_entry}"}; if ($gopts->{field}) { # links between clusters my $f_linknode = $state->{$secnum}{$f_entry}{linknode}; my $t_linknode = $state->{$secnum}{$t_entry}{linknode}; $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}/${f_linknode}\" -> \"section${secnum}/${t_entry}/${t_linknode}\" [ style=\"dashed\", penwidth=\"2.0\", color=\"#ad1741\", ltail=\"cluster_section${secnum}/${f_entry}\", lhead=\"cluster_section${secnum}/${t_entry}\", tooltip=\"${t_entry} is a clone of ${f_entry}\" ]\n"; } else { # links between nodes $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}\" -> \"section${secnum}/${t_entry}\" [ style=\"dashed\", penwidth=\"2.0\", color=\"#ad1741\", tooltip=\"${t_entry} is a clone of ${f_entry}\" ]\n"; } } } } } # Graph xrefs sub _graph_xref { my $secnum = shift; if (my $gr = Biber::Config->get_graph('xref')) { foreach my $f_entry (sort keys $gr->%*) { my $t_entry = $gr->{$f_entry}; next unless $state->{$secnum}{"${secnum}/${f_entry}"}; next unless $state->{$secnum}{"${secnum}/${t_entry}"}; if ($gopts->{field}) { # links between clusters my $f_linknode = $state->{$secnum}{$f_entry}{linknode}; my $t_linknode = $state->{$secnum}{$t_entry}{linknode}; $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}/${f_linknode}\" -> \"section${secnum}/${t_entry}/${t_linknode}\" [ penwidth=\"2.0\", style=\"dashed\", color=\"#7d7879\", ltail=\"cluster_section${secnum}/${f_entry}\", lhead=\"cluster_section${secnum}/${t_entry}\", tooltip=\"${f_entry} XREFS ${t_entry}\" ]\n"; } else { # links between nodes $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}\" -> \"section${secnum}/${t_entry}\" [ penwidth=\"2.0\", style=\"dashed\", color=\"#7d7879\", tooltip=\"${f_entry} XREFS ${t_entry}\" ]\n"; } } } } # Graph crossrefs and xdata sub _graph_inheritance { my ($type, $secnum) = @_; my $edgecolor; if ($type eq 'crossref') { $edgecolor = '#7d7879'; } elsif ($type eq 'xdata') { $edgecolor = '#2ca314'; } if (my $gr = Biber::Config->get_graph($type)) { # Show fields if ($gopts->{field}) { foreach my $f_entry (sort keys $gr->%*) { my $v = $gr->{$f_entry}; foreach my $f_field (sort keys $v->%*) { my $w = $v->{$f_field}; foreach my $t_entry (sort keys $w->%*) { foreach my $t_field ($w->{$t_entry}->@*) { next unless $state->{$secnum}{"${secnum}/${f_entry}"}; next unless $state->{$secnum}{"${secnum}/${t_entry}"}; $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}/${f_field}\" -> \"section${secnum}/${t_entry}/${t_field}\" [ penwidth=\"2.0\", color=\"${edgecolor}\", tooltip=\"${t_entry}/" . uc($t_field) . " inherited via " . uc($type) . " from ${f_entry}/" . uc($f_field) . "\" ]\n"; } } } } } # Just show the entries, no fields else { foreach my $f_entry (sort keys $gr->%*) { my $v = $gr->{$f_entry}; foreach my $w (sort values $v->%*) { foreach my $t_entry (sort keys $w->%*) { next unless $state->{$secnum}{"${secnum}/${f_entry}"}; next unless $state->{$secnum}{"${secnum}/${t_entry}"}; next if $state->{edges}{"section${secnum}/${f_entry}"}{"section${secnum}/${t_entry}"}; $graph_edges .= $i x $in . "\"section${secnum}/${f_entry}\" -> \"section${secnum}/${t_entry}\" [ penwidth=\"2.0\", color=\"${edgecolor}\", tooltip=\"${t_entry} inherits via $type from ${f_entry}\" ]\n"; $state->{edges}{"section${secnum}/${f_entry}"}{"section${secnum}/${t_entry}"} = 1; } } } } } } 1; __END__ =head1 AUTHORS Philip Kime C<< <philip at kime.org.uk> >> =head1 BUGS Please report any bugs or feature requests on our Github tracker at L<https://github.com/plk/biber/issues>. =head1 COPYRIGHT & LICENSE Copyright 2012-2020 Philip Kime, all rights reserved. This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. 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. =cut
33.05974
337
0.568196
73f85c565acc415493c1202b5949e50cbdb43d3f
3,504
pm
Perl
inc/Perl/Critic/Module/Build.pm
gitpan/Perl-Critic
235b267b13687b3bcc4af7b312b792f7cdcececc
[ "Artistic-1.0" ]
null
null
null
inc/Perl/Critic/Module/Build.pm
gitpan/Perl-Critic
235b267b13687b3bcc4af7b312b792f7cdcececc
[ "Artistic-1.0" ]
null
null
null
inc/Perl/Critic/Module/Build.pm
gitpan/Perl-Critic
235b267b13687b3bcc4af7b312b792f7cdcececc
[ "Artistic-1.0" ]
null
null
null
package Perl::Critic::Module::Build; use 5.006001; use strict; use warnings; our $VERSION = '1.116'; use Carp; use English qw< $OS_ERROR $EXECUTABLE_NAME -no_match_vars >; use base 'Perl::Critic::Module::Build::Standard'; sub ACTION_policysummary { my ($self) = @_; require Perl::Critic::PolicySummaryGenerator; Perl::Critic::PolicySummaryGenerator->import( qw< generate_policy_summary > ); my $policy_summary_file = generate_policy_summary(); $self->add_to_cleanup( $policy_summary_file ); return; } sub ACTION_nytprof { my ($self) = @_; $self->depends_on('build'); $self->_run_nytprof(); return; } sub authortest_dependencies { my ($self) = @_; $self->depends_on('policysummary'); $self->SUPER::authortest_dependencies(); return; } sub _run_nytprof { my ($self) = @_; eval { require Devel::NYTProf; 1 } or croak 'Devel::NYTProf is required to run nytprof'; eval { require File::Which; File::Which->import('which'); 1 } or croak 'File::Which is required to run nytprof'; my $nytprofhtml = which('nytprofhtml') or croak 'Could not find nytprofhtml in your PATH'; my $this_perl = $EXECUTABLE_NAME; my @perl_args = qw(-Iblib/lib -d:NYTProf blib/script/perlcritic); my @perlcritic_args = qw< --noprofile --severity=1 --theme=core --exclude=TidyCode --exclude=PodSpelling --exclude=RcsKeywords blib >; warn "Running: $this_perl @perl_args @perlcritic_args\n"; my $status_perlcritic = system $this_perl, @perl_args, @perlcritic_args; croak "perlcritic failed with status $status_perlcritic" if $status_perlcritic == 1; my $status_nytprofhtml = system $nytprofhtml; croak "nytprofhtml failed with status $status_nytprofhtml" if $status_nytprofhtml; return; } 1; __END__ #----------------------------------------------------------------------------- =pod =for stopwords =head1 NAME Perl::Critic::Module::Build - Customization of L<Module::Build> for L<Perl::Critic>. =head1 DESCRIPTION This is a custom subclass of L<Module::Build> (actually, L<Perl::Critic::Module::Build::Standard>) that enhances existing functionality and adds more for the benefit of installing and developing L<Perl::Critic>. The following actions have been added or redefined: =head1 ACTIONS =over =item policysummary Generates the F<PolicySummary.pod> file. This should only be used by C<Perl::Critic> developers. This action is also invoked by the C<authortest> action, so the F<PolicySummary.pod> file will be generated whenever you create a distribution with the C<dist> or C<distdir> targets. =item nytprof Runs perlcritic under the L<Devel::NYTProf> profiler and generates an HTML report in F<nytprof/index.html>. =back =head1 AUTHOR Elliot Shank <perl@galumph.com> =head1 COPYRIGHT Copyright (c) 2007-2011 Elliot Shank. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. =cut ############################################################################## # Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 78 # indent-tabs-mode: nil # c-indentation-style: bsd # End: # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
22.037736
84
0.653824
ed29102939d4eda0d54200c57ba4f74cf60c766c
51
pm
Perl
auto-lib/Azure/Cdn/ResourceType.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
null
null
null
auto-lib/Azure/Cdn/ResourceType.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
null
null
null
auto-lib/Azure/Cdn/ResourceType.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
1
2021-04-08T15:26:39.000Z
2021-04-08T15:26:39.000Z
package Azure::Cdn::ResourceType; use Moose; 1;
10.2
33
0.705882
ed1a24e5fa50600ac7de8e9d6e504fc1e7ce3560
1,275
pl
Perl
ZimbraServer/src/db/migration/optimizeMboxgroups.pl
fciubotaru/z-pec
82335600341c6fb1bb8a471fd751243a90bc4d57
[ "MIT" ]
5
2019-03-26T07:51:56.000Z
2021-08-30T07:26:05.000Z
ZimbraServer/src/db/migration/optimizeMboxgroups.pl
fciubotaru/z-pec
82335600341c6fb1bb8a471fd751243a90bc4d57
[ "MIT" ]
1
2015-08-18T19:03:32.000Z
2015-08-18T19:03:32.000Z
ZimbraServer/src/db/migration/optimizeMboxgroups.pl
fciubotaru/z-pec
82335600341c6fb1bb8a471fd751243a90bc4d57
[ "MIT" ]
13
2015-03-11T00:26:35.000Z
2020-07-26T16:25:18.000Z
#!/usr/bin/perl # # ***** BEGIN LICENSE BLOCK ***** # Zimbra Collaboration Suite Server # Copyright (C) 2008, 2009, 2010 Zimbra, Inc. # # The contents of this file are subject to the Zimbra Public License # Version 1.3 ("License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://www.zimbra.com/license. # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. # ***** END LICENSE BLOCK ***** # use strict; use Migrate; use Getopt::Long; my $concurrent = 10; sub usage() { print STDERR "Usage: optimizeMboxgroups.pl\n"; exit(1); } my $opt_h; GetOptions("help" => \$opt_h); usage() if $opt_h; my @groups = Migrate::getMailboxGroups(); my @sql = (); foreach my $group (@groups) { foreach my $table (qw(mail_item appointment imap_folder imap_message open_conversation pop3_message revision tombstone)) { print "Adding $group.$table to be optimized\n"; push(@sql, "OPTIMIZE TABLE $group.$table;"); } } my $start = time(); Migrate::runSqlParallel($concurrent, @sql); my $elapsed = time() - $start; my $numGroups = scalar @groups; print "\nOptimized $numGroups mailbox groups in $elapsed seconds\n"; exit(0);
27.717391
124
0.698824
73e49a4013df5734e1f7288e0458caac8987a7d1
189
pl
Perl
learningtasks/suramin/prolog/data/toplog/mode.pl
AKSW/STILE
278dbeab8224776bc97f77b71002f2eefe659589
[ "Apache-2.0" ]
14
2017-09-20T23:26:30.000Z
2020-04-24T09:42:32.000Z
learningtasks/suramin/prolog/data/toplog/mode.pl
AKSW/DL-Learning-Benchmark
278dbeab8224776bc97f77b71002f2eefe659589
[ "Apache-2.0" ]
12
2016-03-16T11:08:33.000Z
2017-03-06T17:31:01.000Z
learningtasks/suramin/prolog/data/toplog/mode.pl
AKSW/DL-Learning-Benchmark
278dbeab8224776bc97f77b71002f2eefe659589
[ "Apache-2.0" ]
3
2016-04-29T13:40:23.000Z
2016-11-01T12:39:12.000Z
:- modeh(1,active(+drug)). :- modeb(*,atm(+drug,-atomid,-element,#integer,#real)). :- modeb(*,bond(+drug,+atomid,-atomid,#integer)). :- modeb(*,drug(+drug)). :- modeb(*,element(+element)).
31.5
55
0.613757
73d4b38b3bbd47f8b5811ae6a12541391063fba7
57,258
pm
Perl
lib/autobox/Transform.pm
shadow-dot-cat/p5-autobox-Transform
b18a02a59229ca510e1941458c3dc4f4cac3a763
[ "Artistic-1.0" ]
null
null
null
lib/autobox/Transform.pm
shadow-dot-cat/p5-autobox-Transform
b18a02a59229ca510e1941458c3dc4f4cac3a763
[ "Artistic-1.0" ]
null
null
null
lib/autobox/Transform.pm
shadow-dot-cat/p5-autobox-Transform
b18a02a59229ca510e1941458c3dc4f4cac3a763
[ "Artistic-1.0" ]
null
null
null
package autobox::Transform; use strict; use warnings; use 5.010; use parent qw/autobox/; our $VERSION = "1.034"; =head1 NAME autobox::Transform - Autobox methods to transform Arrays and Hashes =head1 CONTEXT L<autobox> provides the ability to call methods on native types, e.g. strings, arrays, and hashes as if they were objects. L<autobox::Core> provides the basic methods for Perl core functions like C<uc>, C<map>, and C<grep>. This module, C<autobox::Transform>, provides higher level and more specific methods to transform and manipulate arrays and hashes, in particular when the values are hashrefs or objects. =head1 SYNOPSIS use autobox::Core; # map, uniq, sort, join, sum, etc. use autobox::Transform; =head2 Arrays # use autobox::Core for ->map etc. # filter (like a more versatile grep) $book_locations->filter(); # true values $books->filter(sub { $_->is_in_library($library) }); $book_names->filter( qr/lord/i ); $book_genres->filter("scifi"); $book_genres->filter({ fantasy => 1, scifi => 1 }); # hash key exists # reject: the inverse of filter $book_genres->reject("fantasy"); # order (like a more succinct sort) $book_genres->order; $book_genres->order("desc"); $book_prices->order([ "num", "desc" ]); $books->order([ sub { $_->{price} }, "desc", "num" ]); $log_lines->order([ num => qr/pid: "(\d+)"/ ]); $books->order( [ sub { $_->{price} }, "desc", "num" ] # first price sub { $_->{name} }, # then name ); # group (aggregate) array into hash $book_genres->group; # "Sci-fi" => "Sci-fi" $book_genres->group_count; # "Sci-fi" => 3 $book_genres->group_array; # "Sci-fi" => [ "Sci-fi", "Sci-fi", "Sci-fi"] # Flatten arrayrefs-of-arrayrefs $authors->map_by("books") # ->books returns an arrayref # [ [ $book1, $book2 ], [ $book3 ] ] $authors->map_by("books")->flat; # [ $book1, $book2, $book3 ] # Return reference, even in list context, e.g. in a parameter list $book_locations->filter()->to_ref; # Return array, even in scalar context @books->to_array; # Turn paired items into a hash @titles_books->to_hash; =head2 Arrays with hashrefs/objects # $books and $authors below are arrayrefs with either objects or # hashrefs (the call syntax is the same). These have methods/hash # keys like C<$book->genre()>, C<$book->{is_sold_out}>, # C<$book->is_in_library($library)>, etc. $books->map_by("genre"); $books->map_by([ price_with_tax => $tax_pct ]); $books->filter_by("is_sold_out"); $books->filter_by([ is_in_library => $library ]); $books->filter_by([ price_with_tax => $rate ], sub { $_ > 56.00 }); $books->filter_by("price", sub { $_ > 56.00 }); $books->filter_by("author", "James A. Corey"); $books->filter_by("author", qr/corey/i); # grep_by is an alias for filter_by $books->grep_by("is_sold_out"); # reject_by: the inverse of filter_by $books->reject_by("is_sold_out"); $books->uniq_by("id"); $books->order_by("name"); $books->order_by(name => "desc"); $books->order_by(price => "num"); $books->order_by(price => [ "num", "desc" ]); $books->order_by(name => [ sub { uc($_) }, "desc" ]); $books->order_by([ price_with_tax => $rate ] => "num"); $books->order_by( author => "str", # first by author price => [ "num", "desc" ], # then by price, most expensive first ); $books->order_by( author => [ "desc", sub { uc($_) } ], [ price_with_tax => $rate ] => [ "num", "desc" ], "name", ); $books->group_by("title"), # { # "Leviathan Wakes" => $books->[0], # "Caliban's War" => $books->[1], # "The Tree-Body Problem" => $books->[2], # "The Name of the Wind" => $books->[3], # }, $authors->group_by([ publisher_affiliation => "with" ]), # { # 'James A. Corey with Orbit' => $authors->[0], # 'Cixin Liu with Head of Zeus' => $authors->[1], # 'Patrick Rothfuss with Gollanz' => $authors->[2], # }, $books->group_by_count("genre"), # { # "Sci-fi" => 3, # "Fantasy" => 1, # }, my $genre_books = $books->group_by_array("genre"); # { # "Sci-fi" => [ $sf_book_1, $sf_book_2, $sf_book_3 ], # "Fantasy" => [ $fantasy_book_1 ], # }, =head2 Hashes # map over each pair # e.g. Upper-case the genre name, and make the count say "n books" # (return a key => value pair) $genre_count->map_each(sub { uc( $_[0] ) => "$_ books" }); # { # "FANTASY" => "1 books", # "SCI-FI" => "3 books", # }, # map over each value # e.g. Make the count say "n books" # (return the new value) $genre_count->map_each_value(sub { "$_ books" }); # { # "Fantasy" => "1 books", # "Sci-fi" => "3 books", # }, # map each pair into an array # e.g. Transform each pair to the string "n: genre" # (return list of items) $genre_count->map_each_to_array(sub { "$_: $_[0]" }); # [ "1: Fantasy", "3: Sci-fi" ] # filter each pair # Genres with more than five books $genre_count->filter_each(sub { $_ > 5 }); # filter out each pair # Genres with no more than five books $genre_count->reject_each(sub { $_ > 5 }); # Return reference, even in list context, e.g. in a parameter list %genre_count->to_ref; # Return hash, even in scalar context $author->book_count->to_hash; # Turn key-value pairs into an array %isbn__book->to_array; =head2 Combined examples my $order_authors = $order->books ->filter_by("title", qr/^The/) ->uniq_by("isbn") ->map_by("author") ->uniq_by("name") ->order_by(publisher => "str", name => "str") ->map_by("name")->uniq->join(", "); my $total_order_amount = $order->books ->reject_by("is_sold_out") ->filter_by([ covered_by_vouchers => $vouchers ], sub { ! $_ }) ->map_by([ price_with_tax => $tax_pct ]) ->sum; =cut use Carp; sub import { my $self = shift; $self->SUPER::import( ARRAY => "autobox::Transform::Array" ); $self->SUPER::import( HASH => "autobox::Transform::Hash" ); } sub throw { my ($error) = @_; ###JPL: remove lib $error =~ s/ at [\\\/\w ]*?\bautobox.Transform\.pm line \d+\.\n?$//; local $Carp::CarpLevel = 1; croak($error); } # Normalize the two method calling styles for accessor + args: # $acessor, $args_arrayref # or # $acessor_and_args_arrayref sub _normalized_accessor_args_subref { my ($accessor, $args, $subref) = @_; # Note: unfortunately, this won't allow the $subref (modifier) to # become an arrayref later on when we do many types of modifiers # (string eq, qr regex match, sub call, arrayref in) for # filtering. # # That has to happen after the deprecation has expired and the old # syntax is removed. if(ref($args) eq "CODE") { $subref = $args; # Move down one step $args = undef; } if(ref($accessor) eq "ARRAY") { ($accessor, my @args) = @$accessor; $args = \@args; } return ($accessor, $args, $subref); } ###JPL: rename subref to predicate # Normalize the two method calling styles for accessor + args: # $acessor, $args_arrayref, $modifier # or # $acessor_and_args_arrayref, $modifier sub _normalized_accessor_args_predicate { my ($accessor, $args, $subref) = @_; # Note: unfortunately, this won't allow the $subref (modifier) to # be an arrayref, or undef for many types of modifiers (string eq, # qr regex match, sub call, arrayref in) for filtering. # # That has to happen after the deprecation has expired and the old # syntax is removed. if(defined($args) && ref($args) ne "ARRAY") { $subref = $args; # Move down one step $args = undef; } if(ref($accessor) eq "ARRAY") { ($accessor, my @args) = @$accessor; $args = \@args; } return ($accessor, $args, $subref); } sub _predicate { my ($name, $predicate, $default_predicate) = @_; # No predicate, use default is_true defined($predicate) or return $default_predicate; # scalar, do string eq my $type = ref($predicate) or return sub { $predicate eq $_ }; $type eq "CODE" and return $predicate; $type eq "Regexp" and return sub { $_ =~ $predicate }; $type eq "HASH" and return sub { exists $predicate->{ $_ } }; # Invalid predicate Carp::croak("->$name() \$predicate: ($predicate) is not one of: subref, string, regex"); } =head1 DESCRIPTION C<autobox::Transform> provides high level autobox methods you can call on arrays, arrayrefs, hashes and hashrefs. =head2 Transforming lists of objects vs list of hashrefs C<map_by>, C<filter_by> C<order_by> etc. (all methods named C<*_by>) work with sets of hashrefs or objects. These methods are called the same way regardless of whether the array contains objects or hashrefs. The items in the list must be either all objects or all hashrefs. If the array contains hashrefs, the hash key is looked up on each item. If the array contains objects, a method is called on each object (possibly with the arguments provided). =head3 Calling accessor methods with arguments For method calls, it's possible to provide arguments to the method. Consider C<map_by>: $array->map_by($accessor) If the $accessor is a string, it's a simple method call. # method call without args $books->map_by("price") # becomes $_->price() or $_->{price} If the $accessor is an arrayref, the first item is the method name, and the rest of the items are the arguments to the method. # method call with args $books->map_by([ price_with_discount => 5.0 ]) # becomes $_->price_with_discount(5.0) =head3 Deprecated syntax There is an older syntax for calling methods with arguments. It was abandoned to open up more powerful ways to use grep/filter type methods. Here it is for reference, in case you run into existing code. $array->filter_by($accessor, $args, $subref) $books->filter_by("price_with_discount", [ 5.0 ], sub { $_ < 15.0 }) Call the method $accessor on each object using the arguments in the $args arrayref like so: $object->$accessor(@$args) I<This style is deprecated>, and planned for removal in version 2.000, so if you have code with the old call style, please: =over 4 =item Replace your existing code with the new style as soon as possible. The change is trivial and the code easily found by grep/ack. =item If need be, pin your version to < 2.000 in your cpanfile, dist.ini or whatever you use to avoid upgrading modules to incompatible versions. =back =head2 Filter predicates There are several methods that filter items, e.g. C<@array-E<gt>filter> (duh), C<@array-E<gt>filter_by>, and C<%hash-E<gt>filter_each>. These methods take a C<$predicate> argument to determine which items to retain or filter out. The C<reject> family of methods do the opposite, and I<filter out> items that match the predicate, i.e. the opposite of the filter methods. If $predicate is an I<unblessed scalar>, it is compared to each value with C<string eq>. $books->filter_by("author", "James A. Corey"); If $predicate is a I<regex>, it is compared to each value with C<=~>. $books->reject_by("author", qr/Corey/); If $predicate is a I<hashref>, values in @array are retained if the $predicate hash key C<exists> (the hash values are irrelevant). $books->filter_by( "author", { "James A. Corey" => undef, "Cixin Liu" => 0, "Patrick Rothfuss" => 1, }, ); If $predicate is a I<subref>, the subref is called for each value to check whether this item should remain in the list. The $predicate subref should return a true value to remain. C<$_> is set to the current $value. $authors->filter_by(publisher => sub { $_->name =~ /Orbit/ }); =head2 Sorting using order and order_by Let's first compare how sorting is done with Perl's C<sort> and autobox::Transform's C<order>/C<order_by>. =head3 Sorting with sort =over 4 =item * provide a sub that returns the comparison outcome of two values: C<$a> and C<$b> =item * in case of a tie, provide another comparison of $a and $b =back # If the name is the same, compare age (oldest first) sort { uc( $a->{name} ) cmp uc( $b->{name} ) # first comparison || int( $b->{age} / 10 ) <=> int( $a->{age} / 10 ) # second comparison } @users (note the opposite order of C<$a> and C<$b> for the age comparison, something that's often difficult to discern at a glance) =head3 Sorting with order, order_by =over 4 =item * Provide order options for how one value should be compared with the others: =over 8 =item * how to compare (C<cmp> or C<<=E<gt>>) =item * which direction to sort (C<asc>ending or C<desc>ending) =item * which value to compare, using a regex or subref, e.g. by uc($_) =back =item * In case of a tie, provide another comparison =back # If the name is the same, compare age (oldest first) # ->order @users->order( sub { uc( $_->{name} ) }, # first comparison [ "num", sub { int( $_->{age} / 10 ) }, "desc" ], # second comparison ) # ->order_by @users->order_by( name => sub { uc }, # first comparison age => [ num => desc => sub { int( $_ / 10 ) } ], # second comparison ) =head3 Comparison Options If there's only one option for a comparison (e.g. C<num>), provide a single option (string/regex/subref) value. If there are many options, provide them in an arrayref in any order. =head3 Comparison operator =over 4 =item * C<"str"> (cmp) - default =item * C<"num"> (<=>) =back =head3 Sort order =over 4 =item * C<"asc"> (ascending) - default =item * C<"desc"> (descending) =back =head3 The value to compare =over 4 =item * A subref - default is: C<sub { $_ }> =over 8 =item * The return value is used in the comparison =back =item * A regex, e.g. C<qr/id: (\d+)/> =over 8 =item * The value of C<join("", @captured_groups)> are used in the comparison (C<@captured_groups> are C<$1>, C<$2>, C<$3> etc.) =back =back =head3 Examples of a single comparison # order: the first arg is the comparison options (one or an # arrayref with many options) ->order() # Defaults to str, asc, $_, just like sort ->order("num") ->order(sub { uc($_) }) # compare captured matches, e.g. "John" and "Doe" as "JohnDoe" ->order( qr/first_name: (\w+), last_name: (\w+)/ ) ->order([ num => qr/id: (\d+)/ ]) ->order([ sub { int($_) }, "num" ]) # order_by: the first arg is the accessor, just like with # map_by. Second arg is the comparison options (one or an arrayref # with many options) ->order_by("id") ->order_by("id", "num") ->order_by("id", [ "num", "desc" ]) ->order_by("name", sub { uc($_) }) ->order_by(log_line => qr/first_name: (\w+), last_name: (\w+)/ ) ->order_by("log_line", [ num => qr/id: (\d+)/ ]) ->order_by(age => [ sub { int($_) }, "num" ]) # compare int( $a->age_by_interval(10) ) ->order_by([ age_by_interval => 10 ] => [ sub { int($_) }, "num" ]) # compare uc( $a->name_with_title($title) ) ->order_by([ name_with_title => $title ], sub { uc($_) }) =head3 Examples of fallback comparisons When the first comparison is a tie, the subsequent ones are used. # order: list of comparison options (one or an arrayref with many # options, per comparison) ->order( [ sub { $_->{price} }, "num" ], # First a numeric comparison of price [ sub { $_->{name} }, "desc" ], # or if same, a reverse comparison of the name ) ->order( [ sub { uc($_) }, "desc" ], "str", ) ->order( qr/type: (\w+)/, [ num => desc => qr/duration: (\d+)/ ] [ num => sub { /id: (\d+)/ } ], "str", ) # order_by: pairs of accessor-comparison options ->order_by( price => "num", # First a numeric comparison of price name => "desc", # or if same, a reverse comparison of the name ) ->order_by( price => [ "num", "desc" ], name => "str", ) # accessor is a method call with arg: $_->price_with_discount($discount) ->order_by( [ price_with_discount => $discount ] => [ "num", "desc" ], name => [ str => sub { uc($_) } ], "id", ) =head2 List and Scalar Context Almost all of the methods are context sensitive, i.e. they return a list in list context and an arrayref in scalar context, just like L<autobox::Core>. B<Beware>: I<you might be in list context when you need an arrayref.> When in doubt, assume they work like C<map> and C<grep> (i.e. return a list), and convert the return value to references where you might have an non-obvious list context. E.g. =head3 Incorrect $self->my_method( # Wrong, this is list context and wouldn't return an array ref books => $books->filter_by("is_published"), ); =head3 Correct $self->my_method( # Correct, put the returned list in an anonymous array ref books => [ $books->filter_by("is_published") ], ); $self->my_method( # Correct, ensure scalar context to get an array ref books => scalar $books->filter_by("is_published"), ); # Probably the nicest, since ->to_ref goes at the end $self->my_method( # Correct, use ->to_ref to ensure an array ref is returned books => $books->filter_by("is_published")->to_ref, ); =head1 METHODS ON ARRAYS =cut package # hide from PAUSE autobox::Transform::Array; use autobox::Core; use Sort::Maker (); use List::MoreUtils (); =head2 @array->filter($predicate = *is_true_subref*) : @array | @$array Similar to Perl's C<grep>, return an C<@array> with values for which $predicate yields a true value. $predicate can be a subref, string, undef, regex, or hashref. See L</Filter predicates>. The default (no C<$predicate>) is a subref which retains true values in the @array. =head3 Examples my @apples = $fruit->filter("apple"); my @any_apple = $fruit->filter( qr/apple/i ); my @publishers = $authors->filter( sub { $_->publisher->name =~ /Orbit/ }, ); =head3 filter and grep L<autobox::Core>'s C<grep> method takes a subref, just like this method. C<filter> also supports the other predicate types, like string, regex, etc. =cut sub filter { my $array = shift; my ($predicate) = @_; my $subref = autobox::Transform::_predicate( "filter", $predicate, sub { !! $_ }, ); my $result = eval { [ CORE::grep { $subref->( $_ ) } @$array ] } or autobox::Transform::throw($@); return wantarray ? @$result : $result; } =head2 @array->reject($predicate = *is_false_subref*) : @array | @$array Similar to the Unix command C<grep -v>, return an @array with values for which C<$predicate> yields a I<false> value. $predicate can be a subref, string, undef, regex, or hashref. See L</Filter predicates>. The default (no $predicate) is a subref which I<filters out> true values in the C<@array>. Examples: my @apples = $fruit->reject("apple"); my @any_apple = $fruit->reject( qr/apple/i ); my @publishers = $authors->reject( sub { $_->publisher->name =~ /Orbit/ }, ); =cut sub reject { my $array = shift; my ($predicate) = @_; my $subref = autobox::Transform::_predicate( "reject", $predicate, sub { !! $_ }, ); my $result = eval { [ CORE::grep { ! $subref->( $_ ) } @$array ] } or autobox::Transform::throw($@); return wantarray ? @$result : $result; } my $option__group = { str => "operator", num => "operator", asc => "direction", desc => "direction", }; sub _group__value_from_order_options { my ($method_name, $options) = @_; my $group__value = {}; for my $option (grep { $_ } @$options) { my $group; my $ref_option = ref($option); ( $ref_option eq "CODE" ) and $group = "extract"; if ( $ref_option eq "Regexp" ) { my $regex = $option; $option = sub { join("", m/$regex/) }; $group = "extract"; } $group ||= $option__group->{ $option } or Carp::croak("->$method_name(): Invalid comparison option ($option), did you mean ->order_by('$option')?"); exists $group__value->{ $group } and Carp::croak("->$method_name(): Conflicting comparison options: ($group__value->{ $group }) and ($option)"); $group__value->{ $group } = $option; } return $group__value; } my $transform__sorter = { str => "string", num => "number", asc => "ascending", desc => "descending", }; sub _sorter_from_comparisons { my ($method_name, $comparisons) = @_; my @sorter_keys; my @extracts; for my $options (@$comparisons) { ref($options) eq "ARRAY" or $options = [ $options ]; # Check one comparison my $group__value = _group__value_from_order_options( $method_name, $options, ); my $operator = $group__value->{operator} // "str"; my $direction = $group__value->{direction} // "asc"; my $extract = $group__value->{extract} // sub { $_ }; my $sorter_operator = $transform__sorter->{$operator}; my $sorter_direction = $transform__sorter->{$direction}; push(@extracts, $extract); my $extract_index = @extracts; push( @sorter_keys, $sorter_operator => [ $sorter_direction, # Sort this one by the extracted value code => "\$_->[ $extract_index ]", ], ); } my $sorter = Sort::Maker::make_sorter( "plain", "ref_in", "ref_out", @sorter_keys, ) or Carp::croak(__PACKAGE__ . " internal error: $@"); return ($sorter, \@extracts); } sub _item_values_array_from_array_item_extracts { my ($array, $extracts) = @_; # Custom Schwartzian Transform where each array item is arrayref of: # 0: $array item; rest 1..n : comparison values # The sorter keys are simply indexed into the nth value return [ map { ## no critic my $item = $_; [ $item, # array item to compare map { my $extract = $_; local $_ = $item; $extract->(); } @$extracts, # comparison values for array item ]; } @$array ]; } sub _item_values_array_from_map_by_extracts { my ($array, $accessors, $extracts) = @_; # Custom Schwartzian Transform where each array item is arrayref of: # 0: $array item; rest 1..n : comparison values # The sorter keys are simply indexed into the nth value my $accessor_values = $accessors->map( sub { [ map_by($array, $_) ] } ); return [ map { ## no critic my $item = $_; my $accessor_index = 0; [ $item, # array item to compare map { my $extract = $_; my $value = shift @{$accessor_values->[ $accessor_index++ ]}; local $_ = $value; $extract->(); } @$extracts, # comparison values for array item ]; } @$array ]; } =head2 @array->order(@comparisons = ("str")) : @array | @$array Return C<@array> ordered according to the C<@comparisons>. The default comparison is the same as the default sort, e.g. a normal string comparison of the C<@array> values. If the first item in C<@comparison> ends in a tie, the next one is used, etc. Each I<comparison> consists of a single I<option> or an I<arrayref of options>, e.g. C<str>/C<num>, C<asc>/C<desc>, or a subref/regex. See L</Sorting using order and order_by> for details about how these work. Examples: @book_genres->order; @book_genres->order("desc"); @book_prices->order([ "num", "desc" ]); @books->order([ sub { $_->{price} }, "desc", "num" ]); @log_lines->order([ num => qr/pid: "(\d+)"/ ]); @books->order( [ sub { $_->{price} }, "desc", "num" ] # first price sub { $_->{name} }, # then name ); =cut sub order { my $array = shift; my (@comparisons) = @_; @comparisons or @comparisons = ("str"); my ($sorter, $extracts) = _sorter_from_comparisons("order", \@comparisons); my $item_values_array = _item_values_array_from_array_item_extracts( $array, $extracts, ); my $sorted_array = $sorter->($item_values_array); my $result = [ map { $_->[0] } @$sorted_array ]; return wantarray ? @$result : $result; } =head2 @array->group($value_subref = item) : %key_value | %$key_value Group the C<@array> items into a hashref with the items as keys. The default C<$value_subref> puts each item in the list as the hash value. If the key is repeated, the value is overwritten with the last object. Example: my $title_book = $book_titles->group; # { # "Leviathan Wakes" => "Leviathan Wakes", # "Caliban's War" => "Caliban's War", # "The Tree-Body Problem" => "The Tree-Body Problem", # "The Name of the Wind" => "The Name of the Wind", # }, =head3 The $value_subref For simple cases of just grouping a single key to a single value, the C<$value_subref> is straightforward to use. The hash key is the array item. The hash value is whatever is returned from my $new_value = $value_sub->($current_value, $object, $key); =over 4 =item C<$current> value is the current hash value for this key (or undef if the first one). =item C<$object> is the current item in the list. The current $_ is also set to this. =item C<$key> is the array item. =back See also: C<-E<gt>group_by>. =cut sub __core_group { my( $name, $array, $value_sub ) = @_; @$array or return wantarray ? () : { }; my %key_value; for my $item (@$array) { my $key = $item; my $current_value = $key_value{ $key }; local $_ = $item; my $new_value = $value_sub->($current_value, $item, $key); $key_value{ $key } = $new_value; } return wantarray ? %key_value : \%key_value; } sub group { my $array = shift; my ($value_sub) = _normalized_accessor_args_subref(@_); $value_sub //= sub { $_ }; ref($value_sub) eq "CODE" or Carp::croak("group(\$value_sub): \$value_sub ($value_sub) is not a sub ref"); return __core_group("group", $array, $value_sub); } =head2 @array->group_count : %key_count | %$key_count Just like C<group>, but the hash values are the the number of instances each item occurs in the list. Example: $book_genres->group_count; # { # "Sci-fi" => 3, # "Fantasy" => 1, # }, There are three books counted for the "Sci-fi" key. =cut sub group_count { my $array = shift; my $value_sub = sub { my $count = shift // 0; return ++$count; }; return __core_group("group_count", $array, $value_sub); } =head2 @array->group_array : %key_objects | %$key_objects Just like C<group>, but the hash values are arrayrefs containing those same array items. Example: $book_genres->group_array; # { # "Sci-fi" => [ "Sci-fi", "Sci-fi", "Sci-fi" ], # "Fantasy" => [ "Fantasy" ], # }, The three Sci-fi genres are collected under the Sci-fi key. =cut sub group_array { my $array = shift; my $value_sub = sub { my $value_array = shift // []; push( @$value_array, $_ ); return $value_array; }; return __core_group("group_array", $array, $value_sub); } =head2 @array->flat() : @array | @$array Return a (one level) flattened array, assuming the array items themselves are array refs. I.e. [ [ 1, 2, 3 ], [ "a", "b" ], [ [ 1, 2 ], { 3 => 4 } ] ]->flat returns [ 1, 2, 3, "a", "b ", [ 1, 2 ], { 3 => 4 } ] This is useful if e.g. a C<-E<gt>map_by("some_method")> returns arrayrefs of objects which you want to do further method calls on. Example: # ->books returns an arrayref of Book objects with a ->title $authors->map_by("books")->flat->map_by("title") Note: This is different from L<autobox::Core>'s C<-E<gt>flatten>, which reurns a list rather than an array and therefore can't be used in this way. =cut sub flat { my $array = shift; ###JPL: eval and report error from correct place my $result = [ map { @$_ } @$array ]; return wantarray ? @$result : $result; } =head2 @array->to_ref() : $arrayref Return the reference to the C<@array>, regardless of context. Useful for ensuring the last array method return a reference while in scalar context. Typically: do_stuff( books => $author->map_by("books")->to_ref, ); map_by is called in list context, so without C<-E<gt>to_ref> it would have return an array, not an arrayref. =cut sub to_ref { my $array = shift; return $array; } =head2 @array->to_array() : @array Return the C<@array>, regardless of context. This is mostly useful if called on a ArrayRef at the end of a chain of method calls. =cut sub to_array { my $array = shift; return @$array; } =head2 @array->to_hash() : %hash | %$hash Return the item pairs in the C<@array> as the key-value pairs of a C<%hash> (context sensitive). Useful if you need to continue calling C<%hash> methods on it. Die if there aren't an even number of items in C<@array>. =cut sub to_hash { my $array = shift; my $count = @$array; $count % 2 and Carp::croak( "\@array->to_hash on an array with an odd number of elements ($count)", ); my %new_hash = @$array; return wantarray ? %new_hash : \%new_hash; } =head1 METHODS ON ARRAYS CONTAINING OBJECTS/HASHES =cut *_normalized_accessor_args_predicate = \&autobox::Transform::_normalized_accessor_args_predicate; *_normalized_accessor_args_subref = \&autobox::Transform::_normalized_accessor_args_subref; sub __invoke_by { my $invoke = shift; my $array = shift; my( $accessor, $args, $subref_name, $subref ) = @_; defined($accessor) or Carp::croak("->${invoke}_by() missing argument: \$accessor"); @$array or return wantarray ? () : [ ]; $args //= []; if ( ref($array->[0] ) eq "HASH" ) { ( defined($args) && (@$args) ) # defined and isn't empty and Carp::croak("${invoke}_by([ '$accessor', \@args ]): \@args ($args) only supported for method calls, not hash key access"); $invoke .= "_key"; } ###JPL: move up ref($args) eq "ARRAY" or Carp::croak("${invoke}_by([ '$accessor', \@args ]): \@args ($args) is not a list"); if( $subref_name ) { ref($subref) eq "CODE" or Carp::croak("${invoke}_by([ '$accessor', \@args ], \$$subref_name): \$$subref_name ($subref) is not an sub ref"); } my %seen; my $invoke_sub = { map => sub { [ CORE::map { $_->$accessor( @$args ) } @$array ] }, map_key => sub { [ CORE::map { $_->{$accessor} } @$array ] }, filter => sub { [ CORE::grep { $subref->( local $_ = $_->$accessor( @$args ) ) } @$array ] }, filter_key => sub { [ CORE::grep { $subref->( local $_ = $_->{$accessor} ) } @$array ] }, reject => sub { [ CORE::grep { ! $subref->( local $_ = $_->$accessor( @$args ) ) } @$array ] }, reject_key => sub { [ CORE::grep { ! $subref->( local $_ = $_->{$accessor} ) } @$array ] }, uniq => sub { [ CORE::grep { ! $seen{ $_->$accessor( @$args ) // "" }++ } @$array ] }, uniq_key => sub { [ CORE::grep { ! $seen{ $_->{$accessor} // "" }++ } @$array ] }, }->{$invoke}; my $result = eval { $invoke_sub->() } or autobox::Transform::throw($@); return wantarray ? @$result : $result; } =head2 @array->map_by($accessor) : @array | @$array C<$accessor> is either a string, or an arrayref where the first item is a string. Call the C<$accessor> on each object in C<@array>, or get the hash key value on each hashref in C<@array>. Like: map { $_->$accessor() } @array # or map { $_->{$accessor} } @array Examples: my @author_names = $authors->map_by("name"); my $author_names = @publishers->map_by("authors")->flat->map_by("name"); Or get the hash key value. Example: my @review_scores = $reviews->map_by("score"); Alternatively for when C<@array> contains objects, the $accessor can be an arrayref. The first item is the method name, and the rest of the items are passed as args in the method call. This obviously won't work when the C<@array> contains hashrefs. Examples: my @prices_including_tax = $books->map_by([ "price_with_tax", $tax_pct ]); my $prices_including_tax = $books->map_by([ price_with_tax => $tax_pct ]); =cut sub map_by { my $array = shift; my ($accessor, $args) = _normalized_accessor_args_subref(@_); return __invoke_by("map", $array, $accessor, $args); } =head2 @array->filter_by($accessor, $predicate = *is_true_subref*) : @array | @$array C<$accessor> is either a string, or an arrayref where the first item is a string. Call the C<$accessor> on each object in the list, or get the hash key value on each hashref in the list. Example: my @prolific_authors = $authors->filter_by("is_prolific"); Alternatively the C<$accessor> is an arrayref. The first item is the accessor name, and the rest of the items are passed as args the method call. This only works when working with objects, not with hashrefs. Example: my @books_to_charge_for = $books->filter_by([ price_with_tax => $tax_pct ]); Use the C<$predicate> to determine whether the value should remain. C<$predicate> can be a subref, string, undef, regex, or hashref. See L</Filter predicates>. The default (no C<$predicate>) is a subref which retains true values in the result C<@array>. Examples: # Custom predicate subref my @authors = $authors->filter_by( "publisher", sub { $_->name =~ /Orbit/ }, ); # Call method with args and match a regex my @authors = $authors->filter_by( [ publisher_affiliation => "with" ], qr/Orbit/ }, ); Note: if you do something complicated with a $predicate subref, it might be easier and more readable to simply use C<$array-$<gt>filter()>. =head3 Alias C<grep_by> is an alias for C<filter_by>. Unlike C<grep> vs C<filter>, this one works exaclty the same way. =cut sub filter_by { my $array = shift; my ($accessor, $args, $predicate) = _normalized_accessor_args_predicate(@_); my $subref = autobox::Transform::_predicate( "filter_by", $predicate, sub { !! $_ }, ); # filter_by $value, if passed the method value must match the value? return __invoke_by( "filter", $array, $accessor, $args, filter_subref => $subref, ); } *grep_by = \&filter_by; =head2 @array->reject_by($accessor, $predicate = *is_false_subref*) : @array | @$array C<reject_by> is the same as L<C<filter_by>>, except it I<filters out> items that matches the $predicate. Example: my @unproductive_authors = $authors->reject_by("is_prolific"); The default (no $predicate) is a subref which I<filters out> true values in the result C<@array>. =cut sub reject_by { my $array = shift; my ($accessor, $args, $predicate) = _normalized_accessor_args_predicate(@_); my $subref = autobox::Transform::_predicate( "reject_by", $predicate, sub { !! $_ }, ); # filter_by $value, if passed the method value must match the value? return __invoke_by( "reject", $array, $accessor, $args, reject_subref => $subref, ); } =head2 @array->uniq_by($accessor) : @array | @$array C<$accessor> is either a string, or an arrayref where the first item is a string. Call the $C<accessor> on each object in the list, or get the hash key value on each hashref in the list. Return list of items wich have a unique set of return values. The order is preserved. On duplicates, keep the first occurrence. Examples: # You have gathered multiple Author objects with duplicate ids my @authors = $authors->uniq_by("author_id"); Alternatively the C<$accessor> is an arrayref. The first item is the accessor name, and the rest of the items are passed as args the method call. This only works when working with objects, not with hashrefs. Examples: my @example_book_at_price_point = $books->uniq_by( [ price_with_tax => $tax_pct ], ); =cut sub uniq_by { my $array = shift; my ($accessor, $args) = _normalized_accessor_args_subref(@_); return __invoke_by("uniq", $array, $accessor, $args); } =head2 @array->order_by(@accessor_comparison_pairs) : @array | @$array Return C<@array> ordered according to the C<@accessor_comparison_pairs>. The comparison value comes from an initial C<@array->map_by($accessor)> for each accessor-comparison pair. It is important that the $accessor call returns exactly a single scalar that can be compared with the other values. It then works just like with C<-E<gt>order>. $books->order_by("name"); # default order, i.e. "str" $books->order_by(price => "num"); $books->order_by(price => [ "num", "desc" ]); As with C<map_by>, if the $accessor is used on an object, the method call can include arguments. $books->order_by([ price_wih_tax => $tax_rate ] => "num"); Just like with C<order>, the value returned by the accessor can be transformed using a sub, or be matched against a regex. $books->order_by(price => [ num => sub { int($_) } ]); # Ignore leading "The" in book titles by optionally matching it # with a non-capturing group and the rest with a capturing group # paren $books->order_by( title => qr/^ (?: The \s+ )? (.+) /x ); If a comparison is missing for the last pair, the default is a normal C<str> comparison. $books->order_by("name"); # default "str" If the first comparison ends in a tie, the next pair is used, etc. Note that in order to provide accessor-comparison pairs, it's often necessary to provide a default "str" comparison just to make it a pair. $books->order_by( author => "str", price => [ "num", "desc" ], ); =cut sub order_by { my $array = shift; my (@accessors_and_comparisons) = @_; my $i = 0; my ($accessors, $comparisons) = List::MoreUtils::part { $i++ %2 } @accessors_and_comparisons; $accessors ||= []; $comparisons ||= []; @$accessors or Carp::croak("->order_by() missing argument: \$accessor"); # Default comparison @$accessors == @$comparisons or push(@$comparisons, "str"); my ($sorter, $extracts) = _sorter_from_comparisons("order_by", $comparisons); my $item_values_array = _item_values_array_from_map_by_extracts( $array, $accessors, $extracts, ); my $sorted_array = $sorter->($item_values_array); my $result = [ map { $_->[0] } @$sorted_array ]; return wantarray ? @$result : $result; } =head2 @array->group_by($accessor, $value_subref = object) : %key_value | %$key_value C<$accessor> is either a string, or an arrayref where the first item is a string. Call C<-E<gt>$accessor> on each object in the array, or get the hash key for each hashref in the array (just like C<-E<gt>map_by>) and group the values as keys in a hashref. The default C<$value_subref> puts each object in the list as the hash value. If the key is repeated, the value is overwritten with the last object. Example: my $title_book = $books->group_by("title"); # { # "Leviathan Wakes" => $books->[0], # "Caliban's War" => $books->[1], # "The Tree-Body Problem" => $books->[2], # "The Name of the Wind" => $books->[3], # }, =head3 The $value_subref For simple cases of just grouping a single key to a single value, the C<$value_subref> is straightforward to use. The hash key is whatever is returned from C<$object-E<gt>$accessor>. The hash value is whatever is returned from my $new_value = $value_sub->($current_value, $object, $key); =over 4 =item C<$current> value is the current hash value for this key (or undef if the first one). =item C<$object> is the current item in the list. The current $_ is also set to this. =item C<$key> is the key returned by $object->$accessor(@$args) =back A simple example would be to group by the accessor, but instead of the object used as the value you want to look up an attribute on each object: my $book_id__author = $books->group_by("id", sub { $_->author }); # keys: book id; values: author If you want to create an aggregate value the C<$value_subref> can be a bit tricky to use, so the most common thing would probably be to use one of the more specific group_by-methods (see below). It should be capable enough to achieve what you need though. =cut sub __core_group_by { my( $name, $array, $accessor, $args, $value_sub ) = @_; $accessor or Carp::croak("->$name() missing argument: \$accessor"); @$array or return wantarray ? () : { }; my $invoke = do { # Hash key if ( ref($array->[0] ) eq "HASH" ) { defined($args) and Carp::croak("$name([ '$accessor', \@args ]): \@args ($args) only supported for method calls, not hash key access."); "key"; } # Method else { $args //= []; ref($args) eq "ARRAY" or Carp::croak("$name([ '$accessor', \@args ], \$value_sub): \@args ($args) is not a list"); "method"; } }; my $invoke_sub = { method => sub { [ shift->$accessor(@$args) ] }, key => sub { [ shift->{$accessor} ] }, }->{$invoke}; my %key_value; for my $object (@$array) { my $key_ref = eval { $invoke_sub->($object) } or autobox::Transform::throw($@); my $key = $key_ref->[0]; my $current_value = $key_value{ $key }; local $_ = $object; my $new_value = $value_sub->($current_value, $object, $key); $key_value{ $key } = $new_value; } return wantarray ? %key_value : \%key_value; } sub group_by { my $array = shift; my ($accessor, $args, $value_sub) = _normalized_accessor_args_subref(@_); $value_sub //= sub { $_ }; ref($value_sub) eq "CODE" or Carp::croak("group_by([ '$accessor', \@args ], \$value_sub): \$value_sub ($value_sub) is not a sub ref"); return __core_group_by("group_by", $array, $accessor, $args, $value_sub); } =head2 @array->group_by_count($accessor) : %key_count | %$key_count C<$accessor> is either a string, or an arrayref where the first item is a string. Just like C<group_by>, but the hash values are the the number of instances each $accessor value occurs in the list. Example: $books->group_by_count("genre"), # { # "Sci-fi" => 3, # "Fantasy" => 1, # }, C<$book-E<gt>genre()> returns the genre string. There are three books counted for the "Sci-fi" key. =cut sub group_by_count { my $array = shift; my ($accessor, $args) = _normalized_accessor_args_subref(@_); my $value_sub = sub { my $count = shift // 0; return ++$count; }; return __core_group_by("group_by_count", $array, $accessor, $args, $value_sub); } =head2 @array->group_by_array($accessor) : %key_objects | %$key_objects C<$accessor> is either a string, or an arrayref where the first item is a string. Just like C<group_by>, but the hash values are arrayrefs containing the objects which has each $accessor value. Example: my $genre_books = $books->group_by_array("genre"); # { # "Sci-fi" => [ $sf_book_1, $sf_book_2, $sf_book_3 ], # "Fantasy" => [ $fantasy_book_1 ], # }, $book->genre() returns the genre string. The three Sci-fi book objects are collected under the Sci-fi key. =cut sub group_by_array { my $array = shift; my ($accessor, $args) = _normalized_accessor_args_subref(@_); my $value_sub = sub { my $array = shift // []; push( @$array, $_ ); return $array; }; return __core_group_by("group_by_array", $array, $accessor, $args, $value_sub); } =head1 METHODS ON HASHES =cut package # hide from PAUSE autobox::Transform::Hash; use autobox::Core; sub key_value { my $hash = shift; my( $original_key, $new_key ) = @_; $new_key //= $original_key; my %key_value = ( $new_key => $hash->{$original_key} ); return wantarray ? %key_value : \%key_value; } sub __core_key_value_if { my $hash = shift; my( $comparison_sub, $original_key, $new_key ) = @_; $comparison_sub->($hash, $original_key) or return wantarray ? () : {}; return key_value($hash, $original_key, $new_key) } sub key_value_if_exists { my $hash = shift; my( $original_key, $new_key ) = @_; return __core_key_value_if( $hash, sub { !! exists shift->{ shift() } }, $original_key, $new_key ); } sub key_value_if_true { my $hash = shift; my( $original_key, $new_key ) = @_; return __core_key_value_if( $hash, sub { !! shift->{ shift() } }, $original_key, $new_key ); } sub key_value_if_defined { my $hash = shift; my( $original_key, $new_key ) = @_; return __core_key_value_if( $hash, sub { defined( shift->{ shift() } ) }, $original_key, $new_key ); } =head2 %hash->map_each($key_value_subref) : %new_hash | %$new_hash Map each key-value pair in the hash using the C<$key_value_subref>. Similar to how to how map transforms a list into another list, map_each transforms a hash into another hash. C<$key_value_subref-E<gt>($key, $value)> is called for each pair (with $_ set to the value). The subref should return an even-numbered list with zero or more key-value pairs which will make up the C<%new_hash>. Typically two items are returned in the list (the key and the value). =head3 Example { a => 1, b => 2 }->map_each(sub { "$_[0]$_[0]" => $_ * 2 }); # Returns { aa => 2, bb => 4 } =cut sub map_each { my $hash = shift; my ($key_value_subref) = @_; $key_value_subref //= ""; ref($key_value_subref) eq "CODE" or Carp::croak("map_each(\$key_value_subref): \$key_value_subref ($key_value_subref) is not a sub ref"); my $new_hash = { map { ## no critic my $key = $_; my $value = $hash->{$key}; { local $_ = $value; my (@new_key_value) = $key_value_subref->($key, $value); (@new_key_value % 2) and Carp::croak("map_each \$key_value_subref returned odd number of keys/values"); @new_key_value; } } keys %$hash, }; return wantarray ? %$new_hash : $new_hash; } =head2 %hash->map_each_value($value_subref) : %new_hash | %$new_hash Map each value in the hash using the C<$value_subref>, but keep the keys the same. C<$value_subref-E<gt>($key, $value)> is called for each pair (with C<$_> set to the value). The subref should return a single value for each key which will make up the C<%new_hash> (with the same keys but with new mapped values). =head3 Example { a => 1, b => 2 }->map_each_value(sub { $_ * 2 }); # Returns { a => 2, b => 4 } =cut sub map_each_value { my $hash = shift; my ($value_subref) = @_; $value_subref //= ""; ref($value_subref) eq "CODE" or Carp::croak("map_each_value(\$value_subref): \$value_subref ($value_subref) is not a sub ref"); my $new_hash = { map { ## no critic my $key = $_; my $value = $hash->{$key}; { local $_ = $value; my @new_values = $value_subref->($key, $value); @new_values > 1 and Carp::croak( "map_each_value \$value_subref returned multiple values. " . "You can not assign a list to the value of hash key ($key). " . "Did you mean to return an arrayref?", ); $key => @new_values; } } keys %$hash, }; return wantarray ? %$new_hash : $new_hash; } =head2 %hash->map_each_to_array($item_subref) : @new_array | @$new_array Map each key-value pair in the hash into a list using the C<$item_subref>. C<$item_subref-E<gt>($key, $value)> is called for each pair (with C<$_> set to the value) in key order. The subref should return zero or more list items which will make up the C<@new_array>. Typically one item is returned. =head3 Example { a => 1, b => 2 }->map_each_to_array(sub { "$_[0]-$_" }); # Returns [ "a-1", "b-2" ] =cut sub map_each_to_array { my $hash = shift; my ($array_item_subref) = @_; $array_item_subref //= ""; ref($array_item_subref) eq "CODE" or Carp::croak("map_each_to_array(\$array_item_subref): \$array_item_subref ($array_item_subref) is not a sub ref"); my $new_array = [ map { ## no critic my $key = $_; my $value = $hash->{$key}; { local $_ = $value; $array_item_subref->($key, $value); } } sort keys %$hash, ]; return wantarray ? @$new_array : $new_array; } =head2 %hash->filter_each($predicate = *is_true_subref*) : @hash | @$hash Return a C<%hash> with values for which C<$predicate> yields a true value. C<$predicate> can be a subref, string, undef, regex, or hashref. See L</Filter predicates>. The default (no $predicate) is a subref which retains true values in the C<%hash>. If the $predicate is a subref, C<$predicate-E<gt>($key, $value)> is called for each pair (with C<$_> set to the value). The subref should return a true value to retain the key-value pair in the result C<%hash>. =head3 Examples { a => 1, b => 2 }->filter_each(sub { $_ == 2 }); # Returns { b => 2 } $book_author->filter_each(sub { $_->name =~ /Corey/ }); =cut sub filter_each { my $hash = shift; my ($predicate) = @_; my $subref = autobox::Transform::_predicate( "filter_each", $predicate, sub { !! $_ }, # true? ); my $new_hash = { map { ## no critic my $key = $_; my $value = $hash->{$key}; { local $_ = $value; $subref->($key, $value) ? ( $key => $value ) : (); } } keys %$hash, }; return wantarray ? %$new_hash : $new_hash; } { no warnings "once"; *grep_each = \&filter_each; } sub filter_each_defined { my $hash = shift; return &filter_each($hash, sub { defined($_) }); } { no warnings "once"; *grep_each_defined = \&filter_each_defined; } =head2 %hash->reject_each($predicate = *is_false_subref*) : @hash | @$hash C<reject_each> is the same as L<C<filter_each>>, except it I<filters out> items that matches the $predicate. Examples: { a => 1, b => 2 }->reject_each(sub { $_ == 2 }); # Returns { a => 1 } The default (no $predicate) is a subref which I<filters out> true values in the C<%hash>. =cut sub reject_each { my $hash = shift; my ($predicate) = @_; my $subref = autobox::Transform::_predicate( "reject_each", $predicate, sub { !! $_ }, # true? ); my $new_hash = { map { ## no critic my $key = $_; my $value = $hash->{$key}; { local $_ = $value; ( ! $subref->($key, $value) ) ? ( $key => $value ) : (); } } keys %$hash, }; return wantarray ? %$new_hash : $new_hash; } sub reject_each_defined { my $hash = shift; return &reject_each($hash, sub { defined($_) }); } =head2 %hash->to_ref() : $hashref Return the reference to the C<%hash>, regardless of context. Useful for ensuring the last hash method return a reference while in scalar context. Typically: do_stuff( genre_count => $books->group_by_count("genre")->to_ref, ); =cut sub to_ref { my $hash = shift; return $hash; } =head2 %hash->to_hash() : %hash Return the C<%hash>, regardless of context. This is mostly useful if called on a HashRef at the end of a chain of method calls. =cut sub to_hash { my $hash = shift; return %$hash; } =head2 %hash->to_array() : @array | @$array Return the key-value pairs of the C<%hash> as an C<@array>, ordered by the keys. Useful if you need to continue calling C<@array> methods on it. =cut sub to_array { my $hash = shift; my @new_array = map_each_to_array($hash, sub { shift() => $_ }); return wantarray ? @new_array : \@new_array; } =head1 AUTOBOX AND VANILLA PERL =head2 Raison d'etre L<autobox::Core> is awesome, for a variety of reasons. =over 4 =item It cuts down on dereferencing punctuation clutter, both by using methods on references and by using ->elements to deref arrayrefs. =item It makes map and grep transforms read in the same direction it's executed. =item It makes it easier to write those things in a natural order. No need to move the cursor around a lot just to fix dereferencing, order of operations etc. =back On top of this, L<autobox::Transform> provides a few higher level methods for mapping, filtering and sorting common cases which are easier to read and write. Since they are at a slightly higher semantic level, once you know them they also provide a more specific meaning than just C<map> or C<grep>. (Compare the difference between seeing a C<map> and seeing a C<foreach> loop. Just seeing the word C<map> hints at what type of thing is going on here: transforming a list into another list). The methods of C<autobox::Transform> are not suitable for all cases, but when used appropriately they will lead to much more clear, succinct and direct code, especially in conjunction with C<autobox::Core>. =head2 Code Comparison These examples are only for when there's a straightforward and simple Perl equivalent. ### map_by - method call: $books are Book objects my @genres = map { $_->genre() } @$books; my @genres = $books->map_by("genre"); my $genres = [ map { $_->genre() } @$books ]; my $genres = $books->map_by("genre"); # With sum from autobox::Core / List::AllUtils my $book_order_total = sum( map { $_->price_with_tax($tax_pct) } @{$order->books} ); my $book_order_total = $order->books ->map_by([ price_with_tax => $tax_pct ])->sum; ### map_by - hash key: $books are book hashrefs my @genres = map { $_->{genre} } @$books; my @genres = $books->map_by("genre"); ### filter_by - method call: $books are Book objects my $sold_out_books = [ grep { $_->is_sold_out } @$books ]; my $sold_out_books = $books->filter_by("is_sold_out"); my $sold_out_books = $books->grep_by("is_sold_out"); my $books_in_library = [ grep { $_->is_in_library($library) } @$books ]; my $books_in_library = $books->filter_by([ is_in_library => $library ]); ### reject_by - hash key: $books are book hashrefs my $sold_out_books = [ grep { ! $_->{is_sold_out} } @$books ]; my $sold_out_books = $books->reject_by("is_sold_out"); ### uniq_by - method call: $books are Book objects my %seen; my $distinct_books = [ grep { ! %seen{ $_->id // "" }++ } @$books ]; my $distinct_books = $books->uniq_by("id"); ### uniq_by - hash key: $books are book hashrefs my %seen; my $distinct_books = [ grep { ! %seen{ $_->{id} // "" }++ } @$books ]; my $distinct_books = $books->uniq_by("id"); #### flat - $author->books returns an arrayref of Books my $author_books = [ map { @{$_->books} } @$authors ] my $author_books = $authors->map_by("books")->flat =head1 DEVELOPMENT =head2 Author Johan Lindstrom, C<< <johanl [AT] cpan.org> >> =head2 Source code L<https://github.com/jplindstrom/p5-autobox-Transform> =head2 Bug reports Please report any bugs or feature requests on GitHub: L<https://github.com/jplindstrom/p5-autobox-Transform/issues>. =head1 COPYRIGHT & LICENSE Copyright 2016- Johan Lindstrom, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1;
26.718619
138
0.607478
73f6d426c6809a5dd7ec9b61611789554ed07444
4,025
pl
Perl
3rdparty/github/marpaESLIF/3rdparty/github/marpaWrapper/3rdparty/github/Marpa--R2/cpan/xs/create_ops.pl
jddurand/c-marpaESLIF-JSON
21d3fc1bfa8415ddf1bb7bb3c060a8f07b2e9b67
[ "MIT" ]
null
null
null
3rdparty/github/marpaESLIF/3rdparty/github/marpaWrapper/3rdparty/github/Marpa--R2/cpan/xs/create_ops.pl
jddurand/c-marpaESLIF-JSON
21d3fc1bfa8415ddf1bb7bb3c060a8f07b2e9b67
[ "MIT" ]
null
null
null
3rdparty/github/marpaESLIF/3rdparty/github/marpaWrapper/3rdparty/github/Marpa--R2/cpan/xs/create_ops.pl
jddurand/c-marpaESLIF-JSON
21d3fc1bfa8415ddf1bb7bb3c060a8f07b2e9b67
[ "MIT" ]
null
null
null
#!perl # Copyright 2015 Jeffrey Kegler # This file is part of Marpa::R2. Marpa::R2 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 3 of the License, or (at your option) any later version. # # Marpa::R2 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 Marpa::R2. If not, see # http://www.gnu.org/licenses/. use 5.010; use strict; use warnings; use English qw( -no_match_vars ); use autodie; # Portability is NOT emphasized here -- this script is part # of the development environment, not the configuration or # installation environment if (scalar @ARGV != 0) { die("usage: $PROGRAM_NAME > marpa_slifop.h"); } my @ops = sort { $a->[0] cmp $b->[0] } [ "alternative", "MARPA_OP_ALTERNATIVE" ], [ "bless", "MARPA_OP_BLESS" ], [ "callback", "MARPA_OP_CALLBACK" ], [ "earleme_complete", "MARPA_OP_EARLEME_COMPLETE" ], [ "end_marker", "MARPA_OP_END_MARKER" ], [ "invalid_char", "MARPA_OP_INVALID_CHAR" ], [ "noop", "MARPA_OP_NOOP" ], [ "pause", "MARPA_OP_PAUSE" ], [ "push_g1_length", "MARPA_OP_PUSH_G1_LENGTH" ], [ "push_g1_start", "MARPA_OP_PUSH_G1_START" ], [ "push_length", "MARPA_OP_PUSH_LENGTH" ], [ "push_constant", "MARPA_OP_PUSH_CONSTANT" ], [ "push_one", "MARPA_OP_PUSH_ONE" ], [ "push_sequence", "MARPA_OP_PUSH_SEQUENCE" ], [ "push_start_location", "MARPA_OP_PUSH_START_LOCATION" ], [ "push_undef", "MARPA_OP_PUSH_UNDEF" ], [ "push_values", "MARPA_OP_PUSH_VALUES" ], [ "result_is_array", "MARPA_OP_RESULT_IS_ARRAY" ], [ "result_is_constant", "MARPA_OP_RESULT_IS_CONSTANT" ], [ "result_is_n_of_sequence", "MARPA_OP_RESULT_IS_N_OF_SEQUENCE" ], [ "result_is_rhs_n", "MARPA_OP_RESULT_IS_RHS_N" ], [ "result_is_token_value", "MARPA_OP_RESULT_IS_TOKEN_VALUE" ], [ "result_is_undef", "MARPA_OP_RESULT_IS_UNDEF" ], [ "retry_or_set_lexer", "MARPA_OP_RETRY_OR_SET_LEXER" ], [ "set_lexer", "MARPA_OP_SET_LEXER" ]; say <<'END_OF_PREAMBLE'; /* * Copyright 2015 Jeffrey Kegler * This file is part of Libmarpa. Libmarpa 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 3 of the License, or (at your option) any later version. * * Libmarpa 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 Libmarpa. If not, see * http://www.gnu.org/licenses/. */ END_OF_PREAMBLE say <<END_OF_PREAMBLE; /* Generated automatically by $PROGRAM_NAME * NOTE: Changes made to this file will be lost: look at $PROGRAM_NAME. */ END_OF_PREAMBLE for (my $i = 0; $i <= $#ops; $i++) { my (undef, $macro) = @{$ops[$i]}; say "#define $macro $i"; } print "\n"; say q<static struct op_data_s op_by_name_object[] = {>; for (my $i = 0; $i <= $#ops; $i++) { my ($name, $macro) = @{$ops[$i]}; say qq< { "$name", $macro },>; } say q<};>; print "\n"; say q<static const char* op_name_by_id_object[] = {>; for (my $i = 0; $i <= $#ops; $i++) { my ($name) = @{$ops[$i]}; say qq< "$name",>; } say q<};>; print "\n"; # vim: expandtab shiftwidth=4:
37.616822
74
0.643478
ed1330d74cc4948233247e0e3ff9c629b5e08e63
1,192
pl
Perl
src/ace/ACE_wrappers/bin/indent_macros.pl
wfnex/vbng_bin
b8c2cd836ae85d5307f7f5ca87573b964342bb49
[ "BSD-3-Clause" ]
8
2017-06-05T08:56:27.000Z
2020-04-08T16:50:11.000Z
src/ace/ACE_wrappers/bin/indent_macros.pl
wfnex/vbng_bin
b8c2cd836ae85d5307f7f5ca87573b964342bb49
[ "BSD-3-Clause" ]
null
null
null
src/ace/ACE_wrappers/bin/indent_macros.pl
wfnex/vbng_bin
b8c2cd836ae85d5307f7f5ca87573b964342bb49
[ "BSD-3-Clause" ]
17
2017-06-05T08:54:27.000Z
2021-08-29T14:19:12.000Z
eval '(exit $?0)' && eval 'exec perl -i -S $0 ${1+"$@"}' & eval 'exec perl -i -S $0 $argv:q' if 0; # This perl script re-arrange the macro indentation so it's easier to # see the layering relationship. $lineno = 0; $indent = 0; sub inc_indent { $indent += 2; } sub dec_indent { $indent -= 2; } sub get_indent { $retv = 0; print STDERR "$0 (", $lineno, "): Unbalanced macro pairs\n" if ($indent < 0); $retv = $indent - 1 if ($indent > 0); $retv; } while (<>) { $lineno++; if (/^[ \t]*\#[ \t]*((if|el|en|).*)/) { $cont = $1; $temp = $2; if ($temp =~ /if/) { print "#", " " x &get_indent (), $cont,"\n"; inc_indent (); } elsif ($temp =~ /el/) { dec_indent (); print "#", " " x &get_indent (), $cont,"\n"; inc_indent (); } elsif ($temp =~ /en/) { dec_indent (); print "#", " " x &get_indent (), $cont,"\n"; } else { print "#", " " x &get_indent (), $cont,"\n"; } } else { print $_; } } die ("$0 (EOF): Unbalanced macro pairs\n") if ($indent != 0);
20.20339
81
0.427013
ed0136a5aa5de04c0d00d9cb319399ed5f021884
4,436
pl
Perl
pipelines/test/remapping_qc.pl
at7/work
0198a1818700a37c36a8d42a87ac4e8d772ad3eb
[ "Apache-2.0" ]
null
null
null
pipelines/test/remapping_qc.pl
at7/work
0198a1818700a37c36a8d42a87ac4e8d772ad3eb
[ "Apache-2.0" ]
null
null
null
pipelines/test/remapping_qc.pl
at7/work
0198a1818700a37c36a8d42a87ac4e8d772ad3eb
[ "Apache-2.0" ]
null
null
null
use strict; use warnings; use Bio::EnsEMBL::Registry; use DBI; use FileHandle; use Bio::DB::Fasta; use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp expand); use Bio::EnsEMBL::Variation::Utils::RemappingUtils qw(qc_mapped_vf); my $failed_descriptions = { 1 => 'Variant maps to more than 3 different locations', 2 => 'None of the variant alleles match the reference allele', 3 => 'Variant has more than 3 different alleles', 4 => 'Loci with no observed variant alleles in dbSNP', 5 => 'Variant does not map to the genome', 6 => 'Variant has no genotypes', 7 => 'Genotype frequencies do not add up to 1', 8 => 'Variant has no associated sequence', 9 => 'Variant submission has been withdrawn by the 1000 genomes project due to high false positive rate', 11 => 'Additional submitted allele data from dbSNP does not agree with the dbSNP refSNP alleles', 12 => 'Variant has more than 3 different submitted alleles', 13 => 'Alleles contain non-nucleotide characters', 14 => 'Alleles contain ambiguity codes', 15 => 'Mapped position is not compatible with reported alleles', 16 => 'Flagged as suspect by dbSNP', 17 => 'Variant can not be re-mapped to the current assembly', 18 => 'Supporting evidence can not be re-mapped to the current assembly', 19 => 'Variant maps to more than one genomic location', 20 => 'Variant at first base in sequence', }; my @copy_over_failure_reasons = (3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 18, 20); my $registry = 'Bio::EnsEMBL::Registry'; $registry->load_all('/hps/nobackup/production/ensembl/anja/release_90/pig/remapping/ensembl.registry.newasm'); my $vdba = $registry->get_DBAdaptor('sus_scrofa', 'variation'); #my $vdba = $self->param('vdba_newasm'); my $dbh = $vdba->dbc->db_handle(); #my $mapping_qc_dir = $self->param('mapping_qc_dir'); my $qc_mapped_features_dir = '/hps/nobackup/production/ensembl/anja/release_90/pig/remapping/qc_mapped_features/'; #dump_mapped_features(); qc_mapped_features(); sub dump_mapped_features { my @output = (); my $file_count = 1; #my $entries_per_file = $self->param('entries_per_file'); my $entries_per_file = 200000; my $count_entries = 0; my $fh = FileHandle->new("$qc_mapped_features_dir/$file_count.txt", 'w'); my @column_names = qw/variation_feature_id seq_region_id seq_region_name seq_region_start seq_region_end seq_region_strand allele_string variation_id variation_name map_weight alignment_quality/; my $column_concat = join(',', @column_names); #my $feature_table = $self->param('feature_table'); #mapping results my $feature_table = 'variation_feature_mapping_results'; my $sth = $dbh->prepare(qq{ SELECT vf.variation_feature_id, vf.seq_region_id, sr.name, vf.seq_region_start, vf.seq_region_end, vf.seq_region_strand, vf.allele_string, vf.variation_id, vf.variation_name, vf.map_weight, vf.alignment_quality FROM $feature_table vf, seq_region sr WHERE sr.seq_region_id = vf.seq_region_id; }, {mysql_use_result => 1}); $sth->execute(); while (my $row = $sth->fetchrow_arrayref) { my @values = map { defined $_ ? $_ : '\N'} @$row; my @pairs = (); for my $i (0..$#column_names) { push @pairs, "$column_names[$i]=$values[$i]"; } if ($count_entries >= $entries_per_file) { $fh->close(); $file_count++; $fh = FileHandle->new("$qc_mapped_features_dir/$file_count.txt", 'w'); $count_entries = 0; } $count_entries++; print $fh join("\t", @pairs), "\n"; } $sth->finish(); $fh->close(); #$self->param('file_count', $file_count); } sub qc_mapped_features { my $fasta_db = Bio::DB::Fasta->new('/hps/nobackup/production/ensembl/anja/release_90/pig/remapping/new_assembly/', -reindex => 1); my $config = { fasta_db => $fasta_db, mapped_features_file => '/hps/nobackup/production/ensembl/anja/release_90/pig/remapping/qc_mapped_features/11.txt', update_features_file => '/hps/nobackup/production/ensembl/anja/release_90/pig/remapping/qc_update_features/11.txt', failure_reasons_file => '/hps/nobackup/production/ensembl/anja/release_90/pig/remapping/qc_failure_reasons/11.txt', feature_table => 'variation_feature_mapping_results', vdba => $vdba, }; qc_mapped_vf($config); } sub read_line { my $line = shift; my @key_values = split("\t", $line); my $mapping = {}; foreach my $key_value (@key_values) { my ($table_name, $value) = split('=', $key_value, 2); $mapping->{$table_name} = $value; } return $mapping; }
37.59322
212
0.711226
ed328252298e69b654a0003082a02c4570a97f71
2,994
t
Perl
bundle/srcache-nginx-module-0.31/t/static.t
zyqCSL/openresty-1.13.6.1-instrumented
21be1c9e8e57a894a38865e34bccb2d3a97a6c18
[ "BSD-2-Clause" ]
147
2015-01-06T05:12:03.000Z
2022-01-13T11:02:44.000Z
bundle/srcache-nginx-module-0.31/t/static.t
zyqCSL/openresty-1.13.6.1-instrumented
21be1c9e8e57a894a38865e34bccb2d3a97a6c18
[ "BSD-2-Clause" ]
19
2015-01-20T13:50:03.000Z
2021-11-30T15:54:32.000Z
bundle/srcache-nginx-module-0.31/t/static.t
zyqCSL/openresty-1.13.6.1-instrumented
21be1c9e8e57a894a38865e34bccb2d3a97a6c18
[ "BSD-2-Clause" ]
59
2015-02-13T09:28:51.000Z
2022-02-11T13:37:33.000Z
# vi:filetype= use lib 'lib'; use Test::Nginx::Socket; #repeat_each(2); plan tests => repeat_each() * 5 * blocks(); $ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211; #master_on(); no_shuffle(); run_tests(); __DATA__ === TEST 1: flush all --- config location /flush { set $memc_cmd 'flush_all'; memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT; } --- response_headers Content-Type: text/plain Content-Length: 4 Last-Modified: --- request GET /flush --- response_body eval: "OK\r\n" === TEST 2: basic fetch (cache miss) --- config location /foo { default_type text/css; srcache_fetch GET /memc $uri; srcache_store PUT /memc $uri; } location /memc { internal; set $memc_key $query_string; set $memc_exptime 300; memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT; } --- user_files >>> foo 201103040521.59 hello --- request GET /foo --- response_headers Content-Type: text/css Content-Length: 6 Last-Modified: Fri, 04 Mar 2011 05:21:59 GMT --- response_body hello === TEST 3: basic fetch (cache hit) --- config location /foo { default_type text/css; srcache_fetch GET /memc $uri; srcache_store PUT /memc $uri; echo world; } location /memc { internal; set $memc_key $query_string; set $memc_exptime 300; memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT; } --- request GET /foo --- response_headers Content-Type: text/css Content-Length: 6 Last-Modified: Fri, 04 Mar 2011 05:21:59 GMT --- response_body hello === TEST 4: flush all --- config location /flush { set $memc_cmd 'flush_all'; memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT; } --- response_headers Content-Type: text/plain Content-Length: 4 Last-Modified: --- request GET /flush --- response_body eval: "OK\r\n" === TEST 5: basic fetch (cache miss), hide Last-Modified --- config location /foo { default_type text/css; srcache_fetch GET /memc $uri; srcache_store PUT /memc $uri; srcache_store_hide_header Last-Modified; } location /memc { internal; set $memc_key $query_string; set $memc_exptime 300; memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT; } --- user_files >>> foo 201103040521.59 hello --- request GET /foo --- response_headers Content-Type: text/css Content-Length: 6 Last-Modified: Fri, 04 Mar 2011 05:21:59 GMT --- response_body hello === TEST 6: basic fetch (cache hit) --- config location /foo { default_type text/css; srcache_fetch GET /memc $uri; srcache_store PUT /memc $uri; echo world; } location /memc { internal; set $memc_key $query_string; set $memc_exptime 300; memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT; } --- request GET /foo --- response_headers Content-Type: text/css Content-Length: 6 !Last-Modified --- response_body hello
18.256098
56
0.638945
ed23a5b8bb069c3ab8032953e5a2f2103c2023f6
3,805
pl
Perl
3rd_party/RepeatMasker-open-4-0-6/util/rmOutToGFF3.pl
genomecuration/JAM
8b834d3efe32f79c48887c2797005619ac2c3a1d
[ "BSD-3-Clause" ]
null
null
null
3rd_party/RepeatMasker-open-4-0-6/util/rmOutToGFF3.pl
genomecuration/JAM
8b834d3efe32f79c48887c2797005619ac2c3a1d
[ "BSD-3-Clause" ]
null
null
null
3rd_party/RepeatMasker-open-4-0-6/util/rmOutToGFF3.pl
genomecuration/JAM
8b834d3efe32f79c48887c2797005619ac2c3a1d
[ "BSD-3-Clause" ]
null
null
null
#!/u1/local/bin/perl ##---------------------------------------------------------------------------## ## File: ## @(#) rmOutToGFF3.pl ## Author: ## Robert M. Hubley rhubley@systemsbiology.org ## Description: ## A utility script to assist to convert old RepeatMasker *.out files ## to version 3 gff files. ## #****************************************************************************** #* Copyright (C) Institute for Systems Biology 2003-2008 Developed by #* Arian Smit and Robert Hubley. #* #* This work is licensed under the Open Source License v2.1. To view a copy #* of this license, visit http://www.opensource.org/licenses/osl-2.1.php or #* see the license.txt file contained in this distribution. #* #****************************************************************************** # # ChangeLog # # $Log: rmOutToGFF3.pl,v $ # Revision 1.32 2015/08/07 19:06:53 rhubley # Cleanup before a distribution # # ############################################################################### # # To Do: # =head1 NAME rmOutToGFF3.pl - Convert RepeatMasker OUT files to version 3 GFF files =head1 SYNOPSIS rmOutToGFF3.pl [-version] *.out > new.gff =head1 DESCRIPTION A utility script to convert old RepeatMasker *.out files to the new GFF version 3 standard. The options are: =over 4 =item -version Displays the version of the program =back =head1 SEE ALSO ReapeatMasker =head1 COPYRIGHT Copyright 2008 Robert Hubley, Institute for Systems Biology =head1 AUTHOR Robert Hubley <rhubley@systemsbiology.org> =cut # # Module Dependence # use strict; use FindBin; use lib $FindBin::Bin; use lib "$FindBin::Bin/../"; use Getopt::Long; use Data::Dumper; use CrossmatchSearchEngine; use File::Basename; # # Version # my $Version = 0.1; my $DEBUG = 0; # # Option processing # e.g. # -t: Single letter binary option # -t=s: String parameters # -t=i: Number parameters # my @getopt_args = ( '-version', # print out the version and exit ); my %options = (); Getopt::Long::config( "noignorecase", "bundling_override" ); unless ( GetOptions( \%options, @getopt_args ) ) { usage(); } sub usage { print "$0 - $Version\n"; exec "pod2text $0"; exit( 1 ); } if ( $options{'version'} ) { print "$Version\n"; exit; } usage() if ( !$ARGV[ 0 ] ); my $annotationFile = $ARGV[ 0 ]; # # Open up a search results object # my $searchResults = CrossmatchSearchEngine::parseOutput( searchOutput => $annotationFile ); # # Read in annotations and throw away the rest # print "##gff-version 3\n"; my $currentQueryName; for ( my $i = 0 ; $i < $searchResults->size() ; $i++ ) { my $result = $searchResults->get( $i ); # First annotation of a region if ( $result->getQueryName() ne $currentQueryName ) { $currentQueryName = $result->getQueryName(); print "##sequence-region $currentQueryName 1 " . ( $result->getQueryRemaining() + $result->getQueryEnd() ) . "\n"; } # FORMAT: # ##gff-version 3 # ##sequence-region ctg123 1 1497228 # SeqID: QueryName # Source: Constant - "RepeatMasker" # Type: similarity => dispersed_repeat # Start: Query Start # End: Query End # Score: New! # Strand: "+" or "-" # Phase: 0 # Attributes: Target=FAM 24 180 print "" . $currentQueryName . "\t"; print "RepeatMasker\t"; print "dispersed_repeat\t"; print "" . $result->getQueryStart() . "\t"; print "" . $result->getQueryEnd() . "\t"; print "" . $result->getScore() . "\t"; if ( $result->getOrientation() eq "C" ) { print "-\t"; } else { print "+\t"; } print ".\t"; print "Target=" . $result->getSubjName() . " " . $result->getSubjStart() . " " . $result->getSubjEnd() . "\n"; }
21.99422
79
0.575296
73ea6061d2984563ad7b00cf9c4c327cf4f2fe5f
1,628
pm
Perl
lib/Net/OSCAR/MethodInfo.pm
nibirubot/oscar-phoenix
087607550202fcdfc9055d79235ff4502556116d
[ "Artistic-1.0" ]
2
2020-05-06T14:26:19.000Z
2020-08-07T20:28:13.000Z
lib/Net/OSCAR/MethodInfo.pm
nibirubot/oscar-phoenix
087607550202fcdfc9055d79235ff4502556116d
[ "Artistic-1.0" ]
null
null
null
lib/Net/OSCAR/MethodInfo.pm
nibirubot/oscar-phoenix
087607550202fcdfc9055d79235ff4502556116d
[ "Artistic-1.0" ]
null
null
null
=pod =head1 NAME =head1 VERSION version 1.928 Net::OSCAR::MethodInfo -- Mappings from method names to (SNAC,family). Used by rate management functionality =cut package Net::OSCAR::MethodInfo; BEGIN { $Net::OSCAR::MethodInfo::VERSION = '1.928'; } $REVISION = '$Revision$'; use strict; use warnings; use vars qw(@ISA $REVISION); use Net::OSCAR::XML; sub encode($) { my %snac = protobit_to_snac($_[0]); my($family, $subtype) = ($snac{family}, $snac{subtype}); return pack("nn", $family, $subtype); } our %methods = ( set_stealth => encode("set_extended_status"), get_info => encode("get_info"), get_away => encode("get_away"), send_typing_status => encode("typing_notification"), evil => encode("outgoing_warning"), get_icon => encode("buddy_icon_download"), set_extended_status => encode("set_extended_status"), set_info => encode("set_info"), change_password => encode("change_account_info"), confirm_account => encode("confirm_account_request"), change_email => encode("change_account_info"), format_screenname => encode("change_account_info"), set_idle => encode("set_idle"), chat_join => encode("chat_navigator_room_create"), chat_accept => encode("chat_invitation_accept"), chat_decline => encode("chat_invitation_decline"), auth_response => encode("signon"), get_icq_info => encode("ICQ_meta_request"), send_message => encode("outgoing_IM"), svcreq => encode("service_request"), send_im => encode("outgoing_IM"), file_send => encode("outgoing_IM"), rendezvous_revise => encode("outgoing_IM"), rendezvous_reject => encode("outgoing_IM"), chat_send => encode("outgoing_chat_IM") ); 1;
27.133333
79
0.722359
73e172c1c0dd54f820de153751b9cf09dce421a4
1,720
pm
Perl
auto-lib/Paws/MQ/ListBrokersOutput.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
164
2015-01-08T14:58:53.000Z
2022-02-20T19:16:24.000Z
auto-lib/Paws/MQ/ListBrokersOutput.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
348
2015-01-07T22:08:38.000Z
2022-01-27T14:34:44.000Z
auto-lib/Paws/MQ/ListBrokersOutput.pm
0leksii/aws-sdk-perl
b2132fe3c79a06fd15b6137e8a0eb628de722e0f
[ "Apache-2.0" ]
87
2015-04-22T06:29:47.000Z
2021-09-29T14:45:55.000Z
# Generated by default/object.tt package Paws::MQ::ListBrokersOutput; use Moose; has BrokerSummaries => (is => 'ro', isa => 'ArrayRef[Paws::MQ::BrokerSummary]', request_name => 'brokerSummaries', traits => ['NameInRequest']); has NextToken => (is => 'ro', isa => 'Str', request_name => 'nextToken', traits => ['NameInRequest']); 1; ### main pod documentation begin ### =head1 NAME Paws::MQ::ListBrokersOutput =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::MQ::ListBrokersOutput object: $service_obj->Method(Att1 => { BrokerSummaries => $value, ..., NextToken => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::MQ::ListBrokersOutput object: $result = $service_obj->Method(...); $result->Att1->BrokerSummaries =head1 DESCRIPTION A list of information about all brokers. =head1 ATTRIBUTES =head2 BrokerSummaries => ArrayRef[L<Paws::MQ::BrokerSummary>] A list of information about all brokers. =head2 NextToken => Str The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::MQ> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
26.060606
146
0.731395
73f1fe4881f3f7258d5e6eee0ac8f1be7d03b467
1,407
pm
Perl
XML-CompareML/lib/XML/CompareML/DTD/Generate.pm
shlomif/xml-compareml
c2e4fa2750d2da3dbc652eac4d546997c96a73e4
[ "MIT" ]
null
null
null
XML-CompareML/lib/XML/CompareML/DTD/Generate.pm
shlomif/xml-compareml
c2e4fa2750d2da3dbc652eac4d546997c96a73e4
[ "MIT" ]
null
null
null
XML-CompareML/lib/XML/CompareML/DTD/Generate.pm
shlomif/xml-compareml
c2e4fa2750d2da3dbc652eac4d546997c96a73e4
[ "MIT" ]
null
null
null
package XML::CompareML::DTD::Generate; use strict; use warnings; =head1 NAME XML::CompareML::DTD::Generate - generate the DTD for CompareML. =head1 SYNOPSIS use XML::CompareML::DTD::Generate; my $dtd_text = XML::CompareML::DTD::Generate::get_dtd(); =head1 FUNCTIONS =head2 get_dtd() Calculates and returns the DTD. Not exported. =cut sub get_dtd { return <<"EOF"; <!ELEMENT comparison (meta,contents)> <!ELEMENT meta (implementations,timestamp?)> <!ELEMENT implementations (impl+)> <!ELEMENT impl (name,url?,fullname?,vendor?)> <!ELEMENT name (#PCDATA)> <!ELEMENT url (#PCDATA)> <!ELEMENT fullname (#PCDATA)> <!ELEMENT vendor (#PCDATA)> <!ELEMENT contents (section)> <!ELEMENT section (title,expl?,compare?,section*)> <!ELEMENT title (#PCDATA)> <!ELEMENT expl (#PCDATA|a|b)*> <!ELEMENT compare (s+)> <!ELEMENT s (#PCDATA|a|b)*> <!ELEMENT a (#PCDATA|b)*> <!ELEMENT timestamp (#PCDATA)> <!ELEMENT b (#PCDATA)> <!ATTLIST section id ID #REQUIRED> <!ATTLIST a href CDATA #REQUIRED> <!ATTLIST s id CDATA #REQUIRED> <!ATTLIST impl id CDATA #REQUIRED> EOF } =head1 AUTHOR Shlomi Fish, L<http://www.shlomifish.org/>. =head1 SEE ALSO L<XML::CompareML> =head1 COPYRIGHT AND LICENSE Copyright 2004, Shlomi Fish. All rights reserved. You can use, modify and distribute this module under the terms of the MIT X11 license. ( L<http://www.opensource.org/licenses/mit-license.php> ). =cut 1;
20.391304
77
0.706468
ed154a7e15e0262928d6087725d1a7b4313e4af8
310
t
Perl
t/Legacy/Builder/no_diag.t
khwilliamson/test-more
a1915241dc10893376fd2255631f16d7ff25ae65
[ "Artistic-1.0" ]
58
2015-01-10T15:31:11.000Z
2022-02-27T17:55:21.000Z
openresty-win32-build/thirdparty/perl5-5.29.6/cpan/Test-Simple/t/Legacy/Builder/no_diag.t
nneesshh/openresty-win32-build
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
[ "MIT" ]
302
2015-01-01T09:21:08.000Z
2022-02-25T00:15:53.000Z
openresty-win32-build/thirdparty/perl5-5.29.6/cpan/Test-Simple/t/Legacy/Builder/no_diag.t
nneesshh/openresty-win32-build
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
[ "MIT" ]
57
2015-01-05T11:00:00.000Z
2022-03-27T09:08:05.000Z
#!/usr/bin/perl -w use Test::More 'no_diag'; plan 'skip_all' => "This test cannot be run with the current formatter" unless Test::Builder->new->{Stack}->top->format->isa('Test::Builder::Formatter'); pass('foo'); diag('This should not be displayed'); is(Test::More->builder->no_diag, 1); done_testing;
22.142857
85
0.683871
ed1ccad9f44df78eb0b0a2e13a29c9fba4c488c8
1,618
pm
Perl
lib/SWISS/OHs.pm
Helmholtz-HIPS/prosnap
5286cda39276d5eda85d2ddb23b8ab83c5d4960c
[ "MIT" ]
1
2021-11-26T17:29:56.000Z
2021-11-26T17:29:56.000Z
lib/SWISS/OHs.pm
Helmholtz-HIPS/prosnap
5286cda39276d5eda85d2ddb23b8ab83c5d4960c
[ "MIT" ]
1
2020-03-19T21:12:23.000Z
2020-03-19T21:12:23.000Z
lib/SWISS/OHs.pm
Helmholtz-HIPS/prosnap
5286cda39276d5eda85d2ddb23b8ab83c5d4960c
[ "MIT" ]
null
null
null
package SWISS::OHs; use vars qw($AUTOLOAD @ISA @EXPORT_OK %fields); use Exporter; use Carp; use strict; use SWISS::ListBase; use SWISS::TextFunc; use SWISS::OH; BEGIN { @EXPORT_OK = qw(); @ISA = ( 'Exporter', 'SWISS::ListBase'); %fields = ( ); } sub new { my $ref = shift; my $class = ref($ref) || $ref; my $self = new SWISS::ListBase; $self->rebless($class); return $self; } sub fromText { my $self = new(shift); my $textRef = shift; my $line; my @resources; if ($$textRef =~ /($SWISS::TextFunc::linePattern{OH})/m) { foreach $line (split /\n/m, $1) { $self->{indentation} += $line =~ s/^ //; $line = SWISS::TextFunc->cleanLine($line); push @{$self->list()}, SWISS::OH->fromText($line); } } $self->{_dirty} = 0; return $self; } sub toText { my $self = shift; my $textRef = shift; my $newText = ''; for (@{$self->list()}) { $newText .= 'OH ' . $_->toText . "\n"; } $self->{_dirty} = 0; return SWISS::TextFunc->insertLineGroup($textRef, $newText, $SWISS::TextFunc::linePattern{OH}); } # OXs must never be sorted, overwrite the inherited sort method. sub sort { return 1; } 1; __END__ =head1 Name SWISS::OHs =head1 Description B<SWISS::OHs> represents the OH lines within an SWISS-PROT + TrEMBL entry as specified in the user manual http://www.expasy.org/sprot/userman.html . The OHs object is a container object which holds a list of SWISS::OH objects. =head1 Inherits from SWISS::BaseClass.pm =head1 Methods =head2 Standard methods =over =item new =item fromText =item toText =back
16.18
74
0.616811
73da2a8403f45d2e580fdd1ed047a944d7cd69d5
1,026
pl
Perl
FreeBSD/contrib/ntp/ntpdc/nl.pl
TigerBSD/FreeBSD-Custom-ThinkPad
3d092f261b362f73170871403397fc5d6b89d1dc
[ "0BSD" ]
4
2016-08-22T22:02:55.000Z
2017-03-04T22:56:44.000Z
FreeBSD/contrib/ntp/ntpdc/nl.pl
TigerBSD/FreeBSD-Custom-ThinkPad
3d092f261b362f73170871403397fc5d6b89d1dc
[ "0BSD" ]
21
2016-08-11T09:43:43.000Z
2017-01-29T12:52:56.000Z
FreeBSD/contrib/ntp/ntpdc/nl.pl
TigerBSD/TigerBSD
3d092f261b362f73170871403397fc5d6b89d1dc
[ "0BSD" ]
null
null
null
#! /usr/local/bin/perl -w $found = 0; $last = 0; $debug = 0; while (<>) { next if /^#/; next if /^\s*$/; if (/^typedef union req_data_u_tag/) { $found = 1; } if (/^struct info_dns_assoc/) { $last = 1; } if ($found) { if (/^(struct\s*\w*)\s*{\s*$/) { $type = $1; print STDERR "type = '$type'\n" if $debug; printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; next; } if (/^typedef (union\s*\w*)\s*{\s*$/) { $type = $1; print STDERR "union = '$type'\n" if $debug; printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; next; } if (/\s*\w+\s+(\w*)\s*(\[.*\])?\s*;\s*$/) { $field = $1; print STDERR "\tfield = '$field'\n" if $debug; printf " printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n"; next; } if (/^}\s*\w*\s*;\s*$/) { printf " printf(\"\\n\");\n\n"; $found = 0 if $last; next; } print STDERR "Unmatched line: $_"; exit 1; } }
23.318182
93
0.45614
73fc20f3cb8a9a81978549fd471fb934b8dac90d
714
pl
Perl
gcd.pl
adamsch1/scc
b64b8acb4bbb78e27227ff0764c84d28f803af5c
[ "Unlicense" ]
2
2019-05-28T16:37:02.000Z
2021-03-25T22:32:26.000Z
gcd.pl
adamsch1/scc
b64b8acb4bbb78e27227ff0764c84d28f803af5c
[ "Unlicense" ]
null
null
null
gcd.pl
adamsch1/scc
b64b8acb4bbb78e27227ff0764c84d28f803af5c
[ "Unlicense" ]
null
null
null
const m = 7, n = 85; var x, y, z, q, r; procedure multiply; var a,b; begin a := x; b := y; z := 0; while b > 0 do begin if odd b then z := z + a; a := 2 * a; b := b / 2 end end; procedure divide; var w; begin r := x; q := 0; w := y; while w <= r do w := 2 * w; while w > y do begin q := 2 * q; w := w / 2; if w <= r then begin r := r - w; q := q + 1 end end end; procedure gcd; var f, g; begin f := x; g := y; while f # g do begin if f < g then g := g - f; if g < f then f := f - g end; z := f end; begin x := m; y := n; call multiply; x := 25; y := 3; call divide; x := 84; y := 36; call gcd end.
11.704918
29
0.422969
ed0cd142ea2a06f9f0eb5deced5a0a0a3be114e2
674
t
Perl
clients/perl/generated/t/DefaultCrumbIssuerTest.t
PankTrue/swaggy-jenkins
aca35a7cca6e1fcc08bd399e05148942ac2f514b
[ "MIT" ]
23
2017-08-01T12:25:26.000Z
2022-01-25T03:44:11.000Z
clients/perl/generated/t/DefaultCrumbIssuerTest.t
PankTrue/swaggy-jenkins
aca35a7cca6e1fcc08bd399e05148942ac2f514b
[ "MIT" ]
35
2017-06-14T03:28:15.000Z
2022-02-14T10:25:54.000Z
clients/perl/generated/t/DefaultCrumbIssuerTest.t
PankTrue/swaggy-jenkins
aca35a7cca6e1fcc08bd399e05148942ac2f514b
[ "MIT" ]
11
2017-08-31T19:00:20.000Z
2021-12-19T12:04:12.000Z
=begin comment Swaggy Jenkins Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.0.1 Contact: blah@cliffano.com Generated by: https://openapi-generator.tech =end comment =cut # # NOTE: This class is auto generated by the OpenAPI Generator # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # use Test::More tests => 2; use Test::Exception; use lib 'lib'; use strict; use warnings; use_ok('WWW::OpenAPIClient::Object::DefaultCrumbIssuer'); my $instance = WWW::OpenAPIClient::Object::DefaultCrumbIssuer->new(); isa_ok($instance, 'WWW::OpenAPIClient::Object::DefaultCrumbIssuer');
19.823529
69
0.755193
73e3f2b88c174da865e1f1df6ebbde8c9bfe49b6
1,182
al
Perl
Apps/CZ/AdvancedLocalizationPack/app/Src/TableExtensions/JobJournalLine.TableExt.al
MiguelMercadoActual/ALAppExtensions
97ee3823053eb32fa7e38dc3d1e7a89bdcca8d7b
[ "MIT" ]
337
2019-05-07T06:04:40.000Z
2022-03-31T10:07:42.000Z
Apps/CZ/AdvancedLocalizationPack/app/Src/TableExtensions/JobJournalLine.TableExt.al
MiguelMercadoActual/ALAppExtensions
97ee3823053eb32fa7e38dc3d1e7a89bdcca8d7b
[ "MIT" ]
14,850
2019-05-07T06:04:27.000Z
2022-03-31T19:53:28.000Z
Apps/CZ/AdvancedLocalizationPack/app/Src/TableExtensions/JobJournalLine.TableExt.al
MiguelMercadoActual/ALAppExtensions
97ee3823053eb32fa7e38dc3d1e7a89bdcca8d7b
[ "MIT" ]
374
2019-05-09T10:08:14.000Z
2022-03-31T17:48:32.000Z
tableextension 31252 "Job Journal Line CZA" extends "Job Journal Line" { procedure SetGPPGfromSKUCZA() var InventorySetup: Record "Inventory Setup"; GeneralPostingSetup: Record "General Posting Setup"; Item: Record Item; StockkeepingUnit: Record "Stockkeeping Unit"; begin if Type <> Type::Item then exit; InventorySetup.Get(); if not InventorySetup."Use GPPG from SKU CZA" then exit; TestField("No."); Item.Get("No."); if "Gen. Prod. Posting Group" <> Item."Gen. Prod. Posting Group" then Validate("Gen. Prod. Posting Group", Item."Gen. Prod. Posting Group"); if StockkeepingUnit.Get("Location Code", "No.", "Variant Code") then if (StockkeepingUnit."Gen. Prod. Posting Group CZL" <> "Gen. Prod. Posting Group") and (StockkeepingUnit."Gen. Prod. Posting Group CZL" <> '') then Validate("Gen. Prod. Posting Group", StockkeepingUnit."Gen. Prod. Posting Group CZL"); if "Gen. Bus. Posting Group" <> '' then GeneralPostingSetup.Get("Gen. Bus. Posting Group", "Gen. Prod. Posting Group"); end; }
42.214286
159
0.615059
73e4f50644750f90386d38125a7f0e8d3da4d43f
179
pm
Perl
auto-lib/Azure/Consumption/ListForBillingPeriodByEnrollmentAccountMarketplacesResult.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
null
null
null
auto-lib/Azure/Consumption/ListForBillingPeriodByEnrollmentAccountMarketplacesResult.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
null
null
null
auto-lib/Azure/Consumption/ListForBillingPeriodByEnrollmentAccountMarketplacesResult.pm
pplu/azure-sdk-perl
26cbef2d926f571bc1617c26338c106856f95568
[ "Apache-2.0" ]
1
2021-04-08T15:26:39.000Z
2021-04-08T15:26:39.000Z
package Azure::Consumption::ListForBillingPeriodByEnrollmentAccountMarketplacesResult; use Moose; has error => (is => 'ro', isa => 'Azure::Consumption::ErrorDetails' ); 1;
25.571429
86
0.73743
73e30b98125a12682b6b1190b4fcfaad5b2b5c39
10,053
pm
Perl
lib/pgBackRest/Common/ExceptionAuto.pm
mpalmi/pgbackrest
977ec2e307c5487df9ed6fadebd486a92c75f269
[ "MIT" ]
null
null
null
lib/pgBackRest/Common/ExceptionAuto.pm
mpalmi/pgbackrest
977ec2e307c5487df9ed6fadebd486a92c75f269
[ "MIT" ]
null
null
null
lib/pgBackRest/Common/ExceptionAuto.pm
mpalmi/pgbackrest
977ec2e307c5487df9ed6fadebd486a92c75f269
[ "MIT" ]
null
null
null
#################################################################################################################################### # COMMON EXCEPTION AUTO MODULE # # Automatically generated by Build.pm -- do not modify directly. #################################################################################################################################### package pgBackRest::Common::ExceptionAuto; use strict; use warnings FATAL => qw(all); use Exporter qw(import); our @EXPORT = qw(); #################################################################################################################################### # Error Definitions #################################################################################################################################### use constant ERROR_MINIMUM => 25; push @EXPORT, qw(ERROR_MINIMUM); use constant ERROR_MAXIMUM => 125; push @EXPORT, qw(ERROR_MAXIMUM); use constant ERROR_ASSERT => 25; push @EXPORT, qw(ERROR_ASSERT); use constant ERROR_CHECKSUM => 26; push @EXPORT, qw(ERROR_CHECKSUM); use constant ERROR_CONFIG => 27; push @EXPORT, qw(ERROR_CONFIG); use constant ERROR_FILE_INVALID => 28; push @EXPORT, qw(ERROR_FILE_INVALID); use constant ERROR_FORMAT => 29; push @EXPORT, qw(ERROR_FORMAT); use constant ERROR_COMMAND_REQUIRED => 30; push @EXPORT, qw(ERROR_COMMAND_REQUIRED); use constant ERROR_OPTION_INVALID => 31; push @EXPORT, qw(ERROR_OPTION_INVALID); use constant ERROR_OPTION_INVALID_VALUE => 32; push @EXPORT, qw(ERROR_OPTION_INVALID_VALUE); use constant ERROR_OPTION_INVALID_RANGE => 33; push @EXPORT, qw(ERROR_OPTION_INVALID_RANGE); use constant ERROR_OPTION_INVALID_PAIR => 34; push @EXPORT, qw(ERROR_OPTION_INVALID_PAIR); use constant ERROR_OPTION_DUPLICATE_KEY => 35; push @EXPORT, qw(ERROR_OPTION_DUPLICATE_KEY); use constant ERROR_OPTION_NEGATE => 36; push @EXPORT, qw(ERROR_OPTION_NEGATE); use constant ERROR_OPTION_REQUIRED => 37; push @EXPORT, qw(ERROR_OPTION_REQUIRED); use constant ERROR_POSTMASTER_RUNNING => 38; push @EXPORT, qw(ERROR_POSTMASTER_RUNNING); use constant ERROR_PROTOCOL => 39; push @EXPORT, qw(ERROR_PROTOCOL); use constant ERROR_PATH_NOT_EMPTY => 40; push @EXPORT, qw(ERROR_PATH_NOT_EMPTY); use constant ERROR_FILE_OPEN => 41; push @EXPORT, qw(ERROR_FILE_OPEN); use constant ERROR_FILE_READ => 42; push @EXPORT, qw(ERROR_FILE_READ); use constant ERROR_PARAM_REQUIRED => 43; push @EXPORT, qw(ERROR_PARAM_REQUIRED); use constant ERROR_ARCHIVE_MISMATCH => 44; push @EXPORT, qw(ERROR_ARCHIVE_MISMATCH); use constant ERROR_ARCHIVE_DUPLICATE => 45; push @EXPORT, qw(ERROR_ARCHIVE_DUPLICATE); use constant ERROR_VERSION_NOT_SUPPORTED => 46; push @EXPORT, qw(ERROR_VERSION_NOT_SUPPORTED); use constant ERROR_PATH_CREATE => 47; push @EXPORT, qw(ERROR_PATH_CREATE); use constant ERROR_COMMAND_INVALID => 48; push @EXPORT, qw(ERROR_COMMAND_INVALID); use constant ERROR_HOST_CONNECT => 49; push @EXPORT, qw(ERROR_HOST_CONNECT); use constant ERROR_LOCK_ACQUIRE => 50; push @EXPORT, qw(ERROR_LOCK_ACQUIRE); use constant ERROR_BACKUP_MISMATCH => 51; push @EXPORT, qw(ERROR_BACKUP_MISMATCH); use constant ERROR_FILE_SYNC => 52; push @EXPORT, qw(ERROR_FILE_SYNC); use constant ERROR_PATH_OPEN => 53; push @EXPORT, qw(ERROR_PATH_OPEN); use constant ERROR_PATH_SYNC => 54; push @EXPORT, qw(ERROR_PATH_SYNC); use constant ERROR_FILE_MISSING => 55; push @EXPORT, qw(ERROR_FILE_MISSING); use constant ERROR_DB_CONNECT => 56; push @EXPORT, qw(ERROR_DB_CONNECT); use constant ERROR_DB_QUERY => 57; push @EXPORT, qw(ERROR_DB_QUERY); use constant ERROR_DB_MISMATCH => 58; push @EXPORT, qw(ERROR_DB_MISMATCH); use constant ERROR_DB_TIMEOUT => 59; push @EXPORT, qw(ERROR_DB_TIMEOUT); use constant ERROR_FILE_REMOVE => 60; push @EXPORT, qw(ERROR_FILE_REMOVE); use constant ERROR_PATH_REMOVE => 61; push @EXPORT, qw(ERROR_PATH_REMOVE); use constant ERROR_STOP => 62; push @EXPORT, qw(ERROR_STOP); use constant ERROR_TERM => 63; push @EXPORT, qw(ERROR_TERM); use constant ERROR_FILE_WRITE => 64; push @EXPORT, qw(ERROR_FILE_WRITE); use constant ERROR_PROTOCOL_TIMEOUT => 66; push @EXPORT, qw(ERROR_PROTOCOL_TIMEOUT); use constant ERROR_FEATURE_NOT_SUPPORTED => 67; push @EXPORT, qw(ERROR_FEATURE_NOT_SUPPORTED); use constant ERROR_ARCHIVE_COMMAND_INVALID => 68; push @EXPORT, qw(ERROR_ARCHIVE_COMMAND_INVALID); use constant ERROR_LINK_EXPECTED => 69; push @EXPORT, qw(ERROR_LINK_EXPECTED); use constant ERROR_LINK_DESTINATION => 70; push @EXPORT, qw(ERROR_LINK_DESTINATION); use constant ERROR_HOST_INVALID => 72; push @EXPORT, qw(ERROR_HOST_INVALID); use constant ERROR_PATH_MISSING => 73; push @EXPORT, qw(ERROR_PATH_MISSING); use constant ERROR_FILE_MOVE => 74; push @EXPORT, qw(ERROR_FILE_MOVE); use constant ERROR_BACKUP_SET_INVALID => 75; push @EXPORT, qw(ERROR_BACKUP_SET_INVALID); use constant ERROR_TABLESPACE_MAP => 76; push @EXPORT, qw(ERROR_TABLESPACE_MAP); use constant ERROR_PATH_TYPE => 77; push @EXPORT, qw(ERROR_PATH_TYPE); use constant ERROR_LINK_MAP => 78; push @EXPORT, qw(ERROR_LINK_MAP); use constant ERROR_FILE_CLOSE => 79; push @EXPORT, qw(ERROR_FILE_CLOSE); use constant ERROR_DB_MISSING => 80; push @EXPORT, qw(ERROR_DB_MISSING); use constant ERROR_DB_INVALID => 81; push @EXPORT, qw(ERROR_DB_INVALID); use constant ERROR_ARCHIVE_TIMEOUT => 82; push @EXPORT, qw(ERROR_ARCHIVE_TIMEOUT); use constant ERROR_FILE_MODE => 83; push @EXPORT, qw(ERROR_FILE_MODE); use constant ERROR_OPTION_MULTIPLE_VALUE => 84; push @EXPORT, qw(ERROR_OPTION_MULTIPLE_VALUE); use constant ERROR_PROTOCOL_OUTPUT_REQUIRED => 85; push @EXPORT, qw(ERROR_PROTOCOL_OUTPUT_REQUIRED); use constant ERROR_LINK_OPEN => 86; push @EXPORT, qw(ERROR_LINK_OPEN); use constant ERROR_ARCHIVE_DISABLED => 87; push @EXPORT, qw(ERROR_ARCHIVE_DISABLED); use constant ERROR_FILE_OWNER => 88; push @EXPORT, qw(ERROR_FILE_OWNER); use constant ERROR_USER_MISSING => 89; push @EXPORT, qw(ERROR_USER_MISSING); use constant ERROR_OPTION_COMMAND => 90; push @EXPORT, qw(ERROR_OPTION_COMMAND); use constant ERROR_GROUP_MISSING => 91; push @EXPORT, qw(ERROR_GROUP_MISSING); use constant ERROR_PATH_EXISTS => 92; push @EXPORT, qw(ERROR_PATH_EXISTS); use constant ERROR_FILE_EXISTS => 93; push @EXPORT, qw(ERROR_FILE_EXISTS); use constant ERROR_MEMORY => 94; push @EXPORT, qw(ERROR_MEMORY); use constant ERROR_CRYPTO => 95; push @EXPORT, qw(ERROR_CRYPTO); use constant ERROR_PARAM_INVALID => 96; push @EXPORT, qw(ERROR_PARAM_INVALID); use constant ERROR_PATH_CLOSE => 97; push @EXPORT, qw(ERROR_PATH_CLOSE); use constant ERROR_FILE_INFO => 98; push @EXPORT, qw(ERROR_FILE_INFO); use constant ERROR_JSON_FORMAT => 99; push @EXPORT, qw(ERROR_JSON_FORMAT); use constant ERROR_KERNEL => 100; push @EXPORT, qw(ERROR_KERNEL); use constant ERROR_SERVICE => 101; push @EXPORT, qw(ERROR_SERVICE); use constant ERROR_EXECUTE => 102; push @EXPORT, qw(ERROR_EXECUTE); use constant ERROR_RUNTIME => 122; push @EXPORT, qw(ERROR_RUNTIME); use constant ERROR_INVALID => 123; push @EXPORT, qw(ERROR_INVALID); use constant ERROR_UNHANDLED => 124; push @EXPORT, qw(ERROR_UNHANDLED); use constant ERROR_UNKNOWN => 125; push @EXPORT, qw(ERROR_UNKNOWN); 1;
54.63587
132
0.514075
73e024f2e0cea5d754f131b8c982866db3ebebf1
4,846
pl
Perl
usr/eclipseclp/Contrib/assoc.pl
Rimay/sel4-tutorials-manifest
548ebb007c20bb0762af47392967ca44ba1f5093
[ "MIT" ]
111
2015-02-03T02:57:27.000Z
2022-03-01T23:57:09.000Z
usr/eclipseclp/Contrib/assoc.pl
Rimay/sel4-tutorials-manifest
548ebb007c20bb0762af47392967ca44ba1f5093
[ "MIT" ]
12
2016-03-22T14:44:32.000Z
2020-03-18T13:30:29.000Z
usr/eclipseclp/Contrib/assoc.pl
Rimay/sel4-tutorials-manifest
548ebb007c20bb0762af47392967ca44ba1f5093
[ "MIT" ]
55
2015-02-03T05:28:12.000Z
2022-03-31T05:00:03.000Z
:- module(assoc). % SEPIA header :- export assoc_to_list/2, put_assoc/4, get_assoc/3, map_assoc/3, list_to_assoc/2, list_to_assoc/4. % needed in map.pl :- lib(apply). % File : ASSOC.PL % Author : R.A.O'Keefe % Updated: 9 November 1983 % Rewritten: K Johnson 25-5-87 % Ported, fixed and somewhat optimised for SEPIA by J.Schimpf, ECRC 1991 % Purpose: Binary tree implementation of "association lists". % Note : the keys should be ground, the associated values need not be. % This stores association pairs in a tree structure; the empty tree % is just "t". For example, to store the pair "foo-moo" in a hitherto % empty tree % put_assoc(foo,t,moo,T) % To add to tree T the pair "bee-flea" giving the tree U % put_assoc(bee,T,flea,U) % Test data are at the end of the file to help % % put_assoc(+Key, +Old_tree, ?Value, ?New_Tree). % Create a new tree by putting a new pair into an existing one. % put_assoc(Key, t, Val, New) :- !, % Empty tree New = t(Key,Val,t,t). put_assoc(Key, Old, Val, New) :- Old = t(K,_,_,_), compare(Rel, Key, K), put_assoc(Key, Old, Val, New, Rel). % Note that SEPIA will properly index on the last argument: put_assoc(Key, t(_,_,L,R), Val, t(Key,Val,L,R), =). % replace put_assoc(Key, t(K,V,L,R), Val, t(K,V,NewL,R), <) :- put_assoc(Key, L, Val, NewL). put_assoc(Key, t(K,V,L,R), Val, t(K,V,L,NewR), >) :- put_assoc(Key, R, Val, NewR). % % get_assoc gets the Val associated with Key in a tree. % get_assoc(foo,+Tree,-V) % will find the value associated with "foo" in "Tree". % If Key is uninstantiated then get_assoc will work sensibly for the calling % patterns % get_assoc(-Key,+Tree,-V) % which will find every K-V pair on back tracking and % get_assoc(-Key,+Tree,+V) % although the pattern get_assoc(-K,+T,+V) is *time consuming*. % get_assoc(Key, Tree, Val) :- var(Key), !, gen_assoc(Key, Tree, Val). get_assoc(Key, Tree, Val) :- Tree = t(K,_,_,_), compare(Rel, Key, K), get_assoc(Key, Tree, Val, Rel). get_assoc(_Key, t(_,Val,_,_), Val, =). get_assoc(Key, t(_,_,L,_), Val, <) :- get_assoc(Key, L, Val). get_assoc(Key, t(_,_,_,R), Val, >) :- get_assoc(Key, R, Val). gen_assoc(Key, t(_,Val,L,_), Val) :- gen_assoc(Key, L, Val). gen_assoc(Key, t(Key,Val,_,_), Val). gen_assoc(Key, t(_,Val,_,R), Val) :- gen_assoc(Key, R, Val). % % assoc_to_list(+Assoc,-List) % Converts the tree to a list of the form [Key1-Val1, Key2-Val2...] % assoc_to_list(Assoc, List) :- assoc_to_list(Assoc, List, []). assoc_to_list(t, Left, Right) :- !, Left = Right. assoc_to_list(t(Key,Val,L,R), Left, Right) :- assoc_to_list(L, Left, [Key-Val|Mid]), assoc_to_list(R, Mid, Right). % % list_to_assoc(+List, -Assoc) % produces the shortest possible Assoc tree % list_to_assoc(List, Assoc) :- keysort(List, Keys), length(Keys, N), list_to_assoc(N, Keys, Assoc, []). list_to_assoc(0, List, t, List) :- !. list_to_assoc(N, List, t(Key,Val,L,R), Rest) :- A is (N-1) // 2, Z is (N-1)-A, list_to_assoc(A, List, L, [Key-Val|More]), list_to_assoc(Z, More, R, Rest). % % map_assoc(+Pred,+In_tree,-Out_tree) % Calls Pred(X,Y) for every X on the tree. % Constructs a tree of Ys. % :- tool(map_assoc/3, map_assoc/4). map_assoc(_, t, t, _) :- !. map_assoc(Pred, t(Key,Val,L0,R0), t(Key,Ans,L1,R1), Module) :- apply(Pred, [Val, Ans])@Module, map_assoc(Pred, L0, L1, Module), map_assoc(Pred, R0, R1, Module). /* Test insert(K,V) :- % Insert pair K,V into the recorded recorded(tree,T,Ref), % tree. Note, the code above does not put_assoc(K,T,V,T1), % record the tree anywhere. You have to erase(Ref), % do it yourself. record(tree,T1,_). test(_) :- % Test(T) will build up a small tree recorded(tree,_,Ref), % Remove any existing tree(s) erase(Ref), fail. test(T) :- record(tree,t,_), % Create an empty tree insert(mean, bean), % Hang some rhyming pairs off it insert(hoe,go), insert(foo,you), insert(bee,flea), insert(jack,stack), insert(nick,quick), insert(why,sky), insert(word,bird), insert(funny,money), insert(ping,sing), recorded(tree,T,_). % Usage of assoc_to_list balance_tree(T,B) :- % This balances the tree +T giving -B assoc_to_list(T,L), % If you need balanced trees, of course, assoc_to_list(B,L). % there are better ways than this % a test for map_assoc: the "abbrev" predicate deletes all letters % in a name after the third test_map(T,U) :- % Call test_map(-T,-U) recorded(tree,T,_), map_assoc(abbrev,T,U). abbrev(Long,Cut) :- name(Long,Letters), abbrev_list(3,Letters,Fewer_letters), name(Cut,Fewer_letters). abbrev_list(_,[],[]) :- !. abbrev_list(0,_,[]) :- !. abbrev_list(N,[H|T],[H|U]) :- M is N - 1, abbrev_list(M,T,U). */
26.194595
76
0.636195
ed1680f8cd765ab381a619addfefa070c01f8837
9,124
pm
Perl
lib/Perl/Dist/WiX/Mixin/Checkpoint.pm
git-the-cpan/Perl-Dist-WiX
46c6ae7bf1db918e51533c4b9d3a21300eca7282
[ "Artistic-1.0" ]
null
null
null
lib/Perl/Dist/WiX/Mixin/Checkpoint.pm
git-the-cpan/Perl-Dist-WiX
46c6ae7bf1db918e51533c4b9d3a21300eca7282
[ "Artistic-1.0" ]
null
null
null
lib/Perl/Dist/WiX/Mixin/Checkpoint.pm
git-the-cpan/Perl-Dist-WiX
46c6ae7bf1db918e51533c4b9d3a21300eca7282
[ "Artistic-1.0" ]
null
null
null
package Perl::Dist::WiX::Mixin::Checkpoint; =pod =head1 NAME Perl::Dist::WiX::Mixin::Checkpoint - Checkpoint support for Perl::Dist::WiX =head1 VERSION This document describes Perl::Dist::WiX::Mixin::Checkpoint version 1.500002. =head1 SYNOPSIS # This module is not to be used independently. # It provides methods to be called on a Perl::Dist::WiX object. $dist = Perl::Dist::WiX->new( # ... checkpoint_before => 5, checkpoint_after => [8, 9], checkpoint_stop => 9, # ... ); =head1 DESCRIPTION This module provides the routines that Perl::Dist::WiX uses in order to support checkpointing. =head1 INTERFACE There are 2 portions to the interface to this module - the parameters to L<new()|Perl::Dist::WiX/new> (documented in that module), and the object methods that Perl::Dist::WiX uses to coordinate checkpointing, as described below. These routines are not meant to be called from external classes. L<Perl::Dist::WiX|Perl::Dist::WiX> calls these routines as required. =cut #<<< use 5.010; use Moose; use English qw( -no_match_vars ); use List::Util qw( first ); use File::Spec::Functions qw( catdir catfile ); use Storable qw(); use Clone qw(clone); #>>> our $VERSION = '1.500002'; =head2 checkpoint_task C<checkpoint_task> executes a portion of creating an installer. The first parameter is the name of the subroutine to be executed. The second parameter is the task number that goes with that subroutine. Returns true (technically, the object that called it), or throws an exception. This routine is called for each task (a task is a method on C<Perl::Dist::WiX> or a subclass of it) defined in the L<tasklist|Perl::Dist::WiX/tasklist> parameter to C<Perl::Dist::WiX->new()>. =cut sub checkpoint_task { my $self = shift; my $task = shift; my $step = shift; # Are we loading at this step? if ( $self->checkpoint_before() == $step ) { $self->checkpoint_load(); } # Skip if we are loading later on if ( $self->checkpoint_before() > $step ) { $self->trace_line( 0, "Skipping $task (step $step.)\n" ); } else { my $t = time; if ( not $self->can($task) ) { PDWiX::NotTask->throw( class => ref $self, task => $task, step => $step ); } $self->$task(); $self->trace_line( 0, "Completed $task (step $step) in " . ( time - $t ) . " seconds\n" ); } ## end else [ if ( $self->checkpoint_before...)] # Are we saving at this step? if ( defined first { $step == $_ } @{ $self->checkpoint_after() } ) { $self->checkpoint_save(); } # Are we stopping at this step? if ( $self->checkpoint_stop() == $step ) { return 0; } return $self; } ## end sub checkpoint_task =head2 checkpoint_file Returns the file that the Perl::Dist::WiX object is stored in when C<checkpoint_save> is called. =cut sub checkpoint_file { my $self = shift; return catfile( $self->checkpoint_dir(), 'self.dat' ); } =head2 checkpoint_self Currently unimplemented, and throws an exception saying so. =cut sub checkpoint_self { return WiX3::Exception::Unimplemented->throw(); } =head2 checkpoint_save Saves a checkpoint within the checkpoint subdirectory of L<< Perl::Dist::WiX-E<gt>temp_dir()|Perl::Dist::WiX/temp_dir >> =cut sub checkpoint_save { my $self = shift; if ( not $self->temp_dir() ) { PDWiX->throw('Checkpoints require a temp_dir to be set'); } # Clear out any existing checkpoint. $self->trace_line( 1, "Removing old checkpoint\n" ); $self->remake_path( $self->checkpoint_dir() ); # Copy the paths into the checkpoint directory. $self->trace_line( 1, "Copying checkpoint directories...\n" ); foreach my $dir (qw{ build_dir download_dir image_dir output_dir }) { my $from = $self->$dir(); my $to = catdir( $self->checkpoint_dir(), $dir ); $self->copy_file( $from => $to ); } # Blank the checkpoint values to prevent load/save loops, and remove # things we can recreate later. my $copy = clone($self); $copy->_clear_patch_template(); $copy->_clear_guidgen(); $copy->_clear_user_agent(); $copy->_clear_trace_object(); $copy->_set_checkpoint_before(0); $copy->_set_checkpoint_after( [0] ); $copy->_set_checkpoint_stop(0); # Store the main object. local $Storable::Deparse = 1; eval { Storable::nstore( $copy, $self->checkpoint_file() ); 1; } or PDWiX::Caught::Storable->throw( message => $EVAL_ERROR, object => $copy ); return 1; } ## end sub checkpoint_save =head2 checkpoint_load Restores a checkpoint saved to the checkpoint subdirectory of L<< Perl::Dist::WiX-E<gt>temp_dir()|Perl::Dist::WiX/temp_dir >> with L</checkpoint_save>. =cut sub checkpoint_load { ## no critic(ProtectPrivateSubs) my $self = shift; my $class = ref $self; # Does the checkpoint exist? if ( not -d $self->checkpoint_dir() ) { PDWiX::Directory->throw( message => 'Checkpoint directory does not exist', dir => $self->checkpoint_dir() ); } if ( not -f $self->checkpoint_file() ) { PDWiX::File->throw( message => 'Checkpoint file does not exist', file => $self->checkpoint_file() ); } $self->trace_line( 1, "Preparing to restore checkpoint\n" ); # If we want a future checkpoint, save it. my $checkpoint_after = $self->checkpoint_after() || 0; my $checkpoint_stop = $self->checkpoint_stop() || 0; # Save off the user agent for later restoration. my $user_agent = $self->user_agent(); # Clear the directory tree. $self->_clear_directory_tree(); Perl::Dist::WiX::DirectoryTree->_clear_instance(); # Load the stored hash over our object local $Storable::Eval = 1; my $stored = Storable::retrieve( $self->checkpoint_file() ); %{$self} = %{$stored}; # Restore any possible future checkpoint. $self->_set_checkpoint_after($checkpoint_after); $self->_set_checkpoint_stop($checkpoint_stop); # Grab the directory tree stuff before we clear it. my $directory_tree_root = $self->{_directories}->{_root}; my $app_name = $self->{_directories}->{app_name}; my $app_dir = $self->{_directories}->{app_dir}; # Clear the directory tree instance again, then # recreate it with the saved stuff. $self->_clear_directory_tree(); Perl::Dist::WiX::DirectoryTree->_clear_instance(); $self->_set_directories( Perl::Dist::WiX::DirectoryTree->new( app_dir => $app_dir, app_name => $app_name, _root => $directory_tree_root, ) ); # Reload the misc object. $self->_clear_trace_object(); WiX3::Trace::Object->_clear_instance(); WiX3::Traceable->_clear_instance(); $self->_set_trace_object( WiX3::Traceable->new( tracelevel => $self->trace() ) ); # Reload GUID generator. $self->_clear_guidgen(); WiX3::XML::GeneratesGUID::Object->_clear_instance(); $self->_set_guidgen( WiX3::XML::GeneratesGUID::Object->new( _sitename => $self->sitename() ) ); # Reload LWP user agent. $self->_clear_user_agent(); $self->_set_user_agent($user_agent); # Clear other objects for reloading. $self->_clear_patch_template(); # Pull all the directories out of the storage. $self->trace_line( 0, "Restoring checkpoint directories...\n" ); foreach my $dir (qw{ build_dir download_dir image_dir output_dir }) { my $from = File::Spec->catdir( $self->checkpoint_dir(), $dir ); my $to = $self->$dir(); $self->remove_path($to); $self->copy_file( $from => $to ); } return 1; } ## end sub checkpoint_load no Moose; __PACKAGE__->meta()->make_immutable(); 1; __END__ =pod =head1 DIAGNOSTICS See L<Perl::Dist::WiX::Diagnostics|Perl::Dist::WiX::Diagnostics> for a list of exceptions that this module can throw. =head1 BUGS AND LIMITATIONS (SUPPORT) B<WARNING:> The checkpointing facility in this module is NOT stable. It is currently implemented using L<Storable|Storable> with the C<$Storable::Deparse> variable set to 1 (localized, of course). This probably WILL change in the future, as when checkpoints are reloaded, hash entries are appearing that weren't intended to be there. I am also not sure that references that were weakened are weakened when reloaded. Restored checkpoints currently crash with "Free in wrong pool" errors in global destruction - if an exception occurs, they're reported there instead. Do B<NOT> use this in production. Debugging a distribution using the facilities provided here is fine. Bugs should be reported via: 1) The CPAN bug tracker at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-Dist-WiX> if you have an account there. 2) Email to E<lt>bug-Perl-Dist-WiX@rt.cpan.orgE<gt> if you do not. For other issues, contact the topmost author. =head1 AUTHORS Curtis Jewell E<lt>csjewell@cpan.orgE<gt> Adam Kennedy E<lt>adamk@cpan.orgE<gt> =head1 SEE ALSO L<Perl::Dist|Perl::Dist>, L<Perl::Dist::WiX|Perl::Dist::WiX>, L<http://ali.as/>, L<http://csjewell.comyr.com/perl/> =head1 COPYRIGHT AND LICENSE Copyright 2009 - 2010 Curtis Jewell. Copyright 2008 - 2009 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this distribution. =cut
26.678363
90
0.693884
73e0e92d72f4752db46f3cd36fe326374a7e8685
201
t
Perl
t/Wikibase-Datatype-Struct-Reference/02-version.t
michal-josef-spacek/Wikibase-Datatype-Struct
adfd09504136f809e66e156534d08e495d2e5280
[ "BSD-2-Clause" ]
1
2021-01-27T09:48:05.000Z
2021-01-27T09:48:05.000Z
t/Wikibase-Datatype-Struct-Reference/02-version.t
michal-josef-spacek/Wikibase-Datatype-Struct
adfd09504136f809e66e156534d08e495d2e5280
[ "BSD-2-Clause" ]
null
null
null
t/Wikibase-Datatype-Struct-Reference/02-version.t
michal-josef-spacek/Wikibase-Datatype-Struct
adfd09504136f809e66e156534d08e495d2e5280
[ "BSD-2-Clause" ]
null
null
null
use strict; use warnings; use Test::More 'tests' => 2; use Test::NoWarnings; use Wikibase::Datatype::Struct::Reference; # Test. is($Wikibase::Datatype::Struct::Reference::VERSION, 0.09, 'Version.');
20.1
70
0.706468