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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
73f180cfb94d8fe49730103c20aedc08e3f7374d | 657 | t | Perl | t/startup.t | wsdookadr/mojolicious-plugin-sizelimit | fed37106f83c1590bcfaa4661450e834f4ab35cd | [
"Artistic-2.0"
]
| null | null | null | t/startup.t | wsdookadr/mojolicious-plugin-sizelimit | fed37106f83c1590bcfaa4661450e834f4ab35cd | [
"Artistic-2.0"
]
| null | null | null | t/startup.t | wsdookadr/mojolicious-plugin-sizelimit | fed37106f83c1590bcfaa4661450e834f4ab35cd | [
"Artistic-2.0"
]
| null | null | null | use Mojo::Base -strict;
use Test::More;
use Mojo::IOLoop;
use Mojolicious::Lite;
use Test::Mojo;
require Mojolicious::Plugin::SizeLimit;
my ($total, $shared) = Mojolicious::Plugin::SizeLimit::check_size();
unless (ok $total, "OS ($^O) is supported") {
done_testing();
exit 0;
}
my $stopped = 0;
my $t = Test::Mojo->new;
my $shutdown_on_startup_occured = 0;
Mojo::IOLoop->singleton->on("sizelimit_shutdown", sub { $shutdown_on_startup_occured = 1; });
plugin 'SizeLimit', max_process_size => 1, check_interval => 20, startup_check => 1, report_level => 'info';
ok($shutdown_on_startup_occured, "shutdown occured as expected");
done_testing();
| 26.28 | 108 | 0.70624 |
73e77bdd5700c384b166aa1d106a65fc7b29665d | 12,385 | t | Perl | t/max_time_ms.t | nunorc/mongo-perl-driver | 8fcdf41bb8e92771df0b68fc52aadf95d2586e62 | [
"Apache-2.0"
]
| null | null | null | t/max_time_ms.t | nunorc/mongo-perl-driver | 8fcdf41bb8e92771df0b68fc52aadf95d2586e62 | [
"Apache-2.0"
]
| null | null | null | t/max_time_ms.t | nunorc/mongo-perl-driver | 8fcdf41bb8e92771df0b68fc52aadf95d2586e62 | [
"Apache-2.0"
]
| null | null | null | #
# Copyright 2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use warnings;
use Test::More 0.96;
use Test::Fatal;
use MongoDB;
use lib "t/lib";
use MongoDBTest qw/skip_unless_mongod build_client get_test_db server_type server_version/;
skip_unless_mongod();
my $conn = build_client();
my $testdb = get_test_db($conn);
my $server_type = server_type($conn);
my $server_version = server_version($conn);
# This test sets failpoints, which will make the tested server unusable
# for ordinary purposes. As this is risky, the test requires the user
# to opt-in
unless ( $ENV{FAILPOINT_TESTING} ) {
plan skip_all => "\$ENV{FAILPOINT_TESTING} is false";
}
# Test::Harness 3.31 supports the t/testrules.yml file to ensure that
# this test file won't be run in parallel other tests, since turning on
# a fail point will interfere with other tests.
if ( $ENV{HARNESS_VERSION} < 3.31 ) {
plan skip_all => "not safe to run fail points before Test::Harness 3.31";
}
my $param = eval {
$conn->get_database('admin')
->run_command( [ getParameter => 1, enableTestCommands => 1 ] );
};
my $coll;
my $admin = $conn->get_database("admin");
note "CAP-401 test plan";
can_ok( 'MongoDB::Cursor', 'max_time_ms' );
$coll = $testdb->get_collection("test_collection");
my $bulk = $coll->ordered_bulk;
$bulk->insert_one( { _id => $_ } ) for 1 .. 20;
my $err = exception { $bulk->execute };
is( $err, undef, "inserted 20 documents for testing" );
subtest "expected behaviors" => sub {
is( exception { $coll->find->max_time_ms()->next }, undef, "find->max_time_ms()" );
is( exception { $coll->find->max_time_ms(0)->next }, undef, "find->max_time_ms(0)" );
is( exception { $coll->find->max_time_ms(5000)->next },
undef, "find->max_time_ms(5000)" );
like( exception { $coll->find->max_time_ms(-1)->next },
qr/non-negative/, "find->max_time_ms(-1) throws exception" );
is( exception { $coll->find( {}, { maxTimeMS => 5000 } ) },
undef, "find with maxTimeMS" );
is(
exception {
my $doc = $coll->find_one( { _id => 1 }, undef, { maxTimeMS => 5000 } );
},
undef,
"find_one with maxTimeMS works"
);
SKIP: {
skip "aggregate not available until MongoDB v2.2", 1
unless $server_version > v2.2.0;
is(
exception {
my $doc = $coll->aggregate(
[ { '$project' => { name => 1, count => 1 } } ],
{ maxTimeMS => 5000 },
);
},
undef,
"aggregate helper with maxTimeMS works"
);
}
is(
exception {
my $doc = $coll->count( {}, { maxTimeMS => 5000 } );
},
undef,
"count helper with maxTimeMS works"
);
is(
exception {
my $doc = $coll->distinct( 'a', {}, { maxTimeMS => 5000 } );
},
undef,
"distinct helper with maxTimeMS works"
);
is(
exception {
my $doc = $coll->find_one_and_replace(
{ _id => 22 },
{ x => 1 },
{ upsert => 1, maxTimeMS => 5000 }
);
},
undef,
"find_one_and_replace helper with maxTimeMS works"
);
is(
exception {
my $doc = $coll->find_one_and_update(
{ _id => 23 },
{ '$set' => { x => 1 } },
{ upsert => 1, maxTimeMS => 5000 }
);
},
undef,
"find_one_and_update helper with maxTimeMS works"
);
is(
exception {
my $doc = $coll->find_one_and_delete( { _id => 23 }, { maxTimeMS => 5000 } );
},
undef,
"find_one_and_delete helper with maxTimeMS works"
);
is(
exception {
my $cursor = $coll->database->list_collections( {}, { maxTimeMS => 5000 } );
},
undef,
"list_collections command with maxTimeMS works"
);
subtest "parallel_scan" => sub {
plan skip_all => "Parallel scan not supported before MongoDB 2.6"
unless $server_version >= v2.6.0;
plan skip_all => "Parallel scan not supported on mongos"
if $server_type eq 'Mongos';
is(
exception {
my $cursor = $coll->parallel_scan( 20, { maxTimeMS => 5000 } );
},
undef,
"parallel_scan command with maxTimeMS works"
);
};
};
subtest "force maxTimeMS failures" => sub {
plan skip_all => "maxTimeMS not available before 2.6"
unless $server_version >= v2.6.0;
plan skip_all => "enableTestCommands is off"
unless $param && $param->{enableTestCommands};
plan skip_all => "fail points not supported via mongos"
if $server_type eq 'Mongos';
# low batchSize to force multiple batches to get all docs
my $cursor = $coll->find( {}, { batchSize => 5, maxTimeMS => 5000 } )->result;
$cursor->next; # before turning on fail point
is(
exception {
$admin->run_command(
[ configureFailPoint => 'maxTimeAlwaysTimeOut', mode => 'alwaysOn' ] );
},
undef,
"turned on maxTimeAlwaysTimeOut fail point"
);
my @foo;
like(
exception { @foo = $cursor->all },
qr/exceeded time limit/,
"existing cursor with max_time_ms times out"
) or diag explain \@foo;
like(
exception { $coll->find()->max_time_ms(10)->next },
qr/exceeded time limit/,
"new cursor with max_time_ms times out"
);
like(
exception { $coll->find( {}, { maxTimeMS => 10 } )->next },
qr/exceeded time limit/,
, "find with maxTimeMS times out"
);
like(
exception {
my $doc = $coll->find_one( { _id => 1 }, undef, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"find_one with maxTimeMS times out"
);
like(
exception {
my $doc = $coll->count( {}, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"count command with maxTimeMS times out"
);
SKIP: {
skip "aggregate not available until MongoDB v2.2", 1
unless $server_version > v2.2.0;
like(
exception {
my $doc = $coll->aggregate(
[ { '$project' => { name => 1, count => 1 } } ],
{ maxTimeMS => 10 },
);
},
qr/exceeded time limit/,
"aggregate helper with maxTimeMS times out"
);
}
like(
exception {
my $doc = $coll->count( {}, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"count helper with maxTimeMS times out"
);
like(
exception {
my $doc = $coll->distinct( 'a', {}, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"distinct helper with maxTimeMS times out"
);
like(
exception {
my $doc = $coll->find_one_and_replace(
{ _id => 22 },
{ x => 1 },
{ upsert => 1, maxTimeMS => 10 }
);
},
qr/exceeded time limit/,
"find_one_and_replace helper with maxTimeMS times out"
);
like(
exception {
my $doc = $coll->find_one_and_update(
{ _id => 23 },
{ '$set' => { x => 1 } },
{ upsert => 1, maxTimeMS => 10 }
);
},
qr/exceeded time limit/,
"find_one_and_update helper with maxTimeMS times out"
);
like(
exception {
my $doc = $coll->find_one_and_delete( { _id => 23 }, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"find_one_and_delete helper with maxTimeMS times out"
);
like(
exception {
my $cursor = $coll->database->list_collections( {}, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"list_collections command times out"
);
subtest "parallel_scan" => sub {
plan skip_all => "Parallel scan not supported before MongoDB 2.6"
unless $server_version >= v2.6.0;
plan skip_all => "Parallel scan not supported on mongos"
if $server_type eq 'Mongos';
like(
exception {
my $cursor = $coll->parallel_scan( 20, { maxTimeMS => 10 } );
},
qr/exceeded time limit/,
"parallel_scan command times out"
);
};
subtest "max_time_ms via constructor" => sub {
is(
exception { my $doc = $coll->count( {} ) },
undef,
"count helper with default maxTimeMS 0 from client works"
);
my $conn2 = build_client( max_time_ms => 10 );
my $testdb2 = get_test_db($conn2);
my $coll2 = $testdb2->get_collection("test_collection");
like(
exception {
my $doc = $coll2->count( {} );
},
qr/exceeded time limit/,
"count helper with configured maxTimeMS times out"
);
};
subtest "zero disables maxTimeMS" => sub {
is( exception { $coll->find->max_time_ms(0)->next }, undef, "find->max_time_ms(0)" );
is( exception { $coll->find( {}, { maxTimeMS => 5000 } ) },
undef, "find with MaxTimeMS 5000 works" );
is(
exception {
my $doc = $coll->find_one( { _id => 1 }, undef, { maxTimeMS => 0 } );
},
undef,
"find_one with MaxTimeMS zero works"
);
SKIP: {
skip "aggregate not available until MongoDB v2.2", 1
unless $server_version > v2.2.0;
is(
exception {
my $doc = $coll->aggregate(
[ { '$project' => { name => 1, count => 1 } } ],
{ maxTimeMS => 0 },
);
},
undef,
"aggregate helper with MaxTimeMS zero works"
);
}
is(
exception {
my $doc = $coll->count( {}, { maxTimeMS => 0 } );
},
undef,
"count helper with MaxTimeMS zero works"
);
is(
exception {
my $doc = $coll->distinct( 'a', {}, { maxTimeMS => 0 } );
},
undef,
"distinct helper with MaxTimeMS zero works"
);
is(
exception {
my $doc = $coll->find_one_and_replace(
{ _id => 22 },
{ x => 1 },
{ upsert => 1, maxTimeMS => 0 }
);
},
undef,
"find_one_and_replace helper with MaxTimeMS zero works"
);
is(
exception {
my $doc = $coll->find_one_and_update(
{ _id => 23 },
{ '$set' => { x => 1 } },
{ upsert => 1, maxTimeMS => 0 }
);
},
undef,
"find_one_and_update helper with MaxTimeMS zero works"
);
is(
exception {
my $doc = $coll->find_one_and_delete( { _id => 23 }, { maxTimeMS => 0 } );
},
undef,
"find_one_and_delete helper with MaxTimeMS zero works"
);
};
is(
exception {
$admin->run_command(
[ configureFailPoint => 'maxTimeAlwaysTimeOut', mode => 'off' ] );
},
undef,
"turned off maxTimeAlwaysTimeOut fail point"
);
};
done_testing;
| 28.802326 | 93 | 0.503755 |
ed42dca0509ec13a1c588c8645dde0dbd83c778e | 11,386 | pl | Perl | library/quasi_quotations.pl | sailfishos-mirror/swipl | d715454d15f6a24c0ffddf6fc157a82ac5be9383 | [
"BSD-2-Clause"
]
| 725 | 2015-01-01T07:07:49.000Z | 2022-03-29T10:35:31.000Z | library/quasi_quotations.pl | sailfishos-mirror/swipl | d715454d15f6a24c0ffddf6fc157a82ac5be9383 | [
"BSD-2-Clause"
]
| 819 | 2015-01-17T21:18:52.000Z | 2022-03-31T17:35:57.000Z | library/quasi_quotations.pl | sailfishos-mirror/swipl | d715454d15f6a24c0ffddf6fc157a82ac5be9383 | [
"BSD-2-Clause"
]
| 268 | 2015-01-07T04:18:55.000Z | 2022-03-30T06:15:31.000Z | /* Part of SWI-Prolog
Author: Jan Wielemaker
E-mail: J.Wielemaker@vu.nl
WWW: http://www.swi-prolog.org
Copyright (c) 2013-2015, VU University Amsterdam
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
:- module(quasi_quotations,
[ with_quasi_quotation_input/3, % +Content, -Stream, :Goal
phrase_from_quasi_quotation/2, % :Grammar, +Content
quasi_quotation_syntax_error/1, % +Error
quasi_quotation_syntax/1 % :Syntax
]).
:- autoload(library(error),[must_be/2]).
:- autoload(library(pure_input),[stream_to_lazy_list/2]).
/** <module> Define Quasi Quotation syntax
Inspired by
[Haskell](http://www.haskell.org/haskellwiki/Quasiquotation), SWI-Prolog
support _quasi quotation_. Quasi quotation allows for embedding (long)
strings using the syntax of an external language (e.g., HTML, SQL) in
Prolog text and syntax-aware embedding of Prolog variables in this
syntax. At the same time, quasi quotation provides an alternative to
represent long strings and atoms in Prolog.
The basic form of a quasi quotation is defined below. Here, `Syntax` is
an arbitrary Prolog term that must parse into a _callable_ (atom or
compound) term and Quotation is an arbitrary sequence of characters, not
including the sequence =||}|=. If this sequence needs to be embedded, it
must be escaped according to the rules of the target language or the
`quoter' must provide an escaping mechanism.
==
{|Syntax||Quotation|}
==
While reading a Prolog term, and if the Prolog flag =quasi_quotes= is
set to =true= (which is the case if this library is loaded), the parser
collects quasi quotations. After reading the final full stop, the parser
makes the call below. Here, `SyntaxName` is the functor name of `Syntax`
above and `SyntaxArgs` is a list holding the arguments, i.e., `Syntax
=.. [SyntaxName|SyntaxArgs]`. Splitting the syntax into its name and
arguments is done to make the quasi quotation parser a predicate with a
consistent arity 4, regardless of the number of additional arguments.
==
call(+SyntaxName, +Content, +SyntaxArgs, +VariableNames, -Result)
==
The arguments are defined as
- `SyntaxName` is the principal functor of the quasi quotation syntax.
This must be declared using quasi_quotation_syntax/1 and there must be
a predicate SyntaxName/4.
- `Content` is an opaque term that carries the content of the quasi
quoted material and position information about the source code. It is
passed to with_quasi_quote_input/3.
- `SyntaxArgs` carries the additional arguments of the `Syntax`. These are
commonly used to make the parameter passing between the clause and the
quasi quotation explicit. For example:
==
...,
{|html(Name, Address)||
<tr><td>Name<td>Address</tr>
|}
==
- `VariableNames` is the complete variable dictionary of the clause as
it is made available throug read_term/3 with the option
=variable_names=. It is a list of terms `Name = Var`.
- `Result` is a variable that must be unified to resulting term.
Typically, this term is structured Prolog tree that carries a
(partial) representation of the abstract syntax tree with embedded
variables that pass the Prolog parameters. This term is normally
either passed to a predicate that serializes the abstract syntax tree,
or a predicate that processes the result in Prolog. For example, HTML
is commonly embedded for writing HTML documents (see
library(http/html_write)). Examples of languages that may be embedded
for processing in Prolog are SPARQL, RuleML or regular expressions.
The file library(http/html_quasiquotations) provides the, suprisingly
simple, quasi quotation parser for HTML.
@author Jan Wielemaker. Introduction of Quasi Quotation was suggested
by Michael Hendricks.
@see [Why it's nice to be quoted: quasiquoting for
haskell](http://www.cs.tufts.edu/comp/150FP/archive/geoff-mainland/quasiquoting.pdf)
*/
:- meta_predicate
with_quasi_quotation_input(+, -, 0),
quasi_quotation_syntax(4),
phrase_from_quasi_quotation(//, +).
:- set_prolog_flag(quasi_quotations, true).
%! with_quasi_quotation_input(+Content, -Stream, :Goal) is det.
%
% Process the quasi-quoted Content using Stream parsed by Goal.
% Stream is a temporary stream with the following properties:
%
% - Its initial _position_ represents the position of the
% start of the quoted material.
% - It is a text stream, using =utf8= _encoding_.
% - It allows for repositioning
% - It will be closed after Goal completes.
%
% @arg Goal is executed as once(Goal). Goal must succeed.
% Failure or exceptions from Goal are interpreted as
% syntax errors.
% @see phrase_from_quasi_quotation/2 can be used to process a
% quotation using a grammar.
with_quasi_quotation_input(Content, Stream, Goal) :-
functor(Content, '$quasi_quotation', 3),
!,
setup_call_cleanup(
'$qq_open'(Content, Stream),
( call(Goal)
-> true
; quasi_quotation_syntax_error(
quasi_quotation_parser_failed,
Stream)
),
close(Stream)).
%! phrase_from_quasi_quotation(:Grammar, +Content) is det.
%
% Process the quasi quotation using the DCG Grammar. Failure of
% the grammar is interpreted as a syntax error.
%
% @see with_quasi_quotation_input/3 for processing quotations from
% stream.
phrase_from_quasi_quotation(Grammar, Content) :-
functor(Content, '$quasi_quotation', 3),
!,
setup_call_cleanup(
'$qq_open'(Content, Stream),
phrase_quasi_quotation(Grammar, Stream),
close(Stream)).
phrase_quasi_quotation(Grammar, Stream) :-
set_stream(Stream, buffer_size(512)),
stream_to_lazy_list(Stream, List),
phrase(Grammar, List),
!.
phrase_quasi_quotation(_, Stream) :-
quasi_quotation_syntax_error(
quasi_quotation_parser_failed,
Stream).
%! quasi_quotation_syntax(:SyntaxName) is det.
%
% Declare the predicate SyntaxName/4 to implement the the quasi
% quote syntax SyntaxName. Normally used as a directive.
quasi_quotation_syntax(M:Syntax) :-
must_be(atom, Syntax),
'$set_predicate_attribute'(M:Syntax/4, quasi_quotation_syntax, true).
%! quasi_quotation_syntax_error(+Error)
%
% Report syntax_error(Error) using the current location in the
% quasi quoted input parser.
%
% @throws error(syntax_error(Error), Position)
quasi_quotation_syntax_error(Error) :-
quasi_quotation_input(Stream),
quasi_quotation_syntax_error(Error, Stream).
quasi_quotation_syntax_error(Error, Stream) :-
stream_syntax_error_context(Stream, Context),
throw(error(syntax_error(Error), Context)).
quasi_quotation_input(Stream) :-
'$input_context'(Stack),
memberchk(input(quasi_quoted, _File, _Line, StreamVar), Stack),
Stream = StreamVar.
%! stream_syntax_error_context(+Stream, -Position) is det.
%
% Provide syntax error location for the current position of
% Stream.
stream_syntax_error_context(Stream, file(File, LineNo, LinePos, CharNo)) :-
stream_property(Stream, file_name(File)),
position_context(Stream, LineNo, LinePos, CharNo),
!.
stream_syntax_error_context(Stream, stream(Stream, LineNo, LinePos, CharNo)) :-
position_context(Stream, LineNo, LinePos, CharNo),
!.
stream_syntax_error_context(_, _).
position_context(Stream, LineNo, LinePos, CharNo) :-
stream_property(Stream, position(Pos)),
!,
stream_position_data(line_count, Pos, LineNo),
stream_position_data(line_position, Pos, LinePos),
stream_position_data(char_count, Pos, CharNo).
/*******************************
* SYSTEM HOOK *
*******************************/
% system:'$parse_quasi_quotations'(+Quotations:list, +Module) is
% det.
%
% @arg Quotations is a list of terms
%
% quasi_quotation(Syntax, Quotation, VarNames, Result)
:- public
system:'$parse_quasi_quotations'/2.
system:'$parse_quasi_quotations'([], _).
system:'$parse_quasi_quotations'([H|T], M) :-
qq_call(H, M),
system:'$parse_quasi_quotations'(T, M).
qq_call(quasi_quotation(Syntax, Content, VariableNames, Result), M) :-
current_prolog_flag(sandboxed_load, false),
Syntax =.. [SyntaxName|SyntaxArgs],
setup_call_cleanup(
'$push_input_context'(quasi_quoted),
call(M:SyntaxName, Content, SyntaxArgs, VariableNames, Result),
'$pop_input_context'),
!.
qq_call(quasi_quotation(Syntax, Content, VariableNames, Result), M) :-
current_prolog_flag(sandboxed_load, true),
Syntax =.. [SyntaxName|SyntaxArgs],
Expand =.. [SyntaxName, Content, SyntaxArgs, VariableNames, Result],
QExpand = M:Expand,
'$expand':allowed_expansion(QExpand),
setup_call_cleanup(
'$push_input_context'(quasi_quoted),
call(QExpand),
'$pop_input_context'),
!.
qq_call(quasi_quotation(_Syntax, Content, _VariableNames, _Result), _M) :-
setup_call_cleanup(
'$push_input_context'(quasi_quoted),
with_quasi_quotation_input(
Content, Stream,
quasi_quotation_syntax_error(quasi_quote_parser_failed, Stream)),
'$pop_input_context'),
!.
/*******************************
* MESSAGES *
*******************************/
:- multifile
prolog:error_message//1.
prolog:error_message(syntax_error(unknown_quasi_quotation_syntax(Syntax, M))) -->
{ functor(Syntax, Name, _) },
[ 'Quasi quotation syntax ~q:~q is not defined'-[M, Name] ].
prolog:error_message(syntax_error(invalid_quasi_quotation_syntax(Syntax))) -->
[ 'Quasi quotation syntax must be a callable term. Found ~q'-[Syntax] ].
| 38.080268 | 92 | 0.691112 |
ed03dd68829c58a48fdaaa8fa01f5aa853d65b88 | 3,458 | t | Perl | exercises/roman-numerals/roman-numerals.t | cxw42/exercism-perl5 | bdfed33f5fa5029df7aa6005da237a3ded5c368e | [
"MIT"
]
| null | null | null | exercises/roman-numerals/roman-numerals.t | cxw42/exercism-perl5 | bdfed33f5fa5029df7aa6005da237a3ded5c368e | [
"MIT"
]
| null | null | null | exercises/roman-numerals/roman-numerals.t | cxw42/exercism-perl5 | bdfed33f5fa5029df7aa6005da237a3ded5c368e | [
"MIT"
]
| null | null | null | #!/usr/bin/env perl
use Test2::V0;
use JSON::PP;
use FindBin qw($Bin);
use lib $Bin, "$Bin/local/lib/perl5";
use RomanNumerals qw(to_roman);
my $C_DATA = do { local $/; decode_json(<DATA>); };
plan 20;
imported_ok qw(to_roman) or bail_out;
for my $case ( @{ $C_DATA->{cases} } ) {
is to_roman( $case->{input}{number} ), $case->{expected},
$case->{description};
}
__DATA__
{
"exercise": "roman-numerals",
"version": "1.2.0",
"cases": [
{
"description": "1 is a single I",
"property": "roman",
"input": {
"number": 1
},
"expected": "I"
},
{
"description": "2 is two I's",
"property": "roman",
"input": {
"number": 2
},
"expected": "II"
},
{
"description": "3 is three I's",
"property": "roman",
"input": {
"number": 3
},
"expected": "III"
},
{
"description": "4, being 5 - 1, is IV",
"property": "roman",
"input": {
"number": 4
},
"expected": "IV"
},
{
"description": "5 is a single V",
"property": "roman",
"input": {
"number": 5
},
"expected": "V"
},
{
"description": "6, being 5 + 1, is VI",
"property": "roman",
"input": {
"number": 6
},
"expected": "VI"
},
{
"description": "9, being 10 - 1, is IX",
"property": "roman",
"input": {
"number": 9
},
"expected": "IX"
},
{
"description": "20 is two X's",
"property": "roman",
"input": {
"number": 27
},
"expected": "XXVII"
},
{
"description": "48 is not 50 - 2 but rather 40 + 8",
"property": "roman",
"input": {
"number": 48
},
"expected": "XLVIII"
},
{
"description": "49 is not 40 + 5 + 4 but rather 50 - 10 + 10 - 1",
"property": "roman",
"input": {
"number": 49
},
"expected": "XLIX"
},
{
"description": "50 is a single L",
"property": "roman",
"input": {
"number": 59
},
"expected": "LIX"
},
{
"description": "90, being 100 - 10, is XC",
"property": "roman",
"input": {
"number": 93
},
"expected": "XCIII"
},
{
"description": "100 is a single C",
"property": "roman",
"input": {
"number": 141
},
"expected": "CXLI"
},
{
"description": "60, being 50 + 10, is LX",
"property": "roman",
"input": {
"number": 163
},
"expected": "CLXIII"
},
{
"description": "400, being 500 - 100, is CD",
"property": "roman",
"input": {
"number": 402
},
"expected": "CDII"
},
{
"description": "500 is a single D",
"property": "roman",
"input": {
"number": 575
},
"expected": "DLXXV"
},
{
"description": "900, being 1000 - 100, is CM",
"property": "roman",
"input": {
"number": 911
},
"expected": "CMXI"
},
{
"description": "1000 is a single M",
"property": "roman",
"input": {
"number": 1024
},
"expected": "MXXIV"
},
{
"description": "3000 is three M's",
"property": "roman",
"input": {
"number": 3000
},
"expected": "MMM"
}
]
}
| 19.318436 | 72 | 0.425969 |
ed1d4f4531ddb72fed0ee5a5c1be123a090ff73b | 444 | pm | Perl | auto-lib/Paws/SESv2/GetDedicatedIpResponse.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/SESv2/GetDedicatedIpResponse.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/SESv2/GetDedicatedIpResponse.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 87 | 2015-04-22T06:29:47.000Z | 2021-09-29T14:45:55.000Z |
package Paws::SESv2::GetDedicatedIpResponse;
use Moose;
has DedicatedIp => (is => 'ro', isa => 'Paws::SESv2::DedicatedIp');
has _request_id => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::SESv2::GetDedicatedIpResponse
=head1 ATTRIBUTES
=head2 DedicatedIp => L<Paws::SESv2::DedicatedIp>
An object that contains information about a dedicated IP address.
=head2 _request_id => Str
=cut
| 15.857143 | 69 | 0.689189 |
ed2ca9849eae5685a90d3e6b3b3ae2f685c3857f | 422 | pm | Perl | auto-lib/Azure/Network/FlowLogInformation.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/Network/FlowLogInformation.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/Network/FlowLogInformation.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| 1 | 2021-04-08T15:26:39.000Z | 2021-04-08T15:26:39.000Z | package Azure::Network::FlowLogInformation;
use Moose;
has 'flowAnalyticsConfiguration' => (is => 'ro', isa => 'Azure::Network::TrafficAnalyticsProperties' );
has 'targetResourceId' => (is => 'ro', isa => 'Str' );
has 'enabled' => (is => 'ro', isa => 'Bool' );
has 'retentionPolicy' => (is => 'ro', isa => 'Azure::Network::RetentionPolicyParameters' );
has 'storageId' => (is => 'ro', isa => 'Str' );
1;
| 42.2 | 106 | 0.601896 |
ed468a29756a35cdf7bae276b3a6d30e1a44a3a8 | 1,980 | pm | Perl | auto-lib/Paws/Glue/UpdateXMLClassifierRequest.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/Glue/UpdateXMLClassifierRequest.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/Glue/UpdateXMLClassifierRequest.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::Glue::UpdateXMLClassifierRequest;
use Moose;
has Classification => (is => 'ro', isa => 'Str');
has Name => (is => 'ro', isa => 'Str', required => 1);
has RowTag => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Glue::UpdateXMLClassifierRequest
=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::Glue::UpdateXMLClassifierRequest object:
$service_obj->Method(Att1 => { Classification => $value, ..., RowTag => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::Glue::UpdateXMLClassifierRequest object:
$result = $service_obj->Method(...);
$result->Att1->Classification
=head1 DESCRIPTION
Specifies an XML classifier to be updated.
=head1 ATTRIBUTES
=head2 Classification => Str
An identifier of the data format that the classifier matches.
=head2 B<REQUIRED> Name => Str
The name of the classifier.
=head2 RowTag => Str
The XML tag designating the element that contains each record in an XML
document being parsed. This cannot identify a self-closing element
(closed by C</E<gt>>). An empty row element that contains only
attributes can be parsed as long as it ends with a closing tag (for
example, C<E<lt>row item_a="A" item_b="B"E<gt>E<lt>/rowE<gt>> is okay,
but C<E<lt>row item_a="A" item_b="B" /E<gt>> is not).
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::Glue>
=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.052632 | 109 | 0.724747 |
ed418b84fc1d0b6575a3565d2147132db1a40c3f | 930 | t | Perl | perl/t/comp/multiline.t | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
]
| 46 | 2015-12-04T17:12:58.000Z | 2022-03-11T04:30:49.000Z | perl/t/comp/multiline.t | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
]
| null | null | null | perl/t/comp/multiline.t | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
]
| 23 | 2016-10-24T09:18:14.000Z | 2022-02-25T02:11:35.000Z | #!./perl
# $RCSfile: multiline.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:20 $
print "1..5\n";
open(try,'>Comp.try') || (die "Can't open temp file.");
$x = 'now is the time
for all good men
to come to.
!
';
$y = 'now is the time' . "\n" .
'for all good men' . "\n" .
'to come to.' . "\n\n\n!\n\n";
if ($x eq $y) {print "ok 1\n";} else {print "not ok 1\n";}
print try $x;
close try;
open(try,'Comp.try') || (die "Can't reopen temp file.");
$count = 0;
$z = '';
while (<try>) {
$z .= $_;
$count = $count + 1;
}
if ($z eq $y) {print "ok 2\n";} else {print "not ok 2\n";}
if ($count == 7) {print "ok 3\n";} else {print "not ok 3\n";}
$_ = ($^O eq 'MSWin32') ? `type Comp.try` : `cat Comp.try`;
if (/.*\n.*\n.*\n$/) {print "ok 4\n";} else {print "not ok 4\n";}
close(try) || (die "Can't close temp file.");
unlink 'Comp.try' || `/bin/rm -f Comp.try`;
if ($_ eq $y) {print "ok 5\n";} else {print "not ok 5\n";}
| 19.787234 | 69 | 0.522581 |
ed0bd36ede631ceeee5da733f24df1c40d8edf97 | 5,573 | pm | Perl | lib/NTPPool/Control/Scores.pm | aleksandar-pap/ntppool | 7a7dbc4ef8bca95cad606281677bb9185beb5459 | [
"Apache-2.0"
]
| null | null | null | lib/NTPPool/Control/Scores.pm | aleksandar-pap/ntppool | 7a7dbc4ef8bca95cad606281677bb9185beb5459 | [
"Apache-2.0"
]
| null | null | null | lib/NTPPool/Control/Scores.pm | aleksandar-pap/ntppool | 7a7dbc4ef8bca95cad606281677bb9185beb5459 | [
"Apache-2.0"
]
| null | null | null | package NTPPool::Control::Scores;
use strict;
use base qw(NTPPool::Control);
use Combust::Constant qw(OK DECLINED);
use NP::Model;
use List::Util qw(min);
use JSON qw(encode_json);
sub render {
my $self = shift;
my $public = $self->site->name eq 'ntppool' ? 1 : 0;
$self->cache_control('s-maxage=1200,max-age=600') if $public;
unless ($public or $self->user) {
$self->redirect($self->www_url($self->request->uri, $self->request->query_parameters));
}
if (!$public) {
$self->tpl_param('manage_site', 1);
}
return $self->redirect('/scores/') if ($self->request->uri =~ m!^/s/?$!);
if ($self->request->uri =~ m!^/s/([^/]+)!) {
my $server = NP::Model->server->find_server($1) or return 404;
$self->cache_control('max-age=14400, s-maxage=7200');
return $self->redirect('/scores/' . $server->ip, 301);
}
if (my ($id, $mode) = ($self->request->uri =~ m!^/scores/graph/(\d+)-(score|offset).png!)) {
my $server = NP::Model->server->find_server($id) or return 404;
$self->cache_control('max-age=14400, s-maxage=7200');
return $self->redirect($server->graph_uri($mode), 301);
}
if (my $ip = ($self->req_param('ip') || $self->req_param('server_ip'))) {
my $server = NP::Model->server->find_server($ip) or return 404;
return $self->redirect('/scores/' . $server->ip) if $server;
}
if (my ($p, $mode) = $self->request->uri =~ m!^/scores/([^/]+)(?:/(\w+))?!) {
$mode ||= '';
if ($p) {
my ($server) = NP::Model->server->find_server($p);
return 404 unless $server;
return $self->redirect('/scores/' . $server->ip, 301) unless $p eq $server->ip;
if ($mode eq 'monitors') {
$self->cache_control('s-maxage=480,max-age=240') if $public;
return OK, encode_json({monitors => $self->_monitors($server)}),
'application/json';
}
if ($mode eq 'log' or $self->req_param('log') or $mode eq 'json') {
my $limit = $self->req_param('limit') || 0;
$limit = 50 unless $limit and $limit !~ m/\D/;
$limit = 4000 if $limit > 4000;
my $since = $self->req_param('since');
$since = 0 if defined $since and $since =~ m/\D/;
my $options = {
count => $limit,
since => $since,
monitor_id => $self->req_param('monitor'),
};
if ($since) {
$self->cache_control('s-maxage=300');
}
if ($mode eq 'json') {
#local ($Rose::DB::Object::Debug, $Rose::DB::Object::Manager::Debug) = (1, 1);
# This logic should probably just be in the server
# model, similar to log_scores_csv.
$self->request->header_out('Access-Control-Allow-Origin' => '*');
my $history = $server->history($options);
$history = [
map {
my $h = $_;
my %h = ();
my @fields = qw(offset step score monitor_id);
@h{@fields} = map { my $v = $h->$_; defined $v ? $v + 0 : $v } @fields;
$h{ts} = $h->ts->epoch;
\%h;
} @$history
];
unless (defined $options->{since}) {
$history = [ reverse @$history ];
}
if (@$history && $history->[-1]->{ts} < time - 86400) {
$self->cache_control('maxage=28800')
}
return OK,
encode_json(
{ history => $history,
monitors => $self->_monitors($server),
server => {ip => $server->ip}
}
),
'application/json';
}
else {
return OK, $server->log_scores_csv($options), 'text/plain';
}
}
elsif ($mode eq 'rrd') {
return 404;
}
elsif ($mode eq 'graph') {
my ($type) = ($self->request->uri =~ m{/(offset|score)\.png$});
return $self->redirect($server->graph_uri($type), 301);
}
elsif ($mode eq '') {
$self->tpl_param('graph_explanation' => 1) if $self->req_param('graph_explanation');
$self->tpl_param('server' => $server);
}
else {
return $self->redirect('/scores/' . $server->ip);
}
}
}
if ($self->req_param('graph_only')) {
return OK, $self->evaluate_template('tpl/server_static_graph.html');
}
return OK, $self->evaluate_template('tpl/server.html');
}
sub _monitors {
my ($self, $server) = @_;
my $monitors = $server->server_scores;
$monitors = [
map {
my %m = (
id => $_->monitor->id + 0,
score => $_->score + 0,
name => $_->monitor->name,
);
\%m;
} @$monitors
];
return $monitors;
}
sub bc_user_class { NP::Model->user }
sub bc_info_required {'username,email'}
1;
| 35.050314 | 100 | 0.442849 |
ed3a99dde731ba6d8ebca776bb5d09868b0b3125 | 405 | pl | Perl | json/test-xs.pl | poland-can-into-space/benchmarks | 009dc158a2cd0d64ee1eda3c99ae53e5e879eda0 | [
"MIT"
]
| 2 | 2020-01-09T02:44:27.000Z | 2022-03-12T01:35:44.000Z | json/test-xs.pl | poland-can-into-space/benchmarks | 009dc158a2cd0d64ee1eda3c99ae53e5e879eda0 | [
"MIT"
]
| null | null | null | json/test-xs.pl | poland-can-into-space/benchmarks | 009dc158a2cd0d64ee1eda3c99ae53e5e879eda0 | [
"MIT"
]
| 3 | 2015-12-18T06:59:16.000Z | 2020-03-19T06:49:25.000Z | use strict;
use warnings;
use File::Slurper 'read_binary';
use Cpanel::JSON::XS 'decode_json';
my $jobj = decode_json read_binary '1.json';
my $coordinates = $jobj->{coordinates};
my $len = @$coordinates;
my $x = my $y = my $z = 0;
foreach my $coord (@$coordinates) {
$x += $coord->{x};
$y += $coord->{y};
$z += $coord->{z};
}
print $x / $len, "\n";
print $y / $len, "\n";
print $z / $len, "\n";
| 20.25 | 44 | 0.577778 |
ed477a1027cb98945f4cea30c81d4f13aab92c24 | 2,103 | pl | Perl | gbank_gpept_gis/genpept_to_gi_roster.pl | SchwarzEM/ems_perl | 0c20b1fe1d215689ee8db3677b23175bd968841f | [
"BSD-3-Clause"
]
| 2 | 2021-07-19T09:00:17.000Z | 2021-08-30T02:45:18.000Z | gbank_gpept_gis/genpept_to_gi_roster.pl | Superboy666/ems_perl | ce78eb5c2120566e6e55a786ebd15382cb38736f | [
"BSD-3-Clause"
]
| null | null | null | gbank_gpept_gis/genpept_to_gi_roster.pl | Superboy666/ems_perl | ce78eb5c2120566e6e55a786ebd15382cb38736f | [
"BSD-3-Clause"
]
| 1 | 2021-07-19T09:00:18.000Z | 2021-07-19T09:00:18.000Z | #!/usr/bin/perl -w
# Program: genpept_to_gi_roster.pl
# Erich Schwarz, 9/2/99
#
# Purpose: Starting with a batch GenPept file from batch
# Entrez, produce a clean list with one line for each
# gi number, and with the following on each line:
#
# gi no.; gene name; product name; species
#
# This has two uses:
#
# In its own right it makes nice summary data from
# a batch-Entrez output.
# The *.gi_roster file produced here can be fed into
# another script to make tailored FASTA files with
# optimized (from my perspective) headers.
# 1. If not given a genpept file as argument, ask for its name.
if ($#ARGV != 0) {
print "Required: input GenPept file!\n";
print "What will input file be? ";
$infile = <STDIN>;
} else {
$infile = $ARGV[0];
}
chomp ($infile);
$outfile = ($infile . ".gi_roster");
print "The input file is $infile; the output file $outfile\n";
# 2. Open the genpept and future .tfa files or die.
open (INFILE, "$infile") || die "GenPept file $infile not found\n";
open (OUTFILE, ">$outfile") || die "Couldn't open file $outname\n";
# 3. Extract everything I want in a format which is of real use.
while (<INFILE>)
{
if ($_ =~ /^PID[^0-9]*([0-9]+)$/)
{
$aa_read_toggle = 0;
$gi_number = $_;
chomp($gi_number);
$gi_number =~ s/[^0-9]//g;
$species = "no_species_name";
$gene_name = "no_gene_name";
$product_name = "no_product_name";
}
elsif ($_ =~ /ORGANISM[\s]+[.]*/)
{
$species = $_;
chomp($species);
$species =~ s/ORGANISM[\s]+//g;
}
elsif ($_ =~ /gene=/)
{
$gene_name = $_;
chomp($gene_name);
$gene_name =~ s/[\W]*gene=//;
$gene_name =~ s/\"//g;
}
elsif ($_ =~ /product=/)
{
$product_name = $_;
chomp($product_name);
$product_name =~ s/[\W]*product=//;
$product_name =~ s/\"//g;
}
elsif ($_ =~ /ORIGIN/)
{
print OUTFILE ($gi_number . " " . $gene_name . " " . $product_name . " ");
print OUTFILE ("gi|" . $gi_number . " " . $species . "\n");
$aa_read_toggle = 1;
}
}
| 26.620253 | 93 | 0.577271 |
73dde0270edd06ef2a84d1f6490eeef0009f926c | 577 | pl | Perl | slic3r/win/lib/unicore/lib/Nv/300.pl | pschou/py-sdf | 0a269ed155d026e29429d76666fb63c95d2b4b2c | [
"MIT"
]
| null | null | null | slic3r/win/lib/unicore/lib/Nv/300.pl | pschou/py-sdf | 0a269ed155d026e29429d76666fb63c95d2b4b2c | [
"MIT"
]
| null | null | null | slic3r/win/lib/unicore/lib/Nv/300.pl | pschou/py-sdf | 0a269ed155d026e29429d76666fb63c95d2b4b2c | [
"MIT"
]
| null | null | null | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by ..\lib\unicore\mktables from the Unicode
# database, Version 8.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';
V10
65819
65820
65899
65900
66293
66294
68052
68053
69236
69237
END
| 23.08 | 78 | 0.667244 |
ed39ab3229ae89434fce9ad3da882809d69aaa48 | 2,353 | al | Perl | Apps/NA/EnvestnetYodleeBankFeeds/app/src/COD1267.al | bjarkihall/ALAppExtensions | d8243d27e0280dec6e079ab9f1e838f9768c208c | [
"MIT"
]
| 1 | 2021-08-16T18:14:49.000Z | 2021-08-16T18:14:49.000Z | Apps/NA/EnvestnetYodleeBankFeeds/app/src/COD1267.al | bjarkihall/ALAppExtensions | d8243d27e0280dec6e079ab9f1e838f9768c208c | [
"MIT"
]
| null | null | null | Apps/NA/EnvestnetYodleeBankFeeds/app/src/COD1267.al | bjarkihall/ALAppExtensions | d8243d27e0280dec6e079ab9f1e838f9768c208c | [
"MIT"
]
| 1 | 2021-02-09T10:23:09.000Z | 2021-02-09T10:23:09.000Z | Codeunit 1267 "Password Helper"
{
procedure GeneratePassword(Length: Integer): Text;
var
DotNet_Regex: Codeunit DotNet_Regex;
PasswordHandler: Codeunit "Password Handler";
Result: Text;
begin
DotNet_Regex.Regex('[\[\]\{\}\(\)\+\-&%\.\^;,:\|=\\\/\?''"`\~><_]');
Result := DotNet_Regex.Replace(PasswordHandler.GeneratePassword(Length), '');
while WeakYodleePassword(Result) do
Result := DotNet_Regex.Replace(PasswordHandler.GeneratePassword(Length), '');
exit(Result);
end;
procedure WeakYodleePassword(Password: Text): Boolean
var
PasswordChars: List of [Text];
CurrentChar: Char;
ReferenceChar: Char;
i: Integer;
CurrentSequenceLength: Integer;
Length: Integer;
begin
if Password = DelChr(Password, '=', '!@#$*') then
exit(true);
if Password = DelChr(Password, '=', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890') then
exit(true);
Length := StrLen(Password);
for i := 1 to Length do begin
CurrentChar := Password[i];
if CurrentChar = ReferenceChar then
CurrentSequenceLength += 1
else begin
ReferenceChar := CurrentChar;
CurrentSequenceLength := 1
end;
if CurrentSequenceLength = 3 then
exit(true);
end;
CurrentSequenceLength := 0;
ReferenceChar := 0;
for i := 1 to Length do begin
CurrentChar := Password[i];
if CurrentChar - ReferenceChar = 1 then
CurrentSequenceLength += 1
else
CurrentSequenceLength := 1;
ReferenceChar := CurrentChar;
if CurrentSequenceLength = 3 then
exit(true);
end;
CurrentSequenceLength := 0;
ReferenceChar := 0;
for i := 1 to Length do begin
CurrentChar := Password[i];
if ReferenceChar - CurrentChar = 1 then
CurrentSequenceLength += 1
else
CurrentSequenceLength := 1;
ReferenceChar := CurrentChar;
if CurrentSequenceLength = 3 then
exit(true);
end;
exit(false);
end;
}
| 29.4125 | 114 | 0.548661 |
73e35ea275c4bb92a5777373b95410e3e55ba919 | 551 | pl | Perl | examples/cards.pl | jdhedden/Math-Random-MT-Auto | 9b65481a7b4fd350e6b950289d3bb688d981b14d | [
"Unlicense"
]
| null | null | null | examples/cards.pl | jdhedden/Math-Random-MT-Auto | 9b65481a7b4fd350e6b950289d3bb688d981b14d | [
"Unlicense"
]
| null | null | null | examples/cards.pl | jdhedden/Math-Random-MT-Auto | 9b65481a7b4fd350e6b950289d3bb688d981b14d | [
"Unlicense"
]
| null | null | null | #!/usr/bin/perl
use strict;
use warnings;
$| = 1;
use Math::Random::MT::Auto qw(shuffle);
MAIN:
{
my $deck = shuffle(0..51);
my @cards = qw(A 1 2 3 4 5 6 7 8 9 10 J Q K);
my @suits = qw(C D H S);
print('My hand: ');
for my $card (0 .. 4) {
print($cards[$$deck[$card] % 13], '-', $suits[$$deck[$card] / 13], ' ');
}
print("\n\n");
print('Your hand: ');
for my $card (5 .. 9) {
print($cards[$$deck[$card] % 13], '-', $suits[$$deck[$card] / 13], ' ');
}
print("\n");
}
exit(0);
# EOF
| 17.21875 | 81 | 0.459165 |
ed3ad0eec6ae1ee0ccc1845d2d38de33d130ed4b | 5,220 | pl | Perl | build/External/Android/lib-build/SDL_mixer2.0.1/jni/SDL2/src/dynapi/gendynapi.pl | perezite/o2-blocks | c021f9eaddfefe619d3e41508c0fbdb81a95c276 | [
"MIT"
]
| null | null | null | build/External/Android/lib-build/SDL_mixer2.0.1/jni/SDL2/src/dynapi/gendynapi.pl | perezite/o2-blocks | c021f9eaddfefe619d3e41508c0fbdb81a95c276 | [
"MIT"
]
| null | null | null | build/External/Android/lib-build/SDL_mixer2.0.1/jni/SDL2/src/dynapi/gendynapi.pl | perezite/o2-blocks | c021f9eaddfefe619d3e41508c0fbdb81a95c276 | [
"MIT"
]
| 1 | 2020-06-04T10:55:32.000Z | 2020-06-04T10:55:32.000Z | #!/usr/bin/perl -w
# Simple DirectMedia Layer
# Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
# WHAT IS THIS?
# When you add a public API to SDL, please run this script, make sure the
# output looks sane (hg diff, it adds to existing files), and commit it.
# It keeps the dynamic API jump table operating correctly.
# If you wanted this to be readable, you shouldn't have used perl.
use warnings;
use strict;
use File::Basename;
chdir(dirname(__FILE__) . '/../..');
my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h";
my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h";
my %existing = ();
if (-f $sdl_dynapi_procs_h) {
open(SDL_DYNAPI_PROCS_H, '<', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
while (<SDL_DYNAPI_PROCS_H>) {
if (/\ASDL_DYNAPI_PROC\(.*?,(.*?),/) {
$existing{$1} = 1;
}
}
close(SDL_DYNAPI_PROCS_H)
}
open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
while (readdir(HEADERS)) {
next if not /\.h\Z/;
my $header = "include/$_";
open(HEADER, '<', $header) or die("Can't open $header: $!\n");
while (<HEADER>) {
chomp;
next if not /\A\s*extern\s+DECLSPEC/;
my $decl = "$_ ";
if (not $decl =~ /\)\s*;/) {
while (<HEADER>) {
chomp;
s/\A\s+//;
s/\s+\Z//;
$decl .= "$_ ";
last if /\)\s*;/;
}
}
$decl =~ s/\s+\Z//;
#print("DECL: [$decl]\n");
if ($decl =~ /\A\s*extern\s+DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) {
my $rc = "$1$2$3$4";
my $fn = $5;
next if $existing{$fn}; # already slotted into the jump table.
my @params = split(',', $6);
#print("rc == '$rc', fn == '$fn', params == '$params'\n");
my $retstr = ($rc eq 'void') ? '' : 'return';
my $paramstr = '(';
my $argstr = '(';
my $i = 0;
foreach (@params) {
my $str = $_;
$str =~ s/\A\s+//;
$str =~ s/\s+\Z//;
#print("1PARAM: $str\n");
if ($str eq 'void') {
$paramstr .= 'void';
} elsif ($str eq '...') {
if ($i > 0) {
$paramstr .= ', ';
}
$paramstr .= $str;
} elsif ($str =~ /\A\s*((const\s+|)(unsigned\s+|)([a-zA-Z0-9_]*)\s*([\*\s]*))\s*(.*?)\Z/) {
#print("PARSED: [$1], [$2], [$3], [$4], [$5]\n");
my $type = $1;
my $var = $6;
$type =~ s/\A\s+//;
$type =~ s/\s+\Z//;
$var =~ s/\A\s+//;
$var =~ s/\s+\Z//;
$type =~ s/\s*\*\Z/*/g;
$type =~ s/\s*(\*+)\Z/ $1/;
#print("SPLIT: ($type, $var)\n");
my $name = chr(ord('a') + $i);
if ($i > 0) {
$paramstr .= ', ';
$argstr .= ',';
}
my $spc = ($type =~ /\*\Z/) ? '' : ' ';
$paramstr .= "$type$spc$name";
$argstr .= "$name";
}
$i++;
}
$paramstr = '(void' if ($i == 0); # Just to make this consistent.
$paramstr .= ')';
$argstr .= ')';
print("NEW: $decl\n");
print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n";
print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n";
} else {
print("Failed to parse decl [$decl]!\n");
}
}
close(HEADER);
}
closedir(HEADERS);
close(SDL_DYNAPI_PROCS_H);
close(SDL_DYNAPI_OVERRIDES_H);
# vi: set ts=4 sw=4 expandtab:
| 36.760563 | 121 | 0.472605 |
73d9f15fc7b93602a68333736c971066df6b31ca | 13,013 | pm | Perl | lib/Cfn/Resource/AWS/DataPipeline/Pipeline.pm | torrentalle/cfn-perl | f5fd3b9e16bbdf6bf3d7e7d6850dfe0f16888aaf | [
"Apache-2.0"
]
| null | null | null | lib/Cfn/Resource/AWS/DataPipeline/Pipeline.pm | torrentalle/cfn-perl | f5fd3b9e16bbdf6bf3d7e7d6850dfe0f16888aaf | [
"Apache-2.0"
]
| null | null | null | lib/Cfn/Resource/AWS/DataPipeline/Pipeline.pm | torrentalle/cfn-perl | f5fd3b9e16bbdf6bf3d7e7d6850dfe0f16888aaf | [
"Apache-2.0"
]
| null | null | null | # AWS::DataPipeline::Pipeline generated from spec 14.3.0
use Moose::Util::TypeConstraints;
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline',
from 'HashRef',
via { Cfn::Resource::Properties::AWS::DataPipeline::Pipeline->new( %$_ ) };
package Cfn::Resource::AWS::DataPipeline::Pipeline {
use Moose;
extends 'Cfn::Resource';
has Properties => (isa => 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline', is => 'rw', coerce => 1);
sub AttributeList {
[ ]
}
sub supported_regions {
[ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-southeast-1','ap-southeast-2','ca-central-1','cn-north-1','cn-northwest-1','eu-central-1','eu-north-1','eu-south-1','eu-west-1','eu-west-2','eu-west-3','me-south-1','sa-east-1','us-east-1','us-east-2','us-gov-east-1','us-gov-west-1','us-west-1','us-west-2' ]
}
}
subtype 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttribute',
as 'Cfn::Value',
where { $_->isa('Cfn::Value::Array') or $_->isa('Cfn::Value::Function') },
message { "$_ is not a Cfn::Value or a Cfn::Value::Function" };
coerce 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttribute',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
die 'Only accepts functions';
}
},
from 'ArrayRef',
via {
Cfn::Value::Array->new(Value => [
map {
Moose::Util::TypeConstraints::find_type_constraint('Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttribute')->coerce($_)
} @$_
]);
};
subtype 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttribute',
as 'Cfn::Value';
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttribute',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
return Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttributeValue->new( %$_ );
}
};
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttributeValue {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Value::TypedValue';
has Key => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has StringValue => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
subtype 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::Field',
as 'Cfn::Value',
where { $_->isa('Cfn::Value::Array') or $_->isa('Cfn::Value::Function') },
message { "$_ is not a Cfn::Value or a Cfn::Value::Function" };
coerce 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::Field',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
die 'Only accepts functions';
}
},
from 'ArrayRef',
via {
Cfn::Value::Array->new(Value => [
map {
Moose::Util::TypeConstraints::find_type_constraint('Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::Field')->coerce($_)
} @$_
]);
};
subtype 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::Field',
as 'Cfn::Value';
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::Field',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
return Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::FieldValue->new( %$_ );
}
};
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::FieldValue {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Value::TypedValue';
has Key => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has RefValue => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has StringValue => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
subtype 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTag',
as 'Cfn::Value',
where { $_->isa('Cfn::Value::Array') or $_->isa('Cfn::Value::Function') },
message { "$_ is not a Cfn::Value or a Cfn::Value::Function" };
coerce 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTag',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
die 'Only accepts functions';
}
},
from 'ArrayRef',
via {
Cfn::Value::Array->new(Value => [
map {
Moose::Util::TypeConstraints::find_type_constraint('Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTag')->coerce($_)
} @$_
]);
};
subtype 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTag',
as 'Cfn::Value';
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTag',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
return Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTagValue->new( %$_ );
}
};
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTagValue {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Value::TypedValue';
has Key => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has Value => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
subtype 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObject',
as 'Cfn::Value',
where { $_->isa('Cfn::Value::Array') or $_->isa('Cfn::Value::Function') },
message { "$_ is not a Cfn::Value or a Cfn::Value::Function" };
coerce 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObject',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
die 'Only accepts functions';
}
},
from 'ArrayRef',
via {
Cfn::Value::Array->new(Value => [
map {
Moose::Util::TypeConstraints::find_type_constraint('Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObject')->coerce($_)
} @$_
]);
};
subtype 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObject',
as 'Cfn::Value';
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObject',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
return Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObjectValue->new( %$_ );
}
};
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObjectValue {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Value::TypedValue';
has Fields => (isa => 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::Field', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has Id => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has Name => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
subtype 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValue',
as 'Cfn::Value',
where { $_->isa('Cfn::Value::Array') or $_->isa('Cfn::Value::Function') },
message { "$_ is not a Cfn::Value or a Cfn::Value::Function" };
coerce 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValue',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
die 'Only accepts functions';
}
},
from 'ArrayRef',
via {
Cfn::Value::Array->new(Value => [
map {
Moose::Util::TypeConstraints::find_type_constraint('Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValue')->coerce($_)
} @$_
]);
};
subtype 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValue',
as 'Cfn::Value';
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValue',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
return Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValueValue->new( %$_ );
}
};
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValueValue {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Value::TypedValue';
has Id => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has StringValue => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
subtype 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObject',
as 'Cfn::Value',
where { $_->isa('Cfn::Value::Array') or $_->isa('Cfn::Value::Function') },
message { "$_ is not a Cfn::Value or a Cfn::Value::Function" };
coerce 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObject',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
die 'Only accepts functions';
}
},
from 'ArrayRef',
via {
Cfn::Value::Array->new(Value => [
map {
Moose::Util::TypeConstraints::find_type_constraint('Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObject')->coerce($_)
} @$_
]);
};
subtype 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObject',
as 'Cfn::Value';
coerce 'Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObject',
from 'HashRef',
via {
if (my $f = Cfn::TypeLibrary::try_function($_)) {
return $f
} else {
return Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObjectValue->new( %$_ );
}
};
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObjectValue {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Value::TypedValue';
has Attributes => (isa => 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterAttribute', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has Id => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
package Cfn::Resource::Properties::AWS::DataPipeline::Pipeline {
use Moose;
use MooseX::StrictConstructor;
extends 'Cfn::Resource::Properties';
has Activate => (isa => 'Cfn::Value::Boolean', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has Description => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Immutable');
has Name => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Immutable');
has ParameterObjects => (isa => 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterObject', is => 'rw', coerce => 1, required => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has ParameterValues => (isa => 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::ParameterValue', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has PipelineObjects => (isa => 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineObject', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
has PipelineTags => (isa => 'ArrayOfCfn::Resource::Properties::AWS::DataPipeline::Pipeline::PipelineTag', is => 'rw', coerce => 1, traits => [ 'CfnMutability' ], mutability => 'Mutable');
}
1;
### main pod documentation begin ###
=encoding UTF-8
=head1 NAME
Cfn::Resource::AWS::DataPipeline::Pipeline - Cfn resource for AWS::DataPipeline::Pipeline
=head1 DESCRIPTION
This module implements a Perl module that represents the CloudFormation object AWS::DataPipeline::Pipeline.
See L<Cfn> for more information on how to use it.
=head1 AUTHOR
Jose Luis Martinez
CAPSiDE
jlmartinez@capside.com
=head1 COPYRIGHT and LICENSE
Copyright (c) 2013 by CAPSiDE
This code is distributed under the Apache 2 License. The full text of the
license can be found in the LICENSE file included with this module.
=cut
| 39.314199 | 357 | 0.638823 |
ed07d50987762f4e879d555e6ff07be2953d3b12 | 2,030 | pm | Perl | misc-scripts/xref_mapping/Xref/Schema/Result/ChecksumXref.pm | sgiorgetti/ensembl | ff90d0812cc0e64cc55c74a759575db351c5217b | [
"Apache-2.0"
]
| 1 | 2021-09-27T11:01:06.000Z | 2021-09-27T11:01:06.000Z | misc-scripts/xref_mapping/Xref/Schema/Result/ChecksumXref.pm | sgiorgetti/ensembl | ff90d0812cc0e64cc55c74a759575db351c5217b | [
"Apache-2.0"
]
| 1 | 2021-09-23T13:46:54.000Z | 2021-09-23T13:46:54.000Z | misc-scripts/xref_mapping/Xref/Schema/Result/ChecksumXref.pm | sgiorgetti/ensembl | ff90d0812cc0e64cc55c74a759575db351c5217b | [
"Apache-2.0"
]
| null | null | null | =head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2022] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
package Xref::Schema::Result::ChecksumXref;
=head1 NAME
Xref::Schema::Result::ChecksumXref
=cut
use strict;
use warnings;
use utf8;
use base 'DBIx::Class::Core';
=head1 TABLE: C<checksum_xref>
=cut
__PACKAGE__->table("checksum_xref");
=head1 ACCESSORS
=head2 checksum_xref_id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 source_id
data_type: 'integer'
extra: {unsigned => 1}
is_nullable: 0
=head2 accession
data_type: 'char'
is_nullable: 0
size: 14
=head2 checksum
data_type: 'char'
is_nullable: 0
size: 32
=cut
__PACKAGE__->add_columns(
"checksum_xref_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"source_id",
{ data_type => "integer", extra => { unsigned => 1 }, is_nullable => 0 },
"accession",
{ data_type => "char", is_nullable => 0, size => 14 },
"checksum",
{ data_type => "char", is_nullable => 0, size => 32 },
);
=head1 PRIMARY KEY
=over 4
=item * L</checksum_xref_id>
=back
=cut
__PACKAGE__->set_primary_key("checksum_xref_id");
__PACKAGE__->has_one('xref', 'Xref::Schema::Result::Xref', { 'foreign.xref_id' => 'self.checksum_xref_id' });
__PACKAGE__->has_one('source', 'Xref::Schema::Result::Source', 'source_id' );
1;
| 20.09901 | 109 | 0.70936 |
ed18d964580a86866d3e6d958d4b96aeb025564f | 26,201 | pl | Perl | postfixadmin/VIRTUAL_VACATION/vacation.pl | harishjadhav26/mail_server | 7da53c914d6c24a141a5268e59c766c3dbe939f9 | [
"Unlicense"
]
| 1 | 2021-12-30T12:01:33.000Z | 2021-12-30T12:01:33.000Z | postfixadmin/VIRTUAL_VACATION/vacation.pl | harishjadhav26/mail_server | 7da53c914d6c24a141a5268e59c766c3dbe939f9 | [
"Unlicense"
]
| null | null | null | postfixadmin/VIRTUAL_VACATION/vacation.pl | harishjadhav26/mail_server | 7da53c914d6c24a141a5268e59c766c3dbe939f9 | [
"Unlicense"
]
| 3 | 2021-08-24T18:43:11.000Z | 2022-01-03T07:44:01.000Z | #!/usr/bin/perl
#
# Virtual Vacation 4.2
#
# See Contributions.txt for a list of contributions.
# https://github.com/postfixadmin/postfixadmin/blob/master/VIRTUAL_VACATION/Contributions.txt
# See INSTALL.txt for help installing (and lists of dependent packages etc)
# https://github.com/postfixadmin/postfixadmin/blob/master/VIRTUAL_VACATION/INSTALL.md
#
# Note: When you use this module, you may start seeing error messages
# like "Cannot insert a duplicate key into unique index
# vacation_notification_pkey" in your system logs. This is expected
# behavior, and not an indication of trouble (see the "already_notified"
# subroutine for an explanation).
#
use utf8;
use DBI;
use Encode qw(decode);
use MIME::EncWords qw(:all);
use Email::Valid;
use strict;
use Getopt::Std;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP;
use Email::Simple;
use Email::Simple::Creator;
use Try::Tiny;
use Log::Log4perl qw(get_logger :levels);
use File::Basename;
use Net::DNS;
# ========== begin configuration ==========
# IMPORTANT: If you put passwords into this script, then remember
# to restrict access to the script, so that only the vacation user
# can read it.
# db_type - uncomment one of these
our $db_type = 'Pg';
#our $db_type = 'mysql';
# leave empty for connection via UNIX socket
our $db_host = '';
# connection details
our $db_username = 'user';
our $db_password = 'password';
our $db_name = 'postfix';
our $vacation_domain = 'autoreply.example.org';
our $recipient_delimiter = '+';
# port to connect to; defaults to 25 for non-SSL, 465 for 'ssl', 587 for 'starttls'
our $smtp_server_port = 25;
# this is the helo we [the vacation script] use on connection; you may need to change this to your hostname or something,
# depending upon what smtp helo restrictions you have in place within Postfix.
our $smtp_client = 'localhost';
# send mail encrypted or plaintext
# if 'starttls', use STARTTLS; if 'ssl' (or 1), connect securely; otherwise, no security
our $smtp_ssl = 'starttls';
# maximum time in secs to wait for server; default is 120
our $smtp_timeout = '120';
# sasl_username: the username to use for auth; optional
our $smtp_authid = '';
# sasl_password: the password to use for auth; required if username is provided
our $smtp_authpwd = '';
# This specifies the mail 'from' name which is shown to recipients of vacation replies.
# If you leave it empty, the vacation mail will contain:
# From: <original@recipient.domain>
# If you specify something here you'd instead see something like :
# From: Some Friendly Name <original@recipient.domain>
our $friendly_from = '';
# Set to 1 to enable logging to syslog.
our $syslog = 0;
# path to logfile, when empty logging is suppressed
# change to e.g. /dev/null if you want nothing logged.
# if we can't write to this, and $log_to_file is 1 (below) the script will abort.
our $logfile='/var/log/vacation.log';
# 2 = debug + info, 1 = info only, 0 = error only
our $log_level = 2;
# Whether to log to file or not, 0 = do not write to a log file
our $log_to_file = 0;
# notification interval, in seconds
# set to 0 to notify only once
# e.g. 1 day ...
#our $interval = 60*60*24;
# disabled by default
our $interval = 0;
# Send vacation mails to do-not-reply email addresses.
# By default vacation email addresses will be sent.
# For now emails from bounce|do-not-reply|facebook|linkedin|list-|myspace|twitter won't
# be answered when $custom_noreply_pattern is set to 1.
# default = 0
our $custom_noreply_pattern = 0;
our $noreply_pattern = 'bounce|do-not-reply|facebook|linkedin|list-|myspace|twitter';
# Never send vacation mails for the following recipient email addresses.
# Useful for e.g. aliases pointing to multiple recipients which have vacation active
# hence an email to the alias should not trigger vacation messages.
# By default vacation email addresses will be sent for all recipients.
# default = ''
# preventing vacation notifications for recipient info@example.org would look like this:
# our $no_vacation_pattern = 'info\@example\.org';
our $no_vacation_pattern = 'info\@example\.org';
# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/vacation.conf
# or /etc/postfixadmin/vacation.conf just use Perl syntax there to fill the variables listed above
# (without the "our" keyword). Example:
# $db_username = 'mail';
if (-f '/etc/mail/postfixadmin/vacation.conf') {
require '/etc/mail/postfixadmin/vacation.conf';
} elsif (-f '/etc/postfixadmin/vacation.conf') {
require '/etc/postfixadmin/vacation.conf';
} elsif (-f './vacation.conf') {
require './vacation.conf';
}
# =========== end configuration ===========
if($log_to_file == 1) {
if (( ! -w $logfile ) && (! -w dirname($logfile))) {
# Cannot log; no where to write to.
die("Cannot create logfile : $logfile");
}
}
my ($from, $to, $cc, $replyto , $subject, $messageid, $lastheader, $smtp_sender, $smtp_recipient, %opts, $test_mode, $logger);
$subject='';
$messageid='unknown';
# Setup a logger...
#
getopts('f:t:', \%opts) or die "Usage: $0 [-t yes] -f sender -- recipient\n\t-t for testing only\n";
$opts{f} and $smtp_sender = $opts{f} or die '-f sender not present on command line';
$test_mode = 0;
$opts{t} and $test_mode = 1;
$smtp_recipient = shift or die 'recipient not given on command line';
my $log_layout = Log::Log4perl::Layout::PatternLayout->new('%d %p> %F:%L %M - %m%n');
if($test_mode == 1) {
$logger = get_logger();
# log to stdout
my $appender = Log::Log4perl::Appender->new('Log::Dispatch::Screen');
$appender->layout($log_layout);
$logger->add_appender($appender);
$logger->debug('Test mode enabled');
} else {
$logger = get_logger();
if($log_to_file == 1) {
# log to file
my $appender = Log::Log4perl::Appender->new(
'Log::Dispatch::File',
filename => $logfile,
mode => 'append');
$appender->layout($log_layout);
$logger->add_appender($appender);
}
if($syslog == 1) {
my $syslog_appender = Log::Log4perl::Appender->new(
'Log::Dispatch::Syslog',
facility => 'mail',
ident => 'vacation',
);
$logger->add_appender($syslog_appender);
}
}
# change to $DEBUG, $INFO or $ERROR depending on how much logging you want.
$logger->level($ERROR);
if($log_level == 1) {
$logger->level($INFO);
}
if($log_level == 2) {
$logger->level($DEBUG);
}
binmode (STDIN,':encoding(UTF-8)');
my $dbh;
if ($db_host) {
$dbh = DBI->connect("DBI:$db_type:dbname=$db_name;host=$db_host","$db_username", "$db_password", { RaiseError => 1 });
} else {
$dbh = DBI->connect("DBI:$db_type:dbname=$db_name","$db_username", "$db_password", { RaiseError => 1 });
}
if (!$dbh) {
$logger->error('Could not connect to database'); # eval { } etc better here?
exit(0);
}
my $db_true; # MySQL and PgSQL use different values for TRUE, and unicode support...
if ($db_type eq 'mysql') {
$dbh->do('SET CHARACTER SET utf8;');
$db_true = '1';
} else { # Pg
$dbh->do("SET CLIENT_ENCODING TO 'UTF8'");
$dbh->{pg_enable_utf8} = 1;
$db_true = 'True';
}
# used to detect infinite address lookup loops
my $loopcount=0;
#
# Get interval_time for email user from the vacation table
#
sub get_interval {
my ($to) = @_;
my $query = qq{SELECT interval_time FROM vacation WHERE email=? };
my $stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($to) or panic_execute($query," 'email='$to'");
my $rv = $stm->rows;
if ($rv == 1) {
my @row = $stm->fetchrow_array;
my $interval = $row[0] ;
return $interval ;
} else {
return 0 ;
}
}
sub already_notified {
my ($to, $from) = @_;
my $logger = get_logger();
my $query;
# delete old notifications
if ($db_type eq 'Pg') {
$query = qq{DELETE FROM vacation_notification USING vacation WHERE vacation.email = vacation_notification.on_vacation AND on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom;};
} else { # mysql
$query = qq{DELETE vacation_notification.* FROM vacation_notification LEFT JOIN vacation ON vacation.email = vacation_notification.on_vacation WHERE on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom};
}
my $stm = $dbh->prepare($query);
if (!$stm) {
$logger->error("Could not prepare query (trying to delete old vacation notifications) :'$query' to: $to, from:$from");
return 1;
}
$stm->execute($to,$from);
$query = qq{INSERT into vacation_notification (on_vacation,notified) values (?,?)};
$stm = $dbh->prepare($query);
if (!$stm) {
$logger->error("Could not prepare query '$query' to: $to, from:$from");
return 1;
}
$stm->{'PrintError'} = 0;
$stm->{'RaiseError'} = 0;
if (!$stm->execute($to,$from)) {
my $e=$dbh->errstr;
# Violation of a primary key constraint may happen here, and that's
# fine. All other error conditions are not fine, however.
if ($e !~ /(?:_pkey|^Duplicate entry)/) {
$logger->error("Failed to insert into vacation_notification table (to:$to from:$from error:'$e' query:'$query')");
# Let's play safe and notify anyway
return 1;
}
$interval = get_interval($to);
if ($interval) {
if ($db_type eq 'Pg') {
$query = qq{SELECT extract( epoch from (NOW()-notified_at))::int FROM vacation_notification WHERE on_vacation=? AND notified=?};
} else { # mysql
$query = qq{SELECT UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(notified_at) FROM vacation_notification WHERE on_vacation=? AND notified=?};
}
$stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($to,$from) or panic_execute($query,"on_vacation='$to', notified='$from'");
my @row = $stm->fetchrow_array;
my $int = $row[0];
if ($int > $interval) {
$logger->info("[Interval elapsed, sending the message]: From: $from To:$to");
$query = qq{UPDATE vacation_notification SET notified_at=NOW() WHERE on_vacation=? AND notified=?};
$stm = $dbh->prepare($query);
if (!$stm) {
$logger->error("Could not prepare query '$query' (to: '$to', from: '$from')");
return 0;
}
if (!$stm->execute($to,$from)) {
$e=$dbh->errstr;
$logger->error("Error from running query '$query' (to: '$to', from: '$from', error: '$e')");
}
return 0;
} else {
$logger->debug("Notification interval not elapsed; not sending vacation reply (to: '$to', from: '$from')");
return 1;
}
} else {
return 1;
}
}
return 0;
}
#
# Check to see if there is a vacation record against a specific email address.
#
sub check_for_vacation {
my ($email_to_check) =@_;
my $query = qq{SELECT email FROM vacation WHERE email=? and active=$db_true and activefrom <= NOW() and activeuntil >= NOW()};
my $stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($email_to_check) or panic_execute($query,"email='$email_to_check'");
my $rv = $stm->rows;
return $rv;
}
# try and determine if email address has vacation turned on; we
# have to do alias searching, and domain aliasing resolution for this.
# If found, return ($num_matches, $real_email);
sub find_real_address {
my ($email) = @_;
my $logger = get_logger();
if (++$loopcount > 20) {
$logger->error("find_real_address loop! (more than 20 attempts!) currently: $email");
exit(1);
}
my $realemail = '';
my $rv = check_for_vacation($email);
# Recipient has vacation
if ($rv == 1) {
$realemail = $email;
$logger->debug("Found '$email' has vacation active");
} else {
my $vemail = $email;
$vemail =~ s/\@/#/g;
$vemail = $vemail . "\@" . $vacation_domain;
$logger->debug("Looking for alias records that '$email' resolves to with vacation turned on");
my $query = qq{SELECT goto FROM alias WHERE address=? AND (goto LIKE ? OR goto LIKE ? OR goto LIKE ? OR goto = ?)};
my $stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($email,"$vemail,%","%,$vemail","%,$vemail,%", "$vemail") or panic_execute($query,"address='$email'");
$rv = $stm->rows;
# Recipient is an alias, check if mailbox has vacation
if ($rv == 1) {
my @row = $stm->fetchrow_array;
my $alias = $row[0];
if ($alias =~ /,/) {
for (split(/\s*,\s*/, lc($alias))) {
my $singlealias = $_;
$logger->debug("Found alias \'$singlealias\' for email \'$email\'. Looking if vacation is on for alias.");
$rv = check_for_vacation($singlealias);
# Alias has vacation
if ($rv == 1) {
$realemail = $singlealias;
last;
}
}
} else {
$rv = check_for_vacation($alias);
# Alias has vacation
if ($rv == 1) {
$realemail = $alias;
}
}
# We have to look for alias domain (domain1 -> domain2)
} else {
my ($user, $domain) = split(/@/, $email);
$logger->debug("Looking for alias domain for $domain / $email / $user");
$query = qq{SELECT target_domain FROM alias_domain WHERE alias_domain=?};
$stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($domain) or panic_execute($query,"alias_domain='$domain'");
$rv = $stm->rows;
# The domain has a alias domain level alias
if ($rv == 1) {
my @row = $stm->fetchrow_array;
my $alias_domain_dest = $row[0];
($rv, $realemail) = find_real_address ("$user\@$alias_domain_dest");
# We still have to look for domain level aliases...
} else {
my ($user, $domain) = split(/@/, $email);
$logger->debug("Looking for domain level aliases for $domain / $email / $user");
$query = qq{SELECT goto FROM alias WHERE address=?};
$stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute("\@$domain") or panic_execute($query,"address='\@$domain'");
$rv = $stm->rows;
# The recipient has a domain level alias
if ($rv == 1) {
my @row = $stm->fetchrow_array;
my $wildcard_dest = $row[0];
my ($wilduser, $wilddomain) = split(/@/, $wildcard_dest);
# Check domain alias
if ($wilduser) {
($rv, $realemail) = find_real_address ($wildcard_dest);
} else {
($rv, $realemail) = find_real_address ("$user\@$wilddomain");
}
} else {
$logger->debug("No domain level alias present for $domain / $email / $user");
}
}
}
}
return ($rv, $realemail);
}
# sends the vacation mail to the original sender.
#
sub send_vacation_email {
my ($email, $orig_from, $orig_to, $orig_messageid, $orig_subject, $test_mode) = @_;
my $logger = get_logger();
$logger->debug("Asked to send vacation reply to $email thanks to $orig_messageid");
my $query = qq{SELECT subject,body FROM vacation WHERE email=?};
my $stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($email) or panic_execute($query,"email='$email'");
my $rv = $stm->rows;
if ($rv == 1) {
my @row = $stm->fetchrow_array;
if (already_notified($email, $orig_from) == 1) {
$logger->debug("Already notified $orig_from, or some error prevented us from doing so");
return;
}
$logger->debug("Will send vacation response for $orig_messageid: FROM: $email (orig_to: $orig_to), TO: $orig_from; VACATION SUBJECT: $row[0] ; VACATION BODY: $row[1]");
my $subject = $row[0];
$subject = Encode::decode_utf8( $subject ) if( !Encode::is_utf8( $subject ) );
$orig_subject = decode("mime-header", $orig_subject);
$subject =~ s/\$SUBJECT/$orig_subject/g;
if ($subject ne $row[0]) {
$logger->debug("Patched Subject of vacation message to: $subject");
}
my $body = $row[1];
$body = Encode::decode_utf8( $body ) if( !Encode::is_utf8( $body ) );
my $from = $email;
my $to = $orig_from;
# part of the username in the email && part of the domain in the email
my ($email_username_part, $email_domain_part) = split(/@/, $email);
my $resolver = Net::DNS::Resolver->new;
my @mx = mx($resolver, $email_domain_part);
my $smtp_server;
if (@mx) {
$smtp_server = @mx[0]->exchange;
$logger->debug("Found MX record <$smtp_server> for user <$email>!");
} else {
$logger->error("Unable to find MX record for user <$email>, error message: ".$resolver->errorstring);
exit(0);
}
my $smtp_params = {
host => $smtp_server,
port => $smtp_server_port,
ssl_options => {
SSL_verifycn_name => $smtp_server
},
ssl => $smtp_ssl,
timeout => $smtp_timeout,
localaddr => $smtp_client,
debug => 0,
};
if($smtp_authid ne ''){
$smtp_params->{sasl_username}=$smtp_authid;
$smtp_params->{sasl_password}=$smtp_authpwd;
$logger->info("Doing SASL Authentication with user $smtp_params->{sasl_username}\n");
};
my $transport = Email::Sender::Transport::SMTP->new($smtp_params);
$subject = Encode::encode_utf8( $subject ) if( Encode::is_utf8( $subject ) );
$body = Encode::encode_utf8( $body ) if( Encode::is_utf8( $body ) );
$email = Email::Simple->create(
header => [
To => $to,
From => $from,
Subject => encode_mimewords($subject, 'Charset', 'UTF-8'),
Precedence => 'junk',
'Content-Type' => "text/plain; charset=utf-8",
'X-Loop' => 'Postfix Admin Virtual Vacation',
],
body => $body,
);
if($test_mode == 1) {
$logger->info("** TEST MODE ** : Vacation response sent to $to from $from subject $subject (not) sent\n");
$logger->info($email);
return 0;
}
try {
sendmail($email, { transport => $transport });
} finally {
if (@_) {
$logger->error("Failed to send vacation response to $to from $from subject $subject: @_");
} else {
$logger->debug("Vacation response sent to $to from $from subject $subject sent\n");
}
}
}
}
# Convert a (list of) email address(es) from RFC 822 style addressing to
# RFC 821 style addressing. e.g. convert:
# "John Jones" <JJones@acme.com>, "Jane Doe/Sales/ACME" <JDoe@acme.com>
# to:
# jjones@acme.com, jdoe@acme.com
sub strip_address {
my ($arg) = @_;
if(!$arg) {
return '';
}
my @ok;
$logger = get_logger();
my @list;
@list = $arg =~ m/([\w\.\-\+\'\=_\^\|\$\/\{\}~\?\*\\&\!`\%]+\@[\w\.\-]+\w+)/g;
foreach(@list) {
#$logger->debug("Checking: $_");
my $temp = Email::Valid->address( -address => $_, -mxcheck => 0);
if($temp) {
push(@ok, $temp);
} else {
$logger->debug("Email not valid : $Email::Valid::Details");
}
}
# remove duplicates
my %seen = ();
my @uniq;
foreach my $item (@ok) {
push(@uniq, $item) unless $seen{$item}++
}
my $result = lc(join(', ', @uniq));
#$logger->debug("Result: $result");
return $result;
}
sub panic_prepare {
my ($arg) = @_;
my $logger = get_logger();
$logger->error("Could not prepare sql statement: '$arg'");
exit(0);
}
sub panic_execute {
my ($arg,$param) = @_;
my $logger = get_logger();
$logger->error("Could not execute sql statement - '$arg' with parameters '$param'");
exit(0);
}
# Make sure the email wasn't sent by someone who could be a mailing list etc; if it was,
# then we abort after appropriate logging.
sub check_and_clean_from_address {
my ($address) = @_;
my $logger = get_logger();
if($address =~ /^(noreply|postmaster|mailer\-daemon|listserv|majordomo|owner\-|request\-|bounces\-)/i ||
$address =~ /\-(owner|request|bounces)\@/i ||
($custom_noreply_pattern == 1 && $address =~ /^.*($noreply_pattern).*/i) ) {
$logger->debug("sender $address contains $1 - will not send vacation message");
exit(0);
}
$address = strip_address($address);
if($address eq '') {
$logger->error("Address $address is not valid; exiting");
exit(0);
}
#$logger->debug("Address cleaned up to $address");
return $address;
}
########################### main #################################
# Take headers apart
$cc = '';
$replyto = '';
$logger->debug("Script argument SMTP recipient is : '$smtp_recipient' and smtp_sender : '$smtp_sender'");
while (<STDIN>) {
last if (/^$/);
if (/^\s+(.*)/ and $lastheader) { $$lastheader .= " $1"; next; }
elsif (/^from:\s*(.*)\n$/i) { $from = $1; $lastheader = \$from; }
elsif (/^to:\s*(.*)\n$/i) { $to = $1; $lastheader = \$to; }
elsif (/^cc:\s*(.*)\n$/i) { $cc = $1; $lastheader = \$cc; }
elsif (/^Reply\-to:\s*(.*)\s*\n$/i) { $replyto = $1; $lastheader = \$replyto; }
elsif (/^subject:\s*(.*)\n$/i) { $subject = $1; $lastheader = \$subject; }
elsif (/^message\-id:\s*(.*)\s*\n$/i) { $messageid = $1; $lastheader = \$messageid; }
elsif (/^x\-spam\-(flag|status):\s+yes/i) { $logger->debug("x-spam-$1: yes found; exiting"); exit (0); }
elsif (/^x\-facebook\-notify:/i) { $logger->debug('Mail from facebook, ignoring'); exit(0); }
elsif (/^precedence:\s+(bulk|list|junk)/i) { $logger->debug("precedence: $1 found; exiting"); exit (0); }
elsif (/^x\-loop:\s+postfix\ admin\ virtual\ vacation/i) { $logger->debug('x-loop: postfix admin virtual vacation found; exiting'); exit (0); }
elsif (/^Auto\-Submitted:\s*no/i) { next; }
elsif (/^Auto\-Submitted:/i) { $logger->debug('Auto-Submitted: something found; exiting'); exit (0); }
elsif (/^List\-(Id|Post|Unsubscribe):/i) { $logger->debug("List-$1: found; exiting"); exit (0); }
elsif (/^(x\-(barracuda\-)?spam\-status):\s+(yes)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); }
elsif (/^(x\-dspam\-result):\s+(spam|bl[ao]cklisted)/i) { $logger->debug("$1: $2 found; exiting"); exit (0); }
elsif (/^(x\-(anti|avas\-)?virus\-status):\s+(infected)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); }
elsif (/^(x\-(avas\-spam|spamtest|crm114|razor|pyzor)\-status):\s+(spam)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); }
elsif (/^(x\-osbf\-lua\-score):\s+[0-9\/\.\-\+]+\s+\[([-S])\]/i) { $logger->debug("$1: $2 found; exiting"); exit (0); }
elsif (/^x\-autogenerated:\s*reply/i) { $logger->debug('x-autogenerated found; exiting'); exit (0); }
elsif (/^x\-auto\-response\-suppress:\s*oof/i) { $logger->debug('x-auto-response-suppress: oof found; exiting'); exit (0); }
else {$lastheader = '' ; }
}
if($smtp_recipient =~ /\@$vacation_domain/) {
# the regexp used here could probably be improved somewhat, for now hope that people won't use # as a valid mailbox character.
my $tmp = $smtp_recipient;
$tmp =~ s/\@$vacation_domain//;
$tmp =~ s/#/\@/;
if ($recipient_delimiter) {
$tmp =~ s/[\Q$recipient_delimiter\E].+$//;
}
$logger->debug("Converted autoreply mailbox back to normal style - from $smtp_recipient to $tmp");
$smtp_recipient = $tmp;
undef $tmp;
}
# If either From: or To: are not set, exit
if(!$from || !$to || !$messageid || !$smtp_sender || !$smtp_recipient) {
$logger->info("One of from=$from, to=$to, messageid=$messageid, smtp sender=$smtp_sender, smtp recipient=$smtp_recipient empty");
exit(0);
}
$logger->debug("Email headers have to: '$to' and From: '$from'");
if ($to =~ /^.*($no_vacation_pattern).*/i) {
$logger->debug("Will not send vacation reply for messages to $to");
exit(0);
}
$to = strip_address($to);
$cc = strip_address($cc);
$from = check_and_clean_from_address($from);
if($replyto ne '') {
# if reply-to is invalid, or looks like a mailing list, then we probably don't want to send a reply.
$replyto = check_and_clean_from_address($replyto);
}
$smtp_sender = check_and_clean_from_address($smtp_sender);
$smtp_recipient = check_and_clean_from_address($smtp_recipient);
if ($smtp_sender eq $smtp_recipient) {
$logger->debug("smtp sender $smtp_sender and recipient $smtp_recipient are the same; aborting");
exit(0);
}
for (split(/,\s*/, lc($to)), split(/,\s*/, lc($cc))) {
my $header_recipient = strip_address($_);
if ($smtp_sender eq $header_recipient) {
$logger->debug("sender header $smtp_sender contains recipient $header_recipient (mailing myself?)");
exit(0);
}
}
my ($rv, $email) = find_real_address($smtp_recipient);
if ($rv == 1) {
$logger->debug("Attempting to send vacation response for: $messageid to: $smtp_sender, $smtp_recipient, $email (test_mode = $test_mode)");
send_vacation_email($email, $smtp_sender, $smtp_recipient, $messageid, $subject, $test_mode);
} else {
$logger->debug("SMTP recipient $smtp_recipient which resolves to $email does not have an active vacation (rv: $rv, email: $email)");
}
0;
#/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
| 38.305556 | 229 | 0.592573 |
73e67f9c9e905be1c71c15c26954ffb782b9910a | 7,367 | t | Perl | applications/lemuridae/src/lemu2/Lemu.g.t | rewriting/tom | 2918e95c78006f08a2a0919ef440413fa5c2342a | [
"BSD-3-Clause"
]
| 36 | 2016-02-19T12:09:49.000Z | 2022-02-03T13:13:21.000Z | applications/lemuridae/src/lemu2/Lemu.g.t | rewriting/tom | 2918e95c78006f08a2a0919ef440413fa5c2342a | [
"BSD-3-Clause"
]
| null | null | null | applications/lemuridae/src/lemu2/Lemu.g.t | rewriting/tom | 2918e95c78006f08a2a0919ef440413fa5c2342a | [
"BSD-3-Clause"
]
| 6 | 2017-11-30T17:07:10.000Z | 2022-03-12T14:46:21.000Z |
grammar Lemu;
@header {
package lemu2;
import lemu2.kernel.proofterms.types.*;
}
@members {
%include { kernel/proofterms/proofterms.tom }
private RawTermList append(RawTermList l, RawTerm t) {
%match(l) {
EmptyRawtermList() -> { return `ConsRawtermList(t,EmptyRawtermList()); }
ConsRawtermList(x,xs) -> { return `ConsRawtermList(x,append(xs,t)); }
}
throw new RuntimeException("non exhaustive patterns");
}
private RawTermRewriteRules append(RawTermRewriteRules l, RawTermRewriteRule t) {
%match(l) {
EmptyRawtermrrules() -> { return `ConsRawtermrrules(t,EmptyRawtermrrules()); }
ConsRawtermrrules(x,xs) -> { return `ConsRawtermrrules(x,append(xs,t)); }
}
throw new RuntimeException("non exhaustive patterns");
}
private RawPropRewriteRules append(RawPropRewriteRules l, RawPropRewriteRule t) {
%match(l) {
EmptyRawproprrules() -> { return `ConsRawproprrules(t,EmptyRawproprrules()); }
ConsRawproprrules(x,xs) -> { return `ConsRawproprrules(x,append(xs,t)); }
}
throw new RuntimeException("non exhaustive patterns");
}
private RawFoBound append(RawFoBound l, String v) {
%match(l) {
EmptyRawfoBound() -> { return `ConsRawfoBound(v,EmptyRawfoBound()); }
ConsRawfoBound(x,xs) -> { return `ConsRawfoBound(x,append(xs,v)); }
}
throw new RuntimeException("non exhaustive patterns");
}
}
@lexer::header {
package lemu2;
}
/* terms and patterns */
term_list returns [RawTermList res]
: t=term { $res=`RawtermList(t); } (COMMA t=term { $res = append($res,t); })*
;
term returns [RawTerm res]
: LPAR t=term RPAR { $res = t; }
| f=funappl { $res = f; }
| ID { $res = `Rawvar($ID.text); }
;
funappl returns [RawTerm res]
: ID LPAR l=term_list RPAR { $res = `RawfunApp($ID.text,l); }
| ID LPAR RPAR { $res = `RawfunApp($ID.text,RawtermList()); }
;
/* propositions */
prop returns [RawProp res]
: FORALL ID COMMA p=iprop { $res = `Rawforall(RawFa($ID.text,p)); }
| EXISTS ID COMMA p=iprop { $res = `Rawexists(RawEx($ID.text,p)); }
| p=iprop { $res = p; }
;
iprop returns [RawProp res]
: p=orprop { $res = p; } (IMPL p=iprop { $res = `Rawimplies($res,p); })?;
orprop returns [RawProp res]
: p=andprop { $res = p; } (OR p=andprop { $res = `Rawor($res,p); })*;
andprop returns [RawProp res]
: p=atom { $res = p; } (AND p=atom { $res = `Rawand($res,p); })*;
atom returns [RawProp res]
: LPAR p=prop RPAR { $res = p; }
| p=appl { $res = p; }
| BOTTOM { $res = `Rawbottom(); }
| TOP { $res = `Rawtop(); }
;
appl returns [RawProp res]
: UID LPAR l=term_list RPAR { $res = `RawrelApp($UID.text,l); }
| UID { $res = `RawrelApp($UID.text,RawtermList()); }
;
/* rewrite rules */
boundlist returns [RawFoBound res]
: '[' ']' { $res=`RawfoBound(); }
| '[' v=ID { $res=`RawfoBound($v.text); } (',' v=ID { $res=append($res,$v.text); })* ']'
;
termrrule returns [RawTermRewriteRule res]
: n=ID ':' b=boundlist lhs=term ARROW rhs=term { $res = `Rawtermrrule($n.text,Rawtrule(b,lhs,rhs)); }
;
termrrules returns [RawTermRewriteRules res]
@init{
$res = `Rawtermrrules();
}
: (r=termrrule { $res = append($res,r); })*
;
proprrule returns [RawPropRewriteRule res]
: n=ID ':' b=boundlist lhs=prop ARROW rhs=prop { $res = `Rawproprrule($n.text,Rawprule(b,lhs,rhs)); }
;
proprrules returns [RawPropRewriteRules res]
@init{
$res = `Rawproprrules();
}
: (r=proprrule { $res = append($res,r); })*
;
/* proofterms */
proofterm returns [RawProofTerm res]
: ROOTR '(' '<' a=ID ':' pa=prop '>' m=proofterm ')'
{ $res = `RawrootR(RawRootRPrem1($a.text,pa,m)); }
| AX '(' x=ID ',' a=ID ')'
{ $res = `Rawax($x.text,$a.text); }
| TRUER '(' a=ID ')'
{ $res=`RawtrueR($a.text); }
| FALSEL '(' x=ID ')'
{ $res=`RawfalseL($x.text); }
| CUT '(' '<' a=ID ':' pa=prop '>' m=proofterm ','
'<' x=ID ':' px=prop '>' n=proofterm ')'
{ $res = `Rawcut(RawCutPrem1($a.text,pa,m),RawCutPrem2($x.text,px,n)); }
| IMPLYR '(' '<' x=ID ':' px=prop '>' '<' a=ID ':' pa=prop '>' m=proofterm ',' cn=ID')'
{ $res = `RawimplyR(RawImplyRPrem1($x.text,px,$a.text,pa,m),$cn.text); }
| IMPLYL '(' '<' x=ID ':' px=prop '>' m=proofterm ','
'<' a=ID ':' pa=prop '>' n=proofterm ',' y=ID ')'
{ $res = `RawimplyL(RawImplyLPrem1($x.text,px,m),RawImplyLPrem2($a.text,pa,n),$y.text); }
| ANDR '(' '<' a=ID ':' pa=prop '>' m=proofterm ','
'<' b=ID ':' pb=prop '>' n=proofterm ',' c=ID ')'
{ $res = `RawandR(RawAndRPrem1($a.text,pa,m),RawAndRPrem2($b.text,pb,n),$c.text); }
| ANDL '(' '<' x=ID ':' px=prop '>' '<' y=ID ':' py=prop '>' m=proofterm ',' z=ID ')'
{ $res = `RawandL(RawAndLPrem1($x.text,px,$y.text,py,m),$z.text); }
| ORR '(' '<' a=ID ':' pa=prop '>' '<' b=ID ':' pb=prop '>' m=proofterm ',' c=ID ')'
{ $res = `RaworR(RawOrRPrem1($a.text,pa,$b.text,pb,m),$c.text); }
| ORL '(' '<' x=ID ':' px=prop '>' m=proofterm ','
'<' y=ID ':' py=prop '>' n=proofterm ',' z=ID ')'
{ $res = `RaworL(RawOrLPrem1($x.text,px,m),RawOrLPrem2($y.text,py,n),$z.text); }
| EXISTSR '(' '<' a=ID ':' pa=prop '>' m=proofterm ',' t=term ',' b=ID ')'
{ $res = `RawexistsR(RawExistsRPrem1($a.text,pa,m),t,$b.text); }
| EXISTSL '(' '<' x=ID ':' px=prop '>' '<' fx=ID '>' m=proofterm ',' y=ID ')'
{ $res = `RawexistsL(RawExistsLPrem1($x.text,px,$fx.text,m),$y.text); }
| FORALLR '(' '<' a=ID ':' pa=prop '>' '<' fx=ID '>' m=proofterm ',' b=ID ')'
{ $res = `RawforallR(RawForallRPrem1($a.text,pa,$fx.text,m),$b.text); }
| FORALLL '(' '<' x=ID ':' px=prop '>' m=proofterm ',' t=term ',' y=ID ')'
{ $res = `RawforallL(RawForallLPrem1($x.text,px,m),t,$y.text); }
| FOLDR '[' na=ID ']''(''<' a=ID ':' pa=prop '>' m=proofterm ',' b=ID ')'
{ $res = `RawfoldR($na.text,RawFoldRPrem1($a.text,pa,m),$b.text); }
| FOLDL '[' na=ID ']''(' '<' x=ID ':' px=prop '>' m=proofterm ',' y=ID ')'
{ $res = `RawfoldL($na.text,RawFoldLPrem1($x.text,px,m),$y.text); }
;
/* declarations */
termmodulo returns [RawTermRewriteRules res]
: TERM MODULO LBRACE l=termrrules RBRACE { $res=l; }
;
propmodulo returns [RawPropRewriteRules res]
: PROP MODULO LBRACE l=proprrules RBRACE { $res=l; }
;
propfold returns [RawPropRewriteRules res]
: PROP FOLD LBRACE l=proprrules RBRACE { $res=l; }
;
propsuper returns [RawPropRewriteRules res]
: PROP SUPER LBRACE l=proprrules RBRACE { $res=l; }
;
toplevel : proofterm EOF;
COMMENT : '(*' ( options {greedy=false;} : . )* '*)' {$channel=HIDDEN;} ;
WS : (' '|'\t'|'\n')+ { $channel=HIDDEN; } ;
/* colons, brackets, braces and parentheses */
DOT : '.';
LPAR : '(' ;
RPAR : ')' ;
LBR : '<';
RBR : '>';
COLON : ':';
LBRACE : '{';
RBRACE : '}';
LBRACKET : '[';
RBRACKET : ']';
/* other symbols */
ARROW : '->';
/* logical connectors */
FORALL : 'forall';
EXISTS : 'exists';
BOTTOM : 'False';
TOP : 'True';
IMPL : '=>';
OR : '\\/' ;
AND : '/\\';
COMMA : ',';
/* keywords */
TERM : 'term';
PROP : 'prop';
MODULO : 'modulo';
FOLD : 'fold';
SUPER : 'super';
/* proofterms */
AX : 'ax';
CUT : 'cut';
FALSEL : 'falseL';
TRUER : 'trueR';
ANDR : 'andR';
ANDL : 'andL';
ORR : 'orR';
ORL : 'orL';
IMPLYR : 'implyR';
IMPLYL : 'implyL';
EXISTSR : 'existsR';
EXISTSL : 'existsL';
FORALLR : 'forallR';
FORALLL : 'forallL';
ROOTL : 'rootL';
ROOTR : 'rootR';
FOLDL : 'foldL';
FOLDR : 'foldR';
/* identifiers */
ID : ('a'..'z')('a'..'z'|'A'..'Z'|'_'|'0'..'9')* ;
UID : ('A'..'Z')('a'..'z'|'A'..'Z'|'_'|'0'..'9')* ;
| 29.947154 | 101 | 0.580969 |
73e533514c573819d4e9cda05d68d4d21b275b8e | 7,170 | pl | Perl | perl_openbsd/spore-seeder.pl | crypto4a/spore-seeder | 0a155358f932f274568bd075f343f8a95f802481 | [
"MIT"
]
| null | null | null | perl_openbsd/spore-seeder.pl | crypto4a/spore-seeder | 0a155358f932f274568bd075f343f8a95f802481 | [
"MIT"
]
| null | null | null | perl_openbsd/spore-seeder.pl | crypto4a/spore-seeder | 0a155358f932f274568bd075f343f8a95f802481 | [
"MIT"
]
| 1 | 2019-08-19T19:26:16.000Z | 2019-08-19T19:26:16.000Z | #!/usr/bin/perl
#
# MIT License
#
# Copyright (c) 2018-2019 Crypto4A Technologies Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
use strict;
use warnings;
use HTTP::Tiny;
use JSON::PP;
use MIME::Base64 qw(decode_base64url);
use Data::Dumper;
use Getopt::Long;
use FindBin;
use lib $FindBin::Bin;
use lib '../perl_common';
use SporeCommon;
my $SERVICE_CONFIG = "/etc/spore-seeder/spore-seeder-service.config";
#
# Contribute the entropy without increasing entropy estimate.
#
sub contribute_entropy {
my ($result, $entropy_string, $verbose) = @_;
if(defined $result->{'entropy'}) {
my $filename = '/dev/urandom';
if(not -w $filename) {
printf("Warning: $filename is not writable.\n");
printf("Warning: displaying (mixed) entropy for future use:\n");
printf("%s\n", $entropy_string);
exit 1;
} else {
if($verbose == 1) {
printf("Seeding entropy to /dev/urandom.\n");
}
open(FH, '>', $filename) or die $!;
print FH $entropy_string;
close FH;
}
}
}
sub add_entropy {
my ($result, $verbose) = @_;
if($verbose) {
printf("Mixing entropy from Spore server with local random.\n");
}
my $entropy_string = SporeCommon::mix_entropy($result->{'entropy'});
return contribute_entropy($result, $entropy_string, $verbose);
}
sub do_query {
my ($URL, $certChainURL, $info, $certchain, $service, $verbose, $validateSig, $autoSeed, $threshold) = @_;
my $certificateChain = "";
my @claims;
my $challenge;
my $window = 60;
my $time;
$challenge = sprintf("%08X", rand(0xffffffff));
$time = time();
my $result = SporeCommon::get_entropy($URL, $challenge);
if($result == 1) {
printf("Error: Failed to contact spore server: $URL\n");
exit 1;
}
#
# getInfo: no JSON web token claims to verify, no challenge or timestamp
#
if($info == 1) {
if($result->{'entropySize'} =~ /^\d+/) {
printf("%s:", $result->{'name'});
printf("%s:", $result->{'entropySize'});
printf("%s:", $result->{'signingMechanism'} // "");
printf("\n");
# exit as there are no claims to process
exit 0;
} else {
printf("Error: unable to process getInfo request.\n");
exit 1;
}
}
#
# getCertChain and getEntropy both have JSON web token claims
#
my $JWT = $result->{'JWT'} // "";
if($JWT) {
#
# $claims[0] = header
# $claims[1] = payload
# $claims[2] = signature
#
@claims = split(/\./, "$JWT");
}
#
# always validate signed responses
# if we don't yet have it, get the public key for signature validation
#
if(defined $result->{'certificateChain'}) {
$certificateChain = $result->{'certificateChain'};
} else {
my $pkchallenge = sprintf("%08X", rand(0xffffffff));
my $pkresult = SporeCommon::get_entropy($certChainURL, $pkchallenge);
$certificateChain = $pkresult->{'certificateChain'};
}
if($certchain == 1) {
if(defined $certificateChain) {
printf("%s", $certificateChain);
# do not exit; we may need to process web tokens
} else {
printf("Error: unable to process getCerChain request\n");
exit 1;
}
}
#
# check (unsigned) freshness of response as appropriate
#
if(defined $result->{'timestsamp'}) {
if(($result->{'timestamp'} - $time) > $window) {
printf("Error: stale response from server outside window.\n");
exit 1;
}
}
#
# check (unsigned) challenge in response as appropriate
#
if(defined $result->{'challenge'}) {
if($result->{'challenge'} ne $challenge) {
printf("Error: received challenge does not match request.\n");
exit 1;
}
}
if ($validateSig) {
if (!SporeCommon::validate_signature(\@claims, $verbose, $certificateChain)) {
printf("Error: signature verification failed.\n");
}
} elsif ($verbose) {
print "Skip signature validation.\n";
}
if (!SporeCommon::check_claims(\@claims, $result, $certificateChain, $challenge, $verbose)) {
if ($service) {
return;
}
exit 1;
}
add_entropy($result, $verbose);
}
#
# Spore server and URLs
#
my $sporeServer = "rootofqaos.com";
my $infoURL = "http://$sporeServer/eaasp/getInfo";
my $certChainURL = "http://$sporeServer/eaasp/getCertChain";
my $entropyURL = "http://$sporeServer/eaasp/getEntropy";
my $certchain = 0;
my $info = 0;
my $verbose = 0;
my $service = 0;
my $help = 0;
my $opt_url = '';
my $URL = "";
my $skip_sig_validate = 0;
SporeCommon::get_options(\$certchain, \$info, \$verbose, \$help,
\$service, \$opt_url, \$skip_sig_validate);
if ($certchain && $info) {
print "Error: --certificate (-c) and --info (-i) cannot be specified togother.\n";
SporeCommon::usage(1);
}
if ($certchain && $service) {
print "Error: --certificate (-c) and --service (-s) cannot be specified togother.\n";
SporeCommon::usage(1);
}
if ($info && $service) {
print "Error: --info (-i) and --service (-s) cannot be specified togother.\n";
SporeCommon::usage(1);
}
if ($opt_url) {
$infoURL = "http://$opt_url/eaasp/getInfo";
$certChainURL = "http://$opt_url/eaasp/getCertChain";
$entropyURL = "http://$opt_url/eaasp/getEntropy";
}
$URL = $entropyURL;
if ($info) {
$URL = $infoURL;
}
if ($certchain) {
$URL = $certChainURL;
}
if($verbose == 1) {
printf("Using Spore server: %s\n", $opt_url || $sporeServer);
}
if ($service) {
my %service_config = %{SporeCommon::parse_config($SERVICE_CONFIG)};
$verbose = SporeCommon::is_true($service_config{'verbose'});
if ($verbose) {
print "Service Config:\n";
print Dumper(%service_config);
}
my $pollInterval = 3; # Default 3 seconds.
if ($service_config{'pollInterval'}) {
$pollInterval = $service_config{'pollInterval'};
if ($verbose) {
print "spore-seeder service pollInterval: " . $pollInterval . "\n";
}
}
my $entropyURL = "http://$sporeServer/eaasp/getEntropy";
if ($service_config{'address'}) {
$entropyURL = "http://$service_config{'address'}/eaasp/getEntropy";
if ($verbose) {
print "spore-seeder service url: " . $entropyURL . "\n";
}
}
while (1) {
my $validateSig = SporeCommon::is_true($service_config{'verify'});
do_query($entropyURL, $certChainURL, $info, $certchain, $service, $verbose, $validateSig);
sleep($pollInterval);
}
} else {
do_query($URL, $certChainURL, $info, $certchain, $service, $verbose, !$skip_sig_validate);
}
| 26.853933 | 107 | 0.669596 |
ed27fd1b9c2cea192b3516d6a4d10a5d4be40911 | 5,390 | pm | Perl | lib/Perl/Critic/Policy/Modules/ProhibitConditionalUseStatements.pm | utgwkk/Perl-Critic | e88e1bce7f24527cb484ff459e68c80cf411408f | [
"Artistic-1.0"
]
| null | null | null | lib/Perl/Critic/Policy/Modules/ProhibitConditionalUseStatements.pm | utgwkk/Perl-Critic | e88e1bce7f24527cb484ff459e68c80cf411408f | [
"Artistic-1.0"
]
| null | null | null | lib/Perl/Critic/Policy/Modules/ProhibitConditionalUseStatements.pm | utgwkk/Perl-Critic | e88e1bce7f24527cb484ff459e68c80cf411408f | [
"Artistic-1.0"
]
| null | null | null | package Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements;
use 5.006001;
use strict;
use warnings;
use Readonly;
use Perl::Critic::Utils qw{ :booleans :severities };
use base 'Perl::Critic::Policy';
our $VERSION = '1.139_01';
#-----------------------------------------------------------------------------
Readonly::Scalar my $DESC => q{Conditional "use" statement};
Readonly::Scalar my $EXPL => q{Use "require" to conditionally include a module.};
# operators
Readonly::Hash my %OPS => map { $_ => 1 } qw( || && or and );
#-----------------------------------------------------------------------------
sub supported_parameters { return () }
sub default_severity { return $SEVERITY_MEDIUM }
sub default_themes { return qw( core bugs ) }
sub applies_to { return 'PPI::Statement::Include' }
#-----------------------------------------------------------------------------
sub violates {
my ( $self, $elem, $doc ) = @_;
return $self->violation( $DESC, $EXPL, $elem ) if $elem->type() eq 'use'
&& !$elem->pragma()
&& $elem->module()
&& $self->_is_in_conditional_logic($elem);
return;
}
#-----------------------------------------------------------------------------
# is this a non-string eval statement
sub _is_eval {
my ( $self, $elem ) = @_;
$elem->isa('PPI::Statement') or return;
my $first_elem = $elem->first_element();
return $TRUE if $first_elem->isa('PPI::Token::Word')
&& $first_elem eq 'eval';
return;
}
#-----------------------------------------------------------------------------
# is this in a conditional do block
sub _is_in_do_conditional_block {
my ( $self, $elem ) = @_;
return if !$elem->isa('PPI::Structure::Block');
my $prev_sibling = $elem->sprevious_sibling() or return;
if ($prev_sibling->isa('PPI::Token::Word') && $prev_sibling eq 'do') {
my $next_sibling = $elem->snext_sibling();
return $TRUE if $next_sibling
&& $next_sibling->isa('PPI::Token::Word');
$prev_sibling = $prev_sibling->sprevious_sibling() or return;
return $TRUE if $prev_sibling->isa('PPI::Token::Operator')
&& $OPS{$prev_sibling->content()};
}
return;
}
#-----------------------------------------------------------------------------
# is this a compound statement
sub _is_compound_statement {
my ( $self, $elem ) = @_;
return if !$elem->isa('PPI::Statement::Compound');
return $TRUE if $elem->type() ne 'continue'; # exclude bare blocks
return;
}
#-----------------------------------------------------------------------------
# is this contained in conditional logic
sub _is_in_conditional_logic {
my ( $self, $elem ) = @_;
while ($elem = $elem->parent()) {
last if $elem->isa('PPI::Document');
return $TRUE if $self->_is_compound_statement($elem)
|| $self->_is_eval($elem)
|| $self->_is_in_do_conditional_block($elem);
}
return;
}
1;
__END__
#-----------------------------------------------------------------------------
=pod
=for stopwords evals
=head1 NAME
Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements - Avoid putting conditional logic around compile-time includes.
=head1 AFFILIATION
This Policy is part of the core L<Perl::Critic|Perl::Critic>
distribution.
=head1 DESCRIPTION
Modules included via "use" are loaded at compile-time. Placing conditional
logic around the "use" statement has no effect on whether the module will be
loaded. Doing so can also serve to confuse the reader as to the author's
original intent.
If you need to conditionally load a module you should be using "require"
instead.
This policy will catch the following forms of conditional "use" statements:
# if-elsif-else
if ($a == 1) { use Module; }
if ($a == 1) { } elsif ($a == 2) { use Module; }
if ($a == 1) { } else { use Module; }
# for/foreach
for (1..$a) { use Module; }
foreach (@a) { use Module; }
# while
while ($a == 1) { use Module; }
# unless
unless ($a == 1) { use Module; }
# until
until ($a == 1) { use Module; }
# do-condition
do { use Module; } if $a == 1;
do { use Module; } while $a == 1;
do { use Module; } unless $a == 1;
do { use Module; } until $a == 1;
# operator-do
$a == 1 || do { use Module; };
$a == 1 && do { use Module; };
$a == 1 or do { use Module; };
$a == 1 and do { use Module; };
# non-string eval
eval { use Module; };
Including a module via "use" in bare blocks, standalone do blocks, or
string evals is allowed.
# bare block
{ use Module; }
# do
do { use Module; }
# string eval
eval "use Module";
=head1 CONFIGURATION
This Policy is not configurable except for the standard options.
=head1 AUTHOR
Peter Guzis <pguzis@cpan.org>
=head1 COPYRIGHT
Copyright (c) 2010-2011 Peter Guzis. All rights reserved.
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 :
| 26.421569 | 127 | 0.555844 |
73fe747b74441382ded1ba8c556a3c8d644534d5 | 1,427 | t | Perl | t/body_mod.t | apache/spamassassin | 6a28fdf568f16b39c049e45014e082a34a9e4be9 | [
"Apache-2.0"
]
| 196 | 2015-01-13T03:55:31.000Z | 2022-03-29T23:56:13.000Z | t/body_mod.t | apache/spamassassin | 6a28fdf568f16b39c049e45014e082a34a9e4be9 | [
"Apache-2.0"
]
| 2 | 2015-03-23T21:32:14.000Z | 2018-10-18T15:37:36.000Z | t/body_mod.t | apache/spamassassin | 6a28fdf568f16b39c049e45014e082a34a9e4be9 | [
"Apache-2.0"
]
| 77 | 2015-01-13T04:35:30.000Z | 2022-03-15T14:49:08.000Z | #!/usr/bin/perl -w -T
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("body_mod");
use Test::More tests => 3;
use Mail::SpamAssassin;
# ---------------------------------------------------------------------------
# initialize SpamAssassin
my $sa = create_saobj({'dont_copy_prefs' => 1});
$sa->init(0); # parse rules
open (IN, "<data/spam/006");
my $mail = $sa->parse(\*IN);
close IN;
my $msg = Mail::SpamAssassin::PerMsgStatus->new($sa, $mail);
my $decoded_pre = join ('||', @{$msg->get_decoded_body_text_array()});
my $stripped_pre = join ('||', @{$msg->get_decoded_stripped_body_text_array()});
$msg->check();
my $decoded_post = join ('||', @{$msg->get_decoded_body_text_array()});
my $stripped_post = join ('||', @{$msg->get_decoded_stripped_body_text_array()});
my $hits = join (' ', $msg->get_names_of_tests_hit());
print "hit rules: $hits\n";
ok ($hits ne '');
if ($decoded_pre eq $decoded_post) {
print "decoded: body renderings identical pre and post scan\n";
ok (1);
} else {
print "decoded: body renderings DIFFER pre and post scan\n";
print "decoded: pre=".$decoded_pre." post=".$decoded_post."\n\n";
ok (0);
}
if ($stripped_pre eq $stripped_post) {
print "stripped: body renderings identical pre and post scan\n";
ok (1);
} else {
print "stripped: body renderings DIFFER pre and post scan\n";
print "stripped: pre=".$stripped_pre." post=".$stripped_post."\n\n";
ok (0);
}
| 27.980392 | 81 | 0.623686 |
ed28452a579652646210b84800df8ec77de849e0 | 77,503 | pm | Perl | src/main/plugin/ContentAccessService.pm | ickStream/ickstream-client-lms | 63320f67c2bb7398c2a7a5029636384ca38d6f76 | [
"BSD-3-Clause"
]
| 2 | 2015-02-04T20:42:15.000Z | 2015-04-09T07:19:56.000Z | src/main/plugin/ContentAccessService.pm | ickStream/ickstream-client-lms | 63320f67c2bb7398c2a7a5029636384ca38d6f76 | [
"BSD-3-Clause"
]
| null | null | null | src/main/plugin/ContentAccessService.pm | ickStream/ickstream-client-lms | 63320f67c2bb7398c2a7a5029636384ca38d6f76 | [
"BSD-3-Clause"
]
| null | null | null | # Copyright (c) 2013, ickStream GmbH
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of ickStream nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL LOGITECH, INC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package Plugins::IckStreamPlugin::ContentAccessService;
use strict;
use warnings;
use File::Spec::Functions;
use Slim::Utils::Log;
use Slim::Utils::Prefs;
use Slim::Web::JSONRPC;
use HTTP::Status qw(RC_OK);
use JSON::XS::VersionOneAndTwo;
use Scalar::Util qw(blessed);
use Slim::Web::HTTP;
use HTTP::Status qw(RC_MOVED_TEMPORARILY RC_NOT_FOUND);
use Slim::Utils::Compress;
use POSIX qw(floor);
use Crypt::Tea;
use Slim::Utils::Strings qw(string);
use Plugins::IckStreamPlugin::JsonHandler;
my $log = logger('plugin.ickstream.content');
my $prefs = preferences('plugin.ickstream');
my $serverPrefs = preferences('server');
my $KEY = undef;
my $artistImages = undef;
# this array provides a function for each supported JSON method
my %methods = (
'getServiceInformation' => \&getServiceInformation,
'getProtocolVersions' => \&getProtocolVersions,
'getManagementProtocolDescription' => \&getManagementProtocolDescription,
'getProtocolDescription' => \&getProtocolDescription,
'getProtocolDescription2' => \&getProtocolDescription2,
'getPreferredMenus' => \&getPreferredMenus,
'findItems' => \&findItems,
'getNextDynamicPlaylistTracks' => \&getNextDynamicPlaylistTracks,
'getItem' => \&getItem,
);
sub init {
my $plugin = shift;
$KEY = Slim::Utils::PluginManager->dataForPlugin($plugin)->{'id'};
if($::VERSION ge '7.8') {
$artistImages = grep(/MusicArtistInfo/, Slim::Utils::PluginManager->enabledPlugins(undef));
}
}
sub getProtocolDescription {
my $context = shift;
my @contexts = ();
my $genreRequests = {
'type' => 'category',
'parameters' => [
['contextId','type']
],
};
my $artistRequests = {
'type' => 'artist',
'parameters' => [
['contextId','type'],
['contextId','type','categoryId']
],
};
my $albumRequests = {
'type' => 'album',
'parameters' => [
['contextId','type'],
['contextId','type','artistId'],
['contextId','type','categoryId'],
['contextId','type','categoryId','artistId'],
],
};
my $playlistRequests = {
'type' => 'playlist',
'parameters' => [
['contextId','type']
],
};
my $trackRequests = {
'type' => 'track',
'parameters' => [
['contextId','type','playlistId'],
['contextId','type','albumId'],
['contextId','type','artistId'],
['contextId','type','artistId','albumId']
]
};
my $myMusicContext = {
'contextId' => 'myMusic',
'name' => 'My Music',
'supportedRequests' => [
$genreRequests,
$artistRequests,
$playlistRequests,
$albumRequests,
$trackRequests
]
};
push @contexts,$myMusicContext;
my $folderRequests = {
'type' => 'menu',
'parameters' => [
['contextId','type'],
]
};
my $folderContentRequests = {
'parameters' => [
['contextId','menuId']
]
};
my $myMusicFolderContext = {
'contextId' => 'myMusicFolder',
'name' => 'Music Folder',
'supportedRequests' => [
$folderRequests,
$folderContentRequests
]
};
push @contexts,$myMusicFolderContext;
my $myMusicGenresContext = {
'contextId' => 'myMusicGenres',
'name' => 'Genres',
'supportedRequests' => [
$genreRequests
]
};
push @contexts,$myMusicGenresContext;
my $artistSearchRequests = {
'type' => 'artist',
'parameters' => [
['contextId','type','search'],
['contextId','type','categoryId']
]
};
my $playlistSearchRequests = {
'type' => 'playlist',
'parameters' => [
['contextId','type','search']
]
};
my $albumSearchRequests = {
'type' => 'album',
'parameters' => [
['contextId','type','search'],
['contextId','type','artistId'],
['contextId','type','categoryId'],
['contextId','type','categoryId','artistId']
]
};
my $trackSearchRequests = {
'type' => 'track',
'parameters' => [
['contextId','type','search'],
['contextId','type','albumId'],
['contextId','type','artistId'],
['contextId','type','artistId','albumId'],
['contextId','type','categoryId'],
['contextId','type','categoryId','artistId']
]
};
my $allMusicContext = {
'contextId' => 'allMusic',
'name' => 'All Music',
'supportedRequests' => [
$playlistSearchRequests,
$artistSearchRequests,
$albumSearchRequests,
$trackSearchRequests
]
};
push @contexts,$allMusicContext;
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "getProtocolDescription(" . Data::Dump::dump($reqParams) . ")" );
}
my $count = $reqParams->{'count'} if exists($reqParams->{'count'});
my $offset = $reqParams->{'offset'} || 0;
if(!defined($count)) {
$count = scalar(@contexts);
}
my @resultItems = ();
my $i = 0;
for my $context (@contexts) {
if($i>=$offset && scalar(@resultItems)<$count) {
push @resultItems,$context;
}
$i++;
}
my $result = {
'offset' => $offset,
'count' => scalar(@resultItems),
'countAll' => scalar(@contexts),
'items' => \@resultItems
};
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
}
sub getPreferredMenus {
my $context = shift;
my @contexts = ();
my $artistsMenu = {
'type' => 'browse',
'text' => 'Artists',
'menuType' => 'artists',
'childRequest' => {
'request' => 'myMusic:artists',
'childRequest' => {
'request' => 'myMusic:albumsByArtist',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
}
};
push @contexts,$artistsMenu;
my $composersMenu = {
'type' => 'browse',
'text' => 'Composers',
'menuType' => 'artists.composers',
'childRequest' => {
'request' => 'myMusic:artistsWithRoleComposer',
'childRequest' => {
'request' => 'myMusic:albumsByArtistWithRoleComposer',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbumByArtistWithRoleComposer'
}
}
}
};
push @contexts,$composersMenu;
my $conductorsMenu = {
'type' => 'browse',
'text' => 'Conductors',
'menuType' => 'artists.conductors',
'childRequest' => {
'request' => 'myMusic:artistsWithRoleConductor',
'childRequest' => {
'request' => 'myMusic:albumsByArtistWithRoleConductor',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbumByArtistWithRoleConductor'
}
}
}
};
push @contexts,$conductorsMenu;
my $albumsMenu = {
'type' => 'browse',
'text' => 'Albums',
'menuType' => 'albums',
'childRequest' => {
'request' => 'myMusic:albums',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
};
push @contexts,$albumsMenu;
my $genresMenu = {
'type' => 'browse',
'text' => 'Genres',
'menuType' => 'categories.genres',
'childRequest' => {
'request' => 'myMusic:categories',
'childRequest' => {
'request' => 'myMusic:artistsInCategory',
'childRequest' => {
'request' => 'myMusic:albumsInCategoryByArtist',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
}
}
};
push @contexts,$genresMenu;
my $playlistsMenu = {
'type' => 'browse',
'text' => 'Playlists',
'menuType' => 'playlists',
'childRequest' => {
'request' => 'myMusic:playlists',
'childRequest' => {
'request' => 'myMusic:tracksInPlaylist'
}
}
};
push @contexts,$playlistsMenu;
my $decadesMenu = {
'type' => 'browse',
'text' => 'Decades',
'menuType' => 'times.decades',
'childRequest' => {
'request' => 'myMusic:decades',
'childRequest' => {
'request' => 'myMusic:albumsFromDecade',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
}
};
push @contexts,$decadesMenu;
my $yearsMenu = {
'type' => 'browse',
'text' => 'Years',
'menuType' => 'times.years',
'childRequest' => {
'request' => 'myMusic:years',
'childRequest' => {
'request' => 'myMusic:albumsFromYear',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
}
};
push @contexts,$yearsMenu;
my $folderMenu = {
'type' => 'browse',
'text' => 'Music folders',
'menuType' => 'folders',
'childRequest' => {
'request' => 'myMusic:folders',
'childRequest' => {
'request' => 'myMusic:childItemsInMenu'
}
}
};
push @contexts,$folderMenu;
my $searchMenu = {
'type' => 'search',
'text' => 'Search',
'menuType' => 'search',
'childItems' => [
{
'type' => 'search',
'text' => 'Artists',
'menuType' => 'artists',
'childRequest' => {
'request' => 'allMusic:searchForArtists',
'childRequest' => {
'request' => 'myMusic:albumsByArtist',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
}
},
{
'type' => 'search',
'text' => 'Albums',
'menuType' => 'albums',
'childRequest' => {
'request' => 'allMusic:searchForAlbums',
'childRequest' => {
'request' => 'myMusic:tracksOnAlbum'
}
}
},
{
'type' => 'search',
'text' => 'Playlists',
'menuType' => 'playlists',
'childRequest' => {
'request' => 'allMusic:searchForPlaylists',
'childRequest' => {
'request' => 'myMusic:tracksInPlaylist'
}
}
},
{
'type' => 'search',
'text' => 'Tracks',
'menuType' => 'tracks',
'childRequest' => {
'request' => 'allMusic:searchForTracks'
}
},
]
};
push @contexts,$searchMenu;
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "getProtocolDescription(" . Data::Dump::dump($reqParams) . ")" );
}
my $count = $reqParams->{'count'} if exists($reqParams->{'count'});
my $offset = $reqParams->{'offset'} || 0;
if(!defined($count)) {
$count = scalar(@contexts);
}
my @resultItems = ();
my $i = 0;
for my $context (@contexts) {
if($i>=$offset && scalar(@resultItems)<$count) {
push @resultItems,$context;
}
$i++;
}
my $result = {
'offset' => $offset,
'count' => scalar(@resultItems),
'countAll' => scalar(@contexts),
'items' => \@resultItems
};
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
}
sub getProtocolDescription2 {
my $context = shift;
my @contexts = ();
my $myMusicContext = {
'contextId' => 'myMusic',
'name' => 'My Music',
'supportedRequests' => {
'artist' => {
'myMusic:artists' => {
'parameters' =>
['contextId','type']
},
'myMusic:artistsWithRoleComposer' => {
'values' => {
'roleId' => 'composer'
},
'parameters' =>
['contextId','type','roleId']
},
'myMusic:artistsWithRoleConductor' => {
'values' => {
'roleId' => 'conductor'
},
'parameters' =>
['contextId','type','roleId']
},
'myMusic:artistsInCategory' => {
'parameters' =>
['contextId','type','categoryId']
}
},
'album' => {
'myMusic:albums' => {
'parameters' =>
['contextId','type']
},
'myMusic:albumsByArtist' => {
'parameters' =>
['contextId','type','artistId']
},
'myMusic:albumsByArtistWithRoleComposer' => {
'values' => {
'roleId' => 'composer'
},
'parameters' =>
['contextId','type','artistId','roleId']
},
'myMusic:albumsByArtistWithRoleConductor' => {
'values' => {
'roleId' => 'conductor'
},
'parameters' =>
['contextId','type','artistId','roleId']
},
'myMusic:albumsInCategory' => {
'parameters' =>
['contextId','type','categoryId'],
},
'myMusic:albumsFromYear' => {
'parameters' =>
['contextId','type','yearId'],
},
'myMusic:albumsFromDecade' => {
'parameters' =>
['contextId','type','decadeId'],
},
'myMusic:albumsInCategoryByArtist' => {
'parameters' =>
['contextId','type','categoryId','artistId']
}
},
'playlist' => {
'myMusic:playlists' => {
'parameters' =>
['contextId','type']
}
},
'track' => {
'myMusic:tracksByArtist' => {
'parameters' =>
['contextId','type','artistId']
},
'myMusic:tracksInPlaylist' => {
'parameters' =>
['contextId','type','playlistId']
},
'myMusic:tracksOnAlbum' => {
'parameters' =>
['contextId','type','albumId']
},
'myMusic:tracksOnAlbumByArtistWithRoleComposer' => {
'values' => {
'roleId' => 'composer'
},
'parameters' =>
['contextId','type','albumId','artistId','roleId']
},
'myMusic:tracksOnAlbumByArtistWithRoleConductor' => {
'values' => {
'roleId' => 'conductor'
},
'parameters' =>
['contextId','type','albumId','artistId','roleId']
},
'myMusic:tracksOnAlbumByArtist' => {
'parameters' =>
['contextId','type','artistId','albumId']
}
},
'category' => {
'myMusic:categories' => {
'parameters' =>
['contextId','type']
}
},
'folder' => {
'myMusic:folders' => {
'parameters' =>
['contextId','type']
}
},
'year' => {
'myMusic:years' => {
'parameters' =>
['contextId','type']
}
},
'decade' => {
'myMusic:decades' => {
'parameters' =>
['contextId','type']
}
},
'none' => {
'myMusic:childItemsInMenu' => {
'parameters' =>
['contextId','folderId']
}
}
}
};
push @contexts,$myMusicContext;
my $allMusicContext = {
'contextId' => 'allMusic',
'name' => 'All Music',
'supportedRequests' => {
'artist' => {
'allMusic:searchForArtists' => {
'parameters' =>
['contextId','type','search']
}
},
'album' => {
'allMusic:searchForAlbums' => {
'parameters' =>
['contextId','type','search']
},
'allMusic:albumsByArtist' => {
'parameters' =>
['contextId','type','artistId']
},
},
'playlist' => {
'allMusic:searchForPlaylists' => {
'parameters' =>
['contextId','type','search']
}
},
'track' => {
'allMusic:searchForTracks' => {
'parameters' =>
['contextId','type','search']
},
'allMusic:tracksInPlaylist' => {
'parameters' =>
['contextId','type','playlistId']
},
'allMusic:tracksOnAlbum' => {
'parameters' =>
['contextId','type','albumId']
}
}
}
};
push @contexts,$allMusicContext;
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "getProtocolDescription(" . Data::Dump::dump($reqParams) . ")" );
}
my $count = $reqParams->{'count'} if exists($reqParams->{'count'});
my $offset = $reqParams->{'offset'} || 0;
if(!defined($count)) {
$count = scalar(@contexts);
}
my @resultItems = ();
my $i = 0;
for my $context (@contexts) {
if($i>=$offset && scalar(@resultItems)<$count) {
push @resultItems,$context;
}
$i++;
}
my $result = {
'offset' => $offset,
'count' => scalar(@resultItems),
'countAll' => scalar(@contexts),
'items' => \@resultItems
};
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
}
sub getManagementProtocolDescription {
my $context = shift;
my @contexts = ();
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "getProtocolDescription(" . Data::Dump::dump($reqParams) . ")" );
}
my $count = $reqParams->{'count'} if exists($reqParams->{'count'});
my $offset = $reqParams->{'offset'} || 0;
if(!defined($count)) {
$count = scalar(@contexts);
}
my @resultItems = ();
my $i = 0;
for my $context (@contexts) {
if($i>=$offset && scalar(@resultItems)<$count) {
push @resultItems,$context;
}
$i++;
}
my $result = {
'offset' => $offset,
'count' => scalar(@resultItems),
'countAll' => scalar(@contexts),
'items' => \@resultItems
};
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
}
sub getLastScannedTime {
my $lastScanTime = Slim::Music::Import->lastScanTime;
if(!$lastScanTime) {
return time();
}else {
return $lastScanTime;
}
}
sub getItem {
my $context = shift;
eval {
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "getItem(" . Data::Dump::dump($reqParams) . ")" );
}
my $item = undef;
my $serverPrefix = getServerId();
if($reqParams->{'itemId'} =~ /$serverPrefix/) {
if($reqParams->{'itemId'} =~ /^.*\:artist\:(.*)$/) {
$item = getArtist($1);
}elsif($reqParams->{'itemId'} =~ /^.*\:album\:(.*)$/) {
$item = getAlbum($1);
}elsif($reqParams->{'itemId'} =~ /.*\:track\:(.*)$/) {
$item = getTrack($1);
}elsif($reqParams->{'itemId'} =~ /.*\:playlist\:(.*)$/) {
$item = getPlaylist($1);
}elsif($reqParams->{'itemId'} =~ /.*\:folder\:(.*)$/) {
$item = getFolder($1);
}elsif($reqParams->{'itemId'} =~ /^.*\:category\:(.*)$/) {
$item = getCategory($1);
}
}
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($item, $context->{'httpClient'}, $context);
};
if ($@) {
$log->error("An error occurred $@");
}
}
sub findItems {
my $context = shift;
eval {
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "findItems(" . Data::Dump::dump($reqParams) . ")" );
}
my $count = $reqParams->{'count'} if exists($reqParams->{'count'});
my $offset = $reqParams->{'offset'} || 0;
if(defined($reqParams->{'search'})) {
if(!defined($count)) {
$count = 200 - $offset;
}elsif($offset + $count > 200) {
$count = $count - ($offset + $count - 200);
}
}
my $items = undef;
if(!defined($reqParams->{'search'}) || $count>0) {
if(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'album') {
$items = findAlbums($reqParams,$offset,$count);
} elsif(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'playlist') {
$items = findPlaylists($reqParams,$offset,$count);
} elsif(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'artist') {
$items = findArtists($reqParams,$offset,$count);
} elsif(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'track') {
$items = findTracks($reqParams,$offset,$count);
} elsif(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'category') {
$items = findCategories($reqParams,$offset,$count);
} elsif(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'decade') {
$items = findDecades($reqParams,$offset,$count);
} elsif(exists($reqParams->{'type'}) && $reqParams->{'type'} eq 'year') {
$items = findYears($reqParams,$offset,$count);
} elsif(exists($reqParams->{'contextId'}) && ($reqParams->{'contextId'} eq 'myMusicFolder' || $reqParams->{'contextId'} eq 'myMusic') && (!exists($reqParams->{'type'}) || $reqParams->{'type'} eq 'menu' || $reqParams->{'type'} eq 'folder')) {
$items = findFolders($reqParams,$offset,$count);
}
}
my $result;
if(defined($items)) {
$result = {
'offset' => $offset,
'count' => scalar(@$items),
'lastChanged' => getLastScannedTime(),
'items' => $items
};
}else {
my @empty = ();
$result = {
'offset' => $offset,
'count' => 0,
'lastChanged' => getLastScannedTime(),
'items' => \@empty
};
}
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
};
if ($@) {
$log->error("An error occurred $@");
}
}
sub getServiceInformation {
my $context = shift;
if ( $log->is_debug ) {
$log->debug( "getServiceInformation()" );
}
my $serverName = $serverPrefs->get('libraryname');
if(!defined($serverName) || $serverName eq '') {
$serverName = Slim::Utils::Network::hostName();
}
my $serverAddress = Slim::Utils::Network::serverAddr();
($serverAddress) = split /:/, $serverAddress;
if ($serverPrefs->get('authorize')) {
my $password = Crypt::Tea::decrypt($prefs->get('password'),$KEY);
$serverAddress = $serverPrefs->get('username').":".$password."@".$serverAddress;
}
$serverAddress .= ":" . $serverPrefs->get('httpport');
my $result = {
'id' => getServiceId(),
'name' => $serverName,
'type' => 'content',
'mainCategory' => 'localmusic',
'serviceUrl' => 'http://'.$serverAddress
};
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
}
sub getProtocolVersions {
my $context = shift;
if ( $log->is_debug ) {
$log->debug( "getProtocolVersions()" );
}
my $result = {
'minVersion' => '1.0',
'maxVersion' => '2.0'
};
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
}
sub getCategory {
my $genreId = shift;
my $sql = 'SELECT genres.id,genres.name,genres.namesort FROM genres ';
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
my $order_by = "genres.namesort $collate";
my @whereDirectives = ();
my @whereDirectiveValues = ();
push @whereDirectives,'genres.name=?';
push @whereDirectiveValues,$genreId;
if(scalar(@whereDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
}
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY genres.id ORDER BY $order_by";
$sql .= " LIMIT 0, 1";
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
my $items = processCategoryResult($sth,$order_by);
my $item = pop @$items;
return $item;
}
sub findCategories {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my @items = ();
my @whereDirectives = ();
my @whereDirectiveValues = ();
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
my $sql = 'SELECT genres.id,genres.name,genres.namesort FROM genres ';
my $order_by = undef;
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
$order_by = "genres.namesort $collate";
$sql .= "GROUP BY genres.id ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
return processCategoryResult($sth,$order_by);
}
sub processCategoryResult {
my $sth = shift;
my $order_by = shift;
my $serverPrefix = getServerId();
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
my @items = ();
my $genreId;
my $genreName;
my $genreSortName;
$sth->bind_col(1,\$genreId);
$sth->bind_col(2,\$genreName);
$sth->bind_col(3,\$genreSortName);
while ($sth->fetch) {
utf8::decode($genreName);
utf8::decode($genreSortName);
my $item = {
'id' => "$serverPrefix:category:$genreName",
'text' => $genreName,
'sortText' => $genreSortName,
'type' => "category",
'itemAttributes' => {
'id' => "$serverPrefix:category:$genreName",
'categoryType' => 'genre',
'name' => $genreName
}
};
$item->{'sortText'} = $genreSortName;
push @items,$item;
}
$sth->finish();
return \@items;
}
sub findYears {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my @items = ();
my @whereDirectives = ();
my @whereDirectiveValues = ();
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
my $sql = 'SELECT years.id FROM years ';
my $order_by = undef;
$order_by = "years.id desc";
$sql .= "GROUP BY years.id ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
return processYearResult($sth,$order_by);
}
sub processYearResult {
my $sth = shift;
my $order_by = shift;
my $serverPrefix = getServerId();
my @items = ();
my $yearId;
my $yearName;
$sth->bind_col(1,\$yearId);
while ($sth->fetch) {
if($yearId == 0) {
$yearName = string('UNK');
}else {
$yearName = $yearId;
}
my $item = {
'id' => "$serverPrefix:year:$yearId",
'text' => $yearName,
'type' => "year",
'itemAttributes' => {
'id' => "$serverPrefix:year:$yearId",
'name' => $yearName
}
};
push @items,$item;
}
$sth->finish();
return \@items;
}
sub findDecades {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my @items = ();
my @whereDirectives = ();
my @whereDirectiveValues = ();
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
my $sql = 'SELECT floor(years.id/10)*10 FROM years ';
my $order_by = undef;
$order_by = "years.id desc";
$sql .= "GROUP BY floor(years.id/10)*10 ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
return processDecadeResult($sth,$order_by);
}
sub processDecadeResult {
my $sth = shift;
my $order_by = shift;
my $serverPrefix = getServerId();
my @items = ();
my $decadeId;
my $decadeName;
$sth->bind_col(1,\$decadeId);
while ($sth->fetch) {
if($decadeId == 0) {
$decadeName = string('UNK');
}else {
$decadeName = $decadeId."-".($decadeId+9);
}
my $item = {
'id' => "$serverPrefix:decade:$decadeId",
'text' => $decadeName,
'type' => "decade",
'itemAttributes' => {
'id' => "$serverPrefix:decade:$decadeId",
'name' => $decadeName
}
};
push @items,$item;
}
$sth->finish();
return \@items;
}
sub getAlbum {
my $albumId = shift;
my $sql = 'SELECT albums.id,albums.title,albums.titlesort,albums.artwork,albums.disc,albums.year,contributors.id,contributors.name FROM albums ';
$sql .= 'JOIN contributors on contributors.id = albums.contributor ';
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
my $order_by = "albums.titlesort $collate, albums.disc";
my @whereDirectives = ();
my @whereDirectiveValues = ();
push @whereDirectives,'albums.id=?';
push @whereDirectiveValues,$albumId;
if(scalar(@whereDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
}
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY albums.id ORDER BY $order_by";
$sql .= " LIMIT 0, 1";
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
my $items = processAlbumResult($sth,$order_by);
my $item = pop @$items;
return $item;
}
sub findAlbums {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my @items = ();
my @whereDirectives = ();
my @whereDirectiveValues = ();
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
my $sql = 'SELECT albums.id,albums.title,albums.titlesort,albums.artwork,albums.disc,albums.year,contributors.id,contributors.name FROM albums ';
my $order_by = undef;
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
if(exists($reqParams->{'artistId'})) {
$sql .= 'JOIN contributors on contributors.id = albums.contributor ';
$sql .= 'JOIN contributor_album ON contributor_album.album = albums.id ';
if(exists($reqParams->{'roleId'})) {
$sql .= ' AND contributor_album.role=? ';
my $role = Slim::Schema::Contributor->typeToRole(uc($reqParams->{'roleId'}));
if(defined($role)) {
$sql .= ' AND contributor_album.role IN ('.$role.') ';
push @whereDirectiveValues,$role;
}else {
# Make sure we don't get any matches for unknown roles
$sql .= ' AND contributor_album.role IN (99) ';
}
}else {
$sql .= ' AND contributor_album.role IN (?, ?, ?';
push @whereDirectiveValues, Slim::Schema::Contributor->typeToRole('ARTIST');
push @whereDirectiveValues, Slim::Schema::Contributor->typeToRole('TRACKARTIST');
push @whereDirectiveValues, Slim::Schema::Contributor->typeToRole('ALBUMARTIST');
foreach (Slim::Schema::Contributor->contributorRoles) {
if ($serverPrefs->get(lc($_) . 'InArtists')) {
$sql .= ', ?';
push @whereDirectiveValues, Slim::Schema::Contributor->typeToRole($_);
}
}
$sql .= ') ';
}
push @whereDirectives, 'contributor_album.contributor=?';
push @whereDirectiveValues, getInternalId($reqParams->{'artistId'});
if($prefs->get('orderAlbumsForArtist') eq 'by_year_title') {
$order_by = "albums.year desc, albums.titlesort $collate, albums.disc";
}else {
$order_by = "albums.titlesort $collate, albums.disc";
}
}else {
$sql .= 'JOIN contributors on contributors.id = albums.contributor ';
$order_by = "albums.titlesort $collate, albums.disc";
}
if(exists($reqParams->{'categoryId'})) {
$sql .= 'JOIN tracks on tracks.album = albums.id ';
$sql .= 'JOIN genre_track on genre_track.track = tracks.id ';
$sql .= 'JOIN genres on genres.id = genre_track.genre ';
push @whereDirectives, 'genres.name=? ';
push @whereDirectiveValues, getInternalId($reqParams->{'categoryId'});
}
if(exists($reqParams->{'yearId'})) {
push @whereDirectives, 'albums.year=? ';
push @whereDirectiveValues, getInternalId($reqParams->{'yearId'});
}elsif(exists($reqParams->{'decadeId'})) {
push @whereDirectives, 'albums.year>=? ';
push @whereDirectiveValues, getInternalId($reqParams->{'decadeId'});
push @whereDirectives, 'albums.year<=? ';
push @whereDirectiveValues, getInternalId($reqParams->{'decadeId'})+9;
}
if(exists($reqParams->{'search'})) {
my $searchStrings = Slim::Utils::Text::searchStringSplit($reqParams->{'search'});
if( ref $searchStrings->[0] eq 'ARRAY') {
for my $search (@{$searchStrings->[0]}) {
push @whereSearchDirectives,'albums.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}elsif( ref $searchStrings eq 'ARRAY') {
for my $search (@$searchStrings) {
push @whereSearchDirectives,'albums.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}else {
push @whereSearchDirectives,'albums.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$searchStrings;
}
}
if(scalar(@whereDirectives)>0 || scalar(@whereSearchDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
if(scalar(@whereSearchDirectives)>0) {
$whereDirective .= ' AND ('.join(' OR ',@whereSearchDirectives).')';
}
}elsif(scalar(@whereSearchDirectives)>0) {
$whereDirective .= join(' OR ',@whereSearchDirectives);
}
$whereDirective =~ s/\%/\%\%/g;
push @whereDirectiveValues,@whereSearchDirectiveValues;
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY albums.id ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
return processAlbumResult($sth,$order_by);
}
sub processAlbumResult {
my $sth = shift;
my $order_by = shift;
my $serverPrefix = getServerId();
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
my @items = ();
my $albumId;
my $albumTitle;
my $albumSortTitle;
my $albumCover;
my $albumDisc;
my $albumYear;
my $artistId;
my $artistName;
$sth->bind_col(1,\$albumId);
$sth->bind_col(2,\$albumTitle);
$sth->bind_col(3,\$albumSortTitle);
$sth->bind_col(4,\$albumCover);
$sth->bind_col(5,\$albumDisc);
$sth->bind_col(6,\$albumYear);
$sth->bind_col(7,\$artistId);
$sth->bind_col(8,\$artistName);
while ($sth->fetch) {
utf8::decode($albumTitle);
utf8::decode($albumSortTitle);
utf8::decode($artistName);
my @artists = ({
'id' => "$serverPrefix:artist:$artistId",
'name' => $artistName
});
my $item = {
'id' => "$serverPrefix:album:$albumId",
'text' => $albumTitle,
'sortText' => $albumSortTitle,
'type' => "album",
'itemAttributes' => {
'id' => "$serverPrefix:album:$albumId",
'name' => $albumTitle,
'mainArtists' => \@artists
}
};
if($order_by eq "albums.titlesort $collate, albums.disc") {
$item->{'sortText'} = $albumSortTitle." ".(defined($albumDisc)?$albumDisc:"");
}elsif($order_by eq "albums.year desc, albums.titlesort $collate, albums.disc") {
$item->{'sortText'} = $albumYear." ".$albumSortTitle." ".(defined($albumDisc)?$albumDisc:"");
}
if(defined($albumCover)) {
$item->{'image'} = "service://".getServiceId()."/music/$albumCover/cover";
}
if(defined($albumYear) && $albumYear>0) {
$item->{'itemAttributes'}->{'year'} = $albumYear;
}
push @items,$item;
}
$sth->finish();
return \@items;
}
sub getArtist {
my $artistId = shift;
my $serverPrefix = getServerId();
my $sql = 'SELECT contributors.id,contributors.name,contributors.namesort FROM contributors JOIN albums ON albums.contributor=contributors.id ';
my $order_by = undef;
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
$order_by = "contributors.namesort $collate";
my @whereDirectives = ();
my @whereDirectiveValues = ();
push @whereDirectives,'contributors.id=?';
push @whereDirectiveValues,$artistId;
if(scalar(@whereDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
}
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY contributors.id ORDER BY $order_by";
$sql .= " LIMIT 0, 1";
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
my $items = processArtistResult($sth);
my $item = pop @$items;
return $item;
}
sub findArtists {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my $serverPrefix = getServerId();
my @items = ();
my $va_pref = $serverPrefs->get('variousArtistAutoIdentification');
my @whereDirectives = ();
my @whereDirectiveValues = ();
my $sql = 'SELECT contributors.id,contributors.name,contributors.namesort FROM contributors JOIN contributor_album ON contributors.id=contributor_album.contributor ';
if(!exists($reqParams->{'search'})) {
if(exists($reqParams->{'roleId'})) {
my $role = Slim::Schema::Contributor->typeToRole(uc($reqParams->{'roleId'}));
if(defined($role)) {
$sql .= ' AND contributor_album.role=? ';
push @whereDirectiveValues,$role;
}else {
# Unknown roles shouldn't give any matches
$sql .= ' AND contributor_album.role IN (99) ';
}
}else {
$sql .= ' AND contributor_album.role IN (';
my $roles = Slim::Schema->artistOnlyRoles || [];
my $first = 1;
foreach (@{$roles}) {
if(!$first) {
$sql .= ', ';
}
$sql .= '?';
push @whereDirectiveValues, $_;
$first = 0;
}
$sql .= ') ';
}
if($va_pref) {
$sql .= 'JOIN albums ON contributor_album.album = albums.id ';
push @whereDirectives, '(albums.compilation IS NULL OR albums.compilation = 0)';
}
}
if(exists($reqParams->{'categoryId'})) {
$sql .= 'JOIN contributor_track on contributor_track.contributor=contributor_album.contributor ';
$sql .= 'JOIN tracks on tracks.id = contributor_track.track ';
$sql .= 'JOIN genre_track on genre_track.track = tracks.id ';
$sql .= 'JOIN genres on genres.id = genre_track.genre ';
push @whereDirectives, 'genres.name=? ';
push @whereDirectiveValues, getInternalId($reqParams->{'categoryId'});
}
my $order_by = undef;
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
$order_by = "contributors.namesort $collate";
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
if(exists($reqParams->{'search'})) {
my $searchStrings = Slim::Utils::Text::searchStringSplit($reqParams->{'search'});
if( ref $searchStrings->[0] eq 'ARRAY') {
for my $search (@{$searchStrings->[0]}) {
push @whereSearchDirectives,'contributors.namesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}elsif( ref $searchStrings eq 'ARRAY') {
for my $search (@$searchStrings) {
push @whereSearchDirectives,'contributors.namesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}else {
push @whereSearchDirectives,'contributors.namesearch LIKE ?';
push @whereSearchDirectiveValues,$searchStrings;
}
}
if(scalar(@whereDirectives)>0 || scalar(@whereSearchDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
if(scalar(@whereSearchDirectives)>0) {
$whereDirective .= ' AND ('.join(' OR ',@whereSearchDirectives).')';
}
}elsif(scalar(@whereSearchDirectives)>0) {
$whereDirective .= join(' OR ',@whereSearchDirectives);
}
$whereDirective =~ s/\%/\%\%/g;
push @whereDirectiveValues,@whereSearchDirectiveValues;
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY contributors.id ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
if(scalar(@whereDirectiveValues)>0) {
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
}else {
$sth->execute();
}
return processArtistResult($sth);
}
sub processArtistResult {
my $sth = shift;
my $serverPrefix = getServerId();
my @items = ();
my $artistId;
my $artistName;
my $artistSortName;
$sth->bind_col(1,\$artistId);
$sth->bind_col(2,\$artistName);
$sth->bind_col(3,\$artistSortName);
while ($sth->fetch) {
utf8::decode($artistName);
utf8::decode($artistSortName);
my $item = {
'id' => "$serverPrefix:artist:$artistId",
'text' => $artistName,
'sortText' => $artistSortName,
'type' => "artist",
'itemAttributes' => {
'id' => "$serverPrefix:artist:$artistId",
'name' => $artistName
}
};
if($artistImages) {
$item->{'image'} = "service://".getServiceId()."/imageproxy/mai/artist/".$artistId."/image.png";
}
push @items,$item;
}
$sth->finish();
return \@items;
}
sub findPlaylists {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my $serverPrefix = getServerId();
my @items = ();
my $sql = 'SELECT tracks.urlmd5,tracks.title,tracks.titlesort FROM tracks ';
my $order_by = undef;
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
$order_by = "tracks.titlesort $collate";
my @whereDirectives = ('tracks.content_type=?');
my @whereDirectiveValues = ('ssp');
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
if(exists($reqParams->{'search'})) {
my $searchStrings = Slim::Utils::Text::searchStringSplit($reqParams->{'search'});
if( ref $searchStrings->[0] eq 'ARRAY') {
for my $search (@{$searchStrings->[0]}) {
push @whereSearchDirectives,'tracks.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}elsif( ref $searchStrings eq 'ARRAY') {
for my $search (@$searchStrings) {
push @whereSearchDirectives,'tracks.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}else {
push @whereSearchDirectives,'tracks.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$searchStrings;
}
}
if(scalar(@whereDirectives)>0 || scalar(@whereSearchDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
if(scalar(@whereSearchDirectives)>0) {
$whereDirective .= ' AND ('.join(' OR ',@whereSearchDirectives).')';
}
}elsif(scalar(@whereSearchDirectives)>0) {
$whereDirective .= join(' OR ',@whereSearchDirectives);
}
$whereDirective =~ s/\%/\%\%/g;
push @whereDirectiveValues,@whereSearchDirectiveValues;
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY tracks.id ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
if(scalar(@whereDirectiveValues)>0) {
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
}else {
$sth->execute();
}
return processPlaylistResult($sth);
}
sub processPlaylistResult {
my $sth = shift;
my $serverPrefix = getServerId();
my @items = ();
my $playlistId;
my $playlistName;
my $playlistSortName;
$sth->bind_col(1,\$playlistId);
$sth->bind_col(2,\$playlistName);
$sth->bind_col(3,\$playlistSortName);
while ($sth->fetch) {
utf8::decode($playlistName);
utf8::decode($playlistSortName);
my $item = {
'id' => "$serverPrefix:playlist:$playlistId",
'text' => $playlistName,
'sortText' => $playlistSortName,
'type' => "playlist",
'itemAttributes' => {
'id' => "$serverPrefix:playlist:$playlistId",
'name' => $playlistName
}
};
push @items,$item;
}
$sth->finish();
return \@items;
}
sub getTrack {
my $trackId = shift;
my $sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id ';
my $order_by = "tracks.titlesort";
my @whereDirectives = ();
my @whereDirectiveValues = ();
push @whereDirectives, 'tracks.urlmd5=?';
push @whereDirectiveValues, $trackId;
if(scalar(@whereDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
}
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY tracks.id ORDER BY $order_by";
$sql .= " LIMIT 0, 1";
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
my $items = processTrackResult($sth,undef);
my $item = pop @$items;
return $item;
}
sub getPlaylist {
my $trackId = shift;
my $sql = 'SELECT tracks.urlmd5,tracks.title,tracks.titlesort FROM tracks ';
my $order_by = "tracks.titlesort";
my @whereDirectives = ();
my @whereDirectiveValues = ();
push @whereDirectives, 'tracks.urlmd5=?';
push @whereDirectiveValues, $trackId;
if(scalar(@whereDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
}
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY tracks.id ORDER BY $order_by";
$sql .= " LIMIT 0, 1";
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
my $items = processPlaylistResult($sth,undef);
my $item = pop @$items;
return $item;
}
sub findTracks {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my $serverPrefix = getServerId();
my @items = ();
my @whereDirectives = ();
my @whereDirectiveValues = ();
my @whereSearchDirectives = ();
my @whereSearchDirectiveValues = ();
my $sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id ';
my $order_by = "tracks.disc,tracks.tracknum,tracks.titlesort";
if(exists($reqParams->{'playlistId'})) {
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
$sql .= 'JOIN playlist_track ON playlist_track.track = tracks.url ';
$sql .= 'JOIN tracks AS playlists ON playlists.id = playlist_track.playlist ';
push @whereDirectives, 'playlists.urlmd5=?';
push @whereDirectiveValues, getInternalId($reqParams->{'playlistId'});
$order_by = "playlist_track.position";
}
if(exists($reqParams->{'artistId'})) {
my $collate = Slim::Utils::OSDetect->getOS()->sqlHelperClass()->collate();
$sql .= 'JOIN contributor_track ON contributor_track.track = tracks.id ';
push @whereDirectives, 'contributor_track.contributor=?';
push @whereDirectiveValues, getInternalId($reqParams->{'artistId'});
if(exists($reqParams->{'roleId'})) {
push @whereDirectives, 'contributor_track.role=?';
my $role = Slim::Schema::Contributor->typeToRole(uc($reqParams->{'roleId'}));
if(defined($role)) {
push @whereDirectiveValues,$role;
}else {
# Make sure we don't get any matches for unknown roles
push @whereDirectiveValues,99;
}
}
}
if(exists($reqParams->{'categoryId'})) {
$sql .= 'JOIN genre_track on genre_track.track = tracks.id ';
$sql .= 'JOIN genres on genres.id = genre_track.genre ';
push @whereDirectives, 'genres.name=? ';
push @whereDirectiveValues, getInternalId($reqParams->{'categoryId'});
}
if(exists($reqParams->{'albumId'})) {
push @whereDirectives, 'tracks.album=?';
push @whereDirectiveValues, getInternalId($reqParams->{'albumId'});
}elsif(!exists($reqParams->{'playlistId'})) {
$order_by = "tracks.titlesort";
}
if(exists($reqParams->{'search'})) {
my $searchStrings = Slim::Utils::Text::searchStringSplit($reqParams->{'search'});
if( ref $searchStrings->[0] eq 'ARRAY') {
for my $search (@{$searchStrings->[0]}) {
push @whereSearchDirectives,'tracks.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}elsif( ref $searchStrings eq 'ARRAY') {
for my $search (@$searchStrings) {
push @whereSearchDirectives,'tracks.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$search;
}
}else {
push @whereSearchDirectives,'tracks.titlesearch LIKE ?';
push @whereSearchDirectiveValues,$searchStrings;
}
}
if(scalar(@whereDirectives)>0 || scalar(@whereSearchDirectives)>0) {
$sql .= 'WHERE ';
my $whereDirective;
if(scalar(@whereDirectives)>0) {
$whereDirective = join(' AND ', @whereDirectives);
if(scalar(@whereSearchDirectives)>0) {
$whereDirective .= ' AND ('.join(' OR ',@whereSearchDirectives).')';
}
}elsif(scalar(@whereSearchDirectives)>0) {
$whereDirective .= join(' OR ',@whereSearchDirectives);
}
$whereDirective =~ s/\%/\%\%/g;
push @whereDirectiveValues,@whereSearchDirectiveValues;
$sql .= $whereDirective . ' ';
}
$sql .= "GROUP BY tracks.id ORDER BY $order_by";
if(defined($count)) {
$sql .= " LIMIT $offset, $count";
}
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
$log->debug("Using values: ".join(',',@whereDirectiveValues));
$sth->execute(@whereDirectiveValues);
return processTrackResult($sth,$reqParams->{'albumId'});
}
sub processTrackResult {
my $sth = shift;
my $requestedAlbumId = shift;
my $serverPrefix = getServerId();
my @items = ();
my $trackId;
my $trackUrl;
my $trackMd5Url;
my $trackSampleRate;
my $trackSampleSize;
my $trackChannels;
my $trackNumber;
my $trackTitle;
my $trackSortTitle;
my $trackCover;
my $trackYear;
my $trackDisc;
my $trackDuration;
my $trackFormat;
my $albumId;
my $albumTitle;
my $albumYear;
my $contributorIds;
my $contributorNames;
$sth->bind_col(1,\$trackId);
$sth->bind_col(2,\$trackUrl);
$sth->bind_col(3,\$trackMd5Url);
$sth->bind_col(4,\$trackSampleRate);
$sth->bind_col(5,\$trackSampleSize);
$sth->bind_col(6,\$trackChannels);
$sth->bind_col(7,\$trackNumber);
$sth->bind_col(8,\$trackTitle);
$sth->bind_col(9,\$trackSortTitle);
$sth->bind_col(10,\$trackCover);
$sth->bind_col(11,\$trackYear);
$sth->bind_col(12,\$trackDisc);
$sth->bind_col(13,\$trackDuration);
$sth->bind_col(14,\$trackFormat);
$sth->bind_col(15,\$albumId);
$sth->bind_col(16,\$albumTitle);
$sth->bind_col(17,\$albumYear);
$sth->bind_col(18,\$contributorIds);
$sth->bind_col(19,\$contributorNames);
my $serverAddress = Slim::Utils::Network::serverAddr();
($serverAddress) = split /:/, $serverAddress;
$serverAddress .= ":" . $serverPrefs->get('httpport');
while ($sth->fetch) {
utf8::decode($trackSortTitle);
utf8::decode($trackTitle);
utf8::decode($albumTitle);
utf8::decode($contributorNames);
my $sortText = (defined($trackDisc)?($trackDisc<10?"0".$trackDisc."-":$trackDisc."-"):"").(defined($trackNumber)?($trackNumber<10?"0".$trackNumber:$trackNumber):"");
my $displayText = (defined($trackDisc)?$trackDisc."-":"").(defined($trackNumber)?$trackNumber:"").". ".$trackTitle;
if(!$requestedAlbumId) {
$sortText = $trackSortTitle;
$displayText = $trackTitle;
}
my $format = Slim::Music::Info::mimeType($trackUrl);
if($format =~ /flac/) {
$format = 'audio/flac';
}elsif($format =~ /m4a/ || $format =~ /mp4/) {
$format = 'audio/m4a';
}elsif($format =~ /aac/) {
$format = 'audio/aac';
}elsif($format =~ /mp3/ || $format eq 'audio/x-mpeg' || $format eq 'audio/mpeg3' || $format eq 'audio/mpg') {
$format = 'audio/mpeg';
}elsif($format =~ /ogg/) {
$format = 'audio/ogg';
}elsif($format eq 'audio/L16' || $format eq 'audio/pcm') {
$format = 'audio/x-pcm';
}elsif($format eq 'audio/x-ms-wma' || $format eq 'application/vnd.ms.wms-hdr.asfv1' || $format eq 'application/octet-stream' || $format eq 'application/x-mms-framed' || $format eq 'audio/asf') {
$format = 'audio/x-ms-wma';
}elsif($format =~ /aiff/) {
$format = 'audio/x-aiff';
}elsif($format eq 'audio/x-wav') {
$format = 'audio/wav';
}else {
$format = 'audio/native';
}
my @streamingRefs = ({
'format' => $format,
'url' => "service://".getServiceId()."/plugins/IckStreamPlugin/music/$trackMd5Url/download"
});
if(defined($trackSampleSize) && $trackSampleSize>0) {
$streamingRefs[0]->{'sampleSize'} = $trackSampleSize;
}
if(defined($trackSampleRate) && $trackSampleRate>0) {
$streamingRefs[0]->{'sampleRate'} = $trackSampleRate;
}
if(defined($trackChannels) && $trackChannels>0) {
$streamingRefs[0]->{'channels'} = $trackChannels;
}
my $item = {
'id' => "$serverPrefix:track:$trackMd5Url",
'text' => $displayText,
'sortText' => $sortText,
'type' => "track",
'streamingRefs' => \@streamingRefs,
'itemAttributes' => {
'id' => "$serverPrefix:track:$trackMd5Url",
'name' => $trackTitle,
'album' => {
'id' => "$serverPrefix:album:$albumId",
'name' => $albumTitle,
}
}
};
if(defined($trackCover)) {
$item->{'image'} = "service://".getServiceId()."/music/$trackCover/cover";
}
if(defined($trackNumber) && $trackNumber>0) {
$item->{'itemAttributes'}->{'trackNumber'} = $trackNumber;
}
if(defined($trackDisc) && $trackDisc>0) {
$item->{'itemAttributes'}->{'disc'} = $trackDisc;
}
if(defined($trackYear) && $trackYear>0) {
$item->{'itemAttributes'}->{'year'} = $trackYear;
}
if(defined($trackDuration) && $trackDuration>0) {
$item->{'itemAttributes'}->{'duration'} = floor($trackDuration);
}
if(defined($albumYear) && $albumYear>0) {
$item->{'itemAttributes'}->{'album'}->{'year'} = $albumYear;
}
if(defined($contributorIds)) {
my @contributorIdsArray = split('\|',$contributorIds);
my @contributorNamesArray = split('\|',$contributorNames);
my @contributors = ();
while(scalar(@contributorIdsArray)>0) {
my $id = shift @contributorIdsArray;
my $name = shift @contributorNamesArray;
push @contributors,{
'id' => "$serverPrefix:artist:$id",
'name' => $name
};
}
@contributors = sort {
$a->{'name'} cmp $b->{'name'}
} @contributors;
$item->{'itemAttributes'}->{'mainArtists'} = \@contributors;
}
push @items,$item;
}
$sth->finish();
return \@items;
}
sub findFolders {
my $reqParams = shift;
my $offset = shift;
my $count = shift;
my @items = ();
if(!defined($count)) {
$count = 200;
}
my $dbh = Slim::Schema->dbh;
my $folderId = undef;
if(exists($reqParams->{'folderId'})) {
my $internalId = getInternalId($reqParams->{'folderId'});
my $sql = "SELECT id from tracks where urlmd5=?";
my $sth = $dbh->prepare_cached($sql);
$sth->execute(($internalId));
$sth->bind_col(1,\$folderId);
if ($sth->fetch) {
}else {
$sth->finish();
return \@items;
}
$sth->finish();
}
my $request = undef;
if(defined($folderId)) {
$request = Slim::Control::Request->new(undef, ["musicfolder",$offset,$count,"folder_id:".$folderId]);
}else {
$request = Slim::Control::Request->new(undef, ["musicfolder",$offset,$count]);
}
$request->execute();
if($request->isStatusError()) {
return \@items;
}
my $foundItems = $request->getResult("folder_loop");
foreach my $it (@$foundItems) {
if($it->{'type'} eq 'track') {
my $sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id WHERE tracks.id=? GROUP BY tracks.id';
my $sth = $dbh->prepare_cached($sql);
$sth->execute(($it->{'id'}));
my $trackItems = processTrackResult($sth,undef);
my $track = pop @$trackItems;
if(defined($track)) {
push @items,$track;
}
}elsif($it->{'type'} eq 'folder') {
my $sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.title,tracks.titlesort FROM tracks WHERE id=?';
my $sth = $dbh->prepare_cached($sql);
$sth->execute(($it->{'id'}));
my $folderItems = processFolderResult($sth,undef);
my $folder = pop @$folderItems;
if(defined($folder)) {
push @items,$folder;
}
}
}
return \@items;
}
sub processFolderResult {
my $sth = shift;
my $requestedAlbumId = shift;
my $serverPrefix = getServerId();
my @items = ();
my $trackId;
my $trackUrl;
my $trackMd5Url;
my $trackTitle;
my $trackSortTitle;
$sth->bind_col(1,\$trackId);
$sth->bind_col(2,\$trackUrl);
$sth->bind_col(3,\$trackMd5Url);
$sth->bind_col(4,\$trackTitle);
$sth->bind_col(5,\$trackSortTitle);
my $serverAddress = Slim::Utils::Network::serverAddr();
($serverAddress) = split /:/, $serverAddress;
$serverAddress .= ":" . $serverPrefs->get('httpport');
while ($sth->fetch) {
utf8::decode($trackSortTitle);
utf8::decode($trackTitle);
my $sortText = $trackSortTitle;
my $displayText = $trackTitle;
my $item = {
'id' => "$serverPrefix:folder:$trackMd5Url",
'text' => $trackTitle,
'sortText' => $trackSortTitle,
'type' => "folder",
'preferredChildRequest' => 'myMusic:childItemsInMenu',
'itemAttributes' => {
'id' => "$serverPrefix:folder:$trackMd5Url",
'name' => $trackTitle
}
};
push @items,$item;
}
$sth->finish();
return \@items;
}
sub getNextDynamicPlaylistTracks {
my $context = shift;
eval {
# get the JSON-RPC params
my $reqParams = $context->{'procedure'}->{'params'};
if ( $log->is_debug ) {
$log->debug( "getNextDynamicPlaylistTracks(" . Data::Dump::dump($reqParams) . ")" );
}
my $count = $reqParams->{'count'} if exists($reqParams->{'count'});
if(!defined($count)) {
$count = 10;
}
my $selectionParameters = $reqParams->{'selectionParameters'} if exists($reqParams->{'selectionParameters'});
if(!defined($selectionParameters)) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters'
});
return;
}
if(!defined($selectionParameters->{'type'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.type'
});
return;
}
my $type = $selectionParameters->{'type'};
my $items = undef;
if($type eq 'RANDOM_ALL') {
$items = queryNextDynamicPlaylistTracks($count);
}elsif($type eq 'RANDOM_MY_LIBRARY') {
$items = queryNextDynamicPlaylistTracks($count);
}elsif($type eq 'RANDOM_MY_PLAYLISTS') {
$items = queryNextDynamicPlaylistTracksFromMyPlaylists($count);
}elsif($type eq 'RANDOM_FOR_ARTIST') {
if(!defined($selectionParameters->{'data'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.data'
});
}
if(!defined($selectionParameters->{'data'}->{'artist'}) && !defined($selectionParameters->{'data'}->{'artistId'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.data.playlist or selectionParameters.data.playlistId'
});
}
$items = queryNextDynamicPlaylistTracksFromArtist($count,$selectionParameters->{'data'});
}elsif($type eq 'RANDOM_FOR_PLAYLIST') {
if(!defined($selectionParameters->{'data'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.data'
});
}
if(!defined($selectionParameters->{'data'}->{'playlist'}) && !defined($selectionParameters->{'data'}->{'playlistId'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.data.playlist or selectionParameters.data.playlistId'
});
}
$items = queryNextDynamicPlaylistTracksFromPlaylist($count, $selectionParameters->{'data'});
}elsif($type eq 'RANDOM_FOR_CATEGORY') {
if(!defined($selectionParameters->{'data'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.data'
});
}
if(!defined($selectionParameters->{'data'}->{'category'}) && !defined($selectionParameters->{'data'}->{'categoryId'})) {
Plugins::IckStreamPlugin::JsonHandler::requestWrite(undef,$context->{'httpClient'}, $context, {
'code' => -32602,
'message' => 'Missing parameter: selectionParameters.data.category or selectionParameters.data.categoryId'
});
}
$items = queryNextDynamicPlaylistTracksFromCategory($count, $selectionParameters->{'data'});
}
my $result;
if(defined($items)) {
$result = {
'lastChanged' => time(),
'items' => $items
};
}else {
my @empty = ();
$result = {
'lastChanged' => time(),
'items' => \@empty
};
}
# the request was successful and is not async, send results back to caller!
Plugins::IckStreamPlugin::JsonHandler::requestWrite($result, $context->{'httpClient'}, $context);
};
if ($@) {
$log->error("An error occurred $@");
}
}
sub queryNextDynamicPlaylistTracks {
my $count = shift;
my $sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$sth->execute();
my $items = processTrackResult($sth,undef);
return $items;
}
sub queryNextDynamicPlaylistTracksFromMyPlaylists {
my $count = shift;
my $sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album JOIN playlist_track on playlist_track.track=tracks.url LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$sth->execute();
my $items = processTrackResult($sth,undef);
return $items;
}
sub queryNextDynamicPlaylistTracksFromArtist {
my $count = shift;
my $parameters = shift;
my $sql;
my $sth = undef;
if($parameters->{'artistId'} && getInternalId($parameters->{'artistId'})) {
my $artistId = getInternalId($parameters->{'artistId'});
$sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id WHERE ct.contributor=? GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
$sth = $dbh->prepare_cached($sql);
$sth->execute(($artistId));
}elsif($parameters->{'artist'}) {
my $artistName = $parameters->{'artist'};
$sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id WHERE contributors.name=? GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
$sth = $dbh->prepare_cached($sql);
$sth->execute(($artistName));
}
if(defined($sth)) {
my $items = processTrackResult($sth,undef);
return $items;
}else {
return undef;
}
}
sub queryNextDynamicPlaylistTracksFromPlaylist {
my $count = shift;
my $parameters = shift;
my $sql;
my $sth = undef;
if($parameters->{'playlistId'} && getInternalId($parameters->{'playlistId'})) {
my $artistId = getInternalId($parameters->{'playlistId'});
$sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album JOIN playlist_track as pt on pt.track=tracks.url JOIN tracks as playlists on playlists.id=pt.playlist LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id WHERE playlists.urlmd5=? GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
$sth = $dbh->prepare_cached($sql);
$sth->execute(($artistId));
}elsif($parameters->{'playlist'}) {
my $playlistName = $parameters->{'playlist'};
$sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album JOIN playlist_track as pt on pt.track=tracks.url JOIN tracks as playlists on playlists.id=pt.playlist LEFT JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id WHERE playlists.title=? GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
$sth = $dbh->prepare_cached($sql);
$sth->execute(($playlistName));
}
if(defined($sth)) {
my $items = processTrackResult($sth,undef);
return $items;
}else {
return undef;
}
}
sub queryNextDynamicPlaylistTracksFromCategory {
my $count = shift;
my $parameters = shift;
my $sql;
my $sth = undef;
my $categoryId = undef;
if($parameters->{'categoryId'} && getInternalId($parameters->{'categoryId'})) {
$categoryId = getInternalId($parameters->{'categoryId'});
}elsif($parameters->{'category'}) {
$categoryId = $parameters->{'category'};
}
if(defined($categoryId)) {
$sql = 'SELECT tracks.id,tracks.url,tracks.urlmd5,tracks.samplerate,tracks.samplesize,tracks.channels,tracks.tracknum, tracks.title,tracks.titlesort,tracks.coverid,tracks.year,tracks.disc,tracks.secs,tracks.content_type,albums.id,albums.title,albums.year,group_concat(contributors.id,"|"), group_concat(contributors.name,"|") FROM tracks JOIN albums on albums.id=tracks.album JOIN contributor_track as ct on ct.track=tracks.id and ct.role in (1,5) JOIN contributors on ct.contributor=contributors.id JOIN genre_track on genre_track.track=tracks.id JOIN genres on genres.id=genre_track.genre WHERE genres.name=? GROUP BY tracks.id ORDER BY random() LIMIT 0,'.$count;
my $dbh = Slim::Schema->dbh;
$sth = $dbh->prepare_cached($sql);
$sth->execute(($categoryId));
}
if(defined($sth)) {
my $items = processTrackResult($sth,undef);
return $items;
}else {
return undef;
}
}
sub getInternalId {
my $globalId = shift;
if($globalId =~ /^[^:]*:lms:[^:]*:(.*)$/) {
return $1;
}else {
return undef;
}
}
sub getServiceId {
return uc($prefs->get('uuid'));
}
sub getServerId {
return getServiceId().":lms";
}
sub handleStream {
my ($httpClient, $httpResponse) = @_;
my $uri = $httpResponse->request()->uri;
if($uri =~ /\/plugins\/IckStreamPlugin\/music\/([^\/]+)\/download/) {
my $trackId = $1;
my $sql = "SELECT id from TRACKS where urlmd5=?";
my $dbh = Slim::Schema->dbh;
my $sth = $dbh->prepare_cached($sql);
$log->debug("Executing $sql");
my @params = ($trackId);
$sth->execute(@params);
my $id;
$sth->bind_col(1,\$id);
if ($sth->fetch) {
$sth->finish();
$log->debug("Redirect to /music/$id/download");
my $serverAddress = Slim::Utils::Network::serverAddr();
($serverAddress) = split /:/, $serverAddress;
$serverAddress .= ":" . $serverPrefs->get('httpport');
$httpResponse->code(RC_MOVED_TEMPORARILY);
$httpResponse->header('Location' => "http://".$serverAddress."/music/$id/download");
$httpClient->send_response($httpResponse);
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
$sth->finish();
}
$httpResponse->code(RC_NOT_FOUND);
$httpResponse->content_type('text/html');
$httpResponse->header('Connection' => 'close');
my $params = {
'path' => $uri
};
$httpResponse->content_ref(Slim::Web::HTTP::filltemplatefile('html/errors/404.html', $params));
$httpClient->send_response($httpResponse);
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
sub handleJSONRPC {
my ($httpClient, $httpResponse) = @_;
# make sure we're connected
if (!$httpClient->connected()) {
$log->warn("Aborting, client not connected: $httpClient");
return;
}
# cancel any previous subscription on this connection
# we must have a context defined and a subscription defined
if (defined(Plugins::IckStreamPlugin::JsonHandler::getContext($httpClient)) &&
Slim::Control::Request::unregisterAutoExecute($httpClient)) {
# we want to send a last chunk to close the connection as per HTTP...
# a subscription is essentially a never ending response: we're receiving here
# a new request (aka pipelining) so we want to be nice and close the previous response
# we cannot have a subscription if this is not a long lasting, keep-open, chunked connection.
Slim::Web::HTTP::addHTTPLastChunk($httpClient, 0);
}
# get the request data (POST for JSON 2.0)
my $input = $httpResponse->request()->content();
if (!$input) {
# No data
# JSON 2.0 => close connection
$log->warn("No POST data found => closing connection");
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
$log->is_info && $log->info("POST data: [$input]");
# create a hash to store our context
my $context = {};
$context->{'httpClient'} = $httpClient;
$context->{'httpResponse'} = $httpResponse;
my $procedure = undef;
eval {
# Parse the input
# Convert JSON to Perl
# FIXME: JSON 2.0 accepts multiple requests ? How do we parse that efficiently?
$procedure = from_json($input);
};
if ($@) {
Plugins::IckStreamPlugin::JsonHandler::generateJSONResponse($context, undef, {
'code' => -32700,
'message' => 'Invalid JSON'
});
return;
}
# Validate the procedure
# We must get a JSON object, i.e. a hash
if (ref($procedure) ne 'HASH') {
$log->warn("Cannot parse POST data into Perl hash => closing connection");
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
if ( main::DEBUGLOG && $log->is_debug ) {
$log->debug( "JSON parsed procedure: " . Data::Dump::dump($procedure) );
}
$context->{'procedure'} = $procedure;
# ignore notifications (which don't have an id)
if (!defined($procedure->{'id'})) {
$log->debug("Ignoring notification: ".$procedure->{'method'});
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
# ignore errors, just log them
if (defined($procedure->{'error'})) {
$log->warn("JSON error on id=".$procedure->{'id'}.": ".$procedure->{'error'}->{'code'}.":".$procedure->{'error'}->{'code'}.(defined($procedure->{'error'}->{'data'})?"(".$procedure->{'error'}->{'data'}.")":""));
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
# we must have a method
my $method = $procedure->{'method'};
if (!$method) {
Plugins::IckStreamPlugin::JsonHandler::generateJSONResponse($context, undef, {
'code' => -32601,
'message' => 'Method not found',
'data' => $method
});
return;
}
# figure out the method wanted
my $funcPtr = $methods{$method};
if (!$funcPtr) {
Plugins::IckStreamPlugin::JsonHandler::generateJSONResponse($context, undef, {
'code' => -32601,
'message' => 'Method not found',
'data' => $method
});
return;
} elsif (ref($funcPtr) ne 'CODE') {
# return internal server error
$log->error("Procedure $method refers to non CODE ??? => closing connection");
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
# parse the parameters
my $params = $procedure->{'params'};
if (defined($params) && ref($params) ne 'HASH') {
# error, params is an array or an object
$log->warn("Procedure $method has params not HASH => closing connection");
Slim::Web::HTTP::closeHTTPSocket($httpClient);
return;
}
# Detect the language the client wants content returned in
if ( my $lang = $httpResponse->request->header('Accept-Language') ) {
my @parts = split(/[,-]/, $lang);
$context->{lang} = uc $parts[0] if $parts[0];
}
if ( my $ua = ( $httpResponse->request->header('X-User-Agent') || $httpResponse->request->header('User-Agent') ) ) {
$context->{ua} = $ua;
}
# Check our operational mode using our X-Jive header
# We must be delaing with a 1.1 client because X-Jive uses chunked transfers
# We must not be closing the connection
if (defined(my $xjive = $httpResponse->request()->header('X-Jive')) &&
$httpClient->proto_ge('1.1') &&
$httpResponse->header('Connection') !~ /close/i) {
main::INFOLOG && $log->info("Operating in x-jive mode for procedure $method and client $httpClient");
$context->{'x-jive'} = 1;
$httpResponse->header('X-Jive' => 'Jive')
}
# remember we need to send headers. We'll reset this once sent.
$context->{'sendheaders'} = 1;
# store our context. It'll get erased by the callback in HTTP.pm through handleClose
Plugins::IckStreamPlugin::JsonHandler::setContext($httpClient, $context);
# jump to the code handling desired method. It is responsible to send a suitable output
eval { &{$funcPtr}($context); };
if ($@) {
my $funcName = Slim::Utils::PerlRunTime::realNameForCodeRef($funcPtr);
$log->error("While trying to run function coderef [$funcName]: [$@]");
main::DEBUGLOG && $log->error( "JSON parsed procedure: " . Data::Dump::dump($procedure) );
Plugins::IckStreamPlugin::JsonHandler::generateJSONResponse($context, undef, {
'code' => -32001,
'message' => 'Error when executing $funcName',
'data' => $@
});
return;
}
}
1;
| 30.429132 | 688 | 0.63053 |
ed413d81fa4347738aceed2af6037aa6a8395937 | 2,944 | t | Perl | t/mojolicious/tls_lite_app.t | gitpan/Mojolicious | beca309d5d5f856df641e965398986753d8b00a6 | [
"Artistic-2.0"
]
| null | null | null | t/mojolicious/tls_lite_app.t | gitpan/Mojolicious | beca309d5d5f856df641e965398986753d8b00a6 | [
"Artistic-2.0"
]
| null | null | null | t/mojolicious/tls_lite_app.t | gitpan/Mojolicious | beca309d5d5f856df641e965398986753d8b00a6 | [
"Artistic-2.0"
]
| null | null | null | use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
unless $ENV{TEST_TLS};
plan skip_all => 'IO::Socket::SSL 1.84 required for this test!'
unless Mojo::IOLoop::Server::TLS;
use Mojo::IOLoop;
use Mojo::UserAgent;
use Mojolicious::Lite;
use Test::Mojo;
# Silence
app->log->level('fatal');
# Secure sessions
app->sessions->secure(1);
get '/login' => sub {
my $c = shift;
my $name = $c->param('name') || 'anonymous';
$c->session(name => $name);
$c->render(text => "Welcome $name!");
};
get '/again' => sub {
my $c = shift;
my $name = $c->session('name') || 'anonymous';
$c->render(text => "Welcome back $name!");
};
get '/logout' => sub {
my $c = shift;
$c->session(expires => 1);
$c->redirect_to('login');
};
# Use HTTPS
my $t = Test::Mojo->new;
$t->ua->max_redirects(5);
$t->reset_session->ua->server->url('https');
# Login
$t->get_ok('/login?name=sri' => {'X-Forwarded-Proto' => 'https'})
->status_is(200)->content_is('Welcome sri!');
ok $t->tx->res->cookie('mojolicious')->expires, 'session cookie expires';
ok $t->tx->res->cookie('mojolicious')->secure, 'session cookie is secure';
# Return
$t->get_ok('/again' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome back sri!');
# Logout
$t->get_ok('/logout' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome anonymous!');
# Expired session
$t->get_ok('/again' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome back anonymous!');
# No session
$t->get_ok('/logout' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome anonymous!');
# Use HTTP
$t->reset_session->ua->server->url('http');
# Login again
$t->reset_session->get_ok('/login?name=sri')->status_is(200)
->content_is('Welcome sri!');
# Return
$t->get_ok('/again')->status_is(200)->content_is('Welcome back anonymous!');
# Use HTTPS again (without expiration)
$t->reset_session->ua->server->url('https');
app->sessions->default_expiration(0);
# Login again
$t->get_ok('/login?name=sri' => {'X-Forwarded-Proto' => 'https'})
->status_is(200)->content_is('Welcome sri!');
ok !$t->tx->res->cookie('mojolicious')->expires,
'session cookie does not expire';
ok $t->tx->res->cookie('mojolicious')->secure, 'session cookie is secure';
# Return
$t->get_ok('/again' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome back sri!');
# Logout
$t->get_ok('/logout' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome anonymous!');
# Expired session
$t->get_ok('/again' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome back anonymous!');
# No session
$t->get_ok('/logout' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_is('Welcome anonymous!');
done_testing();
| 27.259259 | 76 | 0.642323 |
73d674bbee8b26626acc5d531ac58691b1108c05 | 1,488 | pl | Perl | vfm/vfm_updatedb.pl | TonyChengTW/MailFilter | cc1a6842461a0222db6fb2956ce9ced532481d9b | [
"Apache-2.0"
]
| null | null | null | vfm/vfm_updatedb.pl | TonyChengTW/MailFilter | cc1a6842461a0222db6fb2956ce9ced532481d9b | [
"Apache-2.0"
]
| null | null | null | vfm/vfm_updatedb.pl | TonyChengTW/MailFilter | cc1a6842461a0222db6fb2956ce9ced532481d9b | [
"Apache-2.0"
]
| null | null | null | #!/bin/perl
#------------------------------
#Writer : Mico Cheng
#Version: 20040719
#Use for: update IS list
#Host : mx3.mail.apol.com.tw
#------------------------------
use DBI;
chomp($today = `date +%Y%m%d`);
$is_list_dir = "/export/home/mico/vfm/";
$is_list_apol_file = $today."_APOL.txt";
$is_list_ebtnet_file = $today."_EBTNET.txt";
$is_list_apol = $is_list_dir.$is_list_apol_file;
$is_list_ebtnet = $is_list_dir.$is_list_ebtnet_file;
open IS_APOL, "$is_list_apol" or die "can\'t open $is_list_apol:$!\n";
open IS_EBTNET, "$is_list_ebtnet" or die "can\'t open $is_list_ebtnet:$!\n";
$dbh = DBI->connect('DBI:mysql:mail_apol;host=localhost',
'rmail',
'xxxxxxx') or die "$!\n";
while (<IS_APOL>) {
chomp;
next if ($_ eq "mail.apol.com.tw");
$sqlstmt = sprintf("update MailCheck set s_mhost='is'
where s_mailid='%s'", $_);
$dbh->do($sqlstmt);
printf("update MailCheck set s_mhost='is' where s_mailid='%s'\n", $_);
}
while (<IS_EBTNET>) {
chomp;
next if ($_ eq "mail.ebtnet.net");
$sqlstmt = sprintf("update MailCheck set s_mhost='is'
where s_mailid='%s'", $_);
$dbh->do($sqlstmt);
printf("update MailCheck set s_mhost='is' where s_mailid='%s'\n", $_);
}
# delete b4 30 days List files
system "/usr/local/bin/find /export/home/mico/vfm/200* -type f -mtime +30 -exec rm -f {} \\;";
$dbh->disconnect();
close(IS_APOL);
close(IS_EBTNET);
| 31 | 94 | 0.588038 |
ed3ba6ba2ac0fbe907ffe13a3c5032be14ecee72 | 6,012 | t | Perl | modules/t/strainSlice.t | JAlvarezJarreta/ensembl | 1af1dce3518d6af00df04983993deefa01ec2276 | [
"Apache-2.0"
]
| 49 | 2015-01-14T14:03:30.000Z | 2022-03-17T22:54:52.000Z | modules/t/strainSlice.t | JAlvarezJarreta/ensembl | 1af1dce3518d6af00df04983993deefa01ec2276 | [
"Apache-2.0"
]
| 489 | 2015-01-14T14:53:47.000Z | 2022-03-29T18:30:48.000Z | modules/t/strainSlice.t | JAlvarezJarreta/ensembl | 1af1dce3518d6af00df04983993deefa01ec2276 | [
"Apache-2.0"
]
| 115 | 2015-01-14T14:31:42.000Z | 2022-03-15T16:24:38.000Z | # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# Copyright [2016-2020] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use warnings;
use Test::More;
use Bio::EnsEMBL::Test::TestUtils;
use Bio::EnsEMBL::Test::MultiTestDB;
use Bio::EnsEMBL::DensityFeature;
my $CAN_USE_VARIATION_API;
BEGIN {
if (eval { require Bio::EnsEMBL::Variation::StrainSlice; 1 }) {
$CAN_USE_VARIATION_API = 1;
}
}
if ($CAN_USE_VARIATION_API) {
my $multi_db = Bio::EnsEMBL::Test::MultiTestDB->new('mus_musculus');
my $vdba = $multi_db->get_DBAdaptor('variation');
my $cdba = $multi_db->get_DBAdaptor('core');
$vdba->dnadb($cdba);
my $slice_adaptor = $cdba->get_SliceAdaptor;
my $slice = $slice_adaptor->fetch_by_region('chromosome', 19, 20380186, 20384187);
my $strain_name = 'A/J';
my $strain_slice = Bio::EnsEMBL::Variation::StrainSlice->new(
-START => $slice->{'start'},
-END => $slice->{'end'},
-STRAND => $slice->{'strand'},
-ADAPTOR => $slice->adaptor(),
-SEQ => $slice->{'seq'},
-SEQ_REGION_NAME => $slice->{'seq_region_name'},
-SEQ_REGION_LENGTH => $slice->{'seq_region_length'},
-COORD_SYSTEM => $slice->{'coord_system'},
-STRAIN_NAME => $strain_name);
my $vf_adaptor = $vdba->get_VariationFeatureAdaptor;
$multi_db->save('core', 'analysis');
$multi_db->save('core', 'density_type');
$multi_db->save('core', 'density_feature');
my $aa = $cdba->get_AnalysisAdaptor();
my $analysis = new Bio::EnsEMBL::Analysis(-database => "ensembl", -logic_name => "SNPDensity");
ok(!$analysis->is_stored($cdba));
$aa->store($analysis);
ok($analysis->is_stored($cdba));
my $dta = $cdba->get_DensityTypeAdaptor();
my $dt = Bio::EnsEMBL::DensityType->new(
-analysis => $analysis,
-block_size => 4000,
-value_type => 'sum');
ok(!$dt->is_stored($cdba));
$dta->store($dt);
ok($dt->is_stored($cdba));
my $df = Bio::EnsEMBL::DensityFeature->new(
-seq_region => $slice,
-start => $slice->{'start'},
-end => $slice->{'end'},
-density_type => $dt,
-density_value => 5 );
my $dfa = $cdba->get_DensityFeatureAdaptor();
$dfa->store(($df));
my $features = $dfa->fetch_all_by_Slice($strain_slice, 'SNPDensity', 10, 1);
is( @$features, 10, "Number of stored SNP densities");
$multi_db->restore('core', 'analysis');
$multi_db->restore('core', 'density_type');
$multi_db->restore('core', 'density_feature');
my $variation_adaptor = $vdba->get_VariationAdaptor;
my $vfs = $vf_adaptor->fetch_all_by_Slice($slice);
my $vf = $vfs->[0];
my $A_J = Bio::EnsEMBL::Variation::StrainSlice->new(
-START => $slice->{'start'},
-END => $slice->{'end'},
-STRAND => $slice->{'strand'},
-ADAPTOR => $slice->adaptor(),
-SEQ => $slice->{'seq'},
-SEQ_REGION_NAME => $slice->{'seq_region_name'},
-SEQ_REGION_LENGTH => $slice->{'seq_region_length'},
-COORD_SYSTEM => $slice->{'coord_system'},
-STRAIN_NAME => 'A/J');
my $FVB_NJ = Bio::EnsEMBL::Variation::StrainSlice->new(
-START => $slice->{'start'},
-END => $slice->{'end'},
-STRAND => $slice->{'strand'},
-ADAPTOR => $slice->adaptor(),
-SEQ => $slice->{'seq'},
-SEQ_REGION_NAME => $slice->{'seq_region_name'},
-SEQ_REGION_LENGTH => $slice->{'seq_region_length'},
-COORD_SYSTEM => $slice->{'coord_system'},
-STRAIN_NAME => 'FVB/NJ');
my $with_coverage = 1;
my $display_slice_name = $A_J->display_Slice_name;
ok($display_slice_name eq 'A/J', 'display_slice_name');
$strain_name = $A_J->strain_name;
ok($strain_name eq 'A/J', 'strain_name');
my $sample = $A_J->sample;
ok($sample && $sample->isa('Bio::EnsEMBL::Variation::Sample'), 'isa Bio::EnsEMBL::Variation::Sample');
ok($sample->name eq 'A/J', 'sample name');
my $seq = $A_J->seq;
ok(length($seq) == 4002, 'seq length');
$seq = $A_J->seq($with_coverage);
ok(length($seq) == 4002, 'seq length');
my $expanded_length = $A_J->expanded_length;
ok($expanded_length == 4002, 'expanded length');
my $a_j_vfs = $A_J->get_all_VariationFeatures();
ok(scalar @$a_j_vfs == 189, 'get_all_VariationFeatures');
my $variation = $variation_adaptor->fetch_by_name('rs46873854');
$vfs = $vf_adaptor->fetch_all_by_Variation($variation);
$vf = $vfs->[0];
my $af = $A_J->get_AlleleFeature($vf);
ok($vf->allele_string eq 'C/T', 'VF allele_string');
ok($af->allele_string eq 'T|T', 'AF allele_string');
ok($af->ref_allele_string eq 'C', 'AF ref_allele_string');
my $afs = $A_J->get_all_AlleleFeatures_Slice();
ok(scalar @$afs == 46, 'get_all_AlleleFeatures_Slice');
$afs = $A_J->get_all_AlleleFeatures_Slice($with_coverage);
ok(scalar @$afs == 46, 'get_all_AllelelFeatures_Slice with_coverage');
$afs = $A_J->get_all_differences_StrainSlice($FVB_NJ);
ok(scalar @$afs == 53, 'get_all_differences_StrainSlice');
my $sub_Slice = $A_J->sub_Slice(2, 12, 1);
ok(length($sub_Slice->seq) == 11, 'sub_Slice length');
my $ref_subseq = $A_J->ref_subseq(20380187, 20380197, 1);
ok(length($ref_subseq) == 11, 'ref_subseq length');
my $subseq = $A_J->subseq(1, 10, 1);
ok($subseq eq 'CACTGTTCCC', 'subseq');
my $position = $A_J->get_original_seq_region_position(20);
ok($position == 20, 'get_original_seq_region_position');
done_testing();
}
| 35.364706 | 104 | 0.644045 |
ed4b9652a0edb3817553fb431d4f8a20d7fddb33 | 36,270 | pl | Perl | bin/checkids.pl | pinggit/plwe | b47fe5dae6f14be23e865c859aa9c58bd4dd038b | [
"MIT"
]
| null | null | null | bin/checkids.pl | pinggit/plwe | b47fe5dae6f14be23e865c859aa9c58bd4dd038b | [
"MIT"
]
| null | null | null | bin/checkids.pl | pinggit/plwe | b47fe5dae6f14be23e865c859aa9c58bd4dd038b | [
"MIT"
]
| 1 | 2019-10-24T15:12:04.000Z | 2019-10-24T15:12:04.000Z | #!/usr/bin/perl
# Copyright (c) 2003-2008 Juniper Networks Inc. All rights reserved.
#
# Change history:
# 2003/08/01 - ckim - add uidToNameTable.cfg decode.
# 2003/07/31 - ckim - Initial coding.
# 2008/04/21 - ckim - added Disclaimer (by DDugal), comment out cfgsToListIndex
#
# Disclaimer:
# Juniper Networks is providing this script on an "AS IS" basis.
# No warranty or guarantee of any kind is expressed in this script and none
# should be implied. Juniper Networks expressly excludes and disclaims any
# warranties regarding this script or materials referred to in this script,
# including, without limitation, any implied warranty of merchantability,
# fitness for a particular purpose, absence of hidden defects, or of
# noninfringement. Your use or reliance on this script or materials referred
# to in this script is at your own risk.
#
# Juniper Networks may change this notice or script at any time.
#
########
use integer ;
#use strict;
#
package cnfFile;
use constant MIN_HD_SIZE => 73 ;
#
#
%cfgsToSave = ();
#%cfgsToListIndex = ( "atm1483DataServiceCircuits.cfg", 1 );
%cfgsToListIndex = ( 1 );
#
# printIndex( $id, $count );
sub printIndex {
my ($id, $count) = @_ ;
# my $count = shift;
# my $count = shift;
printf "%02x ", unpack( "C", substr($id, 0, 1) );
for( my $i = 1 ; $i < length $id ; $i++ ){
printf "%02x", unpack( "C", substr( $id, $i, 1 ) ) ;
}
print " - $count entries" if $count ;
print "\n" ;
}
sub readHd {
my $self = shift;
my $lineBuf = "";
my $hdBuf = "";
### print "-" x 20 . "\n" ;
# Hd Sz 105\nVer 1 0\nTS 1058436706\nTyp 0\nIs cl 1\nBHd Sz 74\nD Sz 58980\n
$self->{rtnSz} = MIN_HD_SIZE ;
return "Error: Hd Read, $self->{leftSz} left"
if(MIN_HD_SIZE != read( $self->{fd}, $hdBuf, MIN_HD_SIZE )) ;
if( $hdBuf =~ /Hd Sz\s+(\d+)\nVer 1 0\nTS (\d+)\nTyp 0\nIs cl (\d)\nBHd Sz\s+(\d+)\nD Sz\s+(\d+)\n/ ){
$self->{HdSz} = $1 ; $self->{TS} = $2 ; $self->{Iscl} = $3 ; $self->{BHdSz} = $4 ; $self->{DSz} = $5 ;
if( ($self->{BHdSz} < MIN_HD_SIZE) || ($self->{HdSz} < $self->{BHdSz}) || ($self->{Iscl} > 1)
|| ($self->{DSz} < 12 ) ){
return "Error:[B Hd data" ;
}
} else { return "Hd Fmt Error" ; }
#
read( $self->{fd}, $lineBuf, $self->{BHdSz} - MIN_HD_SIZE );
$self->{rtnSz} = $self->{BHdSz} ;
chomp($lineBuf);
$self->{cfgName} = $lineBuf ;
### printf "%x %.6d %s\n", $self->{TS}, $self->{DSz}, $self->{cfgName};
#
if( $self->{Iscl} == 1 ){
read( $self->{fd}, $lineBuf, $self->{HdSz} - $self->{BHdSz} );
### print $lineBuf;
$self->{rtnSz} = $self->{HdSz} ;
$self->{cnfSz} = $self->{leftSz} = $self->{DSz} ;
$self->{unresCnt} = 0;
$self->{warnMsg} = "";
return "OK";
}
# cfg name
bless $self;
return readData($self);
}
###############
use constant DATA_SIGNATURE => 0xabbadaba ;
use constant MIN_DATA_SIZE => 12 ;
#
sub readData {
my $self = shift ;
return "Error: Data size" if( $self->{DSz} < MIN_DATA_SIZE ) ;
$self->{rtnSz} = $self->{DSz} + $self->{HdSz} + 2 ;
$self->{leftSz} -= $self->{rtnSz};
return "Error: Read Data"
if(read( $self->{fd}, $self->{dBuf}, ($self->{DSz}+2)) != ($self->{DSz}+2)) ;
($self->{sign}, $self->{s1}, $self->{s2}, $self->{n1})
= unpack( "NnnN", substr($self->{dBuf}, 0, MIN_DATA_SIZE) );
if( $self->{cfgName} eq "coreDump.cfg" ){
#00 00 00 04 00 00 01 3C 00 00 02 02 00 00 00 02
for( my $j = 0 ; $j < 40 ; $j += 4){
### printf "%08x ", unpack( "N", substr( $self->{dBuf}, $j, 4 ) );
}
### print "\n" ;
return "OK" ;
}
# check signature
print "Error: Data signature\n" if $self->{sign} != DATA_SIGNATURE ;
# print 2 long words
### printf "%04x %04x %08x($self->{n1})", $self->{s1}, $self->{s2}, $self->{n1} ;
if( $self->{s1} == 0x3000 ){
$self->{idSize} = unpack( "N", substr( $self->{dBuf}, 12, 4 ) ) ;
$self->{rsize} = $self->{n1} + $self->{idSize} + 1;
### printf " : id size = %04x($self->{idSize})\n", $self->{idSize} ;
} elsif( $self->{s1} == 0x5000 ){
$self->{idSize} = 0 ;
$self->{rsize} = $self->{n1} + $self->{idSize} + 1;
### print "\n" ;
} elsif( $self->{s1} == 0x4000 ){
$self->{idSize} = 0 ;
$self->{rsize} = $self->{n1} + $self->{idSize} ;
### print "\n" ;
} else {
print "ERROR: non-30,40,50\n"
}
#
#
### return hostmap_cfg($self) if( $self->{cfgName} =~ /^hostmap\// ) ;
$self->{cfgCode} = $self->{cfgName} ;
$self->{cfgCode} =~ s/[\/.]/_/g ;
# save corrupted files
# if( $self->{sign} != DATA_SIGNATURE ){
# save specific files
if(exists $cfgsToSave{$self->{cfgName}}) {
open( BADFILE, ">$self->{cfgCode}" ) ;
syswrite BADFILE, $self->{dBuf} ;
close BADFILE ;
}
### return &{$self->{cfgCode}}($self) if( defined &{$self->{cfgCode}} ) ;
#
### $self->{unResolved} .= "$self->{cfgName} ";
### $self->{unresCnt} ++ ;
if( $self->{s1} == 0x3000 ){
my %ids = () ;
my $idSize = $self->{idSize} ;
my %oops = () ;
my $cfgName = $self->{cfgName};
if(exists $cfgsToListIndex{$cfgName}) {
print "Listing Index of $cfgName\n" ;
}
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
$id = substr( $self->{dBuf}, $i, $idSize+1 );
if(exists $cfgsToListIndex{$cfgName}){
printIndex($id);
}
# conitnue if first byte(flag) is 0x7f (deleted)
# value is expected to be zeros
next if ord($id) == 0x7f ;
if( exists $ids{$id} ) {
$ids{$id}++ ;
$oops{$id} = $ids{$id};
} else {
$ids{$id} = 1;
}
}
@ks = keys( %oops );
if( $#ks != -1 ){
print "!!!!!!!!!!!!! $cfgName : " . ($#ks+1) . " duplicate ids.\n" ;
for my $id (sort keys %oops) {
printIndex($id, $oops{$id});
# for( my $ii = 0 ; $ii < length $id ; $ii++ ){
# printf "%02x", unpack( "C", substr( $id, $ii, 1 ) ) ;
# }
# print " - " . ($oops{$id} +1) . " entries\n" ;
}
}
## if
##%dups{ for( my $ii = 0 ; $ii < $idSize+1 ; $ii++ ){
## printf "%02x", unpack( "C", substr( $id, $ii, 1 ) ) ;
## }
## print "\n" ;
## }
## }
### } elsif( $self->{s1} == 0x5000 ){
### for( my $i = 12; $i < $self->{DSz} ; $i += $self->{rsize} ){
# printf "%02x", unpack( "C", substr( $self->{dBuf}, $i, 1 );
### my $ff = unpack( "C", substr( $self->{dBuf}, $i, 1 ) );
### printDel($ff) ;
### for( my $j = 1 ; $j < 40 ; $j += 4){
### printf " %08x", unpack( "N", substr( $self->{dBuf}, ($j + $i), 4 ) );
### }
### print "\n" ;
### }
### } else {
### for my $i ( 12 .. ($self->{DSz} - 1) ){
# printf "%02x", unpack( "C", substr( $self->{dBuf}, $i, 1 );
### my $ff = unpack( "C", substr( $self->{dBuf}, $i, 1 ) );
### printDel($ff) ;
### last if $i >= 32 ;
### }
### print "\n" ;
}
return "OK" ;
}
########################
#
sub printDel {
my $aFlag = shift;
if($aFlag == 0xff){
print " " ;
} elsif($aFlag == 0x7f){
print "--" ;
} else {
printf "%02x", aFlag ;
}
}
########################
#system.cfg
#cli.cfg
sub cli_cfg {
#AB BA DA BA 30 00 00 0b 00 00 00 98 00 00 00 02
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CnA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%04x> ", $id ;
for( my $j = 0 ; $j < 80 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
# my($lw1, $str1, $bw1, $str2) = unpack( "NZ20CZ15", $unknown );
# printf "%x \"$str1\" %x \"$str2\"\n", $lw1, $bw1 ;
}
return "OK" ;
}
#cliVtyCfg.cfg
#cliMisc.cfg
#cliXyzzy.cfg
#console.cfg
sub console_cfg {
#AB BA DA BA 30 00 00 02 00 00 00 08 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $v1, $v2) = unpack( "CNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %08x %08x\n", $id, $v1, $v2 ;
}
return "OK" ;
}
#httpd.cfg
#lineAttrib.cfg
#log.cfg
sub log_cfg {
#AB BA DA BA 30 00 00 04 00 00 00 01 00 00 00 20
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $val)
= unpack( "CA32C", substr( $self->{dBuf}, $i, $self->{rsize} ) );
next if($val == 0xe3) ;
printDel($ff) ;
my $sev = $val / 16 ;
print "log sev $sev $id\n" ;
print "log ber high $id\n" if($val & 0x08) ;
}
return "OK" ;
}
#logFilters.cfg
#logMeta.cfg
#nvs.cfg
#syslog.cfg
#syslogSources.cfg
#timezone.cfg
#uidToNameTable.cfg
sub uidToNameTable_cfg {
#AB BA DA BA 30 00 0F A0 00 00 02 00 00 00 00 04
#AB BA DA BA 30 00 00 00 00 00 01 00 00 00 00 04
my $self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
if( $self->{n1} == 0x0200 ){ # $self->{s2} = 0x0fa0
my($ff, $id, $name, $desc)
= unpack( "CNZ256Z256", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> \"%s\" \"%s\"\n", $id, $name, $desc ;
} elsif( $self->{n1} == 0x0100 ){ # $self->{s2} = 0x0000
my($ff, $id, $name)
= unpack( "CNZ256", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> \"%s\"\n", $id, $name ;
} else { # unknown
$self->{warnMsg} .= "uidToNameTable.cfg - unknown leng ($self->{n1})\n" ;
my($ff, $id, $name)
= unpack( "CNZ256", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> \"%s\"\n", $id, $name ;
}
}
return "OK" ;
}
#vtyBanners.cfg
#coreDump.cfg
#IkeConfigurationParameters.cfg
#TmSeed.cfg
#TmTbl.cfg
sub TmTbl_cfg {
#AB BA DA BA 30 00 0F A0 00 00 02 00 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $nameLeng, $name, $id)
= unpack( "CNZ80N", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "($nameLeng) $name <%08x>\n", $id ;
$self->{warnMsg} .= "TmTbl.cfg leng too long ($nameLeng)\n"
if( $nameLeng > 80 );
# $id will be used for pppProfiles.cfg ...
}
return "OK" ;
}
#aaa/aaaBrasLicenseFile.cfg
#aaa/aaaDomainToRouterConfigFile.cfg
sub aaa_aaaDomainToRouterConfigFile_cfg {
#AB BA DA BA 30 00 00 15 00 00 03 68 00 00 00 40
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
if( $self->{s2} == 0x15 ){ # $self->{n1} == 0x0368
my($ff, $domainId, $vRouter, $ext, $loo)
= unpack( "CA64A64A450A4", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
print "aaa domain $domainId virtual-router $vRouter loopback $loo\n" ;
} else {
$self->{warnMsg} .= "aaa/aaaDomainToRouterConfigFile.cfg - unknown ver ($self->{s2})\n" ;
my($ff, $domainId, $vRouter)
= unpack( "CA64A64", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
print "aaa domain $domainId virtual-router $vRouter\n" ;
}
}
return "OK" ;
}
#aaa/aaaGlobalConfigFile.cfg
#aaa/aaaMethodConfigFile.cfg
#aaa/aaaMorePerServerConfigFile.cfg
#aaa/aaaPerServerConfigFile.cfg
#aaa/aaaPerSessionConfigFile.cfg
#aaa/aaaTunnelConfigFile.cfg
#aaa/ar1InterfaceConfigFile.cfg
#ar1CmCfgChecker.cfg
#ar1Ds1.cfg
#ar1Ds1Uid.cfg
#ar1Ds3.cfg
#ar1Ds3Uid.cfg
#ar1Ethernet.cfg
#ar1EthernetUid.cfg
sub ar1EthernetUid_cfg {
#AB BA DA BA 30 00 00 01 00 00 00 04 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $v1) = unpack( "CNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %08x\n", $id, $v1 ;
}
return "OK" ;
}
#ar1Hdlc.cfg
#ar1HdlcUid.cfg
#ar1Scm.cfg
#ar1ScmUid.cfg
#ar1Sonet.cfg
#ar1SonetUid.cfg
sub ar1SonetUid_cfg {
#AB BA DA BA 30 00 00 01 00 00 00 04 00 00 00 10
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id1, $id2, $id3, $id4, $v1) = unpack( "CNNNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%08x-%08x-%08x> %08x\n", $id1, $id2, $id3, $id4, $v1 ;
}
return "OK" ;
}
#ar1System.cfg
#atm.cfg
#atm1483DataService.cfg
#atm1483DataServiceCircuits.cfg
#atm1483DataServiceInterfaces.cfg
#atm1483StaticMap.cfg
#atm1483StaticMapEntry.cfg
#atmAal5.cfg
#atmAal5Interfaces.cfg
#atmF4OamCircuit.cfg
#atmInterfaces.cfg
sub atmInterfaces_cfg {
#AB BA DA BA 30 00 0f a2 00 00 08 a0 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#bgp/addressFamilies.cfg
sub bgp_addressFamilies_cfg {
#AB BA DA BA 30 00 0f a0 00 00 00 70 00 00 00 2c
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $vr, $strID, $l1, $l2, $unknown) = unpack( "CNA32NNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%32s-%08x-%08x> ", $vr, $strID, $l1, $l2 ;
for( my $j = 0 ; $j < 12 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#bgp/aggregates.cfg
#bgp/bgp.cfg
#bgp/confederationPeers.cfg
#bgp/networks.cfg
#bgp/peerAfs.cfg
#bgp/peerGroupAfs.cfg
#bgp/peerGroups.cfg
#bgp/peers.cfg
#bgp/vrfs.cfg
sub bgp_vrfs_cfg {
#AB BA DA BA 30 00 10 04 00 00 00 38 00 00 00 28
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $vr, $strID, $l1, $unknown) = unpack( "CNA32NA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%32s-%08x> ", $vr, $strID, $l1 ;
for( my $j = 0 ; $j < 12 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#bridgedEthernet.cfg
#bridgedEthernetInterfaces.cfg
#bulkfiles.cfg
#bulkrsxfaces.cfg
#bulkscalar.cfg
#bulksels.cfg
#cacIntf.cfg
#cbf/cbf.cfg
#cbf/connections.cfg
#cbf/interfaces.cfg
#claclId.cfg
#cliAaaNewModel.cfg
#dcmProfAssign.cfg
#dhcp.cfg
#dhcpExAdd.cfg
sub dhcpExAdd_cfg {
#AB BA DA BA 30 00 00 00 00 00 00 04 00 00 00 0C
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $l1, $l2, $l3) = unpack( "CNNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %08x %08x %08x\n", $id, $l1, $l2, $l3 ;
}
return "OK" ;
}
#dhcpPool.cfg
#dhcpPrx.cfg
#dhcpPrxConfig.cfg
#dhcpRel.cfg
sub dhcpRel_cfg {
#AB BA DA BA 30 00 00 02 00 00 00 08 00 00 00 08
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $ip, $l1, $l2) = unpack( "CNA4NN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%s> 0x%x, 0x%x\n", $id, strIP($ip), $l1, $l2 ;
}
return "OK" ;
}
#dhcpRelConfig.cfg
#dhcpRsvdAdd.cfg
#dhcpSvr.cfg
#dnsClientResolverBindingGroup.cfg
#dnsConfigGroup.cfg
#dnsLocalDomainGroup.cfg
sub dnsLocalDomainGroup_cfg {
#AB BA DA BA 30 00 00 01 00 00 04 08 00 00 00 08
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id1, $id2, $unknown) = unpack( "CNNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%08x> ", $id1, $id2 ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#dnsSbeltGroup.cfg
#ds1.cfg
#ds1Interfaces.cfg
#ds3.cfg
#ds3Interfaces.cfg
#dvmrpAclDistNbr.cfg
#dvmrpGlobalGrp.cfg
#dvmrpIfGrp.cfg
#dvmrpSummaryAddrGroup.cfg
#entPhysical.cfg
#ethernetInterfaces.cfg
sub ethernetInterfaces_cfg {
#AB BA DA BA 30 00 00 04 00 00 00 54 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#ethernetSubInterfaces.cfg
#ethernetSubUidSeed.cfg
#ethernetVlanMajorUidSeed.cfg
#ethernetVlanSubUidSeed.cfg
#fileSysAgent.cfg
#fileSysAgentScalar.cfg
#frameRelay.cfg
#frameRelayBundle.cfg
#frameRelayCircuits.cfg
#frameRelayMajor.cfg
#frameRelayMajorInterfaces.cfg
#frameRelayMapClassInterfaces.cfg
#frameRelayMapClasses.cfg
#frameRelayMultilink.cfg
#frameRelayMultilinkInterfaces.cfg
#frameRelaySub.cfg
#frameRelaySubInterfaces.cfg
#ft1.cfg
#ft1Interfaces.cfg
#ftpClientSettings.cfg
#ftpServer.cfg
#hdlc.cfg
#hdlcHssiInterfaces.cfg
#hdlcInterfaces.cfg
#hdlcV35Interfaces.cfg
#hostmap/2147483649.cfg
sub hostmap_cfg {
#AB BA DA BA 30 00 00 03 00 00 00 80 00 00 00 30
$self = shift;
my($id, $hostname, $ll0, $ip1, $ip2, $ip3, $ip4, $mask, $fid, $fpw, $ll1, $ll2, $fid2, $ll3, $ll4, $fpw2, $ll5)
= unpack( "NZ40NCCCCNZ21Z23NNZ24NNZ32N", substr( $self->{dBuf}, 17, $self->{rsize} ) );
printDel($id) ;
print "host $hostname $ip1.$ip2.$ip3.$ip4 $fid $fpw\n" ;
printf "! %08x %08x %08x %08x %08x %08x\n", $ll0, $ll1, $ll2, $ll3, $ll4, $ll5 ;
return "OK" ;
}
#http/deamon.cfg
#http/scalar.cfg
#igmpGlobalGroup.cfg
#igmpGrpGroup.cfg
#igmpIntfGroup.cfg
#igmpProfileGroup.cfg
#igmpProfileGrpGroup.cfg
#igmpProxyIntfGroup.cfg
#ikePolicyRule.cfg
#ikePreSharedKey.cfg
#ipASPAccLst.cfg
#ipAccListFilter.cfg
sub ipAccListFilter_cfg {
#AB BA DA BA 30 00 0F A0 00 00 00 04 00 00 00 48
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $sName, $rId, $aName, $l1, $l2)
= unpack( "CZ32NZ32NN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "$sName <%08x> $aName, $l1, $l2\n", $rId ;
}
return "OK" ;
}
#ipAccLst.cfg
sub ipAccLst_cfg {
#AB BA DA BA 30 00 0F A0 00 00 00 24 00 00 00 28
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $rId, $aName, $aId, $isDeny, $ip1, $ip2, $ip3, $ip4, $m1, $m2, $m3, $m4, $ip5, $ip6, $ip7, $ip8, $m5, $m6, $m7, $m8, $l1, $l2, $l3, $l4)
= unpack( "CNZ32NNCCCCCCCCCCCCCCCCNNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> $aName <$aId>\n", $rId ;
print $isDeny ? " deny " : " permit " ;
print "ip $ip1\.$ip2\.$ip3\.$ip4-$m1\.$m2\.$m3\.$m4 - $ip5\.$ip6\.$ip7\.$ip8-$m5\.$m6\.$m7\.$m8 [$l1, $l2, $l3]" ;
print $l4 ? " filter\n" : "\n" ;
print "\n" ;
}
return "OK" ;
}
#ipAddGrp.cfg
sub ipAddGrp_cfg {
#AB BA DA BA 30 00 0f a0 00 00 00 1c 00 00 00 08
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id1, $id2, $unknown) = unpack( "CNNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%08x> ", $id1, $id2 ;
for( my $j = 0 ; $j < $self->{n1} ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#ipCommAccLst.cfg
#ipDampingParams.cfg
#ipDynRedist.cfg
#ipExtCommLst.cfg
#ipGroup.cfg
sub ipGroup_cfg {
#AB BA DA BA 30 00 10 05 00 00 00 60 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $l1, $l2, $l3, $ss1, $st1, $ss2, $l4, $l5, $l6 )
= unpack( "CNNNNnA12nNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %x, %x, %x, %x, %s, %x, %x, %x, %x\n",
$id, $l1, $l2, $l3, $ss1, $st1, $ss2, $l4, $l5, $l6 ;
}
return "OK" ;
}
#routerId.cfg
#ipInterfaceId.cfg
#ipIntf.cfg
sub ipIntf_cfg {
#AB BA DA BA 30 00 10 04 00 00 00 58 00 00 00 08
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id1, $id2, $unknown) = unpack( "CNNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%08x> ", $id1, $id2 ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#ipMcastStatRt.cfg
#ipN2Med.cfg
#ipPolicyAsPathId.cfg
#ipPolicyExtCommId.cfg
#ipPolicyId.cfg
#ipPolicyLog.cfg
#ipPreLst.cfg
sub ipPreLst_cfg {
#AB BA DA BA 30 00 0f a0 00 00 00 54 00 00 00 24
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $strID, $unknown) = unpack( "CNA32A$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%32s> ", $id, $strID ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#ipPreLstEnt.cfg
sub ipPreLstEnt_cfg {
#AB BA DA BA 30 00 0f a0 00 00 00 14 00 00 00 28
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $strID, $id2, $unknown) = unpack( "CNA32NA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%32s-%02x> ", $id, $strID, $id2 ;
for( my $j = 0 ; $j < 20 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#ipPreTr.cfg
#ipPreTrEnt.cfg
#ipRedist.cfg
#ipRtMap.cfg
sub ipRtMap_cfg {
#AB BA DA BA 30 00 0F A0 00 00 00 08 00 00 00 28
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $name, $tag, $l1, $l2)
= unpack( "CNZ32NNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%32s-$tag> $l1, $l2\n", $id, $name ;
}
return "OK" ;
}
#ipRtMapEnt.cfg
sub ipRtMapEnt_cfg {
#AB BA DA BA 30 00 0F A0 00 00 00 34 00 00 00 30
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $name, $tag, $l1, $l2, $d1, $d2, $d3, $d4, $str, $d5)
= unpack( "CNZ32NNNNNNNZ32N", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%32s-$tag-$l1-$l2> $d1, $d2, $d3, $d4, \"$str\", $d5\n", $id, $name ;
}
return "OK" ;
}
#ipStatRt.cfg
sub ipStatRt_cfg {
#AB BA DA BA 30 00 10 04 00 00 00 10 00 00 00 18
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $ip1, $ip2, $t1, $ipn, $t2, $d1, $d2, $d3, $d4) =
unpack( "CNA4A4NA4NNNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%s/%s-%d-%s-%d> 0x%08x,0x%04x, %d, %d\n",
$id, strIP($ip1), strIP($ip2), $t1, strIP($ipn), $t2, $d1, $d2, $d3, $d4 ;
}
return "OK" ;
}
#ipTem.cfg
#ipTem1.cfg
#ipTunnel.cfg
#ipTunnelInterfaces.cfg
#ipVrfRouteMap.cfg
#ipVrfRouteTarget.cfg
sub ipVrfRouteTarget_cfg {
#AB BA DA BA 30 00 0f a0 00 00 00 09 00 00 00 0c
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $vr, $id1, $id2, $l1, $l2, $c1) =
unpack( "CNNNNNC", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%08x-%08x> %08x %08x,%02x\n", $vr, $id1, $id2, $l1, $l2, $c1 ;
}
return "OK" ;
}
#isisAreaAuthenticationGrp.cfg
#isisCircGrp.cfg
#isisDomainAuthenticationGrp.cfg
#isisGroup.cfg
#isisHostNameGrp.cfg
#isisIntfL1AuthenticationGrp.cfg
#isisIntfL2AuthenticationGrp.cfg
#isisManAreaAddGrp.cfg
#isisPassiveIntfGrp.cfg
#isisSummGrp.cfg
#l2f.cfg
#l2fChassis.cfg
#l2fDestinationProfiles.cfg
#l2fDestinations.cfg
#l2fHostProfiles.cfg
#l2fSessions.cfg
#l2fTunnels.cfg
#l2tp.cfg
#l2tpChassis.cfg
#l2tpDestinationProfiles.cfg
#l2tpDestinations.cfg
#l2tpHostProfiles.cfg
#l2tpSessions.cfg
#l2tpTunnels.cfg
#las.cfg
#lasRange.cfg
#mgtmGlobalGroup.cfg
#mplsExplicitPath.cfg
#mplsExplicitPathNode.cfg
#mplsFiconTraceMasks.cfg
#mplsFiconUidSeed.cfg
#mplsLdpLabelAdvAccList.cfg
#mplsLdpProfile.cfg
#mplsLsr.cfg
#mplsMajorInterface.cfg
#mplsMajorInterfaceUidSeed.cfg
#mplsMinorInterface.cfg
#mplsMinorInterfaceUidSeed.cfg
#mplsPathOption.cfg
#mplsRsvpProfile.cfg
#mplsTargetInterface.cfg
#mplsTunnelProfile.cfg
#mplsTunnelProfileDynEndpoints.cfg
#mplsTunnelProfileStaticEndpoints.cfg
#ntpGlobalGrp.cfg
#ntpIfGrp.cfg
#ntpServerGrp.cfg
#ntpVrConfigGrp.cfg
#ospfAggRange.cfg
#ospfArea.cfg
#ospfGeneral.cfg
#ospfIntf.cfg
#ospfIpIntf.cfg
#ospfMd5IntfKeys.cfg
#ospfMd5VirtIntfKeys.cfg
#ospfNbr.cfg
#ospfNetRange.cfg
sub ospfNetRange_cfg {
#AB BA DA BA 30 00 00 01 00 00 00 01 00 00 00 10
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
# ff router-id ospf-area ip-add ip-mask ??
my($ff, $id, $area, $ip, $mask, $dt)
= unpack( "CNA4A4A4C", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%s-%s-%s> %02x\n",
$id, strIP($area), strIP($ip), strIP($mask), $dt ;
}
return "OK" ;
}
#ospfRemoteNbr.cfg
#ospfStub.cfg
#ospfSummImport.cfg
#ospfVirtIf.cfg
#pimAccessListTable.cfg
#pimCandRPTable.cfg
#pimDomainInfoTable.cfg
#pimGeneralGroup.cfg
#pimIntfTable.cfg
#pimRPSetTable.cfg
#pimRemoteNbrTable.cfg
#policyId.cfg
#policyMgrClaclIcmpTable.cfg
#policyMgrClaclIgmpTable.cfg
#policyMgrClaclPortTable.cfg
#policyMgrClaclRuleTable.cfg
#policyMgrClaclTable.cfg
#policyMgrColorRuleTable.cfg
#policyMgrFilterRuleTable.cfg
#policyMgrForwardRuleTable.cfg
#policyMgrLogRuleTable.cfg
#policyMgrMarkingRuleTable.cfg
#policyMgrNextHopRuleTable.cfg
#policyMgrNextInterfaceRuleTable.cfg
#policyMgrPolicyIfTable.cfg
#policyMgrPolicyTable.cfg
#policyMgrPolicyTemplateTable.cfg
#policyMgrRateLimitProfileTable.cfg
#policyMgrRateLimitRuleTable.cfg
#policyMgrTrafficClassRuleTable.cfg
#ppp.cfg
#pppBundle.cfg
#pppIfAlias.cfg
#pppInterfaces.cfg
#pppLink.cfg
#pppLinkIfAlias.cfg
#pppLinkInterfaces.cfg
#pppNetwork.cfg
#pppNetworkIfAlias.cfg
#pppNetworkInterfaces.cfg
#pppProfiles.cfg
sub pppProfiles_cfg {
#AB BA DA BA 30 00 00 0D 00 00 00 18 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $v1, $v2, $v3, $v4, $v5, $v6)
= unpack( "CNNNNNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %08x-%08x-%08x-%08x-%08x-%08x\n", $id, $v1, $v2, $v3, $v4, $v5, $v6 ;
}
return "OK" ;
}
#pppoeAcCookieSeed.cfg
#pppoeMajor.cfg
#pppoeMajorSeed.cfg
#pppoeProfiles.cfg
#pppoeRedbackMode.cfg
#pppoeSub.cfg
#pppoeSubSeed.cfg
#pppoeTemplate.cfg
#qos/interfaceQosAttachment.cfg
#qos/profile.cfg
sub qos_profile_cfg {
#AB BA DA BA 30 00 00 01 00 00 00 10 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $v1, $v2, $v3, $v4)
= unpack( "CNNNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %08x-%08x-%08x-%08x\n", $id, $v1, $v2, $v3, $v4 ;
}
return "OK" ;
}
#qos/qosMgr.cfg
#qos/qosModePort.cfg
#qos/qosProfile.cfg
sub qos_qosProfile_cfg {
#AB BA DA BA 30 00 00 01 00 00 00 60 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $l1, $str, $unknown) =
unpack( "CNNA32A60", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %x-%32s ", $id, $l1, $str ;
for( my $j = 0 ; $j < 60 ; $j += 4){
printf "%x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#qos/qosProfileEntry.cfg
#qos/queueProfile.cfg
#qos/schedulerProfile.cfg
#qos/trafficClass.cfg
#qos/trafficClassGroup.cfg
#qos/trafficClassGroupEntry.cfg
#radius/radiusAccounting.cfg
#radius/radiusAuthentication.cfg
#radius/radiusPerServerConfigFile.cfg
#radius/radiusPerServerMoreConfigFile.cfg
#remOps/pingControl.cfg
#remOps/traceControl.cfg
#ripCfgNbrGrp.cfg
#ripGlobalGrp.cfg
#ripIfGrp.cfg
#ripNetworkGrp.cfg
sub ripNetworkGrp_cfg {
#AB BA DA BA 30 00 00 00 00 00 00 04 00 00 00 0C
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $vr, $ip, $msk, $l1) = unpack( "CNA4A4N", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%s/%s> %08x\n", $vr, strIP($ip), strIP($msk), $l1 ;
}
return "OK" ;
}
#ripSummAddrGrp.cfg
sub ripSummAddrGrp_cfg {
#AB BA DA BA 30 00 00 02 00 00 00 02 00 00 00 0C
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $vr, $ip, $msk, $c1, $c2) = unpack( "CNA4A4CC", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x-%s/%s> %02x%02x\n", $vr, strIP($ip), strIP($msk), $c1, $c2 ;
}
return "OK" ;
}
#rlpId.cfg
#routerTunIpReasm.cfg
#slep.cfg
#slepInterfaces.cfg
#slotDb.cfg
sub slotDb_cfg {
#AB BA DA BA 30 00 00 03 00 00 00 05 00 00 00 01
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $v1, $v2, $v3, $v4, $v5)
= unpack( "C7", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<$id> %02x($boardId{$v1})-%02x-%02x-%02x-%02x\n", $v1, $v2, $v3, $v4, $v5 ;
}
return "OK" ;
}
%boardId = (
1 => "SRP-5G", # Srp2G, /* SRP-5G */
2 => "Ct3",
3 => "Oc3Single",
4 => "Oc3Dual",
5 => "Oc3P2Single",
6 => "Oc3P2Dual",
7 => "Ct3P2",
8 => "Ut3a",
9 => "Ut3f",
0xa => "Ue3a",
0xb => "Ue3f",
0xc => "E1",
0xd => "SRP-10G", #Srp5G, /* SRP-10G non-ECC */
0xe => "Oc12Pos",
0xf => "Ct3P4", #/* CT3 with classifier */
0x10 => "Oc3P3Single", #/* OC3 with classifier */
0x11 => "Oc3P3Dual", #/* OC3 with classifier */
0x12 => "T1",
0x13 => "FeDual",
0x14 => "E1Full",
0x15 => "T1Full",
0x16 => "Oc12Atm",
0x17 => "Oc3QuadPos",
0x18 => "Oc3QuadAtm",
0x19 => "SRP-10GECC", # Srp5GEcc, /* SRP 5G with ECC -->> SRP-10G ECC */
0x1a => "GeFe", #/* generic GE/FE card (P1)*/
0x1b => "Fe8", #/* GE/FE card (P1) with FE8 IOA */
0x1c => "Vts",
0x1d => "Srp40G",
####
0x22 => "COcx",
0x23 => "12PtCt3", #/* 12 port CT3 */
0x24 => "OcxPos", #/* generic OcPos card used by SRP software only */
0x25 => "OcxAtm", #/* generic OcAtm card - used by SRP software only */
0x26 => "Oc12Server",
0x27 => "Hssi", #/* HSSI board same as the ut3f */
0x28 => "OcxAtmHybrid",
0x29 => "OcxPosP3",
0x2a => "GeFeP2", #/* Pass 2 generic Gigabit/Fast Ethernet card */
0x2b => "COc3", #/* channelized oc12 used by SRP software only */
0x2c => "COc12", #/* channelized oc3 used by SRP software only */
0x2d => "Oc3AtmHybrid", #/* oc3Atm Hybrid used by SRP software only */ /* OC3 quad port, ATM */
0x2e => "Oc12AtmHybrid", #/* oc12Atm Hybrid used by SRP software only */
0x2f => "Oc3PosP3", #/* oc3Pos pass 3 used by SRP software only */
0x30 => "Oc12PosP3", #/* oc12Pos pass 3 used by SRP software only */
0x31 => "OcxAtmHybridVe", #/* OCX ATM */
0x32 => "OcxPosP3Ve",
0x33 => "GeFeP2Ve",
0x34 => "Oc12ServerVe",
0x35 => "OC48-obsoleted",
0x38 => "Slc16", #/* 16 port serial line card (X21/V35) */
0x39 => "Ge", #/* GE/FE card (P1) with GE IOA */
0x3a => "GeP2", #/* GE/FE card pass 2 with GE IOA */
0x3b => "Fe8P2", #/* GE/FE card pass 2 with FE8 IOA */
0x3c => "Ut3F12", #/* Unchannelized 12 port ct3 */
0x3d => "COcxVe", #/* coc12 vrtx-e */
0x3e => "Srp40GPlus",
0x40 => "Srp5GPlus",
####
0x62 => "OC48" );
#smdsInterfaces.cfg
#smdsMajorInterfaces.cfg
#smdsSubInterfaces.cfg
#snmpAccessCfg.cfg
#snmpCommunityCfg.cfg
#snmpEngineCfg.cfg
#snmpGlobalCfg.cfg
#snmpNotifyCfg.cfg
#snmpNotifyFilterCfg.cfg
#snmpScalarCfg.cfg
#snmpTargetAddrCfg.cfg
#snmpTargetParamsCfg.cfg
#snmpTrapHostCfg.cfg
#snmpUserCfg.cfg
#snmpViewCfg.cfg
#sonetInterfaces.cfg
sub sonetInterfaces_cfg {
#AB BA DA BA 30 00 0a a1 00 00 00 f8 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#sonetPath.cfg
#sonetPathInterfaces.cfg
sub sonetPathInterfaces_cfg {
#AB BA DA BA 30 00 0f a1 00 00 01 2c 00 00 00 04
my $self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#sonetScalar.cfg
#sonetVT.cfg
#sonetVTInterfaces.cfg
#sshServer.cfg
sub sshServer_cfg {
# if( $self->{cfgName} eq "sshServer.cfg" ){
#AB BA DA BA 30 00 00 03 00 00 00 4c 00 00 00 04
my $self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#sssClient.cfg
#st.cfg
#stGlobalLifetime.cfg
#stInterfaces.cfg
#stLocalEndpoint.cfg
#stTransformSet.cfg
#tclId.cfg
#telnetport.cfg
sub telnetport_cfg {
#AB BA DA BA 30 00 00 00 00 00 00 04 00 00 00 04 FF 00 00 00 01 00 00 00 17
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $val) = unpack( "CNN", substr( $self->{dBuf}, $i, 9 ) );
printDel($ff) ;
printf "<%08x> = %d\n", $id, $val ;
}
return "OK" ;
}
#vlanMajorInterfaces.cfg
sub vlanMajorInterfaces_cfg {
#AB BA DA BA 30 00 00 02 00 00 00 54 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#vlanSubInterfaces.cfg
sub vlanSubInterfaces_cfg {
#AB BA DA BA 30 00 00 03 00 00 00 68 00 00 00 04
$self = shift;
for( my $i = 16; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $unknown) = unpack( "CNA$self->{n1}", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> ", $id ;
for( my $j = 0 ; $j < 40 ; $j += 4){
printf "%08x ", unpack( "N", substr( $unknown, $j, 4 ) );
}
print "\n" ;
}
return "OK" ;
}
#vrrp/vrrpAssoc.cfg
#vrrp/vrrpOper.cfg
#vrrp/vrrpRouter.cfg
#vrrp/vrrpScalar.cfg
##########################
sub vRouterGlobal_cfg {
#AB BA DA BA 50 00 0F A0 00 00 00 0C
#FF 80 00 00 42 80 00 00 01 00 00 00 00
$self = shift;
for( my $i = 12; $i < $self->{DSz} ; $i += $self->{rsize} ){
my($ff, $id, $id1, $id2) = unpack( "CNNN", substr( $self->{dBuf}, $i, $self->{rsize} ) );
printDel($ff) ;
printf "<%08x> %08x, %08x\n", $id, $id1, $id2 ;
}
return "OK" ;
}
###########################
###########################
sub strIP {
#strIP( substr( $i103, 0, 4 ) );
return sprintf( "%d.%d.%d.%d", unpack( "C4", shift ) );
}
###########################
sub new {
my ($this, $filePath) = @_;
my $class = ref($this) || $this;
my $self = {};
$self->{filePath} = $filePath;
open( $self->{fd}, $self->{filePath} ) or return undef;
binmode( $self->{fd} );
bless $self, $class;
# $self->initialize();
return $self;
}
###############
package main;
my $cnfFile = shift;
my $option = "" ;
if( $cnfFile =~ /^-/ ){
$option = $cnfFile ;
$cnfFile = shift ;
}
my $cF = cnfFile->new( $cnfFile );
my $readCount = 0;
my $headCount = 0;
while(1){
my $resultStr = "";
my $resultCount = 0;
$resultStr = $cF->readHd() ;
$readCount += $cF->{rtnSz};
$headCount++;
### print "$resultStr\n" if $resultStr ne "OK" ;
last if eof $cF->{fd} ;
}
### print "\n$headCount files ($cF->{unresCnt} unresolved), $readCount bytes read\n" ;
### print "Warning:\n$cF->{warnMsg}\n" ;
### print "Unresolved = $cF->{unResolved}\n" ;
die "\n$headCount files ($cF->{unresCnt} unresolved), $readCount bytes read\n" ;
########## | 29.22643 | 149 | 0.568211 |
ed196bcecec2ef7c1986fc82b3e342a28a9dbfb4 | 3,798 | t | Perl | t/error-extstore.t | stamhe/memcached | 894e4c16b5162e25ce649cf8a57dfad250965ab0 | [
"BSD-2-Clause",
"BSD-3-Clause"
]
| 9,700 | 2015-01-01T16:19:51.000Z | 2022-03-31T14:32:18.000Z | t/error-extstore.t | stamhe/memcached | 894e4c16b5162e25ce649cf8a57dfad250965ab0 | [
"BSD-2-Clause",
"BSD-3-Clause"
]
| 771 | 2015-01-01T06:59:05.000Z | 2022-03-30T05:53:00.000Z | t/error-extstore.t | stamhe/memcached | 894e4c16b5162e25ce649cf8a57dfad250965ab0 | [
"BSD-2-Clause",
"BSD-3-Clause"
]
| 2,909 | 2015-01-01T01:07:46.000Z | 2022-03-24T15:31:27.000Z | #!/usr/bin/perl
# Test the "Error on get" path for extstore.
# the entire error handling code for process_get_command() never worked, and
# would infinite loop. get_extstore() can hit it sometimes.
use strict;
use warnings;
use Test::More;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
my $ext_path;
if (!supports_extstore()) {
plan skip_all => 'extstore not enabled';
exit 0;
}
$ext_path = "/tmp/extstore.$$";
my $server = new_memcached("-m 64 -I 4m -U 0 -o ext_page_size=8,ext_wbuf_size=8,ext_threads=1,ext_io_depth=2,ext_item_size=512,ext_item_age=2,ext_recache_rate=10000,ext_max_frag=0.9,ext_path=$ext_path:64m,slab_automove=0,ext_compact_under=1");
my $sock = $server->sock;
# Wait until all items have flushed
sub wait_for_ext {
my $sum = 1;
while ($sum != 0) {
my $s = mem_stats($sock, "items");
$sum = 0;
for my $key (keys %$s) {
if ($key =~ m/items:(\d+):number/) {
# Ignore classes which can contain extstore items
next if $1 < 3;
$sum += $s->{$key};
}
}
sleep 1 if $sum != 0;
}
}
# We're testing to ensure item chaining doesn't corrupt or poorly overlap
# data, so create a non-repeating pattern.
my @parts = ();
for (1 .. 8000) {
push(@parts, $_);
}
my $pattern = join(':', @parts);
my $plen = length($pattern);
# Set some large items and let them flush to extstore.
for (1..5) {
my $size = 3000 * 1024;
my $data = "x" x $size;
print $sock "set foo$_ 0 0 $size\r\n$data\r\n";
my $res = <$sock>;
is($res, "STORED\r\n", "stored some big items");
}
wait_for_ext();
{
my $long_key = "f" x 512;
print $sock "get foo1 foo2 foo3 $long_key\r\n";
ok(scalar <$sock> =~ /CLIENT_ERROR bad command line format/, 'long key fails');
my $stats = mem_stats($sock);
cmp_ok($stats->{get_aborted_extstore}, '>', 1, 'some extstore queries aborted');
}
# Infinite loop: if we aborted some extstore requests, the next request would hang
# the daemon.
{
my $size = 3000 * 1024;
my $data = "x" x $size;
mem_get_is($sock, "foo1", $data);
}
# Disable automatic page balancing, then move enough pages that the large
# items can no longer be loaded from extstore
{
print $sock "slabs automove 0\r\n";
my $res = <$sock>;
my $source = 0;
while (1) {
print $sock "slabs reassign $source 1\r\n";
$res = <$sock>;
if ($res =~ m/NOSPARE/) {
$source = -1;
my $stats = mem_stats($sock, 'slabs');
for my $key (grep { /total_pages/ } keys %$stats) {
if ($key =~ m/(\d+):total_pages/) {
next if $1 < 3;
$source = $1 if $stats->{$key} > 1;
}
}
last if $source == -1;
}
select undef, undef, undef, 0.10;
}
}
# fetching the large keys should now fail.
{
print $sock "get foo1\r\n";
my $res = <$sock>;
$res =~ s/[\r\n]//g;
is($res, 'SERVER_ERROR out of memory writing get response', 'can no longer read back item');
my $stats = mem_stats($sock);
is($stats->{get_oom_extstore}, 1, 'check extstore oom counter');
}
# Leaving this for future generations.
# The process_get_command() function had several memory leaks.
my $LEAK_TEST = 0;
if ($LEAK_TEST) {
my $tries = 0;
while ($tries) {
print $sock "slabs reassign 1 39\r\n";
my $res = <$sock>;
if ($res =~ m/BUSY/) {
select undef, undef, undef, 0.10;
} else {
$tries--;
}
}
my $long_key = "f" x 512;
while (1) {
print $sock "get foo1 foo2 foo3 $long_key\r\n";
my $res = <$sock>;
}
}
done_testing();
END {
unlink $ext_path if $ext_path;
}
| 27.323741 | 243 | 0.5703 |
ed44364c6a36fec33ba264acbecd561ebd636af4 | 4,833 | pm | Perl | lib/Security/TLSCheck/App/Parallel.pm | tls-check/TLS-Check | 7ec514bfab17528d54107920a9b452873355d0d4 | [
"Artistic-2.0"
]
| 50 | 2016-03-31T08:41:40.000Z | 2022-03-21T18:15:11.000Z | lib/Security/TLSCheck/App/Parallel.pm | tls-check/TLS-Check | 7ec514bfab17528d54107920a9b452873355d0d4 | [
"Artistic-2.0"
]
| 3 | 2016-04-11T08:46:53.000Z | 2018-01-25T13:51:13.000Z | lib/Security/TLSCheck/App/Parallel.pm | tls-check/TLS-Check | 7ec514bfab17528d54107920a9b452873355d0d4 | [
"Artistic-2.0"
]
| 7 | 2016-03-28T13:12:29.000Z | 2019-07-28T16:47:02.000Z | package Security::TLSCheck::App::Parallel;
use Moose;
use 5.010;
=head1 NAME
Security::TLSCheck::App::Parallel -- run everything in parallel
=head1 VERSION
Version 0.2.x
=cut
#<<<
my $BASE_VERSION = "1.0"; use version; our $VERSION = qv( sprintf "$BASE_VERSION.%d", q$Revision: 658 $ =~ /(\d+)/xg );
#>>>
=head1 SYNOPSIS
=encoding utf8
use Security::TLSCheck::App (extends => 'Security::TLSCheck::Result');
my $app = Security::TLSCheck::App->new_with_options();
$app->run;
=head1 DESCRIPTION
=cut
BEGIN { extends "Security::TLSCheck::App"; }
use English qw( -no_match_vars );
use FindBin qw($Bin);
use Log::Log4perl::EasyCatch;
use Security::TLSCheck;
use Parallel::ForkManager;
use Storable; # => used internally by PFM; => use Sereal instead?
use Time::HiRes qw(time);
use Readonly;
Readonly my $HARD_TIMEOUT => 1200; # stop after 20 minutes ...
# Attributes and default values.
has jobs => ( is => "ro", isa => "Int", default => 20, documentation => "Number of max. parallel worker jobs" );
=head2 init_domain_loop
initialises ForkManager...
=cut
my $pm;
sub init_domain_loop
{
my $self = shift;
die "ForkManager can only be initialised ONCE!\n" if $pm;
$pm = Parallel::ForkManager->new( $self->jobs );
$pm->run_on_finish(
sub {
my ( $pid, $exit_code, $domain, $exit_signal, $core_dump, $return ) = @ARG;
if ($core_dump)
{
ERROR "Child for $domain (pid: $pid) core dumped. Exit-Code: $exit_code; Exit-Signal: $exit_signal";
return;
}
if ($exit_code)
{
ERROR "Child for $domain (pid: $pid) exited with Exit-Code: $exit_code; Exit-Signal: $exit_signal";
return;
}
unless ($return)
{
ERROR "Child for $domain (pid: $pid) returned no data; Exit-Code: $exit_code; Exit-Signal: $exit_signal";
return;
}
my ( $return_domain, $category, $result ) = @$return;
if ( $return_domain ne $domain )
{
ERROR "Really strange error: Domain in return value ($return_domain) differs from ident ($domain)";
return;
}
DEBUG "Master process got result for $domain";
# Replace copy of info-element with a reference to the original
# saves a lot of memory when running with thousands of domains
foreach my $check (@$result)
{
my $class = $check->{check}{class};
foreach my $single_result ( @{ $check->{result} } )
{
my $pos = $single_result->{info}{pos};
$single_result->{info} = $class->new( instance => $self )->key_figures->[$pos];
}
}
$self->add_result_for_category( $category => $result );
}
);
return;
} ## end sub init_domain_loop
=head2 analyse($domain, $category)
Runs all checks for one domain in background!
=cut
sub analyse
{
my $self = shift;
my $domain = shift;
my $category = shift;
my $read_domain = shift;
my $counter = shift;
DEBUG "Schedule $domain in fork pool";
no warnings qw(once); ## no critic (TestingAndDebugging::ProhibitNoWarnings)
local $Storable::Eval = 1; ## no critic (Variables::ProhibitPackageVars)
local $Storable::Deparse = 1; ## no critic (Variables::ProhibitPackageVars)
# returns if in parent process, otherwise the code below continues in new process
$pm->start($domain) and return;
# here IN FORK!
local $SIG{ALRM} = sub {
ERROR "Fatal Error, should never happen: HARD TIMEOUT for $domain reached!";
die "FATAL: HARD TIMEOUT for $domain reached!\n";
}; # NB: \n required
alarm $HARD_TIMEOUT; # Hard timeout ...
my $starttime = time;
INFO "Start analyse $domain (via $read_domain, category $category) (domain # $counter)";
my $tc = Security::TLSCheck->new( domain => $domain, category => $category, app => $self );
my $result = $tc->run_all_checks;
my $runtime = sprintf( "%.3f", time - $starttime );
INFO "DONE analyse $domain (category $category) (domain # $counter) in $runtime Seconds";
$pm->finish( 0, [ $domain, $category, $result ] );
alarm 0;
return;
} ## end sub analyse
=head2 finish_domain_loop
Finish ForkManager: wait for all children
=cut
sub finish_domain_loop
{
my $self = shift;
DEBUG "Now waiting for the last jobs.";
$pm->wait_all_children;
undef $pm;
DEBUG "All jobs finished.";
return;
}
1; # End of TLS::Check
| 24.784615 | 119 | 0.576454 |
ed356c23e4505b3d2e2e52fcca8e4df479b33941 | 6,089 | pl | Perl | prompter.pl | julius-speech/prompter | b2124a73ed02b5d52881d921beae6bd577bb83dd | [
"BSD-2-Clause"
]
| 2 | 2017-08-22T08:16:19.000Z | 2020-11-15T06:49:09.000Z | prompter.pl | julius-speech/prompter | b2124a73ed02b5d52881d921beae6bd577bb83dd | [
"BSD-2-Clause"
]
| null | null | null | prompter.pl | julius-speech/prompter | b2124a73ed02b5d52881d921beae6bd577bb83dd | [
"BSD-2-Clause"
]
| null | null | null | #!/usr/bin/perl
#
# Usage: prompter.pl
#
use utf8;
use Tcl;
use Tkx;
use Encode;
use Time::HiRes qw( usleep gettimeofday tv_interval );
############# user configuration #############
# Julius host name
my $host = "localhost";
# Julius module port number (default is 10500)
my $port = 10500;
# text height of the caption area
my $lines = 3;
# default text size
my $textsize = 30;
# initial message on caption
my $mes = ">> Prompter, a fancy recognition result for Julius";
# initial window location
my $windowloc = "700x250+0+0";
# font name
my $fontname = "MS ゴシック";
# foreground color
my $fgcolor = '#FFFFFF';
# background fgcolor
my $bgcolor = '#000000';
# color of progressive result
my $progcolor = "#999999";
############# system configuration #############
# connection retry interval msec
my $ConnectRetryIntervalMSec = 300;
# max num of connection retry
my $maxConnectRetry = 20;
# maximum number of chars to execute log purge (for large caption, use larger value for safe)
my $maxlinelen = 100;
# julius output character code
my $incode = 'utf8';
###########################################
###########################################
###########################################
#### making window
my $mw = Tkx::widget->new(".");
$mw->g_wm_geometry($windowloc);
my $text = $mw->new_text(
-foreground => $fgcolor,
-background => $bgcolor,
-cursor => 'man',
-font => [$fontname, $textsize],
-height => $lines,
-padx => 15,
-pady => 7,
-state => 'normal',
-wrap => 'char'
);
$text->g_pack();
$text->insert("1.0", $mes);
my $button = $mw->new_button(
-text => "Connect",
-command => sub {connectJulius();},
);
$button->g_pack( -side => 'left');
my $sizebar = $mw->new_scale(
-orient => 'horizontal',
-from => 1.0,
-to => 100.0,
-variable => \$textsize,
-command => \&setscale
);
$sizebar->g_pack( -side =>'left' );
my $button2 = $mw->new_button(
-text => "ClearText",
-command => sub {resetMessage();},
);
$button2->g_pack( -side => 'left');
my $isInConnect = 0;
my $connectCount = 0;
#### avoid error on dialog window, instead call function when $isInConnect is 1
Tkx::set("perl_bgerror", sub {
splice(@_, 0, 3);
my $msg = shift;
print "Error: $msg\n";
if ($isInConnect == 1) {
&retryConnect();
}
});
Tkx::eval(<<'EOT');
proc bgerror {msg} {
global perl_bgerror
$perl_bgerror $msg
}
EOT
my $pass = 1;
my $str1 = "";
my $str2 = "";
my $w;
my $fpflag = 1;
#my $lastOutputTime = 0;
my $socket;
#### infinite main loop
Tkx::MainLoop();
# change text size
sub setscale () {
$text->configure(-font => [$fontname, $textsize]);
}
# retry connection
sub retryConnect() {
$connectCount++;
if ($connectCount < $maxConnectRetry) {
$button->configure(-text => "Retry $connectCount", -state => 'disabled');
Tkx::after($ConnectRetryIntervalMSec, sub {connectJulius();});
} else {
$connectCount = 0;
$button->configure(-text => "Connect", -state => 'normal');
}
}
# create socket and connect
sub connectJulius () {
$isInConnect = 1;
$socket = Tkx::socket($host, $port);
$isInConnect = 0;
if (!$socket || $isError == 1) {
exit;
}
# disable buffering
#$| = 1;
#my($old) = select($socket); $| = 1; select($old);
#$socket->blocking(0);
resetMessage();
Tkx::fconfigure($socket, -encoding => 'binary');
Tkx::fileevent($socket, 'readable' => \&start_process);
$button->configure(-text => "Connected", -state => 'disabled');
}
my $errorcount = 0;
# data receiving process
sub start_process {
$_ = Tkx::gets($socket);
if ($_ eq "") {
# error
$errorcount++;
if ($errorcount >= 20) {
# enter retry mode
Tkx::close($socket);
$connectCount = 0;
&retryConnect();
}
} else {
$errorcount = 0;
}
my $str = Encode::decode($incode, $_);
$_ = $str;
if (/\<PHYPO PASS=\"1\"/) {
$pass = 1;
$str1 = "";
} elsif (/WHYPO/) {
($w) = ($_ =~ /WORD=\"(.*)\"\/\>/);
if ($pass == 1) {
$str1 .= $w;
} else {
$str2 .= $w;
}
} elsif (/\<\/PHYPO>/) {
if ($str1 ne "") {
# 1st pass progressive result
$str1 = &formatStringJP($str1);
if ($fpflag == 1) {
$fpflag = 0;
} else {
$text->delete("prog.first", "prog.last");
}
$text->insert_end($str1, "prog");
$text->tag_config("prog", -foreground => $progcolor);
$text->see("end");
}
} elsif (/\<SHYPO RANK/) {
$pass = 2;
$str2 = "";
} elsif (/\<\/SHYPO>/ && $pass == 2) {
# 2nd pass final result
if ($fpflag == 0) {
$text->delete("prog.first", "prog.last");
}
$str2 = &formatStringJP($str2);
if (! $str2 =~ /^ *$/) {
$text->insert("end", $str2);
$text->see("end");
# rehash old lines
$linelen = $text->index("end - 1 chars");
if ($linelen > "1.$maxlinelen") {
$text->delete("0.0", "end - $lines display lines");
}
}
$fpflag = 1;
} elsif (/\<REJECTED/) {
# rejected
if ($fpflag == 0) {
$text->delete("prog.first", "prog.last");
}
$fpflag = 1;
}
}
# clear text
sub resetMessage ()
{
$pass = 1;
$str1 = "";
$str2 = "";
$fpflag = 1;
$text->delete("0.0", "end");
}
# re-format Japanese recognition result: delete symbols
sub formatStringJP()
{
my ($str) = @_;
if (! ($str =~ /。$/)) {
$str .= " ";
}
$str =~ s/、//g;
$str =~ s/。/ /g;
return $str;
} | 24.258964 | 94 | 0.484973 |
ed4d3eeec54e5a2a7a12e18c696aa2302c8dca9e | 5,860 | pm | Perl | lib/Bio/Tools/Gel.pm | Helmholtz-HIPS/prosnap | 5286cda39276d5eda85d2ddb23b8ab83c5d4960c | [
"MIT"
]
| 5 | 2017-10-27T15:03:19.000Z | 2020-04-25T17:44:49.000Z | lib/Bio/Tools/Gel.pm | Helmholtz-HIPS/prosnap | 5286cda39276d5eda85d2ddb23b8ab83c5d4960c | [
"MIT"
]
| 4 | 2021-01-28T20:49:55.000Z | 2022-03-25T19:02:54.000Z | lib/Bio/Tools/Gel.pm | Helmholtz-HIPS/prosnap | 5286cda39276d5eda85d2ddb23b8ab83c5d4960c | [
"MIT"
]
| 2 | 2019-02-22T10:51:15.000Z | 2019-02-22T12:35:35.000Z | #
# BioPerl module for Bio::Tools::Gel
# Copyright Allen Day <allenday@ucla.edu>
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::Gel - Calculates relative electrophoretic migration distances
=head1 SYNOPSIS
use Bio::PrimarySeq;
use Bio::Restriction::Analysis;
use Bio::Tools::Gel;
# get a sequence
my $d = 'AAAAAAAAAGAATTCTTTTTTTTTTTTTTGAATTCGGGGGGGGGGGGGGGGGGGG';
my $seq1 = Bio::Seq->new(-id=>'groundhog day',-seq=>$d);
# cut it with an enzyme
my $ra=Bio::Restriction::Analysis->new(-seq=>$seq1);
@cuts = $ra->fragments('EcoRI'), 3;
# analyse the fragments in a gel
my $gel = Bio::Tools::Gel->new(-seq=>\@cuts,-dilate=>10);
my %bands = $gel->bands;
foreach my $band (sort {$b <=> $a} keys %bands){
print $band,"\t", sprintf("%.1f", $bands{$band}),"\n";
}
#prints:
#20 27.0
#25 26.0
#10 30.0
=head1 DESCRIPTION
This takes a set of sequences or Bio::Seq objects, and calculates their
respective migration distances using:
distance = dilation * (4 - log10(length(dna));
Source: Molecular Cloning, a Laboratory Manual. Sambrook, Fritsch, Maniatis.
CSHL Press, 1989.
Bio::Tools::Gel currently calculates migration distances based solely on
the length of the nucleotide sequence. Secondary or tertiary structure,
curvature, and other biophysical attributes of a sequence are currently
not considered. Polypeptide migration is currently not supported.
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<bioperl-l@bioperl.org>
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via the
web:
https://github.com/bioperl/bioperl-live/issues
=head1 AUTHOR - Allen Day
Email allenday@ucla.edu
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
package Bio::Tools::Gel;
use strict;
use Bio::PrimarySeq;
use base qw(Bio::Root::Root);
=head2 new
Title : new
Usage : my $gel = Bio::Tools::Gel->new(-seq => $sequence,-dilate => 3);
Function: Initializes a new Gel
Returns : Bio::Tools::Gel
Args : -seq => Bio::Seq(s), scalar(s) or list of either/both
(default: none)
-dilate => Expand band migration distances (default: 1)
=cut
sub new {
my ($class, @args) = @_;
my $self = $class->SUPER::new(@args);
my ($seqs, $dilate) = $self->_rearrange([qw(SEQ DILATE)], @args);
if( ! ref($seqs) ) {
$self->add_band([$seqs]);
} elsif( ref($seqs) =~ /array/i ||
$seqs->isa('Bio::PrimarySeqI') ) {
$self->add_band($seqs);
}
$self->dilate($dilate || 1);
return $self;
}
=head2 add_band
Title : add_band
Usage : $gel->add_band($seq);
Function: Calls _add_band with a (possibly created) Bio::Seq object.
Returns :
Args : Bio::Seq, scalar sequence, or list of either/both.
=cut
sub add_band {
my ($self, $args) = @_;
foreach my $arg (@$args){
my $seq;
if( ! ref $arg ) {
if( $arg =~ /^\d+/ ) {
# $arg is a number
$seq = Bio::PrimarySeq->new(-seq=>'N'x$arg, -id => $arg);
} else {
# $arg is a sequence string
$seq = Bio::PrimarySeq->new(-seq=>$arg, -id=>length $arg);
}
} elsif( $arg->isa('Bio::PrimarySeqI') ) {
# $arg is a sequence object
$seq = $arg;
}
$self->_add_band($seq);
}
return 1;
}
=head2 _add_band
Title : _add_band
Usage : $gel->_add_band($seq);
Function: Adds a new band to the gel.
Returns :
Args : Bio::Seq object
=cut
sub _add_band {
my ($self, $arg) = @_;
if ( defined $arg) {
push (@{$self->{'bands'}},$arg);
}
return 1;
}
=head2 dilate
Title : dilate
Usage : $gel->dilate(1);
Function: Sets/retrieves the dilation factor.
Returns : dilation factor
Args : Float or none
=cut
sub dilate {
my ($self, $arg) = @_;
return $self->{dilate} unless $arg;
$self->throw("-dilate should be numeric") if defined $arg and $arg =~ /[^e\d\.]/;
$self->{dilate} = $arg;
return $self->{dilate};
}
sub migrate {
my ($self, $arg) = @_;
$arg = $self unless $arg;
if ( $arg ) {
return 4 - log10($arg);
} else {
return 0;
}
}
=head2 bands
Title : bands
Usage : $gel->bands;
Function: Calculates migration distances of sequences.
Returns : hash of (seq_id => distance)
Args :
=cut
sub bands {
my $self = shift;
$self->throw("bands() is read-only") if @_;
my %bands = ();
foreach my $band (@{$self->{bands}}){
my $distance = $self->dilate * migrate($band->length);
$bands{$band->id} = $distance;
}
return %bands;
}
=head2 log10
Title : log10
Usage : log10($n);
Function: returns base 10 log of $n.
Returns : float
Args : float
=cut
# from "Programming Perl"
sub log10 {
my $n = shift;
return log($n)/log(10);
}
1;
| 22.980392 | 85 | 0.622526 |
ed491e36e1212902965f86465cab3b6d22dbe030 | 5,697 | pm | Perl | lib/EzmaxApi/Object/EzsignsignatureGetObjectV1Response.pm | eZmaxinc/eZmax-SDK-perl | 7d92a5915dec1c4ccfafb76d20c1b956bf68f535 | [
"MIT"
]
| null | null | null | lib/EzmaxApi/Object/EzsignsignatureGetObjectV1Response.pm | eZmaxinc/eZmax-SDK-perl | 7d92a5915dec1c4ccfafb76d20c1b956bf68f535 | [
"MIT"
]
| null | null | null | lib/EzmaxApi/Object/EzsignsignatureGetObjectV1Response.pm | eZmaxinc/eZmax-SDK-perl | 7d92a5915dec1c4ccfafb76d20c1b956bf68f535 | [
"MIT"
]
| null | null | null | =begin comment
eZmax API Definition
This API expose all the functionnalities for the eZmax and eZsign applications.
The version of the OpenAPI document: 1.1.3
Contact: support-api@ezmax.ca
Generated by: https://openapi-generator.tech
=end comment
=cut
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
package EzmaxApi::Object::EzsignsignatureGetObjectV1Response;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::Parse;
use DateTime;
use EzmaxApi::Object::CommonResponse;
use EzmaxApi::Object::CommonResponseObjDebug;
use EzmaxApi::Object::CommonResponseObjDebugPayload;
use EzmaxApi::Object::EzsignsignatureGetObjectV1ResponseAllOf;
use base ("Class::Accessor", "Class::Data::Inheritable");
#
#Response for the /1/object/ezsignsignature/getObject API Request
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually.
# REF: https://openapi-generator.tech
#
=begin comment
eZmax API Definition
This API expose all the functionnalities for the eZmax and eZsign applications.
The version of the OpenAPI document: 1.1.3
Contact: support-api@ezmax.ca
Generated by: https://openapi-generator.tech
=end comment
=cut
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new plain object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
$self->init(%args);
return $self;
}
# initialize the object
sub init
{
my ($self, %args) = @_;
foreach my $attribute (keys %{$self->attribute_map}) {
my $args_key = $self->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
}
# return perl hash
sub to_hash {
my $self = shift;
my $_hash = decode_json(JSON->new->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
foreach my $_key (keys %{$self->attribute_map}) {
if (defined $self->{$_key}) {
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
}
}
return $_data;
}
# from Perl hashref
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[(.+)\]$/i) { # array
my $_subclass = $1;
my @_array = ();
foreach my $_element (@{$hash->{$_json_attribute}}) {
push @_array, $self->_deserialize($_subclass, $_element);
}
$self->{$_key} = \@_array;
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
my $_subclass = $1;
my %_hash = ();
while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
$_hash{$_key} = $self->_deserialize($_subclass, $_element);
}
$self->{$_key} = \%_hash;
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
} else {
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
}
}
return $self;
}
# deserialize non-array data
sub _deserialize {
my ($self, $type, $data) = @_;
$log->debugf("deserializing %s with %s",Dumper($data), $type);
if ($type eq 'DateTime') {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "EzmaxApi::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => 'Response for the /1/object/ezsignsignature/getObject API Request',
class => 'EzsignsignatureGetObjectV1Response',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'm_payload' => {
datatype => 'object',
base_name => 'mPayload',
description => 'Payload for the /1/object/ezsignsignature/getObject API Request',
format => '',
read_only => '',
},
'obj_debug_payload' => {
datatype => 'CommonResponseObjDebugPayload',
base_name => 'objDebugPayload',
description => '',
format => '',
read_only => '',
},
'obj_debug' => {
datatype => 'CommonResponseObjDebug',
base_name => 'objDebug',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->openapi_types( {
'm_payload' => 'object',
'obj_debug_payload' => 'CommonResponseObjDebugPayload',
'obj_debug' => 'CommonResponseObjDebug'
} );
__PACKAGE__->attribute_map( {
'm_payload' => 'mPayload',
'obj_debug_payload' => 'objDebugPayload',
'obj_debug' => 'objDebug'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;
| 27.65534 | 123 | 0.611725 |
73f1f90508f73714c5153361920761ca2bd83c5f | 82 | pl | Perl | test/pddl_tests/orig_pddl_parser/backward-wa-star-h_add.pl | TeamSPoon/pddl_valoptic_api | 9f3f541aa6a521638b6a2061032d7b0920fd1488 | [
"BSD-2-Clause"
]
| 6 | 2018-08-17T22:13:36.000Z | 2020-09-29T07:28:25.000Z | pack/logicmoo_planner/prolog/logicmoo/planner/orig_pddl_parser/backward-wa-star-h_add.pl | logicmoo/old_logicmoo_workspace | 44025b6e389e2f2f7d86b46c1301cab0604bba26 | [
"MIT"
]
| 1 | 2018-08-17T22:13:27.000Z | 2018-08-17T22:13:27.000Z | pack/logicmoo_planner/prolog/logicmoo/planner/orig_pddl_parser/backward-wa-star-h_add.pl | logicmoo/old_logicmoo_workspace | 44025b6e389e2f2f7d86b46c1301cab0604bba26 | [
"MIT"
]
| null | null | null | :-[readFile, parseProblem, parseDomain, common].
:-['wa-star', backward, h_addb].
| 27.333333 | 48 | 0.695122 |
ed034e7fd67b282d219c0eea2a53657b8fe240a4 | 7,671 | pl | Perl | data/processed/survey_2_1482723311.pl | VincentDerk/Paper-AC-Decisions-Learning | abd1dc8893fbb11b43ebb49a25e26c0183bdba62 | [
"Apache-2.0"
]
| null | null | null | data/processed/survey_2_1482723311.pl | VincentDerk/Paper-AC-Decisions-Learning | abd1dc8893fbb11b43ebb49a25e26c0183bdba62 | [
"Apache-2.0"
]
| null | null | null | data/processed/survey_2_1482723311.pl | VincentDerk/Paper-AC-Decisions-Learning | abd1dc8893fbb11b43ebb49a25e26c0183bdba62 | [
"Apache-2.0"
]
| null | null | null | body_1(0,multi) :- true.
body_36(33,multi) :- a("young"), s("M").
body_52(49,multi) :- a("young"), s("F").
body_67(64,multi) :- a("adult"), s("M").
body_82(79,multi) :- a("adult"), s("F").
body_97(94,multi) :- a("old"), s("M").
body_112(109,multi) :- a("old"), s("F").
body_125(124,multi) :- e("high").
body_139(138,multi) :- e("uni").
body_152(151,multi) :- e("high").
body_166(165,multi) :- e("uni").
body_181(178,multi) :- o("emp"), r("small").
body_202(199,multi) :- o("emp"), r("big").
body_222(219,multi) :- o("self"), r("small").
body_242(239,multi) :- o("self"), r("big").
query(r("small")).
query(t("other")).
query(a("old")).
query(t("train")).
query(a("young")).
query(r("big")).
query(e("high")).
query(e("uni")).
query(t("car")).
query(o("emp")).
query(o("self")).
query(s("M")).
query(s("F")).
query(a("adult")).
utility(util_node(0),-26).
utility(\+(util_node(0)),20).
util_node(0) :- r("small"), \+t("other"), \+a("old"), t("train"), \+a("young"), \+r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
util_node(0) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), \+a("adult").
util_node(0) :- \+r("small"), \+t("other"), a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), \+a("adult").
util_node(0) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), a("adult").
util_node(0) :- \+r("small"), \+t("other"), \+a("old"), t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
utility(util_node(1),-28).
utility(\+(util_node(1)),3).
util_node(1) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
util_node(1) :- \+r("small"), \+t("other"), a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), \+a("adult").
util_node(1) :- \+r("small"), \+t("other"), a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(1) :- \+r("small"), \+t("other"), \+a("old"), t("train"), a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(1) :- \+r("small"), \+t("other"), \+a("old"), t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
utility(util_node(2),3).
utility(\+(util_node(2)),-20).
util_node(2) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
util_node(2) :- \+r("small"), t("other"), \+a("old"), \+t("train"), a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), \+a("adult").
util_node(2) :- r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), \+r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
util_node(2) :- \+r("small"), \+t("other"), a("old"), t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(2) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
utility(util_node(3),2).
utility(\+(util_node(3)),36).
util_node(3) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), a("young"), r("big"), \+e("high"), e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(3) :- \+r("small"), t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), a("adult").
util_node(3) :- r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), \+r("big"), \+e("high"), e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
util_node(3) :- r("small"), \+t("other"), a("old"), \+t("train"), \+a("young"), \+r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), \+a("adult").
util_node(3) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), a("adult").
utility(util_node(4),-41).
utility(\+(util_node(4)),50).
util_node(4) :- \+r("small"), t("other"), \+a("old"), \+t("train"), a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(4) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), \+a("young"), r("big"), \+e("high"), e("uni"), t("car"), o("emp"), \+o("self"), \+s("M"), s("F"), a("adult").
util_node(4) :- \+r("small"), t("other"), a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), \+t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(4) :- \+r("small"), \+t("other"), a("old"), \+t("train"), \+a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
util_node(4) :- \+r("small"), \+t("other"), \+a("old"), \+t("train"), a("young"), r("big"), e("high"), \+e("uni"), t("car"), o("emp"), \+o("self"), s("M"), \+s("F"), \+a("adult").
body_999(998,multi) :- body_1(0,multi).
body_1017(1016,multi) :- body_36(33,multi).
body_1030(1029,multi) :- body_52(49,multi).
body_1043(1042,multi) :- body_67(64,multi).
body_1056(1055,multi) :- body_82(79,multi).
body_1069(1068,multi) :- body_97(94,multi).
body_1082(1081,multi) :- body_112(109,multi).
body_1095(1094,multi) :- body_125(124,multi).
body_1108(1107,multi) :- body_139(138,multi).
body_1121(1120,multi) :- body_152(151,multi).
body_1134(1133,multi) :- body_166(165,multi).
body_1147(1146,multi) :- body_181(178,multi).
body_1165(1164,multi) :- body_202(199,multi).
body_1183(1182,multi) :- body_222(219,multi).
body_1201(1200,multi) :- body_242(239,multi).
?::dec_0.
body_1221(1220,s("M")) :- dec_0.
body_1230(1228,s("F")) :- \+dec_0.
?::dec_1.
body_1240(1239,e("high")) :- dec_1.
?::dec_2.
body_1250(1249,e("high")) :- dec_2.
?::dec_3.
body_1260(1259,t("other")) :- dec_3.
0.3::a("young"); 0.5::a("adult"); 0.2::a("old") :- body_999(998,multi).
0.75::e("high"); 0.25::e("uni") :- body_1017(1016,multi).
0.64::e("high"); 0.36::e("uni") :- body_1030(1029,multi).
0.72::e("high"); 0.28::e("uni") :- body_1043(1042,multi).
0.7::e("high"); 0.3::e("uni") :- body_1056(1055,multi).
0.88::e("high"); 0.12::e("uni") :- body_1069(1068,multi).
0.9::e("high"); 0.1::e("uni") :- body_1082(1081,multi).
0.96::o("emp"); 0.04::o("self") :- body_1095(1094,multi).
0.92::o("emp"); 0.08::o("self") :- body_1108(1107,multi).
0.25::r("small"); 0.75::r("big") :- body_1121(1120,multi).
0.2::r("small"); 0.8::r("big") :- body_1134(1133,multi).
0.48::t("car"); 0.42::t("train"); 0.1::t("other") :- body_1147(1146,multi).
0.58::t("car"); 0.24::t("train"); 0.18::t("other") :- body_1165(1164,multi).
0.56::t("car"); 0.36::t("train"); 0.08::t("other") :- body_1183(1182,multi).
0.7::t("car"); 0.21::t("train"); 0.09::t("other") :- body_1201(1200,multi).
0.6::s("M") :- body_1221(1220,s("M")).
0.4::s("F") :- body_1230(1228,s("F")).
0.72::e("high") :- body_1240(1239,e("high")).
0.88::e("high") :- body_1250(1249,e("high")).
0.08::t("other") :- body_1260(1259,t("other")).
| 70.376147 | 179 | 0.492374 |
73f13f3fac6ba42511c5c3b49f472526d184e1d4 | 976 | pm | Perl | misc-scripts/surgery/SeqStoreConverter/vega/HomoSapiens.pm | thibauthourlier/ensembl | 5c08d9089451b3ed8e39b5a5a3d2232acb09816c | [
"Apache-2.0"
]
| null | null | null | misc-scripts/surgery/SeqStoreConverter/vega/HomoSapiens.pm | thibauthourlier/ensembl | 5c08d9089451b3ed8e39b5a5a3d2232acb09816c | [
"Apache-2.0"
]
| null | null | null | misc-scripts/surgery/SeqStoreConverter/vega/HomoSapiens.pm | thibauthourlier/ensembl | 5c08d9089451b3ed8e39b5a5a3d2232acb09816c | [
"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 SeqStoreConverter::vega::HomoSapiens;
use strict;
use warnings;
use SeqStoreConverter::HomoSapiens;
use SeqStoreConverter::vega::VBasicConverter;
use vars qw(@ISA);
@ISA = qw(SeqStoreConverter::HomoSapiens SeqStoreConverter::vega::VBasicConverter);
1;
| 29.575758 | 100 | 0.79918 |
73e74834a8addf5d9b72c9ff638ae757c9e272a6 | 11,382 | pm | Perl | Rfam/Lib/Bio/Rfam/Config.pm | Rfam/Rfam-combined | 3e0494c80b0b5760dfe96fb7a817372e61d4df51 | [
"Apache-2.0"
]
| 6 | 2017-01-25T12:53:23.000Z | 2021-03-17T04:52:35.000Z | Rfam/Lib/Bio/Rfam/Config.pm | Rfam/Rfam-combined | 3e0494c80b0b5760dfe96fb7a817372e61d4df51 | [
"Apache-2.0"
]
| 50 | 2015-11-06T10:31:46.000Z | 2021-12-03T16:17:28.000Z | Rfam/Lib/Bio/Rfam/Config.pm | Rfam/Rfam-combined | 3e0494c80b0b5760dfe96fb7a817372e61d4df51 | [
"Apache-2.0"
]
| 2 | 2019-05-30T00:10:26.000Z | 2021-04-12T09:42:17.000Z | package Bio::Rfam::Config;
use strict;
use warnings;
use Config::General;
use Catalyst::Utils;
use Data::Printer;
use Carp;
use RfamLive;
use RfamJobs;
use Bio::Rfam::SeqDB;
our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/mxg); sprintf '%d.'.'%03d' x $#r, @r };
=head2 new
Title : new
Usage : Either my $config = Bio::Rfam::Config->new or my $config = new Bio::Rfam::Config
Function : Reads in the config file (location set by the environment varible RFAM_CONFIG)
: If a rfam_local.conf exists in the same diretory, it will merge the
: two configs, with those in the local config taking presidence.
Args : None
Returns : Bio::Rfam::Config object
=cut
sub new {
my $ref = shift;
#Make the object
my $class = ref($ref) || $ref;
my $self = {};
bless( $self, $class );
# allow config string to be passed to new
my $conf = shift;
# if it wasn't passed in then try the ENV
if(!$conf and $ENV{RFAM_CONFIG}){
$conf = $ENV{RFAM_CONFIG};
}
if($conf){
$self->{'_default'} = $conf;
$conf =~ s/\.conf$/_local\.conf/;
if(-s $conf){
$self->{'_local'} = $conf;
}
#This does the reading and merging.
$self->load_config();
}else{
die "No config file set in the environment variable \$RFAM_CONFIG.\n";
}
return $self;
}
sub load_config {
my ($self) = @_;
# load default into $self->{'_config'};
my $conf = new Config::General(("-ConfigFile" => $self->{'_default'}, "-ForceArray" => 1));
my %default = $conf->getall;
$self->config(%default);
# merge locals over the top
if($self->{'_local'}) {
my $local_conf = new Config::General(("-ConfigFile" => $self->{'_local'}, "-ForceArray" => 1));
my %local = $local_conf->getall;
$self->config(%local);
}
return;
}
sub config {
my $self = shift;
my $config = $self->{'_config'} || {};
if (@_) {
my $newconfig = { %{@_ > 1 ? {@_} : $_[0]} };
$self->{'_config'} = $self->_merge_hashes( $config, $newconfig );
}
return $config;
}
sub _merge_hashes {
my ( $self, $lefthash, $righthash ) = @_;
return Catalyst::Utils::merge_hashes( $lefthash, $righthash );
}
=head1 SVN Configurations
=head2
Title : svnRepos
Usage : my $urlRoot = $config->svnRepos
Function : Returns the root URL of the data repository
Args : none
Returns : URL, string
=cut
sub svnRepos {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{svn}->{svnRepos};
}
sub svnFamilies {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{svn}->{svnFamilies};
}
sub svnNewFamilies {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{svn}->{svnNewFamilies};
}
sub svnClans {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{svn}->{svnClans};
}
sub svnNewClans {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{svn}->{svnNewClans};
}
=head2 svnRevision
Title : svnRevision
Usage : my $rev = $config->svnRevision
Function : Returns the svn revision that is being used. This is virtually always
: going to be the HEAD, i.e. the latest version
Args : None
Returns : String specifiying the revision.
=cut
sub svnRevision {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{svn}->{svnRevision};
}
=head2 mandatoryFiles
Title : mandatoryFiles
Usage : my $files = $config->mandartoryFiles();
Function : Returns a list of file names that are expected to be present for
: each Rfam entry.
Args : None, readonly defined in the config
Returns : Array references of strings, corresponding to filenames.
=cut
sub mandatoryFiles {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{_config}->{files}->{family_file};
}
=head2 excluded_files
Title : excluded_files
Usage : my $files_to_exclude_from_DB_commit = $config->excluded_files;
Function : Returns a list of file names that should be added to SVN but
: not to the "_family_files" table by the pre-commit step
Args : None, readonly defined in the config
Returns : Ref to array of strings containing filenames.
=cut
sub excluded_files {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
my %excluded_files = map { $_ => 1 } @{ $self->{'_config'}->{files}->{excluded_file} };
return \%excluded_files;
}
=head2 timestamp_ordered_files
Title : timestampOrderedFiles
Usage : my $files_to_fix_timestamp_on = $config->timestamp_ordered_files;
Function : Returns a list of file names that need to have their timestamps
: reset after being written out as part of the SVN transaction
Args : None, readonly defined in the config
Returns : Ref to array of strings containing filenames.
=cut
sub timestamp_ordered_files {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{files}->{timestamp_ordered_file};
}
sub rfamlive {
my $self = shift;
if($self->location ne 'JFRC' &&
$self->location ne 'EBI') {
return undef;
}
if(!$self->{'schema'}){
my $dbiParams = {
user => $self->{_config}->{Model}->{Rfamlive}->{user},
host => $self->{_config}->{Model}->{Rfamlive}->{host},
port => $self->{_config}->{Model}->{Rfamlive}->{port},
database => $self->{_config}->{Model}->{Rfamlive}->{database},
password => $self->{_config}->{Model}->{Rfamlive}->{password},
driver => 'mysql',
@_,
};
eval {
$self->{'schema'} =
RfamLive->connect( "dbi" . ":"
. $dbiParams->{driver} . ":"
.$dbiParams->{database} . ":"
.$dbiParams->{host} . ":"
.$dbiParams->{port},
$dbiParams->{user}, $dbiParams->{password}, $dbiParams );
};
if ($@) {
croak("Failed to get schema for database:"
. $dbiParams->{'database'}
. ". Error:[$@]\n" );
};
}
return($self->{'schema'});
}
sub rfamjobs {
my $self = shift;
return $self->{rfamjobs_schema} if defined $self->{rfamjobs_schema};
my $dbiParams = {
user => $self->{_config}->{Model}->{RfamJobs}->{user},
host => $self->{_config}->{Model}->{RfamJobs}->{host},
port => $self->{_config}->{Model}->{RfamJobs}->{port},
database => $self->{_config}->{Model}->{RfamJobs}->{database},
password => $self->{_config}->{Model}->{RfamJobs}->{password},
driver => 'mysql',
@_,
};
eval {
$self->{rfamjobs_schema} =
RfamJobs->connect( 'dbi:'
. $dbiParams->{driver} . ':'
. $dbiParams->{database} . ':'
. $dbiParams->{host} . ':'
. $dbiParams->{port},
$dbiParams->{user}, $dbiParams->{password}, $dbiParams );
};
if ($@) {
croak('Failed to get schema for database:'
. $dbiParams->{database}
. ". Error:[$@]\n" );
}
return $self->{rfamjobs_schema};
}
sub rfamseqObj {
my $self = shift;
my $seqdb = $self->seqdbConfig('rfamseq');
if(!$self->{'rfamseqObj'}){
$self->{'rfamseqObj'} = Bio::Rfam::SeqDB->new( { fileLocation => $seqdb->{fetchPath },
dbname => 'rfamseq' });
}
return $self->{'rfamseqObj'};
}
sub familyLocation {
}
sub location {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{location};
}
sub infernalPath {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{binaries}->{infernal};
}
sub easelPath {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{binaries}->{easel};
}
sub RPlotScriptPath {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{binaries}->{RPlotScript};
}
sub seqdbConfig {
my $self = shift;
my $db = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
if(!exists $self->{'_config'}->{seqdb}->{$db}){
my @dbfiles = keys (%{ $self->{'_config'}->{seqdb}});
die "Unknown database $db, must be one of [@dbfiles]\n";
}
return $self->{'_config'}->{seqdb}->{$db}
}
sub revseqdbConfig {
my $self = shift;
my $revdb = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
if(!exists $self->{'_config'}->{revseqdb}->{$revdb}){
my @revdbfiles = keys (%{ $self->{'_config'}->{revseqdb}});
die "Unknown reversed database $revdb, must be one of [@revdbfiles]\n";
}
return $self->{'_config'}->{revseqdb}->{$revdb}
}
sub cmdbConfig {
my $self = shift;
my $cmdb = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
if(!exists $self->{'_config'}->{cmdb}->{$cmdb}){
my @cmdbfiles = keys (%{ $self->{'_config'}->{cmdb}});
die "Unknown CM database $cmdb, must be one of [@cmdbfiles]\n";
}
return $self->{'_config'}->{cmdb}->{$cmdb}
}
sub viewPluginSets {
my $self = shift;
my $category = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
if(!exists $self->{'_config'}->{view_sets}->{$category}){
my @cats = keys (%{ $self->{'_config'}->{view_sets}});
croak( "Unknown view set $category, must be one of [@cats]");
}
return $self->{'_config'}->{view_sets}->{$category};
}
sub GOsuggestions {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{GOsuggestions};
}
sub SOsuggestions {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{SOsuggestions};
}
sub dictionary {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{dictionary};
}
sub descTypes {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{descTypes};
}
sub rnacode_pvalue {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{RNAcode}->{pvalue};
}
sub allowedOverlaps {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{overlap};
}
sub ignorableQC {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{curation}->{ignorableQC};
}
=head2 binLocation
Title : binLocation
Usage : $config->binLocation
Function : Returns the bin directory
Args : None - read only operator
Returns : string containing path
=cut
sub binLocation {
my $self = shift;
if ( $#_ >= 0 ) {
warn "Passed variable to ro config\n";
}
return $self->{'_config'}->{binaries}->{binLocation};
}
1;
| 23.419753 | 99 | 0.575646 |
ed34ab4952f1a541cca67b4f47ca6eadef76e144 | 861 | t | Perl | t/03-unintrusive.t | taboege/raku-Junction-Guts | 92187c66fbc459b7a20902167ec0c94118fe953c | [
"Artistic-2.0"
]
| null | null | null | t/03-unintrusive.t | taboege/raku-Junction-Guts | 92187c66fbc459b7a20902167ec0c94118fe953c | [
"Artistic-2.0"
]
| null | null | null | t/03-unintrusive.t | taboege/raku-Junction-Guts | 92187c66fbc459b7a20902167ec0c94118fe953c | [
"Artistic-2.0"
]
| null | null | null | use Test;
use Junction::Guts;
# Test that we do not impair junction functionality by augmenting
# or exporting routines which interfere with autothreading.
class Y {
has $.name;
has $.type;
has $.list;
method Str { $!name }
method Numeric { +$!list }
}
my @yy =
Y.new(:name<a>, :type<1>, :list[1, 5, 4]),
Y.new(:name<b>, :type<2>, :list[2, 5, 4]),
Y.new(:name<c>, :type<3>, :list[3, 5, 6, 8]),
;
plan 7;
ok +one(@yy) eqv 4, 'autothreading operator';
ok any(@yy) eq 'c', 'autothreading string context';
ok any(@yy).name eq 'b', 'autothreading method call';
ok one(@yy).list eqv [2, 5, 4], 'autothreading over 「list」';
ok any(@yy).type eq '1', 'autothreading over 「type」';
ok all(@yy).list ~~ Array, 'chained method call';
ok none(@yy).type eq 'x', 'and a none junction';
| 28.7 | 65 | 0.578397 |
ed230b33ed1ec570a21608ec9e7cd57ce7bc1e7d | 882 | t | Perl | t/Policy/ValuesAndExpressions/prohibit_escaped_characters.t | git-the-cpan/Perl-Lint | adc4e41477dee326dab30abc97bdab3945059e00 | [
"Artistic-1.0"
]
| 42 | 2015-01-25T20:42:02.000Z | 2021-12-22T12:57:32.000Z | t/Policy/ValuesAndExpressions/prohibit_escaped_characters.t | git-the-cpan/Perl-Lint | adc4e41477dee326dab30abc97bdab3945059e00 | [
"Artistic-1.0"
]
| 38 | 2015-01-10T13:19:24.000Z | 2019-04-11T13:46:42.000Z | t/Policy/ValuesAndExpressions/prohibit_escaped_characters.t | git-the-cpan/Perl-Lint | adc4e41477dee326dab30abc97bdab3945059e00 | [
"Artistic-1.0"
]
| 12 | 2015-04-20T11:24:37.000Z | 2021-03-02T03:06:00.000Z | #!perl
use strict;
use warnings;
use Perl::Lint::Policy::ValuesAndExpressions::ProhibitEscapedCharacters;
use t::Policy::Util qw/fetch_violations/;
use Test::Base::Less;
my $class_name = 'ValuesAndExpressions::ProhibitEscapedCharacters';
filters {
params => [qw/eval/], # TODO wrong!
};
for my $block (blocks) {
my $violations = fetch_violations($class_name, $block->input, $block->params);
is scalar @$violations, $block->failures, $block->dscr;
}
done_testing;
__DATA__
===
--- dscr: Basic passing
--- failures: 0
--- params:
--- input
"\t\r\n\\";
"\N{DELETE}\N{ACKNOWLEDGE}\N{CANCEL}Z";
"\"\'\0";
'\x7f';
q{\x7f};
===
--- dscr: Basic failure
--- failures: 3
--- params:
--- input
"\127\006\030Z";
"\x7F\x06\x22Z";
qq{\x7F\x06\x22Z};
===
--- dscr: no lint
--- failures: 2
--- params:
--- input
"\127\006\030Z";
"\x7F\x06\x22Z"; ## no lint
qq{\x7F\x06\x22Z};
| 16.641509 | 82 | 0.638322 |
73d903f436d2f72e0b9cd5e937edd4dbfe0db8be | 2,094 | pm | Perl | t/lib/TestsFor/Vitruvius/Analysis/Similarity.pm | Zhtwn/Vitruvius | 8f4033f12a18ac7c7e641b18121c234e07cc2523 | [
"Artistic-1.0"
]
| null | null | null | t/lib/TestsFor/Vitruvius/Analysis/Similarity.pm | Zhtwn/Vitruvius | 8f4033f12a18ac7c7e641b18121c234e07cc2523 | [
"Artistic-1.0"
]
| null | null | null | t/lib/TestsFor/Vitruvius/Analysis/Similarity.pm | Zhtwn/Vitruvius | 8f4033f12a18ac7c7e641b18121c234e07cc2523 | [
"Artistic-1.0"
]
| null | null | null | package TestsFor::Vitruvius::Analysis::Similarity;
use FindBin::libs;
use Vitruvius::Test;
use Path::Tiny;
use PPI;
use Vitruvius::App::Similarity; # used as configuration
use Vitruvius::Core::FileSet;
use Vitruvius::Core::NodeSet;
sub single_job : Test {
my $test = shift;
my $base_dir = path('./lib')->absolute;
my $core_dir = path('./lib/Vitruvius/Core');
my @files = $core_dir->children;
my $config = Vitruvius::App::Similarity->new(
jobs => 1,
base_dir => $base_dir,
filenames => \@files,
);
my $file_set = Vitruvius::Core::FileSet->new( config => $config );
my $node_set = Vitruvius::Core::NodeSet->new( config => $config, file_set => $file_set );
my $similarity;
ok( lives { $similarity = $CLASS->new( config => $config, node_set => $node_set ) }, '->new should succeed', $@ );
isa_ok( $similarity, [$CLASS], '->new should return correct class' );
ok( lives { $similarity->diffs }, '->diffs should succeed' );
ok( lives { $similarity->groups }, '->groups should succeed' );
ok( lives { $similarity->report_lines }, '->report_lines should succeed' );
}
sub multiple_jobs : Test {
my $test = shift;
my $base_dir = path('./lib')->absolute;
my $core_dir = path('./lib/Vitruvius/Core');
my @files = $core_dir->children;
my $config = Vitruvius::App::Similarity->new(
jobs => 2,
base_dir => $base_dir,
filenames => \@files,
);
my $file_set = Vitruvius::Core::FileSet->new( config => $config );
my $node_set = Vitruvius::Core::NodeSet->new( config => $config, file_set => $file_set );
my $similarity;
ok( lives { $similarity = $CLASS->new( config => $config, node_set => $node_set ) }, '->new should succeed', $@ );
isa_ok( $similarity, [$CLASS], '->new should return correct class' );
ok( lives { $similarity->diffs }, '->diffs should succeed' );
ok( lives { $similarity->groups }, '->groups should succeed' );
ok( lives { $similarity->report_lines }, '->report_lines should succeed' );
}
1;
| 26.846154 | 118 | 0.607927 |
73e5b338d0ce0efb447ab8b5e8bb7d130f203f3f | 36,979 | pm | Perl | Source/Manip/TZ/amindi00.pm | ssp/Pester | f2d8ec2f62bfb83656f77f3ee41b54149287904a | [
"BSD-2-Clause"
]
| 59 | 2015-01-11T18:44:25.000Z | 2022-03-07T22:56:02.000Z | Source/Manip/TZ/amindi00.pm | ssp/Pester | f2d8ec2f62bfb83656f77f3ee41b54149287904a | [
"BSD-2-Clause"
]
| 11 | 2015-06-19T11:01:00.000Z | 2018-06-05T21:30:17.000Z | Source/Manip/TZ/amindi00.pm | ssp/Pester | f2d8ec2f62bfb83656f77f3ee41b54149287904a | [
"BSD-2-Clause"
]
| 7 | 2015-09-21T21:04:59.000Z | 2022-02-13T18:26:47.000Z | package #
Date::Manip::TZ::amindi00;
# Copyright (c) 2008-2014 Sullivan Beck. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
# This file was automatically generated. Any changes to this file will
# be lost the next time 'tzdata' is run.
# Generated on: Fri Nov 21 10:41:39 EST 2014
# Data version: tzdata2014j
# Code version: tzcode2014j
# This module contains data from the zoneinfo time zone database. The original
# data was obtained from the URL:
# ftp://ftp.iana.org/tz
use strict;
use warnings;
require 5.010000;
our (%Dates,%LastRule);
END {
undef %Dates;
undef %LastRule;
}
our ($VERSION);
$VERSION='6.48';
END { undef $VERSION; }
%Dates = (
1 =>
[
[ [1,1,2,0,0,0],[1,1,1,18,15,22],'-05:44:38',[-5,-44,-38],
'LMT',0,[1883,11,18,17,59,59],[1883,11,18,12,15,21],
'0001010200:00:00','0001010118:15:22','1883111817:59:59','1883111812:15:21' ],
],
1883 =>
[
[ [1883,11,18,18,0,0],[1883,11,18,12,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1918,3,31,7,59,59],[1918,3,31,1,59,59],
'1883111818:00:00','1883111812:00:00','1918033107:59:59','1918033101:59:59' ],
],
1918 =>
[
[ [1918,3,31,8,0,0],[1918,3,31,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1918,10,27,6,59,59],[1918,10,27,1,59,59],
'1918033108:00:00','1918033103:00:00','1918102706:59:59','1918102701:59:59' ],
[ [1918,10,27,7,0,0],[1918,10,27,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1919,3,30,7,59,59],[1919,3,30,1,59,59],
'1918102707:00:00','1918102701:00:00','1919033007:59:59','1919033001:59:59' ],
],
1919 =>
[
[ [1919,3,30,8,0,0],[1919,3,30,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1919,10,26,6,59,59],[1919,10,26,1,59,59],
'1919033008:00:00','1919033003:00:00','1919102606:59:59','1919102601:59:59' ],
[ [1919,10,26,7,0,0],[1919,10,26,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1941,6,22,7,59,59],[1941,6,22,1,59,59],
'1919102607:00:00','1919102601:00:00','1941062207:59:59','1941062201:59:59' ],
],
1941 =>
[
[ [1941,6,22,8,0,0],[1941,6,22,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1941,9,28,6,59,59],[1941,9,28,1,59,59],
'1941062208:00:00','1941062203:00:00','1941092806:59:59','1941092801:59:59' ],
[ [1941,9,28,7,0,0],[1941,9,28,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1942,2,9,7,59,59],[1942,2,9,1,59,59],
'1941092807:00:00','1941092801:00:00','1942020907:59:59','1942020901:59:59' ],
],
1942 =>
[
[ [1942,2,9,8,0,0],[1942,2,9,3,0,0],'-05:00:00',[-5,0,0],
'CWT',1,[1945,8,14,22,59,59],[1945,8,14,17,59,59],
'1942020908:00:00','1942020903:00:00','1945081422:59:59','1945081417:59:59' ],
],
1945 =>
[
[ [1945,8,14,23,0,0],[1945,8,14,18,0,0],'-05:00:00',[-5,0,0],
'CPT',1,[1945,9,30,6,59,59],[1945,9,30,1,59,59],
'1945081423:00:00','1945081418:00:00','1945093006:59:59','1945093001:59:59' ],
[ [1945,9,30,7,0,0],[1945,9,30,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1946,4,28,7,59,59],[1946,4,28,1,59,59],
'1945093007:00:00','1945093001:00:00','1946042807:59:59','1946042801:59:59' ],
],
1946 =>
[
[ [1946,4,28,8,0,0],[1946,4,28,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1946,9,29,6,59,59],[1946,9,29,1,59,59],
'1946042808:00:00','1946042803:00:00','1946092906:59:59','1946092901:59:59' ],
[ [1946,9,29,7,0,0],[1946,9,29,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1947,4,27,7,59,59],[1947,4,27,1,59,59],
'1946092907:00:00','1946092901:00:00','1947042707:59:59','1947042701:59:59' ],
],
1947 =>
[
[ [1947,4,27,8,0,0],[1947,4,27,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1947,9,28,6,59,59],[1947,9,28,1,59,59],
'1947042708:00:00','1947042703:00:00','1947092806:59:59','1947092801:59:59' ],
[ [1947,9,28,7,0,0],[1947,9,28,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1948,4,25,7,59,59],[1948,4,25,1,59,59],
'1947092807:00:00','1947092801:00:00','1948042507:59:59','1948042501:59:59' ],
],
1948 =>
[
[ [1948,4,25,8,0,0],[1948,4,25,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1948,9,26,6,59,59],[1948,9,26,1,59,59],
'1948042508:00:00','1948042503:00:00','1948092606:59:59','1948092601:59:59' ],
[ [1948,9,26,7,0,0],[1948,9,26,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1949,4,24,7,59,59],[1949,4,24,1,59,59],
'1948092607:00:00','1948092601:00:00','1949042407:59:59','1949042401:59:59' ],
],
1949 =>
[
[ [1949,4,24,8,0,0],[1949,4,24,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1949,9,25,6,59,59],[1949,9,25,1,59,59],
'1949042408:00:00','1949042403:00:00','1949092506:59:59','1949092501:59:59' ],
[ [1949,9,25,7,0,0],[1949,9,25,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1950,4,30,7,59,59],[1950,4,30,1,59,59],
'1949092507:00:00','1949092501:00:00','1950043007:59:59','1950043001:59:59' ],
],
1950 =>
[
[ [1950,4,30,8,0,0],[1950,4,30,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1950,9,24,6,59,59],[1950,9,24,1,59,59],
'1950043008:00:00','1950043003:00:00','1950092406:59:59','1950092401:59:59' ],
[ [1950,9,24,7,0,0],[1950,9,24,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1951,4,29,7,59,59],[1951,4,29,1,59,59],
'1950092407:00:00','1950092401:00:00','1951042907:59:59','1951042901:59:59' ],
],
1951 =>
[
[ [1951,4,29,8,0,0],[1951,4,29,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1951,9,30,6,59,59],[1951,9,30,1,59,59],
'1951042908:00:00','1951042903:00:00','1951093006:59:59','1951093001:59:59' ],
[ [1951,9,30,7,0,0],[1951,9,30,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1952,4,27,7,59,59],[1952,4,27,1,59,59],
'1951093007:00:00','1951093001:00:00','1952042707:59:59','1952042701:59:59' ],
],
1952 =>
[
[ [1952,4,27,8,0,0],[1952,4,27,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1952,9,28,6,59,59],[1952,9,28,1,59,59],
'1952042708:00:00','1952042703:00:00','1952092806:59:59','1952092801:59:59' ],
[ [1952,9,28,7,0,0],[1952,9,28,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1953,4,26,7,59,59],[1953,4,26,1,59,59],
'1952092807:00:00','1952092801:00:00','1953042607:59:59','1953042601:59:59' ],
],
1953 =>
[
[ [1953,4,26,8,0,0],[1953,4,26,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1953,9,27,6,59,59],[1953,9,27,1,59,59],
'1953042608:00:00','1953042603:00:00','1953092706:59:59','1953092701:59:59' ],
[ [1953,9,27,7,0,0],[1953,9,27,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1954,4,25,7,59,59],[1954,4,25,1,59,59],
'1953092707:00:00','1953092701:00:00','1954042507:59:59','1954042501:59:59' ],
],
1954 =>
[
[ [1954,4,25,8,0,0],[1954,4,25,3,0,0],'-05:00:00',[-5,0,0],
'CDT',1,[1954,9,26,6,59,59],[1954,9,26,1,59,59],
'1954042508:00:00','1954042503:00:00','1954092606:59:59','1954092601:59:59' ],
[ [1954,9,26,7,0,0],[1954,9,26,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1955,4,24,7,59,59],[1955,4,24,1,59,59],
'1954092607:00:00','1954092601:00:00','1955042407:59:59','1955042401:59:59' ],
],
1955 =>
[
[ [1955,4,24,8,0,0],[1955,4,24,3,0,0],'-05:00:00',[-5,0,0],
'EST',0,[1957,9,29,6,59,59],[1957,9,29,1,59,59],
'1955042408:00:00','1955042403:00:00','1957092906:59:59','1957092901:59:59' ],
],
1957 =>
[
[ [1957,9,29,7,0,0],[1957,9,29,1,0,0],'-06:00:00',[-6,0,0],
'CST',0,[1958,4,27,7,59,59],[1958,4,27,1,59,59],
'1957092907:00:00','1957092901:00:00','1958042707:59:59','1958042701:59:59' ],
],
1958 =>
[
[ [1958,4,27,8,0,0],[1958,4,27,3,0,0],'-05:00:00',[-5,0,0],
'EST',0,[1969,4,27,6,59,59],[1969,4,27,1,59,59],
'1958042708:00:00','1958042703:00:00','1969042706:59:59','1969042701:59:59' ],
],
1969 =>
[
[ [1969,4,27,7,0,0],[1969,4,27,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[1969,10,26,5,59,59],[1969,10,26,1,59,59],
'1969042707:00:00','1969042703:00:00','1969102605:59:59','1969102601:59:59' ],
[ [1969,10,26,6,0,0],[1969,10,26,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[1970,4,26,6,59,59],[1970,4,26,1,59,59],
'1969102606:00:00','1969102601:00:00','1970042606:59:59','1970042601:59:59' ],
],
1970 =>
[
[ [1970,4,26,7,0,0],[1970,4,26,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[1970,10,25,5,59,59],[1970,10,25,1,59,59],
'1970042607:00:00','1970042603:00:00','1970102505:59:59','1970102501:59:59' ],
[ [1970,10,25,6,0,0],[1970,10,25,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2006,4,2,6,59,59],[2006,4,2,1,59,59],
'1970102506:00:00','1970102501:00:00','2006040206:59:59','2006040201:59:59' ],
],
2006 =>
[
[ [2006,4,2,7,0,0],[2006,4,2,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2006,10,29,5,59,59],[2006,10,29,1,59,59],
'2006040207:00:00','2006040203:00:00','2006102905:59:59','2006102901:59:59' ],
[ [2006,10,29,6,0,0],[2006,10,29,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2007,3,11,6,59,59],[2007,3,11,1,59,59],
'2006102906:00:00','2006102901:00:00','2007031106:59:59','2007031101:59:59' ],
],
2007 =>
[
[ [2007,3,11,7,0,0],[2007,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2007,11,4,5,59,59],[2007,11,4,1,59,59],
'2007031107:00:00','2007031103:00:00','2007110405:59:59','2007110401:59:59' ],
[ [2007,11,4,6,0,0],[2007,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2008,3,9,6,59,59],[2008,3,9,1,59,59],
'2007110406:00:00','2007110401:00:00','2008030906:59:59','2008030901:59:59' ],
],
2008 =>
[
[ [2008,3,9,7,0,0],[2008,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2008,11,2,5,59,59],[2008,11,2,1,59,59],
'2008030907:00:00','2008030903:00:00','2008110205:59:59','2008110201:59:59' ],
[ [2008,11,2,6,0,0],[2008,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2009,3,8,6,59,59],[2009,3,8,1,59,59],
'2008110206:00:00','2008110201:00:00','2009030806:59:59','2009030801:59:59' ],
],
2009 =>
[
[ [2009,3,8,7,0,0],[2009,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2009,11,1,5,59,59],[2009,11,1,1,59,59],
'2009030807:00:00','2009030803:00:00','2009110105:59:59','2009110101:59:59' ],
[ [2009,11,1,6,0,0],[2009,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2010,3,14,6,59,59],[2010,3,14,1,59,59],
'2009110106:00:00','2009110101:00:00','2010031406:59:59','2010031401:59:59' ],
],
2010 =>
[
[ [2010,3,14,7,0,0],[2010,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2010,11,7,5,59,59],[2010,11,7,1,59,59],
'2010031407:00:00','2010031403:00:00','2010110705:59:59','2010110701:59:59' ],
[ [2010,11,7,6,0,0],[2010,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2011,3,13,6,59,59],[2011,3,13,1,59,59],
'2010110706:00:00','2010110701:00:00','2011031306:59:59','2011031301:59:59' ],
],
2011 =>
[
[ [2011,3,13,7,0,0],[2011,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2011,11,6,5,59,59],[2011,11,6,1,59,59],
'2011031307:00:00','2011031303:00:00','2011110605:59:59','2011110601:59:59' ],
[ [2011,11,6,6,0,0],[2011,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2012,3,11,6,59,59],[2012,3,11,1,59,59],
'2011110606:00:00','2011110601:00:00','2012031106:59:59','2012031101:59:59' ],
],
2012 =>
[
[ [2012,3,11,7,0,0],[2012,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2012,11,4,5,59,59],[2012,11,4,1,59,59],
'2012031107:00:00','2012031103:00:00','2012110405:59:59','2012110401:59:59' ],
[ [2012,11,4,6,0,0],[2012,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2013,3,10,6,59,59],[2013,3,10,1,59,59],
'2012110406:00:00','2012110401:00:00','2013031006:59:59','2013031001:59:59' ],
],
2013 =>
[
[ [2013,3,10,7,0,0],[2013,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2013,11,3,5,59,59],[2013,11,3,1,59,59],
'2013031007:00:00','2013031003:00:00','2013110305:59:59','2013110301:59:59' ],
[ [2013,11,3,6,0,0],[2013,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2014,3,9,6,59,59],[2014,3,9,1,59,59],
'2013110306:00:00','2013110301:00:00','2014030906:59:59','2014030901:59:59' ],
],
2014 =>
[
[ [2014,3,9,7,0,0],[2014,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2014,11,2,5,59,59],[2014,11,2,1,59,59],
'2014030907:00:00','2014030903:00:00','2014110205:59:59','2014110201:59:59' ],
[ [2014,11,2,6,0,0],[2014,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2015,3,8,6,59,59],[2015,3,8,1,59,59],
'2014110206:00:00','2014110201:00:00','2015030806:59:59','2015030801:59:59' ],
],
2015 =>
[
[ [2015,3,8,7,0,0],[2015,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2015,11,1,5,59,59],[2015,11,1,1,59,59],
'2015030807:00:00','2015030803:00:00','2015110105:59:59','2015110101:59:59' ],
[ [2015,11,1,6,0,0],[2015,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2016,3,13,6,59,59],[2016,3,13,1,59,59],
'2015110106:00:00','2015110101:00:00','2016031306:59:59','2016031301:59:59' ],
],
2016 =>
[
[ [2016,3,13,7,0,0],[2016,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2016,11,6,5,59,59],[2016,11,6,1,59,59],
'2016031307:00:00','2016031303:00:00','2016110605:59:59','2016110601:59:59' ],
[ [2016,11,6,6,0,0],[2016,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2017,3,12,6,59,59],[2017,3,12,1,59,59],
'2016110606:00:00','2016110601:00:00','2017031206:59:59','2017031201:59:59' ],
],
2017 =>
[
[ [2017,3,12,7,0,0],[2017,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2017,11,5,5,59,59],[2017,11,5,1,59,59],
'2017031207:00:00','2017031203:00:00','2017110505:59:59','2017110501:59:59' ],
[ [2017,11,5,6,0,0],[2017,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2018,3,11,6,59,59],[2018,3,11,1,59,59],
'2017110506:00:00','2017110501:00:00','2018031106:59:59','2018031101:59:59' ],
],
2018 =>
[
[ [2018,3,11,7,0,0],[2018,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2018,11,4,5,59,59],[2018,11,4,1,59,59],
'2018031107:00:00','2018031103:00:00','2018110405:59:59','2018110401:59:59' ],
[ [2018,11,4,6,0,0],[2018,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2019,3,10,6,59,59],[2019,3,10,1,59,59],
'2018110406:00:00','2018110401:00:00','2019031006:59:59','2019031001:59:59' ],
],
2019 =>
[
[ [2019,3,10,7,0,0],[2019,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2019,11,3,5,59,59],[2019,11,3,1,59,59],
'2019031007:00:00','2019031003:00:00','2019110305:59:59','2019110301:59:59' ],
[ [2019,11,3,6,0,0],[2019,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2020,3,8,6,59,59],[2020,3,8,1,59,59],
'2019110306:00:00','2019110301:00:00','2020030806:59:59','2020030801:59:59' ],
],
2020 =>
[
[ [2020,3,8,7,0,0],[2020,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2020,11,1,5,59,59],[2020,11,1,1,59,59],
'2020030807:00:00','2020030803:00:00','2020110105:59:59','2020110101:59:59' ],
[ [2020,11,1,6,0,0],[2020,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2021,3,14,6,59,59],[2021,3,14,1,59,59],
'2020110106:00:00','2020110101:00:00','2021031406:59:59','2021031401:59:59' ],
],
2021 =>
[
[ [2021,3,14,7,0,0],[2021,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2021,11,7,5,59,59],[2021,11,7,1,59,59],
'2021031407:00:00','2021031403:00:00','2021110705:59:59','2021110701:59:59' ],
[ [2021,11,7,6,0,0],[2021,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2022,3,13,6,59,59],[2022,3,13,1,59,59],
'2021110706:00:00','2021110701:00:00','2022031306:59:59','2022031301:59:59' ],
],
2022 =>
[
[ [2022,3,13,7,0,0],[2022,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2022,11,6,5,59,59],[2022,11,6,1,59,59],
'2022031307:00:00','2022031303:00:00','2022110605:59:59','2022110601:59:59' ],
[ [2022,11,6,6,0,0],[2022,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2023,3,12,6,59,59],[2023,3,12,1,59,59],
'2022110606:00:00','2022110601:00:00','2023031206:59:59','2023031201:59:59' ],
],
2023 =>
[
[ [2023,3,12,7,0,0],[2023,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2023,11,5,5,59,59],[2023,11,5,1,59,59],
'2023031207:00:00','2023031203:00:00','2023110505:59:59','2023110501:59:59' ],
[ [2023,11,5,6,0,0],[2023,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2024,3,10,6,59,59],[2024,3,10,1,59,59],
'2023110506:00:00','2023110501:00:00','2024031006:59:59','2024031001:59:59' ],
],
2024 =>
[
[ [2024,3,10,7,0,0],[2024,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2024,11,3,5,59,59],[2024,11,3,1,59,59],
'2024031007:00:00','2024031003:00:00','2024110305:59:59','2024110301:59:59' ],
[ [2024,11,3,6,0,0],[2024,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2025,3,9,6,59,59],[2025,3,9,1,59,59],
'2024110306:00:00','2024110301:00:00','2025030906:59:59','2025030901:59:59' ],
],
2025 =>
[
[ [2025,3,9,7,0,0],[2025,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2025,11,2,5,59,59],[2025,11,2,1,59,59],
'2025030907:00:00','2025030903:00:00','2025110205:59:59','2025110201:59:59' ],
[ [2025,11,2,6,0,0],[2025,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2026,3,8,6,59,59],[2026,3,8,1,59,59],
'2025110206:00:00','2025110201:00:00','2026030806:59:59','2026030801:59:59' ],
],
2026 =>
[
[ [2026,3,8,7,0,0],[2026,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2026,11,1,5,59,59],[2026,11,1,1,59,59],
'2026030807:00:00','2026030803:00:00','2026110105:59:59','2026110101:59:59' ],
[ [2026,11,1,6,0,0],[2026,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2027,3,14,6,59,59],[2027,3,14,1,59,59],
'2026110106:00:00','2026110101:00:00','2027031406:59:59','2027031401:59:59' ],
],
2027 =>
[
[ [2027,3,14,7,0,0],[2027,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2027,11,7,5,59,59],[2027,11,7,1,59,59],
'2027031407:00:00','2027031403:00:00','2027110705:59:59','2027110701:59:59' ],
[ [2027,11,7,6,0,0],[2027,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2028,3,12,6,59,59],[2028,3,12,1,59,59],
'2027110706:00:00','2027110701:00:00','2028031206:59:59','2028031201:59:59' ],
],
2028 =>
[
[ [2028,3,12,7,0,0],[2028,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2028,11,5,5,59,59],[2028,11,5,1,59,59],
'2028031207:00:00','2028031203:00:00','2028110505:59:59','2028110501:59:59' ],
[ [2028,11,5,6,0,0],[2028,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2029,3,11,6,59,59],[2029,3,11,1,59,59],
'2028110506:00:00','2028110501:00:00','2029031106:59:59','2029031101:59:59' ],
],
2029 =>
[
[ [2029,3,11,7,0,0],[2029,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2029,11,4,5,59,59],[2029,11,4,1,59,59],
'2029031107:00:00','2029031103:00:00','2029110405:59:59','2029110401:59:59' ],
[ [2029,11,4,6,0,0],[2029,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2030,3,10,6,59,59],[2030,3,10,1,59,59],
'2029110406:00:00','2029110401:00:00','2030031006:59:59','2030031001:59:59' ],
],
2030 =>
[
[ [2030,3,10,7,0,0],[2030,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2030,11,3,5,59,59],[2030,11,3,1,59,59],
'2030031007:00:00','2030031003:00:00','2030110305:59:59','2030110301:59:59' ],
[ [2030,11,3,6,0,0],[2030,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2031,3,9,6,59,59],[2031,3,9,1,59,59],
'2030110306:00:00','2030110301:00:00','2031030906:59:59','2031030901:59:59' ],
],
2031 =>
[
[ [2031,3,9,7,0,0],[2031,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2031,11,2,5,59,59],[2031,11,2,1,59,59],
'2031030907:00:00','2031030903:00:00','2031110205:59:59','2031110201:59:59' ],
[ [2031,11,2,6,0,0],[2031,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2032,3,14,6,59,59],[2032,3,14,1,59,59],
'2031110206:00:00','2031110201:00:00','2032031406:59:59','2032031401:59:59' ],
],
2032 =>
[
[ [2032,3,14,7,0,0],[2032,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2032,11,7,5,59,59],[2032,11,7,1,59,59],
'2032031407:00:00','2032031403:00:00','2032110705:59:59','2032110701:59:59' ],
[ [2032,11,7,6,0,0],[2032,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2033,3,13,6,59,59],[2033,3,13,1,59,59],
'2032110706:00:00','2032110701:00:00','2033031306:59:59','2033031301:59:59' ],
],
2033 =>
[
[ [2033,3,13,7,0,0],[2033,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2033,11,6,5,59,59],[2033,11,6,1,59,59],
'2033031307:00:00','2033031303:00:00','2033110605:59:59','2033110601:59:59' ],
[ [2033,11,6,6,0,0],[2033,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2034,3,12,6,59,59],[2034,3,12,1,59,59],
'2033110606:00:00','2033110601:00:00','2034031206:59:59','2034031201:59:59' ],
],
2034 =>
[
[ [2034,3,12,7,0,0],[2034,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2034,11,5,5,59,59],[2034,11,5,1,59,59],
'2034031207:00:00','2034031203:00:00','2034110505:59:59','2034110501:59:59' ],
[ [2034,11,5,6,0,0],[2034,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2035,3,11,6,59,59],[2035,3,11,1,59,59],
'2034110506:00:00','2034110501:00:00','2035031106:59:59','2035031101:59:59' ],
],
2035 =>
[
[ [2035,3,11,7,0,0],[2035,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2035,11,4,5,59,59],[2035,11,4,1,59,59],
'2035031107:00:00','2035031103:00:00','2035110405:59:59','2035110401:59:59' ],
[ [2035,11,4,6,0,0],[2035,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2036,3,9,6,59,59],[2036,3,9,1,59,59],
'2035110406:00:00','2035110401:00:00','2036030906:59:59','2036030901:59:59' ],
],
2036 =>
[
[ [2036,3,9,7,0,0],[2036,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2036,11,2,5,59,59],[2036,11,2,1,59,59],
'2036030907:00:00','2036030903:00:00','2036110205:59:59','2036110201:59:59' ],
[ [2036,11,2,6,0,0],[2036,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2037,3,8,6,59,59],[2037,3,8,1,59,59],
'2036110206:00:00','2036110201:00:00','2037030806:59:59','2037030801:59:59' ],
],
2037 =>
[
[ [2037,3,8,7,0,0],[2037,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2037,11,1,5,59,59],[2037,11,1,1,59,59],
'2037030807:00:00','2037030803:00:00','2037110105:59:59','2037110101:59:59' ],
[ [2037,11,1,6,0,0],[2037,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2038,3,14,6,59,59],[2038,3,14,1,59,59],
'2037110106:00:00','2037110101:00:00','2038031406:59:59','2038031401:59:59' ],
],
2038 =>
[
[ [2038,3,14,7,0,0],[2038,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2038,11,7,5,59,59],[2038,11,7,1,59,59],
'2038031407:00:00','2038031403:00:00','2038110705:59:59','2038110701:59:59' ],
[ [2038,11,7,6,0,0],[2038,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2039,3,13,6,59,59],[2039,3,13,1,59,59],
'2038110706:00:00','2038110701:00:00','2039031306:59:59','2039031301:59:59' ],
],
2039 =>
[
[ [2039,3,13,7,0,0],[2039,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2039,11,6,5,59,59],[2039,11,6,1,59,59],
'2039031307:00:00','2039031303:00:00','2039110605:59:59','2039110601:59:59' ],
[ [2039,11,6,6,0,0],[2039,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2040,3,11,6,59,59],[2040,3,11,1,59,59],
'2039110606:00:00','2039110601:00:00','2040031106:59:59','2040031101:59:59' ],
],
2040 =>
[
[ [2040,3,11,7,0,0],[2040,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2040,11,4,5,59,59],[2040,11,4,1,59,59],
'2040031107:00:00','2040031103:00:00','2040110405:59:59','2040110401:59:59' ],
[ [2040,11,4,6,0,0],[2040,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2041,3,10,6,59,59],[2041,3,10,1,59,59],
'2040110406:00:00','2040110401:00:00','2041031006:59:59','2041031001:59:59' ],
],
2041 =>
[
[ [2041,3,10,7,0,0],[2041,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2041,11,3,5,59,59],[2041,11,3,1,59,59],
'2041031007:00:00','2041031003:00:00','2041110305:59:59','2041110301:59:59' ],
[ [2041,11,3,6,0,0],[2041,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2042,3,9,6,59,59],[2042,3,9,1,59,59],
'2041110306:00:00','2041110301:00:00','2042030906:59:59','2042030901:59:59' ],
],
2042 =>
[
[ [2042,3,9,7,0,0],[2042,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2042,11,2,5,59,59],[2042,11,2,1,59,59],
'2042030907:00:00','2042030903:00:00','2042110205:59:59','2042110201:59:59' ],
[ [2042,11,2,6,0,0],[2042,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2043,3,8,6,59,59],[2043,3,8,1,59,59],
'2042110206:00:00','2042110201:00:00','2043030806:59:59','2043030801:59:59' ],
],
2043 =>
[
[ [2043,3,8,7,0,0],[2043,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2043,11,1,5,59,59],[2043,11,1,1,59,59],
'2043030807:00:00','2043030803:00:00','2043110105:59:59','2043110101:59:59' ],
[ [2043,11,1,6,0,0],[2043,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2044,3,13,6,59,59],[2044,3,13,1,59,59],
'2043110106:00:00','2043110101:00:00','2044031306:59:59','2044031301:59:59' ],
],
2044 =>
[
[ [2044,3,13,7,0,0],[2044,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2044,11,6,5,59,59],[2044,11,6,1,59,59],
'2044031307:00:00','2044031303:00:00','2044110605:59:59','2044110601:59:59' ],
[ [2044,11,6,6,0,0],[2044,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2045,3,12,6,59,59],[2045,3,12,1,59,59],
'2044110606:00:00','2044110601:00:00','2045031206:59:59','2045031201:59:59' ],
],
2045 =>
[
[ [2045,3,12,7,0,0],[2045,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2045,11,5,5,59,59],[2045,11,5,1,59,59],
'2045031207:00:00','2045031203:00:00','2045110505:59:59','2045110501:59:59' ],
[ [2045,11,5,6,0,0],[2045,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2046,3,11,6,59,59],[2046,3,11,1,59,59],
'2045110506:00:00','2045110501:00:00','2046031106:59:59','2046031101:59:59' ],
],
2046 =>
[
[ [2046,3,11,7,0,0],[2046,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2046,11,4,5,59,59],[2046,11,4,1,59,59],
'2046031107:00:00','2046031103:00:00','2046110405:59:59','2046110401:59:59' ],
[ [2046,11,4,6,0,0],[2046,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2047,3,10,6,59,59],[2047,3,10,1,59,59],
'2046110406:00:00','2046110401:00:00','2047031006:59:59','2047031001:59:59' ],
],
2047 =>
[
[ [2047,3,10,7,0,0],[2047,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2047,11,3,5,59,59],[2047,11,3,1,59,59],
'2047031007:00:00','2047031003:00:00','2047110305:59:59','2047110301:59:59' ],
[ [2047,11,3,6,0,0],[2047,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2048,3,8,6,59,59],[2048,3,8,1,59,59],
'2047110306:00:00','2047110301:00:00','2048030806:59:59','2048030801:59:59' ],
],
2048 =>
[
[ [2048,3,8,7,0,0],[2048,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2048,11,1,5,59,59],[2048,11,1,1,59,59],
'2048030807:00:00','2048030803:00:00','2048110105:59:59','2048110101:59:59' ],
[ [2048,11,1,6,0,0],[2048,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2049,3,14,6,59,59],[2049,3,14,1,59,59],
'2048110106:00:00','2048110101:00:00','2049031406:59:59','2049031401:59:59' ],
],
2049 =>
[
[ [2049,3,14,7,0,0],[2049,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2049,11,7,5,59,59],[2049,11,7,1,59,59],
'2049031407:00:00','2049031403:00:00','2049110705:59:59','2049110701:59:59' ],
[ [2049,11,7,6,0,0],[2049,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2050,3,13,6,59,59],[2050,3,13,1,59,59],
'2049110706:00:00','2049110701:00:00','2050031306:59:59','2050031301:59:59' ],
],
2050 =>
[
[ [2050,3,13,7,0,0],[2050,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2050,11,6,5,59,59],[2050,11,6,1,59,59],
'2050031307:00:00','2050031303:00:00','2050110605:59:59','2050110601:59:59' ],
[ [2050,11,6,6,0,0],[2050,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2051,3,12,6,59,59],[2051,3,12,1,59,59],
'2050110606:00:00','2050110601:00:00','2051031206:59:59','2051031201:59:59' ],
],
2051 =>
[
[ [2051,3,12,7,0,0],[2051,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2051,11,5,5,59,59],[2051,11,5,1,59,59],
'2051031207:00:00','2051031203:00:00','2051110505:59:59','2051110501:59:59' ],
[ [2051,11,5,6,0,0],[2051,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2052,3,10,6,59,59],[2052,3,10,1,59,59],
'2051110506:00:00','2051110501:00:00','2052031006:59:59','2052031001:59:59' ],
],
2052 =>
[
[ [2052,3,10,7,0,0],[2052,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2052,11,3,5,59,59],[2052,11,3,1,59,59],
'2052031007:00:00','2052031003:00:00','2052110305:59:59','2052110301:59:59' ],
[ [2052,11,3,6,0,0],[2052,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2053,3,9,6,59,59],[2053,3,9,1,59,59],
'2052110306:00:00','2052110301:00:00','2053030906:59:59','2053030901:59:59' ],
],
2053 =>
[
[ [2053,3,9,7,0,0],[2053,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2053,11,2,5,59,59],[2053,11,2,1,59,59],
'2053030907:00:00','2053030903:00:00','2053110205:59:59','2053110201:59:59' ],
[ [2053,11,2,6,0,0],[2053,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2054,3,8,6,59,59],[2054,3,8,1,59,59],
'2053110206:00:00','2053110201:00:00','2054030806:59:59','2054030801:59:59' ],
],
2054 =>
[
[ [2054,3,8,7,0,0],[2054,3,8,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2054,11,1,5,59,59],[2054,11,1,1,59,59],
'2054030807:00:00','2054030803:00:00','2054110105:59:59','2054110101:59:59' ],
[ [2054,11,1,6,0,0],[2054,11,1,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2055,3,14,6,59,59],[2055,3,14,1,59,59],
'2054110106:00:00','2054110101:00:00','2055031406:59:59','2055031401:59:59' ],
],
2055 =>
[
[ [2055,3,14,7,0,0],[2055,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2055,11,7,5,59,59],[2055,11,7,1,59,59],
'2055031407:00:00','2055031403:00:00','2055110705:59:59','2055110701:59:59' ],
[ [2055,11,7,6,0,0],[2055,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2056,3,12,6,59,59],[2056,3,12,1,59,59],
'2055110706:00:00','2055110701:00:00','2056031206:59:59','2056031201:59:59' ],
],
2056 =>
[
[ [2056,3,12,7,0,0],[2056,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2056,11,5,5,59,59],[2056,11,5,1,59,59],
'2056031207:00:00','2056031203:00:00','2056110505:59:59','2056110501:59:59' ],
[ [2056,11,5,6,0,0],[2056,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2057,3,11,6,59,59],[2057,3,11,1,59,59],
'2056110506:00:00','2056110501:00:00','2057031106:59:59','2057031101:59:59' ],
],
2057 =>
[
[ [2057,3,11,7,0,0],[2057,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2057,11,4,5,59,59],[2057,11,4,1,59,59],
'2057031107:00:00','2057031103:00:00','2057110405:59:59','2057110401:59:59' ],
[ [2057,11,4,6,0,0],[2057,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2058,3,10,6,59,59],[2058,3,10,1,59,59],
'2057110406:00:00','2057110401:00:00','2058031006:59:59','2058031001:59:59' ],
],
2058 =>
[
[ [2058,3,10,7,0,0],[2058,3,10,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2058,11,3,5,59,59],[2058,11,3,1,59,59],
'2058031007:00:00','2058031003:00:00','2058110305:59:59','2058110301:59:59' ],
[ [2058,11,3,6,0,0],[2058,11,3,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2059,3,9,6,59,59],[2059,3,9,1,59,59],
'2058110306:00:00','2058110301:00:00','2059030906:59:59','2059030901:59:59' ],
],
2059 =>
[
[ [2059,3,9,7,0,0],[2059,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2059,11,2,5,59,59],[2059,11,2,1,59,59],
'2059030907:00:00','2059030903:00:00','2059110205:59:59','2059110201:59:59' ],
[ [2059,11,2,6,0,0],[2059,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2060,3,14,6,59,59],[2060,3,14,1,59,59],
'2059110206:00:00','2059110201:00:00','2060031406:59:59','2060031401:59:59' ],
],
2060 =>
[
[ [2060,3,14,7,0,0],[2060,3,14,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2060,11,7,5,59,59],[2060,11,7,1,59,59],
'2060031407:00:00','2060031403:00:00','2060110705:59:59','2060110701:59:59' ],
[ [2060,11,7,6,0,0],[2060,11,7,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2061,3,13,6,59,59],[2061,3,13,1,59,59],
'2060110706:00:00','2060110701:00:00','2061031306:59:59','2061031301:59:59' ],
],
2061 =>
[
[ [2061,3,13,7,0,0],[2061,3,13,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2061,11,6,5,59,59],[2061,11,6,1,59,59],
'2061031307:00:00','2061031303:00:00','2061110605:59:59','2061110601:59:59' ],
[ [2061,11,6,6,0,0],[2061,11,6,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2062,3,12,6,59,59],[2062,3,12,1,59,59],
'2061110606:00:00','2061110601:00:00','2062031206:59:59','2062031201:59:59' ],
],
2062 =>
[
[ [2062,3,12,7,0,0],[2062,3,12,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2062,11,5,5,59,59],[2062,11,5,1,59,59],
'2062031207:00:00','2062031203:00:00','2062110505:59:59','2062110501:59:59' ],
[ [2062,11,5,6,0,0],[2062,11,5,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2063,3,11,6,59,59],[2063,3,11,1,59,59],
'2062110506:00:00','2062110501:00:00','2063031106:59:59','2063031101:59:59' ],
],
2063 =>
[
[ [2063,3,11,7,0,0],[2063,3,11,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2063,11,4,5,59,59],[2063,11,4,1,59,59],
'2063031107:00:00','2063031103:00:00','2063110405:59:59','2063110401:59:59' ],
[ [2063,11,4,6,0,0],[2063,11,4,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2064,3,9,6,59,59],[2064,3,9,1,59,59],
'2063110406:00:00','2063110401:00:00','2064030906:59:59','2064030901:59:59' ],
],
2064 =>
[
[ [2064,3,9,7,0,0],[2064,3,9,3,0,0],'-04:00:00',[-4,0,0],
'EDT',1,[2064,11,2,5,59,59],[2064,11,2,1,59,59],
'2064030907:00:00','2064030903:00:00','2064110205:59:59','2064110201:59:59' ],
[ [2064,11,2,6,0,0],[2064,11,2,1,0,0],'-05:00:00',[-5,0,0],
'EST',0,[2065,3,8,6,59,59],[2065,3,8,1,59,59],
'2064110206:00:00','2064110201:00:00','2065030806:59:59','2065030801:59:59' ],
],
);
%LastRule = (
'zone' => {
'dstoff' => '-04:00:00',
'stdoff' => '-05:00:00',
},
'rules' => {
'03' => {
'flag' => 'ge',
'dow' => '7',
'num' => '8',
'type' => 'w',
'time' => '02:00:00',
'isdst' => '1',
'abb' => 'EDT',
},
'11' => {
'flag' => 'ge',
'dow' => '7',
'num' => '1',
'type' => 'w',
'time' => '02:00:00',
'isdst' => '0',
'abb' => 'EST',
},
},
);
1;
| 48.401832 | 88 | 0.49593 |
ed1a7875d3065565fb3f8fa4e6da91b2a6309c90 | 5,170 | pl | Perl | perl/vendor/lib/auto/share/dist/DateTime-Locale/pt.pl | ifleeyo180/VspriteMoodleWebsite | 38baa924829c83808d2c87d44740ff365927a646 | [
"Apache-2.0"
]
| 2 | 2021-11-19T22:37:28.000Z | 2021-11-22T18:04:55.000Z | perl/vendor/lib/auto/share/dist/DateTime-Locale/pt.pl | ifleeyo180/VspriteMoodleWebsite | 38baa924829c83808d2c87d44740ff365927a646 | [
"Apache-2.0"
]
| 6 | 2021-11-18T00:39:48.000Z | 2021-11-20T00:31:40.000Z | perl/vendor/lib/auto/share/dist/DateTime-Locale/pt.pl | ifleeyo180/VspriteMoodleWebsite | 38baa924829c83808d2c87d44740ff365927a646 | [
"Apache-2.0"
]
| null | null | null | {
am_pm_abbreviated => [
"AM",
"PM",
],
available_formats => {
Bh => "h B",
Bhm => "h:mm B",
Bhms => "h:mm:ss B",
E => "ccc",
EBhm => "E h:mm B",
EBhms => "E h:mm:ss B",
EHm => "E, HH:mm",
EHms => "E, HH:mm:ss",
Ed => "E, d",
Ehm => "E, h:mm a",
Ehms => "E, h:mm:ss a",
Gy => "y G",
GyMMM => "MMM 'de' y G",
GyMMMEd => "E, d 'de' MMM 'de' y G",
GyMMMd => "d 'de' MMM 'de' y G",
H => "HH",
Hm => "HH:mm",
Hms => "HH:mm:ss",
Hmsv => "HH:mm:ss v",
Hmv => "HH:mm v",
M => "L",
MEd => "E, dd/MM",
MMM => "LLL",
MMMEd => "E, d 'de' MMM",
MMMMEd => "E, d 'de' MMMM",
"MMMMW-count-one" => "W'\N{U+00aa}' 'semana' 'de' MMMM",
"MMMMW-count-other" => "W'\N{U+00aa}' 'semana' 'de' MMMM",
MMMMd => "d 'de' MMMM",
MMMd => "d 'de' MMM",
MMdd => "dd/MM",
Md => "d/M",
d => "d",
h => "h a",
hm => "h:mm a",
hms => "h:mm:ss a",
hmsv => "h:mm:ss a v",
hmv => "h:mm a v",
ms => "mm:ss",
y => "y",
yM => "MM/y",
yMEd => "E, dd/MM/y",
yMM => "MM/y",
yMMM => "MMM 'de' y",
yMMMEd => "E, d 'de' MMM 'de' y",
yMMMM => "MMMM 'de' y",
yMMMMEd => "E, d 'de' MMMM 'de' y",
yMMMMd => "d 'de' MMMM 'de' y",
yMMMd => "d 'de' MMM 'de' y",
yMd => "dd/MM/y",
yQQQ => "QQQ 'de' y",
yQQQQ => "QQQQ 'de' y",
"yw-count-one" => "w'\N{U+00aa}' 'semana' 'de' Y",
"yw-count-other" => "w'\N{U+00aa}' 'semana' 'de' Y",
},
code => "pt",
date_format_full => "EEEE, d 'de' MMMM 'de' y",
date_format_long => "d 'de' MMMM 'de' y",
date_format_medium => "d 'de' MMM 'de' y",
date_format_short => "dd/MM/y",
datetime_format_full => "{1} {0}",
datetime_format_long => "{1} {0}",
datetime_format_medium => "{1} {0}",
datetime_format_short => "{1} {0}",
day_format_abbreviated => [
"seg.",
"ter.",
"qua.",
"qui.",
"sex.",
"s\N{U+00e1}b.",
"dom.",
],
day_format_narrow => [
"S",
"T",
"Q",
"Q",
"S",
"S",
"D",
],
day_format_wide => [
"segunda-feira",
"ter\N{U+00e7}a-feira",
"quarta-feira",
"quinta-feira",
"sexta-feira",
"s\N{U+00e1}bado",
"domingo",
],
day_stand_alone_abbreviated => [
"seg.",
"ter.",
"qua.",
"qui.",
"sex.",
"s\N{U+00e1}b.",
"dom.",
],
day_stand_alone_narrow => [
"S",
"T",
"Q",
"Q",
"S",
"S",
"D",
],
day_stand_alone_wide => [
"segunda-feira",
"ter\N{U+00e7}a-feira",
"quarta-feira",
"quinta-feira",
"sexta-feira",
"s\N{U+00e1}bado",
"domingo",
],
era_abbreviated => [
"a.C.",
"d.C.",
],
era_narrow => [
"a.C.",
"d.C.",
],
era_wide => [
"antes de Cristo",
"depois de Cristo",
],
first_day_of_week => 1,
glibc_date_1_format => "%a %b %e %H:%M:%S %Z %Y",
glibc_date_format => "%m/%d/%y",
glibc_datetime_format => "%a %b %e %H:%M:%S %Y",
glibc_time_12_format => "%I:%M:%S %p",
glibc_time_format => "%H:%M:%S",
language => "Portuguese",
month_format_abbreviated => [
"jan.",
"fev.",
"mar.",
"abr.",
"mai.",
"jun.",
"jul.",
"ago.",
"set.",
"out.",
"nov.",
"dez.",
],
month_format_narrow => [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
],
month_format_wide => [
"janeiro",
"fevereiro",
"mar\N{U+00e7}o",
"abril",
"maio",
"junho",
"julho",
"agosto",
"setembro",
"outubro",
"novembro",
"dezembro",
],
month_stand_alone_abbreviated => [
"jan.",
"fev.",
"mar.",
"abr.",
"mai.",
"jun.",
"jul.",
"ago.",
"set.",
"out.",
"nov.",
"dez.",
],
month_stand_alone_narrow => [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
],
month_stand_alone_wide => [
"janeiro",
"fevereiro",
"mar\N{U+00e7}o",
"abril",
"maio",
"junho",
"julho",
"agosto",
"setembro",
"outubro",
"novembro",
"dezembro",
],
name => "Portuguese",
native_language => "portugu\N{U+00ea}s",
native_name => "portugu\N{U+00ea}s",
native_script => undef,
native_territory => undef,
native_variant => undef,
quarter_format_abbreviated => [
"T1",
"T2",
"T3",
"T4",
],
quarter_format_narrow => [
1,
2,
3,
4,
],
quarter_format_wide => [
"1\N{U+00ba} trimestre",
"2\N{U+00ba} trimestre",
"3\N{U+00ba} trimestre",
"4\N{U+00ba} trimestre",
],
quarter_stand_alone_abbreviated => [
"T1",
"T2",
"T3",
"T4",
],
quarter_stand_alone_narrow => [
1,
2,
3,
4,
],
quarter_stand_alone_wide => [
"1\N{U+00ba} trimestre",
"2\N{U+00ba} trimestre",
"3\N{U+00ba} trimestre",
"4\N{U+00ba} trimestre",
],
script => undef,
territory => undef,
time_format_full => "HH:mm:ss zzzz",
time_format_long => "HH:mm:ss z",
time_format_medium => "HH:mm:ss",
time_format_short => "HH:mm",
variant => undef,
version => 38,
}
| 18.597122 | 62 | 0.448936 |
ed4b3ec88dcf5d5925a96658506710a7ce8ea8c8 | 10,581 | t | Perl | gnu/usr.bin/perl/t/op/smartmatch.t | ArrogantWombatics/openbsd-src | 75721e1d44322953075b7c4b89337b163a395291 | [
"BSD-3-Clause"
]
| 1 | 2019-02-16T13:29:23.000Z | 2019-02-16T13:29:23.000Z | gnu/usr.bin/perl/t/op/smartmatch.t | ArrogantWombatics/openbsd-src | 75721e1d44322953075b7c4b89337b163a395291 | [
"BSD-3-Clause"
]
| 1 | 2018-08-21T03:56:33.000Z | 2018-08-21T03:56:33.000Z | gnu/usr.bin/perl/t/op/smartmatch.t | ArrogantWombaticus/openbsd-src | 75721e1d44322953075b7c4b89337b163a395291 | [
"BSD-3-Clause"
]
| null | null | null | #!./perl
BEGIN {
chdir 't';
@INC = '../lib';
require './test.pl';
}
use strict;
use warnings;
no warnings 'uninitialized';
no warnings 'experimental::smartmatch';
use Tie::Array;
use Tie::Hash;
# Predeclare vars used in the tests:
my @empty;
my %empty;
my @sparse; $sparse[2] = 2;
my $deep1 = []; push @$deep1, $deep1;
my $deep2 = []; push @$deep2, $deep2;
my @nums = (1..10);
tie my @tied_nums, 'Tie::StdArray';
@tied_nums = (1..10);
my %hash = (foo => 17, bar => 23);
tie my %tied_hash, 'Tie::StdHash';
%tied_hash = %hash;
{
package Test::Object::NoOverload;
sub new { bless { key => 1 } }
}
{
package Test::Object::StringOverload;
use overload '""' => sub { "object" }, fallback => 1;
sub new { bless { key => 1 } }
}
{
package Test::Object::WithOverload;
sub new { bless { key => ($_[1] // 'magic') } }
use overload '~~' => sub {
my %hash = %{ $_[0] };
if ($_[2]) { # arguments reversed ?
return $_[1] eq reverse $hash{key};
}
else {
return $_[1] eq $hash{key};
}
};
use overload '""' => sub { "stringified" };
use overload 'eq' => sub {"$_[0]" eq "$_[1]"};
}
our $ov_obj = Test::Object::WithOverload->new;
our $ov_obj_2 = Test::Object::WithOverload->new("object");
our $obj = Test::Object::NoOverload->new;
our $str_obj = Test::Object::StringOverload->new;
my %refh;
unless (is_miniperl()) {
require Tie::RefHash;
tie %refh, 'Tie::RefHash';
$refh{$ov_obj} = 1;
}
my @keyandmore = qw(key and more);
my @fooormore = qw(foo or more);
my %keyandmore = map { $_ => 0 } @keyandmore;
my %fooormore = map { $_ => 0 } @fooormore;
# Load and run the tests
plan tests => 349;
while (<DATA>) {
SKIP: {
next if /^#/ || !/\S/;
chomp;
my ($yn, $left, $right, $note) = split /\t+/;
local $::TODO = $note =~ /TODO/;
die "Bad test spec: ($yn, $left, $right)" if $yn =~ /[^!@=]/;
my $tstr = "$left ~~ $right";
test_again:
my $res;
if ($note =~ /NOWARNINGS/) {
$res = eval "no warnings; $tstr";
}
else {
skip_if_miniperl("Doesn't work with miniperl", $yn =~ /=/ ? 2 : 1)
if $note =~ /MINISKIP/;
$res = eval $tstr;
}
chomp $@;
if ( $yn =~ /@/ ) {
ok( $@ ne '', "$tstr dies" )
and print "# \$\@ was: $@\n";
} else {
my $test_name = $tstr . ($yn =~ /!/ ? " does not match" : " matches");
if ( $@ ne '' ) {
fail($test_name);
print "# \$\@ was: $@\n";
} else {
ok( ($yn =~ /!/ xor $res), $test_name );
}
}
if ( $yn =~ s/=// ) {
$tstr = "$right ~~ $left";
goto test_again;
}
}
}
sub foo {}
sub bar {42}
sub gorch {42}
sub fatal {die "fatal sub\n"}
# to test constant folding
sub FALSE() { 0 }
sub TRUE() { 1 }
sub NOT_DEF() { undef }
# Prefix character :
# - expected to match
# ! - expected to not match
# @ - expected to be a compilation failure
# = - expected to match symmetrically (runs test twice)
# Data types to test :
# undef
# Object-overloaded
# Object
# Coderef
# Hash
# Hashref
# Array
# Arrayref
# Tied arrays and hashes
# Arrays that reference themselves
# Regex (// and qr//)
# Range
# Num
# Str
# Other syntactic items of interest:
# Constants
# Values returned by a sub call
__DATA__
# Any ~~ undef
! $ov_obj undef
! $obj undef
! sub {} undef
! %hash undef
! \%hash undef
! {} undef
! @nums undef
! \@nums undef
! [] undef
! %tied_hash undef
! @tied_nums undef
! $deep1 undef
! /foo/ undef
! qr/foo/ undef
! 21..30 undef
! 189 undef
! "foo" undef
! "" undef
! !1 undef
undef undef
(my $u) undef
NOT_DEF undef
&NOT_DEF undef
# Any ~~ object overloaded
! \&fatal $ov_obj
'cigam' $ov_obj
! 'cigam on' $ov_obj
! ['cigam'] $ov_obj
! ['stringified'] $ov_obj
! { cigam => 1 } $ov_obj
! { stringified => 1 } $ov_obj
! $obj $ov_obj
! undef $ov_obj
# regular object
@ $obj $obj
@ $ov_obj $obj
=@ \&fatal $obj
@ \&FALSE $obj
@ \&foo $obj
@ sub { 1 } $obj
@ sub { 0 } $obj
@ %keyandmore $obj
@ {"key" => 1} $obj
@ @fooormore $obj
@ ["key" => 1] $obj
@ /key/ $obj
@ qr/key/ $obj
@ "key" $obj
@ FALSE $obj
# regular object with "" overload
@ $obj $str_obj
=@ \&fatal $str_obj
@ \&FALSE $str_obj
@ \&foo $str_obj
@ sub { 1 } $str_obj
@ sub { 0 } $str_obj
@ %keyandmore $str_obj
@ {"object" => 1} $str_obj
@ @fooormore $str_obj
@ ["object" => 1] $str_obj
@ /object/ $str_obj
@ qr/object/ $str_obj
@ "object" $str_obj
@ FALSE $str_obj
# Those will treat the $str_obj as a string because of fallback:
# object (overloaded or not) ~~ Any
$obj qr/NoOverload/
$ov_obj qr/^stringified$/
= "$ov_obj" "stringified"
= "$str_obj" "object"
!= $ov_obj "stringified"
$str_obj "object"
$ov_obj 'magic'
! $ov_obj 'not magic'
# ~~ Coderef
sub{0} sub { ref $_[0] eq "CODE" }
%fooormore sub { $_[0] =~ /^(foo|or|more)$/ }
! %fooormore sub { $_[0] =~ /^(foo|or|less)$/ }
\%fooormore sub { $_[0] =~ /^(foo|or|more)$/ }
! \%fooormore sub { $_[0] =~ /^(foo|or|less)$/ }
+{%fooormore} sub { $_[0] =~ /^(foo|or|more)$/ }
! +{%fooormore} sub { $_[0] =~ /^(foo|or|less)$/ }
@fooormore sub { $_[0] =~ /^(foo|or|more)$/ }
! @fooormore sub { $_[0] =~ /^(foo|or|less)$/ }
\@fooormore sub { $_[0] =~ /^(foo|or|more)$/ }
! \@fooormore sub { $_[0] =~ /^(foo|or|less)$/ }
[@fooormore] sub { $_[0] =~ /^(foo|or|more)$/ }
! [@fooormore] sub { $_[0] =~ /^(foo|or|less)$/ }
%fooormore sub{@_==1}
@fooormore sub{@_==1}
"foo" sub { $_[0] =~ /^(foo|or|more)$/ }
! "more" sub { $_[0] =~ /^(foo|or|less)$/ }
/fooormore/ sub{ref $_[0] eq 'Regexp'}
qr/fooormore/ sub{ref $_[0] eq 'Regexp'}
1 sub{shift}
! 0 sub{shift}
! undef sub{shift}
undef sub{not shift}
NOT_DEF sub{not shift}
&NOT_DEF sub{not shift}
FALSE sub{not shift}
[1] \&bar
{a=>1} \&bar
qr// \&bar
! [1] \&foo
! {a=>1} \&foo
$obj sub { ref($_[0]) =~ /NoOverload/ }
$ov_obj sub { ref($_[0]) =~ /WithOverload/ }
# empty stuff matches, because the sub is never called:
[] \&foo
{} \&foo
@empty \&foo
%empty \&foo
! qr// \&foo
! undef \&foo
undef \&bar
@ undef \&fatal
@ 1 \&fatal
@ [1] \&fatal
@ {a=>1} \&fatal
@ "foo" \&fatal
@ qr// \&fatal
# sub is not called on empty hashes / arrays
[] \&fatal
+{} \&fatal
@empty \&fatal
%empty \&fatal
# sub is not special on the left
sub {0} qr/^CODE/
sub {0} sub { ref shift eq "CODE" }
# HASH ref against:
# - another hash ref
{} {}
=! {} {1 => 2}
{1 => 2} {1 => 2}
{1 => 2} {1 => 3}
=! {1 => 2} {2 => 3}
= \%main:: {map {$_ => 'x'} keys %main::}
# - tied hash ref
= \%hash \%tied_hash
\%tied_hash \%tied_hash
!= {"a"=>"b"} \%tied_hash
= %hash %tied_hash
%tied_hash %tied_hash
!= {"a"=>"b"} %tied_hash
$ov_obj %refh MINISKIP
! "$ov_obj" %refh MINISKIP
[$ov_obj] %refh MINISKIP
! ["$ov_obj"] %refh MINISKIP
%refh %refh MINISKIP
# - an array ref
# (since this is symmetrical, tests as well hash~~array)
= [keys %main::] \%::
= [qw[STDIN STDOUT]] \%::
=! [] \%::
=! [""] {}
=! [] {}
=! @empty {}
= [undef] {"" => 1}
= [""] {"" => 1}
= ["foo"] { foo => 1 }
= ["foo", "bar"] { foo => 1 }
= ["foo", "bar"] \%hash
= ["foo"] \%hash
=! ["quux"] \%hash
= [qw(foo quux)] \%hash
= @fooormore { foo => 1, or => 2, more => 3 }
= @fooormore %fooormore
= @fooormore \%fooormore
= \@fooormore %fooormore
# - a regex
= qr/^(fo[ox])$/ {foo => 1}
= /^(fo[ox])$/ %fooormore
=! qr/[13579]$/ +{0..99}
=! qr/a*/ {}
= qr/a*/ {b=>2}
= qr/B/i {b=>2}
= /B/i {b=>2}
=! qr/a+/ {b=>2}
= qr/^à/ {"à"=>2}
# - a scalar
"foo" +{foo => 1, bar => 2}
"foo" %fooormore
! "baz" +{foo => 1, bar => 2}
! "boz" %fooormore
! 1 +{foo => 1, bar => 2}
! 1 %fooormore
1 { 1 => 3 }
1.0 { 1 => 3 }
! "1.0" { 1 => 3 }
! "1.0" { 1.0 => 3 }
"1.0" { "1.0" => 3 }
"à" { "à" => "À" }
# - undef
! undef { hop => 'zouu' }
! undef %hash
! undef +{"" => "empty key"}
! undef {}
# ARRAY ref against:
# - another array ref
[] []
=! [] [1]
[["foo"], ["bar"]] [qr/o/, qr/a/]
! [["foo"], ["bar"]] [qr/ARRAY/, qr/ARRAY/]
["foo", "bar"] [qr/o/, qr/a/]
! [qr/o/, qr/a/] ["foo", "bar"]
["foo", "bar"] [["foo"], ["bar"]]
! ["foo", "bar"] [qr/o/, "foo"]
["foo", undef, "bar"] [qr/o/, undef, "bar"]
! ["foo", undef, "bar"] [qr/o/, "", "bar"]
! ["foo", "", "bar"] [qr/o/, undef, "bar"]
$deep1 $deep1
@$deep1 @$deep1
! $deep1 $deep2
= \@nums \@tied_nums
= @nums \@tied_nums
= \@nums @tied_nums
= @nums @tied_nums
# - an object
! $obj @fooormore
$obj [sub{ref shift}]
# - a regex
= qr/x/ [qw(foo bar baz quux)]
=! qr/y/ [qw(foo bar baz quux)]
= /x/ [qw(foo bar baz quux)]
=! /y/ [qw(foo bar baz quux)]
= /FOO/i @fooormore
=! /bar/ @fooormore
# - a number
2 [qw(1.00 2.00)]
2 [qw(foo 2)]
2.0_0e+0 [qw(foo 2)]
! 2 [qw(1foo bar2)]
# - a string
! "2" [qw(1foo 2bar)]
"2bar" [qw(1foo 2bar)]
# - undef
undef [1, 2, undef, 4]
! undef [1, 2, [undef], 4]
! undef @fooormore
undef @sparse
undef [undef]
! 0 [undef]
! "" [undef]
! undef [0]
! undef [""]
# - nested arrays and ~~ distributivity
11 [[11]]
! 11 [[12]]
"foo" [{foo => "bar"}]
! "bar" [{foo => "bar"}]
# Number against number
2 2
20 2_0
! 2 3
0 FALSE
3-2 TRUE
! undef 0
! (my $u) 0
# Number against string
= 2 "2"
= 2 "2.0"
! 2 "2bananas"
!= 2_3 "2_3" NOWARNINGS
FALSE "0"
! undef "0"
! undef ""
# Regex against string
"x" qr/x/
! "x" qr/y/
# Regex against number
12345 qr/3/
! 12345 qr/7/
# array/hash against string
@fooormore "".\@fooormore
! @keyandmore "".\@fooormore
%fooormore "".\%fooormore
! %keyandmore "".\%fooormore
# Test the implicit referencing
7 @nums
@nums \@nums
! @nums \\@nums
@nums [1..10]
! @nums [0..9]
"foo" %hash
/bar/ %hash
[qw(bar)] %hash
! [qw(a b c)] %hash
%hash %hash
%hash +{%hash}
%hash \%hash
%hash %tied_hash
%tied_hash %tied_hash
%hash { foo => 5, bar => 10 }
! %hash { foo => 5, bar => 10, quux => 15 }
@nums { 1, '', 2, '' }
@nums { 1, '', 12, '' }
! @nums { 11, '', 12, '' }
# array slices
@nums[0..-1] []
@nums[0..0] [1]
! @nums[0..1] [0..2]
@nums[0..4] [1..5]
! undef @nums[0..-1]
1 @nums[0..0]
2 @nums[0..1]
! @nums[0..1] 2
@nums[0..1] @nums[0..1]
# hash slices
@keyandmore{qw(not)} [undef]
@keyandmore{qw(key)} [0]
undef @keyandmore{qw(not)}
0 @keyandmore{qw(key and more)}
! 2 @keyandmore{qw(key and)}
@fooormore{qw(foo)} @keyandmore{qw(key)}
@fooormore{qw(foo or more)} @keyandmore{qw(key and more)}
# UNDEF
! 3 undef
! 1 undef
! [] undef
! {} undef
! \%::main undef
! [1,2] undef
! %hash undef
! @nums undef
! "foo" undef
! "" undef
! !1 undef
! \&foo undef
! sub { } undef
| 20.231358 | 71 | 0.5284 |
ed062da2bcb529c69cfdf9677ac3744c46afca9c | 7,779 | pl | Perl | bin/serial/runscripts/hindIIIcutReads4_simpleForTestingPurposes.pl | Hughes-Genome-Group/CCseqBasicM | d806d0cc9a9a3323b2c486124c1d6002408d57e4 | [
"MIT"
]
| null | null | null | bin/serial/runscripts/hindIIIcutReads4_simpleForTestingPurposes.pl | Hughes-Genome-Group/CCseqBasicM | d806d0cc9a9a3323b2c486124c1d6002408d57e4 | [
"MIT"
]
| null | null | null | bin/serial/runscripts/hindIIIcutReads4_simpleForTestingPurposes.pl | Hughes-Genome-Group/CCseqBasicM | d806d0cc9a9a3323b2c486124c1d6002408d57e4 | [
"MIT"
]
| null | null | null | ##########################################################################
# Copyright 2017, Jelena Telenius (jelena.telenius@imm.ox.ac.uk) #
# #
# This file is part of CCseqBasic5 . #
# #
# CCseqBasic5 is free software: you can redistribute it and/or modify #
# it under the terms of the MIT license.
#
#
# #
# CCseqBasic5 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 #
# MIT license for more details.
# #
# You should have received a copy of the MIT license
# along with CCseqBasic5.
##########################################################################
use strict;
my $min_length = 19;
# Specifications
my $line_counter = 0; my $f_counter = 0; my $gatc_counter=0; my %hash; my $flag; my $k;
my $gatc_0_counter=0; my $gatc_1_counter=0; my $gatc_2_counter=0; my $gatc_3_counter=0; my $fragment_counter=0; my $printed_counter=0;
my @line_labels = qw(name seq spare qscore);
my $filename = $ARGV[0];
my $filetype = $ARGV[1];
unless ($filename =~ /(.*)\.(fastq|fq)/) {die"filename does not match fq"};
my $filename_out= $1."_REdig.$2"; my $filename_dump = $1."_merge_dump.$2";
my $file_name=$1;
my $file_path="";
if ($file_name =~ /(.*\/)(\V++)/) {$file_path = $1; $file_name = $2};
if ( ($filetype ne "NONFLASHED") and ($filetype ne "FLASHED") ) {print "Second parameter has to be file type : either FLASHED or NONFLASHED\n"; exit;}
unless (open(FH, $filename)) {print "Cannot open file $filename\n"; exit;}
# opens a file in append modes for the output of the data
open FHOUT, ">$filename_out" or die $!;
while ($hash{$line_labels[$f_counter]}=<FH>) #assigns each fq line to the hash in batches of 4
{
chomp $hash{$line_labels[$f_counter]};
$f_counter++; $line_counter++;
if ($f_counter==4)
{
# name formats @HISEQ2000:376:C2399ACXX:8:1101:1749:1893 1:N:0:GAGTTAGT run1
# name formats @HISEQ2000:376:C2399ACXX:8:1101:1749:1893 2:N:0:GAGTTAGT run2
# /(.*):(.*):(.*):(.*):(.*):(.*):(\d++) (\d):(.*):(.*):(.*)/
if ($hash{"name"} =~ /(.*:.*:.*:.*:.*:.*:\d++) (\d):(.*:.*:.*)/)
{
$hash{"PE"}=$2;
$hash{"new name"} = $1;
#$hash{"new name end"} = " ".$2.":".$3
}
# codes for marking
# :0 no AAGCTT cut
# :1 AAGCTT in LEFT
# :2 AAGCTT in RIGHT
# :3 AAGCTT in RIGHT and LEFT
# : The cut sequence for HindIII is A^AGCTT
if ($hash{"seq"} =~ /AAGCTT/)
{
my @gatc_splits = split/AAGCTT/, $hash{"seq"};
for (my $i=0; $i<$#gatc_splits+1;$i++)
{
$fragment_counter++;
# ------------------------------------------
# First fragment of the red-in line
if ($i==0) #first fragment
{
$hash{"split$i"}{"sseq"}= "$gatc_splits[$i]";
$hash{"split$i"}{"sqscore"}= substr ($hash{"qscore"},0,length $hash{"split$i"}{"sseq"});
$hash{"split$i"}{"sname"}= $hash{"new name"}.":PE".$hash{"PE"}.":".$i.":F";
}
# ------------------------------------------
# Middle fragments of the red-in line (not-first, not-last)
if ($i!=0 and $i != $#gatc_splits) #middle fragment
{
$hash{"split$i"}{"sseq"}= "$gatc_splits[$i]";
$hash{"split$i"}{"sqscore"}= substr ($hash{"qscore"},0,length $hash{"split$i"}{"sseq"});
$hash{"split$i"}{"sname"}= $hash{"new name"}.":PE".$hash{"PE"}.":".$i.":M";
}
# ------------------------------------------
# Last fragment of the red-in line (if there is more than one fragment : if only one fragment, it is handled in "first fragment" above)
if ($i==$#gatc_splits and $i!=0) #last fragment if there is more than one fragment
{
$hash{"split$i"}{"sseq"}= "$gatc_splits[$i]";
$hash{"split$i"}{"sqscore"}= substr ($hash{"qscore"},0,length $hash{"split$i"}{"sseq"});
$hash{"split$i"}{"sname"}= $hash{"new name"}.":PE".$hash{"PE"}.":".$i.":E";
}
# ------------------------------------------
# end of the first-middle-last fragment read : now 'sseq' 'sqscore' and 'sname' have been set for all cases.
# ------------------------------------------
# If the lenght of the current fragment is long enough to enable unique mapping, proceed to printing ..
if (length $hash{"split$i"}{"sseq"}>$min_length)
{
print FHOUT $hash{"split$i"}{"sname"}."\n".$hash{"split$i"}{"sseq"}."\n+\n".$hash{"split$i"}{"sqscore"}."\n";
$printed_counter++;
}
}
$gatc_counter++;
}
else
{
# We print these only if we are in NONFLASHED - otherwise we just skip over..
if ( $filetype eq "NONFLASHED" )
{
print FHOUT $hash{"new name"}.":PE".$hash{"PE"}.":0".":0\n";
#print FHOUT $hash{"new name"}.":PE".$hash{"PE"}.":0".$hash{"new name end"}."\n";
print FHOUT $hash{"seq"}."\n"; #error check ."\t".length $hash{"split$i"}{"sseq"};
print FHOUT "+\n";
print FHOUT $hash{"qscore"}."\n"; #error check "\t".length $hash{"split$i"}{"sqscore"};
$printed_counter++;
}
$gatc_0_counter++;
$fragment_counter++;
}
#prints the data in the hash: for (my $i=0; $i<4; $i++){print $i.$hash{$line_labels[$i]}."\n"}print "\n";
$f_counter=0
}
#if ($line_counter>1000000){print "$line_counter lines reviewed\n$gatc_counter DpnII sites found\n";exit #}
}
my $readcount=int( $line_counter/4 );
print "hindIII.pl command run on file: $filename\n$readcount reads reviewed, of which\n$gatc_counter had at least one hindIII site in them\n";
if ( $filetype eq "NONFLASHED" )
{
print "Here READ means either R1 or R2 part of any read - both are called read, and the combined entity does not exist, as flashing was not succesfull for these.\n";
print "In detail, \n$fragment_counter fragments was found, and of these \n$printed_counter fragments were printed - as they were longer than the set threshold $min_length\n";
print "Of the printed fragments (in FASTQ coordinates):\n$gatc_3_counter fragments had LEFT and RIGHT AAGCTT,\n$gatc_1_counter fragments had only LEFT AAGCTT,\n$gatc_2_counter fragments had only RIGHT AAGCTT site,\n$gatc_0_counter fragments had no AAGCTT.\n";
}
else {
print "In detail, \n$fragment_counter fragments was found, and of these \n$printed_counter fragments were printed - as they were longer than the set threshold $min_length , and the read contained at least one AAGCTT\n";
print "Of the printed fragments (in FASTQ coordinates):\n$gatc_3_counter fragments had LEFT and RIGHT AAGCTT,\n$gatc_1_counter fragments had only LEFT AAGCTT,\n$gatc_2_counter fragments had only RIGHT AAGCTT site.\n";
print "$gatc_0_counter reads were longer htan the set treshold $min_length, but had no AAGCTT and thus were discarded .\n";
}
# codes for marking (above)
# :0 no AAGCTT cut
# :1 AAGCTT in LEFT
# :2 AAGCTT in RIGHT
# :3 AAGCTT in RIGHT and LEFT
| 46.303571 | 259 | 0.525775 |
73eb4b55cd74b09ced7312121d5631611812449a | 75,344 | pl | Perl | weechat/perl/buffers.pl | ataulmohsin/dotfiles | 78f35b1c7d0418ed83097d6e02d846012debb938 | [
"MIT"
]
| 93 | 2016-07-07T02:57:11.000Z | 2022-03-28T11:58:28.000Z | dot_config/exact_weechat/exact_perl/buffers.pl | azmodude/dotfiles | 0565b41e5f62eab4bdb1ea547f889acf4a657318 | [
"MIT"
]
| 2 | 2015-02-19T22:21:42.000Z | 2017-01-28T17:30:33.000Z | weechat/weechat.symlink/perl/buffers.pl | egoexpress/dotfiles | 49b8af8038ab233160da635e4ee517197879b4e5 | [
"MIT"
]
| 11 | 2015-04-11T15:02:48.000Z | 2019-08-18T00:51:39.000Z | #
# Copyright (C) 2008-2014 Sebastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2011-2013 Nils G <weechatter@arcor.de>
#
# 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/>.
#
#
# Display sidebar with list of buffers.
#
# History:
#
# 2016-05-01, mumixam <mumixam@gmail.com>:
# v5.4: added option "detach_buffer_immediately_level"
# 2015-08-21, Matthew Cox <matthewcpcox@gmail.com>
# v5.3: add option "indenting_amount", to adjust the indenting of channel buffers
# 2015-05-02, arza <arza@arza.us>:
# v5.2: truncate long names (name_size_max) more when mark_inactive adds parenthesis
# 2015-03-29, Ed Santiago <ed@edsantiago.com>:
# v5.1: merged buffers: always indent, except when filling is horizontal
# 2014-12-12
# v5.0: fix cropping non-latin buffer names
# 2014-08-29, Patrick Steinhardt <ps@pks.im>:
# v4.9: add support for specifying custom buffer names
# 2014-07-19, Sebastien Helleu <flashcode@flashtux.org>:
# v4.8: add support of ctrl + mouse wheel to jump to previous/next buffer,
# new option "mouse_wheel"
# 2014-06-22, Sebastien Helleu <flashcode@flashtux.org>:
# v4.7: fix typos in options
# 2014-04-05, Sebastien Helleu <flashcode@flashtux.org>:
# v4.6: add support of hidden buffers (WeeChat >= 0.4.4)
# 2014-01-01, Sebastien Helleu <flashcode@flashtux.org>:
# v4.5: add option "mouse_move_buffer"
# 2013-12-11, Sebastien Helleu <flashcode@flashtux.org>:
# v4.4: fix buffer number on drag to the end of list when option
# weechat.look.buffer_auto_renumber is off
# 2013-12-10, nils_2@freenode.#weechat:
# v4.3: add options "prefix_bufname" and "suffix_bufname (idea by silverd)
# : fix hook_timer() for show_lag wasn't disabled
# : improved signal handling (less updating of buffers list)
# 2013-11-07, Sebastien Helleu <flashcode@flashtux.org>:
# v4.2: use default filling "columns_vertical" when bar position is top/bottom
# 2013-10-31, nils_2@freenode.#weechat:
# v4.1: add option "detach_buffer_immediately" (idea by farn)
# 2013-10-20, nils_2@freenode.#weechat:
# v4.0: add options "detach_displayed_buffers", "detach_display_window_number"
# 2013-09-27, nils_2@freenode.#weechat:
# v3.9: add option "toggle_bar" and option "show_prefix_query" (idea by IvarB)
# : fix problem with linefeed at end of list of buffers (reported by grawity)
# 2012-10-18, nils_2@freenode.#weechat:
# v3.8: add option "mark_inactive", to mark buffers you are not in (idea by xrdodrx)
# : add wildcard "*" for immune_detach_buffers (idea by StarWeaver)
# : add new options "detach_query" and "detach_free_content" (idea by StarWeaver)
# 2012-10-06, Nei <anti.teamidiot.de>:
# v3.7: call menu on right mouse if menu script is loaded.
# 2012-10-06, nils_2 <weechatter@arcor.de>:
# v3.6: add new option "hotlist_counter" (idea by torque).
# 2012-06-02, nils_2 <weechatter@arcor.de>:
# v3.5: add values "server|channel|private|all|keepserver|none" to option "hide_merged_buffers" (suggested by dominikh).
# 2012-05-25, nils_2 <weechatter@arcor.de>:
# v3.4: add new option "show_lag".
# 2012-04-07, Sebastien Helleu <flashcode@flashtux.org>:
# v3.3: fix truncation of wide chars in buffer name (option name_size_max) (bug #36034)
# 2012-03-15, nils_2 <weechatter@arcor.de>:
# v3.2: add new option "detach"(weechat >= 0.3.8)
# add new option "immune_detach_buffers" (requested by Mkaysi)
# add new function buffers_whitelist add|del|reset (suggested by FiXato)
# add new function buffers_detach add|del|reset
# 2012-03-09, Sebastien Helleu <flashcode@flashtux.org>:
# v3.1: fix reload of config file
# 2012-01-29, nils_2 <weechatter@arcor.de>:
# v3.0: fix: buffers did not update directly during window_switch (reported by FiXato)
# 2012-01-29, nils_2 <weechatter@arcor.de>:
# v2.9: add options "name_size_max" and "name_crop_suffix"
# 2012-01-08, nils_2 <weechatter@arcor.de>:
# v2.8: fix indenting for option "show_number off"
# fix unset of buffer activity in hotlist when buffer was moved with mouse
# add buffer with free content and core buffer sorted first (suggested by nyuszika7h)
# add options queries_default_fg/bg and queries_message_fg/bg (suggested by FiXato)
# add clicking with left button on current buffer will do a jump_previously_visited_buffer (suggested by FiXato)
# add clicking with right button on current buffer will do a jump_next_visited_buffer
# add additional informations in help texts
# add default_fg and default_bg for whitelist channels
# internal changes (script is now 3Kb smaller)
# 2012-01-04, Sebastien Helleu <flashcode@flashtux.org>:
# v2.7: fix regex lookup in whitelist buffers list
# 2011-12-04, nils_2 <weechatter@arcor.de>:
# v2.6: add own config file (buffers.conf)
# add new behavior for indenting (under_name)
# add new option to set different color for server buffers and buffers with free content
# 2011-10-30, nils_2 <weechatter@arcor.de>:
# v2.5: add new options "show_number_char" and "color_number_char",
# add help-description for options
# 2011-08-24, Sebastien Helleu <flashcode@flashtux.org>:
# v2.4: add mouse support
# 2011-06-06, nils_2 <weechatter@arcor.de>:
# v2.3: added: missed option "color_whitelist_default"
# 2011-03-23, Sebastien Helleu <flashcode@flashtux.org>:
# v2.2: fix color of nick prefix with WeeChat >= 0.3.5
# 2011-02-13, nils_2 <weechatter@arcor.de>:
# v2.1: add options "color_whitelist_*"
# 2010-10-05, Sebastien Helleu <flashcode@flashtux.org>:
# v2.0: add options "sort" and "show_number"
# 2010-04-12, Sebastien Helleu <flashcode@flashtux.org>:
# v1.9: replace call to log() by length() to align buffer numbers
# 2010-04-02, Sebastien Helleu <flashcode@flashtux.org>:
# v1.8: fix bug with background color and option indenting_number
# 2010-04-02, Helios <helios@efemes.de>:
# v1.7: add indenting_number option
# 2010-02-25, m4v <lambdae2@gmail.com>:
# v1.6: add option to hide empty prefixes
# 2010-02-12, Sebastien Helleu <flashcode@flashtux.org>:
# v1.5: add optional nick prefix for buffers like IRC channels
# 2009-09-30, Sebastien Helleu <flashcode@flashtux.org>:
# v1.4: remove spaces for indenting when bar position is top/bottom
# 2009-06-14, Sebastien Helleu <flashcode@flashtux.org>:
# v1.3: add option "hide_merged_buffers"
# 2009-06-14, Sebastien Helleu <flashcode@flashtux.org>:
# v1.2: improve display with merged buffers
# 2009-05-02, Sebastien Helleu <flashcode@flashtux.org>:
# v1.1: sync with last API changes
# 2009-02-21, Sebastien Helleu <flashcode@flashtux.org>:
# v1.0: remove timer used to update bar item first time (not needed any more)
# 2009-02-17, Sebastien Helleu <flashcode@flashtux.org>:
# v0.9: fix bug with indenting of private buffers
# 2009-01-04, Sebastien Helleu <flashcode@flashtux.org>:
# v0.8: update syntax for command /set (comments)
# 2008-10-20, Jiri Golembiovsky <golemj@gmail.com>:
# v0.7: add indenting option
# 2008-10-01, Sebastien Helleu <flashcode@flashtux.org>:
# v0.6: add default color for buffers, and color for current active buffer
# 2008-09-18, Sebastien Helleu <flashcode@flashtux.org>:
# v0.5: fix color for "low" level entry in hotlist
# 2008-09-18, Sebastien Helleu <flashcode@flashtux.org>:
# v0.4: rename option "show_category" to "short_names",
# remove option "color_slash"
# 2008-09-15, Sebastien Helleu <flashcode@flashtux.org>:
# v0.3: fix bug with priority in hotlist (var not defined)
# 2008-09-02, Sebastien Helleu <flashcode@flashtux.org>:
# v0.2: add color for buffers with activity and config options for
# colors, add config option to display/hide categories
# 2008-03-15, Sebastien Helleu <flashcode@flashtux.org>:
# v0.1: script creation
#
# Help about settings:
# display all settings for script (or use iset.pl script to change settings):
# /set buffers*
# show help text for option buffers.look.whitelist_buffers:
# /help buffers.look.whitelist_buffers
#
# Mouse-support (standard key bindings):
# left mouse-button:
# - click on a buffer to switch to selected buffer
# - click on current buffer will do action jump_previously_visited_buffer
# - drag a buffer and drop it on another position will move the buffer to position
# right mouse-button:
# - click on current buffer will do action jump_next_visited_buffer
# - moving buffer to the left/right will close buffer.
#
use strict;
use Encode qw( decode encode );
# -----------------------------[ internal ]-------------------------------------
my $SCRIPT_NAME = "buffers";
my $SCRIPT_VERSION = "5.4";
my $BUFFERS_CONFIG_FILE_NAME = "buffers";
my $buffers_config_file;
my $cmd_buffers_whitelist= "buffers_whitelist";
my $cmd_buffers_detach = "buffers_detach";
my $maxlength;
my %mouse_keys = ("\@item(buffers):button1*" => "hsignal:buffers_mouse",
"\@item(buffers):button2*" => "hsignal:buffers_mouse",
"\@bar(buffers):ctrl-wheelup" => "hsignal:buffers_mouse",
"\@bar(buffers):ctrl-wheeldown" => "hsignal:buffers_mouse");
my %options;
my %hotlist_level = (0 => "low", 1 => "message", 2 => "private", 3 => "highlight");
my @whitelist_buffers = ();
my @immune_detach_buffers= ();
my @detach_buffer_immediately= ();
my @buffers_focus = ();
my %buffers_timer = ();
my %Hooks = ();
# --------------------------------[ init ]--------------------------------------
weechat::register($SCRIPT_NAME, "Sebastien Helleu <flashcode\@flashtux.org>",
$SCRIPT_VERSION, "GPL3",
"Sidebar with list of buffers", "shutdown_cb", "");
my $weechat_version = weechat::info_get("version_number", "") || 0;
buffers_config_init();
buffers_config_read();
weechat::bar_item_new($SCRIPT_NAME, "build_buffers", "");
weechat::bar_new($SCRIPT_NAME, "0", "0", "root", "", "left", "columns_vertical",
"vertical", "0", "0", "default", "default", "default", "1",
$SCRIPT_NAME);
if ( check_bar_item() == 0 )
{
weechat::command("", "/bar show " . $SCRIPT_NAME) if ( weechat::config_boolean($options{"toggle_bar"}) eq 1 );
}
weechat::hook_signal("buffer_opened", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_closed", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_merged", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_unmerged", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_moved", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_renamed", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_switch", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_hidden", "buffers_signal_buffer", ""); # WeeChat >= 0.4.4
weechat::hook_signal("buffer_unhidden", "buffers_signal_buffer", ""); # WeeChat >= 0.4.4
weechat::hook_signal("buffer_localvar_added", "buffers_signal_buffer", "");
weechat::hook_signal("buffer_localvar_changed", "buffers_signal_buffer", "");
weechat::hook_signal("window_switch", "buffers_signal_buffer", "");
weechat::hook_signal("hotlist_changed", "buffers_signal_hotlist", "");
#weechat::hook_command_run("/input switch_active_*", "buffers_signal_buffer", "");
weechat::bar_item_update($SCRIPT_NAME);
if ($weechat_version >= 0x00030600)
{
weechat::hook_focus($SCRIPT_NAME, "buffers_focus_buffers", "");
weechat::hook_hsignal("buffers_mouse", "buffers_hsignal_mouse", "");
weechat::key_bind("mouse", \%mouse_keys);
}
weechat::hook_command($cmd_buffers_whitelist,
"add/del current buffer to/from buffers whitelist",
"[add] || [del] || [reset]",
" add: add current buffer in configuration file\n".
" del: delete current buffer from configuration file\n".
"reset: reset all buffers from configuration file ".
"(no confirmation!)\n\n".
"Examples:\n".
"/$cmd_buffers_whitelist add\n",
"add %-||".
"del %-||".
"reset %-",
"buffers_cmd_whitelist", "");
weechat::hook_command($cmd_buffers_detach,
"add/del current buffer to/from buffers detach",
"[add] || [del] || [reset]",
" add: add current buffer in configuration file\n".
" del: delete current buffer from configuration file\n".
"reset: reset all buffers from configuration file ".
"(no confirmation!)\n\n".
"Examples:\n".
"/$cmd_buffers_detach add\n",
"add %-||".
"del %-||".
"reset %-",
"buffers_cmd_detach", "");
if ($weechat_version >= 0x00030800)
{
weechat::hook_config("buffers.look.detach", "hook_timer_detach", "");
if (weechat::config_integer($options{"detach"}) > 0)
{
$Hooks{timer_detach} = weechat::hook_timer(weechat::config_integer($options{"detach"}) * 1000,
60, 0, "buffers_signal_hotlist", "");
}
}
weechat::hook_config("buffers.look.show_lag", "hook_timer_lag", "");
if (weechat::config_boolean($options{"show_lag"}))
{
$Hooks{timer_lag} = weechat::hook_timer(
weechat::config_integer(weechat::config_get("irc.network.lag_refresh_interval")) * 1000,
0, 0, "buffers_signal_hotlist", "");
}
# -------------------------------- [ command ] --------------------------------
sub buffers_cmd_whitelist
{
my ( $data, $buffer, $args ) = @_;
$args = lc($args);
my $buffers_whitelist = weechat::config_string( weechat::config_get("buffers.look.whitelist_buffers") );
return weechat::WEECHAT_RC_OK if ( $buffers_whitelist eq "" and $args eq "del" or $buffers_whitelist eq "" and $args eq "reset" );
my @buffers_list = split( /,/, $buffers_whitelist );
# get buffers name
my $infolist = weechat::infolist_get("buffer", weechat::current_buffer(), "");
weechat::infolist_next($infolist);
my $buffers_name = weechat::infolist_string($infolist, "name");
weechat::infolist_free($infolist);
return weechat::WEECHAT_RC_OK if ( $buffers_name eq "" ); # should never happen
if ( $args eq "add" )
{
return weechat::WEECHAT_RC_OK if ( grep /^$buffers_name$/, @buffers_list ); # check if buffer already in list
push @buffers_list, ( $buffers_name );
my $buffers_list = &create_whitelist(\@buffers_list);
weechat::config_option_set( weechat::config_get("buffers.look.whitelist_buffers"), $buffers_list, 1);
weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" added to buffers whitelist");
}
elsif ( $args eq "del" )
{
return weechat::WEECHAT_RC_OK unless ( grep /^$buffers_name$/, @buffers_list ); # check if buffer is in list
@buffers_list = grep {$_ ne $buffers_name} @buffers_list; # delete entry
my $buffers_list = &create_whitelist(\@buffers_list);
weechat::config_option_set( weechat::config_get("buffers.look.whitelist_buffers"), $buffers_list, 1);
weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" deleted from buffers whitelist");
}
elsif ( $args eq "reset" )
{
return weechat::WEECHAT_RC_OK if ( $buffers_whitelist eq "" );
weechat::config_option_set( weechat::config_get("buffers.look.whitelist_buffers"), "", 1);
weechat::print(weechat::current_buffer(), "buffers whitelist is empty, now...");
}
return weechat::WEECHAT_RC_OK;
}
sub buffers_cmd_detach
{
my ( $data, $buffer, $args ) = @_;
$args = lc($args);
my $immune_detach_buffers = weechat::config_string( weechat::config_get("buffers.look.immune_detach_buffers") );
return weechat::WEECHAT_RC_OK if ( $immune_detach_buffers eq "" and $args eq "del" or $immune_detach_buffers eq "" and $args eq "reset" );
my @buffers_list = split( /,/, $immune_detach_buffers );
# get buffers name
my $infolist = weechat::infolist_get("buffer", weechat::current_buffer(), "");
weechat::infolist_next($infolist);
my $buffers_name = weechat::infolist_string($infolist, "name");
weechat::infolist_free($infolist);
return weechat::WEECHAT_RC_OK if ( $buffers_name eq "" ); # should never happen
if ( $args eq "add" )
{
return weechat::WEECHAT_RC_OK if ( grep /^$buffers_name$/, @buffers_list ); # check if buffer already in list
push @buffers_list, ( $buffers_name );
my $buffers_list = &create_whitelist(\@buffers_list);
weechat::config_option_set( weechat::config_get("buffers.look.immune_detach_buffers"), $buffers_list, 1);
weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" added to immune detach buffers");
}
elsif ( $args eq "del" )
{
return weechat::WEECHAT_RC_OK unless ( grep /^$buffers_name$/, @buffers_list ); # check if buffer is in list
@buffers_list = grep {$_ ne $buffers_name} @buffers_list; # delete entry
my $buffers_list = &create_whitelist(\@buffers_list);
weechat::config_option_set( weechat::config_get("buffers.look.immune_detach_buffers"), $buffers_list, 1);
weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" deleted from immune detach buffers");
}
elsif ( $args eq "reset" )
{
return weechat::WEECHAT_RC_OK if ( $immune_detach_buffers eq "" );
weechat::config_option_set( weechat::config_get("buffers.look.immune_detach_buffers"), "", 1);
weechat::print(weechat::current_buffer(), "immune detach buffers is empty, now...");
}
return weechat::WEECHAT_RC_OK;
}
sub create_whitelist
{
my @buffers_list = @{$_[0]};
my $buffers_list = "";
foreach (@buffers_list)
{
$buffers_list .= $_ .",";
}
# remove last ","
chop $buffers_list;
return $buffers_list;
}
# -------------------------------- [ config ] --------------------------------
sub hook_timer_detach
{
my $detach = $_[2];
if ( $detach eq 0 )
{
weechat::unhook($Hooks{timer_detach}) if $Hooks{timer_detach};
$Hooks{timer_detach} = "";
}
else
{
weechat::unhook($Hooks{timer_detach}) if $Hooks{timer_detach};
$Hooks{timer_detach} = weechat::hook_timer( weechat::config_integer( $options{"detach"}) * 1000, 60, 0, "buffers_signal_hotlist", "");
}
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub hook_timer_lag
{
my $lag = $_[2];
if ( $lag eq "off" )
{
weechat::unhook($Hooks{timer_lag}) if $Hooks{timer_lag};
$Hooks{timer_lag} = "";
}
else
{
weechat::unhook($Hooks{timer_lag}) if $Hooks{timer_lag};
$Hooks{timer_lag} = weechat::hook_timer( weechat::config_integer(weechat::config_get("irc.network.lag_refresh_interval")) * 1000, 0, 0, "buffers_signal_hotlist", "");
}
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub buffers_config_read
{
return weechat::config_read($buffers_config_file) if ($buffers_config_file ne "");
}
sub buffers_config_write
{
return weechat::config_write($buffers_config_file) if ($buffers_config_file ne "");
}
sub buffers_config_reload_cb
{
my ($data, $config_file) = ($_[0], $_[1]);
return weechat::config_reload($config_file)
}
sub buffers_config_init
{
$buffers_config_file = weechat::config_new($BUFFERS_CONFIG_FILE_NAME,
"buffers_config_reload_cb", "");
return if ($buffers_config_file eq "");
my %default_options_color =
("color_current_fg" => [
"current_fg", "color",
"foreground color for current buffer",
"", 0, 0, "lightcyan", "lightcyan", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_current_bg" => [
"current_bg", "color",
"background color for current buffer",
"", 0, 0, "red", "red", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_default_fg" => [
"default_fg", "color",
"default foreground color for buffer name",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_default_bg" => [
"default_bg", "color",
"default background color for buffer name",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_highlight_fg" => [
"hotlist_highlight_fg", "color",
"change foreground color of buffer name if a highlight messaged received",
"", 0, 0, "magenta", "magenta", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_highlight_bg" => [
"hotlist_highlight_bg", "color",
"change background color of buffer name if a highlight messaged received",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_low_fg" => [
"hotlist_low_fg", "color",
"change foreground color of buffer name if a low message received",
"", 0, 0, "white", "white", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_low_bg" => [
"hotlist_low_bg", "color",
"change background color of buffer name if a low message received",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_message_fg" => [
"hotlist_message_fg", "color",
"change foreground color of buffer name if a normal message received",
"", 0, 0, "yellow", "yellow", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_message_bg" => [
"hotlist_message_bg", "color",
"change background color of buffer name if a normal message received",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_private_fg" => [
"hotlist_private_fg", "color",
"change foreground color of buffer name if a private message received",
"", 0, 0, "lightgreen", "lightgreen", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_hotlist_private_bg" => [
"hotlist_private_bg", "color",
"change background color of buffer name if a private message received",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_number" => [
"number", "color",
"color for buffer number",
"", 0, 0, "lightgreen", "lightgreen", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_number_char" => [
"number_char", "color",
"color for buffer number char",
"", 0, 0, "lightgreen", "lightgreen", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_default_fg" => [
"whitelist_default_fg", "color",
"default foreground color for whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_default_bg" => [
"whitelist_default_bg", "color",
"default background color for whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_low_fg" => [
"whitelist_low_fg", "color",
"low color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_low_bg" => [
"whitelist_low_bg", "color",
"low color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_message_fg" => [
"whitelist_message_fg", "color",
"message color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_message_bg" => [
"whitelist_message_bg", "color",
"message color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_private_fg" => [
"whitelist_private_fg", "color",
"private color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_private_bg" => [
"whitelist_private_bg", "color",
"private color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_highlight_fg" => [
"whitelist_highlight_fg", "color",
"highlight color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_whitelist_highlight_bg" => [
"whitelist_highlight_bg", "color",
"highlight color of whitelist buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_none_channel_fg" => [
"none_channel_fg", "color",
"foreground color for none channel buffer (e.g.: core/server/plugin ".
"buffer)",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_none_channel_bg" => [
"none_channel_bg", "color",
"background color for none channel buffer (e.g.: core/server/plugin ".
"buffer)",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"queries_default_fg" => [
"queries_default_fg", "color",
"foreground color for query buffer without message",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"queries_default_bg" => [
"queries_default_bg", "color",
"background color for query buffer without message",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"queries_message_fg" => [
"queries_message_fg", "color",
"foreground color for query buffer with unread message",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"queries_message_bg" => [
"queries_message_bg", "color",
"background color for query buffer with unread message",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"queries_highlight_fg" => [
"queries_highlight_fg", "color",
"foreground color for query buffer with unread highlight",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"queries_highlight_bg" => [
"queries_highlight_bg", "color",
"background color for query buffer with unread highlight",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_prefix_bufname" => [
"prefix_bufname", "color",
"color for prefix of buffer name",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
"color_suffix_bufname" => [
"suffix_bufname", "color",
"color for suffix of buffer name",
"", 0, 0, "default", "default", 0,
"", "", "buffers_signal_config", "", "", ""
],
);
my %default_options_look =
(
"hotlist_counter" => [
"hotlist_counter", "boolean",
"show number of message for the buffer (this option needs WeeChat >= ".
"0.3.5). The relevant option for notification is \"weechat.look.".
"buffer_notify_default\"",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_lag" => [
"show_lag", "boolean",
"show lag behind server name. This option is using \"irc.color.".
"item_lag_finished\", ".
"\"irc.network.lag_min_show\" and \"irc.network.lag_refresh_interval\"",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"look_whitelist_buffers" => [
"whitelist_buffers", "string",
"comma separated list of buffers for using a different color scheme ".
"(for example: freenode.#weechat,freenode.#weechat-fr)",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config_whitelist", "", "", ""
],
"hide_merged_buffers" => [
"hide_merged_buffers", "integer",
"hide merged buffers. The value determines which merged buffers should ".
"be hidden, keepserver meaning 'all except server buffers'. Other values ".
"correspondent to the buffer type.",
"server|channel|private|keepserver|all|none", 0, 0, "none", "none", 0,
"", "", "buffers_signal_config", "", "", ""
],
"indenting" => [
"indenting", "integer", "use indenting for channel and query buffers. ".
"This option only takes effect if bar is left/right positioned",
"off|on|under_name", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"indenting_number" => [
"indenting_number", "boolean",
"use indenting for numbers. This option only takes effect if bar is ".
"left/right positioned",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"indenting_amount" => [
"indenting_amount", "integer",
"amount of indenting to use. This option only takes effect if bar ".
"is left/right positioned, and indenting is enabled",
"", 0, 16, 2, 2, 0,
"", "", "buffers_signal_config", "", "", ""
],
"short_names" => [
"short_names", "boolean",
"display short names (remove text before first \".\" in buffer name)",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_number" => [
"show_number", "boolean",
"display buffer number in front of buffer name",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_number_char" => [
"number_char", "string",
"display a char behind buffer number",
"", 0, 0, ".", ".", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_prefix_bufname" => [
"prefix_bufname", "string",
"prefix displayed in front of buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_suffix_bufname" => [
"suffix_bufname", "string",
"suffix displayed at end of buffer name",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_prefix" => [
"prefix", "boolean",
"displays your prefix for channel in front of buffer name",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_prefix_empty" => [
"prefix_empty", "boolean",
"use a placeholder for channels without prefix",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"show_prefix_query" => [
"prefix_for_query", "string",
"prefix displayed in front of query buffer",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config", "", "", ""
],
"sort" => [
"sort", "integer",
"sort buffer-list by \"number\" or \"name\"",
"number|name", 0, 0, "number", "number", 0,
"", "", "buffers_signal_config", "", "", ""
],
"core_to_front" => [
"core_to_front", "boolean",
"core buffer and buffers with free content will be listed first. ".
"Take only effect if buffer sort is by name",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"jump_prev_next_visited_buffer" => [
"jump_prev_next_visited_buffer", "boolean",
"jump to previously or next visited buffer if you click with ".
"left/right mouse button on currently visiting buffer",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"name_size_max" => [
"name_size_max", "integer",
"maximum size of buffer name. 0 means no limitation",
"", 0, 256, 0, 0, 0,
"", "", "buffers_signal_config", "", "", ""
],
"name_crop_suffix" => [
"name_crop_suffix", "string",
"contains an optional char(s) that is appended when buffer name is ".
"shortened",
"", 0, 0, "+", "+", 0,
"", "", "buffers_signal_config", "", "", ""
],
"detach" => [
"detach", "integer",
"detach buffer from buffers list after a specific period of time ".
"(in seconds) without action (weechat ≥ 0.3.8 required) (0 means \"off\")",
"", 0, 31536000, 0, "number", 0,
"", "", "buffers_signal_config", "", "", ""
],
"immune_detach_buffers" => [
"immune_detach_buffers", "string",
"comma separated list of buffers to NOT automatically detach. ".
"Allows \"*\" wildcard. Ex: \"BitlBee,freenode.*\"",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config_immune_detach_buffers", "", "", ""
],
"detach_query" => [
"detach_query", "boolean",
"query buffer will be detached",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"detach_buffer_immediately" => [
"detach_buffer_immediately", "string",
"comma separated list of buffers to detach immediately. Buffers ".
"will attach again based on notify level set in ".
"\"detach_buffer_immediately_level\". Allows \"*\" wildcard. ".
"Ex: \"BitlBee,freenode.*\"",
"", 0, 0, "", "", 0,
"", "", "buffers_signal_config_detach_buffer_immediately", "", "", ""
],
"detach_buffer_immediately_level" => [
"detach_buffer_immediately_level", "integer",
"The value determines what notify level messages are reattached from activity. ".
" This option works in conjunction with \"detach_buffer_immediately\" ".
"0: low priority (like join/part messages), ".
"1: message, ".
"2: private, ".
"3: highlight",
"", 0, 3, 2, 2, 0,
"", "", "buffers_signal_config", "", "", ""
],
"detach_free_content" => [
"detach_free_content", "boolean",
"buffers with free content will be detached (Ex: iset, chanmon)",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"detach_displayed_buffers" => [
"detach_displayed_buffers", "boolean",
"buffers displayed in a (split) window will be detached",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"detach_display_window_number" => [
"detach_display_window_number", "boolean",
"window number will be add, behind buffer name (this option takes only ".
"effect with \"detach_displayed_buffers\" option)",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"mark_inactive" => [
"mark_inactive", "boolean",
"if option is \"on\", inactive buffers (those you are not in) will have ".
"parentheses around them. An inactive buffer will not be detached.",
"", 0, 0, "off", "off", 0,
"", "", "buffers_signal_config", "", "", ""
],
"toggle_bar" => [
"toggle_bar", "boolean",
"if option is \"on\", buffers bar will hide/show when script is ".
"(un)loaded.",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"mouse_move_buffer" => [
"mouse_move_buffer", "boolean",
"if option is \"on\", mouse gestures (drag & drop) can move buffers in list.",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
"mouse_wheel" => [
"mouse_wheel", "boolean",
"if option is \"on\", mouse wheel jumps to previous/next buffer in list.",
"", 0, 0, "on", "on", 0,
"", "", "buffers_signal_config", "", "", ""
],
);
# section "color"
my $section_color = weechat::config_new_section(
$buffers_config_file,
"color", 0, 0, "", "", "", "", "", "", "", "", "", "");
if ($section_color eq "")
{
weechat::config_free($buffers_config_file);
return;
}
foreach my $option (keys %default_options_color)
{
$options{$option} = weechat::config_new_option(
$buffers_config_file,
$section_color,
$default_options_color{$option}[0],
$default_options_color{$option}[1],
$default_options_color{$option}[2],
$default_options_color{$option}[3],
$default_options_color{$option}[4],
$default_options_color{$option}[5],
$default_options_color{$option}[6],
$default_options_color{$option}[7],
$default_options_color{$option}[8],
$default_options_color{$option}[9],
$default_options_color{$option}[10],
$default_options_color{$option}[11],
$default_options_color{$option}[12],
$default_options_color{$option}[13],
$default_options_color{$option}[14]);
}
# section "look"
my $section_look = weechat::config_new_section(
$buffers_config_file,
"look", 0, 0, "", "", "", "", "", "", "", "", "", "");
if ($section_look eq "")
{
weechat::config_free($buffers_config_file);
return;
}
foreach my $option (keys %default_options_look)
{
$options{$option} = weechat::config_new_option(
$buffers_config_file,
$section_look,
$default_options_look{$option}[0],
$default_options_look{$option}[1],
$default_options_look{$option}[2],
$default_options_look{$option}[3],
$default_options_look{$option}[4],
$default_options_look{$option}[5],
$default_options_look{$option}[6],
$default_options_look{$option}[7],
$default_options_look{$option}[8],
$default_options_look{$option}[9],
$default_options_look{$option}[10],
$default_options_look{$option}[11],
$default_options_look{$option}[12],
$default_options_look{$option}[13],
$default_options_look{$option}[14],
$default_options_look{$option}[15]);
}
}
sub build_buffers
{
my $str = "";
# get bar position (left/right/top/bottom)
my $position = "left";
my $option_position = weechat::config_get("weechat.bar.buffers.position");
if ($option_position ne "")
{
$position = weechat::config_string($option_position);
}
# read hotlist
my %hotlist;
my $infolist = weechat::infolist_get("hotlist", "", "");
while (weechat::infolist_next($infolist))
{
$hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")} =
weechat::infolist_integer($infolist, "priority");
if ( weechat::config_boolean( $options{"hotlist_counter"} ) eq 1 and $weechat_version >= 0x00030500)
{
$hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_00"} =
weechat::infolist_integer($infolist, "count_00"); # low message
$hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_01"} =
weechat::infolist_integer($infolist, "count_01"); # channel message
$hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_02"} =
weechat::infolist_integer($infolist, "count_02"); # private message
$hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_03"} =
weechat::infolist_integer($infolist, "count_03"); # highlight message
}
}
weechat::infolist_free($infolist);
# read buffers list
@buffers_focus = ();
my @buffers;
my @current1 = ();
my @current2 = ();
my $old_number = -1;
my $max_number = 0;
my $max_number_digits = 0;
my $active_seen = 0;
$infolist = weechat::infolist_get("buffer", "", "");
while (weechat::infolist_next($infolist))
{
# ignore hidden buffers (WeeChat >= 0.4.4)
if ($weechat_version >= 0x00040400)
{
next if (weechat::infolist_integer($infolist, "hidden"));
}
my $buffer;
my $number = weechat::infolist_integer($infolist, "number");
if ($number ne $old_number)
{
@buffers = (@buffers, @current2, @current1);
@current1 = ();
@current2 = ();
$active_seen = 0;
}
if ($number > $max_number)
{
$max_number = $number;
}
$old_number = $number;
my $active = weechat::infolist_integer($infolist, "active");
if ($active)
{
$active_seen = 1;
}
$buffer->{"pointer"} = weechat::infolist_pointer($infolist, "pointer");
$buffer->{"number"} = $number;
$buffer->{"active"} = $active;
$buffer->{"current_buffer"} = weechat::infolist_integer($infolist, "current_buffer");
$buffer->{"num_displayed"} = weechat::infolist_integer($infolist, "num_displayed");
$buffer->{"plugin_name"} = weechat::infolist_string($infolist, "plugin_name");
$buffer->{"name"} = weechat::infolist_string($infolist, "name");
$buffer->{"short_name"} = weechat::infolist_string($infolist, "short_name");
$buffer->{"full_name"} = $buffer->{"plugin_name"}.".".$buffer->{"name"};
$buffer->{"type"} = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type");
#weechat::print("", $buffer->{"type"});
# check if buffer is active (or maybe a /part, /kick channel)
if ($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1)
{
my $server = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_server");
my $channel = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_channel");
my $infolist_channel = weechat::infolist_get("irc_channel", "", $server.",".$channel);
if ($infolist_channel)
{
weechat::infolist_next($infolist_channel);
$buffer->{"nicks_count"} = weechat::infolist_integer($infolist_channel, "nicks_count");
}else
{
$buffer->{"nicks_count"} = 0;
}
weechat::infolist_free($infolist_channel);
}
my $result = check_immune_detached_buffers($buffer->{"name"}); # checking for wildcard
my $maxlevel = weechat::config_integer($options{"detach_buffer_immediately_level"});
next if ( check_detach_buffer_immediately($buffer->{"name"}) eq 1
and $buffer->{"current_buffer"} eq 0
and ( not exists $hotlist{$buffer->{"pointer"}} or $hotlist{$buffer->{"pointer"}} < $maxlevel) ); # checking for buffer to immediately detach
unless ($result)
{
my $detach_time = weechat::config_integer( $options{"detach"});
my $current_time = time();
# set timer for buffers with no hotlist action
$buffers_timer{$buffer->{"pointer"}} = $current_time
if ( not exists $hotlist{$buffer->{"pointer"}}
and $buffer->{"type"} eq "channel"
and not exists $buffers_timer{$buffer->{"pointer"}}
and $detach_time > 0);
$buffers_timer{$buffer->{"pointer"}} = $current_time
if (weechat::config_boolean($options{"detach_query"}) eq 1
and not exists $hotlist{$buffer->{"pointer"}}
and $buffer->{"type"} eq "private"
and not exists $buffers_timer{$buffer->{"pointer"}}
and $detach_time > 0);
$detach_time = 0
if (weechat::config_boolean($options{"detach_query"}) eq 0
and $buffer->{"type"} eq "private");
# free content buffer
$buffers_timer{$buffer->{"pointer"}} = $current_time
if (weechat::config_boolean($options{"detach_free_content"}) eq 1
and not exists $hotlist{$buffer->{"pointer"}}
and $buffer->{"type"} eq ""
and not exists $buffers_timer{$buffer->{"pointer"}}
and $detach_time > 0);
$detach_time = 0
if (weechat::config_boolean($options{"detach_free_content"}) eq 0
and $buffer->{"type"} eq "");
$detach_time = 0 if (weechat::config_boolean($options{"mark_inactive"}) eq 1 and defined $buffer->{"nicks_count"} and $buffer->{"nicks_count"} == 0);
# check for detach
unless ( $buffer->{"current_buffer"} eq 0
and not exists $hotlist{$buffer->{"pointer"}}
# and $buffer->{"type"} eq "channel"
and exists $buffers_timer{$buffer->{"pointer"}}
and $detach_time > 0
and $weechat_version >= 0x00030800
and $current_time - $buffers_timer{$buffer->{"pointer"}} >= $detach_time)
{
if ($active_seen)
{
push(@current2, $buffer);
}
else
{
push(@current1, $buffer);
}
}
elsif ( $buffer->{"current_buffer"} eq 0
and not exists $hotlist{$buffer->{"pointer"}}
# and $buffer->{"type"} eq "channel"
and exists $buffers_timer{$buffer->{"pointer"}}
and $detach_time > 0
and $weechat_version >= 0x00030800
and $current_time - $buffers_timer{$buffer->{"pointer"}} >= $detach_time)
{ # check for option detach_displayed_buffers and if buffer is displayed in a split window
if ( $buffer->{"num_displayed"} eq 1
and weechat::config_boolean($options{"detach_displayed_buffers"}) eq 0 )
{
my $infolist_window = weechat::infolist_get("window", "", "");
while (weechat::infolist_next($infolist_window))
{
my $buffer_ptr = weechat::infolist_pointer($infolist_window, "buffer");
if ($buffer_ptr eq $buffer->{"pointer"})
{
$buffer->{"window"} = weechat::infolist_integer($infolist_window, "number");
}
}
weechat::infolist_free($infolist_window);
push(@current2, $buffer);
}
}
}
else # buffer in "immune_detach_buffers"
{
if ($active_seen)
{
push(@current2, $buffer);
}
else
{
push(@current1, $buffer);
}
}
} # while end
if ($max_number >= 1)
{
$max_number_digits = length(int($max_number));
}
@buffers = (@buffers, @current2, @current1);
weechat::infolist_free($infolist);
# sort buffers by number, name or shortname
my %sorted_buffers;
if (1)
{
my $number = 0;
for my $buffer (@buffers)
{
my $key;
if (weechat::config_integer( $options{"sort"} ) eq 1) # number = 0; name = 1
{
my $name = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_custom_name");
if (not defined $name or $name eq "") {
if (weechat::config_boolean( $options{"short_names"} ) eq 1) {
$name = $buffer->{"short_name"};
} else {
$name = $buffer->{"name"};
}
}
if (weechat::config_integer($options{"name_size_max"}) >= 1)
{
$maxlength = weechat::config_integer($options{"name_size_max"});
if($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0)
{
$maxlength -= 2;
}
$name = encode("UTF-8", substr(decode("UTF-8", $name), 0, $maxlength));
}
if ( weechat::config_boolean($options{"core_to_front"}) eq 1)
{
if ( (weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "channel" ) and ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "private") )
{
my $type = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type");
if ( $type eq "" and $name ne "weechat")
{
$name = " " . $name
}else
{
$name = " " . $name;
}
}
}
$key = sprintf("%s%08d", lc($name), $buffer->{"number"});
}
else
{
$key = sprintf("%08d", $number);
}
$sorted_buffers{$key} = $buffer;
$number++;
}
}
# build string with buffers
$old_number = -1;
foreach my $key (sort keys %sorted_buffers)
{
my $buffer = $sorted_buffers{$key};
if ( weechat::config_string($options{"hide_merged_buffers"}) eq "server" )
{
# buffer type "server" or merged with core?
if ( ($buffer->{"type"} eq "server" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) )
{
next;
}
}
if ( weechat::config_string($options{"hide_merged_buffers"}) eq "channel" )
{
# buffer type "channel" or merged with core?
if ( ($buffer->{"type"} eq "channel" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) )
{
next;
}
}
if ( weechat::config_string($options{"hide_merged_buffers"}) eq "private" )
{
# buffer type "private" or merged with core?
if ( ($buffer->{"type"} eq "private" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) )
{
next;
}
}
if ( weechat::config_string($options{"hide_merged_buffers"}) eq "keepserver" )
{
if ( ($buffer->{"type"} ne "server" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) )
{
next;
}
}
if ( weechat::config_string($options{"hide_merged_buffers"}) eq "all" )
{
if ( ! $buffer->{"active"} )
{
next;
}
}
push(@buffers_focus, $buffer); # buffer > buffers_focus, for mouse support
my $color = "";
my $bg = "";
$color = weechat::config_color( $options{"color_default_fg"} );
$bg = weechat::config_color( $options{"color_default_bg"} );
if ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") eq "private" )
{
if ( (weechat::config_color($options{"queries_default_bg"})) ne "default" || (weechat::config_color($options{"queries_default_fg"})) ne "default" )
{
$bg = weechat::config_color( $options{"queries_default_bg"} );
$color = weechat::config_color( $options{"queries_default_fg"} );
}
}
# check for core and buffer with free content
if ( (weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "channel" ) and ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "private") )
{
$color = weechat::config_color( $options{"color_none_channel_fg"} );
$bg = weechat::config_color( $options{"color_none_channel_bg"} );
}
# default whitelist buffer?
if (grep {$_ eq $buffer->{"name"}} @whitelist_buffers)
{
$color = weechat::config_color( $options{"color_whitelist_default_fg"} );
$bg = weechat::config_color( $options{"color_whitelist_default_bg"} );
}
$color = "default" if ($color eq "");
# color for channel and query buffer
if (exists $hotlist{$buffer->{"pointer"}})
{
delete $buffers_timer{$buffer->{"pointer"}};
# check if buffer is in whitelist buffer
if (grep {$_ eq $buffer->{"name"}} @whitelist_buffers)
{
$bg = weechat::config_color( $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} );
$color = weechat::config_color( $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} );
}
elsif ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") eq "private" )
{
# queries_default_fg/bg and buffers.color.queries_message_fg/bg
if ( (weechat::config_color($options{"queries_highlight_fg"})) ne "default" ||
(weechat::config_color($options{"queries_highlight_bg"})) ne "default" ||
(weechat::config_color($options{"queries_message_fg"})) ne "default" ||
(weechat::config_color($options{"queries_message_bg"})) ne "default" )
{
if ( ($hotlist{$buffer->{"pointer"}}) == 2 )
{
$bg = weechat::config_color( $options{"queries_message_bg"} );
$color = weechat::config_color( $options{"queries_message_fg"} );
}
elsif ( ($hotlist{$buffer->{"pointer"}}) == 3 )
{
$bg = weechat::config_color( $options{"queries_highlight_bg"} );
$color = weechat::config_color( $options{"queries_highlight_fg"} );
}
}else
{
$bg = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} );
$color = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} );
}
}else
{
$bg = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} );
$color = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} );
}
}
if ($buffer->{"current_buffer"})
{
$color = weechat::config_color( $options{"color_current_fg"} );
$bg = weechat::config_color( $options{"color_current_bg"} );
}
my $color_bg = "";
$color_bg = weechat::color(",".$bg) if ($bg ne "");
# create channel number for output
if ( weechat::config_string( $options{"show_prefix_bufname"} ) ne "" )
{
$str .= $color_bg .
weechat::color( weechat::config_color( $options{"color_prefix_bufname"} ) ).
weechat::config_string( $options{"show_prefix_bufname"} ).
weechat::color("default");
}
if ( weechat::config_boolean( $options{"show_number"} ) eq 1 ) # on
{
if (( weechat::config_boolean( $options{"indenting_number"} ) eq 1)
&& (($position eq "left") || ($position eq "right")))
{
$str .= weechat::color("default").$color_bg
.(" " x ($max_number_digits - length(int($buffer->{"number"}))));
}
if ($old_number ne $buffer->{"number"})
{
$str .= weechat::color( weechat::config_color( $options{"color_number"} ) )
.$color_bg
.$buffer->{"number"}
.weechat::color("default")
.$color_bg
.weechat::color( weechat::config_color( $options{"color_number_char"} ) )
.weechat::config_string( $options{"show_number_char"} )
.$color_bg;
}
else
{
# Indentation aligns channels in a visually appealing way
# when viewing list top-to-bottom...
my $indent = (" " x length($buffer->{"number"}))." ";
# ...except when list is top/bottom and channels left-to-right.
my $option_pos = weechat::config_string( weechat::config_get( "weechat.bar.buffers.position" ) );
if (($option_pos eq 'top') || ($option_pos eq 'bottom')) {
my $option_filling = weechat::config_string( weechat::config_get( "weechat.bar.buffers.filling_top_bottom" ) );
if ($option_filling =~ /horizontal/) {
$indent = '';
}
}
$str .= weechat::color("default")
.$color_bg
.$indent;
}
}
if (( weechat::config_integer( $options{"indenting"} ) ne 0 ) # indenting NOT off
&& (($position eq "left") || ($position eq "right")))
{
my $type = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type");
if (($type eq "channel") || ($type eq "private"))
{
if ( weechat::config_integer( $options{"indenting"} ) eq 1 )
{
$str .= (" " x weechat::config_integer( $options{"indenting_amount"} ) );
}
elsif ( (weechat::config_integer($options{"indenting"}) eq 2) and (weechat::config_integer($options{"indenting_number"}) eq 0) ) #under_name
{
if ( weechat::config_boolean( $options{"show_number"} ) eq 0 )
{
$str .= (" " x weechat::config_integer( $options{"indenting_amount"} ) );
}
else
{
$str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) )).(" " x weechat::config_integer( $options{"indenting_amount"} ) ) );
}
}
}
}
$str .= weechat::config_string( $options{"show_prefix_query"}) if (weechat::config_string( $options{"show_prefix_query"} ) ne "" and $buffer->{"type"} eq "private");
if (weechat::config_boolean( $options{"show_prefix"} ) eq 1)
{
my $nickname = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_nick");
if ($nickname ne "")
{
# with version >= 0.3.2, this infolist will return only nick
# with older versions, whole nicklist is returned for buffer, and this can be very slow
my $infolist_nick = weechat::infolist_get("nicklist", $buffer->{"pointer"}, "nick_".$nickname);
if ($infolist_nick ne "")
{
while (weechat::infolist_next($infolist_nick))
{
if ((weechat::infolist_string($infolist_nick, "type") eq "nick")
&& (weechat::infolist_string($infolist_nick, "name") eq $nickname))
{
my $prefix = weechat::infolist_string($infolist_nick, "prefix");
if (($prefix ne " ") or (weechat::config_boolean( $options{"show_prefix_empty"} ) eq 1))
{
# with version >= 0.3.5, it is now a color name (for older versions: option name with color)
if (int($weechat_version) >= 0x00030500)
{
$str .= weechat::color(weechat::infolist_string($infolist_nick, "prefix_color"));
}
else
{
$str .= weechat::color(weechat::config_color(
weechat::config_get(
weechat::infolist_string($infolist_nick, "prefix_color"))));
}
$str .= $prefix;
}
last;
}
}
weechat::infolist_free($infolist_nick);
}
}
}
if ($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0)
{
$str .= "(";
}
$str .= weechat::color($color) . weechat::color(",".$bg);
my $name = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_custom_name");
if (not defined $name or $name eq "")
{
if (weechat::config_boolean( $options{"short_names"} ) eq 1) {
$name = $buffer->{"short_name"};
} else {
$name = $buffer->{"name"};
}
}
if (weechat::config_integer($options{"name_size_max"}) >= 1) # check max_size of buffer name
{
$name = decode("UTF-8", $name);
$maxlength = weechat::config_integer($options{"name_size_max"});
if($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0)
{
$maxlength -= 2;
}
$str .= encode("UTF-8", substr($name, 0, $maxlength));
$str .= weechat::color(weechat::config_color( $options{"color_number_char"})).weechat::config_string($options{"name_crop_suffix"}) if (length($name) > weechat::config_integer($options{"name_size_max"}));
$str .= add_inactive_parentless($buffer->{"type"}, $buffer->{"nicks_count"});
$str .= add_hotlist_count($buffer->{"pointer"}, %hotlist);
}
else
{
$str .= $name;
$str .= add_inactive_parentless($buffer->{"type"}, $buffer->{"nicks_count"});
$str .= add_hotlist_count($buffer->{"pointer"}, %hotlist);
}
if ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") eq "server" and weechat::config_boolean($options{"show_lag"}) eq 1)
{
my $color_lag = weechat::config_color(weechat::config_get("irc.color.item_lag_finished"));
my $min_lag = weechat::config_integer(weechat::config_get("irc.network.lag_min_show"));
my $infolist_server = weechat::infolist_get("irc_server", "", $buffer->{"short_name"});
weechat::infolist_next($infolist_server);
my $lag = (weechat::infolist_integer($infolist_server, "lag"));
weechat::infolist_free($infolist_server);
if ( int($lag) > int($min_lag) )
{
$lag = $lag / 1000;
$str .= weechat::color("default") . " (" . weechat::color($color_lag) . $lag . weechat::color("default") . ")";
}
}
if (weechat::config_boolean($options{"detach_displayed_buffers"}) eq 0
and weechat::config_boolean($options{"detach_display_window_number"}) eq 1)
{
if ($buffer->{"window"})
{
$str .= weechat::color("default") . " (" . weechat::color(weechat::config_color( $options{"color_number"})) . $buffer->{"window"} . weechat::color("default") . ")";
}
}
$str .= weechat::color("default");
if ( weechat::config_string( $options{"show_suffix_bufname"} ) ne "" )
{
$str .= weechat::color( weechat::config_color( $options{"color_suffix_bufname"} ) ).
weechat::config_string( $options{"show_suffix_bufname"} ).
weechat::color("default");
}
$str .= "\n";
$old_number = $buffer->{"number"};
}
# remove spaces and/or linefeed at the end
$str =~ s/\s+$//;
chomp($str);
return $str;
}
sub add_inactive_parentless
{
my ($buf_type, $buf_nicks_count) = @_;
my $str = "";
if ($buf_type eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buf_nicks_count == 0)
{
$str .= weechat::color(weechat::config_color( $options{"color_number_char"}));
$str .= ")";
}
return $str;
}
sub add_hotlist_count
{
my ($bufpointer, %hotlist) = @_;
return "" if ( weechat::config_boolean( $options{"hotlist_counter"} ) eq 0 or ($weechat_version < 0x00030500)); # off
my $col_number_char = weechat::color(weechat::config_color( $options{"color_number_char"}) );
my $str = " ".$col_number_char."(";
# 0 = low level
if (defined $hotlist{$bufpointer."_count_00"})
{
my $bg = weechat::config_color( $options{"color_hotlist_low_bg"} );
my $color = weechat::config_color( $options{"color_hotlist_low_fg"} );
$str .= weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_00"} if ($hotlist{$bufpointer."_count_00"} ne "0");
}
# 1 = message
if (defined $hotlist{$bufpointer."_count_01"})
{
my $bg = weechat::config_color( $options{"color_hotlist_message_bg"} );
my $color = weechat::config_color( $options{"color_hotlist_message_fg"} );
if ($str =~ /[0-9]$/)
{
$str .= ",".
weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_01"} if ($hotlist{$bufpointer."_count_01"} ne "0");
}else
{
$str .= weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_01"} if ($hotlist{$bufpointer."_count_01"} ne "0");
}
}
# 2 = private
if (defined $hotlist{$bufpointer."_count_02"})
{
my $bg = weechat::config_color( $options{"color_hotlist_private_bg"} );
my $color = weechat::config_color( $options{"color_hotlist_private_fg"} );
if ($str =~ /[0-9]$/)
{
$str .= ",".
weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_02"} if ($hotlist{$bufpointer."_count_02"} ne "0");
}else
{
$str .= weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_02"} if ($hotlist{$bufpointer."_count_02"} ne "0");
}
}
# 3 = highlight
if (defined $hotlist{$bufpointer."_count_03"})
{
my $bg = weechat::config_color( $options{"color_hotlist_highlight_bg"} );
my $color = weechat::config_color( $options{"color_hotlist_highlight_fg"} );
if ($str =~ /[0-9]$/)
{
$str .= ",".
weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_03"} if ($hotlist{$bufpointer."_count_03"} ne "0");
}else
{
$str .= weechat::color($bg).
weechat::color($color).
$hotlist{$bufpointer."_count_03"} if ($hotlist{$bufpointer."_count_03"} ne "0");
}
}
$str .= $col_number_char. ")";
$str = "" if (weechat::string_remove_color($str, "") eq " ()"); # remove color and check for buffer with no messages
return $str;
}
sub buffers_signal_buffer
{
my ($data, $signal, $signal_data) = @_;
# check for buffer_switch and set or remove detach time
if ($weechat_version >= 0x00030800)
{
if ($signal eq "buffer_switch")
{
my $pointer = weechat::hdata_get_list (weechat::hdata_get("buffer"), "gui_buffer_last_displayed"); # get switched buffer
my $current_time = time();
if ( weechat::buffer_get_string($pointer, "localvar_type") eq "channel")
{
$buffers_timer{$pointer} = $current_time;
}
else
{
delete $buffers_timer{$pointer};
}
}
if ($signal eq "buffer_opened")
{
my $current_time = time();
$buffers_timer{$signal_data} = $current_time;
}
if ($signal eq "buffer_closing")
{
delete $buffers_timer{$signal_data};
}
}
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub buffers_signal_hotlist
{
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub buffers_signal_config_whitelist
{
@whitelist_buffers = ();
@whitelist_buffers = split( /,/, weechat::config_string( $options{"look_whitelist_buffers"} ) );
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub buffers_signal_config_immune_detach_buffers
{
@immune_detach_buffers = ();
@immune_detach_buffers = split( /,/, weechat::config_string( $options{"immune_detach_buffers"} ) );
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub buffers_signal_config_detach_buffer_immediately
{
@detach_buffer_immediately = ();
@detach_buffer_immediately = split( /,/, weechat::config_string( $options{"detach_buffer_immediately"} ) );
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
sub buffers_signal_config
{
weechat::bar_item_update($SCRIPT_NAME);
return weechat::WEECHAT_RC_OK;
}
# called when mouse click occured in buffers item: this callback returns buffer
# hash according to line of item where click occured
sub buffers_focus_buffers
{
my %info = %{$_[1]};
my $item_line = int($info{"_bar_item_line"});
undef my $hash;
if (($info{"_bar_item_name"} eq $SCRIPT_NAME) && ($item_line >= 0) && ($item_line <= $#buffers_focus))
{
$hash = $buffers_focus[$item_line];
}
else
{
$hash = {};
my $hash_focus = $buffers_focus[0];
foreach my $key (keys %$hash_focus)
{
$hash->{$key} = "?";
}
}
return $hash;
}
# called when a mouse action is done on buffers item, to execute action
# possible actions: jump to a buffer or move buffer in list (drag & drop of buffer)
sub buffers_hsignal_mouse
{
my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]});
my $current_buffer = weechat::buffer_get_integer(weechat::current_buffer(), "number"); # get current buffer number
if ( $hash{"_key"} eq "button1" )
{
# left mouse button
if ($hash{"number"} eq $hash{"number2"})
{
if ( weechat::config_boolean($options{"jump_prev_next_visited_buffer"}) )
{
if ( $current_buffer eq $hash{"number"} )
{
weechat::command("", "/input jump_previously_visited_buffer");
}
else
{
weechat::command("", "/buffer ".$hash{"full_name"});
}
}
else
{
weechat::command("", "/buffer ".$hash{"full_name"});
}
}
else
{
move_buffer(%hash) if (weechat::config_boolean($options{"mouse_move_buffer"}));
}
}
elsif ( ($hash{"_key"} eq "button2") && (weechat::config_boolean($options{"jump_prev_next_visited_buffer"})) )
{
# right mouse button
if ( $current_buffer eq $hash{"number2"} )
{
weechat::command("", "/input jump_next_visited_buffer");
}
}
elsif ( $hash{"_key"} =~ /wheelup$/ )
{
# wheel up
if (weechat::config_boolean($options{"mouse_wheel"}))
{
weechat::command("", "/buffer -1");
}
}
elsif ( $hash{"_key"} =~ /wheeldown$/ )
{
# wheel down
if (weechat::config_boolean($options{"mouse_wheel"}))
{
weechat::command("", "/buffer +1");
}
}
else
{
my $infolist = weechat::infolist_get("hook", "", "command,menu");
my $has_menu_command = weechat::infolist_next($infolist);
weechat::infolist_free($infolist);
if ( $has_menu_command && $hash{"_key"} =~ /button2/ )
{
if ($hash{"number"} eq $hash{"number2"})
{
weechat::command($hash{"pointer"}, "/menu buffer1 $hash{short_name} $hash{number}");
}
else
{
weechat::command($hash{"pointer"}, "/menu buffer2 $hash{short_name}/$hash{short_name2} $hash{number} $hash{number2}")
}
}
else
{
move_buffer(%hash) if (weechat::config_boolean($options{"mouse_move_buffer"}));
}
}
}
sub move_buffer
{
my %hash = @_;
my $number2 = $hash{"number2"};
if ($number2 eq "?")
{
# if number 2 is not known (end of gesture outside buffers list), then set it
# according to mouse gesture
$number2 = "1";
if (($hash{"_key"} =~ /gesture-right/) || ($hash{"_key"} =~ /gesture-down/))
{
$number2 = "999999";
if ($weechat_version >= 0x00030600)
{
my $hdata_buffer = weechat::hdata_get("buffer");
my $last_gui_buffer = weechat::hdata_get_list($hdata_buffer, "last_gui_buffer");
if ($last_gui_buffer)
{
$number2 = weechat::hdata_integer($hdata_buffer, $last_gui_buffer, "number") + 1;
}
}
}
}
my $ptrbuf = weechat::current_buffer();
weechat::command($hash{"pointer"}, "/buffer move ".$number2);
}
sub check_immune_detached_buffers
{
my ($buffername) = @_;
foreach ( @immune_detach_buffers ){
my $immune_buffer = weechat::string_mask_to_regex($_);
if ($buffername =~ /^$immune_buffer$/i)
{
return 1;
}
}
return 0;
}
sub check_detach_buffer_immediately
{
my ($buffername) = @_;
foreach ( @detach_buffer_immediately ){
my $detach_buffer = weechat::string_mask_to_regex($_);
if ($buffername =~ /^$detach_buffer$/i)
{
return 1;
}
}
return 0;
}
sub shutdown_cb
{
weechat::command("", "/bar hide " . $SCRIPT_NAME) if ( weechat::config_boolean($options{"toggle_bar"}) eq 1 );
return weechat::WEECHAT_RC_OK
}
sub check_bar_item
{
my $item = 0;
my $infolist = weechat::infolist_get("bar", "", "");
while (weechat::infolist_next($infolist))
{
my $bar_items = weechat::infolist_string($infolist, "items");
if (index($bar_items, $SCRIPT_NAME) != -1)
{
my $name = weechat::infolist_string($infolist, "name");
if ($name ne $SCRIPT_NAME)
{
$item = 1;
last;
}
}
}
weechat::infolist_free($infolist);
return $item;
}
| 40.925584 | 215 | 0.567676 |
ed1230f8852b6d89ae5e1bb7bc6769e9b5fdc8f8 | 74,812 | t | Perl | external/synple/data/si4.t | dnidever/apogee | 83ad7496a0b4193df9e2c01b06dc36cb879ea6c1 | [
"BSD-3-Clause"
]
| 5 | 2019-04-11T13:35:24.000Z | 2019-11-14T06:12:51.000Z | external/synple/data/si4.t | dnidever/apogee | 83ad7496a0b4193df9e2c01b06dc36cb879ea6c1 | [
"BSD-3-Clause"
]
| null | null | null | external/synple/data/si4.t | dnidever/apogee | 83ad7496a0b4193df9e2c01b06dc36cb879ea6c1 | [
"BSD-3-Clause"
]
| 5 | 2018-09-20T22:07:43.000Z | 2021-01-15T07:13:38.000Z | ****** Energy Levels (../levels/topbase/si4.l) (../levels/nist/si4.nl)
1.09152383e+16 2.0 3 ' 3s 2S' 0 0. 0 1.09370688e+16 1.08934078e+16 2 2 0 0 0 0
8.76887598e+15 6.0 3 ' 3p 2P*' 0 0. 0 8.79564767e+15 8.74673969e+15 2 2 1 1 1 1
6.10732009e+15 10.0 3 ' 3d 2D' 0 0. 0 6.11954897e+15 6.09508417e+15 2 2 2 2 0 0
5.09989719e+15 2.0 4 ' 4s 2S' 0 0. 0 5.11009698e+15 5.08969739e+15 2 2 0 0 0 0
4.36852826e+15 6.0 4 ' 4p 2P*' 0 0. 0 4.38050592e+15 4.35817737e+15 2 2 1 1 1 1
3.42018469e+15 10.0 4 ' 4d 2D' 0 0. 0 3.42702651e+15 3.41334215e+15 2 2 2 2 0 0
3.29666649e+15 14.0 4 ' 4f 2F*' 0 0. 0 3.30329335e+15 3.29004811e+15 2 2 3 3 1 1
2.95820811e+15 2.0 5 ' 5s 2S' 0 0. 0 2.96412453e+15 2.95229169e+15 2 2 0 0 0 0
2.62436054e+15 6.0 5 ' 5p 2P*' 0 0. 0 2.63111837e+15 2.61836028e+15 2 2 1 1 1 1
2.17636105e+15 10.0 5 ' 5d 2D' 0 0. 0 2.18071575e+15 2.17200702e+15 2 2 2 2 0 0
2.10976412e+15 14.0 5 ' 5f 2F*' 0 0. 0 2.11398365e+15 2.10554460e+15 2 2 3 3 1 1
1.93114906e+15 2.0 6 ' 6s 2S' 0 0. 0 1.93501136e+15 1.92728677e+15 2 2 0 0 0 0
1.75152556e+15 6.0 6 ' 6p 2P*' 0 0. 0 1.75585315e+15 1.74761188e+15 2 2 1 1 1 1
1.50430556e+15 10.0 6 ' 6d 2D' 0 0. 0 1.50731417e+15 1.50129695e+15 2 2 2 2 0 0
1.46487220e+15 14.0 6 ' 6f 2F*' 0 0. 0 1.46780194e+15 1.46194245e+15 2 2 3 3 1 1
1.35956962e+15 2.0 7 ' 7s 2S' 0 0. 0 1.36228876e+15 1.35685048e+15 2 2 0 0 0 0
1.25204191e+15 6.0 7 ' 7p 2P*' 0 0. 0 1.25504463e+15 1.24928950e+15 2 2 1 1 1 1
1.10117293e+15 10.0 7 ' 7d 2D' 0 0. 0 1.10337528e+15 1.09897059e+15 2 2 2 2 0 0
1.07604841e+15 14.0 7 ' 7f 2F*' 0 0. 0 1.07820051e+15 1.07389631e+15 2 2 3 3 1 1
1.00890636e+15 2.0 8 ' 8s 2S' 0 0. 0 1.01092417e+15 1.00688854e+15 2 2 0 0 0 0
9.39507031e+14 6.0 8 ' 8p 2P*' 0 0. 0 9.41707556e+14 9.37467903e+14 2 2 1 1 1 1
8.40666142e+14 10.0 8 ' 8d 2D' 0 0. 0 8.42347474e+14 8.38984810e+14 2 2 2 2 0 0
8.23727733e+14 14.0 8 ' 8f 2F*' 0 0. 0 8.25375188e+14 8.22080277e+14 2 2 3 3 1 1
****** Continuum transitions (../photoionization/topbase/si4.x.out)
1 24 1 317 0 0 0 9.5250e-20 0.0000e+00
-0.0215 -0.0087 0.0040 0.0168 0.0295 0.0423 0.0551 0.0678 0.0806 0.0933
0.1061 0.1189 0.1317 0.1444 0.1572 0.1700 0.1828 0.1955 0.2083 0.2211
0.2339 0.2467 0.2595 0.2723 0.2851 0.2978 0.3106 0.3234 0.3362 0.3490
0.3618 0.3746 0.3874 0.4002 0.4130 0.4258 0.4386 0.4514 0.4643 0.4771
0.4899 0.5027 0.5155 0.5283 0.5411 0.5539 0.5667 0.5796 0.5924 0.6052
0.6180 0.6308 0.6436 0.6565 0.6693 0.6821 0.6949 0.7077 0.7205 0.7334
0.7462 0.7590 0.7718 0.7847 0.7975 0.8103 0.8231 0.8360 0.8488 0.8616
0.8744 0.8873 0.9001 0.9129 0.9257 0.9386 0.9514 0.9642 0.9770 0.9899
1.0027 1.0155 1.0284 1.0412 1.0540 1.0668 1.0797 1.0925 1.1053 1.1182
1.1310 1.1438 1.1567 1.1695 1.1823 1.1952 1.2080 1.2208 1.2336 1.2465
1.2593 1.2721 1.2850 1.2978 1.3106 1.3235 1.3363 1.3491 1.3620 1.3748
1.3876 1.4005 1.4133 1.4261 1.4390 1.4518 1.4646 1.4775 1.4903 1.5032
1.5160 1.5288 1.5417 1.5545 1.5673 1.5802 1.5930 1.6058 1.6187 1.6315
1.6443 1.6572 1.6700 1.6828 1.6957 1.7085 1.7213 1.7342 1.7470 1.7599
1.7727 1.7855 1.7984 1.8112 1.8240 1.8369 1.8497 1.8625 1.8754 1.8882
1.9010 1.9139 1.9267 1.9396 1.9524 1.9652 1.9781 1.9909 2.0037 2.0166
2.0294 2.0422 2.0551 2.0679 2.0808 2.0936 2.1064 2.1193 2.1321 2.1449
2.1578 2.1706 2.1835 2.1963 2.2091 2.2220 2.2348 2.2476 2.2605 2.2733
2.2861 2.2990 2.3118 2.3247 2.3375 2.3503 2.3632 2.3760 2.3888 2.4017
2.4145 2.4273 2.4402 2.4530 2.4659 2.4787 2.4915 2.5044 2.5172 2.5300
2.5429 2.5557 2.5686 2.5814 2.5942 2.6071 2.6199 2.6327 2.6456 2.6584
2.6713 2.6841 2.6969 2.7098 2.7226 2.7354 2.7390
-0.4983 -0.5112 -0.5190 -0.5289 -0.5396 -0.5508 -0.5623 -0.5740 -0.5860 -0.5983
-0.6109 -0.6237 -0.6368 -0.6502 -0.6639 -0.6778 -0.6921 -0.7069 -0.7217 -0.7348
-0.7488 -0.7636 -0.7795 -0.7928 -0.8064 -0.8209 -0.8364 -0.8509 -0.8641 -0.8782
-0.8932 -0.9089 -0.9219 -0.9358 -0.9505 -0.9663 -0.9801 -0.9935 -1.0078 -1.0230
-1.0380 -1.0512 -1.0652 -1.0801 -1.0960 -1.1091 -1.1228 -1.1373 -1.1528 -1.1671
-1.1805 -1.1946 -1.2097 -1.2253 -1.2383 -1.2521 -1.2669 -1.2826 -1.2963 -1.3098
-1.3242 -1.3395 -1.3544 -1.3676 -1.3816 -1.3966 -1.4125 -1.4255 -1.4392 -1.4538
-1.4693 -1.4835 -1.4969 -1.5111 -1.5262 -1.5416 -1.5547 -1.5686 -1.5833 -1.5991
-1.6126 -1.6262 -1.6406 -1.6560 -1.6707 -1.6839 -1.6979 -1.7129 -1.7288 -1.7417
-1.7555 -1.7701 -1.7857 -1.7997 -1.8132 -1.8275 -1.8427 -1.8580 -1.8711 -1.8850
-1.8998 -1.9156 -1.9290 -1.9425 -1.9569 -1.9723 -1.9869 -2.0002 -2.0143 -2.0294
-2.0452 -2.0581 -2.0719 -2.0866 -2.1022 -2.1161 -2.1296 -2.1439 -2.1592 -2.1742
-2.1874 -2.2014 -2.2162 -2.2321 -2.2453 -2.2589 -2.2734 -2.2889 -2.3033 -2.3166
-2.3308 -2.3459 -2.3615 -2.3745 -2.3883 -2.4030 -2.4187 -2.4325 -2.4460 -2.4603
-2.4756 -2.4906 -2.5037 -2.5178 -2.5327 -2.5486 -2.5617 -2.5754 -2.5899 -2.6054
-2.6197 -2.6330 -2.6472 -2.6624 -2.6778 -2.6909 -2.7047 -2.7195 -2.7353 -2.7489
-2.7624 -2.7768 -2.7922 -2.8070 -2.8201 -2.8342 -2.8491 -2.8650 -2.8779 -2.8917
-2.9063 -2.9219 -2.9361 -2.9495 -2.9638 -2.9790 -2.9943 -3.0074 -3.0212 -3.0360
-3.0518 -3.0652 -3.0788 -3.0932 -3.1086 -3.1233 -3.1365 -3.1506 -3.1656 -3.1814
-3.1944 -3.2081 -3.2228 -3.2384 -3.2524 -3.2658 -3.2801 -3.2953 -3.3104 -3.3236
-3.3375 -3.3524 -3.3683 -3.3815 -3.3952 -3.4097 -3.4251 -3.4396 -3.4529 -3.4670
-3.4821 -3.4977 -3.5107 -3.5245 -3.5392 -3.5548 -3.5594
2 24 1 305 0 0 0 1.6059e-19 0.0000e+00
-0.0269 -0.0141 -0.0014 0.0113 0.0241 0.0368 0.0496 0.0624 0.0751 0.0879
0.1006 0.1134 0.1262 0.1389 0.1517 0.1645 0.1773 0.1900 0.2028 0.2156
0.2284 0.2412 0.2539 0.2667 0.2795 0.2923 0.3051 0.3179 0.3307 0.3435
0.3563 0.3691 0.3819 0.3947 0.4075 0.4203 0.4331 0.4459 0.4587 0.4715
0.4843 0.4971 0.5099 0.5227 0.5355 0.5483 0.5611 0.5740 0.5868 0.5996
0.6124 0.6252 0.6380 0.6508 0.6637 0.6765 0.6893 0.7021 0.7149 0.7278
0.7406 0.7534 0.7662 0.7790 0.7919 0.8047 0.8175 0.8303 0.8432 0.8560
0.8688 0.8816 0.8945 0.9073 0.9201 0.9329 0.9458 0.9586 0.9714 0.9842
0.9971 1.0099 1.0227 1.0355 1.0484 1.0612 1.0740 1.0869 1.0997 1.1125
1.1254 1.1382 1.1510 1.1638 1.1767 1.1895 1.2023 1.2152 1.2280 1.2408
1.2537 1.2665 1.2793 1.2922 1.3050 1.3178 1.3307 1.3435 1.3563 1.3692
1.3820 1.3948 1.4077 1.4205 1.4333 1.4462 1.4590 1.4718 1.4847 1.4975
1.5103 1.5232 1.5360 1.5488 1.5617 1.5745 1.5873 1.6002 1.6130 1.6258
1.6387 1.6515 1.6644 1.6772 1.6900 1.7029 1.7157 1.7285 1.7414 1.7542
1.7670 1.7799 1.7927 1.8055 1.8184 1.8312 1.8440 1.8569 1.8697 1.8826
1.8954 1.9082 1.9211 1.9339 1.9467 1.9596 1.9724 1.9852 1.9981 2.0109
2.0238 2.0366 2.0494 2.0623 2.0751 2.0879 2.1008 2.1136 2.1264 2.1393
2.1521 2.1650 2.1778 2.1906 2.2035 2.2163 2.2291 2.2420 2.2548 2.2677
2.2805 2.2933 2.3062 2.3190 2.3318 2.3447 2.3575 2.3703 2.3832 2.3960
2.4089 2.4217 2.4345 2.4474 2.4602 2.4730 2.4859 2.4987 2.5115 2.5244
2.5372 2.5501 2.5629 2.5757 2.5841
-0.2714 -0.2757 -0.2806 -0.2862 -0.2922 -0.2987 -0.3058 -0.3135 -0.3218 -0.3306
-0.3400 -0.3499 -0.3606 -0.3718 -0.3835 -0.3960 -0.4092 -0.4231 -0.4379 -0.4529
-0.4690 -0.4862 -0.5007 -0.5154 -0.5311 -0.5479 -0.5628 -0.5774 -0.5930 -0.6096
-0.6250 -0.6394 -0.6548 -0.6712 -0.6871 -0.7014 -0.7167 -0.7330 -0.7494 -0.7635
-0.7786 -0.7947 -0.8114 -0.8255 -0.8404 -0.8564 -0.8735 -0.8876 -0.9024 -0.9183
-0.9352 -0.9498 -0.9645 -0.9801 -0.9968 -1.0119 -1.0264 -1.0419 -1.0585 -1.0740
-1.0884 -1.1038 -1.1202 -1.1362 -1.1505 -1.1657 -1.1820 -1.1984 -1.2126 -1.2276
-1.2437 -1.2606 -1.2747 -1.2896 -1.3055 -1.3225 -1.3367 -1.3515 -1.3673 -1.3842
-1.3989 -1.4135 -1.4292 -1.4459 -1.4610 -1.4756 -1.4910 -1.5076 -1.5232 -1.5375
-1.5529 -1.5692 -1.5853 -1.5995 -1.6147 -1.6309 -1.6475 -1.6616 -1.6767 -1.6928
-1.7098 -1.7238 -1.7387 -1.7545 -1.7715 -1.7858 -1.8006 -1.8164 -1.8332 -1.8480
-1.8626 -1.8781 -1.8947 -1.9100 -1.9245 -1.9400 -1.9566 -1.9723 -1.9867 -2.0019
-2.0182 -2.0344 -2.0486 -2.0638 -2.0800 -2.0966 -2.1107 -2.1257 -2.1417 -2.1588
-2.1728 -2.1877 -2.2035 -2.2205 -2.2349 -2.2496 -2.2653 -2.2821 -2.2970 -2.3116
-2.3272 -2.3438 -2.3592 -2.3736 -2.3891 -2.4055 -2.4214 -2.4357 -2.4509 -2.4672
-2.4836 -2.4977 -2.5128 -2.5290 -2.5457 -2.5598 -2.5748 -2.5908 -2.6079 -2.6219
-2.6368 -2.6526 -2.6696 -2.6841 -2.6988 -2.7144 -2.7312 -2.7462 -2.7607 -2.7763
-2.7929 -2.8083 -2.8227 -2.8381 -2.8545 -2.8704 -2.8848 -2.9000 -2.9163 -2.9328
-2.9469 -2.9619 -2.9779 -2.9947 -3.0088 -3.0237 -3.0397 -3.0568 -3.0710 -3.0858
-3.1015 -3.1184 -3.1331 -3.1477 -3.1634 -3.1801 -3.1952 -3.2098 -3.2252 -3.2418
-3.2574 -3.2718 -3.2871 -3.3035 -3.3148
3 24 1 176 0 0 0 6.0390e-19 0.0000e+00
-0.0391 -0.0263 -0.0134 -0.0005 0.0123 0.0252 0.0381 0.0509 0.0638 0.0767
0.0895 0.1024 0.1152 0.1281 0.1410 0.1538 0.1667 0.1795 0.1924 0.2053
0.2181 0.2310 0.2438 0.2567 0.2695 0.2824 0.2952 0.3081 0.3209 0.3338
0.3467 0.3595 0.3724 0.3852 0.3981 0.4109 0.4238 0.4366 0.4495 0.4623
0.4751 0.4880 0.5008 0.5137 0.5265 0.5394 0.5522 0.5651 0.5779 0.5908
0.6036 0.6165 0.6293 0.6421 0.6550 0.6678 0.6807 0.6935 0.7064 0.7192
0.7320 0.7449 0.7577 0.7706 0.7834 0.7963 0.8091 0.8219 0.8348 0.8476
0.8605 0.8733 0.8862 0.8990 0.9118 0.9204
0.3038 0.2642 0.2241 0.1839 0.1445 0.1060 0.0621 0.0209 -0.0198 -0.0612
-0.1031 -0.1453 -0.1878 -0.2302 -0.2726 -0.3153 -0.3583 -0.3983 -0.4416 -0.4857
-0.5292 -0.5753 -0.6191 -0.6629 -0.7071 -0.7442 -0.7855 -0.8325 -0.8823 -0.9256
-0.9695 -1.0143 -1.0571 -1.1029 -1.1450 -1.1898 -1.2334 -1.2771 -1.3222 -1.3648
-1.4104 -1.4528 -1.4975 -1.5413 -1.5848 -1.6302 -1.6725 -1.7180 -1.7606 -1.8050
-1.8490 -1.8924 -1.9382 -1.9803 -2.0255 -2.0684 -2.1126 -2.1570 -2.2001 -2.2461
-2.2880 -2.3331 -2.3762 -2.4202 -2.4648 -2.5077 -2.5537 -2.5957 -2.6406 -2.6840
-2.7278 -2.7728 -2.8155 -2.8614 -2.9035 -2.9348
4 24 1 275 0 0 0 1.3233e-19 0.0000e+00
-0.0473 -0.0345 -0.0218 -0.0090 0.0038 0.0166 0.0294 0.0421 0.0549 0.0677
0.0805 0.0933 0.1061 0.1189 0.1317 0.1444 0.1572 0.1700 0.1828 0.1956
0.2084 0.2212 0.2340 0.2468 0.2596 0.2725 0.2853 0.2981 0.3109 0.3237
0.3365 0.3493 0.3621 0.3749 0.3877 0.4006 0.4134 0.4262 0.4390 0.4518
0.4646 0.4774 0.4903 0.5031 0.5159 0.5287 0.5415 0.5544 0.5672 0.5800
0.5928 0.6056 0.6185 0.6313 0.6441 0.6569 0.6698 0.6826 0.6954 0.7082
0.7211 0.7339 0.7467 0.7595 0.7724 0.7852 0.7980 0.8109 0.8237 0.8365
0.8493 0.8622 0.8750 0.8878 0.9007 0.9135 0.9263 0.9392 0.9520 0.9648
0.9776 0.9905 1.0033 1.0161 1.0290 1.0418 1.0546 1.0675 1.0803 1.0931
1.1060 1.1188 1.1316 1.1445 1.1573 1.1701 1.1830 1.1958 1.2086 1.2215
1.2343 1.2471 1.2600 1.2728 1.2856 1.2985 1.3113 1.3241 1.3370 1.3498
1.3626 1.3755 1.3883 1.4011 1.4140 1.4268 1.4396 1.4525 1.4653 1.4781
1.4910 1.5038 1.5167 1.5295 1.5423 1.5552 1.5680 1.5808 1.5937 1.6065
1.6193 1.6322 1.6450 1.6578 1.6707 1.6835 1.6964 1.7092 1.7220 1.7349
1.7477 1.7605 1.7734 1.7862 1.7990 1.8119 1.8247 1.8376 1.8504 1.8632
1.8761 1.8889 1.9017 1.9146 1.9274 1.9402 1.9531 1.9659 1.9788 1.9916
2.0044 2.0173 2.0301 2.0429 2.0558 2.0686 2.0814 2.0943 2.1071 2.1200
2.1328 2.1456 2.1585 2.1713 2.1789
-0.3555 -0.3672 -0.3793 -0.3920 -0.4048 -0.4181 -0.4318 -0.4459 -0.4601 -0.4748
-0.4898 -0.5049 -0.5203 -0.5361 -0.5521 -0.5681 -0.5844 -0.6010 -0.6178 -0.6348
-0.6520 -0.6692 -0.6867 -0.7043 -0.7219 -0.7398 -0.7579 -0.7759 -0.7936 -0.8104
-0.8284 -0.8478 -0.8677 -0.8845 -0.9026 -0.9220 -0.9403 -0.9577 -0.9763 -0.9963
-1.0133 -1.0309 -1.0499 -1.0691 -1.0860 -1.1042 -1.1238 -1.1417 -1.1591 -1.1778
-1.1979 -1.2146 -1.2324 -1.2516 -1.2704 -1.2875 -1.3058 -1.3256 -1.3432 -1.3607
-1.3795 -1.3993 -1.4160 -1.4340 -1.4533 -1.4718 -1.4890 -1.5075 -1.5273 -1.5446
-1.5622 -1.5812 -1.6006 -1.6175 -1.6356 -1.6550 -1.6732 -1.6905 -1.7091 -1.7291
-1.7460 -1.7637 -1.7827 -1.8019 -1.8189 -1.8371 -1.8567 -1.8746 -1.8921 -1.9108
-1.9309 -1.9475 -1.9653 -1.9844 -2.0032 -2.0203 -2.0387 -2.0585 -2.0761 -2.0936
-2.1124 -2.1321 -2.1489 -2.1669 -2.1863 -2.2048 -2.2220 -2.2404 -2.2603 -2.2775
-2.2952 -2.3141 -2.3335 -2.3504 -2.3685 -2.3880 -2.4062 -2.4235 -2.4421 -2.4621
-2.4790 -2.4967 -2.5158 -2.5349 -2.5519 -2.5702 -2.5898 -2.6076 -2.6250 -2.6437
-2.6636 -2.6803 -2.6982 -2.7174 -2.7362 -2.7533 -2.7717 -2.7915 -2.8090 -2.8265
-2.8453 -2.8650 -2.8818 -2.8998 -2.9191 -2.9376 -2.9548 -2.9732 -2.9931 -3.0103
-3.0280 -3.0470 -3.0664 -3.0833 -3.1015 -3.1209 -3.1391 -3.1564 -3.1750 -3.1950
-3.2119 -3.2297 -3.2488 -3.2678 -3.2848 -3.3031 -3.3227 -3.3405 -3.3579 -3.3766
-3.3966 -3.4133 -3.4312 -3.4505 -3.4626
5 24 1 295 0 0 0 1.9470e-19 0.0000e+00
-0.0558 -0.0430 -0.0302 -0.0175 -0.0047 0.0081 0.0209 0.0336 0.0464 0.0592
0.0720 0.0847 0.0975 0.1103 0.1231 0.1359 0.1487 0.1615 0.1743 0.1871
0.1999 0.2127 0.2255 0.2382 0.2510 0.2638 0.2767 0.2895 0.3023 0.3151
0.3279 0.3407 0.3535 0.3663 0.3791 0.3919 0.4047 0.4175 0.4303 0.4432
0.4560 0.4688 0.4816 0.4944 0.5072 0.5201 0.5329 0.5457 0.5585 0.5713
0.5841 0.5970 0.6098 0.6226 0.6354 0.6483 0.6611 0.6739 0.6867 0.6995
0.7124 0.7252 0.7380 0.7508 0.7637 0.7765 0.7893 0.8022 0.8150 0.8278
0.8406 0.8535 0.8663 0.8791 0.8919 0.9048 0.9176 0.9304 0.9433 0.9561
0.9689 0.9818 0.9946 1.0074 1.0202 1.0331 1.0459 1.0587 1.0716 1.0844
1.0972 1.1101 1.1229 1.1357 1.1486 1.1614 1.1742 1.1871 1.1999 1.2127
1.2256 1.2384 1.2512 1.2641 1.2769 1.2897 1.3026 1.3154 1.3282 1.3411
1.3539 1.3667 1.3796 1.3924 1.4052 1.4181 1.4309 1.4437 1.4566 1.4694
1.4822 1.4951 1.5079 1.5208 1.5336 1.5464 1.5593 1.5721 1.5849 1.5978
1.6106 1.6234 1.6363 1.6491 1.6619 1.6748 1.6876 1.7004 1.7133 1.7261
1.7390 1.7518 1.7646 1.7775 1.7903 1.8031 1.8160 1.8288 1.8416 1.8545
1.8673 1.8802 1.8930 1.9058 1.9187 1.9315 1.9443 1.9572 1.9700 1.9828
1.9957 2.0085 2.0214 2.0342 2.0470 2.0599 2.0727 2.0855 2.0984 2.1112
2.1241 2.1369 2.1497 2.1626 2.1754 2.1882 2.2011 2.2139 2.2267 2.2396
2.2524 2.2653 2.2781 2.2909 2.3038 2.3166 2.3294 2.3423 2.3551 2.3679
2.3808 2.3936 2.4065 2.4193 2.4271
-0.1878 -0.1991 -0.2103 -0.2214 -0.2325 -0.2434 -0.2546 -0.2657 -0.2770 -0.2882
-0.2998 -0.3112 -0.3230 -0.3349 -0.3470 -0.3594 -0.3718 -0.3845 -0.3976 -0.4109
-0.4243 -0.4381 -0.4521 -0.4665 -0.4812 -0.4960 -0.5112 -0.5268 -0.5425 -0.5587
-0.5752 -0.5922 -0.6075 -0.6231 -0.6398 -0.6577 -0.6732 -0.6888 -0.7056 -0.7236
-0.7389 -0.7545 -0.7713 -0.7893 -0.8044 -0.8201 -0.8370 -0.8550 -0.8701 -0.8859
-0.9028 -0.9209 -0.9358 -0.9516 -0.9686 -0.9866 -1.0015 -1.0174 -1.0344 -1.0523
-1.0672 -1.0831 -1.1001 -1.1180 -1.1329 -1.1489 -1.1659 -1.1836 -1.1986 -1.2146
-1.2317 -1.2492 -1.2643 -1.2803 -1.2975 -1.3149 -1.3300 -1.3461 -1.3633 -1.3806
-1.3957 -1.4118 -1.4290 -1.4462 -1.4613 -1.4775 -1.4948 -1.5118 -1.5270 -1.5432
-1.5606 -1.5775 -1.5927 -1.6090 -1.6264 -1.6432 -1.6584 -1.6747 -1.6922 -1.7089
-1.7241 -1.7404 -1.7579 -1.7745 -1.7898 -1.8062 -1.8237 -1.8402 -1.8556 -1.8720
-1.8896 -1.9059 -1.9213 -1.9378 -1.9554 -1.9715 -1.9870 -2.0034 -2.0211 -2.0372
-2.0526 -2.0692 -2.0869 -2.1028 -2.1183 -2.1349 -2.1527 -2.1685 -2.1841 -2.2007
-2.2185 -2.2342 -2.2498 -2.2665 -2.2843 -2.2998 -2.3155 -2.3322 -2.3501 -2.3655
-2.3812 -2.3979 -2.4159 -2.4312 -2.4469 -2.4637 -2.4818 -2.4969 -2.5126 -2.5295
-2.5475 -2.5625 -2.5783 -2.5952 -2.6134 -2.6282 -2.6441 -2.6610 -2.6790 -2.6939
-2.7098 -2.7268 -2.7447 -2.7596 -2.7755 -2.7925 -2.8103 -2.8252 -2.8412 -2.8582
-2.8758 -2.8908 -2.9068 -2.9239 -2.9414 -2.9565 -2.9726 -2.9898 -3.0072 -3.0223
-3.0384 -3.0557 -3.0729 -3.0880 -3.1041 -3.1214 -3.1385 -3.1537 -3.1699 -3.1872
-3.2042 -3.2194 -3.2357 -3.2530 -3.2642
6 24 1 187 0 0 0 1.2555e-18 0.0000e+00
-0.0726 -0.0597 -0.0469 -0.0340 -0.0212 -0.0083 0.0045 0.0174 0.0302 0.0431
0.0559 0.0688 0.0816 0.0945 0.1073 0.1202 0.1330 0.1459 0.1587 0.1716
0.1844 0.1973 0.2101 0.2229 0.2358 0.2486 0.2615 0.2743 0.2872 0.3000
0.3129 0.3257 0.3385 0.3514 0.3642 0.3771 0.3899 0.4028 0.4156 0.4284
0.4413 0.4541 0.4670 0.4798 0.4927 0.5055 0.5183 0.5312 0.5440 0.5569
0.5697 0.5825 0.5954 0.6082 0.6211 0.6339 0.6467 0.6596 0.6724 0.6853
0.6981 0.7109 0.7238 0.7366 0.7495 0.7623 0.7751 0.7880 0.8008 0.8137
0.8265 0.8393 0.8522 0.8650 0.8779 0.8907 0.9035 0.9164 0.9292 0.9421
0.9549 0.9677 0.9806 0.9934 1.0062 1.0191 1.0308
0.6217 0.5907 0.5593 0.5276 0.4957 0.4635 0.4319 0.4006 0.3659 0.3342
0.3004 0.2668 0.2334 0.1986 0.1652 0.1300 0.0960 0.0606 0.0258 -0.0095
-0.0455 -0.0806 -0.1175 -0.1530 -0.1894 -0.2269 -0.2631 -0.3000 -0.3377 -0.3754
-0.4126 -0.4504 -0.4885 -0.5269 -0.5656 -0.6042 -0.6426 -0.6813 -0.7182 -0.7584
-0.7952 -0.8356 -0.8724 -0.9133 -0.9496 -0.9901 -1.0267 -1.0670 -1.1038 -1.1439
-1.1809 -1.2209 -1.2581 -1.2979 -1.3353 -1.3749 -1.4125 -1.4518 -1.4897 -1.5289
-1.5670 -1.6059 -1.6442 -1.6829 -1.7214 -1.7599 -1.7986 -1.8369 -1.8759 -1.9140
-1.9534 -1.9912 -2.0306 -2.0682 -2.1079 -2.1453 -2.1852 -2.2224 -2.2625 -2.2994
-2.3398 -2.3765 -2.4172 -2.4537 -2.4943 -2.5309 -2.5683
7 24 1 174 0 0 0 1.6383e-20 0.0000e+00
-0.0755 -0.0627 -0.0499 -0.0371 -0.0242 -0.0114 0.0014 0.0143 0.0271 0.0399
0.0528 0.0656 0.0784 0.0913 0.1041 0.1169 0.1298 0.1426 0.1554 0.1682
0.1811 0.1939 0.2067 0.2196 0.2324 0.2452 0.2581 0.2709 0.2838 0.2966
0.3094 0.3223 0.3351 0.3479 0.3608 0.3736 0.3864 0.3993 0.4121 0.4249
0.4378 0.4506 0.4634 0.4763 0.4891 0.5019 0.5148 0.5276 0.5404 0.5533
0.5661 0.5790 0.5918 0.6046 0.6175 0.6303 0.6431 0.6560 0.6688 0.6816
0.6945 0.7073 0.7201 0.7330 0.7458 0.7587 0.7715 0.7843 0.7972 0.8100
0.8228 0.8357 0.8485 0.8577
-1.2627 -1.3002 -1.3382 -1.3767 -1.4155 -1.4546 -1.4935 -1.5296 -1.5703 -1.6103
-1.6491 -1.6919 -1.7297 -1.7725 -1.8116 -1.8538 -1.8941 -1.9366 -1.9775 -2.0210
-2.0619 -2.1062 -2.1477 -2.1914 -2.2353 -2.2785 -2.3235 -2.3681 -2.4125 -2.4583
-2.5050 -2.5504 -2.5967 -2.6439 -2.6917 -2.7399 -2.7885 -2.8369 -2.8857 -2.9258
-2.9676 -3.0153 -3.0706 -3.1360 -3.1839 -3.2338 -3.2842 -3.3323 -3.3827 -3.4322
-3.4809 -3.5319 -3.5805 -3.6296 -3.6809 -3.7287 -3.7785 -3.8293 -3.8772 -3.9273
-3.9772 -4.0256 -4.0762 -4.1252 -4.1742 -4.2254 -4.2735 -4.3229 -4.3742 -4.4218
-4.4718 -4.5221 -4.5702 -4.6080
8 24 1 266 0 0 0 1.8342e-19 0.0000e+00
-0.0851 -0.0723 -0.0595 -0.0467 -0.0339 -0.0211 -0.0084 0.0044 0.0172 0.0300
0.0428 0.0556 0.0684 0.0812 0.0940 0.1068 0.1196 0.1325 0.1453 0.1581
0.1709 0.1837 0.1965 0.2093 0.2221 0.2349 0.2477 0.2606 0.2734 0.2862
0.2990 0.3118 0.3246 0.3375 0.3503 0.3631 0.3759 0.3887 0.4015 0.4144
0.4272 0.4400 0.4528 0.4657 0.4785 0.4913 0.5041 0.5169 0.5298 0.5426
0.5554 0.5682 0.5811 0.5939 0.6067 0.6196 0.6324 0.6452 0.6580 0.6709
0.6837 0.6965 0.7094 0.7222 0.7350 0.7478 0.7607 0.7735 0.7863 0.7992
0.8120 0.8248 0.8377 0.8505 0.8633 0.8761 0.8890 0.9018 0.9146 0.9275
0.9403 0.9531 0.9660 0.9788 0.9916 1.0045 1.0173 1.0301 1.0430 1.0558
1.0686 1.0815 1.0943 1.1071 1.1200 1.1328 1.1456 1.1585 1.1713 1.1841
1.1970 1.2098 1.2226 1.2355 1.2483 1.2612 1.2740 1.2868 1.2997 1.3125
1.3253 1.3382 1.3510 1.3638 1.3767 1.3895 1.4023 1.4152 1.4280 1.4408
1.4537 1.4665 1.4794 1.4922 1.5050 1.5179 1.5307 1.5435 1.5564 1.5692
1.5820 1.5949 1.6077 1.6205 1.6334 1.6462 1.6591 1.6719 1.6847 1.6976
1.7104 1.7232 1.7361 1.7489 1.7617 1.7746 1.7874 1.8003 1.8131 1.8259
1.8388 1.8516 1.8644 1.8773 1.8901 1.9030 1.9158 1.9286 1.9415 1.9543
1.9671 1.9800 1.9928 2.0056 2.0185 2.0225
-0.2137 -0.2262 -0.2391 -0.2524 -0.2661 -0.2800 -0.2944 -0.3088 -0.3233 -0.3387
-0.3542 -0.3696 -0.3861 -0.4019 -0.4182 -0.4351 -0.4516 -0.4692 -0.4858 -0.5036
-0.5207 -0.5387 -0.5563 -0.5747 -0.5924 -0.6111 -0.6291 -0.6476 -0.6664 -0.6850
-0.7042 -0.7232 -0.7422 -0.7615 -0.7809 -0.8002 -0.8197 -0.8393 -0.8591 -0.8790
-0.8989 -0.9186 -0.9372 -0.9563 -0.9768 -0.9975 -1.0159 -1.0356 -1.0570 -1.0756
-1.0948 -1.1155 -1.1356 -1.1543 -1.1743 -1.1959 -1.2140 -1.2334 -1.2544 -1.2739
-1.2928 -1.3131 -1.3341 -1.3524 -1.3721 -1.3934 -1.4123 -1.4314 -1.4520 -1.4724
-1.4909 -1.5109 -1.5324 -1.5507 -1.5700 -1.5909 -1.6107 -1.6294 -1.6496 -1.6709
-1.6890 -1.7086 -1.7297 -1.7490 -1.7680 -1.7885 -1.8092 -1.8276 -1.8474 -1.8687
-1.8873 -1.9066 -1.9273 -1.9475 -1.9661 -1.9861 -2.0077 -2.0258 -2.0452 -2.0662
-2.0857 -2.1046 -2.1249 -2.1459 -2.1642 -2.1839 -2.2051 -2.2240 -2.2431 -2.2637
-2.2841 -2.3027 -2.3226 -2.3442 -2.3624 -2.3818 -2.4026 -2.4224 -2.4412 -2.4614
-2.4827 -2.5009 -2.5204 -2.5416 -2.5608 -2.5798 -2.6002 -2.6210 -2.6394 -2.6592
-2.6806 -2.6992 -2.7184 -2.7391 -2.7593 -2.7778 -2.7979 -2.8194 -2.8375 -2.8569
-2.8779 -2.8975 -2.9163 -2.9366 -2.9576 -2.9759 -2.9956 -3.0169 -3.0359 -3.0550
-3.0755 -3.0960 -3.1145 -3.1344 -3.1560 -3.1743 -3.1936 -3.2144 -3.2343 -3.2530
-3.2732 -3.2945 -3.3127 -3.3322 -3.3533 -3.3603
9 24 1 281 0 0 0 2.9112e-19 0.0000e+00
-0.0972 -0.0844 -0.0717 -0.0589 -0.0461 -0.0333 -0.0205 -0.0077 0.0051 0.0179
0.0306 0.0434 0.0562 0.0690 0.0818 0.0946 0.1074 0.1202 0.1330 0.1458
0.1586 0.1714 0.1843 0.1971 0.2099 0.2227 0.2355 0.2483 0.2611 0.2739
0.2867 0.2995 0.3124 0.3252 0.3380 0.3508 0.3636 0.3764 0.3893 0.4021
0.4149 0.4277 0.4405 0.4534 0.4662 0.4790 0.4918 0.5046 0.5175 0.5303
0.5431 0.5559 0.5688 0.5816 0.5944 0.6072 0.6201 0.6329 0.6457 0.6585
0.6714 0.6842 0.6970 0.7099 0.7227 0.7355 0.7483 0.7612 0.7740 0.7868
0.7997 0.8125 0.8253 0.8382 0.8510 0.8638 0.8766 0.8895 0.9023 0.9151
0.9280 0.9408 0.9536 0.9665 0.9793 0.9921 1.0050 1.0178 1.0306 1.0435
1.0563 1.0691 1.0820 1.0948 1.1076 1.1205 1.1333 1.1461 1.1590 1.1718
1.1846 1.1975 1.2103 1.2231 1.2360 1.2488 1.2616 1.2745 1.2873 1.3001
1.3130 1.3258 1.3386 1.3515 1.3643 1.3772 1.3900 1.4028 1.4157 1.4285
1.4413 1.4542 1.4670 1.4798 1.4927 1.5055 1.5183 1.5312 1.5440 1.5568
1.5697 1.5825 1.5954 1.6082 1.6210 1.6339 1.6467 1.6595 1.6724 1.6852
1.6980 1.7109 1.7237 1.7366 1.7494 1.7622 1.7751 1.7879 1.8007 1.8136
1.8264 1.8392 1.8521 1.8649 1.8778 1.8906 1.9034 1.9163 1.9291 1.9419
1.9548 1.9676 1.9804 1.9933 2.0061 2.0190 2.0318 2.0446 2.0575 2.0703
2.0831 2.0960 2.1088 2.1217 2.1345 2.1473 2.1602 2.1730 2.1858 2.1987
2.2078
-0.0130 -0.0324 -0.0523 -0.0715 -0.0900 -0.1086 -0.1265 -0.1440 -0.1609 -0.1769
-0.1941 -0.2118 -0.2271 -0.2435 -0.2604 -0.2755 -0.2916 -0.3075 -0.3228 -0.3391
-0.3540 -0.3697 -0.3851 -0.4006 -0.4162 -0.4316 -0.4474 -0.4628 -0.4786 -0.4943
-0.5101 -0.5262 -0.5421 -0.5584 -0.5746 -0.5910 -0.6077 -0.6243 -0.6412 -0.6584
-0.6758 -0.6931 -0.7108 -0.7286 -0.7466 -0.7648 -0.7811 -0.7985 -0.8173 -0.8375
-0.8594 -0.8771 -0.8950 -0.9143 -0.9338 -0.9509 -0.9693 -0.9890 -1.0071 -1.0248
-1.0438 -1.0640 -1.0809 -1.0991 -1.1186 -1.1374 -1.1548 -1.1735 -1.1936 -1.2110
-1.2289 -1.2481 -1.2676 -1.2848 -1.3032 -1.3231 -1.3412 -1.3588 -1.3778 -1.3979
-1.4149 -1.4330 -1.4526 -1.4714 -1.4888 -1.5075 -1.5276 -1.5450 -1.5629 -1.5822
-1.6016 -1.6188 -1.6372 -1.6570 -1.6751 -1.6927 -1.7117 -1.7318 -1.7488 -1.7670
-1.7865 -1.8053 -1.8227 -1.8414 -1.8615 -1.8789 -1.8968 -1.9161 -1.9355 -1.9527
-1.9711 -1.9910 -2.0090 -2.0267 -2.0457 -2.0658 -2.0828 -2.1010 -2.1205 -2.1393
-2.1567 -2.1754 -2.1955 -2.2129 -2.2308 -2.2501 -2.2695 -2.2867 -2.3051 -2.3250
-2.3430 -2.3607 -2.3797 -2.3997 -2.4167 -2.4349 -2.4545 -2.4733 -2.4907 -2.5094
-2.5295 -2.5468 -2.5647 -2.5840 -2.6034 -2.6206 -2.6390 -2.6589 -2.6769 -2.6946
-2.7136 -2.7337 -2.7507 -2.7688 -2.7884 -2.8071 -2.8245 -2.8432 -2.8634 -2.8807
-2.8986 -2.9178 -2.9372 -2.9545 -2.9730 -2.9930 -3.0110 -3.0287 -3.0477 -3.0677
-3.0847 -3.1029 -3.1224 -3.1411 -3.1586 -3.1773 -3.1975 -3.2148 -3.2327 -3.2520
-3.2666
10 24 1 196 0 0 0 2.1480e-18 0.0000e+00
-0.1203 -0.1074 -0.0946 -0.0818 -0.0689 -0.0561 -0.0433 -0.0304 -0.0176 -0.0048
0.0081 0.0209 0.0337 0.0466 0.0594 0.0722 0.0851 0.0979 0.1107 0.1236
0.1364 0.1492 0.1621 0.1749 0.1877 0.2006 0.2134 0.2262 0.2391 0.2519
0.2647 0.2776 0.2904 0.3032 0.3161 0.3289 0.3417 0.3546 0.3674 0.3802
0.3931 0.4059 0.4187 0.4316 0.4444 0.4572 0.4701 0.4829 0.4958 0.5086
0.5214 0.5343 0.5471 0.5599 0.5728 0.5856 0.5984 0.6113 0.6241 0.6369
0.6498 0.6626 0.6755 0.6883 0.7011 0.7140 0.7268 0.7396 0.7525 0.7653
0.7781 0.7910 0.8038 0.8167 0.8295 0.8423 0.8552 0.8680 0.8808 0.8937
0.9065 0.9193 0.9322 0.9450 0.9579 0.9707 0.9835 0.9964 1.0092 1.0220
1.0349 1.0477 1.0605 1.0734 1.0862 1.0978
0.8549 0.8284 0.7994 0.7722 0.7429 0.7154 0.6859 0.6579 0.6286 0.5996
0.5722 0.5451 0.5153 0.4822 0.4538 0.4251 0.3935 0.3613 0.3330 0.3017
0.2684 0.2395 0.2077 0.1747 0.1447 0.1114 0.0797 0.0479 0.0139 -0.0172
-0.0518 -0.0835 -0.1177 -0.1505 -0.1848 -0.2181 -0.2529 -0.2864 -0.3223 -0.3557
-0.3911 -0.4260 -0.4609 -0.4972 -0.5323 -0.5680 -0.6045 -0.6408 -0.6768 -0.7133
-0.7503 -0.7874 -0.8161 -0.8479 -0.8832 -0.9229 -0.9680 -1.0095 -1.0465 -1.0836
-1.1204 -1.1577 -1.1944 -1.2317 -1.2684 -1.3057 -1.3423 -1.3799 -1.4164 -1.4540
-1.4903 -1.5280 -1.5643 -1.6021 -1.6382 -1.6761 -1.7122 -1.7502 -1.7862 -1.8243
-1.8603 -1.8985 -1.9344 -1.9727 -2.0083 -2.0466 -2.0822 -2.1207 -2.1562 -2.1947
-2.2302 -2.2689 -2.3043 -2.3430 -2.3783 -2.4139
11 24 1 183 0 0 0 6.7950e-20 0.0000e+00
-0.1246 -0.1118 -0.0990 -0.0862 -0.0733 -0.0605 -0.0477 -0.0348 -0.0220 -0.0092
0.0037 0.0165 0.0293 0.0422 0.0550 0.0678 0.0806 0.0935 0.1063 0.1191
0.1320 0.1448 0.1576 0.1705 0.1833 0.1961 0.2090 0.2218 0.2346 0.2475
0.2603 0.2731 0.2860 0.2988 0.3116 0.3245 0.3373 0.3501 0.3630 0.3758
0.3887 0.4015 0.4143 0.4272 0.4400 0.4528 0.4657 0.4785 0.4913 0.5042
0.5170 0.5298 0.5427 0.5555 0.5683 0.5812 0.5940 0.6069 0.6197 0.6325
0.6454 0.6582 0.6710 0.6839 0.6967 0.7095 0.7224 0.7352 0.7480 0.7609
0.7737 0.7866 0.7994 0.8122 0.8251 0.8379 0.8507 0.8636 0.8764 0.8892
0.9021 0.9149 0.9180
-0.6449 -0.6788 -0.7167 -0.7520 -0.7897 -0.8255 -0.8636 -0.8997 -0.9388 -0.9748
-1.0119 -1.0448 -1.0814 -1.1227 -1.1644 -1.1987 -1.2371 -1.2805 -1.3178 -1.3551
-1.3972 -1.4373 -1.4749 -1.5173 -1.5573 -1.5962 -1.6402 -1.6784 -1.7197 -1.7621
-1.8019 -1.8465 -1.8855 -1.9297 -1.9701 -2.0143 -2.0557 -2.1004 -2.1421 -2.1876
-2.2297 -2.2747 -2.3190 -2.3634 -2.4099 -2.4544 -2.5002 -2.5473 -2.5939 -2.6404
-2.6881 -2.7367 -2.7855 -2.8313 -2.8797 -2.9270 -2.9738 -3.0232 -3.0691 -3.1169
-3.1653 -3.2115 -3.2603 -3.3071 -3.3544 -3.4037 -3.4493 -3.4976 -3.5453 -3.5919
-3.6411 -3.6872 -3.7349 -3.7835 -3.8296 -3.8783 -3.9252 -3.9723 -4.0220 -4.0674
-4.1155 -4.1635 -4.1759
12 24 1 265 0 0 0 3.4380e-18 0.0000e+00
-0.1245 -0.1117 -0.0990 -0.0862 -0.0734 -0.0606 -0.0478 -0.0350 -0.0222 -0.0094
0.0034 0.0162 0.0290 0.0418 0.0546 0.0674 0.0803 0.0931 0.1059 0.1187
0.1315 0.1443 0.1571 0.1699 0.1827 0.1956 0.2084 0.2212 0.2340 0.2468
0.2596 0.2724 0.2853 0.2981 0.3109 0.3237 0.3365 0.3494 0.3622 0.3750
0.3878 0.4007 0.4135 0.4263 0.4391 0.4520 0.4648 0.4776 0.4904 0.5033
0.5161 0.5289 0.5417 0.5546 0.5674 0.5802 0.5930 0.6059 0.6187 0.6315
0.6444 0.6572 0.6700 0.6828 0.6957 0.7085 0.7213 0.7342 0.7470 0.7598
0.7727 0.7855 0.7983 0.8112 0.8240 0.8368 0.8496 0.8625 0.8753 0.8881
0.9010 0.9138 0.9266 0.9395 0.9523 0.9651 0.9780 0.9908 1.0036 1.0165
1.0293 1.0421 1.0550 1.0678 1.0806 1.0935 1.1063 1.1191 1.1320 1.1448
1.1577 1.1705 1.1833 1.1962 1.2090 1.2218 1.2347 1.2475 1.2603 1.2732
1.2860 1.2988 1.3117 1.3245 1.3373 1.3502 1.3630 1.3759 1.3887 1.4015
1.4144 1.4272 1.4400 1.4529 1.4657 1.4785 1.4914 1.5042 1.5170 1.5299
1.5427 1.5556 1.5684 1.5812 1.5941 1.6069 1.6197 1.6326 1.6454 1.6582
1.6711 1.6839 1.6968 1.7096 1.7224 1.7353 1.7481 1.7609 1.7738 1.7866
1.7994 1.8123 1.8251 1.8380 1.8508 1.8636 1.8765 1.8893 1.9021 1.9150
1.9278 1.9407 1.9535 1.9663 1.9700
1.0592 0.5803 -0.1053 -0.1192 -0.1335 -0.1480 -0.1631 -0.1781 -0.1938 -0.2093
-0.2252 -0.2402 -0.2563 -0.2734 -0.2918 -0.3077 -0.3245 -0.3424 -0.3613 -0.3779
-0.3956 -0.4147 -0.4327 -0.4506 -0.4698 -0.4885 -0.5067 -0.5263 -0.5451 -0.5639
-0.5842 -0.6025 -0.6223 -0.6418 -0.6613 -0.6814 -0.7006 -0.7210 -0.7404 -0.7610
-0.7805 -0.8009 -0.8208 -0.8412 -0.8617 -0.8818 -0.9025 -0.9227 -0.9433 -0.9641
-0.9845 -1.0050 -1.0257 -1.0466 -1.0672 -1.0867 -1.1066 -1.1281 -1.1492 -1.1686
-1.1896 -1.2118 -1.2308 -1.2513 -1.2735 -1.2931 -1.3131 -1.3347 -1.3555 -1.3751
-1.3962 -1.4181 -1.4372 -1.4578 -1.4801 -1.4995 -1.5197 -1.5415 -1.5620 -1.5816
-1.6029 -1.6244 -1.6436 -1.6644 -1.6869 -1.7059 -1.7262 -1.7482 -1.7683 -1.7881
-1.8096 -1.8308 -1.8502 -1.8711 -1.8934 -1.9123 -1.9327 -1.9548 -1.9746 -1.9946
-2.0162 -2.0371 -2.0567 -2.0777 -2.0997 -2.1188 -2.1394 -2.1616 -2.1811 -2.2012
-2.2229 -2.2435 -2.2631 -2.2844 -2.3060 -2.3252 -2.3460 -2.3684 -2.3875 -2.4078
-2.4297 -2.4499 -2.4697 -2.4910 -2.5123 -2.5317 -2.5525 -2.5749 -2.5939 -2.6143
-2.6364 -2.6563 -2.6762 -2.6977 -2.7187 -2.7382 -2.7592 -2.7813 -2.8004 -2.8209
-2.8432 -2.8627 -2.8828 -2.9046 -2.9252 -2.9448 -2.9659 -2.9875 -3.0067 -3.0275
-3.0499 -3.0691 -3.0893 -3.1111 -3.1314 -3.1512 -3.1725 -3.1939 -3.2133 -3.2341
-3.2566 -3.2755 -3.2958 -3.3178 -3.3245
13 24 1 273 0 0 0 5.5410e-18 0.0000e+00
-0.1245 -0.1117 -0.0989 -0.0861 -0.0733 -0.0606 -0.0478 -0.0350 -0.0222 -0.0094
0.0034 0.0162 0.0290 0.0418 0.0546 0.0674 0.0802 0.0930 0.1058 0.1187
0.1315 0.1443 0.1571 0.1699 0.1827 0.1955 0.2083 0.2211 0.2340 0.2468
0.2596 0.2724 0.2852 0.2980 0.3109 0.3237 0.3365 0.3493 0.3621 0.3750
0.3878 0.4006 0.4134 0.4262 0.4391 0.4519 0.4647 0.4775 0.4904 0.5032
0.5160 0.5288 0.5417 0.5545 0.5673 0.5801 0.5930 0.6058 0.6186 0.6315
0.6443 0.6571 0.6699 0.6828 0.6956 0.7084 0.7213 0.7341 0.7469 0.7598
0.7726 0.7854 0.7982 0.8111 0.8239 0.8367 0.8496 0.8624 0.8752 0.8881
0.9009 0.9137 0.9266 0.9394 0.9522 0.9651 0.9779 0.9907 1.0036 1.0164
1.0292 1.0421 1.0549 1.0677 1.0806 1.0934 1.1062 1.1191 1.1319 1.1447
1.1576 1.1704 1.1832 1.1961 1.2089 1.2217 1.2346 1.2474 1.2602 1.2731
1.2859 1.2988 1.3116 1.3244 1.3373 1.3501 1.3629 1.3758 1.3886 1.4014
1.4143 1.4271 1.4399 1.4528 1.4656 1.4785 1.4913 1.5041 1.5170 1.5298
1.5426 1.5555 1.5683 1.5811 1.5940 1.6068 1.6197 1.6325 1.6453 1.6582
1.6710 1.6838 1.6967 1.7095 1.7223 1.7352 1.7480 1.7609 1.7737 1.7865
1.7994 1.8122 1.8250 1.8379 1.8507 1.8635 1.8764 1.8892 1.9021 1.9149
1.9277 1.9406 1.9534 1.9662 1.9791 1.9919 2.0047 2.0176 2.0304 2.0433
2.0561 2.0689 2.0728
1.2665 0.1519 0.1277 0.1014 0.0789 0.0545 0.0314 0.0085 -0.0145 -0.0363
-0.0581 -0.0766 -0.0966 -0.1181 -0.1414 -0.1624 -0.1806 -0.2003 -0.2215 -0.2421
-0.2597 -0.2787 -0.2991 -0.3175 -0.3353 -0.3543 -0.3734 -0.3905 -0.4088 -0.4275
-0.4445 -0.4628 -0.4807 -0.4979 -0.5164 -0.5332 -0.5509 -0.5685 -0.5858 -0.6037
-0.6209 -0.6389 -0.6561 -0.6741 -0.6915 -0.7094 -0.7270 -0.7449 -0.7630 -0.7808
-0.7991 -0.8172 -0.8355 -0.8541 -0.8727 -0.8911 -0.9101 -0.9289 -0.9462 -0.9648
-0.9848 -1.0030 -1.0208 -1.0398 -1.0600 -1.0771 -1.0954 -1.1151 -1.1339 -1.1515
-1.1704 -1.1908 -1.2081 -1.2262 -1.2457 -1.2650 -1.2824 -1.3011 -1.3212 -1.3390
-1.3569 -1.3762 -1.3960 -1.4132 -1.4317 -1.4516 -1.4700 -1.4877 -1.5068 -1.5272
-1.5442 -1.5624 -1.5820 -1.6010 -1.6185 -1.6373 -1.6576 -1.6751 -1.6931 -1.7126
-1.7321 -1.7495 -1.7681 -1.7882 -1.8062 -1.8241 -1.8432 -1.8632 -1.8803 -1.8987
-1.9184 -1.9370 -1.9547 -1.9738 -1.9943 -2.0113 -2.0295 -2.0490 -2.0682 -2.0856
-2.1044 -2.1246 -2.1422 -2.1602 -2.1796 -2.1993 -2.2165 -2.2351 -2.2550 -2.2732
-2.2910 -2.3101 -2.3303 -2.3474 -2.3657 -2.3855 -2.4043 -2.4218 -2.4407 -2.4610
-2.4783 -2.4965 -2.5160 -2.5353 -2.5527 -2.5713 -2.5914 -2.6093 -2.6273 -2.6465
-2.6665 -2.6836 -2.7020 -2.7218 -2.7403 -2.7580 -2.7771 -2.7975 -2.8145 -2.8327
-2.8523 -2.8712 -2.8888 -2.9077 -2.9281 -2.9456 -2.9636 -2.9829 -3.0025 -3.0198
-3.0383 -3.0583 -3.0646
14 24 1 205 0 0 0 2.8038e-17 0.0000e+00
-0.1248 -0.1120 -0.0992 -0.0863 -0.0735 -0.0607 -0.0479 -0.0350 -0.0222 -0.0094
0.0034 0.0163 0.0291 0.0419 0.0547 0.0676 0.0804 0.0932 0.1061 0.1189
0.1317 0.1445 0.1574 0.1702 0.1830 0.1959 0.2087 0.2215 0.2344 0.2472
0.2600 0.2728 0.2857 0.2985 0.3113 0.3242 0.3370 0.3498 0.3627 0.3755
0.3883 0.4012 0.4140 0.4268 0.4397 0.4525 0.4653 0.4782 0.4910 0.5038
0.5167 0.5295 0.5423 0.5552 0.5680 0.5808 0.5937 0.6065 0.6193 0.6322
0.6450 0.6579 0.6707 0.6835 0.6964 0.7092 0.7220 0.7349 0.7477 0.7605
0.7734 0.7862 0.7990 0.8119 0.8247 0.8375 0.8504 0.8632 0.8761 0.8889
0.9017 0.9146 0.9274 0.9402 0.9531 0.9659 0.9787 0.9916 1.0044 1.0172
1.0301 1.0429 1.0558 1.0686 1.0814 1.0943 1.1071 1.1199 1.1328 1.1456
1.1584 1.1713 1.1841 1.1970 1.2093
1.9706 1.6566 0.9078 0.8826 0.8549 0.8270 0.8008 0.7721 0.7453 0.7177
0.6899 0.6667 0.6413 0.6136 0.5830 0.5491 0.5229 0.4971 0.4688 0.4376
0.4042 0.3788 0.3510 0.3204 0.2863 0.2600 0.2313 0.1995 0.1674 0.1396
0.1088 0.0747 0.0468 0.0161 -0.0180 -0.0468 -0.0784 -0.1118 -0.1418 -0.1749
-0.2066 -0.2387 -0.2724 -0.3038 -0.3386 -0.3699 -0.4047 -0.4366 -0.4717 -0.5040
-0.5391 -0.5723 -0.6070 -0.6415 -0.6758 -0.7115 -0.7460 -0.7812 -0.8172 -0.8523
-0.8877 -0.9209 -0.9492 -0.9803 -1.0150 -1.0538 -1.0978 -1.1411 -1.1762 -1.2132
-1.2480 -1.2853 -1.3199 -1.3575 -1.3919 -1.4298 -1.4638 -1.5019 -1.5357 -1.5735
-1.6076 -1.6451 -1.6796 -1.7167 -1.7516 -1.7885 -1.8238 -1.8603 -1.8959 -1.9320
-1.9679 -2.0038 -2.0400 -2.0756 -2.1121 -2.1474 -2.1842 -2.2193 -2.2563 -2.2911
-2.3285 -2.3631 -2.4008 -2.4350 -2.4716
15 24 1 187 0 0 0 1.3458e-18 0.0000e+00
-0.1249 -0.1120 -0.0992 -0.0864 -0.0736 -0.0607 -0.0479 -0.0351 -0.0222 -0.0094
0.0034 0.0163 0.0291 0.0419 0.0548 0.0676 0.0804 0.0933 0.1061 0.1189
0.1318 0.1446 0.1574 0.1703 0.1831 0.1959 0.2088 0.2216 0.2344 0.2473
0.2601 0.2729 0.2858 0.2986 0.3114 0.3243 0.3371 0.3499 0.3628 0.3756
0.3884 0.4013 0.4141 0.4269 0.4398 0.4526 0.4655 0.4783 0.4911 0.5040
0.5168 0.5296 0.5425 0.5553 0.5681 0.5810 0.5938 0.6066 0.6195 0.6323
0.6452 0.6580 0.6708 0.6837 0.6965 0.7093 0.7222 0.7350 0.7478 0.7607
0.7735 0.7863 0.7992 0.8120 0.8249 0.8377 0.8505 0.8634 0.8762 0.8890
0.9019 0.9147 0.9275 0.9404 0.9532 0.9661 0.9691
0.6519 0.2577 -0.4066 -0.4400 -0.4773 -0.5134 -0.5477 -0.5862 -0.6209 -0.6571
-0.6939 -0.7230 -0.7551 -0.7909 -0.8311 -0.8769 -0.9132 -0.9455 -0.9815 -1.0219
-1.0680 -1.1018 -1.1366 -1.1757 -1.2200 -1.2576 -1.2932 -1.3332 -1.3787 -1.4138
-1.4519 -1.4950 -1.5350 -1.5727 -1.6153 -1.6563 -1.6948 -1.7385 -1.7782 -1.8187
-1.8632 -1.9017 -1.9453 -1.9862 -2.0286 -2.0715 -2.1135 -2.1573 -2.1994 -2.2434
-2.2864 -2.3304 -2.3748 -2.4184 -2.4647 -2.5080 -2.5535 -2.5999 -2.6445 -2.6909
-2.7385 -2.7843 -2.8230 -2.8595 -2.9006 -2.9474 -3.0015 -3.0653 -3.1198 -3.1692
-3.2146 -3.2626 -3.3104 -3.3568 -3.4058 -3.4520 -3.4994 -3.5481 -3.5940 -3.6424
-3.6894 -3.7363 -3.7857 -3.8312 -3.8792 -3.9269 -3.9393
16 24 1 258 0 0 0 2.9463e-18 0.0000e+00
-0.1246 -0.1118 -0.0990 -0.0862 -0.0734 -0.0606 -0.0478 -0.0350 -0.0222 -0.0094
0.0034 0.0162 0.0290 0.0418 0.0547 0.0675 0.0803 0.0931 0.1059 0.1187
0.1315 0.1443 0.1572 0.1700 0.1828 0.1956 0.2084 0.2212 0.2341 0.2469
0.2597 0.2725 0.2853 0.2982 0.3110 0.3238 0.3366 0.3495 0.3623 0.3751
0.3879 0.4007 0.4136 0.4264 0.4392 0.4520 0.4649 0.4777 0.4905 0.5034
0.5162 0.5290 0.5418 0.5547 0.5675 0.5803 0.5932 0.6060 0.6188 0.6316
0.6445 0.6573 0.6701 0.6830 0.6958 0.7086 0.7215 0.7343 0.7471 0.7600
0.7728 0.7856 0.7984 0.8113 0.8241 0.8369 0.8498 0.8626 0.8754 0.8883
0.9011 0.9139 0.9268 0.9396 0.9524 0.9653 0.9781 0.9909 1.0038 1.0166
1.0294 1.0423 1.0551 1.0680 1.0808 1.0936 1.1065 1.1193 1.1321 1.1450
1.1578 1.1706 1.1835 1.1963 1.2091 1.2220 1.2348 1.2476 1.2605 1.2733
1.2861 1.2990 1.3118 1.3247 1.3375 1.3503 1.3632 1.3760 1.3888 1.4017
1.4145 1.4273 1.4402 1.4530 1.4659 1.4787 1.4915 1.5044 1.5172 1.5300
1.5429 1.5557 1.5685 1.5814 1.5942 1.6070 1.6199 1.6327 1.6456 1.6584
1.6712 1.6841 1.6969 1.7097 1.7226 1.7354 1.7483 1.7611 1.7739 1.7868
1.7996 1.8124 1.8253 1.8381 1.8509 1.8638 1.8766 1.8883
0.9922 -0.0072 -0.0216 -0.0370 -0.0534 -0.0685 -0.0846 -0.1018 -0.1177 -0.1346
-0.1517 -0.1668 -0.1829 -0.2001 -0.2186 -0.2385 -0.2582 -0.2746 -0.2920 -0.3108
-0.3310 -0.3518 -0.3689 -0.3872 -0.4070 -0.4283 -0.4471 -0.4656 -0.4856 -0.5072
-0.5260 -0.5453 -0.5660 -0.5869 -0.6060 -0.6266 -0.6482 -0.6674 -0.6881 -0.7094
-0.7290 -0.7502 -0.7708 -0.7913 -0.8130 -0.8328 -0.8542 -0.8746 -0.8959 -0.9166
-0.9377 -0.9587 -0.9801 -1.0009 -1.0223 -1.0430 -1.0646 -1.0855 -1.1067 -1.1282
-1.1492 -1.1705 -1.1922 -1.2131 -1.2334 -1.2538 -1.2759 -1.2976 -1.3177 -1.3393
-1.3619 -1.3816 -1.4029 -1.4260 -1.4456 -1.4665 -1.4892 -1.5097 -1.5302 -1.5525
-1.5738 -1.5940 -1.6159 -1.6381 -1.6580 -1.6794 -1.7024 -1.7219 -1.7430 -1.7659
-1.7861 -1.8068 -1.8292 -1.8502 -1.8706 -1.8926 -1.9144 -1.9345 -1.9561 -1.9788
-1.9984 -2.0196 -2.0425 -2.0623 -2.0831 -2.1057 -2.1264 -2.1469 -2.1691 -2.1906
-2.2107 -2.2325 -2.2548 -2.2746 -2.2960 -2.3191 -2.3386 -2.3597 -2.3825 -2.4027
-2.4233 -2.4457 -2.4668 -2.4871 -2.5091 -2.5310 -2.5510 -2.5726 -2.5954 -2.6150
-2.6361 -2.6590 -2.6789 -2.6998 -2.7224 -2.7431 -2.7636 -2.7857 -2.8073 -2.8274
-2.8491 -2.8715 -2.8913 -2.9126 -2.9357 -2.9552 -2.9762 -2.9990 -3.0194 -3.0400
-3.0623 -3.0835 -3.1038 -3.1257 -3.1477 -3.1677 -3.1892 -3.2103
17 24 1 263 0 0 0 4.9080e-18 0.0000e+00
-0.1246 -0.1118 -0.0990 -0.0862 -0.0734 -0.0606 -0.0478 -0.0350 -0.0222 -0.0094
0.0034 0.0162 0.0290 0.0418 0.0546 0.0675 0.0803 0.0931 0.1059 0.1187
0.1315 0.1443 0.1571 0.1700 0.1828 0.1956 0.2084 0.2212 0.2340 0.2469
0.2597 0.2725 0.2853 0.2981 0.3110 0.3238 0.3366 0.3494 0.3622 0.3751
0.3879 0.4007 0.4135 0.4264 0.4392 0.4520 0.4648 0.4777 0.4905 0.5033
0.5161 0.5290 0.5418 0.5546 0.5674 0.5803 0.5931 0.6059 0.6188 0.6316
0.6444 0.6573 0.6701 0.6829 0.6957 0.7086 0.7214 0.7342 0.7471 0.7599
0.7727 0.7856 0.7984 0.8112 0.8241 0.8369 0.8497 0.8626 0.8754 0.8882
0.9011 0.9139 0.9267 0.9396 0.9524 0.9652 0.9781 0.9909 1.0037 1.0166
1.0294 1.0422 1.0551 1.0679 1.0807 1.0936 1.1064 1.1192 1.1321 1.1449
1.1577 1.1706 1.1834 1.1962 1.2091 1.2219 1.2347 1.2476 1.2604 1.2733
1.2861 1.2989 1.3118 1.3246 1.3374 1.3503 1.3631 1.3759 1.3888 1.4016
1.4144 1.4273 1.4401 1.4530 1.4658 1.4786 1.4915 1.5043 1.5171 1.5300
1.5428 1.5556 1.5685 1.5813 1.5942 1.6070 1.6198 1.6327 1.6455 1.6583
1.6712 1.6840 1.6968 1.7097 1.7225 1.7354 1.7482 1.7610 1.7739 1.7867
1.7995 1.8124 1.8252 1.8380 1.8509 1.8637 1.8766 1.8894 1.9022 1.9151
1.9279 1.9407 1.9429
1.2138 1.0894 0.9079 0.5759 0.1974 0.1729 0.1461 0.1187 0.0952 0.0695
0.0443 0.0251 0.0043 -0.0181 -0.0425 -0.0692 -0.0985 -0.1195 -0.1393 -0.1606
-0.1837 -0.2088 -0.2325 -0.2513 -0.2716 -0.2936 -0.3174 -0.3375 -0.3565 -0.3770
-0.3992 -0.4192 -0.4379 -0.4580 -0.4797 -0.4978 -0.5167 -0.5372 -0.5562 -0.5747
-0.5946 -0.6135 -0.6319 -0.6517 -0.6697 -0.6884 -0.7076 -0.7257 -0.7451 -0.7631
-0.7821 -0.8004 -0.8191 -0.8376 -0.8565 -0.8751 -0.8941 -0.9125 -0.9316 -0.9500
-0.9691 -0.9880 -1.0070 -1.0265 -1.0458 -1.0650 -1.0834 -1.1002 -1.1181 -1.1374
-1.1583 -1.1808 -1.2040 -1.2221 -1.2417 -1.2627 -1.2816 -1.3005 -1.3209 -1.3414
-1.3597 -1.3794 -1.4006 -1.4191 -1.4382 -1.4587 -1.4788 -1.4972 -1.5171 -1.5385
-1.5565 -1.5758 -1.5966 -1.6162 -1.6348 -1.6549 -1.6761 -1.6941 -1.7136 -1.7345
-1.7536 -1.7724 -1.7927 -1.8134 -1.8316 -1.8513 -1.8725 -1.8911 -1.9101 -1.9305
-1.9507 -1.9691 -1.9890 -2.0103 -2.0285 -2.0477 -2.0684 -2.0881 -2.1067 -2.1267
-2.1480 -2.1660 -2.1853 -2.2062 -2.2255 -2.2443 -2.2645 -2.2853 -2.3035 -2.3230
-2.3441 -2.3630 -2.3819 -2.4023 -2.4227 -2.4410 -2.4607 -2.4820 -2.5004 -2.5195
-2.5401 -2.5601 -2.5786 -2.5985 -2.6200 -2.6379 -2.6572 -2.6780 -2.6975 -2.7162
-2.7363 -2.7574 -2.7755 -2.7949 -2.8159 -2.8349 -2.8538 -2.8741 -2.8947 -2.9130
-2.9327 -2.9540 -2.9578
18 24 1 211 0 0 0 2.4477e-17 0.0000e+00
-0.1248 -0.1120 -0.0992 -0.0863 -0.0735 -0.0607 -0.0479 -0.0350 -0.0222 -0.0094
0.0034 0.0163 0.0291 0.0419 0.0547 0.0676 0.0804 0.0932 0.1060 0.1189
0.1317 0.1445 0.1574 0.1702 0.1830 0.1958 0.2087 0.2215 0.2343 0.2472
0.2600 0.2728 0.2857 0.2985 0.3113 0.3242 0.3370 0.3498 0.3627 0.3755
0.3883 0.4012 0.4140 0.4268 0.4396 0.4525 0.4653 0.4781 0.4910 0.5038
0.5166 0.5295 0.5423 0.5552 0.5680 0.5808 0.5937 0.6065 0.6193 0.6322
0.6450 0.6578 0.6707 0.6835 0.6963 0.7092 0.7220 0.7348 0.7477 0.7605
0.7733 0.7862 0.7990 0.8118 0.8247 0.8375 0.8504 0.8632 0.8760 0.8889
0.9017 0.9145 0.9274 0.9402 0.9530 0.9659 0.9787 0.9915 1.0044 1.0172
1.0301 1.0429 1.0557 1.0686 1.0814 1.0942 1.1071 1.1199 1.1327 1.1456
1.1584 1.1713 1.1841 1.1969 1.2098 1.2226 1.2354 1.2483 1.2611 1.2739
1.2827
1.9116 1.7316 1.4046 0.9652 0.9409 0.9144 0.8852 0.8590 0.8335 0.8055
0.7779 0.7570 0.7343 0.7097 0.6827 0.6531 0.6203 0.5840 0.5618 0.5377
0.5113 0.4824 0.4505 0.4156 0.3919 0.3662 0.3379 0.3068 0.2722 0.2470
0.2200 0.1904 0.1576 0.1278 0.1007 0.0709 0.0380 0.0086 -0.0198 -0.0511
-0.0843 -0.1123 -0.1430 -0.1772 -0.2055 -0.2366 -0.2704 -0.2996 -0.3320 -0.3644
-0.3953 -0.4295 -0.4600 -0.4933 -0.5256 -0.5585 -0.5917 -0.6246 -0.6581 -0.6915
-0.7252 -0.7595 -0.7929 -0.8282 -0.8615 -0.8964 -0.9314 -0.9657 -1.0010 -1.0365
-1.0695 -1.1054 -1.1392 -1.1746 -1.2089 -1.2438 -1.2787 -1.3131 -1.3486 -1.3824
-1.4185 -1.4518 -1.4884 -1.5213 -1.5581 -1.5910 -1.6271 -1.6605 -1.6961 -1.7302
-1.7654 -1.8002 -1.8347 -1.8700 -1.9040 -1.9398 -1.9734 -2.0098 -2.0428 -2.0798
-2.1124 -2.1487 -2.1820 -2.2178 -2.2517 -2.2870 -2.3215 -2.3562 -2.3912 -2.4255
-2.4510
19 24 1 191 0 0 0 1.6203e-18 0.0000e+00
-0.1249 -0.1121 -0.0992 -0.0864 -0.0736 -0.0607 -0.0479 -0.0351 -0.0222 -0.0094
0.0034 0.0163 0.0291 0.0419 0.0548 0.0676 0.0804 0.0933 0.1061 0.1189
0.1318 0.1446 0.1574 0.1703 0.1831 0.1959 0.2088 0.2216 0.2344 0.2473
0.2601 0.2729 0.2858 0.2986 0.3114 0.3243 0.3371 0.3499 0.3628 0.3756
0.3885 0.4013 0.4141 0.4270 0.4398 0.4526 0.4655 0.4783 0.4911 0.5040
0.5168 0.5296 0.5425 0.5553 0.5681 0.5810 0.5938 0.6067 0.6195 0.6323
0.6452 0.6580 0.6708 0.6837 0.6965 0.7093 0.7222 0.7350 0.7479 0.7607
0.7735 0.7864 0.7992 0.8120 0.8249 0.8377 0.8505 0.8634 0.8762 0.8891
0.9019 0.9147 0.9276 0.9404 0.9532 0.9661 0.9789 0.9917 1.0046 1.0174
1.0222
0.7325 0.5348 0.1438 -0.2128 -0.2444 -0.2796 -0.3191 -0.3525 -0.3857 -0.4228
-0.4595 -0.4853 -0.5135 -0.5447 -0.5793 -0.6181 -0.6621 -0.7126 -0.7438 -0.7738
-0.8071 -0.8443 -0.8862 -0.9341 -0.9682 -1.0003 -1.0360 -1.0762 -1.1219 -1.1595
-1.1930 -1.2304 -1.2726 -1.3173 -1.3506 -1.3879 -1.4299 -1.4736 -1.5085 -1.5476
-1.5919 -1.6305 -1.6684 -1.7113 -1.7525 -1.7907 -1.8341 -1.8749 -1.9145 -1.9595
-1.9981 -2.0402 -2.0831 -2.1236 -2.1687 -2.2085 -2.2536 -2.2941 -2.3391 -2.3806
-2.4262 -2.4678 -2.5134 -2.5562 -2.6011 -2.6462 -2.6903 -2.7365 -2.7817 -2.8270
-2.8707 -2.9041 -2.9415 -2.9837 -3.0319 -3.0878 -3.1542 -3.2019 -3.2496 -3.2952
-3.3415 -3.3893 -3.4340 -3.4816 -3.5274 -3.5735 -3.6216 -3.6662 -3.7136 -3.7598
-3.7786
20 24 1 253 0 0 0 2.5956e-18 0.0000e+00
-0.1246 -0.1118 -0.0990 -0.0862 -0.0734 -0.0606 -0.0478 -0.0350 -0.0222 -0.0094
0.0034 0.0162 0.0290 0.0419 0.0547 0.0675 0.0803 0.0931 0.1059 0.1187
0.1316 0.1444 0.1572 0.1700 0.1828 0.1956 0.2085 0.2213 0.2341 0.2469
0.2598 0.2726 0.2854 0.2982 0.3110 0.3239 0.3367 0.3495 0.3623 0.3752
0.3880 0.4008 0.4136 0.4265 0.4393 0.4521 0.4650 0.4778 0.4906 0.5034
0.5163 0.5291 0.5419 0.5548 0.5676 0.5804 0.5932 0.6061 0.6189 0.6317
0.6446 0.6574 0.6702 0.6831 0.6959 0.7087 0.7216 0.7344 0.7472 0.7600
0.7729 0.7857 0.7985 0.8114 0.8242 0.8370 0.8499 0.8627 0.8755 0.8884
0.9012 0.9140 0.9269 0.9397 0.9525 0.9654 0.9782 0.9911 1.0039 1.0167
1.0296 1.0424 1.0552 1.0681 1.0809 1.0937 1.1066 1.1194 1.1322 1.1451
1.1579 1.1707 1.1836 1.1964 1.2092 1.2221 1.2349 1.2478 1.2606 1.2734
1.2863 1.2991 1.3119 1.3248 1.3376 1.3504 1.3633 1.3761 1.3889 1.4018
1.4146 1.4275 1.4403 1.4531 1.4660 1.4788 1.4916 1.5045 1.5173 1.5301
1.5430 1.5558 1.5687 1.5815 1.5943 1.6072 1.6200 1.6328 1.6457 1.6585
1.6713 1.6842 1.6970 1.7099 1.7227 1.7355 1.7484 1.7612 1.7740 1.7869
1.7997 1.8126 1.8131
0.9371 0.6543 0.0512 0.0360 0.0198 0.0024 -0.0162 -0.0322 -0.0493 -0.0677
-0.0858 -0.1006 -0.1163 -0.1331 -0.1512 -0.1706 -0.1915 -0.2142 -0.2349 -0.2514
-0.2690 -0.2879 -0.3083 -0.3303 -0.3539 -0.3710 -0.3894 -0.4091 -0.4305 -0.4536
-0.4734 -0.4922 -0.5124 -0.5342 -0.5575 -0.5761 -0.5961 -0.6177 -0.6411 -0.6601
-0.6805 -0.7026 -0.7245 -0.7444 -0.7660 -0.7889 -0.8087 -0.8300 -0.8527 -0.8728
-0.8944 -0.9164 -0.9371 -0.9594 -0.9803 -1.0021 -1.0239 -1.0451 -1.0672 -1.0883
-1.1105 -1.1315 -1.1536 -1.1748 -1.1967 -1.2183 -1.2398 -1.2619 -1.2832 -1.3050
-1.3268 -1.3483 -1.3695 -1.3899 -1.4120 -1.4349 -1.4550 -1.4768 -1.5002 -1.5201
-1.5416 -1.5649 -1.5853 -1.6065 -1.6295 -1.6506 -1.6715 -1.6942 -1.7159 -1.7365
-1.7588 -1.7812 -1.8015 -1.8235 -1.8466 -1.8666 -1.8883 -1.9118 -1.9317 -1.9531
-1.9762 -1.9969 -2.0180 -2.0409 -2.0623 -2.0831 -2.1056 -2.1276 -2.1481 -2.1703
-2.1930 -2.2132 -2.2351 -2.2584 -2.2784 -2.2999 -2.3233 -2.3435 -2.3648 -2.3879
-2.4088 -2.4298 -2.4525 -2.4741 -2.4948 -2.5171 -2.5394 -2.5598 -2.5818 -2.6047
-2.6248 -2.6466 -2.6702 -2.6900 -2.7115 -2.7347 -2.7552 -2.7764 -2.7993 -2.8205
-2.8413 -2.8639 -2.8857 -2.9063 -2.9286 -2.9511 -2.9714 -2.9934 -3.0165 -3.0365
-3.0582 -3.0817 -3.0827
21 24 1 261 0 0 0 5.0820e-18 0.0000e+00
-0.1246 -0.1118 -0.0990 -0.0862 -0.0734 -0.0606 -0.0478 -0.0350 -0.0222 -0.0094
0.0034 0.0162 0.0290 0.0419 0.0547 0.0675 0.0803 0.0931 0.1059 0.1187
0.1315 0.1444 0.1572 0.1700 0.1828 0.1956 0.2084 0.2213 0.2341 0.2469
0.2597 0.2726 0.2854 0.2982 0.3110 0.3238 0.3367 0.3495 0.3623 0.3751
0.3880 0.4008 0.4136 0.4264 0.4393 0.4521 0.4649 0.4777 0.4906 0.5034
0.5162 0.5291 0.5419 0.5547 0.5675 0.5804 0.5932 0.6060 0.6189 0.6317
0.6445 0.6574 0.6702 0.6830 0.6958 0.7087 0.7215 0.7343 0.7472 0.7600
0.7728 0.7857 0.7985 0.8113 0.8242 0.8370 0.8498 0.8627 0.8755 0.8883
0.9012 0.9140 0.9268 0.9397 0.9525 0.9653 0.9782 0.9910 1.0038 1.0167
1.0295 1.0423 1.0552 1.0680 1.0808 1.0937 1.1065 1.1194 1.1322 1.1450
1.1579 1.1707 1.1835 1.1964 1.2092 1.2220 1.2349 1.2477 1.2605 1.2734
1.2862 1.2990 1.3119 1.3247 1.3376 1.3504 1.3632 1.3761 1.3889 1.4017
1.4146 1.4274 1.4402 1.4531 1.4659 1.4788 1.4916 1.5044 1.5173 1.5301
1.5429 1.5558 1.5686 1.5814 1.5943 1.6071 1.6200 1.6328 1.6456 1.6585
1.6713 1.6841 1.6970 1.7098 1.7226 1.7355 1.7483 1.7612 1.7740 1.7868
1.7997 1.8125 1.8253 1.8382 1.8510 1.8638 1.8767 1.8895 1.9024 1.9152
1.9266
1.2289 0.6094 0.3633 0.3378 0.3099 0.2791 0.2487 0.2246 0.1983 0.1695
0.1416 0.1228 0.1025 0.0806 0.0568 0.0308 0.0023 -0.0291 -0.0641 -0.0847
-0.1048 -0.1265 -0.1500 -0.1756 -0.2037 -0.2320 -0.2510 -0.2715 -0.2937 -0.3178
-0.3441 -0.3664 -0.3859 -0.4069 -0.4297 -0.4545 -0.4745 -0.4941 -0.5153 -0.5383
-0.5590 -0.5782 -0.5989 -0.6214 -0.6403 -0.6599 -0.6809 -0.7011 -0.7201 -0.7404
-0.7605 -0.7792 -0.7995 -0.8187 -0.8378 -0.8582 -0.8766 -0.8964 -0.9155 -0.9347
-0.9541 -0.9730 -0.9925 -1.0115 -1.0312 -1.0502 -1.0696 -1.0890 -1.1083 -1.1281
-1.1472 -1.1669 -1.1867 -1.2062 -1.2255 -1.2438 -1.2634 -1.2847 -1.3029 -1.3219
-1.3424 -1.3623 -1.3807 -1.4005 -1.4219 -1.4397 -1.4589 -1.4796 -1.4991 -1.5176
-1.5376 -1.5586 -1.5766 -1.5959 -1.6168 -1.6359 -1.6546 -1.6747 -1.6953 -1.7135
-1.7329 -1.7540 -1.7727 -1.7915 -1.8117 -1.8321 -1.8503 -1.8700 -1.8912 -1.9096
-1.9285 -1.9488 -1.9688 -1.9872 -2.0070 -2.0284 -2.0464 -2.0655 -2.0861 -2.1057
-2.1242 -2.1441 -2.1653 -2.1832 -2.2025 -2.2232 -2.2425 -2.2611 -2.2812 -2.3021
-2.3201 -2.3395 -2.3605 -2.3794 -2.3981 -2.4183 -2.4388 -2.4570 -2.4765 -2.4976
-2.5161 -2.5351 -2.5555 -2.5757 -2.5940 -2.6136 -2.6349 -2.6531 -2.6721 -2.6926
-2.7124 -2.7308 -2.7507 -2.7720 -2.7898 -2.8090 -2.8296 -2.8491 -2.8677 -2.8877
-2.9069
22 24 1 215 0 0 0 2.0970e-17 0.0000e+00
-0.1248 -0.1120 -0.0992 -0.0863 -0.0735 -0.0607 -0.0479 -0.0350 -0.0222 -0.0094
0.0034 0.0163 0.0291 0.0419 0.0547 0.0676 0.0804 0.0932 0.1060 0.1189
0.1317 0.1445 0.1574 0.1702 0.1830 0.1959 0.2087 0.2215 0.2343 0.2472
0.2600 0.2728 0.2857 0.2985 0.3113 0.3242 0.3370 0.3498 0.3627 0.3755
0.3883 0.4012 0.4140 0.4268 0.4397 0.4525 0.4653 0.4782 0.4910 0.5038
0.5167 0.5295 0.5423 0.5552 0.5680 0.5808 0.5937 0.6065 0.6193 0.6322
0.6450 0.6578 0.6707 0.6835 0.6963 0.7092 0.7220 0.7348 0.7477 0.7605
0.7733 0.7862 0.7990 0.8119 0.8247 0.8375 0.8504 0.8632 0.8760 0.8889
0.9017 0.9145 0.9274 0.9402 0.9530 0.9659 0.9787 0.9916 1.0044 1.0172
1.0301 1.0429 1.0557 1.0686 1.0814 1.0942 1.1071 1.1199 1.1328 1.1456
1.1584 1.1713 1.1841 1.1969 1.2098 1.2226 1.2354 1.2483 1.2611 1.2740
1.2868 1.2996 1.3125 1.3253 1.3317
1.8445 1.7709 1.6792 1.5588 1.3856 1.0804 0.9604 0.9363 0.9099 0.8810
0.8530 0.8341 0.8137 0.7916 0.7676 0.7414 0.7127 0.6810 0.6458 0.6072
0.5864 0.5639 0.5395 0.5128 0.4835 0.4510 0.4149 0.3895 0.3656 0.3395
0.3109 0.2794 0.2443 0.2186 0.1931 0.1652 0.1345 0.1003 0.0731 0.0465
0.0173 -0.0150 -0.0464 -0.0732 -0.1025 -0.1350 -0.1658 -0.1938 -0.2246 -0.2588
-0.2864 -0.3167 -0.3502 -0.3796 -0.4103 -0.4442 -0.4736 -0.5054 -0.5386 -0.5689
-0.6026 -0.6337 -0.6663 -0.6991 -0.7314 -0.7650 -0.7973 -0.8313 -0.8641 -0.8980
-0.9315 -0.9653 -1.0000 -1.0334 -1.0684 -1.1026 -1.1371 -1.1722 -1.2050 -1.2415
-1.2737 -1.3097 -1.3426 -1.3779 -1.4115 -1.4462 -1.4805 -1.5146 -1.5496 -1.5831
-1.6187 -1.6517 -1.6879 -1.7204 -1.7566 -1.7892 -1.8246 -1.8579 -1.8928 -1.9269
-1.9612 -1.9960 -2.0297 -2.0651 -2.0983 -2.1343 -2.1670 -2.2034 -2.2357 -2.2715
-2.3046 -2.3397 -2.3735 -2.4081 -2.4269
23 24 1 194 0 0 0 1.7112e-18 0.0000e+00
-0.1249 -0.1121 -0.0992 -0.0864 -0.0736 -0.0607 -0.0479 -0.0351 -0.0222 -0.0094
0.0034 0.0163 0.0291 0.0419 0.0548 0.0676 0.0804 0.0933 0.1061 0.1189
0.1318 0.1446 0.1574 0.1703 0.1831 0.1959 0.2088 0.2216 0.2344 0.2473
0.2601 0.2729 0.2858 0.2986 0.3114 0.3243 0.3371 0.3500 0.3628 0.3756
0.3885 0.4013 0.4141 0.4270 0.4398 0.4526 0.4655 0.4783 0.4911 0.5040
0.5168 0.5297 0.5425 0.5553 0.5682 0.5810 0.5938 0.6067 0.6195 0.6323
0.6452 0.6580 0.6708 0.6837 0.6965 0.7094 0.7222 0.7350 0.7479 0.7607
0.7735 0.7864 0.7992 0.8120 0.8249 0.8377 0.8506 0.8634 0.8762 0.8891
0.9019 0.9147 0.9276 0.9404 0.9532 0.9661 0.9789 0.9918 1.0046 1.0174
1.0303 1.0431 1.0559 1.0611
0.7562 0.6810 0.5869 0.4624 0.2808 -0.0517 -0.1337 -0.1646 -0.1989 -0.2374
-0.2745 -0.2974 -0.3223 -0.3496 -0.3795 -0.4127 -0.4498 -0.4915 -0.5392 -0.5946
-0.6240 -0.6516 -0.6821 -0.7158 -0.7536 -0.7963 -0.8451 -0.8846 -0.9140 -0.9465
-0.9828 -1.0236 -1.0700 -1.1099 -1.1414 -1.1764 -1.2157 -1.2602 -1.3021 -1.3350
-1.3716 -1.4130 -1.4601 -1.4936 -1.5302 -1.5714 -1.6177 -1.6520 -1.6904 -1.7339
-1.7747 -1.8121 -1.8543 -1.8972 -1.9348 -1.9773 -2.0195 -2.0585 -2.1027 -2.1428
-2.1843 -2.2283 -2.2682 -2.3136 -2.3533 -2.3978 -2.4392 -2.4835 -2.5256 -2.5705
-2.6127 -2.6587 -2.7008 -2.7461 -2.7904 -2.8349 -2.8813 -2.9255 -2.9637 -2.9975
-3.0352 -3.0779 -3.1267 -3.1835 -3.2509 -3.2955 -3.3422 -3.3877 -3.4331 -3.4806
-3.5247 -3.5716 -3.6169 -3.6371
****** Line transitions (../lines/nist/si4.nln)
1 2 -1 0 1 0 0 6.740e-01 7.000e-01
F 1 7 0. 0.
1 3 0 0 4 0 0 0.000e+00 5.000e-02
1 4 0 0 4 0 0 0.000e+00 5.000e-02
1 5 -1 0 1 0 0 4.100e-02 2.000e-01
F 1 7 0. 0.
1 6 0 0 4 0 0 0.000e+00 5.000e-02
1 7 0 0 4 0 0 0.000e+00 5.000e-02
1 8 0 0 4 0 0 0.000e+00 5.000e-02
1 9 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
1 10 0 0 4 0 0 0.000e+00 5.000e-02
1 11 0 0 4 0 0 0.000e+00 5.000e-02
1 12 0 0 4 0 0 0.000e+00 5.000e-02
1 13 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
1 14 0 0 4 0 0 0.000e+00 5.000e-02
1 15 0 0 4 0 0 0.000e+00 5.000e-02
1 16 0 0 4 0 0 0.000e+00 5.000e-02
1 17 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
1 18 0 0 4 0 0 0.000e+00 5.000e-02
1 19 0 0 4 0 0 0.000e+00 5.000e-02
1 20 0 0 4 0 0 0.000e+00 5.000e-02
1 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
1 22 0 0 4 0 0 0.000e+00 5.000e-02
1 23 0 0 4 0 0 0.000e+00 5.000e-02
2 3 -1 0 1 0 0 7.713e-01 7.000e-01
F 1 7 0. 0.
2 4 -1 0 1 0 0 1.223e-01 2.000e-01
F 1 7 0. 0.
2 5 0 0 4 0 0 0.000e+00 5.000e-02
2 6 -1 0 1 0 0 8.000e-03 2.000e-01
F 1 7 0. 0.
2 7 0 0 4 0 0 0.000e+00 5.000e-02
2 8 -1 0 1 0 0 1.600e-02 2.000e-01
F 1 7 0. 0.
2 9 0 0 4 0 0 0.000e+00 5.000e-02
2 10 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
2 11 0 0 4 0 0 0.000e+00 5.000e-02
2 12 -1 0 1 0 0 6.167e-03 2.000e-01
F 1 7 0. 0.
2 13 0 0 4 0 0 0.000e+00 5.000e-02
2 14 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
2 15 0 0 4 0 0 0.000e+00 5.000e-02
2 16 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
2 17 0 0 4 0 0 0.000e+00 5.000e-02
2 18 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
2 19 0 0 4 0 0 0.000e+00 5.000e-02
2 20 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
2 21 0 0 4 0 0 0.000e+00 5.000e-02
2 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
2 23 0 0 4 0 0 0.000e+00 5.000e-02
3 4 0 0 4 0 0 0.000e+00 5.000e-02
3 5 -1 0 1 0 0 1.458e-01 2.000e-01
F 1 7 0. 0.
3 6 0 0 4 0 0 0.000e+00 5.000e-02
3 7 -1 0 1 0 0 9.337e-01 2.000e-01
F 1 7 0. 0.
3 8 0 0 4 0 0 0.000e+00 5.000e-02
3 9 -1 0 1 0 0 1.200e-02 2.000e-01
F 1 7 0. 0.
3 10 0 0 4 0 0 0.000e+00 5.000e-02
3 11 -1 0 1 0 0 1.711e-01 2.000e-01
F 1 7 0. 0.
3 12 0 0 4 0 0 0.000e+00 5.000e-02
3 13 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
3 14 0 0 4 0 0 0.000e+00 5.000e-02
3 15 -1 0 1 0 0 6.094e-02 2.000e-01
F 1 7 0. 0.
3 16 0 0 4 0 0 0.000e+00 5.000e-02
3 17 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
3 18 0 0 4 0 0 0.000e+00 5.000e-02
3 19 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
3 20 0 0 4 0 0 0.000e+00 5.000e-02
3 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
3 22 0 0 4 0 0 0.000e+00 5.000e-02
3 23 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
4 5 -1 0 1 0 0 1.173e+00 7.000e-01
F 1 7 0. 0.
4 6 0 0 4 0 0 0.000e+00 5.000e-02
4 7 0 0 4 0 0 0.000e+00 5.000e-02
4 8 0 0 4 0 0 0.000e+00 5.000e-02
4 9 -1 0 1 0 0 2.410e-02 2.000e-01
F 1 7 0. 0.
4 10 0 0 4 0 0 0.000e+00 5.000e-02
4 11 0 0 4 0 0 0.000e+00 5.000e-02
4 12 0 0 4 0 0 0.000e+00 5.000e-02
4 13 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
4 14 0 0 4 0 0 0.000e+00 5.000e-02
4 15 0 0 4 0 0 0.000e+00 5.000e-02
4 16 0 0 4 0 0 0.000e+00 5.000e-02
4 17 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
4 18 0 0 4 0 0 0.000e+00 5.000e-02
4 19 0 0 4 0 0 0.000e+00 5.000e-02
4 20 0 0 4 0 0 0.000e+00 5.000e-02
4 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
4 22 0 0 4 0 0 0.000e+00 5.000e-02
4 23 0 0 4 0 0 0.000e+00 5.000e-02
5 6 -1 0 1 0 0 1.193e+00 7.000e-01
F 1 7 0. 0.
5 7 0 0 4 0 0 0.000e+00 5.000e-02
5 8 -1 0 1 0 0 2.007e-01 2.000e-01
F 1 7 0. 0.
5 9 0 0 4 0 0 0.000e+00 5.000e-02
5 10 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
5 11 0 0 4 0 0 0.000e+00 5.000e-02
5 12 -1 0 1 0 0 2.947e-02 2.000e-01
F 1 7 0. 0.
5 13 0 0 4 0 0 0.000e+00 5.000e-02
5 14 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
5 15 0 0 4 0 0 0.000e+00 5.000e-02
5 16 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
5 17 0 0 4 0 0 0.000e+00 5.000e-02
5 18 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
5 19 0 0 4 0 0 0.000e+00 5.000e-02
5 20 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
5 21 0 0 4 0 0 0.000e+00 5.000e-02
5 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
5 23 0 0 4 0 0 0.000e+00 5.000e-02
6 7 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
6 8 0 0 4 0 0 0.000e+00 5.000e-02
6 9 -1 0 1 0 0 3.030e-01 2.000e-01
F 1 7 0. 0.
6 10 0 0 4 0 0 0.000e+00 5.000e-02
6 11 -1 0 1 0 0 7.064e-01 2.000e-01
F 1 7 0. 0.
6 12 0 0 4 0 0 0.000e+00 5.000e-02
6 13 -1 0 1 0 0 2.508e-02 2.000e-01
F 1 7 0. 0.
6 14 0 0 4 0 0 0.000e+00 5.000e-02
6 15 -1 0 1 0 0 1.762e-01 2.000e-01
F 1 7 0. 0.
6 16 0 0 4 0 0 0.000e+00 5.000e-02
6 17 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
6 18 0 0 4 0 0 0.000e+00 5.000e-02
6 19 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
6 20 0 0 4 0 0 0.000e+00 5.000e-02
6 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
6 22 0 0 4 0 0 0.000e+00 5.000e-02
6 23 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
7 8 0 0 4 0 0 0.000e+00 5.000e-02
7 9 0 0 4 0 0 0.000e+00 5.000e-02
7 10 -1 0 1 0 0 2.147e-02 2.000e-01
F 1 7 0. 0.
7 11 0 0 4 0 0 0.000e+00 5.000e-02
7 12 0 0 4 0 0 0.000e+00 5.000e-02
7 13 0 0 4 0 0 0.000e+00 5.000e-02
7 14 -1 0 1 0 0 3.560e-03 2.000e-01
F 1 7 0. 0.
7 15 0 0 4 0 0 0.000e+00 5.000e-02
7 16 0 0 4 0 0 0.000e+00 5.000e-02
7 17 0 0 4 0 0 0.000e+00 5.000e-02
7 18 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
7 19 0 0 4 0 0 0.000e+00 5.000e-02
7 20 0 0 4 0 0 0.000e+00 5.000e-02
7 21 0 0 4 0 0 0.000e+00 5.000e-02
7 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
7 23 0 0 4 0 0 0.000e+00 5.000e-02
8 9 -1 0 1 0 0 1.514e+00 7.000e-01
F 1 7 0. 0.
8 10 0 0 4 0 0 0.000e+00 5.000e-02
8 11 0 0 4 0 0 0.000e+00 5.000e-02
8 12 0 0 4 0 0 0.000e+00 5.000e-02
8 13 -1 0 1 0 0 1.810e-02 2.000e-01
F 1 7 0. 0.
8 14 0 0 4 0 0 0.000e+00 5.000e-02
8 15 0 0 4 0 0 0.000e+00 5.000e-02
8 16 0 0 4 0 0 0.000e+00 5.000e-02
8 17 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
8 18 0 0 4 0 0 0.000e+00 5.000e-02
8 19 0 0 4 0 0 0.000e+00 5.000e-02
8 20 0 0 4 0 0 0.000e+00 5.000e-02
8 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
8 22 0 0 4 0 0 0.000e+00 5.000e-02
8 23 0 0 4 0 0 0.000e+00 5.000e-02
9 10 -1 0 1 0 0 1.521e+00 7.000e-01
F 1 7 0. 0.
9 11 0 0 4 0 0 0.000e+00 5.000e-02
9 12 -1 0 1 0 0 3.013e-01 2.000e-01
F 1 7 0. 0.
9 13 0 0 4 0 0 0.000e+00 5.000e-02
9 14 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
9 15 0 0 4 0 0 0.000e+00 5.000e-02
9 16 -1 0 1 0 0 4.107e-02 2.000e-01
F 1 7 0. 0.
9 17 0 0 4 0 0 0.000e+00 5.000e-02
9 18 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
9 19 0 0 4 0 0 0.000e+00 5.000e-02
9 20 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
9 21 0 0 4 0 0 0.000e+00 5.000e-02
9 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
9 23 0 0 4 0 0 0.000e+00 5.000e-02
10 11 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
10 12 0 0 4 0 0 0.000e+00 5.000e-02
10 13 -1 0 1 0 0 4.498e-01 2.000e-01
F 1 7 0. 0.
10 14 0 0 4 0 0 0.000e+00 5.000e-02
10 15 -1 0 1 0 0 6.416e-01 2.000e-01
F 1 7 0. 0.
10 16 0 0 4 0 0 0.000e+00 5.000e-02
10 17 -1 0 1 0 0 3.896e-02 2.000e-01
F 1 7 0. 0.
10 18 0 0 4 0 0 0.000e+00 5.000e-02
10 19 -1 0 1 0 0 1.689e-01 2.000e-01
F 1 7 0. 0.
10 20 0 0 4 0 0 0.000e+00 5.000e-02
10 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
10 22 0 0 4 0 0 0.000e+00 5.000e-02
10 23 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
11 12 0 0 4 0 0 0.000e+00 5.000e-02
11 13 0 0 4 0 0 0.000e+00 5.000e-02
11 14 -1 0 1 0 0 5.380e-02 2.000e-01
F 1 7 0. 0.
11 15 0 0 4 0 0 0.000e+00 5.000e-02
11 16 0 0 4 0 0 0.000e+00 5.000e-02
11 17 0 0 4 0 0 0.000e+00 5.000e-02
11 18 -1 0 1 0 0 9.417e-03 2.000e-01
F 1 7 0. 0.
11 19 0 0 4 0 0 0.000e+00 5.000e-02
11 20 0 0 4 0 0 0.000e+00 5.000e-02
11 21 0 0 4 0 0 0.000e+00 5.000e-02
11 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
11 23 0 0 4 0 0 0.000e+00 5.000e-02
12 13 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
12 14 0 0 4 0 0 0.000e+00 5.000e-02
12 15 0 0 4 0 0 0.000e+00 5.000e-02
12 16 0 0 4 0 0 0.000e+00 5.000e-02
12 17 -1 0 1 0 0 1.630e-02 2.000e-01
F 1 7 0. 0.
12 18 0 0 4 0 0 0.000e+00 5.000e-02
12 19 0 0 4 0 0 0.000e+00 5.000e-02
12 20 0 0 4 0 0 0.000e+00 5.000e-02
12 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
12 22 0 0 4 0 0 0.000e+00 5.000e-02
12 23 0 0 4 0 0 0.000e+00 5.000e-02
13 14 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
13 15 0 0 4 0 0 0.000e+00 5.000e-02
13 16 -1 0 1 0 0 3.880e-01 2.000e-01
F 1 7 0. 0.
13 17 0 0 4 0 0 0.000e+00 5.000e-02
13 18 -1 0 1 0 0 1.080e-02 2.000e-01
F 1 7 0. 0.
13 19 0 0 4 0 0 0.000e+00 5.000e-02
13 20 -1 0 1 0 0 5.310e-02 2.000e-01
F 1 7 0. 0.
13 21 0 0 4 0 0 0.000e+00 5.000e-02
13 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
13 23 0 0 4 0 0 0.000e+00 5.000e-02
14 15 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
14 16 0 0 4 0 0 0.000e+00 5.000e-02
14 17 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
14 18 0 0 4 0 0 0.000e+00 5.000e-02
14 19 -1 0 1 0 0 5.642e-01 2.000e-01
F 1 7 0. 0.
14 20 0 0 4 0 0 0.000e+00 5.000e-02
14 21 -1 0 1 0 0 5.341e-02 2.000e-01
F 1 7 0. 0.
14 22 0 0 4 0 0 0.000e+00 5.000e-02
14 23 -1 0 1 0 0 1.687e-01 2.000e-01
F 1 7 0. 0.
15 16 0 0 4 0 0 0.000e+00 5.000e-02
15 17 0 0 4 0 0 0.000e+00 5.000e-02
15 18 -1 0 1 0 0 9.170e-02 2.000e-01
F 1 7 0. 0.
15 19 0 0 4 0 0 0.000e+00 5.000e-02
15 20 0 0 4 0 0 0.000e+00 5.000e-02
15 21 0 0 4 0 0 0.000e+00 5.000e-02
15 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
15 23 0 0 4 0 0 0.000e+00 5.000e-02
16 17 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
16 18 0 0 4 0 0 0.000e+00 5.000e-02
16 19 0 0 4 0 0 0.000e+00 5.000e-02
16 20 0 0 4 0 0 0.000e+00 5.000e-02
16 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
16 22 0 0 4 0 0 0.000e+00 5.000e-02
16 23 0 0 4 0 0 0.000e+00 5.000e-02
17 18 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
17 19 0 0 4 0 0 0.000e+00 5.000e-02
17 20 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
17 21 0 0 4 0 0 0.000e+00 5.000e-02
17 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
17 23 0 0 4 0 0 0.000e+00 5.000e-02
18 19 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
18 20 0 0 4 0 0 0.000e+00 5.000e-02
18 21 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
18 22 0 0 4 0 0 0.000e+00 5.000e-02
18 23 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
19 20 0 0 4 0 0 0.000e+00 5.000e-02
19 21 0 0 4 0 0 0.000e+00 5.000e-02
19 22 -1 0 1 0 0 0.000e+00 2.000e-01
F 1 7 0. 0.
19 23 0 0 4 0 0 0.000e+00 5.000e-02
20 21 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
20 22 0 0 4 0 0 0.000e+00 5.000e-02
20 23 0 0 4 0 0 0.000e+00 5.000e-02
21 22 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
21 23 0 0 4 0 0 0.000e+00 5.000e-02
22 23 -1 0 1 0 0 0.000e+00 7.000e-01
F 1 7 0. 0.
| 70.777673 | 109 | 0.526426 |
73fe0508771e5723a5604b6941b1ccd266f23378 | 1,636 | pm | Perl | auto-lib/Paws/Glue/CatalogImportStatus.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/Glue/CatalogImportStatus.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/Glue/CatalogImportStatus.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::Glue::CatalogImportStatus;
use Moose;
has ImportCompleted => (is => 'ro', isa => 'Bool');
has ImportedBy => (is => 'ro', isa => 'Str');
has ImportTime => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Glue::CatalogImportStatus
=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::Glue::CatalogImportStatus object:
$service_obj->Method(Att1 => { ImportCompleted => $value, ..., ImportTime => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::Glue::CatalogImportStatus object:
$result = $service_obj->Method(...);
$result->Att1->ImportCompleted
=head1 DESCRIPTION
A structure containing migration status information.
=head1 ATTRIBUTES
=head2 ImportCompleted => Bool
C<True> if the migration has completed, or C<False> otherwise.
=head2 ImportedBy => Str
The name of the person who initiated the migration.
=head2 ImportTime => Str
The time that the migration was started.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::Glue>
=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
| 23.042254 | 102 | 0.726773 |
ed1774ab7d54bf876f2dd95572dca8d9bbcfa062 | 2,278 | pl | Perl | scripts/fba-import-meta-anno.pl | mmundy42/KBaseFBAModeling | 466ff06bd17c130c32a0f7ee104c208cf461d56f | [
"MIT"
]
| null | null | null | scripts/fba-import-meta-anno.pl | mmundy42/KBaseFBAModeling | 466ff06bd17c130c32a0f7ee104c208cf461d56f | [
"MIT"
]
| null | null | null | scripts/fba-import-meta-anno.pl | mmundy42/KBaseFBAModeling | 466ff06bd17c130c32a0f7ee104c208cf461d56f | [
"MIT"
]
| null | null | null | #!/usr/bin/env perl
########################################################################
# Authors: Christopher Henry, Scott Devoid, Paul Frybarger
# Contact email: chenry@mcs.anl.gov
# Development location: Mathematics and Computer Science Division, Argonne National Lab
########################################################################
use strict;
use warnings;
use Bio::KBase::workspace::ScriptHelpers qw(printObjectInfo get_ws_client workspace workspaceURL parseObjectMeta parseWorkspaceMeta printObjectMeta);
use Bio::KBase::fbaModelServices::ScriptHelpers qw(fbaws get_fba_client runFBACommand universalFBAScriptCode );
#Defining globals describing behavior
my $primaryArgs = ["Annotation filename"];
my $servercommand = "import_metagenome_annotation";
my $script = "fba-import-meta-anno";
my $translation = {
newuid => "metaanno_uid",
outputid => "metaanno_uid",
sourceid => "source_id",
source => "source",
workspace => "workspace",
type => "type",
conftype => "confidence_type",
name => "name",
};
#Defining usage and options
my $specs = [
[ 'newuid|outputid|u:s', 'ID for metagenome annotation in workspace' ],
[ 'name|n:s', 'Name for metagenome annotation' ],
[ 'sourceid|i:s', 'Source ID for metagenome annotation' ],
[ 'source|s:s', 'Source for metagenome annotation' ],
[ 'type|t:s', 'Type of metagenome annotation' ],
[ 'conftype|c:s', 'Confidence type for hits in metagenome annotation' ],
[ 'workspace|w:s', 'Workspace to save phenotypes in', { "default" => fbaws() } ],
];
my ($opt,$params) = universalFBAScriptCode($specs,$script,$primaryArgs,$translation);
$params->{annotations} = [];
if (!-e $opt->{"Annotation filename"}) {
print "Could not find input annotation file!\n";
exit();
}
open(my $fh, "<", $opt->{"Annotation filename"}) || return;
while (my $line = <$fh>) {
chomp($line);
my $array = [split(/\t/,$line)];
push(@{$params->{annotations}},[$array->[0],$array->[1],$array->[4],$array->[2],$array->[3]]);
}
close($fh);
#Calling the server
my $output = runFBACommand($params,$servercommand,$opt);
#Checking output and report results
if (!defined($output)) {
print "Metagenome annotation import failed!\n";
} else {
print "Metagenome annotation import successful:\n";
printObjectInfo($output);
} | 40.678571 | 149 | 0.656277 |
ed0272aff9c4edc4aef241cc4aec2f8c650c5f3f | 2,614 | pm | Perl | auto-lib/Paws/Chime/AssociateSigninDelegateGroupsWithAccount.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/AssociateSigninDelegateGroupsWithAccount.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/AssociateSigninDelegateGroupsWithAccount.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::AssociateSigninDelegateGroupsWithAccount;
use Moose;
has AccountId => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'accountId', required => 1);
has SigninDelegateGroups => (is => 'ro', isa => 'ArrayRef[Paws::Chime::SigninDelegateGroup]', required => 1);
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'AssociateSigninDelegateGroupsWithAccount');
class_has _api_uri => (isa => 'Str', is => 'ro', default => '/accounts/{accountId}?operation=associate-signin-delegate-groups');
class_has _api_method => (isa => 'Str', is => 'ro', default => 'POST');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::Chime::AssociateSigninDelegateGroupsWithAccountResponse');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Chime::AssociateSigninDelegateGroupsWithAccount - Arguments for method AssociateSigninDelegateGroupsWithAccount on L<Paws::Chime>
=head1 DESCRIPTION
This class represents the parameters used for calling the method AssociateSigninDelegateGroupsWithAccount on the
L<Amazon Chime|Paws::Chime> service. Use the attributes of this class
as arguments to method AssociateSigninDelegateGroupsWithAccount.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to AssociateSigninDelegateGroupsWithAccount.
=head1 SYNOPSIS
my $chime = Paws->service('Chime');
my $AssociateSigninDelegateGroupsWithAccountResponse =
$chime->AssociateSigninDelegateGroupsWithAccount(
AccountId => 'MyNonEmptyString',
SigninDelegateGroups => [ { GroupName => 'MyNonEmptyString', }, ... ],
);
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/goto/WebAPI/chime/AssociateSigninDelegateGroupsWithAccount>
=head1 ATTRIBUTES
=head2 B<REQUIRED> AccountId => Str
The Amazon Chime account ID.
=head2 B<REQUIRED> SigninDelegateGroups => ArrayRef[L<Paws::Chime::SigninDelegateGroup>]
The sign-in delegate groups.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method AssociateSigninDelegateGroupsWithAccount in L<Paws::Chime>
=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
| 37.342857 | 249 | 0.744453 |
73fdc695fd440533376150b558bbcf63ff227a28 | 138 | pm | Perl | lib/SQS/Worker/CloudFormationResourceException.pm | pplu/sqs-worker-cfn | 9ebb84f233814b7ca39acde3713d7e5da824173c | [
"Apache-2.0"
]
| null | null | null | lib/SQS/Worker/CloudFormationResourceException.pm | pplu/sqs-worker-cfn | 9ebb84f233814b7ca39acde3713d7e5da824173c | [
"Apache-2.0"
]
| null | null | null | lib/SQS/Worker/CloudFormationResourceException.pm | pplu/sqs-worker-cfn | 9ebb84f233814b7ca39acde3713d7e5da824173c | [
"Apache-2.0"
]
| null | null | null | package SQS::Worker::CloudFormationResourceException;
use Moose;
extends 'Throwable::Error';
__PACKAGE__->meta->make_immutable;
1;
| 19.714286 | 53 | 0.768116 |
ed4655afa4a36d31c590e67cefa2b6a33c5f0f4f | 2,842 | pl | Perl | egs/wsj/s5/local/dict/find_acronyms.pl | oplatek/idlak | 02b24dc6f79b84779e423bfbb17bdf8e70c95aec | [
"Apache-2.0"
]
| 19 | 2015-03-19T10:53:38.000Z | 2020-12-17T06:12:32.000Z | egs/wsj/s5/local/dict/find_acronyms.pl | UFAL-DSG/kaldi-git | 64c8b9e2e3527d0545f279d696b40bab5127fbae | [
"Apache-2.0"
]
| 1 | 2018-12-18T17:43:44.000Z | 2018-12-18T17:43:44.000Z | egs/wsj/s5/local/dict/find_acronyms.pl | UFAL-DSG/kaldi-git | 64c8b9e2e3527d0545f279d696b40bab5127fbae | [
"Apache-2.0"
]
| 47 | 2015-01-27T06:22:57.000Z | 2021-11-11T20:59:04.000Z | #!/usr/bin/perl
# Reads a dictionary, and prints out a list of words that seem to be pronounced
# as acronyms (not including plurals of acronyms, just acronyms). Uses
# the prons of the individual letters (A., B. and so on) to judge this.
# Note: this is somewhat dependent on the convention used in CMUduct, that
# the individual letters are spelled this way (e.g. "A.").
$max_length = 6; # Max length of words that might be
# acronyms.
while(<>) { # Read the dict.
chop;
@A = split(" ", $_);
$word = shift @A;
$pron = join(" ", @A);
if ($word =~ m/^([A-Z])\.$/ ) {
chop $word; # Remove trailing "." to get just the letter
$letter = $1;
if (!defined $letter_prons{$letter} ) {
$letter_prons{$letter} = [ ]; # new anonymous array
}
$arrayref = $letter_prons{$letter};
push @$arrayref, $pron;
} elsif( length($word) <= $max_length ) {
$pronof{$word . "," . $pron} = 1;
$isword{$word} = 1;
#if (!defined $prons{$word} ) {
# $prons{$word} = [ ];
#}
# push @{$prons{$word}}, $pron;
}
}
sub get_letter_prons;
foreach $word (keys %isword) {
my @letter_prons = get_letter_prons($word);
foreach $pron (@letter_prons) {
if (defined $pronof{$word.",".$pron}) {
print "$word $pron\n";
}
}
}
sub get_letter_prons {
@acronym = split("", shift); # The letters in the word.
my @prons = ( "" );
while (@acronym > 0) {
$l = shift @acronym;
$n = 1; # num-repeats of letter $l.
while (@acronym > 0 && $acronym[0] eq $l) {
$n++;
shift @acronym;
}
my $arrayref = $letter_prons{$l};
my @prons_of_block = ();
if ($n == 1) { # Just one repeat.
foreach $lpron ( @$arrayref ) {
push @prons_of_block, $lpron; # typically (always?) just one pron of a letter.
}
} elsif ($n == 2) { # Two repeats. Can be "double a" or "a a"
foreach $lpron ( @$arrayref ) {
push @prons_of_block, "D AH1 B AH0 L " . $lpron;
push @prons_of_block, $lpron . $lpron;
}
} elsif ($n == 3) { # can be "triple a" or "a a a"
foreach $lpron ( @$arrayref ) {
push @prons_of_block, "T R IH1 P AH0 L " . $lpron;
push @prons_of_block, $lpron . $lpron . $lpron;
}
} elsif ($n >= 4) { # let's say it can only be that letter repeated $n times..
# not sure really.
foreach $lpron ( @$arrayref ) {
$nlpron = "";
for ($m = 0; $m < $n; $m++) { $nlpron = $nlpron . $lpron; }
push @prons_of_block, $nlpron;
}
}
my @new_prons = ();
foreach $pron (@prons) {
foreach $pron_of_block(@prons_of_block) {
if ($pron eq "") {
push @new_prons, $pron_of_block;
} else {
push @new_prons, $pron . " " . $pron_of_block;
}
}
}
@prons = @new_prons;
}
return @prons;
}
| 29.604167 | 86 | 0.545742 |
ed3105b244521a50244407df51dbd1f52d391bc0 | 1,766 | pl | Perl | plugins/osversion.pl | jgru/RegRipper3.0 | c61d937b392c73f7719357bd39b7fefe1e8b48f2 | [
"MIT"
]
| 239 | 2020-05-28T18:15:21.000Z | 2022-03-15T12:19:27.000Z | plugins/osversion.pl | jgru/RegRipper3.0 | c61d937b392c73f7719357bd39b7fefe1e8b48f2 | [
"MIT"
]
| 26 | 2020-06-25T14:48:21.000Z | 2021-11-24T18:10:34.000Z | plugins/osversion.pl | jgru/RegRipper3.0 | c61d937b392c73f7719357bd39b7fefe1e8b48f2 | [
"MIT"
]
| 65 | 2020-06-01T10:35:43.000Z | 2022-03-31T03:47:24.000Z | #-----------------------------------------------------------
# osversion.pl
# Plugin to check for OSVersion value, which appears to be queried
# by some malware, and used by others; getting a response of "OSVersion
# not found" is a good thing.
#
# Change history
# 20200511 - updated date output format
# 20120601 - created
#
# References
# Search Google for "Software\Microsoft\OSVersion" - you'll get several
# hits that refer to various malware;
#
# copyright 2020 Quantum Analytics Research, LLC
# Author: H. Carvey, keydet89@yahoo.com
#-----------------------------------------------------------
package osversion;
use strict;
my %config = (hive => "NTUSER\.DAT",
hasShortDescr => 1,
hasDescr => 0,
hasRefs => 0,
osmask => 22,
version => 20200511);
sub getConfig{return %config}
sub getShortDescr {
return "Checks for OSVersion value";
}
sub getDescr{}
sub getRefs {}
sub getHive {return $config{hive};}
sub getVersion {return $config{version};}
my $VERSION = getVersion();
sub pluginmain {
my $class = shift;
my $ntuser = shift;
::logMsg("Launching osversion v.".$VERSION);
my $reg = Parse::Win32Registry->new($ntuser);
my $root_key = $reg->get_root_key;
my $key_path = 'Software\\Microsoft';
my $key;
if ($key = $root_key->get_subkey($key_path)) {
::rptMsg("OSVersion");
::rptMsg($key_path);
::rptMsg("LastWrite Time ".::getDateFromEpoch($key->get_timestamp())."Z");
::rptMsg("");
my $os;
eval {
$os = $key->get_value("OSVersion")->get_data();
};
if ($@) {
::rptMsg("OSVersion value not found.");
}
else {
::rptMsg("OSVersion = ".$os);
}
}
else {
::rptMsg($key_path." not found.");
}
}
1; | 24.873239 | 76 | 0.579275 |
73d8d28a1a0b1c8874c6ec49cd0146e27305a96b | 837 | pm | Perl | lib/Selenium/Remote/Finders.pm | bschmalhofer/Selenium-Remote-Driver | e8798e499e8d0b4f4943b59abbe7b6be54dfe7e2 | [
"Apache-2.0"
]
| 44 | 2017-07-26T11:19:20.000Z | 2021-03-19T22:33:49.000Z | lib/Selenium/Remote/Finders.pm | bschmalhofer/Selenium-Remote-Driver | e8798e499e8d0b4f4943b59abbe7b6be54dfe7e2 | [
"Apache-2.0"
]
| 175 | 2017-07-25T00:33:06.000Z | 2022-01-12T13:29:08.000Z | lib/Selenium/Remote/Finders.pm | bschmalhofer/Selenium-Remote-Driver | e8798e499e8d0b4f4943b59abbe7b6be54dfe7e2 | [
"Apache-2.0"
]
| 24 | 2017-08-08T01:32:20.000Z | 2021-01-16T11:21:06.000Z | package Selenium::Remote::Finders;
use strict;
use warnings;
# ABSTRACT: Handle construction of generic parameter finders
use Try::Tiny;
use Carp qw/carp/;
use Moo::Role;
use namespace::clean;
=head1 DESCRIPTION
This package just takes care of setting up parameter finders - that
is, the C<find_element_by_.*> versions of the find element
functions. You probably don't need to do anything with this package;
instead, see L<Selenium::Remote::Driver/find_element> documentation
for the specific finder functions.
=cut
sub _build_find_by {
my ( $self, $by ) = @_;
return sub {
my ( $driver, $locator ) = @_;
my $strategy = $by;
return try {
return $driver->find_element( $locator, $strategy );
}
catch {
carp $_;
return 0;
};
}
}
1;
| 20.925 | 68 | 0.642772 |
ed2d0bd93b1ab060cd9b840e6072d67e5635118c | 1,584 | pl | Perl | Benchmarks/Recomputation/specOMP_install/bin/lib/unicore/lib/Radical/N.pl | sqsq87/NVC | 1ed478788978e3e85c219313cd55564d4037e242 | [
"MIT"
]
| null | null | null | Benchmarks/Recomputation/specOMP_install/bin/lib/unicore/lib/Radical/N.pl | sqsq87/NVC | 1ed478788978e3e85c219313cd55564d4037e242 | [
"MIT"
]
| null | null | null | Benchmarks/Recomputation/specOMP_install/bin/lib/unicore/lib/Radical/N.pl | sqsq87/NVC | 1ed478788978e3e85c219313cd55564d4037e242 | [
"MIT"
]
| null | null | null | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by lib/unicore/mktables from the Unicode
# database, Version 5.2.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by the Perl program only. The format and even
# the name or existence of this file are subject to change without notice.
# Don't use it directly.
# This file returns the 1_113_783 code points in Unicode Version 5.2.0 that
# match any of the following regular expression constructs:
#
# \p{Radical=No}
# \p{Is_Radical=N}
# \p{Radical=F}
# \p{Is_Radical=False}
#
# \P{Radical}
# \P{Is_Radical}
#
# perluniprops.pod should be consulted for the syntax rules for any of these,
# including if adding or subtracting white space, underscore, and hyphen
# characters matters or doesn't matter, and other permissible syntactic
# variants. Upper/lower case distinctions never matter.
#
# A colon can be substituted for the equals sign, and anything to the left of
# the equals (or colon) can be combined with anything to the right. Thus,
# for example,
# \p{Is_Radical: No}
# is also valid.
#
# The format of the lines of this file is: START\tSTOP\twhere START is the
# starting code point of the range, in hex; STOP is the ending point, or if
# omitted, the range has just one code point. Numbers in comments in
# [brackets] indicate how many code points are in the range.
return <<'END';
0000 2E7F # [11_904]
2E9A
2EF4 2EFF # [12]
2FD6 10FFFF # [1_101_866]
END
| 36.837209 | 78 | 0.693182 |
ed028c9ba1734815ce1e1fb23e2aad86ed81e8b1 | 4,376 | pl | Perl | Cwl/repeatmodeler/RepeatMaskerConf/util/rmOut2Fasta.pl | vetscience/Tools | 1f177c6671d2aeb374a64bb8db019331eec8a7c9 | [
"BSD-3-Clause"
]
| 6 | 2019-03-02T17:30:07.000Z | 2021-01-30T08:56:43.000Z | Cwl/repeatmodeler/RepeatMaskerConf/util/rmOut2Fasta.pl | vetscience/Tools | 1f177c6671d2aeb374a64bb8db019331eec8a7c9 | [
"BSD-3-Clause"
]
| 1 | 2020-07-20T08:36:00.000Z | 2020-07-20T22:15:56.000Z | Cwl/repeatmodeler/RepeatMaskerConf/util/rmOut2Fasta.pl | vetscience/Tools | 1f177c6671d2aeb374a64bb8db019331eec8a7c9 | [
"BSD-3-Clause"
]
| 6 | 2019-03-05T11:20:14.000Z | 2020-03-16T07:17:00.000Z | #!/usr/local/bin/perl
##---------------------------------------------------------------------------##
## File:
## @(#) rmOut2Fasta.pl
## Author:
## Robert Hubley <rhubley@systemsbiology.org>
## Description:
## Using RepeatMasker's batching mechanism generate a particular
## numbered batch from the input file.
##
#******************************************************************************
#* Copyright (C) Institute for Systems Biology 2002-2011 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: rmOut2Fasta.pl,v $
# Revision 1.6 2017/02/01 21:01:57 rhubley
# Cleanup before a distribution
#
#
###############################################################################
#
# To Do:
#
#
=head1 NAME
rmOut2Fasta.pl - Extract FASTA sequences based on RM *.out annotations
=head1 SYNOPSIS
rmOut2Fasta.pl [-options] -fasta <*.fa> -out <*.out>
=head1 DESCRIPTION
The options are:
=over 4
=item -fasta <*.fa>
A single FASTA file containing all the sequences referenced in
a RepeatMasker *.out file.
=item -out <*.out>
A single RepeatMasker *.out file.
=back
=head1 SEE ALSO
=over 4
RepeatMasker
=back
=head1 COPYRIGHT
Copyright 2007-2013 Robert Hubley, Arian Smit, Institute for Systems Biology
=head1 AUTHORS
Robert Hubley <rhubley@systemsbiology.org>
=cut
#
# Module Dependence
#
use strict;
use FindBin;
use lib $FindBin::RealBin;
use lib "$FindBin::Bin/..";
use Getopt::Long;
use POSIX qw(:sys_wait_h);
use File::Copy;
use File::Spec;
use File::Path;
use Data::Dumper;
use Cwd;
# RepeatMasker Libraries
use FastaDB;
use CrossmatchSearchEngine;
use SearchResultCollection;
# Debugging flag
my $DEBUG = 0;
#
# Version
#
# This is a neat trick. CVS allows you to tag
# files in a repository ( i.e. cvs tag "2003/12/03" ).
# If you check out that release into a new
# directory with "cvs co -r "2003/12/03" it will
# place this string into the $Name: open-4-0-7 $ space below
# automatically. This will help us keep track
# of which release we are using. If we simply
# check out the code as "cvs co RepeatMasker" the
# $Name: open-4-0-7 $ macro will be blank and thus we use
# this as the development version.
#
my $CVSTag = '$Name: open-4-0-7 $';
my $version;
if ( $CVSTag =~ /\$\s*Name:\s*open-(\S+)\s*\$/ ) {
$version = $1;
$version =~ s/-/./g;
$version = "open-$version";
}
else {
$version =
'development-$Id: rmOut2Fasta.pl,v 1.6 2017/02/01 21:01:57 rhubley Exp $';
}
my @getopt_args = (
'-version', # print out the version and exit
'-fasta=s',
'-out=s'
);
my %options = ();
Getopt::Long::config( "noignorecase", "bundling_override" );
unless ( GetOptions( \%options, @getopt_args ) ) {
usage();
}
# Print the internal POD documentation if something is missing
if ( !( $options{'fasta'} && $options{'out'} ) ) {
print "Missing -fasta or -out options!\n\n";
exec "pod2text $0";
die;
}
my $db = FastaDB->new(
fileName => $options{'fasta'},
openMode => SeqDBI::ReadOnly,
maxIDLength => 50
);
my $resultCollection =
CrossmatchSearchEngine::parseOutput( searchOutput => $options{'out'} );
for ( my $i = 0 ; $i < $resultCollection->size() ; $i++ ) {
my $result = $resultCollection->get( $i );
my $qID = $result->getQueryName();
my $qBeg = $result->getQueryStart();
my $qEnd = $result->getQueryEnd();
my $sID = $result->getSubjName();
my $sBeg = $result->getSubjStart();
my $sEnd = $result->getSubjEnd();
my $orient = $result->getOrientation();
$orient = "+" if ( $orient ne "C" );
$orient = "-" if ( $orient eq "C" );
my $seq = $db->getSubstr( $qID, $qBeg - 1, $qEnd - $qBeg + 1 );
if ( $orient eq "-" ) {
$seq = reverse( $seq );
$seq =~ tr/ACGTYRMKHBVDacgtyrmkhbvd/TGCARYKMDVBHtgcarykmdvbh/;
}
$seq =~ s/(\S{50})/$1\n/g;
$seq .= "\n"
unless ( $seq =~ /.*\n+$/s );
print ">$qID:$qBeg-$qEnd ( $sID:$sBeg-$sEnd orient=$orient )\n";
print "$seq";
}
| 24.446927 | 80 | 0.58021 |
73fcb31ce7a16f391930a23566cc8d8c31790efc | 2,955 | pm | Perl | auto-lib/Paws/EC2/CreateSpotDatafeedSubscription.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/EC2/CreateSpotDatafeedSubscription.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/EC2/CreateSpotDatafeedSubscription.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null |
package Paws::EC2::CreateSpotDatafeedSubscription;
use Moose;
has Bucket => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'bucket' , required => 1);
has DryRun => (is => 'ro', isa => 'Bool', traits => ['NameInRequest'], request_name => 'dryRun' );
has Prefix => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'prefix' );
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'CreateSpotDatafeedSubscription');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::EC2::CreateSpotDatafeedSubscriptionResult');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::EC2::CreateSpotDatafeedSubscription - Arguments for method CreateSpotDatafeedSubscription on L<Paws::EC2>
=head1 DESCRIPTION
This class represents the parameters used for calling the method CreateSpotDatafeedSubscription on the
L<Amazon Elastic Compute Cloud|Paws::EC2> service. Use the attributes of this class
as arguments to method CreateSpotDatafeedSubscription.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to CreateSpotDatafeedSubscription.
=head1 SYNOPSIS
my $ec2 = Paws->service('EC2');
# To create a Spot Instance datafeed
# This example creates a Spot Instance data feed for your AWS account.
my $CreateSpotDatafeedSubscriptionResult =
$ec2->CreateSpotDatafeedSubscription(
{
'Bucket' => 'my-s3-bucket',
'Prefix' => 'spotdata'
}
);
# Results:
my $SpotDatafeedSubscription =
$CreateSpotDatafeedSubscriptionResult->SpotDatafeedSubscription;
# Returns a L<Paws::EC2::CreateSpotDatafeedSubscriptionResult> 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/goto/WebAPI/ec2/CreateSpotDatafeedSubscription>
=head1 ATTRIBUTES
=head2 B<REQUIRED> Bucket => Str
The Amazon S3 bucket in which to store the Spot Instance data feed.
=head2 DryRun => Bool
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response. If
you have the required permissions, the error response is
C<DryRunOperation>. Otherwise, it is C<UnauthorizedOperation>.
=head2 Prefix => Str
A prefix for the data feed file names.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method CreateSpotDatafeedSubscription in L<Paws::EC2>
=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
| 33.579545 | 249 | 0.729272 |
73d84aed14452eeb340964a5212e87ae336e1730 | 1,279 | t | Perl | t/css-loading.t | sceox/amusewiki | 7d9fedb2abf4790c058ccd23c7f111a3db2464b9 | [
"Artistic-1.0"
]
| null | null | null | t/css-loading.t | sceox/amusewiki | 7d9fedb2abf4790c058ccd23c7f111a3db2464b9 | [
"Artistic-1.0"
]
| 39 | 2020-03-19T23:35:06.000Z | 2020-05-07T20:22:01.000Z | t/css-loading.t | sceox/amusewiki | 7d9fedb2abf4790c058ccd23c7f111a3db2464b9 | [
"Artistic-1.0"
]
| 1 | 2020-04-01T21:10:25.000Z | 2020-04-01T21:10:25.000Z | #!perl
use strict;
use warnings;
BEGIN { $ENV{DBIX_CONFIG_DIR} = "t" };
use Test::More tests => 11;
use AmuseWikiFarm::Schema;
use Test::WWW::Mechanize::Catalyst;
my $schema = AmuseWikiFarm::Schema->connect('amuse');
my $site = $schema->resultset('Site')->find('0blog0');
# cleanup
$site->revisions->delete_all;
my $mech = Test::WWW::Mechanize::Catalyst->new(catalyst_app => 'AmuseWikiFarm',
host => $site->canonical);
my $mk_css = '/static/js/markitup/skins/amw/style.css';
$mech->get_ok('/');
diag "At root";
$mech->content_lacks($mk_css);
$mech->get_ok('/login');
ok($mech->submit_form(with_fields => {__auth_user => 'root', __auth_pass => 'root' }),
"Found login form");
is $mech->status, '200';
foreach my $type (qw/special text/) {
$mech->get("/action/$type/new");
diag $mech->uri;
$mech->content_lacks($mk_css);
$mech->submit_form(with_fields => {title => 'this-is-a-test-' . $type},
button => 'go',
);
diag $mech->uri;
$mech->content_contains($mk_css);
}
$mech->get('/category/author/ciao/edit');
diag $mech->uri;
$mech->content_contains($mk_css);
$mech->get('/category/topic/miao/edit');
diag $mech->uri;
$mech->content_contains($mk_css);
| 25.58 | 86 | 0.610633 |
ed35bc1fc9f564309e563ee1353eaf2b54faa635 | 384 | pm | Perl | src/observer/perl/Subject/DataSubject.pm | oxnz/design-patterns | 6fe3b4e7a2f524a5c1ebac7f4d3eed0b0f955c59 | [
"MIT"
]
| 117 | 2015-01-31T13:01:02.000Z | 2022-02-02T19:55:19.000Z | src/observer/perl/Subject/DataSubject.pm | addisonlynch/design-patterns | e9e0f6029ac427a8c81847e8df4a2720b03ce918 | [
"MIT"
]
| 1 | 2018-01-10T13:06:51.000Z | 2018-01-10T13:06:51.000Z | src/observer/perl/Subject/DataSubject.pm | addisonlynch/design-patterns | e9e0f6029ac427a8c81847e8df4a2720b03ce918 | [
"MIT"
]
| 34 | 2015-08-17T13:54:30.000Z | 2020-03-23T19:35:13.000Z | package Subject::DataSubject;
use parent Subject;
use strict;
use warnings;
use Data::Dump;
sub new {
my ($class, $args) = @_;
my $self = $class->SUPER::new($args);
$self->{name} = $args->{name};
$self->{data} = $args->{data};
return $self;
}
sub data {
my ($self, $data) = @_;
if (defined($data)) {
$self->{data} = $data;
$self->notify;
}
return $self->{data};
}
1;
| 14.769231 | 38 | 0.580729 |
ed49f577f956e3f20759c18a488b5be56795866b | 717 | t | Perl | t/060-free-refs.t | gitpan/Promises | 20253674cd65018fd97bd99ed97245021e3c6c07 | [
"Artistic-1.0"
]
| null | null | null | t/060-free-refs.t | gitpan/Promises | 20253674cd65018fd97bd99ed97245021e3c6c07 | [
"Artistic-1.0"
]
| null | null | null | t/060-free-refs.t | gitpan/Promises | 20253674cd65018fd97bd99ed97245021e3c6c07 | [
"Artistic-1.0"
]
| null | null | null | use strict;
use warnings;
use Promises 'deferred';
use Scalar::Util qw(weaken);
use Test::More 0.89;
my $count;
my $cb;
sub setup {
$count = 0;
$cb = sub { $count++ };
my $d = deferred;
my $p = $d->promise;
for ( 1 .. 5 ) {
$p = $p->then( $cb, $cb );
}
weaken $cb;
return $d;
}
# Free resolve & reject on resolve()
my $d = setup();
ok $cb, "Weakened ref exists pre-resolve";
$d->resolve();
is $count, 5, "Resolve successful";
ok !$cb, "Weakened ref freed post-resolve";
# Free resolve & reject on reject()
$d = setup();
ok $cb, "Weakened ref exists pre-reject";
$d->reject();
is $count, 5, "Reject successful";
ok !$cb, "Weakened ref freed pos-reject";
done_testing;
| 17.071429 | 43 | 0.589958 |
73fa17304c7ffe9b69248dcbda6cce7b7a12305f | 13,932 | pm | Perl | exiftool/lib/Image/ExifTool/OOXML.pm | wp-plugins/symbiostock | 5075898fc74e524c3236ab8dc94e6dd36eac6dd8 | [
"OLDAP-2.2.1"
]
| 21 | 2017-03-26T16:48:24.000Z | 2022-01-08T15:45:26.000Z | exiftool/lib/Image/ExifTool/OOXML.pm | wp-plugins/symbiostock | 5075898fc74e524c3236ab8dc94e6dd36eac6dd8 | [
"OLDAP-2.2.1"
]
| 11 | 2020-03-03T20:32:27.000Z | 2022-03-30T22:14:53.000Z | exiftool/lib/Image/ExifTool/OOXML.pm | wp-plugins/symbiostock | 5075898fc74e524c3236ab8dc94e6dd36eac6dd8 | [
"OLDAP-2.2.1"
]
| 7 | 2017-02-08T18:35:38.000Z | 2021-11-29T09:48:14.000Z | #------------------------------------------------------------------------------
# File: OOXML.pm
#
# Description: Read Office Open XML+ZIP files
#
# Revisions: 2009/10/31 - P. Harvey Created
#------------------------------------------------------------------------------
package Image::ExifTool::OOXML;
use strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::XMP;
use Image::ExifTool::ZIP;
$VERSION = '1.07';
# test for recognized OOXML document extensions
my %isOOXML = (
DOCX => 1, DOCM => 1,
DOTX => 1, DOTM => 1,
POTX => 1, POTM => 1,
PPSX => 1, PPSM => 1,
PPTX => 1, PPTM => 1, THMX => 1,
XLAM => 1,
XLSX => 1, XLSM => 1, XLSB => 1,
XLTX => 1, XLTM => 1,
);
# generate reverse lookup for file type based on MIME
my %fileType;
{
my $type;
foreach $type (keys %isOOXML) {
$fileType{$Image::ExifTool::mimeType{$type}} = $type;
}
}
# XML attributes to queue
my %queuedAttrs;
my %queueAttrs = (
fmtid => 1,
pid => 1,
name => 1,
);
# keep track of items in a vector (to accumulate as a list)
my $vectorCount;
my @vectorVals;
# Office Open XML tags
%Image::ExifTool::OOXML::Main = (
GROUPS => { 0 => 'XML', 1 => 'XML', 2 => 'Document' },
PROCESS_PROC => \&Image::ExifTool::XMP::ProcessXMP,
VARS => { NO_ID => 1 },
NOTES => q{
The Office Open XML (OOXML) format was introduced with Microsoft Office 2007
and is used by file types such as DOCX, PPTX and XLSX. These are
essentially ZIP archives containing XML files. The table below lists some
tags which have been observed in OOXML documents, but ExifTool will extract
any tags found from XML files of the OOXML document properties ("docProps")
directory.
B<Tips:>
1) Structural ZIP tags may be ignored (if desired) with C<--ZIP:all> on the
command line.
2) Tags may be grouped by their document number in the ZIP archive with the
C<-g3> or C<-G3> option.
},
# These tags all have 1:1 correspondence with FlashPix tags except for:
# OOXML FlashPix
# --------------- -------------
# DocSecurity Security
# Application Software
# dc:Description Comments
# dc:Creator Author
Application => { },
AppVersion => { },
category => { },
Characters => { },
CharactersWithSpaces => { },
CheckedBy => { },
Client => { },
Company => { },
created => {
Name => 'CreateDate',
Groups => { 2 => 'Time' },
Format => 'date',
PrintConv => '$self->ConvertDateTime($val)',
},
createdType => { Hidden => 1, RawConv => 'undef' }, # ignore this XML type name
DateCompleted => {
Groups => { 2 => 'Time' },
Format => 'date',
PrintConv => '$self->ConvertDateTime($val)',
},
Department => { },
Destination => { },
Disposition => { },
Division => { },
DocSecurity => {
# (http://msdn.microsoft.com/en-us/library/documentformat.openxml.extendedproperties.documentsecurity.aspx)
PrintConv => {
0 => 'None',
1 => 'Password protected',
2 => 'Read-only recommended',
4 => 'Read-only enforced',
8 => 'Locked for annotations',
},
},
DocumentNumber=> { },
Editor => { Groups => { 2 => 'Author'} },
ForwardTo => { },
Group => { },
HeadingPairs=> { },
HiddenSlides=> { },
HyperlinkBase=>{ },
HyperlinksChanged => { PrintConv => { 'false' => 'No', 'true' => 'Yes' } },
keywords => { },
Language => { },
lastModifiedBy => { Groups => { 2 => 'Author'} },
lastPrinted => {
Groups => { 2 => 'Time' },
Format => 'date',
PrintConv => '$self->ConvertDateTime($val)',
},
Lines => { },
LinksUpToDate=>{ PrintConv => { 'false' => 'No', 'true' => 'Yes' } },
Mailstop => { },
Manager => { },
Matter => { },
MMClips => { },
modified => {
Name => 'ModifyDate',
Groups => { 2 => 'Time' },
Format => 'date',
PrintConv => '$self->ConvertDateTime($val)',
},
modifiedType=> { Hidden => 1, RawConv => 'undef' }, # ignore this XML type name
Notes => { },
Office => { },
Owner => { Groups => { 2 => 'Author'} },
Pages => { },
Paragraphs => { },
PresentationFormat => { },
Project => { },
Publisher => { },
Purpose => { },
ReceivedFrom=> { },
RecordedBy => { },
RecordedDate=> {
Groups => { 2 => 'Time' },
Format => 'date',
PrintConv => '$self->ConvertDateTime($val)',
},
Reference => { },
revision => { Name => 'RevisionNumber' },
ScaleCrop => { PrintConv => { 'false' => 'No', 'true' => 'Yes' } },
SharedDoc => { PrintConv => { 'false' => 'No', 'true' => 'Yes' } },
Slides => { },
Source => { },
Status => { },
TelephoneNumber => { },
Template => { },
TitlesOfParts=>{ },
TotalTime => {
Name => 'TotalEditTime',
PrintConv => 'ConvertTimeSpan($val, 60)',
},
Typist => { },
Words => { },
);
#------------------------------------------------------------------------------
# Generate a tag ID for this XML tag
# Inputs: 0) tag property name list ref
# Returns: tagID and outtermost interesting namespace (or '' if no namespace)
sub GetTagID($)
{
my $props = shift;
my ($tag, $prop, $namespace);
foreach $prop (@$props) {
# split name into namespace and property name
# (Note: namespace can be '' for property qualifiers)
my ($ns, $nm) = ($prop =~ /(.*?):(.*)/) ? ($1, $2) : ('', $prop);
next if $ns eq 'vt'; # ignore 'vt' properties
if (defined $tag) {
$tag .= ucfirst($nm); # add to tag name
} elsif ($prop ne 'Properties' and $prop ne 'cp:coreProperties' and
$prop ne 'property')
{
$tag = $nm;
# save namespace of first property to contribute to tag name
$namespace = $ns unless $namespace;
}
}
return ($tag, $namespace || '');
}
#------------------------------------------------------------------------------
# We found an XMP property name/value
# Inputs: 0) ExifTool object ref, 1) tag table ref
# 2) reference to array of XMP property names (last is current property)
# 3) property value, 4) attribute hash ref (not used here)
# Returns: 1 if valid tag was found
sub FoundTag($$$$;$)
{
my ($et, $tagTablePtr, $props, $val, $attrs) = @_;
return 0 unless @$props;
my $verbose = $et->Options('Verbose');
my $tag = $$props[-1];
$et->VPrint(0, " | - Tag '", join('/',@$props), "'\n") if $verbose > 1;
# un-escape XML character entities
$val = Image::ExifTool::XMP::UnescapeXML($val);
# convert OOXML-escaped characters (eg. "_x0000d_" is a newline)
$val =~ s/_x([0-9a-f]{4})_/Image::ExifTool::PackUTF8(hex($1))/gie;
# convert from UTF8 to ExifTool Charset
$val = $et->Decode($val, 'UTF8');
# queue this attribute for later if necessary
if ($queueAttrs{$tag}) {
$queuedAttrs{$tag} = $val;
return 0;
}
my $ns;
($tag, $ns) = GetTagID($props);
if (not $tag) {
# all properties are in ignored namespaces
# so 'name' from our queued attributes for the tag
my $name = $queuedAttrs{name} or return 0;
$name =~ s/(^| )([a-z])/$1\U$2/g; # start words with uppercase
($tag = $name) =~ tr/-_a-zA-Z0-9//dc;
return 0 unless length $tag;
unless ($$tagTablePtr{$tag}) {
my %tagInfo = (
Name => $tag,
Description => $name,
);
# format as a date/time value if type is 'vt:filetime'
if ($$props[-1] eq 'vt:filetime') {
$tagInfo{Groups} = { 2 => 'Time' },
$tagInfo{Format} = 'date',
$tagInfo{PrintConv} = '$self->ConvertDateTime($val)';
}
$et->VPrint(0, " | [adding $tag]\n") if $verbose;
AddTagToTable($tagTablePtr, $tag, \%tagInfo);
}
} elsif ($tag eq 'xmlns') {
# ignore namespaces (for now)
return 0;
} elsif (ref $Image::ExifTool::XMP::Main{$ns} eq 'HASH' and
$Image::ExifTool::XMP::Main{$ns}{SubDirectory})
{
# use standard XMP table if it exists
my $table = $Image::ExifTool::XMP::Main{$ns}{SubDirectory}{TagTable};
no strict 'refs';
if ($table and %$table) {
$tagTablePtr = Image::ExifTool::GetTagTable($table);
}
} elsif (@$props > 2 and grep /^vt:vector$/, @$props) {
# handle vector properties (accumulate as lists)
if ($$props[-1] eq 'vt:size') {
$vectorCount = $val;
undef @vectorVals;
return 0;
} elsif ($$props[-1] eq 'vt:baseType') {
return 0; # ignore baseType
} elsif ($vectorCount) {
--$vectorCount;
if ($vectorCount) {
push @vectorVals, $val;
return 0;
}
$val = [ @vectorVals, $val ] if @vectorVals;
# Note: we will lose any improper-sized vector elements here
}
}
# add any unknown tags to table
if ($$tagTablePtr{$tag}) {
my $tagInfo = $$tagTablePtr{$tag};
if (ref $tagInfo eq 'HASH') {
# reformat date/time values
my $fmt = $$tagInfo{Format} || $$tagInfo{Writable} || '';
$val = Image::ExifTool::XMP::ConvertXMPDate($val) if $fmt eq 'date';
}
} else {
$et->VPrint(0, " [adding $tag]\n") if $verbose;
AddTagToTable($tagTablePtr, $tag, { Name => ucfirst $tag });
}
# save the tag
$et->HandleTag($tagTablePtr, $tag, $val);
# start fresh for next tag
undef $vectorCount;
undef %queuedAttrs;
return 1;
}
#------------------------------------------------------------------------------
# Extract information from an OOXML file
# Inputs: 0) ExifTool object reference, 1) dirInfo reference
# Returns: 1
# Notes: Upon entry to this routine, the file type has already been verified
# and the dirInfo hash contains 2 elements unique to this process proc:
# MIME - mime type of main document from "[Content_Types].xml"
# ZIP - reference to Archive::Zip object for this file
sub ProcessDOCX($$)
{
my ($et, $dirInfo) = @_;
my $zip = $$dirInfo{ZIP};
my $tagTablePtr = GetTagTable('Image::ExifTool::OOXML::Main');
my $mime = $$dirInfo{MIME} || $Image::ExifTool::mimeType{DOCX};
# set the file type ('DOCX' by default)
my $fileType = $fileType{$mime};
if ($fileType) {
# THMX is a special case because its contents.main MIME types is PPTX
if ($fileType eq 'PPTX' and $$et{FILE_EXT} and $$et{FILE_EXT} eq 'THMX') {
$fileType = 'THMX';
}
} else {
$et->VPrint(0, "Unrecognized MIME type: $mime\n");
# get MIME type according to file extension
$fileType = $$et{FILE_EXT};
# default to 'DOCX' if this isn't a known OOXML extension
$fileType = 'DOCX' unless $fileType and $isOOXML{$fileType};
}
$et->SetFileType($fileType);
# must catch all Archive::Zip warnings
local $SIG{'__WARN__'} = \&Image::ExifTool::ZIP::WarnProc;
# extract meta information from all files in ZIP "docProps" directory
my $docNum = 0;
my @members = $zip->members();
my $member;
foreach $member (@members) {
# get filename of this ZIP member
my $file = $member->fileName();
next unless defined $file;
$et->VPrint(0, "File: $file\n");
# set the document number and extract ZIP tags
$$et{DOC_NUM} = ++$docNum;
Image::ExifTool::ZIP::HandleMember($et, $member);
# process only XML and JPEG/WMF thumbnail images in "docProps" directory
next unless $file =~ m{^docProps/(.*\.xml|(thumbnail\.(jpe?g|wmf)))$}i;
# get the file contents (CAREFUL! $buff MUST be local since we hand off a value ref)
my ($buff, $status) = $zip->contents($member);
$status and $et->Warn("Error extracting $file"), next;
# extract docProps/thumbnail.(jpg|mwf) as PreviewImage|PreviewMWF
if ($file =~ /\.(jpe?g|wmf)$/i) {
my $tag = $file =~ /\.wmf$/i ? 'PreviewWMF' : 'PreviewImage';
$et->FoundTag($tag, \$buff);
next;
}
# process XML files (docProps/app.xml, docProps/core.xml, docProps/custom.xml)
my %dirInfo = (
DataPt => \$buff,
DirLen => length $buff,
DataLen => length $buff,
XMPParseOpts => {
FoundProc => \&FoundTag,
},
);
$et->ProcessDirectory(\%dirInfo, $tagTablePtr);
undef $buff; # (free memory now)
}
delete $$et{DOC_NUM};
return 1;
}
1; # end
__END__
=head1 NAME
Image::ExifTool::OOXML - Read Office Open XML+ZIP files
=head1 SYNOPSIS
This module is used by Image::ExifTool
=head1 DESCRIPTION
This module contains definitions required by Image::ExifTool to extract meta
information from Office Open XML files. This is the format of Word, Excel
and PowerPoint files written by Microsoft Office 2007 -- essentially ZIP
archives of XML files.
=head1 AUTHOR
Copyright 2003-2015, Phil Harvey (phil at owl.phy.queensu.ca)
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 SEE ALSO
L<Image::ExifTool::TagNames/OOXML Tags>,
L<Image::ExifTool::TagNames/FlashPix Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
| 33.980488 | 115 | 0.529788 |
ed2554d09b46337648023d265a7e6abc1390b028 | 885 | pm | Perl | modules/EnsEMBL/Web/DOM/Node/Element/Input/Hidden.pm | nakib103/ensembl-webcode | 4814ccb25ff9925d80b71514c72793917614c614 | [
"Apache-2.0"
]
| 16 | 2015-01-14T14:12:30.000Z | 2021-01-27T15:28:52.000Z | modules/EnsEMBL/Web/DOM/Node/Element/Input/Hidden.pm | nakib103/ensembl-webcode | 4814ccb25ff9925d80b71514c72793917614c614 | [
"Apache-2.0"
]
| 250 | 2015-01-05T13:03:19.000Z | 2022-03-30T09:07:12.000Z | modules/EnsEMBL/Web/DOM/Node/Element/Input/Hidden.pm | nakib103/ensembl-webcode | 4814ccb25ff9925d80b71514c72793917614c614 | [
"Apache-2.0"
]
| 98 | 2015-01-05T14:58:48.000Z | 2022-02-15T17:11:32.000Z | =head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2021] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
package EnsEMBL::Web::DOM::Node::Element::Input::Hidden;
use strict;
use base qw(EnsEMBL::Web::DOM::Node::Element::Input);
use constant {
TYPE_ATTRIB => 'hidden',
};
1; | 29.5 | 100 | 0.776271 |
ed46fec1a796a5b58ac6df3660d3ce6dec815e5d | 2,296 | pm | Perl | auto-lib/Paws/Robomaker/UpdateSimulationApplicationResponse.pm | meis/aws-sdk-perl | 6d61ffcf351e446f06d7e84e53caa08d98573959 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/Robomaker/UpdateSimulationApplicationResponse.pm | meis/aws-sdk-perl | 6d61ffcf351e446f06d7e84e53caa08d98573959 | [
"Apache-2.0"
]
| 1 | 2021-05-26T19:13:58.000Z | 2021-05-26T19:13:58.000Z | auto-lib/Paws/Robomaker/UpdateSimulationApplicationResponse.pm | meis/aws-sdk-perl | 6d61ffcf351e446f06d7e84e53caa08d98573959 | [
"Apache-2.0"
]
| null | null | null |
package Paws::Robomaker::UpdateSimulationApplicationResponse;
use Moose;
has Arn => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'arn');
has LastUpdatedAt => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'lastUpdatedAt');
has Name => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'name');
has RenderingEngine => (is => 'ro', isa => 'Paws::Robomaker::RenderingEngine', traits => ['NameInRequest'], request_name => 'renderingEngine');
has RevisionId => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'revisionId');
has RobotSoftwareSuite => (is => 'ro', isa => 'Paws::Robomaker::RobotSoftwareSuite', traits => ['NameInRequest'], request_name => 'robotSoftwareSuite');
has SimulationSoftwareSuite => (is => 'ro', isa => 'Paws::Robomaker::SimulationSoftwareSuite', traits => ['NameInRequest'], request_name => 'simulationSoftwareSuite');
has Sources => (is => 'ro', isa => 'ArrayRef[Paws::Robomaker::Source]', traits => ['NameInRequest'], request_name => 'sources');
has Version => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'version');
has _request_id => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Robomaker::UpdateSimulationApplicationResponse
=head1 ATTRIBUTES
=head2 Arn => Str
The Amazon Resource Name (ARN) of the updated simulation application.
=head2 LastUpdatedAt => Str
The time, in milliseconds since the epoch, when the simulation
application was last updated.
=head2 Name => Str
The name of the simulation application.
=head2 RenderingEngine => L<Paws::Robomaker::RenderingEngine>
The rendering engine for the simulation application.
=head2 RevisionId => Str
The revision id of the simulation application.
=head2 RobotSoftwareSuite => L<Paws::Robomaker::RobotSoftwareSuite>
Information about the robot software suite.
=head2 SimulationSoftwareSuite => L<Paws::Robomaker::SimulationSoftwareSuite>
The simulation software suite used by the simulation application.
=head2 Sources => ArrayRef[L<Paws::Robomaker::Source>]
The sources of the simulation application.
=head2 Version => Str
The version of the robot application.
=head2 _request_id => Str
=cut
| 29.818182 | 169 | 0.700784 |
73f9227a3d49866fbc7438fc1b45c7d2fad03e36 | 287 | pm | Perl | perl/vendor/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm | ifleeyo180/VspriteMoodleWebsite | 38baa924829c83808d2c87d44740ff365927a646 | [
"Apache-2.0"
]
| 2 | 2021-11-19T22:37:28.000Z | 2021-11-22T18:04:55.000Z | perl/vendor/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm | ifleeyo180/VspriteMoodleWebsite | 38baa924829c83808d2c87d44740ff365927a646 | [
"Apache-2.0"
]
| 6 | 2021-11-18T00:39:48.000Z | 2021-11-20T00:31:40.000Z | perl/vendor/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm | ifleeyo180/VspriteMoodleWebsite | 38baa924829c83808d2c87d44740ff365927a646 | [
"Apache-2.0"
]
| null | null | null | package Moose::Exception::TypeParameterMustBeMooseMetaType;
our $VERSION = '2.2014';
use Moose;
extends 'Moose::Exception';
with 'Moose::Exception::Role::TypeConstraint';
sub _build_message {
"The type parameter must be a Moose meta type";
}
__PACKAGE__->meta->make_immutable;
1;
| 20.5 | 59 | 0.752613 |
ed2296d991f595332989cbefe6621edf49bff988 | 2,280 | al | Perl | benchmark/benchmarks/FASP-benchmarks/data/planar-triangulations/triangulation-0169-170-504.al | krzysg/FaspHeuristic | 1929c40e3fbc49e68b04acfc5522539a18758031 | [
"MIT"
]
| null | null | null | benchmark/benchmarks/FASP-benchmarks/data/planar-triangulations/triangulation-0169-170-504.al | krzysg/FaspHeuristic | 1929c40e3fbc49e68b04acfc5522539a18758031 | [
"MIT"
]
| null | null | null | benchmark/benchmarks/FASP-benchmarks/data/planar-triangulations/triangulation-0169-170-504.al | krzysg/FaspHeuristic | 1929c40e3fbc49e68b04acfc5522539a18758031 | [
"MIT"
]
| null | null | null | 1 21 109 153 155
2 76 91
3 31 105 124
4 17 80 85 127 168
5 35 85 168 169
6 23 27 54 136
7 9
8 10 56 130
9 55
10 53 72 120
11 51 82 99
12 2 88 133 147
13 100 142
14 61 146 158
15 73
16 108 146 150 165
17 80 160
18 37 148
19 67 93 166
20 64 103 117 140
21 84
22 3 14 34 105 124 134 146
23 54 126
24 15 43 85
25 32 41 71 129
26 1 49 123 142 155
27 54 133 150
28 75 139 143 161
29 5 18 46 96
30 24 39 43 60 85 96
31 61 124 139
32 62 151
33 38 122 158
34 16 98 134 146
35 37 152 169
36 28 43
37 5 29 132
38 158 170
39 83
40 27 42 150
41
42 108
43 60 159
44 20 79 88 103 117
45 3 13 31 75 105 157
46 5
47 8 9 55
48 104 120
49 94 109
50 79 111
51 69 82 119 132 163
52 82 138
53 22 105 134
54 12 88 133
55 26 49 94 123
56 7 9 47 101
57 11 82 111 115 137
58 38 164
59 14 146 165
60 68 83
61 122 139 158
62 11 51 69
63 49 69 77 109 135
64 103 121 137
65 11 32 62 99
66 78 81 86 104
67 58 164 170
68 21
69 112 135 151
70 23 44 167
71 41 104 125
72 107 120 150 162
73 160
74 13 21 84 116
75 13 31 139 143
76 93 118 166
77 7 9 55 69 94
78 48 81
79 128
80 15 73 160
81 48
82 163
83 30 68 69 87 112 135
84 13 60 68 100 143 159
85 15 46 80 96 168
86 44 70 89 131
87 18 39
88 23 70 117
89 66 71 104 131
90 35 138 152
91 40 42 76
92 50 79 111 154
93 91 144 166
94 63
95 2 76 118 147
96 18 46 148
97 15 67 73 166
98 10 72 134 150
99 32 129
100 143
101
102 108 158 164 165
103 50 79
104 81 101 125
105 157
106 35 37 52 82 163
107 6 48 78 136 162
108 40 141 145
109 21 26 135
110 64 90 115 137 140
111 11 99
112 18 51 87
113 8 56 101 104
114 13 75 100
115 52 82
116 13 21 142 153 155
117 12
118 166
119 106 132
120 8 162
121 20 110
122 139
123 8 47
124 14 61
125 7 41 56 101
126 70
127 90 118 156 168
128 25 44 71 89 154
129 32 92 111 128
130 10 123 142
131 44 128
132 18 106 112
133 2 40 91
134 10
135 21 68
136 23 66 78 86
137 50 103 111 115
138 35 106 110 115
139 33
140 90 117 121 147 156
141 19 42 93
142 45 123 155
143 114
144 42 91 141
145 19 102 141
146
147 2 117 156
148 30 39 87
149 8 48 104 113 120
150 6 34 107 108
151 7 25 41 62 77 125
152 127
153 21
154 79 129
155 153
156 90 95 118
157 10 53 130 142
158 59 122 164
159 28 36 60 143
160 4 118 127
161 24 36 43 139
162 48
163 119
164 19 38 145
165 108 146 158
166 67 73 160
167 23 86 126 136
168 169
169 127 152
170 15 24 33 58 97 139 161 | 13.411765 | 26 | 0.704825 |
73e53d039df17295266c6a5b5fdd16bd97a47529 | 301 | pm | Perl | lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm | cv-library/Moose | 7d6242635c5700b2c28142778e959a6379e1ed3f | [
"Artistic-1.0"
]
| 2 | 2021-10-20T00:25:39.000Z | 2021-11-08T12:52:42.000Z | external/win_perl/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm | Brute-f0rce/l0phtcrack | 25f681c07828e5e68e0dd788d84cc13c154aed3d | [
"Apache-2.0",
"MIT"
]
| null | null | null | external/win_perl/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm | Brute-f0rce/l0phtcrack | 25f681c07828e5e68e0dd788d84cc13c154aed3d | [
"Apache-2.0",
"MIT"
]
| 1 | 2022-03-14T06:41:16.000Z | 2022-03-14T06:41:16.000Z | package Moose::Exception::CreateMOPClassTakesArrayRefOfSuperclasses;
our $VERSION = '2.2009';
use Moose;
extends 'Moose::Exception';
with 'Moose::Exception::Role::RoleForCreateMOPClass';
sub _build_message {
"You must pass an ARRAY ref of superclasses";
}
__PACKAGE__->meta->make_immutable;
1;
| 21.5 | 68 | 0.767442 |
73eb0950df8a63da1e17a323f147fb09f2b05624 | 22,160 | t | Perl | t/plugin/form/bootstrap4.t | kiwiroy/Yancy | 42111830eccb514f5dbacba2fb6b358d79bf1860 | [
"Artistic-1.0"
]
| null | null | null | t/plugin/form/bootstrap4.t | kiwiroy/Yancy | 42111830eccb514f5dbacba2fb6b358d79bf1860 | [
"Artistic-1.0"
]
| null | null | null | t/plugin/form/bootstrap4.t | kiwiroy/Yancy | 42111830eccb514f5dbacba2fb6b358d79bf1860 | [
"Artistic-1.0"
]
| null | null | null |
=head1 DESCRIPTION
Tests the Bootstrap 4 form plugin methods.
=head1 SEE ALSO
L<Yancy::Plugin::Form::Bootstrap4>, L<Yancy::Plugin::Form>
=cut
use Mojo::Base '-strict';
use Test::More;
use Test::Mojo;
use Mojo::DOM;
use Mojo::File qw( path );
use FindBin qw( $Bin );
use lib "".path( $Bin, '..', '..', 'lib' );
use Local::Test qw( init_backend );
my $schema = \%Yancy::Backend::Test::SCHEMA;
my ( $backend_url, $backend, %items ) = init_backend(
$schema,
);
my $t = Test::Mojo->new( 'Yancy', {
backend => $backend_url,
schema => $schema,
read_schema => 1,
} );
# We must still set the envvar so Test::Mojo doesn't reset it to "fatal"
$t->app->log->level( $ENV{MOJO_LOG_LEVEL} = 'warn' );
$t->app->yancy->plugin( 'Form::Bootstrap4' );
my $c = $t->app->build_controller;
$c->tx->remote_address( '127.0.0.1' ); # Form uses this to detect a real request
my $plugin = $c->yancy->form;
subtest 'input' => sub {
subtest 'name is required' => sub {
eval { $plugin->input() };
ok $@, 'input() method died';
like $@, qr{input name is required}, 'error message is correct';
};
subtest 'basic string field' => sub {
my $html = $plugin->input( name => 'username', value => 'preaction' );
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'type' ), 'text',
'string field default type attr is correct';
is $field->attr( 'name' ), 'username',
'string field name attr is correct';
is $field->attr( 'value' ), 'preaction',
'string field value attr is correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
subtest 'readonly' => sub {
my $html = $plugin->input( name => 'id', readOnly => 1, value => 45 );
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'p', 'readonly string field tag correct';
is $field->text, 45, 'readonly string field text is value';
};
};
subtest 'append classes' => sub {
my $html = $plugin->input(
name => 'username',
class => 'my-class',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'name' ), 'username',
'string field name attr is correct';
is $field->attr( 'class' ), 'form-control my-class',
'bootstrap class is correct';
};
subtest 'email' => sub {
my $html = $plugin->input(
name => 'email',
format => 'email',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'name' ), 'email',
'string field name attr is correct';
is $field->attr( 'type' ), 'email',
'string field type attr correct';
is $field->attr( 'inputmode' ), 'email',
'string field inputmode attr correct';
is $field->attr( 'pattern' ), '[^@]+@[^@]+',
'string field pattern attr correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
};
subtest 'password' => sub {
my $html = $plugin->input(
name => 'password',
format => 'password',
value => 'mypassword',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'name' ), 'password',
'string field name attr is correct';
is $field->attr( 'value' ), undef,
'password field value attr is not set';
is $field->attr( 'type' ), 'password',
'string field type attr correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
};
subtest 'date-time' => sub {
my $html = $plugin->input(
name => 'created',
format => 'date-time',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'name' ), 'created',
'string field name attr is correct';
is $field->attr( 'type' ), 'datetime-local',
'string field type attr correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
};
subtest 'number' => sub {
my $html = $plugin->input(
name => 'height',
type => 'number',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'name' ), 'height',
'string field name attr is correct';
is $field->attr( 'type' ), 'number',
'string field type attr correct';
is $field->attr( 'inputmode' ), 'decimal',
'string field inputmode attr correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
};
subtest 'integer' => sub {
my $html = $plugin->input(
name => 'age',
type => 'integer',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'input', 'string field tag correct';
is $field->attr( 'name' ), 'age',
'string field name attr is correct';
is $field->attr( 'type' ), 'number',
'string field type attr correct';
is $field->attr( 'pattern' ), '[0-9]*',
'string field pattern attr correct';
is $field->attr( 'inputmode' ), 'numeric',
'string field inputmode attr correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
};
subtest 'textarea' => sub {
my $html = $plugin->input(
name => 'description',
format => 'textarea',
value => "my text\non multiple lines",
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'textarea', 'textarea field tag correct';
is $field->attr( 'name' ), 'description',
'string field name attr is correct';
is $field->text, "my text\non multiple lines",
'textarea value is correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
subtest 'class' => sub {
my $html = $plugin->input(
name => 'description',
format => 'textarea',
class => 'foo',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'textarea', 'textarea field tag correct';
is $field->attr( 'class' ), 'form-control foo',
'bootstrap class is correct and has our custom class';
};
subtest 'disabled' => sub {
my $html = $plugin->input(
name => 'description',
format => 'textarea',
disabled => 1,
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'textarea', 'textarea field tag correct';
ok $field->attr( 'disabled' ), 'disabled attribute is present';
};
subtest 'readonly' => sub {
my $html = $plugin->input(
name => 'description',
format => 'textarea',
readonly => 1,
value => "Text\nArea",
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'p', 'readonly textarea field tag correct';
is $field->text, "Text\nArea", 'readonly textarea value is correct';
};
};
subtest 'enum' => sub {
my $html = $plugin->input(
name => 'varname',
type => 'string',
enum => [qw( foo bar baz )],
value => 'bar',
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'select', 'enum field tag correct';
is $field->attr( 'name' ), 'varname',
'select field name attr is correct';
is $field->attr( 'class' ), 'custom-select',
'bootstrap class is correct';
my @option_texts = $field->children->map( 'text' )->each;
is_deeply \@option_texts, [qw( foo bar baz )],
'option texts are correct';
ok my $selected_option = $field->at( 'option[selected=selected]' ),
'selected option exists';
is $selected_option->text, 'bar',
'selected option text is correct';
subtest 'readonly' => sub {
my $html = $plugin->input(
name => 'varname',
type => 'string',
value => 'bar',
enum => [qw( foo bar baz )],
readOnly => 1,
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'p', 'readonly select field tag correct';
is $field->text, 'bar', 'readonly select field value correct';
};
};
subtest 'boolean' => sub {
my $html = $plugin->input(
type => 'boolean',
name => 'myname',
value => 0,
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'div', 'boolean field tag correct';
is $field->attr( 'class' ), 'btn-group yes-no',
'bootstrap class is correct';
my @labels = $field->children->each;
is $labels[0]->tag, 'label', 'label tag (Yes) is correct';
like $labels[0]->text, qr{^\s*Yes\s*$}, 'label text (Yes) is correct';
is $labels[1]->tag, 'label', 'label tag (No) is correct';
like $labels[1]->text, qr{^\s*No\s*$}, 'label text (No) is correct';
is $labels[0]->children->[0]->tag, 'input', 'input tag (Yes) is correct';
is $labels[1]->children->[0]->tag, 'input', 'input tag (No) is correct';
is $labels[0]->children->[0]->attr( 'name' ), 'myname',
'input name attr (Yes) is correct';
is $labels[1]->children->[0]->attr( 'name' ), 'myname',
'input name attr (No) is correct';
is $labels[0]->children->[0]->attr( 'value' ), '1',
'input value attr (Yes) is correct';
is $labels[1]->children->[0]->attr( 'value' ), '0',
'input value attr (No) is correct';
ok !$labels[0]->children->[0]->attr( 'selected' ),
'input is not selected (Yes)';
is $labels[1]->children->[0]->attr( 'selected' ), 'selected',
'input is selected (No)';
subtest 'readonly' => sub {
my $html = $plugin->input(
type => 'boolean',
name => 'myname',
value => 0,
readOnly => 1,
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'p', 'readonly tag is correct';
is $field->text, 'No', 'false is "No"';
};
};
subtest 'markdown' => sub {
my $html = $plugin->input(
name => 'bio',
format => 'markdown',
value => "my text\non *multiple* lines",
);
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->tag, 'textarea', 'textarea field tag correct';
is $field->attr( 'name' ), 'bio',
'string field name attr is correct';
is $field->text, "my text\non *multiple* lines",
'markdown value is correct';
is $field->attr( 'class' ), 'form-control',
'bootstrap class is correct';
};
};
subtest 'field_for' => sub {
subtest 'basic string field' => sub {
my $html = $plugin->field_for( user => 'age', value => '42' );
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
is $field->attr( 'class' ), 'form-group', 'field class correct';
ok my $label = $dom->at( 'label' ), 'label exists';
ok $label->attr( 'for' ), 'label has for attribute';
is $label->text, 'age', 'label text is field name';
ok my $input = $dom->at( 'input' ), 'input exists';
is $input->attr( 'id' ), $label->attr( 'for' ), 'input id matches label for';
is $input->attr( 'name' ), 'age', 'input name correct';
is $input->attr( 'value' ), '42', 'input value correct';
ok my $desc = $dom->at( '.form-group .form-text' ), 'description exists';
is $desc->text, 'The person\'s age',
'description text is correct';
};
subtest 'readonly field' => sub {
my $html = $plugin->field_for( user => 'id', value => 1 );
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
ok my $input = $dom->at( 'p[data-name=id]' ), 'paragraph exists';
is $input->text, 1, 'paragraph text correct';
};
subtest 'required field with title and pattern' => sub {
my $html = $plugin->field_for( user => 'email' );
my $dom = Mojo::DOM->new( $html );
my $field = $dom->children->[0];
ok my $label = $dom->at( 'label' ), 'label exists';
is $label->text, 'E-mail Address *',
'label text is field title with required marker';
ok my $input = $dom->at( 'input' ), 'input exists';
is $input->attr( 'name' ), 'email', 'input name correct';
is $input->attr( 'pattern' ),
$schema->{user}{properties}{email}{pattern},
'input pattern matches schema config';
};
subtest 'class goes to input' => sub {
my $html = $plugin->field_for( user => 'name', class => 'foo' );
my $dom = Mojo::DOM->new( $html );
ok my $input = $dom->at( 'input' ), 'input exists';
like $input->attr( 'class' ), qr{\bfoo\b}, 'input class contains string';
};
};
subtest 'form_for' => sub {
my %item = (
id => 1,
email => 'doug@example.com',
password => 'sdfsdfsdfsdf',
access => 'user',
username => 'preaction',
age => 35,
plugin => 'password',
);
my $html = $plugin->form_for( 'user', item => \%item );
#; diag $html;
my $dom = Mojo::DOM->new( $html );
my $form = $dom->children->[0];
subtest 'form attribute defaults' => sub {
is $form->attr( 'method' ), 'POST', 'default method is "POST"';
ok !$form->attr( 'action' ), 'action is not set';
ok !$form->attr( 'id' ), 'id is not set';
};
subtest 'form fields' => sub {
my $fields = $dom->find( '.form-group' );
is $fields->size, 8, 'found 8 fields';
#; diag $fields->each;
my $labels = $fields->map( at => 'label' )->grep( sub { defined } );
is $labels->size, 8, 'found 8 labels';
#; diag $labels->each;
is_deeply [ $labels->map( 'text' )->each ],
[ 'username *', 'E-mail Address *', 'password *', 'access', 'age', 'plugin', 'avatar', 'created' ],
'label texts in correct order';
my $inputs = $fields->map( at => 'input,select,textarea' )->grep( sub { defined } );
is $inputs->size, 8, 'found 8 inputs';
is_deeply [ $inputs->map( attr => 'name' )->each ],
[ 'username', 'email', 'password', 'access', 'age', 'plugin', 'avatar', 'created' ],
'input names in correct order';
my $email_input = $dom->at( 'input[name=email]' );
is $email_input->attr( 'type' ), 'email',
'email field type is correct';
is $email_input->attr( 'value' ), $item{ email },
'email field value is correct';
my $username_input = $dom->at( 'input[name=username]' );
is $username_input->attr( 'value' ), $item{ username },
'username field value is correct';
my $password_input = $dom->at( 'input[name=password]' );
is $password_input->attr( 'value' ), undef,
'password field value is not set to avoid security issues';
my $access_input = $dom->at( 'select[name=access]' );
ok my $selected_option = $access_input->at( 'option[selected]' ),
'access select field has selected option';
is $selected_option->text, 'user', 'selected option value is correct';
};
subtest 'hidden csrf field' => sub {
ok my $csrf_field = $dom->at( '[name=csrf_token]' ), 'crsf token field exists';
is $csrf_field->attr( 'value' ), $c->csrf_token, 'crsf token value correct';
};
subtest 'buttons' => sub {
ok my $button = $dom->at( 'button' ), 'button exists';
is $button->text, 'Submit', 'button text is correct';
};
subtest 'set form element attributes' => sub {
my $html = $plugin->form_for( 'user',
action => '/user/1',
method => 'POST',
);
my $dom = Mojo::DOM->new( $html );
my $form = $dom->children->[0];
is $form->attr( 'method' ), 'POST', 'method is set from args';
is $form->attr( 'action' ), '/user/1', 'action is set from args';
};
subtest 'default item from stash' => sub {
my $c = $t->app->build_controller;
$c->tx->remote_address( '127.0.0.1' );
$c->stash( item => \%item );
my $html = $c->yancy->form->form_for( 'user' );
#; diag $html;
my $dom = Mojo::DOM->new( $html );
my $form = $dom->children->[0];
my $fields = $dom->find( '.form-group' );
is $fields->size, 8, 'found 8 fields';
my $labels = $fields->map( at => 'label' )->grep( sub { defined } );
is $labels->size, 8, 'found 8 labels';
my $inputs = $fields->map( at => 'input,select,textarea' )->grep( sub { defined } );
is $inputs->size, 8, 'found 8 inputs';
my $email_input = $dom->at( 'input[name=email]' );
is $email_input->attr( 'type' ), 'email',
'email field type is correct';
is $email_input->attr( 'value' ), $item{ email },
'email field value is correct';
};
subtest 'form_for properties option' => sub {
my $html = $plugin->form_for( 'user', item => \%item, properties => [qw/email password username age/] );
my $dom = Mojo::DOM->new($html);
my $form = $dom->children->[0];
is $dom->at('input[name=id]'), undef;
is $dom->at('input[name=access]'), undef;
is $dom->at('input[name=plugin]'), undef;
ok $dom->at('input[name=email]');
ok $dom->at('input[name=password]');
ok $dom->at('input[name=username]');
ok $dom->at('input[name=age]');
subtest 'default from stash' => sub {
my $c = $t->app->build_controller;
$c->tx->remote_address( '127.0.0.1' );
$c->stash(
item => \%item,
properties => [qw/email password username age/],
);
my $html = $c->yancy->form->form_for( 'user' );
my $dom = Mojo::DOM->new($html);
my $form = $dom->children->[0];
is $dom->at('input[name=id]'), undef;
is $dom->at('input[name=access]'), undef;
is $dom->at('input[name=plugin]'), undef;
ok $dom->at('input[name=email]');
ok $dom->at('input[name=password]');
ok $dom->at('input[name=username]');
ok $dom->at('input[name=age]');
};
};
subtest 'set values from current request params' => sub {
my $c = $t->app->build_controller;
$c->tx->remote_address( '127.0.0.1' );
$c->stash( item => \%item );
$c->req->param( email => 'override@example.com' );
my $html = $c->yancy->form->form_for( 'user' );
#; diag $html;
my $dom = Mojo::DOM->new( $html );
my $form = $dom->children->[0];
my $fields = $dom->find( '.form-group' );
is $fields->size, 8, 'found 8 fields';
my $labels = $fields->map( at => 'label' )->grep( sub { defined } );
is $labels->size, 8, 'found 8 labels';
my $inputs = $fields->map( at => 'input,select,textarea' )->grep( sub { defined } );
is $inputs->size, 8, 'found 8 inputs';
my $email_input = $dom->at( 'input[name=email]' );
is $email_input->attr( 'type' ), 'email',
'email field type is correct';
is $email_input->attr( 'value' ), 'override@example.com',
'email field value is set from query param';
};
subtest 'CSRF disabled' => sub {
my $html = $plugin->form_for( 'user', csrf => 0 );
my $dom = Mojo::DOM->new( $html );
ok !$dom->at( '[name=csrf_token]' ), 'csrf => 0 disabled CSRF token';
};
subtest 'CSRF requires a real request' => sub {
my $html = $t->app->yancy->form->form_for( 'user' );
my $dom = Mojo::DOM->new( $html );
ok $dom->at( '[name=csrf_token]' ), 'CSRF token exists';
ok !!(
grep { $_->[3] =~ /form_for\(\) called with incomplete/ }
@{ $t->app->log->history }
), 'message about CSRF not validating is logged'
or diag explain [ grep { $_->[1] eq 'warn' } @{ $t->app->log->history } ];
};
};
subtest 'default form plugin' => sub {
my $t = Test::Mojo->new( 'Yancy', {
backend => $backend_url,
schema => $schema,
read_schema => 1,
} );
ok +( grep { /Yancy::Plugin::Form::Bootstrap4/ }
@{ $t->app->renderer->classes }
), 'app renderer has bootstrap4 class';
};
done_testing;
| 38.472222 | 112 | 0.504603 |
ed10695692be3d08e56493b425d03d79ca69b848 | 21,815 | pm | Perl | main/solenv/bin/modules/installer/windows/property.pm | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
]
| 679 | 2015-01-06T06:34:58.000Z | 2022-03-30T01:06:03.000Z | main/solenv/bin/modules/installer/windows/property.pm | ackza/openoffice | d49dfe9c625750e261c7ed8d6ccac8d361bf3418 | [
"Apache-2.0"
]
| 102 | 2017-11-07T08:51:31.000Z | 2022-03-17T12:13:49.000Z | main/solenv/bin/modules/installer/windows/property.pm | ackza/openoffice | d49dfe9c625750e261c7ed8d6ccac8d361bf3418 | [
"Apache-2.0"
]
| 331 | 2015-01-06T11:40:55.000Z | 2022-03-14T04:07:51.000Z | #**************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#**************************************************************
package installer::windows::property;
use installer::exiter;
use installer::files;
use installer::globals;
use installer::windows::idtglobal;
use installer::windows::language;
#############################################
# Setting the properties dynamically
# for the table Property.idt
#############################################
sub get_arpcomments_for_property_table
{
my ( $allvariables, $languagestringref ) = @_;
my $name = $allvariables->{'PRODUCTNAME'};
my $version = $allvariables->{'PRODUCTVERSION'};
my $comment = $name . " " . $version;
my $postversionextension = "";
if ( $allvariables->{'POSTVERSIONEXTENSION'} )
{
$postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
$comment = $comment . " " . $postversionextension;
}
if ( $installer::globals::languagepack ) { $comment = $comment . " " . "Language Pack"; }
if ( $installer::globals::patch )
{
if ( ! $allvariables->{'WINDOWSPATCHLEVEL'} ) { installer::exiter::exit_program("ERROR: No Patch level defined for Windows patch: WINDOWSPATCHLEVEL", "get_arpcomments_for_property_table"); }
my $patchstring = "Product Update" . " " . $allvariables->{'WINDOWSPATCHLEVEL'};
$comment = $comment . " " . $patchstring;
}
my $languagestring = $$languagestringref;
$languagestring =~ s/\_/\,/g;
$comment = $comment . " ($languagestring)";
my $localminor = "";
if ( $installer::globals::updatepack ) { $localminor = $installer::globals::lastminor; }
else { $localminor = $installer::globals::minor; }
my $buildidstring = "(" . $installer::globals::build . $localminor . "(Build:" . $installer::globals::buildid . "))";
# the environment variable CWS_WORK_STAMP is set only in CWS
if ( $ENV{'CWS_WORK_STAMP'} ) { $buildidstring = $buildidstring . "\[CWS\:" . $ENV{'CWS_WORK_STAMP'} . "\]"; }
$comment = $comment . " " . $buildidstring;
return $comment;
}
sub get_installlevel_for_property_table
{
my $installlevel = "100";
return $installlevel;
}
sub get_ischeckforproductupdates_for_property_table
{
my $ischeckforproductupdates = "1";
return $ischeckforproductupdates;
}
sub get_manufacturer_for_property_table
{
return $installer::globals::manufacturer;
}
sub get_productlanguage_for_property_table
{
my ($language) = @_;
my $windowslanguage = installer::windows::language::get_windows_language($language);
return $windowslanguage;
}
sub get_language_string
{
my $langstring = "";
for ( my $i = 0; $i <= $#installer::globals::languagenames; $i++ )
{
$langstring = $langstring . $installer::globals::languagenames[$i] . ", ";
}
$langstring =~ s/\,\s*$//;
$langstring = "(" . $langstring . ")";
return $langstring;
}
sub get_english_language_string
{
my $langstring = "";
# Sorting value not keys, therefore collecting all values
my %helper = ();
foreach my $lang ( keys %installer::globals::all_required_english_languagestrings )
{
$helper{$installer::globals::all_required_english_languagestrings{$lang}} = 1;
}
foreach my $lang ( sort keys %helper )
{
$langstring = $langstring . $lang . ", ";
}
$langstring =~ s/\,\s*$//;
$langstring = "(" . $langstring . ")";
return $langstring;
}
sub get_productname_for_property_table
{
my ( $allvariables ) = @_;
my $name = $allvariables->{'PRODUCTNAME'};
my $version = $allvariables->{'PRODUCTVERSION'};
my $productname = $name . " " . $version;
my $postversionextension = "";
if ( $allvariables->{'POSTVERSIONEXTENSION'} )
{
$postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
$productname = $productname . " " . $postversionextension;
}
my $productextension = "";
if ( $allvariables->{'PRODUCTEXTENSION'} )
{
$productextension = $allvariables->{'PRODUCTEXTENSION'};
$productname = $productname . " " . $productextension;
}
if ( $installer::globals::languagepack )
{
# my $langstring = get_language_string(); # Example (English, Deutsch)
my $langstring = get_english_language_string(); # New: (English, German)
$productname = $name . " " . $version . " Language Pack" . " " . $langstring;
}
if ( $installer::globals::patch )
{
if ( ! $allvariables->{'WINDOWSPATCHLEVEL'} ) { installer::exiter::exit_program("ERROR: No Patch level defined for Windows patch: WINDOWSPATCHLEVEL", "get_productname_for_property_table"); }
my $patchstring = "Product Update" . " " . $allvariables->{'WINDOWSPATCHLEVEL'};
$productname = $productname . " " . $patchstring;
}
# Saving this name in hash $allvariables for further usage
$allvariables->{'PROPERTYTABLEPRODUCTNAME'} = $productname;
my $infoline = "Defined variable PROPERTYTABLEPRODUCTNAME: $productname\n";
$installer::logger::Lang->print($infoline);
return $productname;
}
sub get_quickstarterlinkname_for_property_table
{
my ( $allvariables ) = @_;
# no usage of POSTVERSIONEXTENSION for Quickstarter link name!
my $name = $allvariables->{'PRODUCTNAME'};
my $version = $allvariables->{'PRODUCTVERSION'};
my $quickstartername = $name . " " . $version;
my $infoline = "Defined Quickstarter Link name: $quickstartername\n";
$installer::logger::Lang->print($infoline);
return $quickstartername;
}
sub get_productversion_for_property_table
{
return $installer::globals::msiproductversion;
}
#######################################################
# Setting all feature names as Properties. This is
# required for the Windows patch process.
#######################################################
sub set_featurename_properties_for_patch ($)
{
my ($propertyfile) = @_;
foreach my $feature_gid (keys %installer::globals::featurecollector)
{
push @$propertyfile, $feature_gid . "\t" . "1" . "\n";
}
}
#######################################################
# Setting some important properties
# (for finding the product in deinstallation process)
#######################################################
sub set_important_properties
{
my ($propertyfile, $allvariables, $languagestringref) = @_;
# Setting new variables with the content of %PRODUCTNAME and %PRODUCTVERSION
if ( $allvariables->{'PRODUCTNAME'} )
{
my $onepropertyline = "DEFINEDPRODUCT" . "\t" . $allvariables->{'PRODUCTNAME'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTVERSION'} )
{
my $onepropertyline = "DEFINEDVERSION" . "\t" . $allvariables->{'PRODUCTVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if (( $allvariables->{'PRODUCTNAME'} ) && ( $allvariables->{'PRODUCTVERSION'} ) && ( $allvariables->{'MANUFACTURER'} ) && ( $allvariables->{'PRODUCTCODE'} ))
{
my $onepropertyline = "FINDPRODUCT" . "\t" . "Software\\" . $allvariables->{'MANUFACTURER'} . "\\" . $allvariables->{'PRODUCTNAME'} . $allvariables->{'PRODUCTADDON'} . "\\" . $allvariables->{'PRODUCTVERSION'} . "\\" . $allvariables->{'PRODUCTCODE'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTMAJOR'} )
{
my $onepropertyline = "PRODUCTMAJOR" . "\t" . $allvariables->{'PRODUCTMAJOR'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTMINOR'} )
{
my $onepropertyline = "PRODUCTMINOR" . "\t" . $allvariables->{'PRODUCTMINOR'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTBUILDID'} )
{
my $onepropertyline = "PRODUCTBUILDID" . "\t" . $allvariables->{'PRODUCTBUILDID'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'OOOBASEVERSION'} )
{
my $onepropertyline = "OOOBASEVERSION" . "\t" . $allvariables->{'OOOBASEVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'URELAYERVERSION'} )
{
my $onepropertyline = "URELAYERVERSION" . "\t" . $allvariables->{'URELAYERVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'BRANDPACKAGEVERSION'} )
{
my $onepropertyline = "BRANDPACKAGEVERSION" . "\t" . $allvariables->{'BRANDPACKAGEVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'BASISROOTNAME'} )
{
my $onepropertyline = "BASISROOTNAME" . "\t" . $allvariables->{'BASISROOTNAME'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'EXCLUDE_FROM_REBASE'} )
{
my $onepropertyline = "EXCLUDE_FROM_REBASE" . "\t" . $allvariables->{'EXCLUDE_FROM_REBASE'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PREREQUIREDPATCH'} )
{
my $onepropertyline = "PREREQUIREDPATCH" . "\t" . $allvariables->{'PREREQUIREDPATCH'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
my $onepropertyline = "IGNOREPREREQUIREDPATCH" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
$onepropertyline = "DONTOPTIMIZELIBS" . "\t" . "0" . "\n";
push(@{$propertyfile}, $onepropertyline);
if ( $installer::globals::officedirhostname )
{
my $onepropertyline = "OFFICEDIRHOSTNAME" . "\t" . $installer::globals::officedirhostname . "\n";
push(@{$propertyfile}, $onepropertyline);
my $localofficedirhostname = $installer::globals::officedirhostname;
$localofficedirhostname =~ s/\//\\/g;
$onepropertyline = "OFFICEDIRHOSTNAME_" . "\t" . $localofficedirhostname . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $installer::globals::desktoplinkexists )
{
my $onepropertyline = "DESKTOPLINKEXISTS" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
$onepropertyline = "CREATEDESKTOPLINK" . "\t" . "1" . "\n"; # Setting the default
push(@{$propertyfile}, $onepropertyline);
}
if ( $installer::globals::patch )
{
my $onepropertyline = "ISPATCH" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
$onepropertyline = "SETUP_USED" . "\t" . "0" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $installer::globals::languagepack )
{
my $onepropertyline = "ISLANGUAGEPACK" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
my $languagesline = "PRODUCTALLLANGUAGES" . "\t" . $$languagestringref . "\n";
push(@{$propertyfile}, $languagesline);
if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
{
# my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
# push(@{$propertyfile}, $registryline);
my $betainfoline = "BETAPRODUCT" . "\t" . "1" . "\n";
push(@{$propertyfile}, $betainfoline);
}
elsif ( $allvariables->{'DEVELOPMENTPRODUCT'} )
{
my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
push(@{$propertyfile}, $registryline);
}
else
{
my $registryline = "WRITE_REGISTRY" . "\t" . "1" . "\n"; # Default: Write complete registry
push(@{$propertyfile}, $registryline);
}
# Adding also used tree conditions for multilayer products.
# These are saved in %installer::globals::usedtreeconditions
foreach my $treecondition (keys %installer::globals::usedtreeconditions)
{
my $onepropertyline = $treecondition . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
# No more license dialog for selected products
if ( $allvariables->{'HIDELICENSEDIALOG'} )
{
my $onepropertyline = "HIDEEULA" . "\t" . "1" . "\n";
my $already_defined = 0;
for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
{
if ( ${$propertyfile}[$i] =~ /^\s*HIDEEULA\t/ )
{
${$propertyfile}[$i] = $onepropertyline;
$already_defined = 1;
last;
}
}
if ( ! $already_defined )
{
push(@{$propertyfile}, $onepropertyline);
}
}
# Setting .NET requirements
if ( $installer::globals::required_dotnet_version ne "" )
{
my $onepropertyline = "REQUIRED_DOTNET_VERSION" . "\t" . $installer::globals::required_dotnet_version . "\n";
push(@{$propertyfile}, $onepropertyline);
$onepropertyline = "DOTNET_SUFFICIENT" . "\t" . "1" . "\n"; # default value for found .NET
push(@{$propertyfile}, $onepropertyline);
}
}
#######################################################
# Setting properties needed for ms file type registration
#######################################################
sub set_ms_file_types_properties
{
my ($propertyfile) = @_;
push(@{$propertyfile}, "REGISTER_PPS" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPSX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPSM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPAM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_POT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_POTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_POTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOC" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOCX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOCM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_RTF" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLS" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLSX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLSM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLSB" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLAM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_NO_MSO_TYPES" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_ALL_MSO_TYPES" . "\t" . "0" . "\n");
}
####################################################################################
# Updating the file Property.idt dynamically
# Content:
# Property Value
####################################################################################
sub update_property_table
{
my ($basedir, $language, $allvariables, $languagestringref) = @_;
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
# Getting the new values
# Some values (arpcomments, arpcontacts, ...) are inserted from the Property.mlf
my $arpcomments = get_arpcomments_for_property_table($allvariables, $languagestringref);
my $installlevel = get_installlevel_for_property_table();
my $ischeckforproductupdates = get_ischeckforproductupdates_for_property_table();
my $manufacturer = $allvariables->{'OOOVENDOR'};
my $productlanguage = get_productlanguage_for_property_table($language);
my $productname = get_productname_for_property_table($allvariables);
my $productversion = get_productversion_for_property_table();
my $quickstarterlinkname = get_quickstarterlinkname_for_property_table($allvariables);
# Updating the values
for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
{
${$propertyfile}[$i] =~ s/\bARPCOMMENTSTEMPLATE\b/$arpcomments/;
${$propertyfile}[$i] =~ s/\bINSTALLLEVELTEMPLATE\b/$installlevel/;
${$propertyfile}[$i] =~ s/\bISCHECKFORPRODUCTUPDATESTEMPLATE\b/$ischeckforproductupdates/;
${$propertyfile}[$i] =~ s/\bMANUFACTURERTEMPLATE\b/$manufacturer/;
${$propertyfile}[$i] =~ s/\bPRODUCTLANGUAGETEMPLATE\b/$productlanguage/;
${$propertyfile}[$i] =~ s/\bPRODUCTNAMETEMPLATE\b/$productname/;
${$propertyfile}[$i] =~ s/\bPRODUCTVERSIONTEMPLATE\b/$productversion/;
${$propertyfile}[$i] =~ s/\bQUICKSTARTERLINKNAMETEMPLATE\b/$quickstarterlinkname/;
}
# Setting variables into propertytable
set_important_properties($propertyfile, $allvariables, $languagestringref);
# Setting feature names as properties for Windows patch mechanism
if ( $installer::globals::patch ) { set_featurename_properties_for_patch($propertyfile); }
# Setting variables for register for ms file types
set_ms_file_types_properties($propertyfile);
# Saving the file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Updated idt file: $properyfilename\n";
$installer::logger::Lang->print($infoline);
}
####################################################################################
# Setting language specific Properties in file Property.idt dynamically
# Adding:
# is1033 = 1
# isMulti = 1
####################################################################################
sub set_languages_in_property_table
{
my ($basedir, $languagesarrayref) = @_;
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
# Setting the component properties saved in %installer::globals::languageproperties
foreach my $localproperty ( keys %installer::globals::languageproperties )
{
$onepropertyline = $localproperty . "\t" . $installer::globals::languageproperties{$localproperty} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
# Setting the info about multilingual installation in property "isMulti"
my $propertyname = "isMulti";
my $ismultivalue = 0;
if ( $installer::globals::ismultilingual ) { $ismultivalue = 1; }
my $onepropertyline = $propertyname . "\t" . $ismultivalue . "\n";
push(@{$propertyfile}, $onepropertyline);
# setting the ARPPRODUCTICON
if ($installer::globals::sofficeiconadded) # set in shortcut.pm
{
$onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.ico" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
# Saving the file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Added language content into idt file: $properyfilename\n";
$installer::logger::Lang->print($infoline);
}
############################################################
# Setting the ProductCode and the UpgradeCode
# into the Property table. Both have to be stored
# in the global file $installer::globals::codefilename
############################################################
sub set_codes_in_property_table
{
my ($basedir) = @_;
# Reading the property file
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
# Updating the values
for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
{
${$propertyfile}[$i] =~ s/\bPRODUCTCODETEMPLATE\b/$installer::globals::productcode/;
${$propertyfile}[$i] =~ s/\bUPGRADECODETEMPLATE\b/$installer::globals::upgradecode/;
}
# Saving the property file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Added language content into idt file: $properyfilename\n";
$installer::logger::Lang->print($infoline);
}
############################################################
# Setting the variable REGKEYPRODPATH, that is used
# by the language packs.
############################################################
sub set_regkeyprodpath_in_property_table
{
my ($basedir, , $allvariables) = @_;
# Reading the property file
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
my $name = $allvariables->{'PRODUCTNAME'};
my $version = $allvariables->{'PRODUCTVERSION'};
my $onepropertyline = "REGKEYPRODPATH" . "\t" . "Software" . "\\" . $installer::globals::manufacturer . "\\". $name;
push(@{$propertyfile}, $onepropertyline);
# Saving the property file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Added language content into idt file: $properyfilename\n";
$installer::logger::Lang->print($infoline);
}
############################################################
# Changing default for MS file type registration
# in Beta products.
############################################################
sub update_checkbox_table
{
my ($basedir, $allvariables) = @_;
if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
{
my $checkboxfilename = $basedir . $installer::globals::separator . "CheckBox.idt";
if ( -f $checkboxfilename )
{
my $checkboxfile = installer::files::read_file($checkboxfilename);
my $checkboxline = "SELECT_WORD" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
$checkboxline = "SELECT_EXCEL" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
$checkboxline = "SELECT_POWERPOINT" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
# Saving the property file
installer::files::save_file($checkboxfilename ,$checkboxfile);
my $infoline = "Added ms file type defaults into idt file: $checkboxfilename\n";
$installer::logger::Lang->print($infoline);
}
}
}
1;
| 33.821705 | 258 | 0.630804 |
73dc103241634ddcc5785dfab47c8b9b9f240d0a | 497 | pl | Perl | verilator-4.016/test_regress/t/t_param_type2.pl | tcovert2015/fpga_competition | 26b7a72959afbf8315eb962ec597ba14b4a73dbd | [
"BSD-3-Clause"
]
| null | null | null | verilator-4.016/test_regress/t/t_param_type2.pl | tcovert2015/fpga_competition | 26b7a72959afbf8315eb962ec597ba14b4a73dbd | [
"BSD-3-Clause"
]
| null | null | null | verilator-4.016/test_regress/t/t_param_type2.pl | tcovert2015/fpga_competition | 26b7a72959afbf8315eb962ec597ba14b4a73dbd | [
"BSD-3-Clause"
]
| null | null | null | #!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(simulator => 1);
compile(
);
#execute(
# check_finished => 1,
# );
ok(1);
1;
| 23.666667 | 84 | 0.694165 |
ed2556cae1214a1d21ea6e069a91d098f8e91dc4 | 4,178 | pl | Perl | Monitor/Messenger/mysql/examples/tests/fork3_test.pl | Jeanmilost/Visual-Mercutio | f079730005b6ce93d5e184bb7c0893ccced3e3ab | [
"MIT"
]
| 1 | 2022-01-31T06:24:24.000Z | 2022-01-31T06:24:24.000Z | Monitor/Messenger/mysql/examples/tests/fork3_test.pl | Jeanmilost/Visual-Mercutio | f079730005b6ce93d5e184bb7c0893ccced3e3ab | [
"MIT"
]
| 2 | 2021-04-11T15:50:42.000Z | 2021-06-05T08:23:04.000Z | Monitor/Messenger/mysql/examples/tests/fork3_test.pl | Jeanmilost/Visual-Mercutio | f079730005b6ce93d5e184bb7c0893ccced3e3ab | [
"MIT"
]
| 2 | 2021-01-08T00:55:18.000Z | 2022-01-31T06:24:18.000Z | #!/my/gnu/bin/perl -w
#
# This is a test with uses 3 processes to insert, delete and select
#
$opt_loop_count=100000; # Change this to make test harder/easier
##################### Standard benchmark inits ##############################
use DBI;
use Getopt::Long;
use Benchmark;
package main;
$opt_skip_create=$opt_skip_in=$opt_verbose=$opt_fast_insert=
$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=0;
$opt_host=""; $opt_db="test";
GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in","skip-delete",
"verbose","fast-insert","lock-tables","debug","fast","force") || die "Aborted";
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
print "Testing 3 multiple connections to a server with 1 insert, 1 delete\n";
print "and 1 select connections.\n";
$firsttable = "bench_f1";
####
#### Start timeing and start test
####
$start_time=new Benchmark;
if (!$opt_skip_create)
{
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$Mysql::QUIET = 1;
$dbh->do("drop table $firsttable");
$Mysql::QUIET = 0;
print "Creating table $firsttable in database $opt_db\n";
$dbh->do("create table $firsttable (id int(6) not null, info varchar(32), marker char(1), primary key(id))") || die $DBI::errstr;
$dbh->disconnect; $dbh=0; # Close handler
}
$|= 1; # Autoflush
####
#### Start the tests
####
test_insert() if (($pid=fork()) == 0); $work{$pid}="insert";
test_delete() if (($pid=fork()) == 0); $work{$pid}="delete";
test_select() if (($pid=fork()) == 0); $work{$pid}="select1";
$errors=0;
while (($pid=wait()) != -1)
{
$ret=$?/256;
print "thread '" . $work{$pid} . "' finnished with exit code $ret\n";
$errors++ if ($ret != 0);
}
if (!$opt_skip_delete && !$errors)
{
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$dbh->do("drop table $firsttable");
$dbh->disconnect; $dbh=0; # Close handler
}
print ($errors ? "Test failed\n" :"Test ok\n");
$end_time=new Benchmark;
print "Total time: " .
timestr(timediff($end_time, $start_time),"noc") . "\n";
exit(0);
#
# Insert records in the table
#
sub test_insert
{
my ($dbh,$i,$sth);
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($i=0 ; $i < $opt_loop_count; $i++)
{
$sth=$dbh->do("insert into $firsttable values ($i,'This is entry $i','')") || die "Got error on insert: $Mysql::db_errstr\n";
$sth=0;
}
$dbh->disconnect; $dbh=0;
print "Test_insert: Inserted $i rows\n";
exit(0);
}
sub test_delete
{
my ($dbh,$i,$sth,@row);
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($i=0 ; $i < $opt_loop_count ; $i++)
{
sleep(5);
if ($opt_lock_tables)
{
$sth=$dbh->do("lock tables $firsttable WRITE") || die "Got error on lock tables $firsttable: $Mysql::db_errstr\n";
}
$sth=$dbh->prepare("select count(*) from $firsttable") || die "Got error on select from $firsttable: $dbh->errstr\n";
$sth->execute || die $dbh->errstr;
if ((@row = $sth->fetchrow_array()))
{
last if (!$row[0]); # Insert thread is probably ready
}
$sth=$dbh->do("delete from $firsttable") || die "Got error on delete from $firsttable: $dbh->errstr;\n";
}
$sth=0;
$dbh->disconnect; $dbh=0;
print "Test_delete: Deleted all rows $i times\n";
exit(0);
}
#
# select records
#
sub test_select
{
my ($dbh,$i,$sth,@row);
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
for ($i=0 ; $i < $opt_loop_count ; $i++)
{
$sth=$dbh->prepare("select count(*) from $firsttable") || die "Got error on select from $firsttable: $dbh->errstr;\n";
$sth->execute || die $dbh->errstr;
@row = $sth->fetchrow_array();
$sth=0;
}
$dbh->disconnect; $dbh=0;
print "Test_select: ok\n";
exit(0);
}
| 27.30719 | 131 | 0.610579 |
ed4e4e4d2db38b2725176c1531a27cf088dda3ef | 4,268 | pl | Perl | makepackage.pl | tandrup/webmin | 0a2eb1d52084b3899f2ff4645cfe0cd4a78f0263 | [
"BSD-3-Clause"
]
| null | null | null | makepackage.pl | tandrup/webmin | 0a2eb1d52084b3899f2ff4645cfe0cd4a78f0263 | [
"BSD-3-Clause"
]
| null | null | null | makepackage.pl | tandrup/webmin | 0a2eb1d52084b3899f2ff4645cfe0cd4a78f0263 | [
"BSD-3-Clause"
]
| null | null | null | #!/usr/bin/perl
# makepackage.pl <version>
# Copy files from some directory to /opt/webmin and build a package
@ARGV || die "usage: makepackage.pl <version> [directory]";
$dir = $ARGV[1] || "/usr/local/webadmin/tarballs/webmin-$ARGV[0]";
$> == 0 || die "makepackage.pl must be run as root";
-r "$dir/version" || die "$dir does not look like a webmin directory";
chop($v = `cat $dir/version`);
print "Copying $dir to /opt/webmin ..\n";
system("rm -rf /opt/webmin");
mkdir("/opt/webmin", 0755);
system("cd $dir ; tar cf - . | (cd /opt/webmin ; tar xf -)");
open(MODE, ">/opt/webmin/install-type");
print MODE "solaris-pkg\n";
close(MODE);
system("chown -R root /opt/webmin");
system("chgrp -R bin /opt/webmin");
system("chmod -R og-rxw /opt/webmin");
print ".. done\n\n";
print "Deleting non-Solaris modules ..\n";
system("cd /opt/webmin ; rm -rf /opt/webmin/{adsl-client,exports,fdisk,firewall,frox,grub,heartbeat,idmapd,ipsec,krb5,lilo,lvm,ppp-client,pptp-client,pptp-server,raid,shorewall,smart-status,vgetty,ldap-client,iscsi-server,iscsi-client,iscsi-target,bsdfdisk}");
print ".. done\n\n";
print "Setting Perl path to /usr/bin/perl ..\n";
system("(find /opt/webmin -name '*.cgi' -print ; find /opt/webmin -name '*.pl' -print) | perl /opt/webmin/perlpath.pl /usr/bin/perl -");
print ".. done\n\n";
print "Making prototype file ..\n";
chdir("/opt/webmin");
open(PROTO, "> prototype");
print PROTO "i pkginfo=/opt/webmin/pkginfo\n";
close(PROTO);
system("find . -print | grep -v \"^prototype\" | pkgproto >>prototype");
open(PROTO, ">> prototype");
print PROTO "i postinstall=./postinstall\n";
print PROTO "i preremove=./preremove\n";
print PROTO "f none /etc/init.d/webmin=webmin-init 0755 root sys\n";
print PROTO "l none /etc/rc3.d/S99webmin=/etc/init.d/webmin\n";
print PROTO "l none /etc/rc0.d/K10webmin=/etc/init.d/webmin\n";
print PROTO "l none /etc/rc1.d/K10webmin=/etc/init.d/webmin\n";
print PROTO "l none /etc/rc2.d/K10webmin=/etc/init.d/webmin\n";
print PROTO "l none /etc/rcS.d/K10webmin=/etc/init.d/webmin\n";
close(PROTO);
print ".. done\n\n";
print "Making postinstall file ..\n";
open(POST, "> postinstall");
print POST <<EOF;
echo "Executing postinstall script .."
cd /opt/webmin
config_dir=/etc/webmin
var_dir=/var/webmin
perl=/usr/bin/perl
autoos=1
port=10000
login=root
crypt=x
ssl=0
atboot=0
nochown=1
autothird=1
noperlpath=1
nouninstall=1
export config_dir var_dir perl autoos port login crypt ssl atboot nochown autothird noperlpath nouninstall
./setup.sh
EOF
close(POST);
print ".. done\n\n";
print "Making preremove file ..\n";
open(PRE, "> preremove");
print PRE <<EOF;
echo "In preremove script.."
/etc/webmin/stop
grep root=/opt/webmin /etc/webmin/miniserv.conf >/dev/null 2>&1
if [ "\$?" = 0 -a "\$KEEP_ETC_WEBMIN" = "" ]; then
# Package is being removed, and no new version of webmin
# has taken it's place. Delete the config files
echo "Running uninstall scripts .."
(cd /opt/webmin ; WEBMIN_CONFIG=/etc/webmin WEBMIN_VAR=/var/webmin /opt/webmin/run-uninstalls.pl)
rm -rf /etc/webmin /var/webmin
fi
EOF
close(PRE);
print ".. done\n\n";
print "Making pkginfo file ..\n";
@tm = localtime(time());
$pstamp = sprintf("%4.4d%2.2%2.2d%2.2d%2.2d%2.2d",
$tm[5]+1900, $tm[4]+1, $tm[3], $tm[2], $tm[1], $tm[0]);
open(INFO, "> pkginfo");
print INFO <<EOF;
PKG="WSwebmin"
NAME="Webmin - Web-based system administration"
ARCH="all"
VERSION="$v"
CATEGORY="application"
VENDOR="Webmin Software"
EMAIL="jcameron\@webmin.com"
PSTAMP="Jamie Cameron"
BASEDIR="/opt/webmin"
CLASSES="none"
PSTAMP="$pstamp"
MAXINST="2"
EOF
close(INFO);
print ".. done\n\n";
print "Running pkgmk ..\n";
system("pkgmk -o -r /opt/webmin");
print ".. done\n\n";
print "Running pkgtrans ..\n";
system("pkgtrans -s /var/spool/pkg webmin-$v.pkg WSwebmin");
print ".. done\n\n";
print "Delete files in /opt/webmin ..\n";
chdir("/");
system("rm -rf /opt/webmin");
print ".. done\n\n";
print "Delete files in /var/spool/pkg ..\n";
system("rm -rf /var/spool/pkg/WSwebmin");
print ".. done\n\n";
if (-d "/usr/local/webadmin/solaris-pkg") {
$dest = "/usr/local/webadmin/solaris-pkg/webmin-$v.pkg.gz";
print "Moving package to $dest ..\n";
system("gzip -c /var/spool/pkg/webmin-$v.pkg >$dest");
unlink("/var/spool/pkg/webmin-$v.pkg");
print ".. done\n\n";
}
| 31.153285 | 260 | 0.683927 |
ed0967d5655bf296e698242e8b3405bf065c03cd | 8,872 | pl | Perl | scripts/config.pl | gigi81/mbed-crypto | 3f20efc03016b38f2677dadd476b21229c627c80 | [
"Apache-2.0"
]
| null | null | null | scripts/config.pl | gigi81/mbed-crypto | 3f20efc03016b38f2677dadd476b21229c627c80 | [
"Apache-2.0"
]
| null | null | null | scripts/config.pl | gigi81/mbed-crypto | 3f20efc03016b38f2677dadd476b21229c627c80 | [
"Apache-2.0"
]
| null | null | null | #!/usr/bin/env perl
#
# This file is part of mbed TLS (https://tls.mbed.org)
#
# Copyright (c) 2014-2016, ARM Limited, All Rights Reserved
#
# Purpose
#
# Comments and uncomments #define lines in the given header file and optionally
# sets their value or can get the value. This is to provide scripting control of
# what preprocessor symbols, and therefore what build time configuration flags
# are set in the 'config.h' file.
#
# Usage: config.pl [-f <file> | --file <file>] [-o | --force]
# [set <symbol> <value> | unset <symbol> | get <symbol> |
# full | realfull]
#
# Full usage description provided below.
#
# The following options are disabled instead of enabled with "full".
#
# MBEDTLS_TEST_NULL_ENTROPY
# MBEDTLS_DEPRECATED_REMOVED
# MBEDTLS_HAVE_SSE2
# MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
# MBEDTLS_ECP_DP_M221_ENABLED
# MBEDTLS_ECP_DP_M383_ENABLED
# MBEDTLS_ECP_DP_M511_ENABLED
# MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
# MBEDTLS_NO_PLATFORM_ENTROPY
# MBEDTLS_RSA_NO_CRT
# MBEDTLS_PSA_CRYPTO_SPM
# MBEDTLS_PSA_INJECT_ENTROPY
# MBEDTLS_ECP_RESTARTABLE
# and any symbol beginning _ALT
#
use warnings;
use strict;
my $config_file = "include/mbedtls/config.h";
my $usage = <<EOU;
$0 [-f <file> | --file <file>] [-o | --force]
[set <symbol> <value> | unset <symbol> | get <symbol> |
full | realfull | baremetal]
Commands
set <symbol> [<value>] - Uncomments or adds a #define for the <symbol> to
the configuration file, and optionally making it
of <value>.
If the symbol isn't present in the file an error
is returned.
unset <symbol> - Comments out the #define for the given symbol if
present in the configuration file.
get <symbol> - Finds the #define for the given symbol, returning
an exitcode of 0 if the symbol is found, and 1 if
not. The value of the symbol is output if one is
specified in the configuration file.
full - Uncomments all #define's in the configuration file
excluding some reserved symbols, until the
'Module configuration options' section
realfull - Uncomments all #define's with no exclusions
baremetal - Sets full configuration suitable for baremetal build.
Options
-f | --file <filename> - The file or file path for the configuration file
to edit. When omitted, the following default is
used:
$config_file
-o | --force - If the symbol isn't present in the configuration
file when setting its value, a #define is
appended to the end of the file.
EOU
my @excluded = qw(
MBEDTLS_TEST_NULL_ENTROPY
MBEDTLS_DEPRECATED_REMOVED
MBEDTLS_HAVE_SSE2
MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
MBEDTLS_ECP_DP_M221_ENABLED
MBEDTLS_ECP_DP_M383_ENABLED
MBEDTLS_ECP_DP_M511_ENABLED
MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
MBEDTLS_NO_PLATFORM_ENTROPY
MBEDTLS_RSA_NO_CRT
MBEDTLS_NO_UDBL_DIVISION
MBEDTLS_NO_64BIT_MULTIPLICATION
MBEDTLS_PSA_CRYPTO_SE_C
MBEDTLS_PSA_CRYPTO_SPM
MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
MBEDTLS_PSA_INJECT_ENTROPY
MBEDTLS_ECP_RESTARTABLE
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
_ALT\s*$
);
# Things that should be disabled in "baremetal"
my @excluded_baremetal = qw(
MBEDTLS_TIMING_C
MBEDTLS_FS_IO
MBEDTLS_ENTROPY_NV_SEED
MBEDTLS_HAVE_TIME
MBEDTLS_HAVE_TIME_DATE
MBEDTLS_DEPRECATED_WARNING
MBEDTLS_HAVEGE_C
MBEDTLS_THREADING_C
MBEDTLS_THREADING_PTHREAD
MBEDTLS_MEMORY_BACKTRACE
MBEDTLS_MEMORY_BUFFER_ALLOC_C
MBEDTLS_PLATFORM_TIME_ALT
MBEDTLS_PLATFORM_FPRINTF_ALT
MBEDTLS_PSA_ITS_FILE_C
MBEDTLS_PSA_CRYPTO_SE_C
MBEDTLS_PSA_CRYPTO_STORAGE_C
);
# Things that should be enabled in "full" even if they match @excluded
my @non_excluded = qw(
PLATFORM_[A-Z0-9]+_ALT
);
# Things that should be enabled in "baremetal"
my @non_excluded_baremetal = qw(
MBEDTLS_NO_PLATFORM_ENTROPY
);
# Process the command line arguments
my $force_option = 0;
my ($arg, $name, $value, $action);
while ($arg = shift) {
# Check if the argument is an option
if ($arg eq "-f" || $arg eq "--file") {
$config_file = shift;
-f $config_file or die "No such file: $config_file\n";
}
elsif ($arg eq "-o" || $arg eq "--force") {
$force_option = 1;
}
else
{
# ...else assume it's a command
$action = $arg;
if ($action eq "full" || $action eq "realfull" || $action eq "baremetal" ) {
# No additional parameters
die $usage if @ARGV;
}
elsif ($action eq "unset" || $action eq "get") {
die $usage unless @ARGV;
$name = shift;
}
elsif ($action eq "set") {
die $usage unless @ARGV;
$name = shift;
$value = shift if @ARGV;
}
else {
die "Command '$action' not recognised.\n\n".$usage;
}
}
}
# If no command was specified, exit...
if ( not defined($action) ){ die $usage; }
# Check the config file is present
if (! -f $config_file) {
chdir '..' or die;
# Confirm this is the project root directory and try again
if ( !(-d 'scripts' && -d 'include' && -d 'library' && -f $config_file) ) {
die "If no file specified, must be run from the project root or scripts directory.\n";
}
}
# Now read the file and process the contents
open my $config_read, '<', $config_file or die "read $config_file: $!\n";
my @config_lines = <$config_read>;
close $config_read;
# Add required baremetal symbols to the list that is included.
if ( $action eq "baremetal" ) {
@non_excluded = ( @non_excluded, @non_excluded_baremetal );
}
my ($exclude_re, $no_exclude_re, $exclude_baremetal_re);
if ($action eq "realfull") {
$exclude_re = qr/^$/;
$no_exclude_re = qr/./;
} else {
$exclude_re = join '|', @excluded;
$no_exclude_re = join '|', @non_excluded;
}
if ( $action eq "baremetal" ) {
$exclude_baremetal_re = join '|', @excluded_baremetal;
}
my $config_write = undef;
if ($action ne "get") {
open $config_write, '>', $config_file or die "write $config_file: $!\n";
}
my $done;
for my $line (@config_lines) {
if ($action eq "full" || $action eq "realfull" || $action eq "baremetal" ) {
if ($line =~ /name SECTION: Module configuration options/) {
$done = 1;
}
if (!$done && $line =~ m!^//\s?#define! &&
( $line !~ /$exclude_re/ || $line =~ /$no_exclude_re/ ) &&
( $action ne "baremetal" || ( $line !~ /$exclude_baremetal_re/ ) ) ) {
$line =~ s!^//\s?!!;
}
if (!$done && $line =~ m!^\s?#define! &&
! ( ( $line !~ /$exclude_re/ || $line =~ /$no_exclude_re/ ) &&
( $action ne "baremetal" || ( $line !~ /$exclude_baremetal_re/ ) ) ) ) {
$line =~ s!^!//!;
}
} elsif ($action eq "unset") {
if (!$done && $line =~ /^\s*#define\s*$name\b/) {
$line = '//' . $line;
$done = 1;
}
} elsif (!$done && $action eq "set") {
if ($line =~ m!^(?://)?\s*#define\s*$name\b!) {
$line = "#define $name";
$line .= " $value" if defined $value && $value ne "";
$line .= "\n";
$done = 1;
}
} elsif (!$done && $action eq "get") {
if ($line =~ /^\s*#define\s*$name(?:\s+(.*?))\s*(?:$|\/\*|\/\/)/) {
$value = $1;
$done = 1;
}
}
if (defined $config_write) {
print $config_write $line or die "write $config_file: $!\n";
}
}
# Did the set command work?
if ($action eq "set" && $force_option && !$done) {
# If the force option was set, append the symbol to the end of the file
my $line = "#define $name";
$line .= " $value" if defined $value && $value ne "";
$line .= "\n";
$done = 1;
print $config_write $line or die "write $config_file: $!\n";
}
if (defined $config_write) {
close $config_write or die "close $config_file: $!\n";
}
if ($action eq "get") {
if ($done) {
if ($value ne '') {
print "$value\n";
}
exit 0;
} else {
# If the symbol was not found, return an error
exit 1;
}
}
if ($action eq "full" && !$done) {
die "Configuration section was not found in $config_file\n";
}
if ($action ne "full" && $action ne "unset" && !$done) {
die "A #define for the symbol $name was not found in $config_file\n";
}
__END__
| 29.972973 | 94 | 0.591298 |
ed4c98338f0459ddbe04f3f9d2e288bfbacc8ecb | 16,120 | pl | Perl | summary_plots/blocks_partition_boxplot.pl | hyphaltip/genome-scripts | 65949403a34f019d5785bfb29bee6456c7e6f7e0 | [
"Artistic-2.0"
]
| 46 | 2015-06-11T14:16:35.000Z | 2022-02-22T04:57:15.000Z | summary_plots/blocks_partition_boxplot.pl | harish0201/genome-scripts | 68234e24c463e22006b49267a76d87c774945b5c | [
"Artistic-2.0"
]
| 1 | 2018-08-07T04:02:16.000Z | 2018-08-21T03:40:01.000Z | summary_plots/blocks_partition_boxplot.pl | harish0201/genome-scripts | 68234e24c463e22006b49267a76d87c774945b5c | [
"Artistic-2.0"
]
| 47 | 2015-09-22T13:59:15.000Z | 2022-03-25T02:13:52.000Z | #!/usr/bin/perl -w
use strict;
use Getopt::Long;
use Bio::SeqIO;
my $debug = 0;
use constant GENES => 'coprinus_gene_summary.tab';
use constant ORTHOS => 'coprinus_orthologs.tab';
use constant ORPHANS => 'coprinus_orphans.tab';
use constant PARALOGS => 'coprinus_paralogs.tab';
use constant REPEATS => 'coprinus_rptmask.tab';
use constant INTERGENIC => 'coprinus_intergenic_summary.tab';
use constant HAPLOTYPES => 'recombination_rates.tab';
use constant DS => 'coprinus_avg_ds.tab';
my $DIR = 'plot';
my $odir = 'chrom_summary';
GetOptions(
'dir:s' => \$DIR,
);
my $dir = shift;
my %CHROMS;
{
my $seq = Bio::SeqIO->new(-format => 'fasta', -file=> "$DIR/genome.fa");
my $i = 0;
while( my $s = $seq->next_seq ) {
$CHROMS{$s->display_id} = [$i++,$s->length];
}
}
my $genes = Windows->new('genes');
$genes->parse( File::Spec->catfile($DIR,GENES),
qw(chrom chrom_start));
my $repeats = Windows->new('repeats');
$repeats->parse(File::Spec->catfile($DIR,REPEATS),
qw(chrom start));
my $orthos = Windows->new('orthologs');
$orthos->parse(File::Spec->catfile($DIR,ORTHOS),
qw(src src_start));
#$orthos->normalize($genes);
my $orphans = Windows->new('orphans'); # orphans
$orphans->parse(File::Spec->catfile($DIR,ORPHANS),
qw(chrom chrom_start));
#$orphans->normalize($genes);
my $paralogs = Windows->new('paralogs'); #paralogs
$paralogs->parse(File::Spec->catfile($DIR,PARALOGS),
qw(chrom chrom_start));
#$paralogs->normalize($genes);
my $dS = Windows->new('dS'); #paralogs
$dS->parse(File::Spec->catfile($DIR,DS),
qw(scaffold start_position dS));
my $dupnum = Windows->new('dupNum'); #paralogs
$dupnum->parse(File::Spec->catfile($DIR,DS),
qw(scaffold start_position count));
#my $ssgenes = Windows->new('ssgenes'); #species-specificgenes
#$ssgenes->parse(File::Spec->catfile($DIR,SSGENES),
# qw(chrom chrom_start));
#$ssgenes->normalize($genes);
my %dat = ( 'genes' => $genes,
'repeats' => $repeats,
'paralogs' => $paralogs,
'orthologs'=> $orthos,
'orphans' => $orphans,
'dupnum' => $dupnum,
#'species_specific' => $ssgenes,
);
open(my $blocks => (File::Spec->catfile($DIR,HAPLOTYPES))) || die $!;
my %blocks;
my $block_hdr = <$blocks>;
while(<$blocks>) {
next if /^#/;
my @line = split;
push @{$blocks{$line[0]}->{$line[5]}}, [$line[1],$line[2]];
}
for my $dat ( keys %dat ) {
open(my $hotfh => ">$odir/$dat\_hot.dat") || die $!;
print $hotfh join("\t",qw(CHROM BIN TOTAL)),"\n";
open(my $coldfh => ">$odir/$dat\_cold.dat") || die $!;
print $coldfh join("\t",qw(CHROM BIN TOTAL)),"\n";
open(my $avgfh => ">$odir/$dat\_avg.dat") || die $!;
print $avgfh join("\t",qw(CHROM BIN TOTAL)),"\n";
open(my $notCfh => ">$odir/$dat\_notcold.dat") || die $!;
print $notCfh join("\t",qw(CHROM BIN TOTAL)),"\n";
for my $chrom (sort { $CHROMS{$a}->[0] <=> $CHROMS{$b}->[0] }
keys %CHROMS) {
next if $chrom =~ /^U/i;
# warn( "Processing $chrom ...\n");
# print "$chrom ", $CHROMS{$chrom}->[1], "\n";
for my $blocks ( @{$blocks{$chrom}->{'HOT'}} ) {
my $bins = &process_lumped($dat{$dat},$chrom,
@$blocks);
print $hotfh join("\n",@$bins),"\n" if scalar @$bins;
print $notCfh join("\n",@$bins),"\n" if scalar @$bins;
}
for my $blocks ( @{$blocks{$chrom}->{'COLD'}} ) {
my $bins = &process_lumped($dat{$dat},$chrom,
@$blocks);
print $coldfh join("\n",@$bins),"\n" if scalar @$bins;
}
for my $blocks ( @{$blocks{$chrom}->{'NEUTRAL'}} ) {
my $bins = &process_lumped($dat{$dat},$chrom,
@$blocks);
print $notCfh join("\n",@$bins),"\n" if scalar @$bins;
print $avgfh join("\n",@$bins),"\n" if scalar @$bins;
}
}
open(R, ">$odir/coldhot_$dat.R") || die $!;
printf R "%scold <- read.table(\"%s_cold.dat\",header=T)\n",$dat,$dat;
printf R "%shot <- read.table(\"%s_hot.dat\",header=T)\n",$dat,$dat;
printf R "%savg <- read.table(\"%s_avg.dat\",header=T)\n",$dat,$dat;
printf R "%snotcold <- read.table(\"%s_notcold.dat\",header=T)\n",$dat,$dat;
printf R "pdf(\"cold_hot_avg_%s.pdf\")\n",$dat;
printf R "boxplot(%scold\$TOTAL,%shot\$TOTAL,%savg\$TOTAL,%snotcold\$TOTAL,main=\"%s Cold-Hot-Avg Density BoxPlot\", outline=FALSE, names=c(\"Cold\",\"Hot\",\"Avg\", \"NotCold\"))\n",$dat,$dat,$dat,$dat,$dat;
printf R "summary(%shot\$TOTAL)\n",$dat;
printf R "summary(%savg\$TOTAL)\n",$dat;
printf R "summary(%scold\$TOTAL)\n",$dat;
printf R "summary(%snotcold\$TOTAL)\n",$dat;
printf R "var.test(%scold\$TOTAL,%shot\$TOTAL)\n",$dat,$dat;
printf R "var.test(%shot\$TOTAL,%savg\$TOTAL)\n",$dat,$dat;
printf R "var.test(%scold\$TOTAL,%savg\$TOTAL)\n",$dat,$dat;
printf R "var.test(%scold\$TOTAL,%snotcold\$TOTAL)\n",$dat,$dat;
printf R "ks.test(%scold\$TOTAL,%shot\$TOTAL)\n",$dat,$dat;
printf R "ks.test(%shot\$TOTAL,%savg\$TOTAL)\n",$dat,$dat;
printf R "ks.test(%scold\$TOTAL,%savg\$TOTAL)\n",$dat,$dat;
printf R "ks.test(%scold\$TOTAL,%snotcold\$TOTAL)\n",$dat,$dat;
printf R "wilcox.test(%scold\$TOTAL,%shot\$TOTAL)\n",$dat,$dat;
printf R "wilcox.test(%shot\$TOTAL,%savg\$TOTAL)\n",$dat,$dat;
printf R "wilcox.test(%scold\$TOTAL,%savg\$TOTAL)\n",$dat,$dat;
printf R "wilcox.test(%scold\$TOTAL,%snotcold\$TOTAL)\n",$dat,$dat;
}
{
# need to do the dS summary
my $dat = 'dS';
$dat{$dat} = $dS;
open(my $hotfh => ">$odir/$dat\_hot.dat") || die $!;
print $hotfh join("\t",qw(CHROM BIN MEAN)),"\n";
open(my $coldfh => ">$odir/$dat\_cold.dat") || die $!;
print $coldfh join("\t",qw(CHROM BIN MEAN)),"\n";
open(my $avgfh => ">$odir/$dat\_avg.dat") || die $!;
print $avgfh join("\t",qw(CHROM BIN MEAN)),"\n";
open(my $notCfh => ">$odir/$dat\_notcold.dat") || die $!;
print $notCfh join("\t",qw(CHROM BIN MEAN)),"\n";
for my $chrom (sort { $CHROMS{$a}->[0] <=> $CHROMS{$b}->[0] }
keys %CHROMS) {
next if $chrom =~ /^U/i;
# warn( "Processing $chrom ...\n");
# print "$chrom ", $CHROMS{$chrom}->[1], "\n";
for my $blocks ( @{$blocks{$chrom}->{'HOT'}} ) {
my $bins = &process_lumped_value($dat{$dat},$chrom,
@$blocks);
print $hotfh join("\n",@$bins),"\n" if scalar @$bins;
print $notCfh join("\n",@$bins),"\n" if scalar @$bins;
}
for my $blocks ( @{$blocks{$chrom}->{'COLD'}} ) {
my $bins = &process_lumped_value($dat{$dat},$chrom,
@$blocks);
print $coldfh join("\n",@$bins),"\n" if scalar @$bins;
}
for my $blocks ( @{$blocks{$chrom}->{'NEUTRAL'}} ) {
my $bins = &process_lumped_value($dat{$dat},$chrom,
@$blocks);
print $avgfh join("\n",@$bins),"\n" if scalar @$bins;
print $notCfh join("\n",@$bins),"\n" if scalar @$bins;
}
}
open(R, ">$odir/coldhot_$dat.R") || die $!;
printf R "%scold <- read.table(\"%s_cold.dat\",header=T)\n",$dat,$dat;
printf R "%shot <- read.table(\"%s_hot.dat\",header=T)\n",$dat,$dat;
printf R "%savg <- read.table(\"%s_avg.dat\",header=T)\n",$dat,$dat;
printf R "%snotcold <- read.table(\"%s_notcold.dat\",header=T)\n",$dat,$dat;
printf R "pdf(\"cold_hot_avg_%s.pdf\")\n",$dat;
printf R "boxplot(%scold\$MEAN,%shot\$MEAN,%savg\$MEAN,%snotcold\$MEAN,main=\"%s Cold-Hot-Avg Density BoxPlot\", outline=FALSE, names=c(\"Cold\",\"Hot\",\"Avg\",\"NotCold\"))\n",$dat,$dat,$dat,$dat,$dat;
printf R "summary(%shot\$MEAN)\n",$dat;
printf R "summary(%savg\$MEAN)\n",$dat;
printf R "summary(%scold\$MEAN)\n",$dat;
printf R "summary(%snotcold\$MEAN)\n",$dat;
printf R "ks.test(%scold\$MEAN,%shot\$MEAN)\n",$dat,$dat;
printf R "ks.test(%shot\$MEAN,%savg\$MEAN)\n",$dat,$dat;
printf R "ks.test(%scold\$MEAN,%savg\$MEAN)\n",$dat,$dat;
printf R "ks.test(%scold\$MEAN,%snotcold\$MEAN)\n",$dat,$dat;
}
sub process_lumped {
my ($obj,$chrom,$left,$right) = @_;
my $flag = 'total';
my $bins = $obj->fetch_bins($chrom);
my @d;
for my $bin (@$bins) {
if( $bin >= $left && $bin <= $right ) {
push @d, join("\t", $chrom,$bin,$obj->$flag($chrom,$bin));
}
}
return \@d;
}
sub process_lumped_value {
my ($obj,$chrom,$left,$right) = @_;
my $flag = 'average';
my $bins = $obj->fetch_bins($chrom);
my @d;
for my $bin (@$bins) {
if( $bin >= $left && $bin <= $right ) {
my $avg = $obj->$flag($chrom,$bin);
next if $avg > 4;
push @d, join("\t", $chrom,$bin,$avg);
}
}
return \@d;
}
package Windows;
use List::Util qw(sum max);
# constants for sliding windows
use constant WINDOW => 50_000;
use constant STEP => 50_000;
sub new {
my ($self,$label) = @_;
my $this = bless {},$self;
$this->{label} = $label;
$this->{fh} = undef;
return $this;
}
sub parse {
my ($self,$file,$group_by,$bin_by,$save_by, $filter) = @_;
my $cols = fetch_columns($file);
for my $col ( $group_by, $bin_by, $save_by) {
if( defined $col && ! exists $cols->{$bin_by}) {
die("cannot find column $bin_by in $file\n");
}
}
warn( "parsing: $file ...\n");
my $positions = {};
open($self->{fh} => $file) or die "$! $file\n";;
my $fh = $self->{fh};
while (<$fh>) {
chomp;
# Skip comments
next if (/^\#/);
# Fetch the position of the bin_by and group_by
# columns in the fields array
my @fields = split("\t",$_);
my $bin_val = $fields[$cols->{$bin_by}];
my $group_val = $fields[$cols->{$group_by}];
# Is the value out of range?
if ($bin_val > $CHROMS{$group_val}[1]) {
print STDERR "Positional value out of range for chromosome $group_val...$bin_val\t",
$CHROMS{$group_val}[1],"\n";
next;
}
# Save both the physical position to map and the value...
# (these may or may not be the same thing!)
# This is normally used for things like KaKs values,
# where I am plotting values (and not just sums of occurences)
# against the physical position
my $value = 0;
if( defined $save_by ) {
$value = eval { $fields[$cols->{$save_by}] };
if( ! defined $filter || &$filter($value)) {
push (@{$self->{nonsliding}->{$group_val}},[$bin_val,$value]);
} else {
next;
}
} else {
$value = 1;
# Okay, I didn't find a save_by value. Just plotting by the bin_value
}
$value ||= $bin_val;
push (@{$positions->{$group_val}},[$bin_val,$value]);
}
$self->sliding_windows($positions);
return;
}
# Which windows does this fall into?
sub sliding_windows {
my ($self,$positions) = @_;
print STDERR " binning...\n";
for my $group_value (keys %$positions) {
# Get the maximal limit (ie the highest scoring feature)
my @positions = sort { $a->[0] <=> $b->[0] } @{$positions->{$group_value}};
for my $temp (@positions) {
my ($fstart,$value) = @$temp;
$self->stuff($fstart,$value,$positions[-1]->[0],$group_value);
}
}
# calculate the average and total values in each bin
$self->calc_averages();
}
# This is a new attempt at a vastly more efficient
# calculated sliding window algorithm
sub stuff {
my ($self,$fstart,$value,$max,$key) = @_;
# Calculate the center bin position based on the STEP size,
# not the WINDOW size...
my $center_bin_index = int ($fstart / STEP);
# How many steps are there per window?
my $steps = WINDOW / STEP;
# One approach: the feature should fall into equal bins on both sides
# This centers each window on the bin point - maybe not quite accurate...
# my $start = $center_bin_index - ($steps/2);
# my $stop = $center_bin_index + ($steps/2);
# Second approach: the center_bin_index is really the LAST bin
# that should contain the feature (that is, it's the upper limit
# for bins containing the feature).
my $start = $center_bin_index - $steps; # 0-based indexing
my $stop = $center_bin_index + 1;
# Is $start less than 0?
$start = ($start < 0) ? 0 : $start;
# Non-overlapping bins...
if ($steps == 1) {
$start = $center_bin_index;
$stop = $center_bin_index;
}
for (my $i=$start;$i<=$stop;$i+=1) {
my $bin = $i * STEP;
push (@{$self->{groups}->{$key}->{$bin}->{values}},$value);
# print STDERR "\t",$i,"\t",$bin,"\t",$value,,"\t",$fstart,"\n";
}
return;
}
# Calculate an average for each bin or a total value.
sub calc_averages {
my $self = shift;
warn(" calculating average...\n");
my ($max_average,$max_total,$max_value_all) = (0,0,0);
# maybe should also calculate 1SD to help in setting an upper limit cutoff?
for my $group_by ($self->fetch_groups()) {
warn("group is empty") unless defined $group_by;
my $bins = $self->fetch_bins($group_by);
my $max_value = 0;
for my $bin (@$bins) {
my $all = $self->fetch_values($group_by,$bin);
my $sum = &sum (@$all);
my $avg = $sum / scalar @$all;
$self->{groups}->{$group_by}->{$bin}->{average} = $avg;
$self->{groups}->{$group_by}->{$bin}->{total} = scalar @$all;
$max_value = max(@$all, $max_value);
$max_total = max( scalar @$all, $max_total);
$max_average = max($avg,$max_average);
}
$self->{'max_y_value_'.$group_by} = $max_value;
$max_value_all = max($max_value, $max_value_all);
}
$self->{'max_y_total'} = $max_total || 1;
$self->{'max_y_value'} = $max_value_all || 1;
$self->{'max_y_average'} = $max_average || 1;
}
sub fetch_columns {
my $file = shift;
open(IN,$file)|| die "$! $file\n";
my %cols;
while (<IN>) {
chomp;
my $line = $_;
$line =~ s/\#//g;
my @cols = split("\t",$line);
my $pos = 0;
for (@cols) {
$cols{$_} = $pos;
$pos++;
}
last;
}
return \%cols;
}
# Normalization
sub normalize {
my ($numerator,$denominator) = @_;
# Iterate through all the bins in the numerator
# looking up the corresponding values in the denominator.
my $max;
print STDERR " normalizing...\n";
for my $group ($numerator->fetch_groups()) {
my $bins = $numerator->fetch_bins($group);
for my $bin (@$bins) {
my $total = $numerator->total($group,$bin);
my $denom_total = $denominator->total($group,$bin);
my $normalized = eval { $total / $denom_total };
$normalized ||= '0';
$max ||= $normalized;
$max = max($normalized,$max);
$numerator->{groups}->{$group}->{$bin}->{normalized} = $normalized;
}
}
$numerator->{max_y_normalized} = $max;
}
# Data access methods
sub fetch_groups { return keys %{shift->{groups}}; }
sub fetch_bins {
my ($self,$group,$min,$max) = @_;
my @bins = keys %{$self->{groups}->{$group}};
my @sorted = sort { $a <=> $b } @bins;
return \@sorted;
}
sub fetch_values {
my ($self,$group,$bin) = @_;
my @vals = @{$self->{groups}->{$group}->{$bin}->{values}};
return \@vals;
}
sub total {
my ($self,$group,$bin) = @_;
return $self->{groups}->{$group}->{$bin}->{total};
}
sub average {
my ($self,$group,$bin) = @_;
return $self->{groups}->{$group}->{$bin}->{average};
}
sub normalized {
my ($self,$group,$bin) = @_;
return $self->{groups}->{$group}->{$bin}->{normalized};
}
sub print_info {
my ($self,$tag,$field) = @_;
$field ||= 'total';
my $file = $self->{dumped_file};
open OUT,">dumped_values/$file.out";
for my $group ($self->fetch_groups()) {
# Print out some header information
print OUT "#chromosome=$group\n";
print OUT "#field_content=$field\n";
print OUT "#max_y_average=" . $self->{max_y_average} . "\n";
print OUT "#max_y_total=" . $self->{max_y_total} . "\n";
print OUT "#max_y_normalized=" . $self->{max_y_normalized} . "\n";
my $bins = $self->fetch_bins($group);
for my $bin (@$bins) {
my $normalized = $self->normalized($group,$bin);
my $total = $self->$field($group,$bin);
print OUT $group,"\t",$bin,"\t",$total,"\n";
}
}
close OUT;
}
sub calc_y_scale {
my ($self,$tag,$height) = @_;
my $max = $self->{'max_y_' . $tag};
unless( defined $max ) { warn("no max for ".'max_y_' . $tag."\n") }
return 1 unless $max;
return $height / $max;
}
1;
| 31.484375 | 212 | 0.578722 |
ed0ec3c91528e9fcc41e89b8980a4a0c8c1b6148 | 1,440 | t | Perl | t/20-cmdline.t | talexb/CSVDB | c3e8eec8fc138437749dfe1ee249964757804f35 | [
"ClArtistic"
]
| null | null | null | t/20-cmdline.t | talexb/CSVDB | c3e8eec8fc138437749dfe1ee249964757804f35 | [
"ClArtistic"
]
| null | null | null | t/20-cmdline.t | talexb/CSVDB | c3e8eec8fc138437749dfe1ee249964757804f35 | [
"ClArtistic"
]
| null | null | null | #!perl
use 5.006;
use strict;
use warnings;
use Test::More;
use FindBin qw/$Bin/; # For test file location
{
my $prog = "$Bin/../script/csvdb";
my $filename = 't/Shapes-2021-1008.csv';
# Load the file .. only needs to be done once.
open( my $fh, '<', $filename );
my $line_num = 0;
my @data_from_file;
while (<$fh>) {
next if ( $line_num++ == 0 );
s/\s+$//;
my @row = split(/,/);
push( @data_from_file, \@row );
}
close($fh);
# Test '*' (all fields), '1,2' (all fields, with and without an
# extra space) and 'sides,name' (all fields -- by name, with and without
# an extra space) since they are equivalent in this case.
foreach my $select ('*', '1,2', '1, 2', 'sides,name', 'sides, name') {
my @result =
map { s/\s+$//; $_ } `$prog 2>&1 -o $filename -e 'select $select'`;
ok( @result, 'Got some output from the command line call' );
my @info_only = grep { /^INFO:/ } @result;
like( $info_only[0], qr/$filename loaded/, 'Saw file loaded message' );
my @data_only = grep { $_ !~ /:/ } @result;
is( scalar @data_only, 7, 'Got the right number of lines back' );
foreach my $n ( 0 .. $line_num - 2 ) {
my @got = split( /\t/, $data_only[$n] );
is_deeply( \@got, $data_from_file[$n], "Data for row $n matched" );
}
}
done_testing;
}
| 26.181818 | 79 | 0.527083 |
ed471f526d3bc9ca8b2b783b980a60a5d2aa451b | 180 | pl | Perl | finales/DB_final-27-02-14_empleado.pl | MaraniMatias/UTN-Prolog | eb7fce25342e7edbffb636fc98bfef476f007916 | [
"MIT"
]
| 1 | 2020-05-09T02:36:32.000Z | 2020-05-09T02:36:32.000Z | finales/DB_final-27-02-14_empleado.pl | MaraniMatias/UTN-Prolog | eb7fce25342e7edbffb636fc98bfef476f007916 | [
"MIT"
]
| null | null | null | finales/DB_final-27-02-14_empleado.pl | MaraniMatias/UTN-Prolog | eb7fce25342e7edbffb636fc98bfef476f007916 | [
"MIT"
]
| 2 | 2020-05-09T03:07:55.000Z | 2021-02-18T15:25:15.000Z | :- dynamic empleado/3.
% empleado(nombre_empleado, profesion, ciudad)
empleado(matias, developers, casilda).
empleado(marcelo, gerente, casilda).
empleado(agus, topTop, rosario).
| 25.714286 | 46 | 0.772222 |
ed2255fa038490738f7cc401c2cf9518639539df | 3,561 | t | Perl | Schedule-DRMAAc-0.81/t/03_system_queries.t | biocoder/Perl-for-Bioinformatics | da0a7d43c5185c99bbcc603a2807b93986942d81 | [
"Artistic-1.0"
]
| 33 | 2015-05-06T15:08:55.000Z | 2022-02-19T05:45:05.000Z | Schedule-DRMAAc-0.81/t/03_system_queries.t | biocoder/Perl-for-Bioinformatics | da0a7d43c5185c99bbcc603a2807b93986942d81 | [
"Artistic-1.0"
]
| 6 | 2015-09-18T20:56:32.000Z | 2018-10-23T15:59:45.000Z | Schedule-DRMAAc-0.81/t/03_system_queries.t | biocoder/Perl-for-Bioinformatics | da0a7d43c5185c99bbcc603a2807b93986942d81 | [
"Artistic-1.0"
]
| 31 | 2015-02-26T19:10:44.000Z | 2021-12-07T03:11:07.000Z | ##############################################################################
# Copyright (c) 2004, The Regents of the University of California.
# Produced at the Lawrence Livermore National Laboratory.
# Written by Tim Harsch <harsch1@llnl.gov>
# UCRL-CODE-155918
# All rights reserved.
#
# This file is part of Schedule::DRMAAc. For details, see CPAN
# Please also read LICENSE.txt which is found in this source distribution.
#
# 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) version 2, dated June 1991.
# 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 terms and conditions of 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, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
##############################################################################
# $Id: 03_system_queries.t,v 1.2 2004/04/27 20:50:36 harsch Exp $
##############################################################################
use Schedule::DRMAAc qw/ :all /;
use strict;
use constant TESTS => 15;
use Test::More tests => TESTS;
sub mydiag( $ $ ; $ );
my( $error, $diagnosis );
my @vals = drmaa_strerror( 0 );
ok( @vals == 1, "drmaa_strerror returned " . scalar(@vals) . " of 1 args" );
@vals = ( $error, $diagnosis ) = drmaa_init( undef );
ok( @vals == 2, "drmaa_init returned " . scalar(@vals) . " of 2 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_init error?" )
or mydiag( $error, $diagnosis );
my $jt;
@vals = ( $error, $jt, $diagnosis ) = drmaa_allocate_job_template();
ok( @vals == 3, "drmaa_init returned " . scalar(@vals) . " of 3 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_allocate_job_template error?" )
or mydiag( $error, $diagnosis );
my( $major, $minor );
@vals = ( $error, $major, $minor, $diagnosis ) = drmaa_version();
ok( @vals == 4, "drmaa_version returned " . scalar(@vals) . " of 4 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_version error?" )
or mydiag( $error, $diagnosis );
my $DRMAA_impl;
@vals = ( $error, $DRMAA_impl, $diagnosis ) = drmaa_get_DRMAA_implementation();
ok( @vals == 3, "drmaa_version returned " . scalar(@vals) . " of 3 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_version error?" )
or mydiag( $error, $diagnosis );
my $DRM_system;
@vals = ( $error, $DRM_system, $diagnosis ) = drmaa_get_DRM_system();
ok( @vals == 3, "drmaa_get_DRM_system returned " . scalar(@vals) . " of 3 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_get_DRM_system error?" )
or mydiag( $error, $diagnosis );
my $contact;
@vals = ( $error, $contact, $diagnosis ) = drmaa_get_contact();
ok( @vals == 3, "drmaa_get_contact returned " . scalar(@vals) . " of 3 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_get_contact error?" )
or mydiag( $error, $diagnosis );
@vals = ( $error, $diagnosis ) = drmaa_exit();
ok( @vals == 2, "drmaa_exit returned " . scalar(@vals) . " of 2 args" );
ok( $error == $DRMAA_ERRNO_SUCCESS, "drmaa_exit error?" )
or mydiag( $error, $diagnosis );
sub mydiag( $ $ ; $ ) {
my $msg = "error: " . drmaa_strerror( $_[0] ) . "\n" . "diagnosis: " . $_[1];
$msg .= $_[2] if defined $_[2];
diag( $msg );
} # end sub
1; # Ancient Druid Custom
| 40.465909 | 82 | 0.629879 |
73fe3d466773441ffadbe8352fb698cc662e7784 | 4,543 | pm | Perl | storage/panzura/snmp/mode/memory.pm | centreon-lab/centreon-plugins | 68096c697a9e1baf89a712674a193d9a9321503c | [
"Apache-2.0"
]
| null | null | null | storage/panzura/snmp/mode/memory.pm | centreon-lab/centreon-plugins | 68096c697a9e1baf89a712674a193d9a9321503c | [
"Apache-2.0"
]
| null | null | null | storage/panzura/snmp/mode/memory.pm | centreon-lab/centreon-plugins | 68096c697a9e1baf89a712674a193d9a9321503c | [
"Apache-2.0"
]
| null | null | null | #
# Copyright 2022 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::panzura::snmp::mode::memory;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
if ($self->{snmp}->is_snmpv1()) {
$self->{output}->add_option_msg(short_msg => "Need to use SNMP v2c or v3.");
$self->{output}->option_exit();
}
# It's KB. Even if the mib file says 'MB'!! The MIB description will be fixed by panzura
my $oid_memUsed = '.1.3.6.1.4.1.32853.1.3.1.2.1.0'; # KB
my $oid_memAvail = '.1.3.6.1.4.1.32853.1.3.1.2.2.0'; # KB
my $oid_memTotal = '.1.3.6.1.4.1.32853.1.3.1.2.3.0'; # KB
my $result = $self->{snmp}->get_leef(oids => [$oid_memUsed, $oid_memAvail, $oid_memTotal],
nothing_quit => 1);
my $total_size = $result->{$oid_memTotal} * 1024;
my $used = $result->{$oid_memUsed} * 1024;
my $free = $result->{$oid_memAvail} * 1024;
my $prct_used = $used * 100 / $total_size;
my $prct_free = 100 - $prct_used;
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $used);
my ($free_value, $free_unit) = $self->{perfdata}->change_bytes(value => $free);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Memory Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
$total_value . " " . $total_unit,
$used_value . " " . $used_unit, $prct_used,
$free_value . " " . $free_unit, $prct_free));
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),
min => 0, max => $total_size);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check memory (panzura-systemext).
=over 8
=item B<--warning>
Threshold warning in percent.
=item B<--critical>
Threshold critical in percent.
=back
=cut
| 37.545455 | 194 | 0.561083 |
ed4042593084525a5bdb3dcd7420f2dd54319a3c | 2,122 | pm | Perl | lib/App/RecordStream/Operation/sort.pm | gitpan/App-RecordStream | 039ea5fdcb2456425068400d5f23cbb975058d1c | [
"Artistic-1.0"
]
| null | null | null | lib/App/RecordStream/Operation/sort.pm | gitpan/App-RecordStream | 039ea5fdcb2456425068400d5f23cbb975058d1c | [
"Artistic-1.0"
]
| null | null | null | lib/App/RecordStream/Operation/sort.pm | gitpan/App-RecordStream | 039ea5fdcb2456425068400d5f23cbb975058d1c | [
"Artistic-1.0"
]
| null | null | null | package App::RecordStream::Operation::sort;
our $VERSION = "4.0.10";
use strict;
use warnings;
use base qw(App::RecordStream::Accumulator App::RecordStream::Operation);
sub init {
my $this = shift;
my $args = shift;
my @keys;
my $reverse;
my $spec = {
"key|k=s" => sub { push @keys, split(/,/, $_[1]); },
"reverse|r" => \$reverse,
};
$this->parse_options($args, $spec);
$this->{'KEYS'} = \@keys;
$this->{'REVERSE'} = $reverse;
}
sub stream_done {
my $this = shift;
my @records = App::RecordStream::Record::sort($this->get_records(), @{$this->{'KEYS'}});
if ( $this->{'REVERSE'} ) {
@records = reverse @records;
}
foreach my $record (@records) {
$this->push_record($record);
}
}
sub add_help_types {
my $this = shift;
$this->use_help_type('keyspecs');
}
sub usage {
my $this = shift;
my $options = [
['key <keyspec>', "May be comma separated, May be specified multiple times. Each keyspec is a name or a name=sortType. The name should be a field name to sort on. The sort type should be either lexical or numeric. Default sort type is lexical (can also use nat, lex, n, and l). Additionallly, the sort type may be prefixed with '-' to indicate a decreasing sort order. Additionally, the sort type may be postfixed with '*' to sort the special value 'ALL' to the end (useful for the output of recs-collate --cube). See perldoc for App::RecordStream::Record for more on sort specs. May be a key spec, see '--help-keyspecs' for more. Cannot be a keygroup."],
['reverse', 'Reverses the sort order'],
];
my $args_string = $this->options_string($options);
return <<USAGE;
Usage: recs-sort <args> [<files>]
__FORMAT_TEXT__
Sorts records from input or from <files>. You may sort on a list of keys,
each key sorted lexically (alpha order) or numerically
__FORMAT_TEXT__
$args_string
Examples:
Sort on the id field, a numeric
recs-sort --key id=numeric
Sort on age, then name
recs-sort --key age=numeric,name
Sort on decreasing size, name
recs-sort --key size=-numeric --key name
USAGE
}
1;
| 27.558442 | 668 | 0.656927 |
ed43fe181cd4978fa542e3bf33984dccbf4e3c0a | 1,055 | t | Perl | t/CHI-Route-no.t | Akron/Mojolicious-Plugin-CHI-Route | cd04fcb76fa1eedfc38af09eb13fb20fba19f018 | [
"Artistic-2.0"
]
| null | null | null | t/CHI-Route-no.t | Akron/Mojolicious-Plugin-CHI-Route | cd04fcb76fa1eedfc38af09eb13fb20fba19f018 | [
"Artistic-2.0"
]
| null | null | null | t/CHI-Route-no.t | Akron/Mojolicious-Plugin-CHI-Route | cd04fcb76fa1eedfc38af09eb13fb20fba19f018 | [
"Artistic-2.0"
]
| null | null | null | #!/usr/bin/env perl
use Mojolicious::Lite;
use Test::More;
use Test::Mojo;
use_ok 'Mojolicious::Plugin::CHI::Route';
my $t = Test::Mojo->new;
my $app = $t->app;
$app->plugin('CHI');
$app->plugin('CHI::Route' => {
namespace => 'xyz'
});
my $call = 1;
get('/cool')->requires('chi' => { key => sub { 'abc' } })->to(
cb => sub {
my $c = shift;
$c->res->headers->header('X-Funny' => 'hi');
return $c->render(
text => 'works: cool: ' . $call++,
format => 'txt'
);
}
);
my $err = $t->get_ok('/cool')
->status_is(200)
->content_type_is('text/plain;charset=UTF-8')
->content_is('works: cool: 1')
->header_is('X-Funny','hi')
->header_is('X-Cache-CHI', undef)
->tx->res->dom->at('#error')
;
if ($err) {
is($err->text, '');
};
$err = $t->get_ok('/cool')
->status_is(200)
->content_type_is('text/plain;charset=UTF-8')
->content_is('works: cool: 2')
->header_is('X-Funny','hi')
->header_is('X-Cache-CHI', undef)
->tx->res->dom->at('#error')
;
if ($err) {
is($err->text, '');
};
done_testing;
| 18.508772 | 62 | 0.545024 |
ed45377279e70daccc35fc239afb1975a5b3e9a0 | 11,281 | pm | Perl | lib/Quarantine.pm | datumbox/clamtk-gtk3 | 69e6f810e8666668e4e27fce44e938daa89b28a1 | [
"BSD-3-Clause"
]
| null | null | null | lib/Quarantine.pm | datumbox/clamtk-gtk3 | 69e6f810e8666668e4e27fce44e938daa89b28a1 | [
"BSD-3-Clause"
]
| null | null | null | lib/Quarantine.pm | datumbox/clamtk-gtk3 | 69e6f810e8666668e4e27fce44e938daa89b28a1 | [
"BSD-3-Clause"
]
| null | null | null | # ClamTk, copyright (C) 2004-2020 Dave M
#
# This file is part of ClamTk
# (https://gitlab.com/dave_m/clamtk-gtk3/).
#
# ClamTk is free software; you can redistribute it and/or modify it
# under the terms of either:
#
# a) the GNU General Public License as published by the Free Software
# Foundation; either version 1, or (at your option) any later version, or
#
# b) the "Artistic License".
package ClamTk::Quarantine;
use Glib 'TRUE', 'FALSE';
# use strict;
# use warnings;
$| = 1;
use POSIX 'locale_h';
use File::Basename 'basename', 'dirname';
use File::Copy 'move';
use Digest::SHA 'sha256_hex';
use Locale::gettext;
use Encode 'decode';
use constant ROW => 0;
use constant FILE => 1;
my $liststore;
binmode( STDIN, ':utf8' );
binmode( STDOUT, ':utf8' );
sub show_window {
my $box = Gtk3::Box->new( 'vertical', 5 );
$box->set_homogeneous( FALSE );
my $sw = Gtk3::ScrolledWindow->new( undef, undef );
$sw->set_policy( 'automatic', 'automatic' );
$sw->set_vexpand( TRUE );
$box->pack_start( $sw, TRUE, TRUE, 5 );
#<<<
$liststore = Gtk3::ListStore->new(
'Glib::Int',
'Glib::String',
);
#>>>
my $view = Gtk3::TreeView->new_with_model( $liststore );
$view->set_rules_hint( TRUE );
my $column = Gtk3::TreeViewColumn->new_with_attributes(
_( 'Number' ),
Gtk3::CellRendererText->new,
text => ROW,
);
$column->set_sort_column_id( 0 );
$column->set_sizing( 'fixed' );
$column->set_expand( TRUE );
$column->set_resizable( TRUE );
$view->append_column( $column );
$column = Gtk3::TreeViewColumn->new_with_attributes(
_( 'File' ),
Gtk3::CellRendererText->new,
text => FILE,
);
$column->set_sort_column_id( 1 );
$column->set_sizing( 'fixed' );
$column->set_expand( TRUE );
$column->set_resizable( TRUE );
$view->append_column( $column );
$sw->add( $view );
my $viewbar = Gtk3::Toolbar->new;
$box->pack_start( $viewbar, FALSE, FALSE, 5 );
$viewbar->set_style( 'both-horiz' );
my $button = Gtk3::ToolButton->new();
my $use_image = ClamTk::Icons->get_image( 'edit-undo' );
$button->set_icon_name( $use_image );
$button->set_label( _( 'Restore' ) );
$viewbar->insert( $button, -1 );
$button->set_is_important( TRUE );
$button->signal_connect( clicked => \&restore, $view );
my $v_sep = Gtk3::SeparatorToolItem->new;
$v_sep->set_draw( FALSE );
$v_sep->set_expand( TRUE );
$viewbar->insert( $v_sep, -1 );
$button = Gtk3::ToolButton->new();
$use_image = ClamTk::Icons->get_image( 'edit-delete' );
$button->set_icon_name( $use_image );
$button->set_label( _( 'Delete' ) );
$viewbar->insert( $button, -1 );
$button->set_is_important( TRUE );
$button->signal_connect( clicked => \&delete, $view );
push_viruses();
$box->show_all;
return $box;
}
sub delete {
my ( $toolbutton, $treeview ) = @_;
my $selected = $treeview->get_selection;
my ( $model, $iter ) = $selected->get_selected;
return unless $iter;
my $row = $model->get_value( $iter, ROW );
my $viruses = get_and_sort_viruses();
my $file = $viruses->{ $row }->{ basename };
my $fullname = $viruses->{ $row }->{ fullname };
# Get confirmation about deletion
#<<<
my $question = sprintf(
_( 'Really delete this file (%s) ?' ),
$file,
);
my $message
= Gtk3::MessageDialog->new(
undef,
[ qw| modal destroy-with-parent | ],
'question',
'ok-cancel',
$question,
);
#>>>
if ( 'ok' eq $message->run ) {
$message->destroy;
unlink( $fullname ) or do {
warn "Unable to delete >$fullname<: $!\n";
return FALSE;
};
$model->clear;
push_viruses();
return TRUE;
} else {
$message->destroy;
return FALSE;
}
}
sub restore {
my ( $toolbutton, $treeview ) = @_;
my $selected = $treeview->get_selection;
my ( $model, $iter ) = $selected->get_selected;
return unless $iter;
my $row = $model->get_value( $iter, ROW );
my $viruses = get_and_sort_viruses();
my $fullname = $viruses->{ $row }->{ fullname };
my $basename = $viruses->{ $row }->{ basename };
# Current location of quarantined file
my $current_path = ClamTk::App->get_path( 'viruses' );
$current_path .= '/';
$current_path .= $basename;
# By default, the final destination will be $HOME
my $final_destination = ClamTk::App->get_path( 'directory' );
$final_destination .= '/';
$final_destination .= $basename;
my $current_hash = get_hash( $current_path );
# See if we have a record of this file
my ( $hopeful_path, $hopeful_mode ) = query_hash( $current_hash );
if ( $hopeful_path ) {
$final_destination = decode( 'utf8', $hopeful_path );
}
# Save-as dialog
my $dialog = Gtk3::FileChooserDialog->new(
_( 'Save file as...' ),
undef,
'save',
'gtk-cancel' => 'cancel',
'gtk-ok' => 'ok',
);
$dialog->set_current_name( $final_destination );
$dialog->set_do_overwrite_confirmation( TRUE );
if ( 'ok' eq $dialog->run ) {
$dialog->destroy;
# If we obtained permissions, apply them;
# or, 644 by default. (?)
# Unless someone has a better idea for default perms.
$hopeful_mode ||= 644;
chmod oct( $hopeful_mode ), $current_path;
move( $current_path, $final_destination ) or do {
warn "Unable to move >$current_path< to ",
">", $final_destination, "<\n";
return FALSE;
};
if ( remove_hash( undef, $current_hash ) ) {
$liststore->clear;
push_viruses();
return TRUE;
} else {
warn "error removing file >$fullname< from restore file: $!\n";
$liststore->clear;
push_viruses();
return FALSE;
}
} else {
$dialog->destroy;
return FALSE;
}
}
sub get_and_sort_viruses {
# Where we hold the quarantined stuff
my $path = ClamTk::App->get_path( 'viruses' );
my $hash;
my $i = 1;
for my $virus ( glob "$path/*" ) {
$hash->{ $i }->{ fullname } = decode( 'utf8', $virus );
$hash->{ $i }->{ basename } = decode( 'utf8', basename( $virus ) );
$hash->{ $i }->{ number } = $i;
$i++;
}
return $hash;
}
sub push_viruses {
my $hash = shift;
# If we weren't given a hash of info,
# go and get it:
if ( !$hash ) {
$hash = get_and_sort_viruses();
}
#<<<
for my $key ( sort { $a <=> $b } keys %$hash ) {
my $iter = $liststore->append;
$liststore->set(
$iter,
0, $hash->{ $key }->{ number },
1, $hash->{ $key }->{ basename },
);
}
#<<<
}
sub query_hash {
# See if queried file exists in 'restore' file;
# this might have to change to allow for querying
# by hash or fullpath
my $filehash = shift;
my $restore_path = ClamTk::App->get_path( 'restore' );
#open( my $F, '<:encoding(UTF-8)', $restore_path ) or do {
open( my $F, '<', $restore_path ) or do {
warn "Can't open restore file for reading: $!\n";
return FALSE;
};
my $current_list;
while ( <$F> ) {
chomp;
my ( $qhash, $qpath, $qmode ) = split /:/;
$current_list->{ $qhash }->{ hash } = $qhash;
$current_list->{ $qhash }->{ path } = $qpath;
$current_list->{ $qhash }->{ mode } = $qmode;
# See if it already exists in the restore file
if ( $current_list->{ $qhash }->{ hash } eq $filehash ) {
close( $F );
return (
$current_list->{ $qhash }->{ path },
$current_list->{ $qhash }->{ mode }
);
}
}
close( $F );
return FALSE;
}
sub add_hash {
# Add quarantined file to 'restore' file
my ( $pkg_name, $file, $permissions ) = @_;
my $hash = get_hash( $file );
my $restore_path = ClamTk::App->get_path( 'restore' );
open( my $F, '<:encoding(UTF-8)', $restore_path ) or do {
warn "Can't open restore file for reading: $!\n";
return FALSE;
};
my $current_list;
while ( <$F> ) {
chomp;
next if ( /^\s*$/ );
my ( $qhash, $qpath, $qmode ) = split /:/;
$current_list->{ $qhash }->{ hash } = $qhash;
$current_list->{ $qhash }->{ path } = $qpath;
$current_list->{ $qhash }->{ mode } = $qmode;
# See if it already exists in the restore file
if ( $current_list->{ $qhash }->{ hash } eq $hash
|| $current_list->{ $qhash }->{ path } eq $file )
{
return FALSE;
}
}
close( $F );
# Rewrite restore file with new addition
open( $F, '>:encoding(UTF-8)', $restore_path ) or do {
# open( $F, '>', $restore_path ) or do {
warn "Can't open restore file for reading: $!\n";
return FALSE;
};
for my $key ( keys %$current_list ) {
print $F join( ':',
$current_list->{ $key }->{ hash },
$current_list->{ $key }->{ path },
$current_list->{ $key }->{ mode },
);
print $F "\n";
}
print $F $hash, ':', $file, ':', $permissions, "\n";
close( $F );
return TRUE;
}
sub remove_hash {
# Remove quarantined file from 'restore' file
my ( $pkg_name, $hash ) = @_;
my $restore_path = ClamTk::App->get_path( 'restore' );
#open( my $F, '<:encoding(UTF-8)', $restore_path ) or do {
open( my $F, '<', $restore_path ) or do {
warn "Can't open restore file for reading: $!\n";
return FALSE;
};
my $current_list;
while ( <$F> ) {
chomp;
my ( $qhash, $qpath, $qmode ) = split /:/;
$current_list->{ $qhash }->{ hash } = $qhash;
$current_list->{ $qhash }->{ path } = $qpath;
$current_list->{ $qhash }->{ mode } = $qmode;
}
close( $F );
warn "no files listed in restore file!\n"
and return FALSE
unless scalar keys %$current_list;
# Rewrite restore file
#open( $F, '>:encoding(UTF-8)', $restore_path ) or do {
open( $F, '>', $restore_path ) or do {
warn "Can't open restore file for reading: $!\n";
return FALSE;
};
# Next over the one we're removing
for my $key ( keys %$current_list ) {
next if ( $current_list->{ $key }->{ hash } eq $hash );
print $F join( ':',
$current_list->{ $key }->{ hash },
$current_list->{ $key }->{ path },
$current_list->{ $key }->{ mode },
);
print $F "\n";
}
close( $F );
return TRUE;
}
sub get_hash {
my $file = shift;
my $slurp = do {
local $/ = undef;
open( my $f, '<', $file ) or do {
warn "Unable to open >$file< for hashing: $!\n";
return;
};
binmode( $f );
<$f>;
};
return sha256_hex( $slurp );
}
1;
| 27.854321 | 75 | 0.528411 |
ed51d08aafb3deb38d4c02669ac74257033ecdc0 | 10,464 | pl | Perl | src/perl/filter_deseq.pl | jonathancrabtree/ergatis | a587bfa0d30c58dec8855ba5ed45274e4f206ad7 | [
"Artistic-1.0"
]
| null | null | null | src/perl/filter_deseq.pl | jonathancrabtree/ergatis | a587bfa0d30c58dec8855ba5ed45274e4f206ad7 | [
"Artistic-1.0"
]
| null | null | null | src/perl/filter_deseq.pl | jonathancrabtree/ergatis | a587bfa0d30c58dec8855ba5ed45274e4f206ad7 | [
"Artistic-1.0"
]
| null | null | null |
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
=head1 NAME
filter_deseq.pl - filter DESeq output on [FDR, log fold change, Read Count, P value]
=head1 SYNOPSIS
USAGE: filter_on_fc.pl
[REQUIRED]
--deseq_list = list file of .txt output files from DESeq
--output_dir = output directory to write the UP and DOWN regulated gene lists
--filters = string containing combinations of various filters <FDR=0.5,RC=10:FDR=0.3,RC=5:FDR=0.05,RC=15>
--project_name = this will be the file name for xls document
[OPTIONAL]
--map_file = file that has mapping information of [gene_id TAB gene_name TAB gene_desc]
--abbrev_file = file that has abbreviations for sample names (used for tab names in xls sheet which cannot be > 31 characters)
--help
=head1 CONTACT
Priti Kumari
pkumari@som.umaryland.edu
=cut
use strict;
use warnings;
use File::Spec;
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin";
use Getopt::Long qw(:config no_ignore_case no_auto_abbrev pass_through);
use Pod::Usage;
use Spreadsheet::WriteExcel;
my %options = ();
my $results = GetOptions (\%options,
'deseq_list=s',
'output_dir=s',
'filters=s',
'project_name=s',
'map_file=s', # optional
'help|h') || pod2usage();
# display documentation
if( $options{'help'} ) {
pod2usage( {-exitval => 0, -verbose => 2, -output => \*STDERR} );
}
# make sure parameters are correct
&check_parameters();
if( !-d $options{output_dir} ) {
print STDERR "Output directory doesn't exist. Creating...\n";
mkdir $options{output_dir};
}
$options{output_dir} = File::Spec->canonpath($options{output_dir});
my %worksheets;
my $map_info = {};
my ($file,$IN, $fh, $SA, $out, $summary_file, $summary_all, $i, $p, $stub, $sample_name, $sample1, $sample2, $total_output, $line, $workbook, $cmd, $t);
my (@vals, @arr, @parameters, @filters, @results_files, @files, @samples, @up, @down);
my %param;
my @su =();
my %outfiles = ();
my $f = 0;
open( $IN, "<", $options{deseq_list} ) or die "Error cannot open the list file";
@results_files = <$IN>;
close $IN;
if( defined $options{ 'map_file' } ) {
print STDERR "\nGetting map information of gene id and gene name\n";
$map_info = get_map_info( $options{ 'map_file' } );
}
@filters = split (/\:/,$options{'filters'});
$summary_all = $options{output_dir}."/".$options{project_name}."_summary.txt";
open($SA, ">", $summary_all) or die "Error Cannot open the summary output file";
print $SA "Filters\tSample\tUP\tDOWN\tTotal\n";
foreach $file (@results_files) {
chomp $file;
print STDERR "Processing $file...\n";
# set sample names
($i, $p, $stub) = File::Spec->splitpath($file);
($sample1, $i) = split(/\_vs\_/, $stub);
$sample2 = (split(/\./,$i))[0];
# output for up and down fc
(@files, @samples, @up, @down) = ();
for ($i = 1 ;$i <= scalar @filters; $i++) {
$total_output = $options{output_dir} . "/" . $sample1 . "_vs_" . $sample2 . "_".$i.".filtered.txt";
if (! exists $outfiles{$i}) {$outfiles{$i} = [$total_output];}
else {push (@{$outfiles{$i}}, $total_output);}
my $FH ;
open($FH, ">", $total_output) or die "Error Cannot open the output file";
push (@samples , $sample1 . "_vs_" . $sample2 . "_".$i);
push (@files , $FH);
push (@up ,0);
push (@down ,0);
}
open($fh, "<", $file );
$line = <$fh>;
chomp($line);
$t = 0 ;
if ($line =~ /ID/) {
$t = 1;
@arr = split (/\t/,$line);
foreach (@arr) {
foreach $i (@files) {
print $i "$_\t";
}
}
}
if (exists $options{'map_file'}) {
foreach $i (@files) {
print $i "gene_symbol\tgene_name";
}
}
if ($t == 1) {
foreach $i (@files) {
print $i "\n";
}
}
while (<$fh>) {
$f = 0;
chomp ($_);
@vals = split(/\t/,$_);
push (@vals,0);
push (@vals,0);
# if user mentioned map_file, we want to print name in output - Mahesh Vangala
if( $options{ 'map_file' } ) {
if( !defined $$map_info{ $vals[ 0 ] }{ 'gene_symbol' } ) {
$$map_info{ $vals[0] }{ 'gene_symbol' } = "NOT FOUND";
}
if( !defined $$map_info{ $vals[ 0 ] }{ 'gene_name' } ) {
$$map_info{ $vals[ 0 ] }{ 'gene_name' } = "NOT FOUND";
}
push (@vals , $$map_info{ $vals[ 0 ] }{ 'gene_symbol' });
push (@vals , $$map_info{ $vals[ 0 ] }{ 'gene_name' });
}
for ($i = 0; $i< scalar @filters ;$i++) {
@parameters = split (/,/,$filters[($i)]);
%param = ();
foreach $p (@parameters) {
@arr = split(/=/,$p);
$param{$arr[0]} = $arr[1];
}
if (! defined $param{'UFC'}) {
$param{'UFC'} = 1;
}
if (! defined $param{'DFC'}) {
$param{'DFC'} = -1;
}
$f = run_filter_checks(\@vals,\%param);
if ($f == 0) {
$out = $files[$i];
find_up_or_down_regulated(\@vals, $out, \%param, \$up[$i], \$down[$i]);
}
}
# report UP regulated genes in sample1 compared to sample2
}
for( $i = 0; $i < scalar @filters ;$i++) {
close $files[$i];
$p = $up[$i] + $down[$i];
next if ($p == 0);
print "$samples[$i]\tUpregulated: $up[$i]\tDownregulated: $down[$i]\tTotal: $p\n";
print $SA "$filters[$i]\t$samples[$i]\t$up[$i]\t$down[$i]\t$p\n";
}
close $fh;
}
close $SA ;
foreach (keys %outfiles) {
foreach $i (@{$outfiles{$_}}) {
$p = 0;
open ($fh , "<$i") or die "Cannot open file";
while(<$fh>) {
$p++;
last if ($p>3)
}
close $fh;
if ($p == 1) {
$cmd = "rm ". $i;
exec_command($cmd);
}
next if (! -e $i);
$cmd = "head -1 ".$i." >".$options{output_dir}."/temp.txt";
exec_command($cmd);
$cmd = "grep -v ID ".$i."| sort -k6 -g -r >>". $options{output_dir}."/temp.txt";
exec_command($cmd);
$cmd = "mv ".$options{output_dir}."/temp.txt ".$i;
exec_command($cmd);
}
}
for ($i = 1; $i <= scalar @filters; $i++) {
$workbook = Spreadsheet::WriteExcel->new($options{output_dir} . "/$options{project_name}.RNA_Seq_$i.xls");
&write_to_excel($workbook,\@{$outfiles{$i}});
}
print STDERR "\n";
###############################
#
# sample1 is up-regulated vs sample2 or down-regulated
#
sub find_up_or_down_regulated {
my ($vals, $total_out, $param, $up_reg, $down_reg) = @_;
my $i;
my $l = 2;
my $data_out = "";
if (exists $options{'map_file'}) {
$l = 4;
}
foreach ($i = 0; $i< (scalar @{$vals}) - $l ;$i++) {
$data_out.= $$vals[$i]."\t";
}
if (exists $options{'map_file'}) {
$data_out.= $$map_info{$$vals[0]}{'gene_symbol'}."\t";
$data_out.= $$map_info{$$vals[0]}{'gene_name'};
}
$data_out.= "\n";
if( $$vals[8] ) {
print $total_out $data_out;
$$up_reg ++;
}
elsif( $$vals[5] > $param->{'UFC'} ) {
print $total_out $data_out;
$$up_reg ++;
}
if( $$vals[9] ) {
print $total_out $data_out;
$$down_reg ++;
}
elsif( $$vals[5] < $param->{'DFC'} ) {
print $total_out $data_out;
$$down_reg ++;
}
}
#
# return = 1 means that the feature will be filtered out
#
sub run_filter_checks {
my $vals = shift;
my $param = shift;
my $filtered = 0;
my $nMax = 0;
# FDR cutoff not satisfied
if (exists $param->{'FDR'}) {
if( $param->{'FDR'} != 0 && $$vals[7] > $param{'FDR'} ) {
$filtered = 1;
}
}
if (exists $param->{'P'}) {
if ($$vals[6] > $param->{'P'} ) {
$filtered = 1;
}
}
# log_fc = Inf; read count for sample2 is 0 and read count for sample1 is greater than the read_count_cutoff
if( $$vals[2] == 0 && $$vals[3] > $param->{'RC'} ) {
$$vals[8] = 1;
}
# log_fc = -Inf; read count for sample1 is 0 and read count for sample2 is greater than the read_count_cutoff
if( $$vals[3] == 0 && $$vals[2] > $param->{'RC'} ) {
$$vals[9] = 1;
}
$nMax = (($$vals[3] > $$vals[2]) ? $$vals[3] : $$vals[2]);
if( $nMax < $param->{'RC'} ) {
$filtered = 1;
}
return $filtered;
}
sub write_to_excel {
my ($workbook) = shift ;
my $files = shift ;
my ($i,$cmd,$prefix,@sheets, $fh, $len, $j, $t);
my ($worksheet, $format, $format1);
my $c = 0;
foreach(@{$files}) {
($i,$i,$prefix) = File::Spec->splitpath($_);
$prefix = (split (/\./,$prefix))[0];
if (length $prefix > 31) {
$prefix = substr($prefix,0,25);
$prefix.="_".$c;
$c++;
}
push(@sheets,$prefix);
}
$format = $workbook->add_format(bold=>1,size=>14);
$format->set_num_format('00.E+00');
for($i = 0 ; $i< scalar @{$files}; $i++) {
$c = 0;
next if (! -e $$files[$i] );
$worksheet = $workbook->add_worksheet($sheets[$i]);
open($fh, "<$$files[$i]") or die "Cannot open the output txt file";
while (<$fh>) {
chomp($_);
@arr = split (/\t/, $_);
if ($_ =~ /^ID/) {
$len = chr((64 + scalar(@arr) - 3));
$worksheet->set_column("A:$len",30);
}
$t = 0;
for ($j = 0; $j< scalar @arr ; $j++) {
next if ($j == 1 || $j == 4 || $j == 8 || $j == 9);
if ($t == 4 ) {
if ($_ =~ /ID/) {
$worksheet->write($c,$t,"Abs_log_fold",$format);
}
else {
$len = abs($arr[5]);
$worksheet->write($c,$t,$len,$format);
}
$t++;
}
$worksheet->write($c,$t,$arr[$j],$format);
$t++;
}
$c++;
}
close $fh;
}
}
sub exec_command {
my $sCmd = shift;
if ((!(defined $sCmd)) || ($sCmd eq "")) {
die "\nSubroutine::exec_command : ERROR! Incorrect command!\n";
}
my $nExitCode;
print STDERR "\n$sCmd\n";
$nExitCode = system("$sCmd");
if ($nExitCode != 0) {
die "\tERROR! Command Failed!\n\t$!\n";
}
print STDERR "\n";
return;
}
sub check_parameters {
my @required = qw( deseq_list output_dir project_name );
for my $option ( @required ) {
unless ( defined $options{$option} ) {
die "--$option is a required option";
}
if (! defined $options{'filters'} ){
$options{'filters'} = "FDR=0.05,RC=10,UFC=1,DFC=-1";
}
}
}
sub get_map_info {
my( $file ) = @_;
my $info = {};
open( FH, "<$file" ) or die "Error in opening the file, $file, $!\n";
while( my $line = <FH> ) {
chomp $line;
next if( $line =~ /^\#/ );
my( $gene_id, $gene_symbol, $gene_name ) = split( "\t", $line );
$$info{ $gene_id }{ 'gene_symbol' } = $gene_symbol;
$$info{ $gene_id }{ 'gene_name' } = $gene_name;
}
close FH or die "Error in closing the file, $file, $!\n";
return $info;
}
| 23.781818 | 152 | 0.540807 |
73def4cd9afa6a7a5d79dc313dff7d826fe77856 | 94 | pl | Perl | tests/tests/test014.pl | jacobfriedman/trealla | 414f9612f15470ea5056952e3d16ab847d8f52dd | [
"MIT"
]
| null | null | null | tests/tests/test014.pl | jacobfriedman/trealla | 414f9612f15470ea5056952e3d16ab847d8f52dd | [
"MIT"
]
| null | null | null | tests/tests/test014.pl | jacobfriedman/trealla | 414f9612f15470ea5056952e3d16ab847d8f52dd | [
"MIT"
]
| null | null | null | :-initialization(main).
main :- between(1,100000,_), X=fail, ignore(X), fail.
main :- halt.
| 15.666667 | 53 | 0.648936 |
ed514aa55d2c155e27e2da53a760ec68712da9d4 | 63,277 | pl | Perl | Project_Euler/Primes/primes.sudaram.pl | perlygatekeeper/glowing-robot | 7ef5eb089f552a1de309092606c95e805e6723a0 | [
"Artistic-2.0"
]
| 2 | 2015-06-05T15:40:06.000Z | 2020-03-19T17:08:37.000Z | Project_Euler/Primes/primes.sudaram.pl | perlygatekeeper/glowing-robot | 7ef5eb089f552a1de309092606c95e805e6723a0 | [
"Artistic-2.0"
]
| null | null | null | Project_Euler/Primes/primes.sudaram.pl | perlygatekeeper/glowing-robot | 7ef5eb089f552a1de309092606c95e805e6723a0 | [
"Artistic-2.0"
]
| null | null | null | #!/usr/bin/env perl
#
# A perl script to list the first N primes>
# All primes from 2 to 99999 are stored at the end of the script>
#
$name = $0; $name =~ s'.*/''; # remove path--like basename
$usage = "usage:\n$name [MAX]";
use strict;
use warnings;
use Benchmark;
my $t0 = Benchmark->new;
my ($i, @primes, $j, $k);
my $preload = 0;
my $MAX = 100000;
if ($ARGV[0] and $ARGV[0]=~/^\d+$/) { $MAX=$ARGV[0]; shift; }
my $L=length($MAX)+1; # $L is the number of characters needed to print the biggest prime + one space delimiter
my $N=int(96/$L); # $N is the number of primes to print on a 96-character-long line----\
# | | | | | | | | | . |
# 10 20 30 40 50 60 70 80 90 100
#234567891#234567892#234567893#234567894#234567895#234567896#234567897#234567898#234567899#234567890
# we will load some number of known primes from the end of this script. This isn't necessary, as the algorithm used
# works with no pre-known primes, even 2, as the foreach loop won't be run.
# in fact, I populated the known-prime list with $name 100000 >> $name.
if ( $preload ) {
while (<DATA>) {
next if (/^$|^\s*#/); # skip blank and commented lines.
# s/^#//; # activate this line (and comment previous one) if you'd rather have the known primes on comment lines
chomp;
push(@primes,split);
last if ($primes[$#primes] > $MAX)
}
}
if ( not @primes ) { push( @primes, 2 ) }
# DO WE NEED TO LOOK FOR MORE PRIMES?\
my @a;
if ( $MAX > $primes[$#primes] ) {
$k = int(( $MAX - 2 ) / 2 );
foreach $i ( 1 .. $k ) { $a[$i] = 0; }
foreach $i ( 1 .. $k ) {
$j = $i;
while(( $i + $j + 2 * $i * $j ) <= $k) {
$a[ $i + $j + 2 * $i * $j ] = 1;
$j += 1;
}
}
foreach $i ( 1 .. $k ) {
if ( $a[$i] == 0 ) {
push(@primes, ( 2*$i + 1 ) );
}
}
}
# PRINT THEM OUT
foreach my $prime (@primes) {
last if ($prime>$MAX);
printf "%${L}d", $prime; $i++;
printf "\n" if (not ($i%$N));
}
printf "\n";
my $t1 = Benchmark->new;
my $td = timediff($t1, $t0);
printf "%d to %d.\n", $primes[0], $primes[$#primes];
printf "Found %d primes in %s.\n", $#primes, timestr($td);
printf "\n";
exit 0;
__END__
# This generator 2*N + 1 simply produces only odd numbers (50%)
# A generator based on multiples of 10 would be better.
# 10*N + 1, 10*N + 3, 10*N + 7, 10*N + 9 (40%)
# As this would skip multiples of 5 as well as even numbers, but I was lazy and didn't want to code the calculation of the first_generator
# First the generator can only be used with N >=1 so you have to preload the known-primes array with 2, 3, 5 and 7.
# Second, the first_generator would need to be modifed to give the next set of 4 prime canidates after the largest known prime in @primes
# Third, since this new generator gives us prime canidates in groups of four, and our larges known prime might have not have been the last
# member of a set of four, we will have to detect that and handle it, ie. if our largest known prime at the end of @primes is 53, then
# our first generator would be 6, giving us 61, 63, 67 and 69, but we would have not then considered 57(divisable by 3) and 59 (59 is prime).
# I then discovered the wheel method of prime seiving: https://en.wikipedia.org/wiki/Wheel_factorization.
# I relalized that a generator based on 10, is an incomplete wheel seive. Wheel seives are based on numbers which are products of the first
# few primes, so there are wheel seives based on 2, 2x3 = 6, 2x3x5 = 30, 2x3x5x7 = 210 etc.
# A wheel seive starts immediately AFTER the base number, so the wheel seive based on 30, produces the generator:
# preload primes: ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 )
# 30 * N + 1, 7, 11, 13, 17, 19, 23, 29; and test prime canidates with primes P; where P >= 7 and P < SQRT(MAX)
# this is 8 numbers of each 80 consecutive natural numbers (26.7%)
# A wheel seive based on 2x3x5x7 = 210 produces the generator:
# preload primes (below 210): ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
# 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199 )
# unlike the wheel based on 30, this wheel's innermost ring contains 5 numbers which are not eliminated but are non-the-less compound:
# 121, 143, 169, 187 and 209.
#
# 11*11 11*13 13*13 11*17 11*19 | 13*17 11*23
# 121 143 187 209 | 253
# 143 169 | 221
# 210 * N + 1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
# 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193,
# 197, 199, 209
# and test prime canidates with primes P; where P >= 11 and P < SQRT(MAX)
# this is 47 of each 210 conscutive numbers (22.4%).
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53
59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131
137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223
227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311
313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409
419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503
509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613
617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719
727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827
829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941
947 953 967 971 977 983 991 997 1009 1013 1019 1021 1031 1033 1039 1049
1051 1061 1063 1069 1087 1091 1093 1097 1103 1109 1117 1123 1129 1151 1153 1163
1171 1181 1187 1193 1201 1213 1217 1223 1229 1231 1237 1249 1259 1277 1279 1283
1289 1291 1297 1301 1303 1307 1319 1321 1327 1361 1367 1373 1381 1399 1409 1423
1427 1429 1433 1439 1447 1451 1453 1459 1471 1481 1483 1487 1489 1493 1499 1511
1523 1531 1543 1549 1553 1559 1567 1571 1579 1583 1597 1601 1607 1609 1613 1619
1621 1627 1637 1657 1663 1667 1669 1693 1697 1699 1709 1721 1723 1733 1741 1747
1753 1759 1777 1783 1787 1789 1801 1811 1823 1831 1847 1861 1867 1871 1873 1877
1879 1889 1901 1907 1913 1931 1933 1949 1951 1973 1979 1987 1993 1997 1999 2003
2011 2017 2027 2029 2039 2053 2063 2069 2081 2083 2087 2089 2099 2111 2113 2129
2131 2137 2141 2143 2153 2161 2179 2203 2207 2213 2221 2237 2239 2243 2251 2267
2269 2273 2281 2287 2293 2297 2309 2311 2333 2339 2341 2347 2351 2357 2371 2377
2381 2383 2389 2393 2399 2411 2417 2423 2437 2441 2447 2459 2467 2473 2477 2503
2521 2531 2539 2543 2549 2551 2557 2579 2591 2593 2609 2617 2621 2633 2647 2657
2659 2663 2671 2677 2683 2687 2689 2693 2699 2707 2711 2713 2719 2729 2731 2741
2749 2753 2767 2777 2789 2791 2797 2801 2803 2819 2833 2837 2843 2851 2857 2861
2879 2887 2897 2903 2909 2917 2927 2939 2953 2957 2963 2969 2971 2999 3001 3011
3019 3023 3037 3041 3049 3061 3067 3079 3083 3089 3109 3119 3121 3137 3163 3167
3169 3181 3187 3191 3203 3209 3217 3221 3229 3251 3253 3257 3259 3271 3299 3301
3307 3313 3319 3323 3329 3331 3343 3347 3359 3361 3371 3373 3389 3391 3407 3413
3433 3449 3457 3461 3463 3467 3469 3491 3499 3511 3517 3527 3529 3533 3539 3541
3547 3557 3559 3571 3581 3583 3593 3607 3613 3617 3623 3631 3637 3643 3659 3671
3673 3677 3691 3697 3701 3709 3719 3727 3733 3739 3761 3767 3769 3779 3793 3797
3803 3821 3823 3833 3847 3851 3853 3863 3877 3881 3889 3907 3911 3917 3919 3923
3929 3931 3943 3947 3967 3989 4001 4003 4007 4013 4019 4021 4027 4049 4051 4057
4073 4079 4091 4093 4099 4111 4127 4129 4133 4139 4153 4157 4159 4177 4201 4211
4217 4219 4229 4231 4241 4243 4253 4259 4261 4271 4273 4283 4289 4297 4327 4337
4339 4349 4357 4363 4373 4391 4397 4409 4421 4423 4441 4447 4451 4457 4463 4481
4483 4493 4507 4513 4517 4519 4523 4547 4549 4561 4567 4583 4591 4597 4603 4621
4637 4639 4643 4649 4651 4657 4663 4673 4679 4691 4703 4721 4723 4729 4733 4751
4759 4783 4787 4789 4793 4799 4801 4813 4817 4831 4861 4871 4877 4889 4903 4909
4919 4931 4933 4937 4943 4951 4957 4967 4969 4973 4987 4993 4999 5003 5009 5011
5021 5023 5039 5051 5059 5077 5081 5087 5099 5101 5107 5113 5119 5147 5153 5167
5171 5179 5189 5197 5209 5227 5231 5233 5237 5261 5273 5279 5281 5297 5303 5309
5323 5333 5347 5351 5381 5387 5393 5399 5407 5413 5417 5419 5431 5437 5441 5443
5449 5471 5477 5479 5483 5501 5503 5507 5519 5521 5527 5531 5557 5563 5569 5573
5581 5591 5623 5639 5641 5647 5651 5653 5657 5659 5669 5683 5689 5693 5701 5711
5717 5737 5741 5743 5749 5779 5783 5791 5801 5807 5813 5821 5827 5839 5843 5849
5851 5857 5861 5867 5869 5879 5881 5897 5903 5923 5927 5939 5953 5981 5987 6007
6011 6029 6037 6043 6047 6053 6067 6073 6079 6089 6091 6101 6113 6121 6131 6133
6143 6151 6163 6173 6197 6199 6203 6211 6217 6221 6229 6247 6257 6263 6269 6271
6277 6287 6299 6301 6311 6317 6323 6329 6337 6343 6353 6359 6361 6367 6373 6379
6389 6397 6421 6427 6449 6451 6469 6473 6481 6491 6521 6529 6547 6551 6553 6563
6569 6571 6577 6581 6599 6607 6619 6637 6653 6659 6661 6673 6679 6689 6691 6701
6703 6709 6719 6733 6737 6761 6763 6779 6781 6791 6793 6803 6823 6827 6829 6833
6841 6857 6863 6869 6871 6883 6899 6907 6911 6917 6947 6949 6959 6961 6967 6971
6977 6983 6991 6997 7001 7013 7019 7027 7039 7043 7057 7069 7079 7103 7109 7121
7127 7129 7151 7159 7177 7187 7193 7207 7211 7213 7219 7229 7237 7243 7247 7253
7283 7297 7307 7309 7321 7331 7333 7349 7351 7369 7393 7411 7417 7433 7451 7457
7459 7477 7481 7487 7489 7499 7507 7517 7523 7529 7537 7541 7547 7549 7559 7561
7573 7577 7583 7589 7591 7603 7607 7621 7639 7643 7649 7669 7673 7681 7687 7691
7699 7703 7717 7723 7727 7741 7753 7757 7759 7789 7793 7817 7823 7829 7841 7853
7867 7873 7877 7879 7883 7901 7907 7919 7927 7933 7937 7949 7951 7963 7993 8009
8011 8017 8039 8053 8059 8069 8081 8087 8089 8093 8101 8111 8117 8123 8147 8161
8167 8171 8179 8191 8209 8219 8221 8231 8233 8237 8243 8263 8269 8273 8287 8291
8293 8297 8311 8317 8329 8353 8363 8369 8377 8387 8389 8419 8423 8429 8431 8443
8447 8461 8467 8501 8513 8521 8527 8537 8539 8543 8563 8573 8581 8597 8599 8609
8623 8627 8629 8641 8647 8663 8669 8677 8681 8689 8693 8699 8707 8713 8719 8731
8737 8741 8747 8753 8761 8779 8783 8803 8807 8819 8821 8831 8837 8839 8849 8861
8863 8867 8887 8893 8923 8929 8933 8941 8951 8963 8969 8971 8999 9001 9007 9011
9013 9029 9041 9043 9049 9059 9067 9091 9103 9109 9127 9133 9137 9151 9157 9161
9173 9181 9187 9199 9203 9209 9221 9227 9239 9241 9257 9277 9281 9283 9293 9311
9319 9323 9337 9341 9343 9349 9371 9377 9391 9397 9403 9413 9419 9421 9431 9433
9437 9439 9461 9463 9467 9473 9479 9491 9497 9511 9521 9533 9539 9547 9551 9587
9601 9613 9619 9623 9629 9631 9643 9649 9661 9677 9679 9689 9697 9719 9721 9733
9739 9743 9749 9767 9769 9781 9787 9791 9803 9811 9817 9829 9833 9839 9851 9857
9859 9871 9883 9887 9901 9907 9923 9929 9931 9941 9949 9967 9973 10007 10009 10037
10039 10061 10067 10069 10079 10091 10093 10099 10103 10111 10133 10139 10141 10151 10159 10163
10169 10177 10181 10193 10211 10223 10243 10247 10253 10259 10267 10271 10273 10289 10301 10303
10313 10321 10331 10333 10337 10343 10357 10369 10391 10399 10427 10429 10433 10453 10457 10459
10463 10477 10487 10499 10501 10513 10529 10531 10559 10567 10589 10597 10601 10607 10613 10627
10631 10639 10651 10657 10663 10667 10687 10691 10709 10711 10723 10729 10733 10739 10753 10771
10781 10789 10799 10831 10837 10847 10853 10859 10861 10867 10883 10889 10891 10903 10909 10937
10939 10949 10957 10973 10979 10987 10993 11003 11027 11047 11057 11059 11069 11071 11083 11087
11093 11113 11117 11119 11131 11149 11159 11161 11171 11173 11177 11197 11213 11239 11243 11251
11257 11261 11273 11279 11287 11299 11311 11317 11321 11329 11351 11353 11369 11383 11393 11399
11411 11423 11437 11443 11447 11467 11471 11483 11489 11491 11497 11503 11519 11527 11549 11551
11579 11587 11593 11597 11617 11621 11633 11657 11677 11681 11689 11699 11701 11717 11719 11731
11743 11777 11779 11783 11789 11801 11807 11813 11821 11827 11831 11833 11839 11863 11867 11887
11897 11903 11909 11923 11927 11933 11939 11941 11953 11959 11969 11971 11981 11987 12007 12011
12037 12041 12043 12049 12071 12073 12097 12101 12107 12109 12113 12119 12143 12149 12157 12161
12163 12197 12203 12211 12227 12239 12241 12251 12253 12263 12269 12277 12281 12289 12301 12323
12329 12343 12347 12373 12377 12379 12391 12401 12409 12413 12421 12433 12437 12451 12457 12473
12479 12487 12491 12497 12503 12511 12517 12527 12539 12541 12547 12553 12569 12577 12583 12589
12601 12611 12613 12619 12637 12641 12647 12653 12659 12671 12689 12697 12703 12713 12721 12739
12743 12757 12763 12781 12791 12799 12809 12821 12823 12829 12841 12853 12889 12893 12899 12907
12911 12917 12919 12923 12941 12953 12959 12967 12973 12979 12983 13001 13003 13007 13009 13033
13037 13043 13049 13063 13093 13099 13103 13109 13121 13127 13147 13151 13159 13163 13171 13177
13183 13187 13217 13219 13229 13241 13249 13259 13267 13291 13297 13309 13313 13327 13331 13337
13339 13367 13381 13397 13399 13411 13417 13421 13441 13451 13457 13463 13469 13477 13487 13499
13513 13523 13537 13553 13567 13577 13591 13597 13613 13619 13627 13633 13649 13669 13679 13681
13687 13691 13693 13697 13709 13711 13721 13723 13729 13751 13757 13759 13763 13781 13789 13799
13807 13829 13831 13841 13859 13873 13877 13879 13883 13901 13903 13907 13913 13921 13931 13933
13963 13967 13997 13999 14009 14011 14029 14033 14051 14057 14071 14081 14083 14087 14107 14143
14149 14153 14159 14173 14177 14197 14207 14221 14243 14249 14251 14281 14293 14303 14321 14323
14327 14341 14347 14369 14387 14389 14401 14407 14411 14419 14423 14431 14437 14447 14449 14461
14479 14489 14503 14519 14533 14537 14543 14549 14551 14557 14561 14563 14591 14593 14621 14627
14629 14633 14639 14653 14657 14669 14683 14699 14713 14717 14723 14731 14737 14741 14747 14753
14759 14767 14771 14779 14783 14797 14813 14821 14827 14831 14843 14851 14867 14869 14879 14887
14891 14897 14923 14929 14939 14947 14951 14957 14969 14983 15013 15017 15031 15053 15061 15073
15077 15083 15091 15101 15107 15121 15131 15137 15139 15149 15161 15173 15187 15193 15199 15217
15227 15233 15241 15259 15263 15269 15271 15277 15287 15289 15299 15307 15313 15319 15329 15331
15349 15359 15361 15373 15377 15383 15391 15401 15413 15427 15439 15443 15451 15461 15467 15473
15493 15497 15511 15527 15541 15551 15559 15569 15581 15583 15601 15607 15619 15629 15641 15643
15647 15649 15661 15667 15671 15679 15683 15727 15731 15733 15737 15739 15749 15761 15767 15773
15787 15791 15797 15803 15809 15817 15823 15859 15877 15881 15887 15889 15901 15907 15913 15919
15923 15937 15959 15971 15973 15991 16001 16007 16033 16057 16061 16063 16067 16069 16073 16087
16091 16097 16103 16111 16127 16139 16141 16183 16187 16189 16193 16217 16223 16229 16231 16249
16253 16267 16273 16301 16319 16333 16339 16349 16361 16363 16369 16381 16411 16417 16421 16427
16433 16447 16451 16453 16477 16481 16487 16493 16519 16529 16547 16553 16561 16567 16573 16603
16607 16619 16631 16633 16649 16651 16657 16661 16673 16691 16693 16699 16703 16729 16741 16747
16759 16763 16787 16811 16823 16829 16831 16843 16871 16879 16883 16889 16901 16903 16921 16927
16931 16937 16943 16963 16979 16981 16987 16993 17011 17021 17027 17029 17033 17041 17047 17053
17077 17093 17099 17107 17117 17123 17137 17159 17167 17183 17189 17191 17203 17207 17209 17231
17239 17257 17291 17293 17299 17317 17321 17327 17333 17341 17351 17359 17377 17383 17387 17389
17393 17401 17417 17419 17431 17443 17449 17467 17471 17477 17483 17489 17491 17497 17509 17519
17539 17551 17569 17573 17579 17581 17597 17599 17609 17623 17627 17657 17659 17669 17681 17683
17707 17713 17729 17737 17747 17749 17761 17783 17789 17791 17807 17827 17837 17839 17851 17863
17881 17891 17903 17909 17911 17921 17923 17929 17939 17957 17959 17971 17977 17981 17987 17989
18013 18041 18043 18047 18049 18059 18061 18077 18089 18097 18119 18121 18127 18131 18133 18143
18149 18169 18181 18191 18199 18211 18217 18223 18229 18233 18251 18253 18257 18269 18287 18289
18301 18307 18311 18313 18329 18341 18353 18367 18371 18379 18397 18401 18413 18427 18433 18439
18443 18451 18457 18461 18481 18493 18503 18517 18521 18523 18539 18541 18553 18583 18587 18593
18617 18637 18661 18671 18679 18691 18701 18713 18719 18731 18743 18749 18757 18773 18787 18793
18797 18803 18839 18859 18869 18899 18911 18913 18917 18919 18947 18959 18973 18979 19001 19009
19013 19031 19037 19051 19069 19073 19079 19081 19087 19121 19139 19141 19157 19163 19181 19183
19207 19211 19213 19219 19231 19237 19249 19259 19267 19273 19289 19301 19309 19319 19333 19373
19379 19381 19387 19391 19403 19417 19421 19423 19427 19429 19433 19441 19447 19457 19463 19469
19471 19477 19483 19489 19501 19507 19531 19541 19543 19553 19559 19571 19577 19583 19597 19603
19609 19661 19681 19687 19697 19699 19709 19717 19727 19739 19751 19753 19759 19763 19777 19793
19801 19813 19819 19841 19843 19853 19861 19867 19889 19891 19913 19919 19927 19937 19949 19961
19963 19973 19979 19991 19993 19997 20011 20021 20023 20029 20047 20051 20063 20071 20089 20101
20107 20113 20117 20123 20129 20143 20147 20149 20161 20173 20177 20183 20201 20219 20231 20233
20249 20261 20269 20287 20297 20323 20327 20333 20341 20347 20353 20357 20359 20369 20389 20393
20399 20407 20411 20431 20441 20443 20477 20479 20483 20507 20509 20521 20533 20543 20549 20551
20563 20593 20599 20611 20627 20639 20641 20663 20681 20693 20707 20717 20719 20731 20743 20747
20749 20753 20759 20771 20773 20789 20807 20809 20849 20857 20873 20879 20887 20897 20899 20903
20921 20929 20939 20947 20959 20963 20981 20983 21001 21011 21013 21017 21019 21023 21031 21059
21061 21067 21089 21101 21107 21121 21139 21143 21149 21157 21163 21169 21179 21187 21191 21193
21211 21221 21227 21247 21269 21277 21283 21313 21317 21319 21323 21341 21347 21377 21379 21383
21391 21397 21401 21407 21419 21433 21467 21481 21487 21491 21493 21499 21503 21517 21521 21523
21529 21557 21559 21563 21569 21577 21587 21589 21599 21601 21611 21613 21617 21647 21649 21661
21673 21683 21701 21713 21727 21737 21739 21751 21757 21767 21773 21787 21799 21803 21817 21821
21839 21841 21851 21859 21863 21871 21881 21893 21911 21929 21937 21943 21961 21977 21991 21997
22003 22013 22027 22031 22037 22039 22051 22063 22067 22073 22079 22091 22093 22109 22111 22123
22129 22133 22147 22153 22157 22159 22171 22189 22193 22229 22247 22259 22271 22273 22277 22279
22283 22291 22303 22307 22343 22349 22367 22369 22381 22391 22397 22409 22433 22441 22447 22453
22469 22481 22483 22501 22511 22531 22541 22543 22549 22567 22571 22573 22613 22619 22621 22637
22639 22643 22651 22669 22679 22691 22697 22699 22709 22717 22721 22727 22739 22741 22751 22769
22777 22783 22787 22807 22811 22817 22853 22859 22861 22871 22877 22901 22907 22921 22937 22943
22961 22963 22973 22993 23003 23011 23017 23021 23027 23029 23039 23041 23053 23057 23059 23063
23071 23081 23087 23099 23117 23131 23143 23159 23167 23173 23189 23197 23201 23203 23209 23227
23251 23269 23279 23291 23293 23297 23311 23321 23327 23333 23339 23357 23369 23371 23399 23417
23431 23447 23459 23473 23497 23509 23531 23537 23539 23549 23557 23561 23563 23567 23581 23593
23599 23603 23609 23623 23627 23629 23633 23663 23669 23671 23677 23687 23689 23719 23741 23743
23747 23753 23761 23767 23773 23789 23801 23813 23819 23827 23831 23833 23857 23869 23873 23879
23887 23893 23899 23909 23911 23917 23929 23957 23971 23977 23981 23993 24001 24007 24019 24023
24029 24043 24049 24061 24071 24077 24083 24091 24097 24103 24107 24109 24113 24121 24133 24137
24151 24169 24179 24181 24197 24203 24223 24229 24239 24247 24251 24281 24317 24329 24337 24359
24371 24373 24379 24391 24407 24413 24419 24421 24439 24443 24469 24473 24481 24499 24509 24517
24527 24533 24547 24551 24571 24593 24611 24623 24631 24659 24671 24677 24683 24691 24697 24709
24733 24749 24763 24767 24781 24793 24799 24809 24821 24841 24847 24851 24859 24877 24889 24907
24917 24919 24923 24943 24953 24967 24971 24977 24979 24989 25013 25031 25033 25037 25057 25073
25087 25097 25111 25117 25121 25127 25147 25153 25163 25169 25171 25183 25189 25219 25229 25237
25243 25247 25253 25261 25301 25303 25307 25309 25321 25339 25343 25349 25357 25367 25373 25391
25409 25411 25423 25439 25447 25453 25457 25463 25469 25471 25523 25537 25541 25561 25577 25579
25583 25589 25601 25603 25609 25621 25633 25639 25643 25657 25667 25673 25679 25693 25703 25717
25733 25741 25747 25759 25763 25771 25793 25799 25801 25819 25841 25847 25849 25867 25873 25889
25903 25913 25919 25931 25933 25939 25943 25951 25969 25981 25997 25999 26003 26017 26021 26029
26041 26053 26083 26099 26107 26111 26113 26119 26141 26153 26161 26171 26177 26183 26189 26203
26209 26227 26237 26249 26251 26261 26263 26267 26293 26297 26309 26317 26321 26339 26347 26357
26371 26387 26393 26399 26407 26417 26423 26431 26437 26449 26459 26479 26489 26497 26501 26513
26539 26557 26561 26573 26591 26597 26627 26633 26641 26647 26669 26681 26683 26687 26693 26699
26701 26711 26713 26717 26723 26729 26731 26737 26759 26777 26783 26801 26813 26821 26833 26839
26849 26861 26863 26879 26881 26891 26893 26903 26921 26927 26947 26951 26953 26959 26981 26987
26993 27011 27017 27031 27043 27059 27061 27067 27073 27077 27091 27103 27107 27109 27127 27143
27179 27191 27197 27211 27239 27241 27253 27259 27271 27277 27281 27283 27299 27329 27337 27361
27367 27397 27407 27409 27427 27431 27437 27449 27457 27479 27481 27487 27509 27527 27529 27539
27541 27551 27581 27583 27611 27617 27631 27647 27653 27673 27689 27691 27697 27701 27733 27737
27739 27743 27749 27751 27763 27767 27773 27779 27791 27793 27799 27803 27809 27817 27823 27827
27847 27851 27883 27893 27901 27917 27919 27941 27943 27947 27953 27961 27967 27983 27997 28001
28019 28027 28031 28051 28057 28069 28081 28087 28097 28099 28109 28111 28123 28151 28163 28181
28183 28201 28211 28219 28229 28277 28279 28283 28289 28297 28307 28309 28319 28349 28351 28387
28393 28403 28409 28411 28429 28433 28439 28447 28463 28477 28493 28499 28513 28517 28537 28541
28547 28549 28559 28571 28573 28579 28591 28597 28603 28607 28619 28621 28627 28631 28643 28649
28657 28661 28663 28669 28687 28697 28703 28711 28723 28729 28751 28753 28759 28771 28789 28793
28807 28813 28817 28837 28843 28859 28867 28871 28879 28901 28909 28921 28927 28933 28949 28961
28979 29009 29017 29021 29023 29027 29033 29059 29063 29077 29101 29123 29129 29131 29137 29147
29153 29167 29173 29179 29191 29201 29207 29209 29221 29231 29243 29251 29269 29287 29297 29303
29311 29327 29333 29339 29347 29363 29383 29387 29389 29399 29401 29411 29423 29429 29437 29443
29453 29473 29483 29501 29527 29531 29537 29567 29569 29573 29581 29587 29599 29611 29629 29633
29641 29663 29669 29671 29683 29717 29723 29741 29753 29759 29761 29789 29803 29819 29833 29837
29851 29863 29867 29873 29879 29881 29917 29921 29927 29947 29959 29983 29989 30011 30013 30029
30047 30059 30071 30089 30091 30097 30103 30109 30113 30119 30133 30137 30139 30161 30169 30181
30187 30197 30203 30211 30223 30241 30253 30259 30269 30271 30293 30307 30313 30319 30323 30341
30347 30367 30389 30391 30403 30427 30431 30449 30467 30469 30491 30493 30497 30509 30517 30529
30539 30553 30557 30559 30577 30593 30631 30637 30643 30649 30661 30671 30677 30689 30697 30703
30707 30713 30727 30757 30763 30773 30781 30803 30809 30817 30829 30839 30841 30851 30853 30859
30869 30871 30881 30893 30911 30931 30937 30941 30949 30971 30977 30983 31013 31019 31033 31039
31051 31063 31069 31079 31081 31091 31121 31123 31139 31147 31151 31153 31159 31177 31181 31183
31189 31193 31219 31223 31231 31237 31247 31249 31253 31259 31267 31271 31277 31307 31319 31321
31327 31333 31337 31357 31379 31387 31391 31393 31397 31469 31477 31481 31489 31511 31513 31517
31531 31541 31543 31547 31567 31573 31583 31601 31607 31627 31643 31649 31657 31663 31667 31687
31699 31721 31723 31727 31729 31741 31751 31769 31771 31793 31799 31817 31847 31849 31859 31873
31883 31891 31907 31957 31963 31973 31981 31991 32003 32009 32027 32029 32051 32057 32059 32063
32069 32077 32083 32089 32099 32117 32119 32141 32143 32159 32173 32183 32189 32191 32203 32213
32233 32237 32251 32257 32261 32297 32299 32303 32309 32321 32323 32327 32341 32353 32359 32363
32369 32371 32377 32381 32401 32411 32413 32423 32429 32441 32443 32467 32479 32491 32497 32503
32507 32531 32533 32537 32561 32563 32569 32573 32579 32587 32603 32609 32611 32621 32633 32647
32653 32687 32693 32707 32713 32717 32719 32749 32771 32779 32783 32789 32797 32801 32803 32831
32833 32839 32843 32869 32887 32909 32911 32917 32933 32939 32941 32957 32969 32971 32983 32987
32993 32999 33013 33023 33029 33037 33049 33053 33071 33073 33083 33091 33107 33113 33119 33149
33151 33161 33179 33181 33191 33199 33203 33211 33223 33247 33287 33289 33301 33311 33317 33329
33331 33343 33347 33349 33353 33359 33377 33391 33403 33409 33413 33427 33457 33461 33469 33479
33487 33493 33503 33521 33529 33533 33547 33563 33569 33577 33581 33587 33589 33599 33601 33613
33617 33619 33623 33629 33637 33641 33647 33679 33703 33713 33721 33739 33749 33751 33757 33767
33769 33773 33791 33797 33809 33811 33827 33829 33851 33857 33863 33871 33889 33893 33911 33923
33931 33937 33941 33961 33967 33997 34019 34031 34033 34039 34057 34061 34123 34127 34129 34141
34147 34157 34159 34171 34183 34211 34213 34217 34231 34253 34259 34261 34267 34273 34283 34297
34301 34303 34313 34319 34327 34337 34351 34361 34367 34369 34381 34403 34421 34429 34439 34457
34469 34471 34483 34487 34499 34501 34511 34513 34519 34537 34543 34549 34583 34589 34591 34603
34607 34613 34631 34649 34651 34667 34673 34679 34687 34693 34703 34721 34729 34739 34747 34757
34759 34763 34781 34807 34819 34841 34843 34847 34849 34871 34877 34883 34897 34913 34919 34939
34949 34961 34963 34981 35023 35027 35051 35053 35059 35069 35081 35083 35089 35099 35107 35111
35117 35129 35141 35149 35153 35159 35171 35201 35221 35227 35251 35257 35267 35279 35281 35291
35311 35317 35323 35327 35339 35353 35363 35381 35393 35401 35407 35419 35423 35437 35447 35449
35461 35491 35507 35509 35521 35527 35531 35533 35537 35543 35569 35573 35591 35593 35597 35603
35617 35671 35677 35729 35731 35747 35753 35759 35771 35797 35801 35803 35809 35831 35837 35839
35851 35863 35869 35879 35897 35899 35911 35923 35933 35951 35963 35969 35977 35983 35993 35999
36007 36011 36013 36017 36037 36061 36067 36073 36083 36097 36107 36109 36131 36137 36151 36161
36187 36191 36209 36217 36229 36241 36251 36263 36269 36277 36293 36299 36307 36313 36319 36341
36343 36353 36373 36383 36389 36433 36451 36457 36467 36469 36473 36479 36493 36497 36523 36527
36529 36541 36551 36559 36563 36571 36583 36587 36599 36607 36629 36637 36643 36653 36671 36677
36683 36691 36697 36709 36713 36721 36739 36749 36761 36767 36779 36781 36787 36791 36793 36809
36821 36833 36847 36857 36871 36877 36887 36899 36901 36913 36919 36923 36929 36931 36943 36947
36973 36979 36997 37003 37013 37019 37021 37039 37049 37057 37061 37087 37097 37117 37123 37139
37159 37171 37181 37189 37199 37201 37217 37223 37243 37253 37273 37277 37307 37309 37313 37321
37337 37339 37357 37361 37363 37369 37379 37397 37409 37423 37441 37447 37463 37483 37489 37493
37501 37507 37511 37517 37529 37537 37547 37549 37561 37567 37571 37573 37579 37589 37591 37607
37619 37633 37643 37649 37657 37663 37691 37693 37699 37717 37747 37781 37783 37799 37811 37813
37831 37847 37853 37861 37871 37879 37889 37897 37907 37951 37957 37963 37967 37987 37991 37993
37997 38011 38039 38047 38053 38069 38083 38113 38119 38149 38153 38167 38177 38183 38189 38197
38201 38219 38231 38237 38239 38261 38273 38281 38287 38299 38303 38317 38321 38327 38329 38333
38351 38371 38377 38393 38431 38447 38449 38453 38459 38461 38501 38543 38557 38561 38567 38569
38593 38603 38609 38611 38629 38639 38651 38653 38669 38671 38677 38693 38699 38707 38711 38713
38723 38729 38737 38747 38749 38767 38783 38791 38803 38821 38833 38839 38851 38861 38867 38873
38891 38903 38917 38921 38923 38933 38953 38959 38971 38977 38993 39019 39023 39041 39043 39047
39079 39089 39097 39103 39107 39113 39119 39133 39139 39157 39161 39163 39181 39191 39199 39209
39217 39227 39229 39233 39239 39241 39251 39293 39301 39313 39317 39323 39341 39343 39359 39367
39371 39373 39383 39397 39409 39419 39439 39443 39451 39461 39499 39503 39509 39511 39521 39541
39551 39563 39569 39581 39607 39619 39623 39631 39659 39667 39671 39679 39703 39709 39719 39727
39733 39749 39761 39769 39779 39791 39799 39821 39827 39829 39839 39841 39847 39857 39863 39869
39877 39883 39887 39901 39929 39937 39953 39971 39979 39983 39989 40009 40013 40031 40037 40039
40063 40087 40093 40099 40111 40123 40127 40129 40151 40153 40163 40169 40177 40189 40193 40213
40231 40237 40241 40253 40277 40283 40289 40343 40351 40357 40361 40387 40423 40427 40429 40433
40459 40471 40483 40487 40493 40499 40507 40519 40529 40531 40543 40559 40577 40583 40591 40597
40609 40627 40637 40639 40693 40697 40699 40709 40739 40751 40759 40763 40771 40787 40801 40813
40819 40823 40829 40841 40847 40849 40853 40867 40879 40883 40897 40903 40927 40933 40939 40949
40961 40973 40993 41011 41017 41023 41039 41047 41051 41057 41077 41081 41113 41117 41131 41141
41143 41149 41161 41177 41179 41183 41189 41201 41203 41213 41221 41227 41231 41233 41243 41257
41263 41269 41281 41299 41333 41341 41351 41357 41381 41387 41389 41399 41411 41413 41443 41453
41467 41479 41491 41507 41513 41519 41521 41539 41543 41549 41579 41593 41597 41603 41609 41611
41617 41621 41627 41641 41647 41651 41659 41669 41681 41687 41719 41729 41737 41759 41761 41771
41777 41801 41809 41813 41843 41849 41851 41863 41879 41887 41893 41897 41903 41911 41927 41941
41947 41953 41957 41959 41969 41981 41983 41999 42013 42017 42019 42023 42043 42061 42071 42073
42083 42089 42101 42131 42139 42157 42169 42179 42181 42187 42193 42197 42209 42221 42223 42227
42239 42257 42281 42283 42293 42299 42307 42323 42331 42337 42349 42359 42373 42379 42391 42397
42403 42407 42409 42433 42437 42443 42451 42457 42461 42463 42467 42473 42487 42491 42499 42509
42533 42557 42569 42571 42577 42589 42611 42641 42643 42649 42667 42677 42683 42689 42697 42701
42703 42709 42719 42727 42737 42743 42751 42767 42773 42787 42793 42797 42821 42829 42839 42841
42853 42859 42863 42899 42901 42923 42929 42937 42943 42953 42961 42967 42979 42989 43003 43013
43019 43037 43049 43051 43063 43067 43093 43103 43117 43133 43151 43159 43177 43189 43201 43207
43223 43237 43261 43271 43283 43291 43313 43319 43321 43331 43391 43397 43399 43403 43411 43427
43441 43451 43457 43481 43487 43499 43517 43541 43543 43573 43577 43579 43591 43597 43607 43609
43613 43627 43633 43649 43651 43661 43669 43691 43711 43717 43721 43753 43759 43777 43781 43783
43787 43789 43793 43801 43853 43867 43889 43891 43913 43933 43943 43951 43961 43963 43969 43973
43987 43991 43997 44017 44021 44027 44029 44041 44053 44059 44071 44087 44089 44101 44111 44119
44123 44129 44131 44159 44171 44179 44189 44201 44203 44207 44221 44249 44257 44263 44267 44269
44273 44279 44281 44293 44351 44357 44371 44381 44383 44389 44417 44449 44453 44483 44491 44497
44501 44507 44519 44531 44533 44537 44543 44549 44563 44579 44587 44617 44621 44623 44633 44641
44647 44651 44657 44683 44687 44699 44701 44711 44729 44741 44753 44771 44773 44777 44789 44797
44809 44819 44839 44843 44851 44867 44879 44887 44893 44909 44917 44927 44939 44953 44959 44963
44971 44983 44987 45007 45013 45053 45061 45077 45083 45119 45121 45127 45131 45137 45139 45161
45179 45181 45191 45197 45233 45247 45259 45263 45281 45289 45293 45307 45317 45319 45329 45337
45341 45343 45361 45377 45389 45403 45413 45427 45433 45439 45481 45491 45497 45503 45523 45533
45541 45553 45557 45569 45587 45589 45599 45613 45631 45641 45659 45667 45673 45677 45691 45697
45707 45737 45751 45757 45763 45767 45779 45817 45821 45823 45827 45833 45841 45853 45863 45869
45887 45893 45943 45949 45953 45959 45971 45979 45989 46021 46027 46049 46051 46061 46073 46091
46093 46099 46103 46133 46141 46147 46153 46171 46181 46183 46187 46199 46219 46229 46237 46261
46271 46273 46279 46301 46307 46309 46327 46337 46349 46351 46381 46399 46411 46439 46441 46447
46451 46457 46471 46477 46489 46499 46507 46511 46523 46549 46559 46567 46573 46589 46591 46601
46619 46633 46639 46643 46649 46663 46679 46681 46687 46691 46703 46723 46727 46747 46751 46757
46769 46771 46807 46811 46817 46819 46829 46831 46853 46861 46867 46877 46889 46901 46919 46933
46957 46993 46997 47017 47041 47051 47057 47059 47087 47093 47111 47119 47123 47129 47137 47143
47147 47149 47161 47189 47207 47221 47237 47251 47269 47279 47287 47293 47297 47303 47309 47317
47339 47351 47353 47363 47381 47387 47389 47407 47417 47419 47431 47441 47459 47491 47497 47501
47507 47513 47521 47527 47533 47543 47563 47569 47581 47591 47599 47609 47623 47629 47639 47653
47657 47659 47681 47699 47701 47711 47713 47717 47737 47741 47743 47777 47779 47791 47797 47807
47809 47819 47837 47843 47857 47869 47881 47903 47911 47917 47933 47939 47947 47951 47963 47969
47977 47981 48017 48023 48029 48049 48073 48079 48091 48109 48119 48121 48131 48157 48163 48179
48187 48193 48197 48221 48239 48247 48259 48271 48281 48299 48311 48313 48337 48341 48353 48371
48383 48397 48407 48409 48413 48437 48449 48463 48473 48479 48481 48487 48491 48497 48523 48527
48533 48539 48541 48563 48571 48589 48593 48611 48619 48623 48647 48649 48661 48673 48677 48679
48731 48733 48751 48757 48761 48767 48779 48781 48787 48799 48809 48817 48821 48823 48847 48857
48859 48869 48871 48883 48889 48907 48947 48953 48973 48989 48991 49003 49009 49019 49031 49033
49037 49043 49057 49069 49081 49103 49109 49117 49121 49123 49139 49157 49169 49171 49177 49193
49199 49201 49207 49211 49223 49253 49261 49277 49279 49297 49307 49331 49333 49339 49363 49367
49369 49391 49393 49409 49411 49417 49429 49433 49451 49459 49463 49477 49481 49499 49523 49529
49531 49537 49547 49549 49559 49597 49603 49613 49627 49633 49639 49663 49667 49669 49681 49697
49711 49727 49739 49741 49747 49757 49783 49787 49789 49801 49807 49811 49823 49831 49843 49853
49871 49877 49891 49919 49921 49927 49937 49939 49943 49957 49991 49993 49999 50021 50023 50033
50047 50051 50053 50069 50077 50087 50093 50101 50111 50119 50123 50129 50131 50147 50153 50159
50177 50207 50221 50227 50231 50261 50263 50273 50287 50291 50311 50321 50329 50333 50341 50359
50363 50377 50383 50387 50411 50417 50423 50441 50459 50461 50497 50503 50513 50527 50539 50543
50549 50551 50581 50587 50591 50593 50599 50627 50647 50651 50671 50683 50707 50723 50741 50753
50767 50773 50777 50789 50821 50833 50839 50849 50857 50867 50873 50891 50893 50909 50923 50929
50951 50957 50969 50971 50989 50993 51001 51031 51043 51047 51059 51061 51071 51109 51131 51133
51137 51151 51157 51169 51193 51197 51199 51203 51217 51229 51239 51241 51257 51263 51283 51287
51307 51329 51341 51343 51347 51349 51361 51383 51407 51413 51419 51421 51427 51431 51437 51439
51449 51461 51473 51479 51481 51487 51503 51511 51517 51521 51539 51551 51563 51577 51581 51593
51599 51607 51613 51631 51637 51647 51659 51673 51679 51683 51691 51713 51719 51721 51749 51767
51769 51787 51797 51803 51817 51827 51829 51839 51853 51859 51869 51871 51893 51899 51907 51913
51929 51941 51949 51971 51973 51977 51991 52009 52021 52027 52051 52057 52067 52069 52081 52103
52121 52127 52147 52153 52163 52177 52181 52183 52189 52201 52223 52237 52249 52253 52259 52267
52289 52291 52301 52313 52321 52361 52363 52369 52379 52387 52391 52433 52453 52457 52489 52501
52511 52517 52529 52541 52543 52553 52561 52567 52571 52579 52583 52609 52627 52631 52639 52667
52673 52691 52697 52709 52711 52721 52727 52733 52747 52757 52769 52783 52807 52813 52817 52837
52859 52861 52879 52883 52889 52901 52903 52919 52937 52951 52957 52963 52967 52973 52981 52999
53003 53017 53047 53051 53069 53077 53087 53089 53093 53101 53113 53117 53129 53147 53149 53161
53171 53173 53189 53197 53201 53231 53233 53239 53267 53269 53279 53281 53299 53309 53323 53327
53353 53359 53377 53381 53401 53407 53411 53419 53437 53441 53453 53479 53503 53507 53527 53549
53551 53569 53591 53593 53597 53609 53611 53617 53623 53629 53633 53639 53653 53657 53681 53693
53699 53717 53719 53731 53759 53773 53777 53783 53791 53813 53819 53831 53849 53857 53861 53881
53887 53891 53897 53899 53917 53923 53927 53939 53951 53959 53987 53993 54001 54011 54013 54037
54049 54059 54083 54091 54101 54121 54133 54139 54151 54163 54167 54181 54193 54217 54251 54269
54277 54287 54293 54311 54319 54323 54331 54347 54361 54367 54371 54377 54401 54403 54409 54413
54419 54421 54437 54443 54449 54469 54493 54497 54499 54503 54517 54521 54539 54541 54547 54559
54563 54577 54581 54583 54601 54617 54623 54629 54631 54647 54667 54673 54679 54709 54713 54721
54727 54751 54767 54773 54779 54787 54799 54829 54833 54851 54869 54877 54881 54907 54917 54919
54941 54949 54959 54973 54979 54983 55001 55009 55021 55049 55051 55057 55061 55073 55079 55103
55109 55117 55127 55147 55163 55171 55201 55207 55213 55217 55219 55229 55243 55249 55259 55291
55313 55331 55333 55337 55339 55343 55351 55373 55381 55399 55411 55439 55441 55457 55469 55487
55501 55511 55529 55541 55547 55579 55589 55603 55609 55619 55621 55631 55633 55639 55661 55663
55667 55673 55681 55691 55697 55711 55717 55721 55733 55763 55787 55793 55799 55807 55813 55817
55819 55823 55829 55837 55843 55849 55871 55889 55897 55901 55903 55921 55927 55931 55933 55949
55967 55987 55997 56003 56009 56039 56041 56053 56081 56087 56093 56099 56101 56113 56123 56131
56149 56167 56171 56179 56197 56207 56209 56237 56239 56249 56263 56267 56269 56299 56311 56333
56359 56369 56377 56383 56393 56401 56417 56431 56437 56443 56453 56467 56473 56477 56479 56489
56501 56503 56509 56519 56527 56531 56533 56543 56569 56591 56597 56599 56611 56629 56633 56659
56663 56671 56681 56687 56701 56711 56713 56731 56737 56747 56767 56773 56779 56783 56807 56809
56813 56821 56827 56843 56857 56873 56891 56893 56897 56909 56911 56921 56923 56929 56941 56951
56957 56963 56983 56989 56993 56999 57037 57041 57047 57059 57073 57077 57089 57097 57107 57119
57131 57139 57143 57149 57163 57173 57179 57191 57193 57203 57221 57223 57241 57251 57259 57269
57271 57283 57287 57301 57329 57331 57347 57349 57367 57373 57383 57389 57397 57413 57427 57457
57467 57487 57493 57503 57527 57529 57557 57559 57571 57587 57593 57601 57637 57641 57649 57653
57667 57679 57689 57697 57709 57713 57719 57727 57731 57737 57751 57773 57781 57787 57791 57793
57803 57809 57829 57839 57847 57853 57859 57881 57899 57901 57917 57923 57943 57947 57973 57977
57991 58013 58027 58031 58043 58049 58057 58061 58067 58073 58099 58109 58111 58129 58147 58151
58153 58169 58171 58189 58193 58199 58207 58211 58217 58229 58231 58237 58243 58271 58309 58313
58321 58337 58363 58367 58369 58379 58391 58393 58403 58411 58417 58427 58439 58441 58451 58453
58477 58481 58511 58537 58543 58549 58567 58573 58579 58601 58603 58613 58631 58657 58661 58679
58687 58693 58699 58711 58727 58733 58741 58757 58763 58771 58787 58789 58831 58889 58897 58901
58907 58909 58913 58921 58937 58943 58963 58967 58979 58991 58997 59009 59011 59021 59023 59029
59051 59053 59063 59069 59077 59083 59093 59107 59113 59119 59123 59141 59149 59159 59167 59183
59197 59207 59209 59219 59221 59233 59239 59243 59263 59273 59281 59333 59341 59351 59357 59359
59369 59377 59387 59393 59399 59407 59417 59419 59441 59443 59447 59453 59467 59471 59473 59497
59509 59513 59539 59557 59561 59567 59581 59611 59617 59621 59627 59629 59651 59659 59663 59669
59671 59693 59699 59707 59723 59729 59743 59747 59753 59771 59779 59791 59797 59809 59833 59863
59879 59887 59921 59929 59951 59957 59971 59981 59999 60013 60017 60029 60037 60041 60077 60083
60089 60091 60101 60103 60107 60127 60133 60139 60149 60161 60167 60169 60209 60217 60223 60251
60257 60259 60271 60289 60293 60317 60331 60337 60343 60353 60373 60383 60397 60413 60427 60443
60449 60457 60493 60497 60509 60521 60527 60539 60589 60601 60607 60611 60617 60623 60631 60637
60647 60649 60659 60661 60679 60689 60703 60719 60727 60733 60737 60757 60761 60763 60773 60779
60793 60811 60821 60859 60869 60887 60889 60899 60901 60913 60917 60919 60923 60937 60943 60953
60961 61001 61007 61027 61031 61043 61051 61057 61091 61099 61121 61129 61141 61151 61153 61169
61211 61223 61231 61253 61261 61283 61291 61297 61331 61333 61339 61343 61357 61363 61379 61381
61403 61409 61417 61441 61463 61469 61471 61483 61487 61493 61507 61511 61519 61543 61547 61553
61559 61561 61583 61603 61609 61613 61627 61631 61637 61643 61651 61657 61667 61673 61681 61687
61703 61717 61723 61729 61751 61757 61781 61813 61819 61837 61843 61861 61871 61879 61909 61927
61933 61949 61961 61967 61979 61981 61987 61991 62003 62011 62017 62039 62047 62053 62057 62071
62081 62099 62119 62129 62131 62137 62141 62143 62171 62189 62191 62201 62207 62213 62219 62233
62273 62297 62299 62303 62311 62323 62327 62347 62351 62383 62401 62417 62423 62459 62467 62473
62477 62483 62497 62501 62507 62533 62539 62549 62563 62581 62591 62597 62603 62617 62627 62633
62639 62653 62659 62683 62687 62701 62723 62731 62743 62753 62761 62773 62791 62801 62819 62827
62851 62861 62869 62873 62897 62903 62921 62927 62929 62939 62969 62971 62981 62983 62987 62989
63029 63031 63059 63067 63073 63079 63097 63103 63113 63127 63131 63149 63179 63197 63199 63211
63241 63247 63277 63281 63299 63311 63313 63317 63331 63337 63347 63353 63361 63367 63377 63389
63391 63397 63409 63419 63421 63439 63443 63463 63467 63473 63487 63493 63499 63521 63527 63533
63541 63559 63577 63587 63589 63599 63601 63607 63611 63617 63629 63647 63649 63659 63667 63671
63689 63691 63697 63703 63709 63719 63727 63737 63743 63761 63773 63781 63793 63799 63803 63809
63823 63839 63841 63853 63857 63863 63901 63907 63913 63929 63949 63977 63997 64007 64013 64019
64033 64037 64063 64067 64081 64091 64109 64123 64151 64153 64157 64171 64187 64189 64217 64223
64231 64237 64271 64279 64283 64301 64303 64319 64327 64333 64373 64381 64399 64403 64433 64439
64451 64453 64483 64489 64499 64513 64553 64567 64577 64579 64591 64601 64609 64613 64621 64627
64633 64661 64663 64667 64679 64693 64709 64717 64747 64763 64781 64783 64793 64811 64817 64849
64853 64871 64877 64879 64891 64901 64919 64921 64927 64937 64951 64969 64997 65003 65011 65027
65029 65033 65053 65063 65071 65089 65099 65101 65111 65119 65123 65129 65141 65147 65167 65171
65173 65179 65183 65203 65213 65239 65257 65267 65269 65287 65293 65309 65323 65327 65353 65357
65371 65381 65393 65407 65413 65419 65423 65437 65447 65449 65479 65497 65519 65521 65537 65539
65543 65551 65557 65563 65579 65581 65587 65599 65609 65617 65629 65633 65647 65651 65657 65677
65687 65699 65701 65707 65713 65717 65719 65729 65731 65761 65777 65789 65809 65827 65831 65837
65839 65843 65851 65867 65881 65899 65921 65927 65929 65951 65957 65963 65981 65983 65993 66029
66037 66041 66047 66067 66071 66083 66089 66103 66107 66109 66137 66161 66169 66173 66179 66191
66221 66239 66271 66293 66301 66337 66343 66347 66359 66361 66373 66377 66383 66403 66413 66431
66449 66457 66463 66467 66491 66499 66509 66523 66529 66533 66541 66553 66569 66571 66587 66593
66601 66617 66629 66643 66653 66683 66697 66701 66713 66721 66733 66739 66749 66751 66763 66791
66797 66809 66821 66841 66851 66853 66863 66877 66883 66889 66919 66923 66931 66943 66947 66949
66959 66973 66977 67003 67021 67033 67043 67049 67057 67061 67073 67079 67103 67121 67129 67139
67141 67153 67157 67169 67181 67187 67189 67211 67213 67217 67219 67231 67247 67261 67271 67273
67289 67307 67339 67343 67349 67369 67391 67399 67409 67411 67421 67427 67429 67433 67447 67453
67477 67481 67489 67493 67499 67511 67523 67531 67537 67547 67559 67567 67577 67579 67589 67601
67607 67619 67631 67651 67679 67699 67709 67723 67733 67741 67751 67757 67759 67763 67777 67783
67789 67801 67807 67819 67829 67843 67853 67867 67883 67891 67901 67927 67931 67933 67939 67943
67957 67961 67967 67979 67987 67993 68023 68041 68053 68059 68071 68087 68099 68111 68113 68141
68147 68161 68171 68207 68209 68213 68219 68227 68239 68261 68279 68281 68311 68329 68351 68371
68389 68399 68437 68443 68447 68449 68473 68477 68483 68489 68491 68501 68507 68521 68531 68539
68543 68567 68581 68597 68611 68633 68639 68659 68669 68683 68687 68699 68711 68713 68729 68737
68743 68749 68767 68771 68777 68791 68813 68819 68821 68863 68879 68881 68891 68897 68899 68903
68909 68917 68927 68947 68963 68993 69001 69011 69019 69029 69031 69061 69067 69073 69109 69119
69127 69143 69149 69151 69163 69191 69193 69197 69203 69221 69233 69239 69247 69257 69259 69263
69313 69317 69337 69341 69371 69379 69383 69389 69401 69403 69427 69431 69439 69457 69463 69467
69473 69481 69491 69493 69497 69499 69539 69557 69593 69623 69653 69661 69677 69691 69697 69709
69737 69739 69761 69763 69767 69779 69809 69821 69827 69829 69833 69847 69857 69859 69877 69899
69911 69929 69931 69941 69959 69991 69997 70001 70003 70009 70019 70039 70051 70061 70067 70079
70099 70111 70117 70121 70123 70139 70141 70157 70163 70177 70181 70183 70199 70201 70207 70223
70229 70237 70241 70249 70271 70289 70297 70309 70313 70321 70327 70351 70373 70379 70381 70393
70423 70429 70439 70451 70457 70459 70481 70487 70489 70501 70507 70529 70537 70549 70571 70573
70583 70589 70607 70619 70621 70627 70639 70657 70663 70667 70687 70709 70717 70729 70753 70769
70783 70793 70823 70841 70843 70849 70853 70867 70877 70879 70891 70901 70913 70919 70921 70937
70949 70951 70957 70969 70979 70981 70991 70997 70999 71011 71023 71039 71059 71069 71081 71089
71119 71129 71143 71147 71153 71161 71167 71171 71191 71209 71233 71237 71249 71257 71261 71263
71287 71293 71317 71327 71329 71333 71339 71341 71347 71353 71359 71363 71387 71389 71399 71411
71413 71419 71429 71437 71443 71453 71471 71473 71479 71483 71503 71527 71537 71549 71551 71563
71569 71593 71597 71633 71647 71663 71671 71693 71699 71707 71711 71713 71719 71741 71761 71777
71789 71807 71809 71821 71837 71843 71849 71861 71867 71879 71881 71887 71899 71909 71917 71933
71941 71947 71963 71971 71983 71987 71993 71999 72019 72031 72043 72047 72053 72073 72077 72089
72091 72101 72103 72109 72139 72161 72167 72169 72173 72211 72221 72223 72227 72229 72251 72253
72269 72271 72277 72287 72307 72313 72337 72341 72353 72367 72379 72383 72421 72431 72461 72467
72469 72481 72493 72497 72503 72533 72547 72551 72559 72577 72613 72617 72623 72643 72647 72649
72661 72671 72673 72679 72689 72701 72707 72719 72727 72733 72739 72763 72767 72797 72817 72823
72859 72869 72871 72883 72889 72893 72901 72907 72911 72923 72931 72937 72949 72953 72959 72973
72977 72997 73009 73013 73019 73037 73039 73043 73061 73063 73079 73091 73121 73127 73133 73141
73181 73189 73237 73243 73259 73277 73291 73303 73309 73327 73331 73351 73361 73363 73369 73379
73387 73417 73421 73433 73453 73459 73471 73477 73483 73517 73523 73529 73547 73553 73561 73571
73583 73589 73597 73607 73609 73613 73637 73643 73651 73673 73679 73681 73693 73699 73709 73721
73727 73751 73757 73771 73783 73819 73823 73847 73849 73859 73867 73877 73883 73897 73907 73939
73943 73951 73961 73973 73999 74017 74021 74027 74047 74051 74071 74077 74093 74099 74101 74131
74143 74149 74159 74161 74167 74177 74189 74197 74201 74203 74209 74219 74231 74257 74279 74287
74293 74297 74311 74317 74323 74353 74357 74363 74377 74381 74383 74411 74413 74419 74441 74449
74453 74471 74489 74507 74509 74521 74527 74531 74551 74561 74567 74573 74587 74597 74609 74611
74623 74653 74687 74699 74707 74713 74717 74719 74729 74731 74747 74759 74761 74771 74779 74797
74821 74827 74831 74843 74857 74861 74869 74873 74887 74891 74897 74903 74923 74929 74933 74941
74959 75011 75013 75017 75029 75037 75041 75079 75083 75109 75133 75149 75161 75167 75169 75181
75193 75209 75211 75217 75223 75227 75239 75253 75269 75277 75289 75307 75323 75329 75337 75347
75353 75367 75377 75389 75391 75401 75403 75407 75431 75437 75479 75503 75511 75521 75527 75533
75539 75541 75553 75557 75571 75577 75583 75611 75617 75619 75629 75641 75653 75659 75679 75683
75689 75703 75707 75709 75721 75731 75743 75767 75773 75781 75787 75793 75797 75821 75833 75853
75869 75883 75913 75931 75937 75941 75967 75979 75983 75989 75991 75997 76001 76003 76031 76039
76079 76081 76091 76099 76103 76123 76129 76147 76157 76159 76163 76207 76213 76231 76243 76249
76253 76259 76261 76283 76289 76303 76333 76343 76367 76369 76379 76387 76403 76421 76423 76441
76463 76471 76481 76487 76493 76507 76511 76519 76537 76541 76543 76561 76579 76597 76603 76607
76631 76649 76651 76667 76673 76679 76697 76717 76733 76753 76757 76771 76777 76781 76801 76819
76829 76831 76837 76847 76871 76873 76883 76907 76913 76919 76943 76949 76961 76963 76991 77003
77017 77023 77029 77041 77047 77069 77081 77093 77101 77137 77141 77153 77167 77171 77191 77201
77213 77237 77239 77243 77249 77261 77263 77267 77269 77279 77291 77317 77323 77339 77347 77351
77359 77369 77377 77383 77417 77419 77431 77447 77471 77477 77479 77489 77491 77509 77513 77521
77527 77543 77549 77551 77557 77563 77569 77573 77587 77591 77611 77617 77621 77641 77647 77659
77681 77687 77689 77699 77711 77713 77719 77723 77731 77743 77747 77761 77773 77783 77797 77801
77813 77839 77849 77863 77867 77893 77899 77929 77933 77951 77969 77977 77983 77999 78007 78017
78031 78041 78049 78059 78079 78101 78121 78137 78139 78157 78163 78167 78173 78179 78191 78193
78203 78229 78233 78241 78259 78277 78283 78301 78307 78311 78317 78341 78347 78367 78401 78427
78437 78439 78467 78479 78487 78497 78509 78511 78517 78539 78541 78553 78569 78571 78577 78583
78593 78607 78623 78643 78649 78653 78691 78697 78707 78713 78721 78737 78779 78781 78787 78791
78797 78803 78809 78823 78839 78853 78857 78877 78887 78889 78893 78901 78919 78929 78941 78977
78979 78989 79031 79039 79043 79063 79087 79103 79111 79133 79139 79147 79151 79153 79159 79181
79187 79193 79201 79229 79231 79241 79259 79273 79279 79283 79301 79309 79319 79333 79337 79349
79357 79367 79379 79393 79397 79399 79411 79423 79427 79433 79451 79481 79493 79531 79537 79549
79559 79561 79579 79589 79601 79609 79613 79621 79627 79631 79633 79657 79669 79687 79691 79693
79697 79699 79757 79769 79777 79801 79811 79813 79817 79823 79829 79841 79843 79847 79861 79867
79873 79889 79901 79903 79907 79939 79943 79967 79973 79979 79987 79997 79999 80021 80039 80051
80071 80077 80107 80111 80141 80147 80149 80153 80167 80173 80177 80191 80207 80209 80221 80231
80233 80239 80251 80263 80273 80279 80287 80309 80317 80329 80341 80347 80363 80369 80387 80407
80429 80447 80449 80471 80473 80489 80491 80513 80527 80537 80557 80567 80599 80603 80611 80621
80627 80629 80651 80657 80669 80671 80677 80681 80683 80687 80701 80713 80737 80747 80749 80761
80777 80779 80783 80789 80803 80809 80819 80831 80833 80849 80863 80897 80909 80911 80917 80923
80929 80933 80953 80963 80989 81001 81013 81017 81019 81023 81031 81041 81043 81047 81049 81071
81077 81083 81097 81101 81119 81131 81157 81163 81173 81181 81197 81199 81203 81223 81233 81239
81281 81283 81293 81299 81307 81331 81343 81349 81353 81359 81371 81373 81401 81409 81421 81439
81457 81463 81509 81517 81527 81533 81547 81551 81553 81559 81563 81569 81611 81619 81629 81637
81647 81649 81667 81671 81677 81689 81701 81703 81707 81727 81737 81749 81761 81769 81773 81799
81817 81839 81847 81853 81869 81883 81899 81901 81919 81929 81931 81937 81943 81953 81967 81971
81973 82003 82007 82009 82013 82021 82031 82037 82039 82051 82067 82073 82129 82139 82141 82153
82163 82171 82183 82189 82193 82207 82217 82219 82223 82231 82237 82241 82261 82267 82279 82301
82307 82339 82349 82351 82361 82373 82387 82393 82421 82457 82463 82469 82471 82483 82487 82493
82499 82507 82529 82531 82549 82559 82561 82567 82571 82591 82601 82609 82613 82619 82633 82651
82657 82699 82721 82723 82727 82729 82757 82759 82763 82781 82787 82793 82799 82811 82813 82837
82847 82883 82889 82891 82903 82913 82939 82963 82981 82997 83003 83009 83023 83047 83059 83063
83071 83077 83089 83093 83101 83117 83137 83177 83203 83207 83219 83221 83227 83231 83233 83243
83257 83267 83269 83273 83299 83311 83339 83341 83357 83383 83389 83399 83401 83407 83417 83423
83431 83437 83443 83449 83459 83471 83477 83497 83537 83557 83561 83563 83579 83591 83597 83609
83617 83621 83639 83641 83653 83663 83689 83701 83717 83719 83737 83761 83773 83777 83791 83813
83833 83843 83857 83869 83873 83891 83903 83911 83921 83933 83939 83969 83983 83987 84011 84017
84047 84053 84059 84061 84067 84089 84121 84127 84131 84137 84143 84163 84179 84181 84191 84199
84211 84221 84223 84229 84239 84247 84263 84299 84307 84313 84317 84319 84347 84349 84377 84389
84391 84401 84407 84421 84431 84437 84443 84449 84457 84463 84467 84481 84499 84503 84509 84521
84523 84533 84551 84559 84589 84629 84631 84649 84653 84659 84673 84691 84697 84701 84713 84719
84731 84737 84751 84761 84787 84793 84809 84811 84827 84857 84859 84869 84871 84913 84919 84947
84961 84967 84977 84979 84991 85009 85021 85027 85037 85049 85061 85081 85087 85091 85093 85103
85109 85121 85133 85147 85159 85193 85199 85201 85213 85223 85229 85237 85243 85247 85259 85297
85303 85313 85331 85333 85361 85363 85369 85381 85411 85427 85429 85439 85447 85451 85453 85469
85487 85513 85517 85523 85531 85549 85571 85577 85597 85601 85607 85619 85621 85627 85639 85643
85661 85667 85669 85691 85703 85711 85717 85733 85751 85781 85793 85817 85819 85829 85831 85837
85843 85847 85853 85889 85903 85909 85931 85933 85991 85999 86011 86017 86027 86029 86069 86077
86083 86111 86113 86117 86131 86137 86143 86161 86171 86179 86183 86197 86201 86209 86239 86243
86249 86257 86263 86269 86287 86291 86293 86297 86311 86323 86341 86351 86353 86357 86369 86371
86381 86389 86399 86413 86423 86441 86453 86461 86467 86477 86491 86501 86509 86531 86533 86539
86561 86573 86579 86587 86599 86627 86629 86677 86689 86693 86711 86719 86729 86743 86753 86767
86771 86783 86813 86837 86843 86851 86857 86861 86869 86923 86927 86929 86939 86951 86959 86969
86981 86993 87011 87013 87037 87041 87049 87071 87083 87103 87107 87119 87121 87133 87149 87151
87179 87181 87187 87211 87221 87223 87251 87253 87257 87277 87281 87293 87299 87313 87317 87323
87539 87541 87547 87553 87557 87559 87583 87587 87589 87613 87623 87629 87631 87641 87643 87649
87671 87679 87683 87691 87697 87701 87719 87721 87739 87743 87751 87767 87793 87797 87803 87811
87833 87853 87869 87877 87881 87887 87911 87917 87931 87943 87959 87961 87973 87977 87991 88001
88003 88007 88019 88037 88069 88079 88093 88117 88129 88169 88177 88211 88223 88237 88241 88259
88261 88289 88301 88321 88327 88337 88339 88379 88397 88411 88423 88427 88463 88469 88471 88493
88499 88513 88523 88547 88589 88591 88607 88609 88643 88651 88657 88661 88663 88667 88681 88721
88729 88741 88747 88771 88789 88793 88799 88801 88807 88811 88813 88817 88819 88843 88853 88861
88867 88873 88883 88897 88903 88919 88937 88951 88969 88993 88997 89003 89009 89017 89021 89041
89051 89057 89069 89071 89083 89087 89101 89107 89113 89119 89123 89137 89153 89189 89203 89209
89213 89227 89231 89237 89261 89269 89273 89293 89303 89317 89329 89363 89371 89381 89387 89393
89399 89413 89417 89431 89443 89449 89459 89477 89491 89501 89513 89519 89521 89527 89533 89561
89563 89567 89591 89597 89599 89603 89611 89627 89633 89653 89657 89659 89669 89671 89681 89689
89753 89759 89767 89779 89783 89797 89809 89819 89821 89833 89839 89849 89867 89891 89897 89899
89909 89917 89923 89939 89959 89963 89977 89983 89989 90001 90007 90011 90017 90019 90023 90031
90053 90059 90067 90071 90073 90089 90107 90121 90127 90149 90163 90173 90187 90191 90197 90199
90203 90217 90227 90239 90247 90263 90271 90281 90289 90313 90353 90359 90371 90373 90379 90397
90401 90403 90407 90437 90439 90469 90473 90481 90499 90511 90523 90527 90529 90533 90547 90583
90599 90617 90619 90631 90641 90647 90659 90677 90679 90697 90703 90709 90731 90749 90787 90793
90803 90821 90823 90833 90841 90847 90863 90887 90901 90907 90911 90917 90931 90947 90971 90977
90989 90997 91009 91019 91033 91079 91081 91097 91099 91121 91127 91129 91139 91141 91151 91153
91159 91163 91183 91193 91199 91229 91237 91243 91249 91253 91283 91291 91297 91303 91309 91331
91367 91369 91373 91381 91387 91393 91397 91411 91423 91433 91453 91457 91459 91463 91493 91499
91513 91529 91541 91571 91573 91577 91583 91591 91621 91631 91639 91673 91691 91703 91711 91733
91753 91757 91771 91781 91801 91807 91811 91813 91823 91837 91841 91867 91873 91909 91921 91939
91943 91951 91957 91961 91967 91969 91997 92003 92009 92033 92041 92051 92077 92083 92107 92111
92119 92143 92153 92173 92177 92179 92189 92203 92219 92221 92227 92233 92237 92243 92251 92269
92297 92311 92317 92333 92347 92353 92357 92363 92369 92377 92381 92383 92387 92399 92401 92413
92419 92431 92459 92461 92467 92479 92489 92503 92507 92551 92557 92567 92569 92581 92593 92623
92627 92639 92641 92647 92657 92669 92671 92681 92683 92693 92699 92707 92717 92723 92737 92753
92761 92767 92779 92789 92791 92801 92809 92821 92831 92849 92857 92861 92863 92867 92893 92899
92921 92927 92941 92951 92957 92959 92987 92993 93001 93047 93053 93059 93077 93083 93089 93097
93103 93113 93131 93133 93139 93151 93169 93179 93187 93199 93229 93239 93241 93251 93253 93257
93263 93281 93283 93287 93307 93319 93323 93329 93337 93371 93377 93383 93407 93419 93427 93463
93479 93481 93487 93491 93493 93497 93503 93523 93529 93553 93557 93559 93563 93581 93601 93607
93629 93637 93683 93701 93703 93719 93739 93761 93763 93787 93809 93811 93827 93851 93871 93887
93889 93893 93901 93911 93913 93923 93937 93941 93949 93967 93971 93979 93983 93997 94007 94009
94033 94049 94057 94063 94079 94099 94109 94111 94117 94121 94151 94153 94169 94201 94207 94219
94229 94253 94261 94273 94291 94307 94309 94321 94327 94331 94343 94349 94351 94379 94397 94399
94421 94427 94433 94439 94441 94447 94463 94477 94483 94513 94529 94531 94541 94543 94547 94559
94561 94573 94583 94597 94603 94613 94621 94649 94651 94687 94693 94709 94723 94727 94747 94771
94777 94781 94789 94793 94811 94819 94823 94837 94841 94847 94849 94873 94889 94903 94907 94933
94949 94951 94961 94993 94999 95003 95009 95021 95027 95063 95071 95083 95087 95089 95093 95101
95107 95111 95131 95143 95153 95177 95189 95191 95203 95213 95219 95231 95233 95239 95257 95261
95267 95273 95279 95287 95311 95317 95327 95339 95369 95383 95393 95401 95413 95419 95429 95441
95443 95461 95467 95471 95479 95483 95507 95527 95531 95539 95549 95561 95569 95581 95597 95603
95617 95621 95629 95633 95651 95701 95707 95713 95717 95723 95731 95737 95747 95773 95783 95789
95791 95801 95803 95813 95819 95857 95869 95873 95881 95891 95911 95917 95923 95929 95947 95957
95959 95971 95987 95989 96001 96013 96017 96043 96053 96059 96079 96097 96137 96149 96157 96167
96179 96181 96199 96211 96221 96223 96233 96259 96263 96269 96281 96289 96293 96323 96329 96331
96337 96353 96377 96401 96419 96431 96443 96451 96457 96461 96469 96479 96487 96493 96497 96517
96527 96553 96557 96581 96587 96589 96601 96643 96661 96667 96671 96697 96703 96731 96737 96739
96749 96757 96763 96769 96779 96787 96797 96799 96821 96823 96827 96847 96851 96857 96893 96907
96911 96931 96953 96959 96973 96979 96989 96997 97001 97003 97007 97021 97039 97073 97081 97103
97117 97127 97151 97157 97159 97169 97171 97177 97187 97213 97231 97241 97259 97283 97301 97303
97327 97367 97369 97373 97379 97381 97387 97397 97423 97429 97441 97453 97459 97463 97499 97501
97511 97523 97547 97549 97553 97561 97571 97577 97579 97583 97607 97609 97613 97649 97651 97673
97687 97711 97729 97771 97777 97787 97789 97813 97829 97841 97843 97847 97849 97859 97861 97871
97879 97883 97919 97927 97931 97943 97961 97967 97973 97987 98009 98011 98017 98041 98047 98057
98081 98101 98123 98129 98143 98179 98207 98213 98221 98227 98251 98257 98269 98297 98299 98317
98321 98323 98327 98347 98369 98377 98387 98389 98407 98411 98419 98429 98443 98453 98459 98467
98473 98479 98491 98507 98519 98533 98543 98561 98563 98573 98597 98621 98627 98639 98641 98663
98669 98689 98711 98713 98717 98729 98731 98737 98773 98779 98801 98807 98809 98837 98849 98867
98869 98873 98887 98893 98897 98899 98909 98911 98927 98929 98939 98947 98953 98963 98981 98993
98999 99013 99017 99023 99041 99053 99079 99083 99089 99103 99109 99119 99131 99133 99137 99139
99149 99173 99181 99191 99223 99233 99241 99251 99257 99259 99277 99289 99317 99347 99349 99367
99371 99377 99391 99397 99401 99409 99431 99439 99469 99487 99497 99523 99527 99529 99551 99559
99563 99571 99577 99581 99607 99611 99623 99643 99661 99667 99679 99689 99707 99709 99713 99719
99721 99733 99761 99767 99787 99793 99809 99817 99823 99829 99833 99839 99859 99871 99877 99881
99901 99907 99923 99929 99961 99971 99989 99991
| 89.75461 | 143 | 0.781627 |
ed40546922badbe8cdbffc0d4b3af6ac09e656e4 | 451 | t | Perl | t/32-get_password.t | guillaumeaubert/Business-CyberSource-Report | c625fee098d1363a7a00341ed556b1a704ca3326 | [
"Artistic-1.0"
]
| null | null | null | t/32-get_password.t | guillaumeaubert/Business-CyberSource-Report | c625fee098d1363a7a00341ed556b1a704ca3326 | [
"Artistic-1.0"
]
| null | null | null | t/32-get_password.t | guillaumeaubert/Business-CyberSource-Report | c625fee098d1363a7a00341ed556b1a704ca3326 | [
"Artistic-1.0"
]
| null | null | null | #!perl -T
use strict;
use warnings;
use Business::CyberSource::Report;
use Test::FailWarnings -allow_deps => 1;
use Test::More tests => 1;
my $report_factory = Business::CyberSource::Report->new(
merchant_id => 'test_merchant_id',
username => 'test_username',
password => 'test_password',
use_production_system => 0,
);
is(
$report_factory->get_password(),
'test_password',
'Retrieve the password.',
);
| 19.608696 | 56 | 0.654102 |
73dd666c1155cd42d8740aae3606ef501982cb9b | 3,298 | t | Perl | t/00_CappedCollection/04_receive.t | TrackingSoft/Redis-CappedCollection | 3131861abb3eeba4cf2aed835e74783da24fb6a4 | [
"Artistic-1.0-Perl"
]
| null | null | null | t/00_CappedCollection/04_receive.t | TrackingSoft/Redis-CappedCollection | 3131861abb3eeba4cf2aed835e74783da24fb6a4 | [
"Artistic-1.0-Perl"
]
| 1 | 2020-02-15T21:45:36.000Z | 2020-02-19T03:30:33.000Z | t/00_CappedCollection/04_receive.t | TrackingSoft/Redis-CappedCollection | 3131861abb3eeba4cf2aed835e74783da24fb6a4 | [
"Artistic-1.0-Perl"
]
| null | null | null | #!/usr/bin/perl -w
use 5.010;
use strict;
use warnings;
use lib 'lib', 't/tlib';
use Test::More;
plan "no_plan";
BEGIN {
eval "use Test::Exception"; ## no critic
plan skip_all => "because Test::Exception required for testing" if $@;
}
BEGIN {
eval "use Test::RedisServer"; ## no critic
plan skip_all => "because Test::RedisServer required for testing" if $@;
}
BEGIN {
eval "use Net::EmptyPort"; ## no critic
plan skip_all => "because Net::EmptyPort required for testing" if $@;
}
BEGIN {
eval 'use Test::NoWarnings'; ## no critic
plan skip_all => 'because Test::NoWarnings required for testing' if $@;
}
use bytes;
use Data::UUID;
use Redis::CappedCollection qw(
$NAMESPACE
);
use Redis::CappedCollection::Test::Utils qw(
verify_redis
);
# options for testing arguments: ( undef, 0, 0.5, 1, -1, -3, "", "0", "0.5", "1", 9999999999999999, \"scalar", [], $uuid )
my ( $redis, $skip_msg, $port ) = verify_redis();
SKIP: {
diag $skip_msg if $skip_msg;
skip( $skip_msg, 1 ) if $skip_msg;
# For Test::RedisServer
isa_ok( $redis, 'Test::RedisServer' );
my ( $coll, $name, $tmp, $id, $status_key, $queue_key, $list_key, @arr );
my $uuid = new Data::UUID;
my $msg = "attribute is set correctly";
$coll = Redis::CappedCollection->create(
redis => $redis,
name => $uuid->create_str,
);
isa_ok( $coll, 'Redis::CappedCollection' );
ok $coll->_server =~ /.+:$port$/, $msg;
ok ref( $coll->_redis ) =~ /Redis/, $msg;
$status_key = $NAMESPACE.':S:'.$coll->name;
$queue_key = $NAMESPACE.':Q:'.$coll->name;
ok $coll->_call_redis( "EXISTS", $status_key ), "status hash created";
ok !$coll->_call_redis( "EXISTS", $queue_key ), "queue list not created";
my $data_id = 0;
# some inserts
for ( my $i = 1; $i <= 10; ++$i )
{
$data_id = 0;
$coll->insert( $i, $data_id++, $_ ) for $i..10;
}
#-- all correct
for ( my $i = 1; $i <= 10; ++$i )
{
@arr = ();
push @arr, $_ for $i..10;
@arr = sort @arr;
my @ret = sort $coll->receive( $i );
is "@arr", "@ret", "correct receive";
}
@arr = ( 1, 2, 3 );
@arr = $coll->receive( "bad_id" );
ok !@arr, "not received";
for ( my $i = 1; $i <= 10; ++$i )
{
$tmp = $coll->receive( 1, $i - 1 );
is $tmp, $i.'', "correct receive";
}
$tmp = $coll->receive( 1, 123 );
ok !defined( $tmp ), "empty list";
$tmp = $coll->receive( 1 );
is $tmp, 10, "correct list len";
$coll = Redis::CappedCollection->create(
redis => $redis,
name => $uuid->create_str,
);
$data_id = 0;
$coll->insert( "Some id", $data_id++, $_ ) for 1..10;
@arr = ();
push @arr, ( $_ - 1, $_ ) for 1..10;
my @ret = $coll->receive( "Some id", '' );
is "@arr", "@ret", "correct receive";
$tmp = $coll->receive( "Some id", 'bad_id' );
is $tmp, undef, "correct receive";
# errors in the arguments
dies_ok { $coll->receive() } "expecting to die - no args";
foreach my $arg ( ( undef, "", \"scalar", [], $uuid ) )
{
dies_ok { $coll->receive( $arg ) } "expecting to die: ".( $arg || '' );
}
foreach my $arg ( ( \"scalar", [], $uuid ) )
{
dies_ok { $coll->receive( "Some id", $arg ) } "expecting to die: ".( $arg || '' );
}
$coll->_call_redis( "DEL", $_ ) foreach $coll->_call_redis( "KEYS", $NAMESPACE.":*" );
}
| 24.42963 | 122 | 0.564888 |
ed1f2c1362c2f124008989204317f7100574136d | 2,341 | t | Perl | ssi_include_big.t | muradm/nginx-tests | ddfb68b9012a0aa6d60eb7e139830d4b3c86ff2a | [
"BSD-2-Clause"
]
| 77 | 2015-11-08T00:07:30.000Z | 2022-03-17T02:34:07.000Z | ssi_include_big.t | muradm/nginx-tests | ddfb68b9012a0aa6d60eb7e139830d4b3c86ff2a | [
"BSD-2-Clause"
]
| 3 | 2020-10-11T08:05:36.000Z | 2021-09-23T11:23:21.000Z | ssi_include_big.t | muradm/nginx-tests | ddfb68b9012a0aa6d60eb7e139830d4b3c86ff2a | [
"BSD-2-Clause"
]
| 72 | 2015-09-25T18:07:43.000Z | 2022-03-25T18:35:03.000Z | #!/usr/bin/perl
# (C) Maxim Dounin
# Tests for nginx ssi bug with big includes.
###############################################################################
use warnings;
use strict;
use Test::More;
BEGIN { use FindBin; chdir($FindBin::Bin); }
use lib 'lib';
use Test::Nginx qw/ :DEFAULT :gzip /;
###############################################################################
select STDERR; $| = 1;
select STDOUT; $| = 1;
my $t = Test::Nginx->new()->has(qw/http ssi rewrite gzip proxy/)->plan(8);
$t->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
daemon off;
events {
}
http {
%%TEST_GLOBALS_HTTP%%
output_buffers 2 512;
ssi on;
gzip on;
server {
listen 127.0.0.1:8080;
server_name localhost;
location /proxy/ {
proxy_pass http://127.0.0.1:8080/local/;
}
location = /local/blah {
return 204;
}
}
}
EOF
$t->write_file('c1.html', 'X' x 1023);
$t->write_file('c2.html', 'X' x 1024);
$t->write_file('c3.html', 'X' x 1025);
$t->write_file('test1.html', '<!--#include virtual="/proxy/blah" -->'
. '<!--#include virtual="/c1.html" -->');
$t->write_file('test2.html', '<!--#include virtual="/proxy/blah" -->'
. '<!--#include virtual="/c2.html" -->');
$t->write_file('test3.html', '<!--#include virtual="/proxy/blah" -->'
. '<!--#include virtual="/c3.html" -->');
$t->write_file('test4.html', '<!--#include virtual="/proxy/blah" -->'
. ('X' x 1025));
$t->run();
###############################################################################
my $t1 = http_gzip_request('/test1.html');
ok(defined $t1, 'small included file (less than output_buffers)');
http_gzip_like($t1, qr/^X{1023}\Z/, 'small included file content');
my $t2 = http_gzip_request('/test2.html');
ok(defined $t2, 'small included file (equal to output_buffers)');
http_gzip_like($t2, qr/^X{1024}\Z/, 'small included file content');
my $t3 = http_gzip_request('/test3.html');
ok(defined $t3, 'big included file (more than output_buffers)');
http_gzip_like($t3, qr/^X{1025}\Z/, 'big included file content');
my $t4 = http_gzip_request('/test4.html');
ok(defined $t4, 'big ssi main file');
http_gzip_like($t4, qr/^X{1025}\Z/, 'big ssi main file content');
###############################################################################
| 26.011111 | 79 | 0.527552 |
ed148ae0411dc6f961113e2178491d68afbfc4ca | 713 | pm | Perl | lib/Map/Metro/Cmd/AllRoutes.pm | karenetheridge/Map-Metro | 7021429b62081f98305c6c468fb365c6798b96a9 | [
"Artistic-1.0"
]
| null | null | null | lib/Map/Metro/Cmd/AllRoutes.pm | karenetheridge/Map-Metro | 7021429b62081f98305c6c468fb365c6798b96a9 | [
"Artistic-1.0"
]
| null | null | null | lib/Map/Metro/Cmd/AllRoutes.pm | karenetheridge/Map-Metro | 7021429b62081f98305c6c468fb365c6798b96a9 | [
"Artistic-1.0"
]
| null | null | null | use Map::Metro::Standard::Moops;
use strict;
use warnings;
# VERSION
# PODNAME: Map::Metro::Cmd::AllRoutes
class Map::Metro::Cmd::AllRoutes extends Map::Metro::Cmd using Moose {
use MooseX::App::Command;
parameter cityname => (
is => 'rw',
isa => Str,
documentation => 'The name of the city',
required => 1,
);
command_short_description 'Display routes for *all* pairs of stations (slow)';
method run {
my %hooks = (hooks => ['PrettyPrinter']);
my $graph = $self->cityname !~ m{\.} ? Map::Metro->new($self->cityname, %hooks)->parse : Map::Metro::Shim->new($self->cityname, %hooks)->parse;
my $all = $graph->all_pairs;
}
}
1;
| 23.766667 | 151 | 0.591865 |
73dad757dc639564d9eac1b1478cc4a3677d8dd7 | 2,551 | pl | Perl | getMPL115A2.pl | omzn/MPL115A2 | 8100e7e20dd3870f796580192e4123acfebaf88b | [
"MIT"
]
| 1 | 2020-11-21T16:45:32.000Z | 2020-11-21T16:45:32.000Z | getMPL115A2.pl | omzn/MPL115A2 | 8100e7e20dd3870f796580192e4123acfebaf88b | [
"MIT"
]
| null | null | null | getMPL115A2.pl | omzn/MPL115A2 | 8100e7e20dd3870f796580192e4123acfebaf88b | [
"MIT"
]
| null | null | null | #!/usr/bin/perl
use strict;
my $I2CSET = "/usr/sbin/i2cset";
my $I2CGET = "/usr/sbin/i2cget";
system("$I2CSET -y 1 0x60 0x12 0x01");
&shortsleep(0.1);
#----- padc -----#
my $address_0 = `$I2CGET -y 1 0x60 0x00 w`;
while ( $address_0 eq "" ) {
$address_0 = `$I2CGET -y 1 0x60 0x00 w`;
}
chomp($address_0);
my $padc = hex(substr($address_0,4,2).substr($address_0,2,2)) >> 6;
#print "0x00: $address_0\n";
#print "Padc = $padc\n";
#----- tadc -----#
my $address_2 = `$I2CGET -y 1 0x60 0x02 w`;
while ( $address_2 eq "" ) {
$address_2 = `$I2CGET -y 1 0x60 0x02 w`;
}
chomp($address_2);
my $tadc = hex(substr($address_2,4,2).substr($address_2,2,2)) >> 6;
#print "0x02: $address_2\n";
#print "Tadc = $tadc\n";
#----- a0 -----#
my $address_4 = `$I2CGET -y 1 0x60 0x04 w`;
while ( $address_4 eq "" ) {
$address_4 = `$I2CGET -y 1 0x60 0x04 w`;
}
chomp($address_4);
my $a0 = hex(substr($address_4,4,2).substr($address_4,2,2));
#print "0x04: $address_4\n";
$a0 = &get_frac($a0,3,0);
#print "a0: ",$a0,"\n";
#----- b1 -----#
my $address_6 = `$I2CGET -y 1 0x60 0x06 w`;
while ( $address_6 eq "" ) {
$address_6 = `$I2CGET -y 1 0x60 0x06 w`;
}
chomp($address_6);
my $b1 = hex(substr($address_6,4,2).substr($address_6,2,2));
#print "0x06: $address_6\n";
$b1 = &get_frac($b1,13,0);
#print "b1: ",$b1,"\n";
#----- b2 -----#
my $address_8 = `$I2CGET -y 1 0x60 0x08 w`;
while ( $address_8 eq "" ) {
$address_8 = `$I2CGET -y 1 0x60 0x08 w`;
}
chomp($address_8);
my $b2 = hex(substr($address_8,4,2).substr($address_8,2,2));
#print "0x08: $address_8\n";
$b2 = &get_frac($b2,14,0);
#print "b2: ",$b2,"\n";
#----- c12 -----#
my $address_a = `$I2CGET -y 1 0x60 0x0a w`;
while ( $address_a eq "" ) {
$address_a = `$I2CGET -y 1 0x60 0x0a w`;
}
chomp($address_a);
my $c12 = hex(substr($address_a,4,2).substr($address_a,2,2));
#print "0x0a: $address_a\n";
$c12 = &get_frac($c12,22,2);
#print "c12: ",$c12,"\n";
my $Pcomp = $a0 + ($b1 + $c12 * $tadc) * $padc + $b2 * $tadc;
my $PhPa = ((65/1023) * $Pcomp + 50) * 10;
printf "%6.1f\n",$PhPa;
exit 0;
sub get_frac {
my ($val,$fracbits,$zero) = @_;
my $valsign = 1;
if ($val & 0x8000) {
$valsign = -1; # sign
$val = ~$val + 1;
}
$val = $val >> $zero if ($zero);
my $valfrac = 0;
my $mask = 0x0001;
for (my $i=$fracbits;$i>0;$i--) {
$valfrac += 1/(2**$i) if ($val & $mask);
$mask <<= 1;
}
my $valint = ($val & 0x7fff) >> $fracbits;
return $valsign * ($valint + $valfrac);
}
sub shortsleep {
my $s = shift;
select(undef,undef,undef,$s);
}
__END__
| 26.030612 | 67 | 0.562525 |
73fc2acfed888304083511564d9bdd35e5b6889e | 98 | t | Perl | Kosmos/t/view_Web.t | haoess/hidden-kosmos | 021bfeb394f3996d50edd0a6820e6f4be9c90435 | [
"CC-BY-4.0"
]
| 3 | 2017-03-15T09:28:00.000Z | 2019-10-18T18:18:04.000Z | Kosmos/t/view_Web.t | haoess/hidden-kosmos | 021bfeb394f3996d50edd0a6820e6f4be9c90435 | [
"CC-BY-4.0"
]
| 36 | 2016-02-23T08:51:46.000Z | 2019-01-03T08:48:40.000Z | Kosmos/t/view_Web.t | haoess/hidden-kosmos | 021bfeb394f3996d50edd0a6820e6f4be9c90435 | [
"CC-BY-4.0"
]
| 4 | 2015-10-02T10:22:43.000Z | 2019-12-21T11:32:38.000Z | use strict;
use warnings;
use Test::More;
BEGIN { use_ok 'Kosmos::View::Web' }
done_testing();
| 10.888889 | 36 | 0.683673 |
73e849b508178933c144cf8dc7dd6a5177155d00 | 4,800 | pl | Perl | packages/PIPS/pips/src/Scripts/validation/ubs_checking_instrument.pl | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
]
| 51 | 2015-01-31T01:51:39.000Z | 2022-02-18T02:01:50.000Z | packages/PIPS/pips/src/Scripts/validation/ubs_checking_instrument.pl | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
]
| 7 | 2017-05-29T09:29:00.000Z | 2019-03-11T16:01:39.000Z | packages/PIPS/pips/src/Scripts/validation/ubs_checking_instrument.pl | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
]
| 12 | 2015-03-26T08:05:38.000Z | 2022-02-18T02:01:51.000Z | #! /usr/bin/perl -w
#
# $Id$
#
# Copyright 1989-2014 MINES ParisTech
#
# This file is part of PIPS.
#
# PIPS 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
# any later version.
#
# PIPS 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 PIPS. If not, see <http://www.gnu.org/licenses/>.
#
#
# Given the instrumenting file, the script does the following things:
# Insert ubs checks before a given statement (the statement ordering is known)
#
# Expected syntax in the instrument file: prefixed tab-separated list
# $UBS_CHECK: FILE MODULE ORDERING
# code...
# $UBS_CHECK_END
#
# Command : ubs_checking_instrument.pl < instrument_file
use Getopt::Long;
$opt_help = '';
$opt_suffix = 'old';
GetOptions("help")
or die $!;
if ($opt_help) {
print STDERR
"Usage: ubs_checking_instrument.pl < instrument_file\n" .
"\tinstrument_file: contains ubs checks\n" .
"\tin format of prefixed tab-separated lists \n" .
"\tformat: \$UBS_CHECK file module ordering \n" .
"\t\t checks\n" .
"\t\t\$UBS_CHECK_END \n" .
"\t-h: this help\n";
exit;
}
# get all ubs checks to add for stdin
&debug("Loading ubs checks to be inserted\n");
%files =();
while (<>)
{
if (/^\$UBS_CHECK/)
{
chomp;
@split = split /\t/;
shift(@split);
($file, $module, $ordering) = @split;
$code = '';
while (($line = <>) !~ /^\$UBS_CHECK_END/)
{
$code .= $line;
}
# module ordering code
#&debug("Adding ubs checks: $file $module $ordering \n$code \n");
push(@{$files{$file}},"$module:$ordering:$code\n");
}
}
&debug("For each file, create new instrumented file ... \n");
foreach $file (sort keys %files)
{
&debug("Loading file $file \n");
open FILE, "< $file"
or die "Cannot open file $file for reading ($!)";
@fortran = <FILE>;
close FILE or die $!;
# for each insertion
foreach $line (@{$files{$file}})
{
if ($line =~ /^([^:]*):([^:]*):(.*)\n$/s)
{
($module,$ordering,$code) = ($1,$2,$3);
#&debug("Considering line: $module $ordering \n$code \n");
$n = @fortran;
$done = 0;
$insub = 0;
for ($i = 0; $i < $n and not $done; $i++)
{
$ligne = $fortran[$i];
#if ($i < 150)
#{
# &debug("Print line $ligne \n");
#}
# insure that we're in the right routine
# bug : su2cor
# 1000 FORMAT(1X,75('+')/' PROGRAM SU2V1COR',' -- MODIFIED HEAT BATH ALGO
# => conclude : not in right routine :-(
#$insub = 0
# if $ligne =~ /^[^Cc\*!].*(program|function|subroutine)/i;
$insub = 1
if $ligne =~ /^[^Cc\*!].*(program|function|subroutine)[ \t]*$module\b/i;
#$insub = 1
# if $module eq '-';
next if not $insub;
#if ($i < 150)
#{
# &debug("In right routine \n");
#}
# find line that matchs current ordering
if ($fortran[$i] =~ /C \($ordering\)\n/)
{
#&debug("Appending code to line $i\n");
$done = 1;
$fortran[$i] .= "$code";
}
}
failed("Ordering not found \n") if not $done;
}
}
# fix line length where necessary (length <=72)...
$n = @fortran;
for ($i=0; $i<$n; $i++)
{
#&debug("Fix length $fortran[$i] \n");
# skip comments
# attention, this skips also lines with instrumented code C(2,30) ....code...
next if $fortran[$i] =~ /^[Cc!\*]/;
$fortran[$i] =~ s/^(.{72})/$1\n x /;
while ($fortran[$i] =~ s/(\n[^\n]{72})([^\n])/$1\n x $2/s) {};
}
# For CATHAR, it is better to rename the current file to an old file
# and replace the current file by the new file
$old_file = "$file.$opt_suffix";
if (-f $old_file) {
$i = 1;
while (-f "$old_file$i") { $i++; }
$old_file .= $i;
}
# rename initial file
rename "$file", "$old_file"
or die "cannot rename file $file as $old_file ($!)";
unlink $file;
&debug("Save to file $file\n");
open FILE, "> $file"
or die "cannot open file $file for saving ($!)";
print FILE @fortran;
close FILE or die $!;
# chose new source file name
#$new_file = "$file.$opt_suffix";
#if (-f $new_file) {
# $i = 1;
# while (-f "$new_file$i") { $i++; }
# $new_file .= $i;
# }
# &debug("Create new file $new_file\n");
# save to new file
# open FILE, "> $new_file"
# or die "Cannot open file $new_file for saving ($!)";
# print FILE @fortran;
# close FILE or die $!;
}
sub failed
{
print STDERR "Failed: ", @_;
}
sub debug()
{
print STDERR @_;
}
| 22.857143 | 78 | 0.584167 |
73f61df51fdeb9c29a164c98dbc101b13d64ee3b | 6,079 | pl | Perl | perl/lib/unicore/lib/GCB/LV.pl | DDMoReFoundation/PortableNonmem | 7e40b30887537f24fed12421935b58325ba2e5c3 | [
"BSD-3-Clause-Clear"
]
| null | null | null | perl/lib/unicore/lib/GCB/LV.pl | DDMoReFoundation/PortableNonmem | 7e40b30887537f24fed12421935b58325ba2e5c3 | [
"BSD-3-Clause-Clear"
]
| null | null | null | perl/lib/unicore/lib/GCB/LV.pl | DDMoReFoundation/PortableNonmem | 7e40b30887537f24fed12421935b58325ba2e5c3 | [
"BSD-3-Clause-Clear"
]
| null | null | null | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by mktables from the Unicode
# database, Version 6.3.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by core Perl only. The format and even the
# name or existence of this file are subject to change without notice. Don't
# use it directly. Use Unicode::UCD to access the Unicode character data
# base.
return <<'END';
V798
44032
44033
44060
44061
44088
44089
44116
44117
44144
44145
44172
44173
44200
44201
44228
44229
44256
44257
44284
44285
44312
44313
44340
44341
44368
44369
44396
44397
44424
44425
44452
44453
44480
44481
44508
44509
44536
44537
44564
44565
44592
44593
44620
44621
44648
44649
44676
44677
44704
44705
44732
44733
44760
44761
44788
44789
44816
44817
44844
44845
44872
44873
44900
44901
44928
44929
44956
44957
44984
44985
45012
45013
45040
45041
45068
45069
45096
45097
45124
45125
45152
45153
45180
45181
45208
45209
45236
45237
45264
45265
45292
45293
45320
45321
45348
45349
45376
45377
45404
45405
45432
45433
45460
45461
45488
45489
45516
45517
45544
45545
45572
45573
45600
45601
45628
45629
45656
45657
45684
45685
45712
45713
45740
45741
45768
45769
45796
45797
45824
45825
45852
45853
45880
45881
45908
45909
45936
45937
45964
45965
45992
45993
46020
46021
46048
46049
46076
46077
46104
46105
46132
46133
46160
46161
46188
46189
46216
46217
46244
46245
46272
46273
46300
46301
46328
46329
46356
46357
46384
46385
46412
46413
46440
46441
46468
46469
46496
46497
46524
46525
46552
46553
46580
46581
46608
46609
46636
46637
46664
46665
46692
46693
46720
46721
46748
46749
46776
46777
46804
46805
46832
46833
46860
46861
46888
46889
46916
46917
46944
46945
46972
46973
47000
47001
47028
47029
47056
47057
47084
47085
47112
47113
47140
47141
47168
47169
47196
47197
47224
47225
47252
47253
47280
47281
47308
47309
47336
47337
47364
47365
47392
47393
47420
47421
47448
47449
47476
47477
47504
47505
47532
47533
47560
47561
47588
47589
47616
47617
47644
47645
47672
47673
47700
47701
47728
47729
47756
47757
47784
47785
47812
47813
47840
47841
47868
47869
47896
47897
47924
47925
47952
47953
47980
47981
48008
48009
48036
48037
48064
48065
48092
48093
48120
48121
48148
48149
48176
48177
48204
48205
48232
48233
48260
48261
48288
48289
48316
48317
48344
48345
48372
48373
48400
48401
48428
48429
48456
48457
48484
48485
48512
48513
48540
48541
48568
48569
48596
48597
48624
48625
48652
48653
48680
48681
48708
48709
48736
48737
48764
48765
48792
48793
48820
48821
48848
48849
48876
48877
48904
48905
48932
48933
48960
48961
48988
48989
49016
49017
49044
49045
49072
49073
49100
49101
49128
49129
49156
49157
49184
49185
49212
49213
49240
49241
49268
49269
49296
49297
49324
49325
49352
49353
49380
49381
49408
49409
49436
49437
49464
49465
49492
49493
49520
49521
49548
49549
49576
49577
49604
49605
49632
49633
49660
49661
49688
49689
49716
49717
49744
49745
49772
49773
49800
49801
49828
49829
49856
49857
49884
49885
49912
49913
49940
49941
49968
49969
49996
49997
50024
50025
50052
50053
50080
50081
50108
50109
50136
50137
50164
50165
50192
50193
50220
50221
50248
50249
50276
50277
50304
50305
50332
50333
50360
50361
50388
50389
50416
50417
50444
50445
50472
50473
50500
50501
50528
50529
50556
50557
50584
50585
50612
50613
50640
50641
50668
50669
50696
50697
50724
50725
50752
50753
50780
50781
50808
50809
50836
50837
50864
50865
50892
50893
50920
50921
50948
50949
50976
50977
51004
51005
51032
51033
51060
51061
51088
51089
51116
51117
51144
51145
51172
51173
51200
51201
51228
51229
51256
51257
51284
51285
51312
51313
51340
51341
51368
51369
51396
51397
51424
51425
51452
51453
51480
51481
51508
51509
51536
51537
51564
51565
51592
51593
51620
51621
51648
51649
51676
51677
51704
51705
51732
51733
51760
51761
51788
51789
51816
51817
51844
51845
51872
51873
51900
51901
51928
51929
51956
51957
51984
51985
52012
52013
52040
52041
52068
52069
52096
52097
52124
52125
52152
52153
52180
52181
52208
52209
52236
52237
52264
52265
52292
52293
52320
52321
52348
52349
52376
52377
52404
52405
52432
52433
52460
52461
52488
52489
52516
52517
52544
52545
52572
52573
52600
52601
52628
52629
52656
52657
52684
52685
52712
52713
52740
52741
52768
52769
52796
52797
52824
52825
52852
52853
52880
52881
52908
52909
52936
52937
52964
52965
52992
52993
53020
53021
53048
53049
53076
53077
53104
53105
53132
53133
53160
53161
53188
53189
53216
53217
53244
53245
53272
53273
53300
53301
53328
53329
53356
53357
53384
53385
53412
53413
53440
53441
53468
53469
53496
53497
53524
53525
53552
53553
53580
53581
53608
53609
53636
53637
53664
53665
53692
53693
53720
53721
53748
53749
53776
53777
53804
53805
53832
53833
53860
53861
53888
53889
53916
53917
53944
53945
53972
53973
54000
54001
54028
54029
54056
54057
54084
54085
54112
54113
54140
54141
54168
54169
54196
54197
54224
54225
54252
54253
54280
54281
54308
54309
54336
54337
54364
54365
54392
54393
54420
54421
54448
54449
54476
54477
54504
54505
54532
54533
54560
54561
54588
54589
54616
54617
54644
54645
54672
54673
54700
54701
54728
54729
54756
54757
54784
54785
54812
54813
54840
54841
54868
54869
54896
54897
54924
54925
54952
54953
54980
54981
55008
55009
55036
55037
55064
55065
55092
55093
55120
55121
55148
55149
55176
55177
END
| 7.477245 | 78 | 0.709985 |
73ffde4f8f98baf1fd064eb6d2778e20956a0441 | 856 | pl | Perl | ext/regulus/Examples/Calendar/SLM/scripts/japanese_tagging_grammar_spec.pl | TeamSPoon/logicmoo_nlu | 5c3e5013a3048da7d68a8a43476ad84d3ea4bb47 | [
"MIT"
]
| 6 | 2020-01-27T12:08:02.000Z | 2020-02-28T19:30:28.000Z | pack/logicmoo_nlu/prolog/regulus/Examples/Calendar/SLM/scripts/japanese_tagging_grammar_spec.pl | logicmoo/old_logicmoo_workspace | 44025b6e389e2f2f7d86b46c1301cab0604bba26 | [
"MIT"
]
| 1 | 2020-02-02T13:12:34.000Z | 2020-02-02T13:12:34.000Z | pack/logicmoo_nlu/prolog/regulus/Examples/Calendar/SLM/scripts/japanese_tagging_grammar_spec.pl | logicmoo/old_logicmoo_workspace | 44025b6e389e2f2f7d86b46c1301cab0604bba26 | [
"MIT"
]
| null | null | null |
tagging_class('WaOrGa', [wa, ga]).
tagging_class('Meeting', [kaigi, miitingu]).
tagging_class('NextLast', [tsugi, jikai]).
tagging_class('Copula', [desu, deshita]).
tagging_class('NamedTimePeriod', [sensyuu, kongetsu]).
tagging_class('TimePeriod', [syuukan, kagetsukan]).
tagging_class('DayOfWeek', [getsuyoubi, nichiyoubi]).
tagging_class('DayNumber', [touka, (nijuu, kunichi)]).
tagging_class('Name', [pieretto, juneevu, (mariannu, sutaarandaa)]).
tagging_class('Day', [ototoi, kyou]).
tagging_class('Month', [(go, gatsu), (shichi, gatsu)]).
tagging_class('Cardinal', [go, sanjuu, (nijuu, ku)]).
tagging_class('StartEnd', [(hajimari, masu), (owari, mashita)]).
tagging_class('Attend', [(syusseki, shita), (syusseki, shi, masu), deru]).
tagging_class('TimeOfDay', [gogo, gozen]).
tagging_class('PersonalInfo', [juusyo, (meeru, adoresu)]).
| 25.939394 | 74 | 0.700935 |
ed327a82df3d2ce34168587cc9e2cc63785e1af6 | 4,223 | pl | Perl | library/unicode_data/unicode_derived_normalization_props/unicode_nfc_qc_maybe.pl | sergio-castro/logtalk3 | 821cb1277cf144be36b52bef9d9f86c530f96fac | [
"Apache-2.0"
]
| null | null | null | library/unicode_data/unicode_derived_normalization_props/unicode_nfc_qc_maybe.pl | sergio-castro/logtalk3 | 821cb1277cf144be36b52bef9d9f86c530f96fac | [
"Apache-2.0"
]
| null | null | null | library/unicode_data/unicode_derived_normalization_props/unicode_nfc_qc_maybe.pl | sergio-castro/logtalk3 | 821cb1277cf144be36b52bef9d9f86c530f96fac | [
"Apache-2.0"
]
| null | null | null | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is part of VivoMind Prolog Unicode Resources
%
% VivoMind Prolog Unicode Resources is free software distributed using the
% Creative Commons CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication
% license
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Last modified: March 27, 2012
%
% Original Unicode file header comments follow
/*
# DerivedNormalizationProps-6.1.0.txt
# Date: 2011-07-26, 04:18:07 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2011 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see http://www.unicode.org/reports/tr44/
*/
unicode_nfc_qc_maybe(CodePoint) :-
( var(CodePoint) ->
% generate code point pairs
unicode_nfc_qc_maybe(CodePointStart, CodePointEnd),
between(CodePointStart, CodePointEnd, CodePoint)
; % try first-argument indexing first
unicode_nfc_qc_maybe(CodePoint, _) ->
true
; % look for a code point range that includes the given code point
unicode_nfc_qc_maybe(CodePointStart, CodePointEnd),
between(CodePointStart, CodePointEnd, CodePoint) ->
true
).
% ================================================
% NFC_Quick_Check=Maybe
unicode_nfc_qc_maybe(0x0300, 0x0304). % Mn [5] COMBINING GRAVE ACCENT..COMBINING MACRON
unicode_nfc_qc_maybe(0x0306, 0x030C). % Mn [7] COMBINING BREVE..COMBINING CARON
unicode_nfc_qc_maybe(0x030F, 0x030F). % Mn COMBINING DOUBLE GRAVE ACCENT
unicode_nfc_qc_maybe(0x0311, 0x0311). % Mn COMBINING INVERTED BREVE
unicode_nfc_qc_maybe(0x0313, 0x0314). % Mn [2] COMBINING COMMA ABOVE..COMBINING REVERSED COMMA ABOVE
unicode_nfc_qc_maybe(0x031B, 0x031B). % Mn COMBINING HORN
unicode_nfc_qc_maybe(0x0323, 0x0328). % Mn [6] COMBINING DOT BELOW..COMBINING OGONEK
unicode_nfc_qc_maybe(0x032D, 0x032E). % Mn [2] COMBINING CIRCUMFLEX ACCENT BELOW..COMBINING BREVE BELOW
unicode_nfc_qc_maybe(0x0330, 0x0331). % Mn [2] COMBINING TILDE BELOW..COMBINING MACRON BELOW
unicode_nfc_qc_maybe(0x0338, 0x0338). % Mn COMBINING LONG SOLIDUS OVERLAY
unicode_nfc_qc_maybe(0x0342, 0x0342). % Mn COMBINING GREEK PERISPOMENI
unicode_nfc_qc_maybe(0x0345, 0x0345). % Mn COMBINING GREEK YPOGEGRAMMENI
unicode_nfc_qc_maybe(0x0653, 0x0655). % Mn [3] ARABIC MADDAH ABOVE..ARABIC HAMZA BELOW
unicode_nfc_qc_maybe(0x093C, 0x093C). % Mn DEVANAGARI SIGN NUKTA
unicode_nfc_qc_maybe(0x09BE, 0x09BE). % Mc BENGALI VOWEL SIGN AA
unicode_nfc_qc_maybe(0x09D7, 0x09D7). % Mc BENGALI AU LENGTH MARK
unicode_nfc_qc_maybe(0x0B3E, 0x0B3E). % Mc ORIYA VOWEL SIGN AA
unicode_nfc_qc_maybe(0x0B56, 0x0B56). % Mn ORIYA AI LENGTH MARK
unicode_nfc_qc_maybe(0x0B57, 0x0B57). % Mc ORIYA AU LENGTH MARK
unicode_nfc_qc_maybe(0x0BBE, 0x0BBE). % Mc TAMIL VOWEL SIGN AA
unicode_nfc_qc_maybe(0x0BD7, 0x0BD7). % Mc TAMIL AU LENGTH MARK
unicode_nfc_qc_maybe(0x0C56, 0x0C56). % Mn TELUGU AI LENGTH MARK
unicode_nfc_qc_maybe(0x0CC2, 0x0CC2). % Mc KANNADA VOWEL SIGN UU
unicode_nfc_qc_maybe(0x0CD5, 0x0CD6). % Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK
unicode_nfc_qc_maybe(0x0D3E, 0x0D3E). % Mc MALAYALAM VOWEL SIGN AA
unicode_nfc_qc_maybe(0x0D57, 0x0D57). % Mc MALAYALAM AU LENGTH MARK
unicode_nfc_qc_maybe(0x0DCA, 0x0DCA). % Mn SINHALA SIGN AL-LAKUNA
unicode_nfc_qc_maybe(0x0DCF, 0x0DCF). % Mc SINHALA VOWEL SIGN AELA-PILLA
unicode_nfc_qc_maybe(0x0DDF, 0x0DDF). % Mc SINHALA VOWEL SIGN GAYANUKITTA
unicode_nfc_qc_maybe(0x102E, 0x102E). % Mn MYANMAR VOWEL SIGN II
unicode_nfc_qc_maybe(0x1161, 0x1175). % Lo [21] HANGUL JUNGSEONG A..HANGUL JUNGSEONG I
unicode_nfc_qc_maybe(0x11A8, 0x11C2). % Lo [27] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG HIEUH
unicode_nfc_qc_maybe(0x1B35, 0x1B35). % Mc BALINESE VOWEL SIGN TEDUNG
unicode_nfc_qc_maybe(0x3099, 0x309A). % Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
unicode_nfc_qc_maybe(0x110BA, 0x110BA). % Mn KAITHI SIGN NUKTA
unicode_nfc_qc_maybe(0x11127, 0x11127). % Mn CHAKMA VOWEL SIGN A
% Total code points: 104
| 52.135802 | 146 | 0.716552 |
ed30e48ecbd6e5f64dd1f139815f673e8e1e211e | 777 | pm | Perl | auto-lib/Paws/EC2/ConfirmProductInstanceResult.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/EC2/ConfirmProductInstanceResult.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/EC2/ConfirmProductInstanceResult.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null |
package Paws::EC2::ConfirmProductInstanceResult;
use Moose;
has OwnerId => (is => 'ro', isa => 'Str', request_name => 'ownerId', traits => ['NameInRequest',]);
has Return => (is => 'ro', isa => 'Bool', request_name => 'return', traits => ['NameInRequest',]);
has _request_id => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::EC2::ConfirmProductInstanceResult
=head1 ATTRIBUTES
=head2 OwnerId => Str
The AWS account ID of the instance owner. This is only present if the
product code is attached to the instance.
=head2 Return => Bool
The return value of the request. Returns C<true> if the specified
product code is owned by the requester and associated with the
specified instance.
=head2 _request_id => Str
=cut
| 21 | 101 | 0.689833 |
ed492d8826964bce46072b5a447b5e971a70c48a | 1,039 | pm | Perl | lib/Google/Ads/GoogleAds/V5/Common/DestinationTextList.pm | PierrickVoulet/google-ads-perl | bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4 | [
"Apache-2.0"
]
| null | null | null | lib/Google/Ads/GoogleAds/V5/Common/DestinationTextList.pm | PierrickVoulet/google-ads-perl | bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4 | [
"Apache-2.0"
]
| null | null | null | lib/Google/Ads/GoogleAds/V5/Common/DestinationTextList.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::Common::DestinationTextList;
use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseEntity);
use Google::Ads::GoogleAds::Utils::GoogleAdsHelper;
sub new {
my ($class, $args) = @_;
my $self = {destinationTexts => $args->{destinationTexts}};
# Delete the unassigned fields in this object for a more concise JSON payload
remove_unassigned_fields($self, $args);
bless $self, $class;
return $self;
}
1;
| 29.685714 | 79 | 0.739172 |
73dc703e5ec2e53cce4fa2374b93c6eed9bad56a | 2,888 | t | Perl | t/calculate_af.t | BuildJet/MIP | f1f63117a7324e37dbcaa16c0298f4b4c857d44c | [
"MIT"
]
| null | null | null | t/calculate_af.t | BuildJet/MIP | f1f63117a7324e37dbcaa16c0298f4b4c857d44c | [
"MIT"
]
| null | null | null | t/calculate_af.t | BuildJet/MIP | f1f63117a7324e37dbcaa16c0298f4b4c857d44c | [
"MIT"
]
| null | null | null | #!/usr/bin/env perl
use 5.026;
use Carp;
use charnames qw{ :full :short };
use English qw{ -no_match_vars };
use File::Basename qw{ dirname };
use File::Spec::Functions qw{ catdir catfile };
use FindBin qw{ $Bin };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use Test::More;
use utf8;
use warnings qw{ FATAL utf8 };
## CPANM
use autodie qw{ :all };
use Modern::Perl qw{ 2018 };
use Readonly;
## MIPs lib/
use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Test::Commands qw{ test_function };
use MIP::Test::Fixtures qw{ test_standard_cli };
my $VERBOSE = 1;
our $VERSION = 1.01;
$VERBOSE = test_standard_cli(
{
verbose => $VERBOSE,
version => $VERSION,
}
);
BEGIN {
use MIP::Test::Fixtures qw{ test_import };
### Check all internal dependency modules and imports
## Modules with import
my %perl_module = (
q{MIP::Program::Allele_frequency} => [qw{ calculate_af }],
q{MIP::Test::Fixtures} => [qw{ test_standard_cli }],
);
test_import( { perl_module_href => \%perl_module, } );
}
use MIP::Program::Allele_frequency qw{ calculate_af };
diag( q{Test calculate_af from Allele_frequency.pm v}
. $MIP::Program::Allele_frequency::VERSION
. $COMMA
. $SPACE . q{Perl}
. $SPACE
. $PERL_VERSION
. $SPACE
. $EXECUTABLE_NAME );
## Base arguments
my @function_base_commands = qw{ calculate_af };
my %base_argument = (
filehandle => {
input => undef,
expected_output => \@function_base_commands,
},
stderrfile_path => {
input => q{stderrfile.test},
expected_output => q{2> stderrfile.test},
},
stderrfile_path_append => {
input => q{stderrfile.test},
expected_output => q{2>> stderrfile.test},
},
stdoutfile_path => {
input => q{stdoutfile.test},
expected_output => q{1> stdoutfile.test},
},
);
## Can be duplicated with %base_argument and/or %specific_argument
## to enable testing of each individual argument
my %specific_argument = (
infile_path => {
input => catfile(qw{ a file.txt }),
expected_output => catfile(qw{ a file.txt }),
},
);
## Coderef - enables generalized use of generate call
my $module_function_cref = \&calculate_af;
## Test both base and function specific arguments
my @arguments = ( \%base_argument, \%specific_argument );
ARGUMENT_HASH_REF:
foreach my $argument_href (@arguments) {
my @commands = test_function(
{
argument_href => $argument_href,
do_test_base_command => 1,
function_base_commands_ref => \@function_base_commands,
module_function_cref => $module_function_cref,
}
);
}
done_testing();
| 25.333333 | 71 | 0.615997 |
ed0709bdb80f70cd298ee19998f071f91ac5344c | 9,661 | pl | Perl | src/condor_tests/docker_simulator.pl | olifre/htcondor | e1299614fbdcad113a206270f3940e2e8777c2bd | [
"Apache-2.0"
]
| 217 | 2015-01-08T04:49:42.000Z | 2022-03-27T10:11:58.000Z | src/condor_tests/docker_simulator.pl | olifre/htcondor | e1299614fbdcad113a206270f3940e2e8777c2bd | [
"Apache-2.0"
]
| 185 | 2015-05-03T13:26:31.000Z | 2022-03-28T03:08:59.000Z | src/condor_tests/docker_simulator.pl | olifre/htcondor | e1299614fbdcad113a206270f3940e2e8777c2bd | [
"Apache-2.0"
]
| 133 | 2015-02-11T09:17:45.000Z | 2022-03-31T07:28:54.000Z | #! /usr/bin/env perl
##**************************************************************
##
## Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
## University of Wisconsin-Madison, WI.
##
## 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.
##
##**************************************************************
###########################################################################
# Update:
# the script can now simulate docker functionalities:
# version, info, images: with fixed fake data
# run: where it sleeps for 60s, echos job id and name, and returns
# rm, kill, pause, unpause: right now they just prints job name to stdout
###########################################################################
use strict;
use warnings;
my $logfile = "docker_simulator.log";
my $arg;
my $version_log;
my $info_log;
my $images_log;
# attach to the end of the log file.
open(FH,">>$logfile") || print "FAILED opening file $logfile\n";
my $parsed_ref = parse_args(\@ARGV);
my @parsed;
if ($parsed_ref ne '0') {
@parsed = @{$parsed_ref};
}
my $name;
if (defined $parsed[0]) {
$name = $parsed[0];
}
# rules of processing the arguments.
my %rules_arg =
(
'version' => sub {
print FH gettime(time), " @ARGV\n";
$version_log = version();
print "$version_log";
},
'info' => sub {
print FH gettime(time), " @ARGV\n";
$info_log = info();
print "$info_log";
},
'images' => sub {
print FH gettime(time), " @ARGV\n";
$images_log = images();
print "$images_log";
},
'run' => sub {
print FH gettime(time), " @ARGV\n";
run($name);
},
'inspect' => sub {
print FH gettime(time), " @ARGV\n";
print inspect($ARGV[1]);
},
"rm" => sub {
print FH gettime(time), " @ARGV\n";
print rm($ARGV[1]);
},
'kill' => sub { ## right now kill and the others returns the same std out as rm does
print FH gettime(time), " @ARGV\n"; ## use rm() for now but might need to change later
print rm($ARGV[1]);
},
'pause' => sub {
print FH gettime(time), " @ARGV\n";
print rm($ARGV[1]);
},
'unpause' => sub {
print FH gettime(time), " @ARGV\n";
print rm($ARGV[1]);
}
);
if (defined $rules_arg{$ARGV[0]}) {
$rules_arg{$ARGV[0]}();
}
else {
print FH gettime(time), " Invalid command\n";
usage();
}
# functions related to different arguments
sub version {
my $line = "client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64
";
return $line;
}
sub info {
my $line = "Containers: 6
Images: 4
Storage Driver: devicemapper
Pool Name: docker-253:0-522536-pool
Pool Blocksize: 65.54 kB
Backing Filesystem: extfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 317.4 MB
Data Space Total: 107.4 GB
Data Space Available: 30.48 GB
Metadata Space Used: 1.069 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.146 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.89-RHEL6 (2014-09-01)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 2.6.32-642.11.1.el6.x86_64
Operating System: <unknown>
CPUs: 1
Total Memory: 1.826 GiB
Name: localhost.localdomain
ID: 4QHG:JPN3:H2UL:MANT:VUWJ:4J2G:WI6N:TASX:NWPF:G2J3:SVL6:CRDV
";
return $line;
}
sub images {
my $line = "REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest d4350798c2ee 5 weeks ago 191.8 MB
";
return $line;
}
sub run {
my $jobname = $_[0];
print "Job: $jobname, Id: ", int(rand(1000)), "\n";
sleep(60);
print FH gettime(time), " Job $jobname finished\n";
}
sub inspect {
my $jobname =$_[0];
return "[
{
\"Id\": \"a0b69664b42fc84b7bb46f4f51275efd3c81c687647d5c4e98018f2413a429c4\",
\"Created\": \"2017-01-23T22:49:18.611954836Z\",
\"Path\": \"/bin/bash\",
\"Args\": [],
\"State\": {
\"Running\": false,
\"Paused\": false,
\"Restarting\": false,
\"OOMKilled\": false,
\"Dead\": false,
\"Pid\": 0,
\"ExitCode\": 0,
\"Error\": \"\",
\"StartedAt\": \"2017-01-23T22:49:20.253395177Z\",
\"FinishedAt\": \"2017-01-23T22:49:20.961450116Z\"
},
\"Image\": \"fb434121fc77c965f255cbb848927f577bbdbd9325bdc1d7f1b33f99936b9abb\",
\"NetworkSettings\": {
\"Bridge\": \"\",
\"EndpointID\": \"\",
\"Gateway\": \"\",
\"GlobalIPv6Address\": \"\",
\"GlobalIPv6PrefixLen\": 0,
\"HairpinMode\": false,
\"IPAddress\": \"\",
\"IPPrefixLen\": 0,
\"IPv6Gateway\": \"\",
\"LinkLocalIPv6Address\": \"\",
\"LinkLocalIPv6PrefixLen\": 0,
\"MacAddress\": \"\",
\"NetworkID\": \"\",
\"PortMapping\": null,
\"Ports\": null,
\"SandboxKey\": \"\",
\"SecondaryIPAddresses\": null,
\"SecondaryIPv6Addresses\": null
},
\"ResolvConfPath\": \"/var/lib/docker/containers/a0b69664b42fc84b7bb46f4f51275efd3c81c687647d5c4e98018f2413a429c4/resolv.conf\",
\"HostnamePath\": \"/var/lib/docker/containers/a0b69664b42fc84b7bb46f4f51275efd3c81c687647d5c4e98018f2413a429c4/hostname\",
\"HostsPath\": \"/var/lib/docker/containers/a0b69664b42fc84b7bb46f4f51275efd3c81c687647d5c4e98018f2413a429c4/hosts\",
\"LogPath\": \"/var/lib/docker/containers/a0b69664b42fc84b7bb46f4f51275efd3c81c687647d5c4e98018f2413a429c4/a0b69664b42fc84b7bb46f4f51275efd3c81c687647d5c4e98018f2413a429c4-json.log\",
\"Name\": \"/$jobname\",
\"RestartCount\": 0,
\"Driver\": \"devicemapper\",
\"ExecDriver\": \"native-0.2\",
\"MountLabel\": \"\",
\"ProcessLabel\": \"\",
\"Volumes\": {},
\"VolumesRW\": {},
\"AppArmorProfile\": \"\",
\"ExecIDs\": null,
\"HostConfig\": {
\"Binds\": null,
\"ContainerIDFile\": \"\",
\"LxcConf\": [],
\"Memory\": 0,
\"MemorySwap\": 0,
\"CpuShares\": 0,
\"CpuPeriod\": 0,
\"CpusetCpus\": \"\",
\"CpusetMems\": \"\",
\"CpuQuota\": 0,
\"BlkioWeight\": 0,
\"OomKillDisable\": false,
\"Privileged\": false,
\"PortBindings\": {},
\"Links\": null,
\"PublishAllPorts\": false,
\"Dns\": null,
\"DnsSearch\": null,
\"ExtraHosts\": null,
\"VolumesFrom\": null,
\"Devices\": [],
\"NetworkMode\": \"bridge\",
\"IpcMode\": \"\",
\"PidMode\": \"\",
\"UTSMode\": \"\",
\"CapAdd\": null,
\"CapDrop\": null,
\"RestartPolicy\": {
\"Name\": \"no\",
\"MaximumRetryCount\": 0
},
\"SecurityOpt\": null,
\"ReadonlyRootfs\": false,
\"Ulimits\": null,
\"LogConfig\": {
\"Type\": \"json-file\",
\"Config\": {}
},
\"CgroupParent\": \"\"
},
\"Config\": {
\"Hostname\": \"a0b69664b42f\",
\"Domainname\": \"\",
\"User\": \"\",
\"AttachStdin\": false,
\"AttachStdout\": true,
\"AttachStderr\": true,
\"PortSpecs\": null,
\"ExposedPorts\": null,
\"Tty\": false,
\"OpenStdin\": false,
\"StdinOnce\": false,
\"Env\": [
\"PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"
],
\"Cmd\": [
\"/bin/bash\"
],
\"Image\": \"docker/test\",
\"Volumes\": null,
\"VolumeDriver\": \"\",
\"WorkingDir\": \"/test\",
\"Entrypoint\": null,
\"NetworkDisabled\": false,
\"MacAddress\": \"\",
\"OnBuild\": null,
\"Labels\": {}
}
}
]
";
}
sub rm {
my $jobname = $_[0];
return "$jobname\n";
}
# parse the command line arguments: 0->name 1->.....
sub parse_args {
my @args = @{$_[0]};
my @parsed_elements;
for my $i (0..(scalar @args)-1) {
if ($args[$i] =~ /--name/) {
$name = $args[$i+1];
}
# if ...... # other arguments
}
return @parsed_elements;
}
sub gettime {
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
$mon = sprintf("%d",$mon + 1);
$mday = sprintf("%d", $mday);
$hour = sprintf("%02d", $hour);
$min = sprintf("%02d", $min);
$sec = sprintf("%02d", $sec);
return ("$mon/$mday ", "$hour:$min:$sec");
}
sub usage {
print "Invalid command!\nUsage:
version: ./docker_simulator.pl version
info: ./docker_simulator.pl info
images: ./docker_simulator.pl images
run: ./docker_simulator.pl --name <JOBNAME>
inspect: ./docker_simulator.pl inspect <JOBNAME>
rm: ./docker_simulator.pl rm <JOBNAME>
kill: ./docker_simulator.pl kill <JOBNAME>
pause: ./docker_simulator.pl pause <JOBNAME>
unpause: ./docker_simulator.pl unpause <JOBNAME>
";
exit;
}
| 28.667656 | 187 | 0.562468 |
73dfbc8c3c972a6ac2943899599aab1c69e9bdb6 | 2,146 | t | Perl | modules/t/sliceVariation.t | duartemolha/ensembl | 378db18977278a066bd54b41e7afcf1db05d7db3 | [
"Apache-2.0"
]
| null | null | null | modules/t/sliceVariation.t | duartemolha/ensembl | 378db18977278a066bd54b41e7afcf1db05d7db3 | [
"Apache-2.0"
]
| null | null | null | modules/t/sliceVariation.t | duartemolha/ensembl | 378db18977278a066bd54b41e7afcf1db05d7db3 | [
"Apache-2.0"
]
| null | null | null | # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# Copyright [2016-2019] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use warnings;
use Test::More;
#use Test::Warnings;
use Bio::EnsEMBL::Test::TestUtils;
use Bio::EnsEMBL::Test::MultiTestDB;
use Bio::EnsEMBL::Slice;
our $verbose = 0;
#
# TEST - Slice Compiles
#
ok(1);
my $multi_db = Bio::EnsEMBL::Test::MultiTestDB->new;
my $db = $multi_db->get_DBAdaptor('core');
my $vdb = $multi_db->get_DBAdaptor('variation');
#
# TEST - Slice creation from adaptor
#
my $slice_adaptor = $db->get_SliceAdaptor;
# tests for variation related methods
my $slice = $slice_adaptor->fetch_by_region('chromosome', 20, 30_252_000, 31_252_001);
my $study_adaptor = $vdb->get_StudyAdaptor;
my $variation_set_adaptor = $vdb->get_VariationSetAdaptor;
my $population_adaptor = $vdb->get_PopulationAdaptor;
my $vfs = $slice->get_all_VariationFeatures;
is(scalar @$vfs, 2, 'get_all_VariationFeatures');
$vfs = $slice->get_all_somatic_VariationFeatures;
is(scalar @$vfs, 1, 'get_all_somatic_VariationFeatures');
$vfs = $slice->get_all_somatic_VariationFeatures_by_source('dbSNP');
is(scalar @$vfs, 1, 'get_all_somatic_VariationFeatures_by_source');
$vfs = $slice->get_all_somatic_VariationFeatures_with_phenotype;
is(scalar @$vfs, 1, 'get_all_somatic_VariationFeatures_with_phenotype');
my $population = $population_adaptor->fetch_by_name('population');
$vfs = $slice->get_all_VariationFeatures_by_Population($population);
is(scalar @$vfs, 1, 'get_all_VariationFeatures_by_Population');
done_testing();
| 34.063492 | 102 | 0.768406 |
73e86cafba203b43507189c7613aa22b6dac2dac | 847 | t | Perl | t/05-output-bool.t | Corion/DBIx--RunSQL | 583889bdf896c3511e2845fbbffd69d9f97d08a8 | [
"Artistic-2.0"
]
| null | null | null | t/05-output-bool.t | Corion/DBIx--RunSQL | 583889bdf896c3511e2845fbbffd69d9f97d08a8 | [
"Artistic-2.0"
]
| null | null | null | t/05-output-bool.t | Corion/DBIx--RunSQL | 583889bdf896c3511e2845fbbffd69d9f97d08a8 | [
"Artistic-2.0"
]
| 1 | 2019-09-10T14:40:18.000Z | 2019-09-10T14:40:18.000Z | #!perl -w
use strict;
use Test::More;
use DBIx::RunSQL;
use Data::Dumper;
# Test against a "real" database if we have one:
if( ! eval { require DBD::SQLite;
require 5.008; # for scalar open
1; }) {
plan skip_all => $@;
exit;
};
plan tests => 1;
# Redirect STDOUT to a variable
close STDOUT; # shhh
open STDOUT, '>', \my $output;
my $exitcode = DBIx::RunSQL->handle_command_line(
"my-test-app",
[
'--bool',
'--dsn' => 'dbi:SQLite:dbname=:memory:',
'--sql' => <<'SQL',
create table foo (bar integer, baz varchar);
insert into foo (bar,baz) values (1,'hello');
insert into foo (bar,baz) values (2,'world');
select * from foo;
SQL
]
);
is $exitcode, 1, "We get a nonzero exit code if a row gets selected with --bool"
or diag $output;
done_testing(); | 21.717949 | 80 | 0.582054 |
ed50448ff87bb8d99b143a82efdce2502ccd2ed8 | 19,704 | pm | Perl | perl-lib/OESS/lib/OESS/NSI/Provisioning.pm | bensiefers/OESS | c1cd89a926f35032b6c2cca772610cbefa7bf559 | [
"Apache-2.0"
]
| null | null | null | perl-lib/OESS/lib/OESS/NSI/Provisioning.pm | bensiefers/OESS | c1cd89a926f35032b6c2cca772610cbefa7bf559 | [
"Apache-2.0"
]
| null | null | null | perl-lib/OESS/lib/OESS/NSI/Provisioning.pm | bensiefers/OESS | c1cd89a926f35032b6c2cca772610cbefa7bf559 | [
"Apache-2.0"
]
| null | null | null | #!/usr/bin/perl
#
##----- D-Bus OESS NSI Provisioning State Machine
##-----
##----- Handles NSI Provisioning 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::Provisioning;
use strict;
use warnings;
use DateTime;
use SOAP::Lite on_action => sub { sprintf '"http://schemas.ogf.org/nsi/2013/12/connection/service/%s"', $_[1]};
use Time::HiRes qw(gettimeofday);
use Data::Dumper;
use GRNOC::Log;
use GRNOC::Config;
use GRNOC::WebService::Client;
use OESS::NSI::Constant;
use OESS::NSI::Utils;
use Data::UUID;
=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;
}
=head2 process_queue
=cut
sub process_queue {
my ($self) = @_;
log_debug("Processing Provisioning Queue.");
while(my $message = shift(@{$self->{'provisioning_queue'}})){
my $type = $message->{'type'};
if($type == OESS::NSI::Constant::PROVISIONING_SUCCESS){
log_debug("Handling Provisioning Success Message");
$self->_provisioning_success($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::DO_PROVISIONING){
log_debug("Actually provisioning");
$self->_do_provisioning($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::DO_TERMINATE){
log_debug("Actually terminating");
$self->_do_terminate($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::PROVISIONING_FAILED){
log_debug("Handling provisioning Fail Message");
$self->_provisioning_failed($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::TERMINATION_SUCCESS){
log_debug("handling terminate success");
$self->_terminate_success($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::TERMINATION_FAILED){
log_debug("handling termination failed!");
$self->_terminate_failure($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::DO_RELEASE){
$self->_do_release($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::RELEASE_FAILED){
log_debug("handling release failed");
$self->_release_failed($message->{'args'});
next;
}elsif($type == OESS::NSI::Constant::RELEASE_SUCCESS){
log_debug("handling release success");
$self->_release_confirmed($message->{'args'});
next;
}else{
log_error("Unknown type: " . $type);
next;
}
}
}
=head2 provision
=cut
sub provision{
my ($self, $args) = @_;
my $connection_id = $args->{'connectionId'};
log_info("provision: connectionId: " . $connection_id);
if(!defined($connection_id) || $connection_id eq ''){
log_error("Missing connection id!");
return OESS::NSI::Constant::MISSING_REQUEST_PARAMETERS;
}
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::DO_PROVISIONING, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
sub _do_provisioning{
my ($self, $args) = @_;
my $connection_id = $args->{'connectionId'};
log_debug("do provisioning: " . $connection_id);
my $ckt = $self->_get_circuit_details($connection_id);
if(!defined($ckt)){
log_error("Unable to fetch circuit details: " . $connection_id);
return;
}
my $url = $self->{'websvc_location'} . "provisioning.cgi";
$self->{'websvc'}->set_url($url);
my $res = $self->{'websvc'}->provision_circuit(
state => 'provisioned',
circuit_id => $connection_id,
workgroup_id => $self->{'workgroup_id'},
description => $ckt->{'description'},
name => $ckt->{'name'},
link => $ckt->{'link'},
backup_link => $ckt->{'backup_link'},
bandwidth => $ckt->{'bandwidth'},
provision_time => -1,
remove_time => 1,
node => $ckt->{'node'},
interface => $ckt->{'interface'},
tag => $ckt->{'tag'}
);
if (!defined $res) {
log_error("Couldn't call provision_circuit using $url: Fatal webservice error occurred.");
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::PROVISIONING_FAILED, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
if (defined $res->{'error'}) {
log_error("Couldn't call provision_circuit using $url: $res->{'error'}");
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::PROVISIONING_FAILED, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
log_debug("results of provision circuit: " . Data::Dumper::Dumper($res));
if (defined $res->{'results'}) {
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::PROVISIONING_SUCCESS, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
log_error("Error provisioning circuit: " . $res->{'error'});
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::PROVISIONING_FAILED, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
sub _get_circuit_details{
my $self = shift;
my $circuit_id = shift;
$self->{'websvc'}->set_url($self->{'websvc_location'} . "/data.cgi");
log_debug("fetching circuit details");
my $circuit = $self->{'websvc'}->get_circuit_details(
circuit_id => $circuit_id);
log_debug("Circuit Details: " . Data::Dumper::Dumper($circuit));
my $scheduled_actions = $self->{'websvc'}->get_circuit_scheduled_events(
circuit_id => $circuit_id);
log_debug("Circuit scheduled events: " . Data::Dumper::Dumper($scheduled_actions));
if(!defined($circuit) && !defined($circuit->{'results'})){
log_error("circuit $circuit_id was not defined");
return OESS::NSI::Constant::ERROR;
}
$circuit = $circuit->{'results'};
my @links = ();
foreach my $link (@{$circuit->{'links'}}){
push(@links, $link->{'name'});
}
my @backup_links = ();
foreach my $link (@{$circuit->{'backup_links'}}){
push(@backup_links, $link->{'name'});
}
my @nodes = ();
my @ints = ();
my @tags = ();
foreach my $ep (@{$circuit->{'endpoints'}}){
push(@nodes,$ep->{'node'});
push(@ints,$ep->{'interface'});
push(@tags,$ep->{'tag'});
}
my $ckt = { state => $circuit->{'state'},
circuit_id => $circuit->{'circuit_id'},
workgroup_id => $circuit->{'workgroup'}->{'workgroup_id'},
description => $circuit->{'description'},
name => $circuit->{'name'},
remote_url => $circuit->{'remote_url'},
remote_requester => $circuit->{'remote_requester'},
link => \@links,
backup_link => \@backup_links,
bandwidth => $circuit->{'bandwidth'},
provision_time => $circuit->{'provision_time'},
remove_time => $circuit->{'remove_time'},
node => \@nodes,
interface => \@ints,
tag => \@tags
};
return $ckt;
}
=head2 terminate
=cut
sub terminate{
my ($self, $args) = @_;
my $connection_id = $args->{'connectionId'};
log_info("terminate: connectionId: " . $connection_id);
if(!defined($connection_id) || $connection_id eq ''){
log_error("Missing connection id!");
return OESS::NSI::Constant::MISSING_REQUEST_PARAMETERS;
}
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::DO_TERMINATE, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
sub _do_terminate{
my ($self, $args) = @_;
my $connection_id = $args->{'connectionId'};
my $cgi = $self->{'websvc_location'} . "provisioning.cgi";
log_debug("_do_terminate - url: $cgi circuit: $connection_id");
$self->{'websvc'}->set_url($cgi);
my $res = $self->{'websvc'}->remove_circuit(circuit_id => $connection_id,
workgroup_id => $self->{'workgroup_id'},
remove_time => -1);
log_debug("Results of remove_circuit: " . Data::Dumper::Dumper($res));
if(defined($res) && defined($res->{'results'})){
log_info("Termination success: connection_id: " . $connection_id);
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::TERMINATION_SUCCESS, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
log_error("Unable to remove circuit: " . $res->{'error'} . " " . $res->{'error_text'} . Dumper($res));
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::TERMINATION_FAILED, args => $args});
return OESS::NSI::Constant::ERROR;
}
sub _provisioning_success{
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->provisionConfirmed($nsiheader, SOAP::Data->name(connectionId => $data->{'connectionId'})->type(''));
};
log_error("Unable to send provisionConfirmed message: " . Data::Dumper::Dumper($@)) if $@;
}
sub _terminate_success{
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->terminateConfirmed($nsiheader, SOAP::Data->name(connectionId => $data->{'connectionId'})->type(''));
};
log_error("Unable to send terminateConfirmed message: " . 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'}
);
$websvc->{'debug'} = 0;
$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->{'workgroup_id'} = $self->{'config'}->get('/config/oess-service/@workgroup-id');
$self->{'ug'} = Data::UUID->new;
$self->{'provisioning_queue'} = [];
}
sub _release_failed{
my ($self, $data) = @_;
log_error("RELEASE FAILED!!");
my $soap = OESS::NSI::Utils::build_client( proxy =>$data->{'header'}->{'replyTo'},ssl => $self->{'ssl'});
$self->_release_confirmed( $data );
my $nsiheader = OESS::NSI::Utils::build_header($data->{'header'});
eval{
my $db = OESS::Database->new();
my $dn = $db->get_local_domain_name();
my $providerNSA = "nsi" . $dn . ":2013:nsa";
my $soap_response = $soap->error($nsiheader, SOAP::Data->name( serviceException => \SOAP::Data->value( SOAP::Data->name( nsaid => $providerNSA)->type(''),
SOAP::Data->name( connectionId => $data->{'connectionId'})->type(''),
SOAP::Data->name( text => 'An error occured releasing the circuit')->type(''),
SOAP::Data->name( errorId => 00700 )->type(''))));
};
log_error("Unable to send releaseFailed message: " . Data::Dumper::Dumper($@)) if $@;
}
sub _provisioning_failed{
my ($self, $data) = @_;
log_error("provisioning FAILED!!");
$self->_provisioning_success( $data );
#ok now send the error
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 $db = OESS::Database->new();
my $dn = $db->get_local_domain_name();
my $providerNSA = "nsi" . $dn . ":2013:nsa";
my $soap_response = $soap->error($nsiheader, SOAP::Data->name( serviceException => \SOAP::Data->value( SOAP::Data->name( nsaid => $providerNSA)->type(''),
SOAP::Data->name( connectionId => $data->{'connectionId'})->type(''),
SOAP::Data->name( text => 'An error occured provisioning the circuit')->type(''),
SOAP::Data->name( errorId => 00700 )->type(''))));
};
log_error("Unable to send provisioningFailed message: " . Data::Dumper::Dumper($@)) if $@;
}
sub _terminate_failure{
my ($self, $data) = @_;
log_error("terminate FAILED!!");
#first send the terminate success
$self->_terminate_success( $data );
#now send the error
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 $db = OESS::Database->new();
my $dn = $db->get_local_domain_name();
my $providerNSA = "nsi" . $dn . ":2013:nsa";
my $soap_response = $soap->error($nsiheader, SOAP::Data->name( serviceException => \SOAP::Data->value( SOAP::Data->name( nsaid => $providerNSA)->type(''),
SOAP::Data->name( connectionId => $data->{'connectionId'})->type(''),
SOAP::Data->name( text => 'An error occured terminating the circuit')->type(''),
SOAP::Data->name( errorId => 00700 )->type(''))));
};
log_error("Unable to send terminateFailed message: " . Data::Dumper::Dumper($@)) if $@;
}
sub _do_release{
my ($self, $args) = @_;
my $connection_id = $args->{'connectionId'};
my $ckt = $self->_get_circuit_details($connection_id);
if (!defined $ckt->{'provision_time'}) {
$ckt->{'provision_time'} = -1;
}
if (!defined $ckt->{'remove_time'}) {
$ckt->{'remove_time'} = -1;
}
$self->{'websvc'}->set_url($self->{'websvc_location'} . "/provisioning.cgi");
my $res = $self->{'websvc'}->provision_circuit(
state => 'reserved',
circuit_id => $connection_id,
workgroup_id => $self->{'workgroup_id'},
description => $ckt->{'description'},
name => $ckt->{'name'},
link => $ckt->{'link'},
backup_link => $ckt->{'backup_link'},
bandwidth => $ckt->{'bandwidth'},
provision_time => $ckt->{'provision_time'},
remove_time => $ckt->{'remove_time'},
node => $ckt->{'node'},
interface => $ckt->{'interface'},
tag => $ckt->{'tag'});
if(defined($res) && defined($res->{'results'})){
log_info("Release connectionId: " . $args->{'connectionId'} . " success!");
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::RELEASE_SUCCESS, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
log_error("Unable to remove circuit: " . $res->{'error'} . " " . $res->{'error_text'});
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::RELEASE_FAILED, args => $args});
return OESS::NSI::Constant::ERROR;
}
=head2 release
=cut
sub release{
my ($self, $args) = @_;
log_info("release connectionId: " . $args->{'connectionId'});
push(@{$self->{'provisioning_queue'}}, {type => OESS::NSI::Constant::DO_RELEASE, args => $args});
return OESS::NSI::Constant::SUCCESS;
}
sub _build_dataPlaneStatus{
my $circuit_details = shift;
my $active = 'false';
if($circuit_details->{'state'} eq 'active'){
$active = 'true';
}
return SOAP::Data->name( dataPlaneStatus => \SOAP::Data->value( SOAP::Data->name( active => $active)->type(''),
SOAP::Data->name( version => 1)->type(''),
SOAP::Data->name( versionConsistent => 'true')->type('')));
}
=head2 dataPlaneStateChange
=cut
sub dataPlaneStateChange{
my $self = shift;
my $circuit = shift;
log_info("Circuit Modification detected: connectionId: " . $circuit);
my $ckt = $self->_get_circuit_details($circuit);
if(!defined($ckt->{'remote_url'}) || !defined($ckt->{'remote_requester'})){
log_error("Circuit in NSI workgroup, did not have remote_url or remote_requester specified!\n");
return;
}
my $soap = OESS::NSI::Utils::build_client( proxy => $ckt->{'remote_url'}, ssl => $self->{'ssl'});
my $nsiheader = OESS::NSI::Utils::build_header({ requesterNSA => $ckt->{'remote_requester'} });
eval{
my $resp = $soap->dataPlaneStateChange($nsiheader, SOAP::Data->name( connectionId => $circuit)->type(''),
SOAP::Data->name( notificationId => 1)->type(''),
SOAP::Data->name( timeStamp => _timestampNow() )->type(''),
_build_dataPlaneStatus($ckt ));
};
log_error("Unable to send dataPlaneStateChange message: " . Data::Dumper::Dumper($@)) if $@;
}
sub _timestampNow{
my $dt = DateTime->now();
return $dt->strftime( "%F" ) . "T" . $dt->strftime( "%T" ) . "Z";
}
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'});
my $soap_response = $soap->releaseConfirmed($nsiheader, SOAP::Data->name(connectionId => $data->{'connectionId'}));
}
1;
| 34.751323 | 162 | 0.55476 |
ed4aca4f9c1ccf22d1c45a280351d247225f6606 | 1,527 | pl | Perl | BioPerl/distance.pl | wojdyr/pdb-benchmarks | 6f99ef1ad7151c0c637f5f2a2c35a5b4ceb042fe | [
"MIT"
]
| 30 | 2016-05-21T18:07:36.000Z | 2022-02-25T15:10:49.000Z | BioPerl/distance.pl | wojdyr/pdb-benchmarks | 6f99ef1ad7151c0c637f5f2a2c35a5b4ceb042fe | [
"MIT"
]
| 7 | 2016-06-20T22:40:50.000Z | 2020-06-17T17:06:10.000Z | BioPerl/distance.pl | wojdyr/pdb-benchmarks | 6f99ef1ad7151c0c637f5f2a2c35a5b4ceb042fe | [
"MIT"
]
| 6 | 2016-05-26T14:44:28.000Z | 2020-05-26T09:50:47.000Z | # Benchmark the calculation of a distance in a PDB file
# The distance is the closest distance between any atoms of residues 50 and 60
# of chain A in 1AKE
use Bio::Structure::IO;
use Time::HiRes qw(time);
use strict;
my $pdb_filepath = "data/1AKE.pdb";
my $structio = Bio::Structure::IO->new(-file => $pdb_filepath);
my $struc = $structio->next_structure;
sub distance {
my @coords_50 = ();
my @coords_60 = ();
for my $chain ($struc->get_chains) {
if ($chain->id eq "A") {
for my $res ($struc->get_residues($chain)) {
if (substr($res->id, -3, 3) eq "-50") {
for my $atom ($struc->get_atoms($res)) {
push @coords_50, [$atom->xyz];
}
} elsif (substr($res->id, -3, 3) eq "-60") {
for my $atom ($struc->get_atoms($res)) {
push @coords_60, [$atom->xyz];
}
}
}
}
}
my $min_sq_dist = "Infinity";
for (my $i = 0; $i < scalar(@coords_50); $i++) {
for (my $j = 0; $j < scalar(@coords_60); $j++) {
my $sq_dist = ($coords_50[$i][0]-$coords_60[$j][0]) ** 2 + ($coords_50[$i][1]-$coords_60[$j][1]) ** 2 + ($coords_50[$i][2]-$coords_60[$j][2]) ** 2;
if ($sq_dist < $min_sq_dist) {
$min_sq_dist = $sq_dist;
}
}
}
return sqrt($min_sq_dist);
}
my $start = time();
distance();
my $end = time();
print $end - $start, "\n";
| 31.8125 | 159 | 0.486575 |
ed488c3a8230bbe2edd437bd969b6193a86eb8c5 | 5,073 | pm | Perl | auto-lib/Paws/SageMaker/AlgorithmSpecification.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/SageMaker/AlgorithmSpecification.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/SageMaker/AlgorithmSpecification.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::SageMaker::AlgorithmSpecification;
use Moose;
has AlgorithmName => (is => 'ro', isa => 'Str');
has EnableSageMakerMetricsTimeSeries => (is => 'ro', isa => 'Bool');
has MetricDefinitions => (is => 'ro', isa => 'ArrayRef[Paws::SageMaker::MetricDefinition]');
has TrainingImage => (is => 'ro', isa => 'Str');
has TrainingInputMode => (is => 'ro', isa => 'Str', required => 1);
1;
### main pod documentation begin ###
=head1 NAME
Paws::SageMaker::AlgorithmSpecification
=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::SageMaker::AlgorithmSpecification object:
$service_obj->Method(Att1 => { AlgorithmName => $value, ..., TrainingInputMode => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::SageMaker::AlgorithmSpecification object:
$result = $service_obj->Method(...);
$result->Att1->AlgorithmName
=head1 DESCRIPTION
Specifies the training algorithm to use in a CreateTrainingJob request.
For more information about algorithms provided by Amazon SageMaker, see
Algorithms
(https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html). For
information about using your own algorithms, see Using Your Own
Algorithms with Amazon SageMaker
(https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html).
=head1 ATTRIBUTES
=head2 AlgorithmName => Str
The name of the algorithm resource to use for the training job. This
must be an algorithm resource that you created or subscribe to on
Amazon Web Services Marketplace. If you specify a value for this
parameter, you can't specify a value for C<TrainingImage>.
=head2 EnableSageMakerMetricsTimeSeries => Bool
To generate and save time-series metrics during training, set to
C<true>. The default is C<false> and time-series metrics aren't
generated except in the following cases:
=over
=item *
You use one of the Amazon SageMaker built-in algorithms
=item *
You use one of the following Prebuilt Amazon SageMaker Docker Images
(https://docs.aws.amazon.com/sagemaker/latest/dg/pre-built-containers-frameworks-deep-learning.html):
=over
=item *
Tensorflow (version E<gt>= 1.15)
=item *
MXNet (version E<gt>= 1.6)
=item *
PyTorch (version E<gt>= 1.3)
=back
=item *
You specify at least one MetricDefinition
=back
=head2 MetricDefinitions => ArrayRef[L<Paws::SageMaker::MetricDefinition>]
A list of metric definition objects. Each object specifies the metric
name and regular expressions used to parse algorithm logs. Amazon
SageMaker publishes each metric to Amazon CloudWatch.
=head2 TrainingImage => Str
The registry path of the Docker image that contains the training
algorithm. For information about docker registry paths for built-in
algorithms, see Algorithms Provided by Amazon SageMaker: Common
Parameters
(https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html).
Amazon SageMaker supports both C<registry/repository[:tag]> and
C<registry/repository[@digest]> image path formats. For more
information, see Using Your Own Algorithms with Amazon SageMaker
(https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html).
=head2 B<REQUIRED> TrainingInputMode => Str
The input mode that the algorithm supports. For the input modes that
Amazon SageMaker algorithms support, see Algorithms
(https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html). If an
algorithm supports the C<File> input mode, Amazon SageMaker downloads
the training data from S3 to the provisioned ML storage Volume, and
mounts the directory to docker volume for training container. If an
algorithm supports the C<Pipe> input mode, Amazon SageMaker streams
data directly from S3 to the container.
In File mode, make sure you provision ML storage volume with sufficient
capacity to accommodate the data download from S3. In addition to the
training data, the ML storage volume also stores the output model. The
algorithm container use ML storage volume to also store intermediate
information, if any.
For distributed algorithms using File mode, training data is
distributed uniformly, and your training duration is predictable if the
input data objects size is approximately same. Amazon SageMaker does
not split the files any further for model training. If the object sizes
are skewed, training won't be optimal as the data distribution is also
skewed where one host in a training cluster is overloaded, thus
becoming bottleneck in training.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::SageMaker>
=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
| 31.70625 | 110 | 0.774295 |
Subsets and Splits