code stringlengths 2 1.05M | repo_name stringlengths 5 101 | path stringlengths 4 991 | language stringclasses 3 values | license stringclasses 5 values | size int64 2 1.05M |
|---|---|---|---|---|---|
=pod
=head1 NAME
evp - high-level cryptographic functions
=head1 SYNOPSIS
#include <openssl/evp.h>
=head1 DESCRIPTION
The EVP library provides a high-level interface to cryptographic
functions.
B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption
and decryption to implement digital "envelopes".
The B<EVP_Sign>I<...> and B<EVP_Verify>I<...> functions implement
digital signatures.
Symmetric encryption is available with the B<EVP_Encrypt>I<...>
functions. The B<EVP_Digest>I<...> functions provide message digests.
The B<EVP_PKEY>I<...> functions provide a high level interface to
asymmetric algorithms.
Algorithms are loaded with OpenSSL_add_all_algorithms(3).
All the symmetric algorithms (ciphers), digests and asymmetric algorithms
(public key algorithms) can be replaced by ENGINE modules providing alternative
implementations. If ENGINE implementations of ciphers or digests are registered
as defaults, then the various EVP functions will automatically use those
implementations automatically in preference to built in software
implementations. For more information, consult the engine(3) man page.
Although low level algorithm specific functions exist for many algorithms
their use is discouraged. They cannot be used with an ENGINE and ENGINE
versions of new algorithms cannot be accessed using the low level functions.
Also makes code harder to adapt to new algorithms and some options are not
cleanly supported at the low level and some operations are more efficient
using the high level interface.
=head1 SEE ALSO
L<EVP_DigestInit(3)|EVP_DigestInit(3)>,
L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>,
L<EVP_OpenInit(3)|EVP_OpenInit(3)>,
L<EVP_SealInit(3)|EVP_SealInit(3)>,
L<EVP_SignInit(3)|EVP_SignInit(3)>,
L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>,
L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)>,
L<engine(3)|engine(3)>
=cut
| GaloisInc/hacrypto | src/C/libssl/HEAD/src/doc/crypto/evp.pod | Perl | bsd-3-clause | 1,883 |
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
## we delete all files we don't need in this directory. Be careful in case users try running it somewhere else, outside this dir.
chdir $FindBin::Bin or die "error, cannot cd to $FindBin::Bin";
my @files_to_keep = qw (cleanme.pl
runMe.sh
samples_n_reads_decribed.txt
Makefile
);
my %keep = map { + $_ => 1 } @files_to_keep;
`rm -rf edgeR_\*`;
`find ./trinity_out_dir -type f -delete`;
`rm -rf ./trinity_out_dir`;
`rm -f rnaseq_reads/*fq`;
`rm -rf collectl/`;
`rm -rf *.stat/`;
`rm -rf ./read_content_analysis/`;
foreach my $file (<*>) {
if (! $keep{$file}) {
print STDERR "-removing file: $file\n";
unlink($file);
}
}
exit(0);
| ssn1306/trinityrnaseq | sample_data/test_full_edgeR_pipeline/cleanme.pl | Perl | bsd-3-clause | 829 |
#
# This file is part of CatalystX-ExtJS-Direct
#
# This software is Copyright (c) 2014 by Moritz Onken.
#
# This is free software, licensed under:
#
# The (three-clause) BSD License
#
package CatalystX::Action::ExtJS::Direct;
$CatalystX::Action::ExtJS::Direct::VERSION = '2.1.5';
# ABSTRACT: Placeholder
use Moose;
extends qw(Catalyst::Action);
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
CatalystX::Action::ExtJS::Direct - Placeholder
=head1 VERSION
version 2.1.5
=head1 AUTHOR
Moritz Onken <onken@netcubed.de>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Moritz Onken.
This is free software, licensed under:
The (three-clause) BSD License
=cut
| gitpan/CatalystX-ExtJS-Direct | lib/CatalystX/Action/ExtJS/Direct.pm | Perl | bsd-3-clause | 689 |
package AsposeStorageCloud::StorageApi;
require 5.6.0;
use strict;
use warnings;
use utf8;
use Exporter;
use Carp qw( croak );
use Log::Any qw($log);
use File::Slurp;
use AsposeStorageCloud::ApiClient;
use AsposeStorageCloud::Configuration;
my $VERSION = '1.03';
sub new {
my $class = shift;
my $default_api_client = $AsposeStorageCloud::Configuration::api_client ? $AsposeStorageCloud::Configuration::api_client :
AsposeStorageCloud::ApiClient->new;
my (%self) = (
'api_client' => $default_api_client,
@_
);
bless \%self, $class;
}
#
# GetDiscUsage
#
# Check the disk usage of the current account. Parameters: storage - user's storage name.
#
# @param string $storage (optional)
# @return DiscUsageResponse
#
sub GetDiscUsage {
my ($self, %args) = @_;
# parse inputs
my $_resource_path = '/storage/disc/?appSid={appSid}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'DiscUsageResponse', $response->header('content-type'));
return $_response_object;
}
#
# GetIsExist
#
# Check if a specific file or folder exists. Parameters: path - file or folder path e.g. /file.ext or /Folder1, versionID - file's version, storage - user's storage name.
#
# @param string $Path (required)
# @param string $versionId (optional)
# @param string $storage (optional)
# @return FileExistResponse
#
sub GetIsExist {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling GetIsExist");
}
# parse inputs
my $_resource_path = '/storage/exist/{path}/?appSid={appSid}&versionId={versionId}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'versionId'}) {
$_resource_path =~ s/\Q{versionId}\E/$args{'versionId'}/g;
}else{
$_resource_path =~ s/[?&]versionId.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'FileExistResponse', $response->header('content-type'));
return $_response_object;
}
#
# PutCopy
#
# Copy a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file's version, storage - user's source storage name, newdest - destination file path, destStorage - user's destination storage name.
#
# @param string $Path (required)
# @param string $newdest (required)
# @param file $file (required)
# @param string $versionId (optional)
# @param string $storage (optional)
# @param string $destStorage (optional)
# @return ResponseMessage
#
sub PutCopy {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling PutCopy");
}
# verify the required parameter 'newdest' is set
unless (exists $args{'newdest'}) {
croak("Missing the required parameter 'newdest' when calling PutCopy");
}
# verify the required parameter 'file' is set
unless (exists $args{'file'}) {
croak("Missing the required parameter 'file' when calling PutCopy");
}
# parse inputs
my $_resource_path = '/storage/file/{path}/?appSid={appSid}&newdest={newdest}&versionId={versionId}&storage={storage}&destStorage={destStorage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'PUT';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('multipart/form-data');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'newdest'}) {
$_resource_path =~ s/\Q{newdest}\E/$args{'newdest'}/g;
}else{
$_resource_path =~ s/[?&]newdest.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'versionId'}) {
$_resource_path =~ s/\Q{versionId}\E/$args{'versionId'}/g;
}else{
$_resource_path =~ s/[?&]versionId.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'destStorage'}) {
$_resource_path =~ s/\Q{destStorage}\E/$args{'destStorage'}/g;
}else{
$_resource_path =~ s/[?&]destStorage.*?(?=&|\?|$)//g;
}
my $_body_data;
# form params
if ( exists $args{'file'} ) {
$_body_data = read_file( $args{'file'} , binmode => ':raw' );
}
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'ResponseMessage', $response->header('content-type'));
return $_response_object;
}
#
# GetDownload
#
# Download a specific file. Parameters: path - file path e.g. /file.ext, versionID - file's version, storage - user's storage name.
#
# @param string $Path (required)
# @param string $versionId (optional)
# @param string $storage (optional)
# @return ResponseMessage
#
sub GetDownload {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling GetDownload");
}
# parse inputs
my $_resource_path = '/storage/file/{path}/?appSid={appSid}&versionId={versionId}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/octet-stream');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'versionId'}) {
$_resource_path =~ s/\Q{versionId}\E/$args{'versionId'}/g;
}else{
$_resource_path =~ s/[?&]versionId.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'ResponseMessage', $response->header('content-type'));
return $_response_object;
}
#
# PutCreate
#
# Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file's version, storage - user's source storage name, newdest - destination file path, destStorage - user's destination storage name.
#
# @param string $Path (required)
# @param file $file (required)
# @param string $versionId (optional)
# @param string $storage (optional)
# @return ResponseMessage
#
sub PutCreate {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling PutCreate");
}
# verify the required parameter 'file' is set
unless (exists $args{'file'}) {
croak("Missing the required parameter 'file' when calling PutCreate");
}
# parse inputs
my $_resource_path = '/storage/file/{path}/?appSid={appSid}&versionId={versionId}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'PUT';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('multipart/form-data');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'versionId'}) {
$_resource_path =~ s/\Q{versionId}\E/$args{'versionId'}/g;
}else{
$_resource_path =~ s/[?&]versionId.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# form params
if ( exists $args{'file'} ) {
$_body_data = read_file( $args{'file'} , binmode => ':raw' );
}
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'ResponseMessage', $response->header('content-type'));
return $_response_object;
}
#
# DeleteFile
#
# Remove a specific file. Parameters: path - file path e.g. /file.ext, versionID - file's version, storage - user's storage name.
#
# @param string $Path (required)
# @param string $versionId (optional)
# @param string $storage (optional)
# @return RemoveFileResponse
#
sub DeleteFile {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling DeleteFile");
}
# parse inputs
my $_resource_path = '/storage/file/{path}/?appSid={appSid}&versionId={versionId}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'DELETE';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'versionId'}) {
$_resource_path =~ s/\Q{versionId}\E/$args{'versionId'}/g;
}else{
$_resource_path =~ s/[?&]versionId.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'RemoveFileResponse', $response->header('content-type'));
return $_response_object;
}
#
# PostMoveFile
#
# Move a specific file.
#
# @param string $src source file path e.g. /file.ext (required)
# @param string $dest (required)
# @param string $versionId source file's version, (optional)
# @param string $storage user's source storage name (optional)
# @param string $destStorage user's destination storage name (optional)
# @return MoveFileResponse
#
sub PostMoveFile {
my ($self, %args) = @_;
# verify the required parameter 'src' is set
unless (exists $args{'src'}) {
croak("Missing the required parameter 'src' when calling PostMoveFile");
}
# verify the required parameter 'dest' is set
unless (exists $args{'dest'}) {
croak("Missing the required parameter 'dest' when calling PostMoveFile");
}
# parse inputs
my $_resource_path = '/storage/file/{src}/?dest={dest}&appSid={appSid}&versionId={versionId}&storage={storage}&destStorage={destStorage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'POST';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'src'}) {
$_resource_path =~ s/\Q{src}\E/$args{'src'}/g;
}else{
$_resource_path =~ s/[?&]src.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'dest'}) {
$_resource_path =~ s/\Q{dest}\E/$args{'dest'}/g;
}else{
$_resource_path =~ s/[?&]dest.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'versionId'}) {
$_resource_path =~ s/\Q{versionId}\E/$args{'versionId'}/g;
}else{
$_resource_path =~ s/[?&]versionId.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'destStorage'}) {
$_resource_path =~ s/\Q{destStorage}\E/$args{'destStorage'}/g;
}else{
$_resource_path =~ s/[?&]destStorage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'MoveFileResponse', $response->header('content-type'));
return $_response_object;
}
#
# PutCopyFolder
#
# Copy a folder. Parameters: path - source folder path e.g. /Folder1, storage - user's source storage name, newdest - destination folder path e.g. /Folder2, destStorage - user's destination storage name.
#
# @param string $Path (required)
# @param string $newdest (required)
# @param string $storage (optional)
# @param string $destStorage (optional)
# @return ResponseMessage
#
sub PutCopyFolder {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling PutCopyFolder");
}
# verify the required parameter 'newdest' is set
unless (exists $args{'newdest'}) {
croak("Missing the required parameter 'newdest' when calling PutCopyFolder");
}
# parse inputs
my $_resource_path = '/storage/folder/{path}/?appSid={appSid}&newdest={newdest}&storage={storage}&destStorage={destStorage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'PUT';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'newdest'}) {
$_resource_path =~ s/\Q{newdest}\E/$args{'newdest'}/g;
}else{
$_resource_path =~ s/[?&]newdest.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'destStorage'}) {
$_resource_path =~ s/\Q{destStorage}\E/$args{'destStorage'}/g;
}else{
$_resource_path =~ s/[?&]destStorage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'ResponseMessage', $response->header('content-type'));
return $_response_object;
}
#
# GetListFiles
#
# Get the file listing of a specific folder. Parametres: path - start with name of storage e.g. root folder '/'or some folder '/folder1/..', storage - user's storage name.
#
# @param string $Path (optional)
# @param string $storage (optional)
# @return ResponseMessage
#
sub GetListFiles {
my ($self, %args) = @_;
# parse inputs
my $_resource_path = '/storage/folder/{path}/?appSid={appSid}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'ResponseMessage', $response->header('content-type'));
return $_response_object;
}
#
# PutCreateFolder
#
# Create the folder. Parameters: path - source folder path e.g. /Folder1, storage - user's source storage name, newdest - destination folder path e.g. /Folder2, destStorage - user's destination storage name.
#
# @param string $Path (required)
# @param string $storage (optional)
# @param string $destStorage (optional)
# @return ResponseMessage
#
sub PutCreateFolder {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling PutCreateFolder");
}
# parse inputs
my $_resource_path = '/storage/folder/{path}/?appSid={appSid}&storage={storage}&destStorage={destStorage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'PUT';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'destStorage'}) {
$_resource_path =~ s/\Q{destStorage}\E/$args{'destStorage'}/g;
}else{
$_resource_path =~ s/[?&]destStorage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'ResponseMessage', $response->header('content-type'));
return $_response_object;
}
#
# DeleteFolder
#
# Remove a specific folder. Parameters: path - folder path e.g. /Folder1, storage - user's storage name, recursive - is subfolders and files must be deleted for specified path.
#
# @param string $Path (required)
# @param string $storage (optional)
# @param boolean $recursive (optional)
# @return RemoveFolderResponse
#
sub DeleteFolder {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling DeleteFolder");
}
# parse inputs
my $_resource_path = '/storage/folder/{path}/?appSid={appSid}&storage={storage}&recursive={recursive}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'DELETE';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'recursive'}) {
$_resource_path =~ s/\Q{recursive}\E/$args{'recursive'}/g;
}else{
$_resource_path =~ s/[?&]recursive.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'RemoveFolderResponse', $response->header('content-type'));
return $_response_object;
}
#
# PostMoveFolder
#
# Move a specific folder. Parameters: src - source folder path e.g. /Folder1, storage - user's source storage name, dest - destination folder path e.g. /Folder2, destStorage - user's destination storage name.
#
# @param string $src (required)
# @param string $dest (required)
# @param string $storage (optional)
# @param string $destStorage (optional)
# @return MoveFolderResponse
#
sub PostMoveFolder {
my ($self, %args) = @_;
# verify the required parameter 'src' is set
unless (exists $args{'src'}) {
croak("Missing the required parameter 'src' when calling PostMoveFolder");
}
# verify the required parameter 'dest' is set
unless (exists $args{'dest'}) {
croak("Missing the required parameter 'dest' when calling PostMoveFolder");
}
# parse inputs
my $_resource_path = '/storage/folder/{src}/?dest={dest}&appSid={appSid}&storage={storage}&destStorage={destStorage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'POST';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'src'}) {
$_resource_path =~ s/\Q{src}\E/$args{'src'}/g;
}else{
$_resource_path =~ s/[?&]src.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'dest'}) {
$_resource_path =~ s/\Q{dest}\E/$args{'dest'}/g;
}else{
$_resource_path =~ s/[?&]dest.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'destStorage'}) {
$_resource_path =~ s/\Q{destStorage}\E/$args{'destStorage'}/g;
}else{
$_resource_path =~ s/[?&]destStorage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'MoveFolderResponse', $response->header('content-type'));
return $_response_object;
}
#
# GetListFileVersions
#
# Get the file's versions list. Parameters: path - file path e.g. /file.ext or /Folder1/file.ext, storage - user's storage name.
#
# @param string $Path (required)
# @param string $storage (optional)
# @return FileVersionsResponse
#
sub GetListFileVersions {
my ($self, %args) = @_;
# verify the required parameter 'Path' is set
unless (exists $args{'Path'}) {
croak("Missing the required parameter 'Path' when calling GetListFileVersions");
}
# parse inputs
my $_resource_path = '/storage/version/{path}/?appSid={appSid}&storage={storage}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'Path'}) {
$_resource_path =~ s/\Q{Path}\E/$args{'Path'}/g;
}else{
$_resource_path =~ s/[?&]Path.*?(?=&|\?|$)//g;
}# query params
if ( exists $args{'storage'}) {
$_resource_path =~ s/\Q{storage}\E/$args{'storage'}/g;
}else{
$_resource_path =~ s/[?&]storage.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'FileVersionsResponse', $response->header('content-type'));
return $_response_object;
}
#
# GetIsStorageExist
#
# Check if a specific storage exists.
#
# @param string $name Storage name (required)
# @return StorageExistResponse
#
sub GetIsStorageExist {
my ($self, %args) = @_;
# verify the required parameter 'name' is set
unless (exists $args{'name'}) {
croak("Missing the required parameter 'name' when calling GetIsStorageExist");
}
# parse inputs
my $_resource_path = '/storage/{name}/exist/?appSid={appSid}';
$_resource_path =~ s/\Q&\E/&/g;
$_resource_path =~ s/\Q\/?\E/?/g;
$_resource_path =~ s/\QtoFormat={toFormat}\E/format={format}"/g;
$_resource_path =~ s/\Q{path}\E/{Path}/g;
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# query params
if ( exists $args{'name'}) {
$_resource_path =~ s/\Q{name}\E/$args{'name'}/g;
}else{
$_resource_path =~ s/[?&]name.*?(?=&|\?|$)//g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
if($AsposeStorageCloud::Configuration::debug){
print "\nResponse Content: ".$response->content;
}
my $_response_object = $self->{api_client}->pre_deserialize($response->content, 'StorageExistResponse', $response->header('content-type'));
return $_response_object;
}
1;
| aspose-total/Aspose.Total-for-Cloud | SDKs/Aspose.Storage-Cloud-SDK-for-Perl/lib/AsposeStorageCloud/StorageApi.pm | Perl | mit | 38,027 |
package Paws::CloudSearchDomain::UploadDocumentsResponse;
use Moose;
has Adds => (is => 'ro', isa => 'Int', traits => ['NameInRequest'], request_name => 'adds');
has Deletes => (is => 'ro', isa => 'Int', traits => ['NameInRequest'], request_name => 'deletes');
has Status => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'status');
has Warnings => (is => 'ro', isa => 'ArrayRef[Paws::CloudSearchDomain::DocumentServiceWarning]', traits => ['NameInRequest'], request_name => 'warnings');
has _request_id => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::CloudSearchDomain::UploadDocumentsResponse
=head1 ATTRIBUTES
=head2 Adds => Int
The number of documents that were added to the search domain.
=head2 Deletes => Int
The number of documents that were deleted from the search domain.
=head2 Status => Str
The status of an C<UploadDocumentsRequest>.
=head2 Warnings => ArrayRef[L<Paws::CloudSearchDomain::DocumentServiceWarning>]
Any warnings returned by the document service about the documents being
uploaded.
=head2 _request_id => Str
=cut
| ioanrogers/aws-sdk-perl | auto-lib/Paws/CloudSearchDomain/UploadDocumentsResponse.pm | Perl | apache-2.0 | 1,141 |
#!/usr/bin/perl -w
use 5.6.1;
use strict;
use warnings;
use Parse::DMIDecode qw();
my $dmi = Parse::DMIDecode->new( nowarnings => 1 );
$dmi->probe;
my $physical_cpus = 0;
for my $handle ($dmi->get_handles(group => "processor")) {
my $type = ($handle->keyword("processor-type") or "");
next unless $type =~ /Central Processor/i;
# Check the status of the cpu
my $status = ($handle->keyword("processor-status") or "");
if ($status !~ /Unpopulated/i) {
$physical_cpus++;
}
}
printf("There %s %d physical %s in this machine.\n",
($physical_cpus == 1 ? "is" : "are"),
$physical_cpus,
($physical_cpus == 1 ? "CPU" : "CPUs"),
);
exit;
__END__
| gitpan/Parse-DMIDecode | examples/physical_cpus.pl | Perl | apache-2.0 | 660 |
# $FreeBSD$
use strict;
use warnings;
use Test::More tests => 19;
use Fcntl qw(:DEFAULT :seek);
use constant BLK => 512;
use constant BLKS_PER_MB => 2048;
my $unit;
END { system "mdconfig -du$unit" if defined $unit };
sub setsize {
my ($partszMB, $unitszMB) = @_;
open my $fd, "|-", "disklabel -R md$unit /dev/stdin" or die;
print $fd "a: ", ($partszMB * BLKS_PER_MB), " 0 4.2BSD 1024 8192\n";
print $fd "c: ", ($unitszMB * BLKS_PER_MB), " 0 unused 0 0\n";
close $fd;
}
sub fill {
my ($start, $size, $content) = @_;
my $content512 = $content x (int(512 / length $content) + 1);
substr($content512, 512) = "";
sysopen my $fd, "/dev/md$unit", O_RDWR or die "/dev/md$unit: $!";
seek($fd, $start * BLK, SEEK_SET);
while ($size) {
syswrite($fd, $content512) == 512 or die "write: $!";
$size--;
}
}
SKIP: {
skip "Cannot test without UID 0", 19 if $<;
chomp(my $md = `mdconfig -s40m`);
like($md, qr/^md\d+$/, "Created $md with size 40m") or die;
$unit = substr $md, 2;
for my $type (1..2) {
initialise: {
ok(setsize(10, 40), "Sized ${md}a to 10m");
system "newfs -O $type -U ${md}a >/dev/null";
is($?, 0, "Initialised the filesystem on ${md}a as UFS$type");
chomp(my @out = `fsck -tufs -y ${md}a`);
ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " .
scalar(@out) . " lines of output");
}
extend20_zeroed: {
ok(setsize(20, 40), "Sized ${md}a to 20m");
diag "Filling the extent with zeros";
fill(10 * BLKS_PER_MB, 10 * BLKS_PER_MB, chr(0));
my $out = `growfs -y ${md}a`;
is($?, 0, "Extended the filesystem on ${md}a") or print $out;
my ($unallocated) = $out =~ m{\d+ sectors cannot be allocated};
fill(30 * BLKS_PER_MB - $unallocated, $unallocated, chr(0))
if $unallocated;
chomp(my @out = `fsck -tufs -y ${md}a`);
ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " .
scalar(@out) . " lines of output");
}
extend30_garbaged: {
ok(setsize(30, 40), "Sized ${md}a to 30m");
diag "Filling the extent with garbage";
fill(20 * BLKS_PER_MB, 10 * BLKS_PER_MB, chr(0xaa) . chr(0x55));
my $out = `growfs -y ${md}a`;
is($?, 0, "Extended the filesystem on ${md}a") or print $out;
my ($unallocated) = $out =~ m{\d+ sectors cannot be allocated};
fill(30 * BLKS_PER_MB - $unallocated, $unallocated, chr(0))
if $unallocated;
chomp(my @out = `fsck -tufs -y ${md}a`);
ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " .
scalar(@out) . " lines of output");
}
}
system "mdconfig -du$unit";
undef $unit;
}
| jrobhoward/SCADAbase | sbin/growfs/tests/legacy_test.pl | Perl | bsd-3-clause | 2,631 |
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test;
BEGIN { plan tests => 1 };
use DFA::Statemap;
ok(1); # If we made it this far, we're ok.
#########################
# Insert your test code below, the Test module is use()ed here so read
# its man page ( perldoc Test ) for help writing this test script.
| kaoru2010/android-startup-project | tools/smc/smc_6_5_0/lib/Perl/test.pl | Perl | apache-2.0 | 493 |
=pod
=head1 NAME
s_client - SSL/TLS client program
=head1 SYNOPSIS
B<openssl> B<s_client>
[B<-connect host:port>]
[B<-servername name>]
[B<-verify depth>]
[B<-verify_return_error>]
[B<-cert filename>]
[B<-certform DER|PEM>]
[B<-key filename>]
[B<-keyform DER|PEM>]
[B<-pass arg>]
[B<-CApath directory>]
[B<-CAfile filename>]
[B<-no_alt_chains>]
[B<-reconnect>]
[B<-pause>]
[B<-showcerts>]
[B<-debug>]
[B<-msg>]
[B<-nbio_test>]
[B<-state>]
[B<-nbio>]
[B<-crlf>]
[B<-ign_eof>]
[B<-no_ign_eof>]
[B<-quiet>]
[B<-ssl2>]
[B<-ssl3>]
[B<-tls1>]
[B<-no_ssl2>]
[B<-no_ssl3>]
[B<-no_tls1>]
[B<-no_tls1_1>]
[B<-no_tls1_2>]
[B<-fallback_scsv>]
[B<-bugs>]
[B<-sigalgs sigalglist>]
[B<-curves curvelist>]
[B<-cipher cipherlist>]
[B<-serverpref>]
[B<-starttls protocol>]
[B<-engine id>]
[B<-tlsextdebug>]
[B<-no_ticket>]
[B<-sess_out filename>]
[B<-sess_in filename>]
[B<-rand file(s)>]
[B<-serverinfo types>]
[B<-status>]
[B<-alpn protocols>]
[B<-nextprotoneg protocols>]
=head1 DESCRIPTION
The B<s_client> command implements a generic SSL/TLS client which connects
to a remote host using SSL/TLS. It is a I<very> useful diagnostic tool for
SSL servers.
=head1 OPTIONS
=over 4
=item B<-connect host:port>
This specifies the host and optional port to connect to. If not specified
then an attempt is made to connect to the local host on port 4433.
=item B<-servername name>
Set the TLS SNI (Server Name Indication) extension in the ClientHello message.
=item B<-cert certname>
The certificate to use, if one is requested by the server. The default is
not to use a certificate.
=item B<-certform format>
The certificate format to use: DER or PEM. PEM is the default.
=item B<-key keyfile>
The private key to use. If not specified then the certificate file will
be used.
=item B<-keyform format>
The private format to use: DER or PEM. PEM is the default.
=item B<-pass arg>
the private key password source. For more information about the format of B<arg>
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
=item B<-verify depth>
The verify depth to use. This specifies the maximum length of the
server certificate chain and turns on server certificate verification.
Currently the verify operation continues after errors so all the problems
with a certificate chain can be seen. As a side effect the connection
will never fail due to a server certificate verify failure.
=item B<-verify_return_error>
Return verification errors instead of continuing. This will typically
abort the handshake with a fatal error.
=item B<-CApath directory>
The directory to use for server certificate verification. This directory
must be in "hash format", see B<verify> for more information. These are
also used when building the client certificate chain.
=item B<-CAfile file>
A file containing trusted certificates to use during server authentication
and to use when attempting to build the client certificate chain.
=item B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig -no_alt_chains>
Set various certificate chain valiadition option. See the
L<B<verify>|verify(1)> manual page for details.
=item B<-reconnect>
reconnects to the same server 5 times using the same session ID, this can
be used as a test that session caching is working.
=item B<-pause>
pauses 1 second between each read and write call.
=item B<-showcerts>
display the whole server certificate chain: normally only the server
certificate itself is displayed.
=item B<-prexit>
print session information when the program exits. This will always attempt
to print out information even if the connection fails. Normally information
will only be printed out once if the connection succeeds. This option is useful
because the cipher in use may be renegotiated or the connection may fail
because a client certificate is required or is requested only after an
attempt is made to access a certain URL. Note: the output produced by this
option is not always accurate because a connection might never have been
established.
=item B<-state>
prints out the SSL session states.
=item B<-debug>
print extensive debugging information including a hex dump of all traffic.
=item B<-msg>
show all protocol messages with hex dump.
=item B<-nbio_test>
tests non-blocking I/O
=item B<-nbio>
turns on non-blocking I/O
=item B<-crlf>
this option translated a line feed from the terminal into CR+LF as required
by some servers.
=item B<-ign_eof>
inhibit shutting down the connection when end of file is reached in the
input.
=item B<-quiet>
inhibit printing of session and certificate information. This implicitly
turns on B<-ign_eof> as well.
=item B<-no_ign_eof>
shut down the connection when end of file is reached in the input.
Can be used to override the implicit B<-ign_eof> after B<-quiet>.
=item B<-psk_identity identity>
Use the PSK identity B<identity> when using a PSK cipher suite.
=item B<-psk key>
Use the PSK key B<key> when using a PSK cipher suite. The key is
given as a hexadecimal number without leading 0x, for example -psk
1a2b3c4d.
=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2>
These options require or disable the use of the specified SSL or TLS protocols.
By default the initial handshake uses a I<version-flexible> method which will
negotiate the highest mutually supported protocol version.
=item B<-fallback_scsv>
Send TLS_FALLBACK_SCSV in the ClientHello.
=item B<-bugs>
there are several known bug in SSL and TLS implementations. Adding this
option enables various workarounds.
=item B<-sigalgs sigalglist>
Specifies the list of signature algorithms that are sent by the client.
The server selects one entry in the list based on its preferences.
For example strings, see L<SSL_CTX_set1_sigalgs(3)>
=item B<-curves curvelist>
Specifies the list of supported curves to be sent by the client. The curve is
is ultimately selected by the server. For a list of all curves, use:
$ openssl ecparam -list_curves
=item B<-cipher cipherlist>
this allows the cipher list sent by the client to be modified. Although
the server determines which cipher suite is used it should take the first
supported cipher in the list sent by the client. See the B<ciphers>
command for more information.
=item B<-serverpref>
use the server's cipher preferences; only used for SSLV2.
=item B<-starttls protocol>
send the protocol-specific message(s) to switch to TLS for communication.
B<protocol> is a keyword for the intended protocol. Currently, the only
supported keywords are "smtp", "pop3", "imap", and "ftp".
=item B<-tlsextdebug>
print out a hex dump of any TLS extensions received from the server.
=item B<-no_ticket>
disable RFC4507bis session ticket support.
=item B<-sess_out filename>
output SSL session to B<filename>
=item B<-sess_in sess.pem>
load SSL session from B<filename>. The client will attempt to resume a
connection from this session.
=item B<-engine id>
specifying an engine (by its unique B<id> string) will cause B<s_client>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
=item B<-rand file(s)>
a file or files containing random data used to seed the random number
generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
Multiple files can be specified separated by a OS-dependent character.
The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
all others.
=item B<-serverinfo types>
a list of comma-separated TLS Extension Types (numbers between 0 and
65535). Each type will be sent as an empty ClientHello TLS Extension.
The server's response (if any) will be encoded and displayed as a PEM
file.
=item B<-status>
sends a certificate status request to the server (OCSP stapling). The server
response (if any) is printed out.
=item B<-alpn protocols>, B<-nextprotoneg protocols>
these flags enable the
Enable the Application-Layer Protocol Negotiation or Next Protocol
Negotiation extension, respectively. ALPN is the IETF standard and
replaces NPN.
The B<protocols> list is a
comma-separated protocol names that the client should advertise
support for. The list should contain most wanted protocols first.
Protocol names are printable ASCII strings, for example "http/1.1" or
"spdy/3".
Empty list of protocols is treated specially and will cause the client to
advertise support for the TLS extension but disconnect just after
reciving ServerHello with a list of server supported protocols.
=back
=head1 CONNECTED COMMANDS
If a connection is established with an SSL server then any data received
from the server is displayed and any key presses will be sent to the
server. When used interactively (which means neither B<-quiet> nor B<-ign_eof>
have been given), the session will be renegotiated if the line begins with an
B<R>, and if the line begins with a B<Q> or if end of file is reached, the
connection will be closed down.
=head1 NOTES
B<s_client> can be used to debug SSL servers. To connect to an SSL HTTP
server the command:
openssl s_client -connect servername:443
would typically be used (https uses port 443). If the connection succeeds
then an HTTP command can be given such as "GET /" to retrieve a web page.
If the handshake fails then there are several possible causes, if it is
nothing obvious like no client certificate then the B<-bugs>, B<-ssl2>,
B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> options can be tried
in case it is a buggy server. In particular you should play with these
options B<before> submitting a bug report to an OpenSSL mailing list.
A frequent problem when attempting to get client certificates working
is that a web client complains it has no certificates or gives an empty
list to choose from. This is normally because the server is not sending
the clients certificate authority in its "acceptable CA list" when it
requests a certificate. By using B<s_client> the CA list can be viewed
and checked. However some servers only request client authentication
after a specific URL is requested. To obtain the list in this case it
is necessary to use the B<-prexit> option and send an HTTP request
for an appropriate page.
If a certificate is specified on the command line using the B<-cert>
option it will not be used unless the server specifically requests
a client certificate. Therefor merely including a client certificate
on the command line is no guarantee that the certificate works.
If there are problems verifying a server certificate then the
B<-showcerts> option can be used to show the whole chain.
Since the SSLv23 client hello cannot include compression methods or extensions
these will only be supported if its use is disabled, for example by using the
B<-no_sslv2> option.
The B<s_client> utility is a test tool and is designed to continue the
handshake after any certificate verification errors. As a result it will
accept any certificate chain (trusted or not) sent by the peer. None test
applications should B<not> do this as it makes them vulnerable to a MITM
attack. This behaviour can be changed by with the B<-verify_return_error>
option: any verify errors are then returned aborting the handshake.
=head1 BUGS
Because this program has a lot of options and also because some of
the techniques used are rather old, the C source of s_client is rather
hard to read and not a model of how things should be done. A typical
SSL client program would be much simpler.
The B<-prexit> option is a bit of a hack. We should really report
information whenever a session is renegotiated.
=head1 SEE ALSO
L<sess_id(1)|sess_id(1)>, L<s_server(1)|s_server(1)>, L<ciphers(1)|ciphers(1)>
=head1 HISTORY
The -no_alt_chains options was first added to OpenSSL 1.0.2b.
=cut
| LomoX-Offical/nginx-openresty-windows | src/nginx/objs/lib_x64/openssl/doc/apps/s_client.pod | Perl | bsd-2-clause | 11,929 |
package Net::DNS::RR::TSIG;
#
# $Id: TSIG.pm 932 2011-10-26 12:40:48Z willem $
#
use strict;
BEGIN {
eval { require bytes; }
}
use vars qw(@ISA $VERSION);
use Digest::HMAC_MD5;
use MIME::Base64;
use constant DEFAULT_ALGORITHM => "HMAC-MD5.SIG-ALG.REG.INT";
use constant DEFAULT_FUDGE => 300;
@ISA = qw(Net::DNS::RR);
$VERSION = (qw$LastChangedRevision: 932 $)[1];
# a signing function for the HMAC-MD5 algorithm. This can be overridden using
# the sign_func element
sub sign_hmac {
my ($key, $data) = @_;
$key =~ s/ //g;
$key = decode_base64($key);
my $hmac = Digest::HMAC_MD5->new($key);
$hmac->add($data);
return $hmac->digest;
}
sub new {
my ($class, $self, $data, $offset) = @_;
if ($self->{"rdlength"} > 0) {
($self->{"algorithm"}, $offset) = Net::DNS::Packet::dn_expand($data, $offset);
my ($time_high, $time_low) = unpack("\@$offset nN", $$data);
$self->{"time_signed"} = $time_low; # bug
$offset += Net::DNS::INT16SZ() + Net::DNS::INT32SZ();
@{$self}{qw(fudge mac_size)} = unpack("\@$offset nn", $$data);
$offset += Net::DNS::INT16SZ() + Net::DNS::INT16SZ();
$self->{"mac"} = substr($$data, $offset, $self->{'mac_size'});
$offset += $self->{'mac_size'};
@{$self}{qw(original_id error other_len)} = unpack("\@$offset nnn", $$data);
$offset += Net::DNS::INT16SZ() * 3;
my $odata = substr($$data, $offset, $self->{'other_len'});
my ($odata_high, $odata_low) = unpack("nN", $odata);
$self->{"other_data"} = $odata_low;
}
return bless $self, $class;
}
sub new_from_string {
my ($class, $self, $string) = @_;
if ($string && ($string =~ /^(.*)$/)) {
$self->{"key"} = $1;
}
$self->{"algorithm"} = DEFAULT_ALGORITHM;
$self->{"time_signed"} = time;
$self->{"fudge"} = DEFAULT_FUDGE;
$self->{"mac_size"} = 0;
$self->{"mac"} = "";
$self->{"original_id"} = 0;
$self->{"error"} = 0;
$self->{"other_len"} = 0;
$self->{"other_data"} = "";
$self->{"sign_func"} = \&sign_hmac;
# RFC 2845 Section 2.3
$self->{"class"} = "ANY";
return bless $self, $class;
}
sub error {
my $self = shift;
my $rcode;
my $error = $self->{"error"};
if (defined($error)) {
$rcode = $Net::DNS::rcodesbyval{$error} || $error;
}
return $rcode;
}
sub mac_size {
my $self = shift;
return length(defined($self->{"mac"}) ? $self->{"mac"} : "");
}
sub mac {
my $self = shift;
my $mac = unpack("H*", $self->{"mac"}) if defined($self->{"mac"});
return $mac;
}
sub rdatastr {
my $self = shift;
my $error = $self->error;
$error = "UNDEFINED" unless defined $error;
my $rdatastr;
if (exists $self->{"algorithm"}) {
$rdatastr = "$self->{algorithm}. $error";
if ($self->{"other_len"} && defined($self->{"other_data"})) {
$rdatastr .= " $self->{other_data}";
}
} else {
$rdatastr = "";
}
return $rdatastr;
}
# return the data that needs to be signed/verified. This is useful for
# external TSIG verification routines
sub sig_data {
my ($self, $packet) = @_;
my ($newpacket, $sigdata);
# XXX this is horrible. $pkt = Net::DNS::Packet->clone($packet); maybe?
bless($newpacket = {},"Net::DNS::Packet");
%{$newpacket} = %{$packet};
bless($newpacket->{"header"} = {},"Net::DNS::Header");
$newpacket->{"additional"} = [];
%{$newpacket->{"header"}} = %{$packet->{"header"}};
@{$newpacket->{"additional"}} =
grep { $_ != $self } @{$packet->{"additional"}};
$newpacket->{"header"}{"arcount"}--;
$newpacket->{"compnames"} = {};
# Add the request MAC if present (used to validate responses).
$sigdata .= pack("H*", $self->{"request_mac"})
if $self->{"request_mac"};
$sigdata .= $newpacket->data;
# Don't compress the record (key) name.
my $tmppacket = Net::DNS::Packet->new("");
$sigdata .= $tmppacket->dn_comp(lc($self->{"name"}), 0);
$sigdata .= pack("n", $Net::DNS::classesbyname{uc($self->{"class"})});
$sigdata .= pack("N", $self->{"ttl"});
# Don't compress the algorithm name.
$tmppacket->{"compnames"} = {};
$sigdata .= $tmppacket->dn_comp(lc($self->{"algorithm"}), 0);
$sigdata .= pack("nN", 0, $self->{"time_signed"}); # bug
$sigdata .= pack("n", $self->{"fudge"});
$sigdata .= pack("nn", $self->{"error"}, $self->{"other_len"});
$sigdata .= pack("nN", 0, $self->{"other_data"})
if $self->{"other_data"};
return $sigdata;
}
sub rr_rdata {
my ($self, $packet, $offset) = @_;
my $rdata = "";
if (exists $self->{"key"}) {
# form the data to be signed
my $sigdata = $self->sig_data($packet);
# and call the signing function
$self->{"mac"} = &{$self->{"sign_func"}}($self->{"key"}, $sigdata);
$self->{"mac_size"} = length($self->{"mac"});
# construct the signed TSIG record
$packet->{"compnames"} = {};
$rdata .= $packet->dn_comp($self->{"algorithm"}, 0);
$rdata .= pack("nN", 0, $self->{"time_signed"}); # bug
$rdata .= pack("nn", $self->{"fudge"}, $self->{"mac_size"});
$rdata .= $self->{"mac"};
$rdata .= pack("nnn",($packet->{"header"}->{"id"},
$self->{"error"},
$self->{"other_len"}));
$rdata .= pack("nN", 0, $self->{"other_data"})
if $self->{"other_data"};
}
return $rdata;
}
1;
__END__
=head1 NAME
Net::DNS::RR::TSIG - DNS TSIG resource record
=head1 SYNOPSIS
C<use Net::DNS::RR>;
=head1 DESCRIPTION
Class for DNS Transaction Signature (TSIG) resource records.
=head1 METHODS
=head2 algorithm
$rr->algorithm($algorithm_name);
print "algorithm = ", $rr->algorithm, "\n";
Gets or sets the domain name that specifies the name of the algorithm.
The only algorithm currently supported is HMAC-MD5.SIG-ALG.REG.INT.
=head2 time_signed
$rr->time_signed(time);
print "time signed = ", $rr->time_signed, "\n";
Gets or sets the signing time as the number of seconds since 1 Jan 1970
00:00:00 UTC.
The default signing time is the current time.
=head2 fudge
$rr->fudge(60);
print "fudge = ", $rr->fudge, "\n";
Gets or sets the "fudge", i.e., the seconds of error permitted in the
signing time.
The default fudge is 300 seconds.
=head2 mac_size
print "MAC size = ", $rr->mac_size, "\n";
Returns the number of octets in the message authentication code (MAC).
The programmer must call a Net::DNS::Packet object's data method
before this will return anything meaningful.
=head2 mac
print "MAC = ", $rr->mac, "\n";
Returns the message authentication code (MAC) as a string of hex
characters. The programmer must call a Net::DNS::Packet object's
data method before this will return anything meaningful.
=head2 original_id
$rr->original_id(12345);
print "original ID = ", $rr->original_id, "\n";
Gets or sets the original message ID.
=head2 error
print "error = ", $rr->error, "\n";
Returns the RCODE covering TSIG processing. Common values are
NOERROR, BADSIG, BADKEY, and BADTIME. See RFC 2845 for details.
=head2 other_len
print "other len = ", $rr->other_len, "\n";
Returns the length of the Other Data. Should be zero unless the
error is BADTIME.
=head2 other_data
print "other data = ", $rr->other_data, "\n";
Returns the Other Data. This field should be empty unless the
error is BADTIME, in which case it will contain the server's
time as the number of seconds since 1 Jan 1970 00:00:00 UTC.
=head2 sig_data
my $sigdata = $tsig->sig_data($packet);
Returns the packet packed according to RFC2845 in a form for signing. This
is only needed if you want to supply an external signing function, such as is
needed for TSIG-GSS.
=head2 sign_func
sub my_sign_fn($$) {
my ($key, $data) = @_;
return some_digest_algorithm($key, $data);
}
$tsig->sign_func(\&my_sign_fn);
This sets the signing function to be used for this TSIG record.
The default signing function is HMAC-MD5.
=head1 BUGS
This code is still under development. Use with caution on production
systems.
The time_signed and other_data fields should be 48-bit unsigned
integers (RFC 2845, Sections 2.3 and 4.5.2). The current implementation
ignores the upper 16 bits; this will cause problems for times later
than 19 Jan 2038 03:14:07 UTC.
The only builtin algorithm currently supported is
HMAC-MD5.SIG-ALG.REG.INT. You can use other algorithms by supplying an
appropriate sign_func.
=head1 COPYRIGHT
Copyright (c) 2002 Michael Fuhr.
Portions Copyright (c) 2002-2004 Chris Reinhardt.
All rights reserved. This program is free software; you may redistribute
it and/or modify it under the same terms as Perl itself.
=head1 ACKNOWLEDGMENT
Most of the code in the Net::DNS::RR::TSIG module was contributed
by Chris Turbeville.
Support for external signing functions was added by Andrew Tridgell.
=head1 SEE ALSO
L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
RFC 2845
=cut
| btovar/cvmfs | test/mock_services/Net/DNS/RR/TSIG.pm | Perl | bsd-3-clause | 8,811 |
package Test::TrafficServerConfig;
use strict;
use warnings;
use Carp qw/cluck/;
BEGIN {
use Exporter;
our @EXPORT_OK = qw{ loadConfigFile loadConfig };
}
my $keyval_re = qr/
(\w+)= # key=
(
"[^"]*" | # quoted string
[^"\s]* # unquoted value (no spaces)
)
(?:\s+|$) # white space or end-of-line
/x;
sub parseConfigLine {
my $line = shift;
my %h;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
while ( $line =~ /${keyval_re}\s*/g ) {
my ( $k, $v ) = ( $1, $2 );
# remove surrounding quotes if there
$v =~ s/^"(.*)"$/$1/;
if ( $k =~ /parent/ ) {
$h{$k} = [ split /;/, $v ];
}
else {
$h{$k} = $v;
}
}
return \%h;
}
sub parseConfig {
my $lines = shift;
my $uq = qr/(?<!\\)"/;
my @config;
for my $line ( split /\n/, $lines ) {
next if $line =~ /^\s*#/;
push @config, parseConfigLine($line);
}
return \@config;
}
sub loadConfigFile {
my $cf = shift;
if ( !-f $cf ) {
return {};
}
open my $cfh, '<', $cf or return {};
local $/; # slurp mode
my $txt = <$cfh>;
close $cfh;
return parseConfig($txt);
}
1;
| PSUdaemon/traffic_control | traffic_ops/app/lib/Test/TrafficServerConfig.pm | Perl | apache-2.0 | 1,104 |
If you read this file _as_is_, just ignore the funny characters you
see. It is written in the POD format (see pod/perlpod.pod) which is
specially designed to be readable as is.
=head1 NAME
perlepoc - Perl for EPOC
=head1 SYNOPSIS
Perl 5 README file for the EPOC Release 5 operating system.
=head1 INTRODUCTION
EPOC is an OS for palmtops and mobile phones. For more information look
at: L<http://www.symbian.com/>
This is a port of perl to the epocemx SDK by Eberhard Mattes, which
itself uses the SDK by symbian. Essentially epocemx it is a POSIX
look alike environment for the EPOC OS. For more information look at:
L<http://epocemx.sourceforge.net/>
perl and epocemx runs on Epoc Release 5 machines: Psion 5mx, 5mx Pro,
Psion Revo, Psion Netbook and on the Ericsson M128. It may run on Epoc
Release 3 Hardware (Series 5 classic), too. For more information about
this hardware please refer to L<http://www.psion.com/>
Vendors which like to have support for their devices are free to send
me a sample.
=head1 INSTALLING PERL ON EPOC
You can download a ready-to-install version from
L<http://www.oflebbe.de/perl/perl5.html>
You will need at least ~6MB free space in order to install and run perl.
Please install the emxusr.sis package from
L<http://epocemx.sourceforge.net/> first.
Install perl.sis on the EPOC machine. If you do not know how to do
that, consult your PsiWin documentation.
Perl itself and its standard library is using 4 MB disk space.
Unicode support and some other modules are left out. (For details,
please look into epoc/createpkg.pl). If you like to use these modules,
you are free to copy them from a current perl release.
=head1 STARTING PERL ON EPOC
Please use the epocemx shell to start perl. perl integrates with the
conventions of epocemx.
=head2 Features of Perl on Epoc
The built-in function EPOC::getcwd returns the current directory.
=head2 Restrictions of Perl on Epoc
Features are left out, because of restrictions of the POSIX support in
EPOC:
=over 4
=item *
socket IO is only implemented poorly. You can only use sysread and
syswrite on them. The commands read, write, print, <> do not work for
sockets. This may change iff epocemx supports sockets.
=item *
kill, alarm and signals. Do not try to use them. This may be
impossible to implement on EPOC.
=item *
select is missing.
=item *
binmode does not exist. (No CR LF to LF translation for text files)
=item *
EPOC does not handle the notion of current drive and current
directory very well (i.e. not at all, but it tries hard to emulate
one). See PATH.
=item *
Heap is limited to 4MB.
=item *
Dynamic loading is not implemented.
=back
=head2 Compiling Perl 5 on the EPOC cross compiling environment
Sorry, this is far too short.
=over 4
=item *
You will need the epocemx SDK from Eberhard Mattes.
=item *
Get the Perl sources from your nearest CPAN site.
=item *
Unpack the sources.
=item *
Build a native perl from this sources... Make sure to save the
miniperl executable as miniperl.native.
Start again from scratch
cp epoc/* .
./Configure -S
make
cp miniperl.native miniperl
touch miniperl.exe
make
perl createpkg.pl
emxsis perl.pkg perl.sis
=back
=head1 SUPPORT STATUS OF PERL ON EPOC
I'm offering this port "as is". You can ask me questions, but I can't
guarantee I'll be able to answer them. Since the port to epocemx is
quite new, please check the web for updates first.
Very special thanks to Eberhard Mattes for epocemx.
=head1 AUTHOR
Olaf Flebbe <olaf@oflebbe.de>
L<http://www.oflebbe.de/perl/perl5.html>
=head1 LAST UPDATE
2003-01-18
=cut
| Dokaponteam/ITF_Project | xampp/perl/lib/pods/perlepoc.pod | Perl | mit | 3,658 |
#!/usr/bin/perl
use strict;
use warnings;
$|++;
use Net::RabbitFoot;
my $conn = Net::RabbitFoot->new()->load_xml_spec()->connect(
host => 'localhost',
port => 5672,
user => 'guest',
pass => 'guest',
vhost => '/',
);
my $chan = $conn->open_channel();
$chan->publish(
exchange => '',
routing_key => 'hello',
body => 'Hello World!',
);
print " [x] Sent 'Hello World!'\n";
$conn->close();
| bwong199/rabbitmq-tutorials | perl/send.pl | Perl | apache-2.0 | 426 |
#!/usr/bin/env perl
#
# Implemented as a Perl wrapper as we want to support several different
# architectures with single file. We pick up the target based on the
# file name we are asked to generate.
#
# It should be noted though that this perl code is nothing like
# <openssl>/crypto/perlasm/x86*. In this case perl is used pretty much
# as pre-processor to cover for platform differences in name decoration,
# linker tables, 32-/64-bit instruction sets...
#
# As you might know there're several PowerPC ABI in use. Most notably
# Linux and AIX use different 32-bit ABIs. Good news are that these ABIs
# are similar enough to implement leaf(!) functions, which would be ABI
# neutral. And that's what you find here: ABI neutral leaf functions.
# In case you wonder what that is...
#
# AIX performance
#
# MEASUREMENTS WITH cc ON a 200 MhZ PowerPC 604e.
#
# The following is the performance of 32-bit compiler
# generated code:
#
# OpenSSL 0.9.6c 21 dec 2001
# built on: Tue Jun 11 11:06:51 EDT 2002
# options:bn(64,32) ...
#compiler: cc -DTHREADS -DAIX -DB_ENDIAN -DBN_LLONG -O3
# sign verify sign/s verify/s
#rsa 512 bits 0.0098s 0.0009s 102.0 1170.6
#rsa 1024 bits 0.0507s 0.0026s 19.7 387.5
#rsa 2048 bits 0.3036s 0.0085s 3.3 117.1
#rsa 4096 bits 2.0040s 0.0299s 0.5 33.4
#dsa 512 bits 0.0087s 0.0106s 114.3 94.5
#dsa 1024 bits 0.0256s 0.0313s 39.0 32.0
#
# Same bechmark with this assembler code:
#
#rsa 512 bits 0.0056s 0.0005s 178.6 2049.2
#rsa 1024 bits 0.0283s 0.0015s 35.3 674.1
#rsa 2048 bits 0.1744s 0.0050s 5.7 201.2
#rsa 4096 bits 1.1644s 0.0179s 0.9 55.7
#dsa 512 bits 0.0052s 0.0062s 191.6 162.0
#dsa 1024 bits 0.0149s 0.0180s 67.0 55.5
#
# Number of operations increases by at almost 75%
#
# Here are performance numbers for 64-bit compiler
# generated code:
#
# OpenSSL 0.9.6g [engine] 9 Aug 2002
# built on: Fri Apr 18 16:59:20 EDT 2003
# options:bn(64,64) ...
# compiler: cc -DTHREADS -D_REENTRANT -q64 -DB_ENDIAN -O3
# sign verify sign/s verify/s
#rsa 512 bits 0.0028s 0.0003s 357.1 3844.4
#rsa 1024 bits 0.0148s 0.0008s 67.5 1239.7
#rsa 2048 bits 0.0963s 0.0028s 10.4 353.0
#rsa 4096 bits 0.6538s 0.0102s 1.5 98.1
#dsa 512 bits 0.0026s 0.0032s 382.5 313.7
#dsa 1024 bits 0.0081s 0.0099s 122.8 100.6
#
# Same benchmark with this assembler code:
#
#rsa 512 bits 0.0020s 0.0002s 510.4 6273.7
#rsa 1024 bits 0.0088s 0.0005s 114.1 2128.3
#rsa 2048 bits 0.0540s 0.0016s 18.5 622.5
#rsa 4096 bits 0.3700s 0.0058s 2.7 171.0
#dsa 512 bits 0.0016s 0.0020s 610.7 507.1
#dsa 1024 bits 0.0047s 0.0058s 212.5 173.2
#
# Again, performance increases by at about 75%
#
# Mac OS X, Apple G5 1.8GHz (Note this is 32 bit code)
# OpenSSL 0.9.7c 30 Sep 2003
#
# Original code.
#
#rsa 512 bits 0.0011s 0.0001s 906.1 11012.5
#rsa 1024 bits 0.0060s 0.0003s 166.6 3363.1
#rsa 2048 bits 0.0370s 0.0010s 27.1 982.4
#rsa 4096 bits 0.2426s 0.0036s 4.1 280.4
#dsa 512 bits 0.0010s 0.0012s 1038.1 841.5
#dsa 1024 bits 0.0030s 0.0037s 329.6 269.7
#dsa 2048 bits 0.0101s 0.0127s 98.9 78.6
#
# Same benchmark with this assembler code:
#
#rsa 512 bits 0.0007s 0.0001s 1416.2 16645.9
#rsa 1024 bits 0.0036s 0.0002s 274.4 5380.6
#rsa 2048 bits 0.0222s 0.0006s 45.1 1589.5
#rsa 4096 bits 0.1469s 0.0022s 6.8 449.6
#dsa 512 bits 0.0006s 0.0007s 1664.2 1376.2
#dsa 1024 bits 0.0018s 0.0023s 545.0 442.2
#dsa 2048 bits 0.0061s 0.0075s 163.5 132.8
#
# Performance increase of ~60%
#
# If you have comments or suggestions to improve code send
# me a note at schari@us.ibm.com
#
$flavour = shift;
if ($flavour =~ /32/) {
$BITS= 32;
$BNSZ= $BITS/8;
$ISA= "\"ppc\"";
$LD= "lwz"; # load
$LDU= "lwzu"; # load and update
$ST= "stw"; # store
$STU= "stwu"; # store and update
$UMULL= "mullw"; # unsigned multiply low
$UMULH= "mulhwu"; # unsigned multiply high
$UDIV= "divwu"; # unsigned divide
$UCMPI= "cmplwi"; # unsigned compare with immediate
$UCMP= "cmplw"; # unsigned compare
$CNTLZ= "cntlzw"; # count leading zeros
$SHL= "slw"; # shift left
$SHR= "srw"; # unsigned shift right
$SHRI= "srwi"; # unsigned shift right by immediate
$SHLI= "slwi"; # shift left by immediate
$CLRU= "clrlwi"; # clear upper bits
$INSR= "insrwi"; # insert right
$ROTL= "rotlwi"; # rotate left by immediate
$TR= "tw"; # conditional trap
} elsif ($flavour =~ /64/) {
$BITS= 64;
$BNSZ= $BITS/8;
$ISA= "\"ppc64\"";
# same as above, but 64-bit mnemonics...
$LD= "ld"; # load
$LDU= "ldu"; # load and update
$ST= "std"; # store
$STU= "stdu"; # store and update
$UMULL= "mulld"; # unsigned multiply low
$UMULH= "mulhdu"; # unsigned multiply high
$UDIV= "divdu"; # unsigned divide
$UCMPI= "cmpldi"; # unsigned compare with immediate
$UCMP= "cmpld"; # unsigned compare
$CNTLZ= "cntlzd"; # count leading zeros
$SHL= "sld"; # shift left
$SHR= "srd"; # unsigned shift right
$SHRI= "srdi"; # unsigned shift right by immediate
$SHLI= "sldi"; # shift left by immediate
$CLRU= "clrldi"; # clear upper bits
$INSR= "insrdi"; # insert right
$ROTL= "rotldi"; # rotate left by immediate
$TR= "td"; # conditional trap
} else { die "nonsense $flavour"; }
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
$data=<<EOF;
#--------------------------------------------------------------------
#
#
#
#
# File: ppc32.s
#
# Created by: Suresh Chari
# IBM Thomas J. Watson Research Library
# Hawthorne, NY
#
#
# Description: Optimized assembly routines for OpenSSL crypto
# on the 32 bitPowerPC platform.
#
#
# Version History
#
# 2. Fixed bn_add,bn_sub and bn_div_words, added comments,
# cleaned up code. Also made a single version which can
# be used for both the AIX and Linux compilers. See NOTE
# below.
# 12/05/03 Suresh Chari
# (with lots of help from) Andy Polyakov
##
# 1. Initial version 10/20/02 Suresh Chari
#
#
# The following file works for the xlc,cc
# and gcc compilers.
#
# NOTE: To get the file to link correctly with the gcc compiler
# you have to change the names of the routines and remove
# the first .(dot) character. This should automatically
# be done in the build process.
#
# Hand optimized assembly code for the following routines
#
# bn_sqr_comba4
# bn_sqr_comba8
# bn_mul_comba4
# bn_mul_comba8
# bn_sub_words
# bn_add_words
# bn_div_words
# bn_sqr_words
# bn_mul_words
# bn_mul_add_words
#
# NOTE: It is possible to optimize this code more for
# specific PowerPC or Power architectures. On the Northstar
# architecture the optimizations in this file do
# NOT provide much improvement.
#
# If you have comments or suggestions to improve code send
# me a note at schari\@us.ibm.com
#
#--------------------------------------------------------------------------
#
# Defines to be used in the assembly code.
#
#.set r0,0 # we use it as storage for value of 0
#.set SP,1 # preserved
#.set RTOC,2 # preserved
#.set r3,3 # 1st argument/return value
#.set r4,4 # 2nd argument/volatile register
#.set r5,5 # 3rd argument/volatile register
#.set r6,6 # ...
#.set r7,7
#.set r8,8
#.set r9,9
#.set r10,10
#.set r11,11
#.set r12,12
#.set r13,13 # not used, nor any other "below" it...
# Declare function names to be global
# NOTE: For gcc these names MUST be changed to remove
# the first . i.e. for example change ".bn_sqr_comba4"
# to "bn_sqr_comba4". This should be automatically done
# in the build.
.globl .bn_sqr_comba4
.globl .bn_sqr_comba8
.globl .bn_mul_comba4
.globl .bn_mul_comba8
.globl .bn_sub_words
.globl .bn_add_words
.globl .bn_div_words
.globl .bn_sqr_words
.globl .bn_mul_words
.globl .bn_mul_add_words
# .text section
.machine "any"
#
# NOTE: The following label name should be changed to
# "bn_sqr_comba4" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_sqr_comba4:
#
# Optimized version of bn_sqr_comba4.
#
# void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
# r3 contains r
# r4 contains a
#
# Freely use registers r5,r6,r7,r8,r9,r10,r11 as follows:
#
# r5,r6 are the two BN_ULONGs being multiplied.
# r7,r8 are the results of the 32x32 giving 64 bit multiply.
# r9,r10, r11 are the equivalents of c1,c2, c3.
# Here's the assembly
#
#
xor r0,r0,r0 # set r0 = 0. Used in the addze
# instructions below
#sqr_add_c(a,0,c1,c2,c3)
$LD r5,`0*$BNSZ`(r4)
$UMULL r9,r5,r5
$UMULH r10,r5,r5 #in first iteration. No need
#to add since c1=c2=c3=0.
# Note c3(r11) is NOT set to 0
# but will be.
$ST r9,`0*$BNSZ`(r3) # r[0]=c1;
# sqr_add_c2(a,1,0,c2,c3,c1);
$LD r6,`1*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r7,r7,r7 # compute (r7,r8)=2*(r7,r8)
adde r8,r8,r8
addze r9,r0 # catch carry if any.
# r9= r0(=0) and carry
addc r10,r7,r10 # now add to temp result.
addze r11,r8 # r8 added to r11 which is 0
addze r9,r9
$ST r10,`1*$BNSZ`(r3) #r[1]=c2;
#sqr_add_c(a,1,c3,c1,c2)
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r0
#sqr_add_c2(a,2,0,c3,c1,c2)
$LD r6,`2*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r7,r7,r7
adde r8,r8,r8
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
$ST r11,`2*$BNSZ`(r3) #r[2]=c3
#sqr_add_c2(a,3,0,c1,c2,c3);
$LD r6,`3*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r7,r7,r7
adde r8,r8,r8
addze r11,r0
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
#sqr_add_c2(a,2,1,c1,c2,c3);
$LD r5,`1*$BNSZ`(r4)
$LD r6,`2*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r7,r7,r7
adde r8,r8,r8
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
$ST r9,`3*$BNSZ`(r3) #r[3]=c1
#sqr_add_c(a,2,c2,c3,c1);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r0
#sqr_add_c2(a,3,1,c2,c3,c1);
$LD r6,`3*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r7,r7,r7
adde r8,r8,r8
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
$ST r10,`4*$BNSZ`(r3) #r[4]=c2
#sqr_add_c2(a,3,2,c3,c1,c2);
$LD r5,`2*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r7,r7,r7
adde r8,r8,r8
addze r10,r0
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
$ST r11,`5*$BNSZ`(r3) #r[5] = c3
#sqr_add_c(a,3,c1,c2,c3);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r9,r7,r9
adde r10,r8,r10
$ST r9,`6*$BNSZ`(r3) #r[6]=c1
$ST r10,`7*$BNSZ`(r3) #r[7]=c2
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_sqr_comba8" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_sqr_comba8:
#
# This is an optimized version of the bn_sqr_comba8 routine.
# Tightly uses the adde instruction
#
#
# void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
# r3 contains r
# r4 contains a
#
# Freely use registers r5,r6,r7,r8,r9,r10,r11 as follows:
#
# r5,r6 are the two BN_ULONGs being multiplied.
# r7,r8 are the results of the 32x32 giving 64 bit multiply.
# r9,r10, r11 are the equivalents of c1,c2, c3.
#
# Possible optimization of loading all 8 longs of a into registers
# doesnt provide any speedup
#
xor r0,r0,r0 #set r0 = 0.Used in addze
#instructions below.
#sqr_add_c(a,0,c1,c2,c3);
$LD r5,`0*$BNSZ`(r4)
$UMULL r9,r5,r5 #1st iteration: no carries.
$UMULH r10,r5,r5
$ST r9,`0*$BNSZ`(r3) # r[0]=c1;
#sqr_add_c2(a,1,0,c2,c3,c1);
$LD r6,`1*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10 #add the two register number
adde r11,r8,r0 # (r8,r7) to the three register
addze r9,r0 # number (r9,r11,r10).NOTE:r0=0
addc r10,r7,r10 #add the two register number
adde r11,r8,r11 # (r8,r7) to the three register
addze r9,r9 # number (r9,r11,r10).
$ST r10,`1*$BNSZ`(r3) # r[1]=c2
#sqr_add_c(a,1,c3,c1,c2);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r0
#sqr_add_c2(a,2,0,c3,c1,c2);
$LD r6,`2*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
$ST r11,`2*$BNSZ`(r3) #r[2]=c3
#sqr_add_c2(a,3,0,c1,c2,c3);
$LD r6,`3*$BNSZ`(r4) #r6 = a[3]. r5 is already a[0].
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r0
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
#sqr_add_c2(a,2,1,c1,c2,c3);
$LD r5,`1*$BNSZ`(r4)
$LD r6,`2*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
$ST r9,`3*$BNSZ`(r3) #r[3]=c1;
#sqr_add_c(a,2,c2,c3,c1);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r0
#sqr_add_c2(a,3,1,c2,c3,c1);
$LD r6,`3*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
#sqr_add_c2(a,4,0,c2,c3,c1);
$LD r5,`0*$BNSZ`(r4)
$LD r6,`4*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
$ST r10,`4*$BNSZ`(r3) #r[4]=c2;
#sqr_add_c2(a,5,0,c3,c1,c2);
$LD r6,`5*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r0
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
#sqr_add_c2(a,4,1,c3,c1,c2);
$LD r5,`1*$BNSZ`(r4)
$LD r6,`4*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
#sqr_add_c2(a,3,2,c3,c1,c2);
$LD r5,`2*$BNSZ`(r4)
$LD r6,`3*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
$ST r11,`5*$BNSZ`(r3) #r[5]=c3;
#sqr_add_c(a,3,c1,c2,c3);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r0
#sqr_add_c2(a,4,2,c1,c2,c3);
$LD r6,`4*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
#sqr_add_c2(a,5,1,c1,c2,c3);
$LD r5,`1*$BNSZ`(r4)
$LD r6,`5*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
#sqr_add_c2(a,6,0,c1,c2,c3);
$LD r5,`0*$BNSZ`(r4)
$LD r6,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
$ST r9,`6*$BNSZ`(r3) #r[6]=c1;
#sqr_add_c2(a,7,0,c2,c3,c1);
$LD r6,`7*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r0
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
#sqr_add_c2(a,6,1,c2,c3,c1);
$LD r5,`1*$BNSZ`(r4)
$LD r6,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
#sqr_add_c2(a,5,2,c2,c3,c1);
$LD r5,`2*$BNSZ`(r4)
$LD r6,`5*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
#sqr_add_c2(a,4,3,c2,c3,c1);
$LD r5,`3*$BNSZ`(r4)
$LD r6,`4*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
$ST r10,`7*$BNSZ`(r3) #r[7]=c2;
#sqr_add_c(a,4,c3,c1,c2);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r0
#sqr_add_c2(a,5,3,c3,c1,c2);
$LD r6,`5*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
#sqr_add_c2(a,6,2,c3,c1,c2);
$LD r5,`2*$BNSZ`(r4)
$LD r6,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
#sqr_add_c2(a,7,1,c3,c1,c2);
$LD r5,`1*$BNSZ`(r4)
$LD r6,`7*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
$ST r11,`8*$BNSZ`(r3) #r[8]=c3;
#sqr_add_c2(a,7,2,c1,c2,c3);
$LD r5,`2*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r0
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
#sqr_add_c2(a,6,3,c1,c2,c3);
$LD r5,`3*$BNSZ`(r4)
$LD r6,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
#sqr_add_c2(a,5,4,c1,c2,c3);
$LD r5,`4*$BNSZ`(r4)
$LD r6,`5*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
$ST r9,`9*$BNSZ`(r3) #r[9]=c1;
#sqr_add_c(a,5,c2,c3,c1);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r0
#sqr_add_c2(a,6,4,c2,c3,c1);
$LD r6,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
#sqr_add_c2(a,7,3,c2,c3,c1);
$LD r5,`3*$BNSZ`(r4)
$LD r6,`7*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
$ST r10,`10*$BNSZ`(r3) #r[10]=c2;
#sqr_add_c2(a,7,4,c3,c1,c2);
$LD r5,`4*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r0
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
#sqr_add_c2(a,6,5,c3,c1,c2);
$LD r5,`5*$BNSZ`(r4)
$LD r6,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
addc r11,r7,r11
adde r9,r8,r9
addze r10,r10
$ST r11,`11*$BNSZ`(r3) #r[11]=c3;
#sqr_add_c(a,6,c1,c2,c3);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r0
#sqr_add_c2(a,7,5,c1,c2,c3)
$LD r6,`7*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
addc r9,r7,r9
adde r10,r8,r10
addze r11,r11
$ST r9,`12*$BNSZ`(r3) #r[12]=c1;
#sqr_add_c2(a,7,6,c2,c3,c1)
$LD r5,`6*$BNSZ`(r4)
$UMULL r7,r5,r6
$UMULH r8,r5,r6
addc r10,r7,r10
adde r11,r8,r11
addze r9,r0
addc r10,r7,r10
adde r11,r8,r11
addze r9,r9
$ST r10,`13*$BNSZ`(r3) #r[13]=c2;
#sqr_add_c(a,7,c3,c1,c2);
$UMULL r7,r6,r6
$UMULH r8,r6,r6
addc r11,r7,r11
adde r9,r8,r9
$ST r11,`14*$BNSZ`(r3) #r[14]=c3;
$ST r9, `15*$BNSZ`(r3) #r[15]=c1;
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_mul_comba4" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_mul_comba4:
#
# This is an optimized version of the bn_mul_comba4 routine.
#
# void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
# r3 contains r
# r4 contains a
# r5 contains b
# r6, r7 are the 2 BN_ULONGs being multiplied.
# r8, r9 are the results of the 32x32 giving 64 multiply.
# r10, r11, r12 are the equivalents of c1, c2, and c3.
#
xor r0,r0,r0 #r0=0. Used in addze below.
#mul_add_c(a[0],b[0],c1,c2,c3);
$LD r6,`0*$BNSZ`(r4)
$LD r7,`0*$BNSZ`(r5)
$UMULL r10,r6,r7
$UMULH r11,r6,r7
$ST r10,`0*$BNSZ`(r3) #r[0]=c1
#mul_add_c(a[0],b[1],c2,c3,c1);
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r8,r11
adde r12,r9,r0
addze r10,r0
#mul_add_c(a[1],b[0],c2,c3,c1);
$LD r6, `1*$BNSZ`(r4)
$LD r7, `0*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r8,r11
adde r12,r9,r12
addze r10,r10
$ST r11,`1*$BNSZ`(r3) #r[1]=c2
#mul_add_c(a[2],b[0],c3,c1,c2);
$LD r6,`2*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r8,r12
adde r10,r9,r10
addze r11,r0
#mul_add_c(a[1],b[1],c3,c1,c2);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r8,r12
adde r10,r9,r10
addze r11,r11
#mul_add_c(a[0],b[2],c3,c1,c2);
$LD r6,`0*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r8,r12
adde r10,r9,r10
addze r11,r11
$ST r12,`2*$BNSZ`(r3) #r[2]=c3
#mul_add_c(a[0],b[3],c1,c2,c3);
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r8,r10
adde r11,r9,r11
addze r12,r0
#mul_add_c(a[1],b[2],c1,c2,c3);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r8,r10
adde r11,r9,r11
addze r12,r12
#mul_add_c(a[2],b[1],c1,c2,c3);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r8,r10
adde r11,r9,r11
addze r12,r12
#mul_add_c(a[3],b[0],c1,c2,c3);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`0*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r8,r10
adde r11,r9,r11
addze r12,r12
$ST r10,`3*$BNSZ`(r3) #r[3]=c1
#mul_add_c(a[3],b[1],c2,c3,c1);
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r8,r11
adde r12,r9,r12
addze r10,r0
#mul_add_c(a[2],b[2],c2,c3,c1);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r8,r11
adde r12,r9,r12
addze r10,r10
#mul_add_c(a[1],b[3],c2,c3,c1);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r8,r11
adde r12,r9,r12
addze r10,r10
$ST r11,`4*$BNSZ`(r3) #r[4]=c2
#mul_add_c(a[2],b[3],c3,c1,c2);
$LD r6,`2*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r8,r12
adde r10,r9,r10
addze r11,r0
#mul_add_c(a[3],b[2],c3,c1,c2);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r8,r12
adde r10,r9,r10
addze r11,r11
$ST r12,`5*$BNSZ`(r3) #r[5]=c3
#mul_add_c(a[3],b[3],c1,c2,c3);
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r8,r10
adde r11,r9,r11
$ST r10,`6*$BNSZ`(r3) #r[6]=c1
$ST r11,`7*$BNSZ`(r3) #r[7]=c2
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_mul_comba8" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_mul_comba8:
#
# Optimized version of the bn_mul_comba8 routine.
#
# void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
# r3 contains r
# r4 contains a
# r5 contains b
# r6, r7 are the 2 BN_ULONGs being multiplied.
# r8, r9 are the results of the 32x32 giving 64 multiply.
# r10, r11, r12 are the equivalents of c1, c2, and c3.
#
xor r0,r0,r0 #r0=0. Used in addze below.
#mul_add_c(a[0],b[0],c1,c2,c3);
$LD r6,`0*$BNSZ`(r4) #a[0]
$LD r7,`0*$BNSZ`(r5) #b[0]
$UMULL r10,r6,r7
$UMULH r11,r6,r7
$ST r10,`0*$BNSZ`(r3) #r[0]=c1;
#mul_add_c(a[0],b[1],c2,c3,c1);
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
addze r12,r9 # since we didnt set r12 to zero before.
addze r10,r0
#mul_add_c(a[1],b[0],c2,c3,c1);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`0*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
$ST r11,`1*$BNSZ`(r3) #r[1]=c2;
#mul_add_c(a[2],b[0],c3,c1,c2);
$LD r6,`2*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r0
#mul_add_c(a[1],b[1],c3,c1,c2);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[0],b[2],c3,c1,c2);
$LD r6,`0*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
$ST r12,`2*$BNSZ`(r3) #r[2]=c3;
#mul_add_c(a[0],b[3],c1,c2,c3);
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r0
#mul_add_c(a[1],b[2],c1,c2,c3);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[2],b[1],c1,c2,c3);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[3],b[0],c1,c2,c3);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`0*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
$ST r10,`3*$BNSZ`(r3) #r[3]=c1;
#mul_add_c(a[4],b[0],c2,c3,c1);
$LD r6,`4*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r0
#mul_add_c(a[3],b[1],c2,c3,c1);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[2],b[2],c2,c3,c1);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[1],b[3],c2,c3,c1);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[0],b[4],c2,c3,c1);
$LD r6,`0*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
$ST r11,`4*$BNSZ`(r3) #r[4]=c2;
#mul_add_c(a[0],b[5],c3,c1,c2);
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r0
#mul_add_c(a[1],b[4],c3,c1,c2);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[2],b[3],c3,c1,c2);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[3],b[2],c3,c1,c2);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[4],b[1],c3,c1,c2);
$LD r6,`4*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[5],b[0],c3,c1,c2);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`0*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
$ST r12,`5*$BNSZ`(r3) #r[5]=c3;
#mul_add_c(a[6],b[0],c1,c2,c3);
$LD r6,`6*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r0
#mul_add_c(a[5],b[1],c1,c2,c3);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[4],b[2],c1,c2,c3);
$LD r6,`4*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[3],b[3],c1,c2,c3);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[2],b[4],c1,c2,c3);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[1],b[5],c1,c2,c3);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[0],b[6],c1,c2,c3);
$LD r6,`0*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
$ST r10,`6*$BNSZ`(r3) #r[6]=c1;
#mul_add_c(a[0],b[7],c2,c3,c1);
$LD r7,`7*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r0
#mul_add_c(a[1],b[6],c2,c3,c1);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[2],b[5],c2,c3,c1);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[3],b[4],c2,c3,c1);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[4],b[3],c2,c3,c1);
$LD r6,`4*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[5],b[2],c2,c3,c1);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[6],b[1],c2,c3,c1);
$LD r6,`6*$BNSZ`(r4)
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[7],b[0],c2,c3,c1);
$LD r6,`7*$BNSZ`(r4)
$LD r7,`0*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
$ST r11,`7*$BNSZ`(r3) #r[7]=c2;
#mul_add_c(a[7],b[1],c3,c1,c2);
$LD r7,`1*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r0
#mul_add_c(a[6],b[2],c3,c1,c2);
$LD r6,`6*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[5],b[3],c3,c1,c2);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[4],b[4],c3,c1,c2);
$LD r6,`4*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[3],b[5],c3,c1,c2);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[2],b[6],c3,c1,c2);
$LD r6,`2*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[1],b[7],c3,c1,c2);
$LD r6,`1*$BNSZ`(r4)
$LD r7,`7*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
$ST r12,`8*$BNSZ`(r3) #r[8]=c3;
#mul_add_c(a[2],b[7],c1,c2,c3);
$LD r6,`2*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r0
#mul_add_c(a[3],b[6],c1,c2,c3);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[4],b[5],c1,c2,c3);
$LD r6,`4*$BNSZ`(r4)
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[5],b[4],c1,c2,c3);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[6],b[3],c1,c2,c3);
$LD r6,`6*$BNSZ`(r4)
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[7],b[2],c1,c2,c3);
$LD r6,`7*$BNSZ`(r4)
$LD r7,`2*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
$ST r10,`9*$BNSZ`(r3) #r[9]=c1;
#mul_add_c(a[7],b[3],c2,c3,c1);
$LD r7,`3*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r0
#mul_add_c(a[6],b[4],c2,c3,c1);
$LD r6,`6*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[5],b[5],c2,c3,c1);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[4],b[6],c2,c3,c1);
$LD r6,`4*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
#mul_add_c(a[3],b[7],c2,c3,c1);
$LD r6,`3*$BNSZ`(r4)
$LD r7,`7*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
$ST r11,`10*$BNSZ`(r3) #r[10]=c2;
#mul_add_c(a[4],b[7],c3,c1,c2);
$LD r6,`4*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r0
#mul_add_c(a[5],b[6],c3,c1,c2);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[6],b[5],c3,c1,c2);
$LD r6,`6*$BNSZ`(r4)
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
#mul_add_c(a[7],b[4],c3,c1,c2);
$LD r6,`7*$BNSZ`(r4)
$LD r7,`4*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
addze r11,r11
$ST r12,`11*$BNSZ`(r3) #r[11]=c3;
#mul_add_c(a[7],b[5],c1,c2,c3);
$LD r7,`5*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r0
#mul_add_c(a[6],b[6],c1,c2,c3);
$LD r6,`6*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
#mul_add_c(a[5],b[7],c1,c2,c3);
$LD r6,`5*$BNSZ`(r4)
$LD r7,`7*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r10,r10,r8
adde r11,r11,r9
addze r12,r12
$ST r10,`12*$BNSZ`(r3) #r[12]=c1;
#mul_add_c(a[6],b[7],c2,c3,c1);
$LD r6,`6*$BNSZ`(r4)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r0
#mul_add_c(a[7],b[6],c2,c3,c1);
$LD r6,`7*$BNSZ`(r4)
$LD r7,`6*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r11,r11,r8
adde r12,r12,r9
addze r10,r10
$ST r11,`13*$BNSZ`(r3) #r[13]=c2;
#mul_add_c(a[7],b[7],c3,c1,c2);
$LD r7,`7*$BNSZ`(r5)
$UMULL r8,r6,r7
$UMULH r9,r6,r7
addc r12,r12,r8
adde r10,r10,r9
$ST r12,`14*$BNSZ`(r3) #r[14]=c3;
$ST r10,`15*$BNSZ`(r3) #r[15]=c1;
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_sub_words" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
#
.align 4
.bn_sub_words:
#
# Handcoded version of bn_sub_words
#
#BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
#
# r3 = r
# r4 = a
# r5 = b
# r6 = n
#
# Note: No loop unrolling done since this is not a performance
# critical loop.
xor r0,r0,r0 #set r0 = 0
#
# check for r6 = 0 AND set carry bit.
#
subfc. r7,r0,r6 # If r6 is 0 then result is 0.
# if r6 > 0 then result !=0
# In either case carry bit is set.
beq Lppcasm_sub_adios
addi r4,r4,-$BNSZ
addi r3,r3,-$BNSZ
addi r5,r5,-$BNSZ
mtctr r6
Lppcasm_sub_mainloop:
$LDU r7,$BNSZ(r4)
$LDU r8,$BNSZ(r5)
subfe r6,r8,r7 # r6 = r7+carry bit + onescomplement(r8)
# if carry = 1 this is r7-r8. Else it
# is r7-r8 -1 as we need.
$STU r6,$BNSZ(r3)
bdnz- Lppcasm_sub_mainloop
Lppcasm_sub_adios:
subfze r3,r0 # if carry bit is set then r3 = 0 else -1
andi. r3,r3,1 # keep only last bit.
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_add_words" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_add_words:
#
# Handcoded version of bn_add_words
#
#BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
#
# r3 = r
# r4 = a
# r5 = b
# r6 = n
#
# Note: No loop unrolling done since this is not a performance
# critical loop.
xor r0,r0,r0
#
# check for r6 = 0. Is this needed?
#
addic. r6,r6,0 #test r6 and clear carry bit.
beq Lppcasm_add_adios
addi r4,r4,-$BNSZ
addi r3,r3,-$BNSZ
addi r5,r5,-$BNSZ
mtctr r6
Lppcasm_add_mainloop:
$LDU r7,$BNSZ(r4)
$LDU r8,$BNSZ(r5)
adde r8,r7,r8
$STU r8,$BNSZ(r3)
bdnz- Lppcasm_add_mainloop
Lppcasm_add_adios:
addze r3,r0 #return carry bit.
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_div_words" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_div_words:
#
# This is a cleaned up version of code generated by
# the AIX compiler. The only optimization is to use
# the PPC instruction to count leading zeros instead
# of call to num_bits_word. Since this was compiled
# only at level -O2 we can possibly squeeze it more?
#
# r3 = h
# r4 = l
# r5 = d
$UCMPI 0,r5,0 # compare r5 and 0
bne Lppcasm_div1 # proceed if d!=0
li r3,-1 # d=0 return -1
blr
Lppcasm_div1:
xor r0,r0,r0 #r0=0
li r8,$BITS
$CNTLZ. r7,r5 #r7 = num leading 0s in d.
beq Lppcasm_div2 #proceed if no leading zeros
subf r8,r7,r8 #r8 = BN_num_bits_word(d)
$SHR. r9,r3,r8 #are there any bits above r8'th?
$TR 16,r9,r0 #if there're, signal to dump core...
Lppcasm_div2:
$UCMP 0,r3,r5 #h>=d?
blt Lppcasm_div3 #goto Lppcasm_div3 if not
subf r3,r5,r3 #h-=d ;
Lppcasm_div3: #r7 = BN_BITS2-i. so r7=i
cmpi 0,0,r7,0 # is (i == 0)?
beq Lppcasm_div4
$SHL r3,r3,r7 # h = (h<< i)
$SHR r8,r4,r8 # r8 = (l >> BN_BITS2 -i)
$SHL r5,r5,r7 # d<<=i
or r3,r3,r8 # h = (h<<i)|(l>>(BN_BITS2-i))
$SHL r4,r4,r7 # l <<=i
Lppcasm_div4:
$SHRI r9,r5,`$BITS/2` # r9 = dh
# dl will be computed when needed
# as it saves registers.
li r6,2 #r6=2
mtctr r6 #counter will be in count.
Lppcasm_divouterloop:
$SHRI r8,r3,`$BITS/2` #r8 = (h>>BN_BITS4)
$SHRI r11,r4,`$BITS/2` #r11= (l&BN_MASK2h)>>BN_BITS4
# compute here for innerloop.
$UCMP 0,r8,r9 # is (h>>BN_BITS4)==dh
bne Lppcasm_div5 # goto Lppcasm_div5 if not
li r8,-1
$CLRU r8,r8,`$BITS/2` #q = BN_MASK2l
b Lppcasm_div6
Lppcasm_div5:
$UDIV r8,r3,r9 #q = h/dh
Lppcasm_div6:
$UMULL r12,r9,r8 #th = q*dh
$CLRU r10,r5,`$BITS/2` #r10=dl
$UMULL r6,r8,r10 #tl = q*dl
Lppcasm_divinnerloop:
subf r10,r12,r3 #t = h -th
$SHRI r7,r10,`$BITS/2` #r7= (t &BN_MASK2H), sort of...
addic. r7,r7,0 #test if r7 == 0. used below.
# now want to compute
# r7 = (t<<BN_BITS4)|((l&BN_MASK2h)>>BN_BITS4)
# the following 2 instructions do that
$SHLI r7,r10,`$BITS/2` # r7 = (t<<BN_BITS4)
or r7,r7,r11 # r7|=((l&BN_MASK2h)>>BN_BITS4)
$UCMP cr1,r6,r7 # compare (tl <= r7)
bne Lppcasm_divinnerexit
ble cr1,Lppcasm_divinnerexit
addi r8,r8,-1 #q--
subf r12,r9,r12 #th -=dh
$CLRU r10,r5,`$BITS/2` #r10=dl. t is no longer needed in loop.
subf r6,r10,r6 #tl -=dl
b Lppcasm_divinnerloop
Lppcasm_divinnerexit:
$SHRI r10,r6,`$BITS/2` #t=(tl>>BN_BITS4)
$SHLI r11,r6,`$BITS/2` #tl=(tl<<BN_BITS4)&BN_MASK2h;
$UCMP cr1,r4,r11 # compare l and tl
add r12,r12,r10 # th+=t
bge cr1,Lppcasm_div7 # if (l>=tl) goto Lppcasm_div7
addi r12,r12,1 # th++
Lppcasm_div7:
subf r11,r11,r4 #r11=l-tl
$UCMP cr1,r3,r12 #compare h and th
bge cr1,Lppcasm_div8 #if (h>=th) goto Lppcasm_div8
addi r8,r8,-1 # q--
add r3,r5,r3 # h+=d
Lppcasm_div8:
subf r12,r12,r3 #r12 = h-th
$SHLI r4,r11,`$BITS/2` #l=(l&BN_MASK2l)<<BN_BITS4
# want to compute
# h = ((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2
# the following 2 instructions will do this.
$INSR r11,r12,`$BITS/2`,`$BITS/2` # r11 is the value we want rotated $BITS/2.
$ROTL r3,r11,`$BITS/2` # rotate by $BITS/2 and store in r3
bdz Lppcasm_div9 #if (count==0) break ;
$SHLI r0,r8,`$BITS/2` #ret =q<<BN_BITS4
b Lppcasm_divouterloop
Lppcasm_div9:
or r3,r8,r0
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_sqr_words" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_sqr_words:
#
# Optimized version of bn_sqr_words
#
# void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
#
# r3 = r
# r4 = a
# r5 = n
#
# r6 = a[i].
# r7,r8 = product.
#
# No unrolling done here. Not performance critical.
addic. r5,r5,0 #test r5.
beq Lppcasm_sqr_adios
addi r4,r4,-$BNSZ
addi r3,r3,-$BNSZ
mtctr r5
Lppcasm_sqr_mainloop:
#sqr(r[0],r[1],a[0]);
$LDU r6,$BNSZ(r4)
$UMULL r7,r6,r6
$UMULH r8,r6,r6
$STU r7,$BNSZ(r3)
$STU r8,$BNSZ(r3)
bdnz- Lppcasm_sqr_mainloop
Lppcasm_sqr_adios:
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_mul_words" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_mul_words:
#
# BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
#
# r3 = rp
# r4 = ap
# r5 = num
# r6 = w
xor r0,r0,r0
xor r12,r12,r12 # used for carry
rlwinm. r7,r5,30,2,31 # num >> 2
beq Lppcasm_mw_REM
mtctr r7
Lppcasm_mw_LOOP:
#mul(rp[0],ap[0],w,c1);
$LD r8,`0*$BNSZ`(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
addc r9,r9,r12
#addze r10,r10 #carry is NOT ignored.
#will be taken care of
#in second spin below
#using adde.
$ST r9,`0*$BNSZ`(r3)
#mul(rp[1],ap[1],w,c1);
$LD r8,`1*$BNSZ`(r4)
$UMULL r11,r6,r8
$UMULH r12,r6,r8
adde r11,r11,r10
#addze r12,r12
$ST r11,`1*$BNSZ`(r3)
#mul(rp[2],ap[2],w,c1);
$LD r8,`2*$BNSZ`(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
adde r9,r9,r12
#addze r10,r10
$ST r9,`2*$BNSZ`(r3)
#mul_add(rp[3],ap[3],w,c1);
$LD r8,`3*$BNSZ`(r4)
$UMULL r11,r6,r8
$UMULH r12,r6,r8
adde r11,r11,r10
addze r12,r12 #this spin we collect carry into
#r12
$ST r11,`3*$BNSZ`(r3)
addi r3,r3,`4*$BNSZ`
addi r4,r4,`4*$BNSZ`
bdnz- Lppcasm_mw_LOOP
Lppcasm_mw_REM:
andi. r5,r5,0x3
beq Lppcasm_mw_OVER
#mul(rp[0],ap[0],w,c1);
$LD r8,`0*$BNSZ`(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
addc r9,r9,r12
addze r10,r10
$ST r9,`0*$BNSZ`(r3)
addi r12,r10,0
addi r5,r5,-1
cmpli 0,0,r5,0
beq Lppcasm_mw_OVER
#mul(rp[1],ap[1],w,c1);
$LD r8,`1*$BNSZ`(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
addc r9,r9,r12
addze r10,r10
$ST r9,`1*$BNSZ`(r3)
addi r12,r10,0
addi r5,r5,-1
cmpli 0,0,r5,0
beq Lppcasm_mw_OVER
#mul_add(rp[2],ap[2],w,c1);
$LD r8,`2*$BNSZ`(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
addc r9,r9,r12
addze r10,r10
$ST r9,`2*$BNSZ`(r3)
addi r12,r10,0
Lppcasm_mw_OVER:
addi r3,r12,0
blr
.long 0x00000000
#
# NOTE: The following label name should be changed to
# "bn_mul_add_words" i.e. remove the first dot
# for the gcc compiler. This should be automatically
# done in the build
#
.align 4
.bn_mul_add_words:
#
# BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
#
# r3 = rp
# r4 = ap
# r5 = num
# r6 = w
#
# empirical evidence suggests that unrolled version performs best!!
#
xor r0,r0,r0 #r0 = 0
xor r12,r12,r12 #r12 = 0 . used for carry
rlwinm. r7,r5,30,2,31 # num >> 2
beq Lppcasm_maw_leftover # if (num < 4) go LPPCASM_maw_leftover
mtctr r7
Lppcasm_maw_mainloop:
#mul_add(rp[0],ap[0],w,c1);
$LD r8,`0*$BNSZ`(r4)
$LD r11,`0*$BNSZ`(r3)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
addc r9,r9,r12 #r12 is carry.
addze r10,r10
addc r9,r9,r11
#addze r10,r10
#the above instruction addze
#is NOT needed. Carry will NOT
#be ignored. It's not affected
#by multiply and will be collected
#in the next spin
$ST r9,`0*$BNSZ`(r3)
#mul_add(rp[1],ap[1],w,c1);
$LD r8,`1*$BNSZ`(r4)
$LD r9,`1*$BNSZ`(r3)
$UMULL r11,r6,r8
$UMULH r12,r6,r8
adde r11,r11,r10 #r10 is carry.
addze r12,r12
addc r11,r11,r9
#addze r12,r12
$ST r11,`1*$BNSZ`(r3)
#mul_add(rp[2],ap[2],w,c1);
$LD r8,`2*$BNSZ`(r4)
$UMULL r9,r6,r8
$LD r11,`2*$BNSZ`(r3)
$UMULH r10,r6,r8
adde r9,r9,r12
addze r10,r10
addc r9,r9,r11
#addze r10,r10
$ST r9,`2*$BNSZ`(r3)
#mul_add(rp[3],ap[3],w,c1);
$LD r8,`3*$BNSZ`(r4)
$UMULL r11,r6,r8
$LD r9,`3*$BNSZ`(r3)
$UMULH r12,r6,r8
adde r11,r11,r10
addze r12,r12
addc r11,r11,r9
addze r12,r12
$ST r11,`3*$BNSZ`(r3)
addi r3,r3,`4*$BNSZ`
addi r4,r4,`4*$BNSZ`
bdnz- Lppcasm_maw_mainloop
Lppcasm_maw_leftover:
andi. r5,r5,0x3
beq Lppcasm_maw_adios
addi r3,r3,-$BNSZ
addi r4,r4,-$BNSZ
#mul_add(rp[0],ap[0],w,c1);
mtctr r5
$LDU r8,$BNSZ(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
$LDU r11,$BNSZ(r3)
addc r9,r9,r11
addze r10,r10
addc r9,r9,r12
addze r12,r10
$ST r9,0(r3)
bdz Lppcasm_maw_adios
#mul_add(rp[1],ap[1],w,c1);
$LDU r8,$BNSZ(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
$LDU r11,$BNSZ(r3)
addc r9,r9,r11
addze r10,r10
addc r9,r9,r12
addze r12,r10
$ST r9,0(r3)
bdz Lppcasm_maw_adios
#mul_add(rp[2],ap[2],w,c1);
$LDU r8,$BNSZ(r4)
$UMULL r9,r6,r8
$UMULH r10,r6,r8
$LDU r11,$BNSZ(r3)
addc r9,r9,r11
addze r10,r10
addc r9,r9,r12
addze r12,r10
$ST r9,0(r3)
Lppcasm_maw_adios:
addi r3,r12,0
blr
.long 0x00000000
.align 4
EOF
$data =~ s/\`([^\`]*)\`/eval $1/gem;
print $data;
close STDOUT;
| leighpauls/k2cro4 | third_party/openssl/openssl/crypto/bn/asm/ppc.pl | Perl | bsd-3-clause | 44,705 |
package CGI::Session::Serialize::freezethaw;
# $Id: freezethaw.pm 351 2006-11-24 14:16:50Z markstos $
use strict;
use FreezeThaw;
use CGI::Session::ErrorHandler;
$CGI::Session::Serialize::freezethaw::VERSION = 4.2;
@CGI::Session::Serialize::freezethaw::ISA = ( "CGI::Session::ErrorHandler" );
sub freeze {
my ($self, $data) = @_;
return FreezeThaw::freeze($data);
}
sub thaw {
my ($self, $string) = @_;
return (FreezeThaw::thaw($string))[0];
}
1;
__END__;
=pod
=head1 NAME
CGI::Session::Serialize::freezethaw - serializer for CGI::Session
=head1 DESCRIPTION
This library can be used by CGI::Session to serialize session data. Uses L<FreezeThaw|FreezeThaw>.
=head1 METHODS
=over 4
=item freeze($class, \%hash)
Receives two arguments. First is the class name, the second is the data to be serialized. Should return serialized string on success, undef on failure. Error message should be set using C<set_error()|CGI::Session::ErrorHandler/"set_error()">
=item thaw($class, $string)
Received two arguments. First is the class name, second is the I<frozen> data string. Should return thawed data structure on success, undef on failure. Error message should be set using C<set_error()|CGI::Session::ErrorHandler/"set_error()">
=back
=head1 LICENSING
For support and licensing see L<CGI::Session|CGI::Session>
=cut
| carlgao/lenga | images/lenny64-peon/usr/share/perl5/CGI/Session/Serialize/freezethaw.pm | Perl | mit | 1,352 |
#!/usr/bin/perl
open F,"tc05.txt";
while(<F>){
my $line = $_;
chomp($line);
# my $Regex_Pattern = '(?:href\=\"([\w:;\.\/&=\?]+)\"[\w\W]*\>([\w\W]*)\<\/a\>)+';
my $Regex_Pattern ='<a\shref=\"([^"]*)\"\s?[^>]*>(?:<b>)?([\w|\s|/|.|,]*)(?:<\/b>)?';
while ($line =~m/$Regex_Pattern/g){
my ($url, $content) = ($1, $2);
$content =~ s/^\s+//g;
print "$url,$content\n";
}
}
exit;
my $n=<STDIN>;
chomp $n;
for (my $i=0;$i<$n;$i++){
my $input = <STDIN>;
chomp($input);
my $Regex_Pattern = 'href\=\"([\w:;\.\/&=\?]+)\"[\w\W]*\>([\w\W]*)\<\/a\>';
if ($input =~ /$Regex_Pattern/){
print "$1,$2\n";
}
}
| MarsBighead/mustang | Perl/detect-HTML-links.pl | Perl | mit | 659 |
=head1 NAME
Mail::Box::Message - manage one message within a mail-folder
=head1 INHERITANCE
Mail::Box::Message
is a Mail::Message
is a Mail::Reporter
Mail::Box::Message is extended by
Mail::Box::Dir::Message
Mail::Box::File::Message
Mail::Box::Message::Destructed
Mail::Box::Net::Message
=head1 SYNOPSIS
# Usually these message objects are created indirectly
use Mail::Box::Manager;
my $manager = Mail::Box::Manager->new;
my $folder = $manager->open(folder => 'Mail/Drafts');
my $msg = $folder->message(1);
$msg->delete;
$msg->size; # and much more
=head1 DESCRIPTION
These pages do only describe methods which relate to folders. If you
access the knowledge of a message, then read L<Mail::Message|Mail::Message>.
During its life, a message will pass through certain stages. These
stages were introduced to reduce the access-time to the folder. Changing
from stage, the message's body and head objects may change.
=head1 METHODS
=head2 Constructors
$obj-E<gt>B<clone>(OPTIONS)
=over 4
See L<Mail::Message/"Constructors">
=back
Mail::Box::Message-E<gt>B<new>(OPTIONS)
=over 4
Option --Defined in --Default
body Mail::Message undef
body_type <from folder>
deleted Mail::Message <false>
field_type Mail::Message undef
folder <required>
head Mail::Message undef
head_type Mail::Message Mail::Message::Head::Complete
labels Mail::Message {}
log Mail::Reporter 'WARNINGS'
messageId Mail::Message undef
modified Mail::Message <false>
size undef
trace Mail::Reporter 'WARNINGS'
trusted Mail::Message <false>
. body => OBJECT
. body_type => CODE|CLASS
=over 4
If the body of a message is used delay-loaded, the message must what type
of message to become when it finally gets parsed. The folder which is
delaying the load must specify the algorithm to determine that type.
=back
. deleted => BOOLEAN
. field_type => CLASS
. folder => FOLDER
=over 4
The folder where this message appeared in. The argument is
an instance of (a sub-class of) a L<Mail::Box|Mail::Box>.
=back
. head => OBJECT
. head_type => CLASS
. labels => ARRAY|HASH
. log => LEVEL
. messageId => STRING
. modified => BOOLEAN
. size => INTEGER
=over 4
The size of the message, which includes head and body, but without the
message separators which may be used by the folder type.
=back
. trace => LEVEL
. trusted => BOOLEAN
=back
=head2 Constructing a message
$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
=over 4
See L<Mail::Message::Construct::Bounce/"Constructing a message">
=back
Mail::Box::Message-E<gt>B<build>([MESSAGE|PART|BODY], CONTENT)
=over 4
See L<Mail::Message::Construct::Build/"Constructing a message">
=back
Mail::Box::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
=over 4
See L<Mail::Message::Construct::Build/"Constructing a message">
=back
$obj-E<gt>B<forward>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardAttach>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardInline>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardNo>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardPostlude>
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardPrelude>
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
$obj-E<gt>B<forwardSubject>(STRING)
=over 4
See L<Mail::Message::Construct::Forward/"Constructing a message">
=back
Mail::Box::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
=over 4
See L<Mail::Message::Construct::Read/"Constructing a message">
=back
$obj-E<gt>B<rebuild>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Rebuild/"Constructing a message">
=back
$obj-E<gt>B<reply>(OPTIONS)
=over 4
See L<Mail::Message::Construct::Reply/"Constructing a message">
=back
$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
=over 4
See L<Mail::Message::Construct::Reply/"Constructing a message">
=back
$obj-E<gt>B<replySubject>(STRING)
Mail::Box::Message-E<gt>B<replySubject>(STRING)
=over 4
See L<Mail::Message::Construct::Reply/"Constructing a message">
=back
=head2 The message
$obj-E<gt>B<container>
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
=over 4
Copy the message to the indicated opened FOLDER, without deleting the
original. The coerced message (the clone in the destination folder)
is returned.
Option --Default
shallow <false>
shallow_body <false>
shallow_head <false>
share <false>
. shallow => BOOLEAN
=over 4
Used for L<clone(shallow)|Mail::Message/"Constructors">.
=back
. shallow_body => BOOLEAN
=over 4
Used for L<clone(shallow_body)|Mail::Message/"Constructors">.
=back
. shallow_head => BOOLEAN
=over 4
Used for L<clone(shallow_head)|Mail::Message/"Constructors">.
=back
. share => BOOLEAN
=over 4
Try to share the physical storage of the message between the two folders.
Sometimes, they even may be of different types. When not possible, this
options will be silently ignored.
=back
example:
my $draft = $mgr->open(folder => 'Draft');
$message->copyTo($draft, share => 1);
=back
$obj-E<gt>B<folder>([FOLDER])
=over 4
In with folder did we detect this message/dummy? This is a reference
to the folder-object.
=back
$obj-E<gt>B<isDummy>
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<isPart>
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<messageId>
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<moveTo>(FOLDER, OPTIONS)
=over 4
Move the message from this folder to the FOLDER specified. This will
create a copy using L<clone()|Mail::Message/"Constructors"> first. Then, this original message is
flagged to get deleted. So until the source folder is closed, two copies
of the message may stay in memory.
The newly created message clone (part of the destination folder)
is returned. All OPTIONS are passed to L<copyTo()|Mail::Box::Message/"The message">
Option --Default
shallow_body <undef>
share <true unless shallow_body exists>
. shallow_body => BOOLEAN
=over 4
Only create a shallow body, which means that the header can not be
reused. A message can therefore not be shared in storage unless
explicitly stated.
=back
. share => BOOLEAN
=over 4
When there is a chance that the original message can be undeleted, then
this must be set to false. Otherwise a shallow clone will be made, which
will share the header which can be modified in the undeleted message.
=back
example: of moving a message
my $t = $msg->moveTo('trash');
is equivalent to
my $t = $msg->copyTo('trash', share => 1);
$msg->delete;
=back
$obj-E<gt>B<print>([FILEHANDLE])
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<send>([MAILER], OPTIONS)
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<seqnr>([INTEGER])
=over 4
Get the number of this message is the current folder. It starts counting
from zero. Do not change the number.
=back
$obj-E<gt>B<size>
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<toplevel>
=over 4
See L<Mail::Message/"The message">
=back
$obj-E<gt>B<write>([FILEHANDLE])
=over 4
See L<Mail::Message/"The message">
=back
=head2 The header
$obj-E<gt>B<bcc>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<cc>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<date>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<destinations>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<from>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<get>(FIELDNAME)
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<guessTimestamp>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<head>([HEAD])
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<nrLines>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<sender>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<study>(FIELDNAME)
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<subject>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<timestamp>
=over 4
See L<Mail::Message/"The header">
=back
$obj-E<gt>B<to>
=over 4
See L<Mail::Message/"The header">
=back
=head2 The body
$obj-E<gt>B<body>([BODY])
=over 4
See L<Mail::Message/"The body">
=back
$obj-E<gt>B<contentType>
=over 4
See L<Mail::Message/"The body">
=back
$obj-E<gt>B<decoded>(OPTIONS)
=over 4
See L<Mail::Message/"The body">
=back
$obj-E<gt>B<encode>(OPTIONS)
=over 4
See L<Mail::Message/"The body">
=back
$obj-E<gt>B<isMultipart>
=over 4
See L<Mail::Message/"The body">
=back
$obj-E<gt>B<isNested>
=over 4
See L<Mail::Message/"The body">
=back
$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
=over 4
See L<Mail::Message/"The body">
=back
=head2 Flags
$obj-E<gt>B<delete>
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<deleted>([BOOLEAN])
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<isDeleted>
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<isModified>
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<label>(LABEL|PAIRS)
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<labels>
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<labelsToStatus>
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<modified>([BOOLEAN])
=over 4
See L<Mail::Message/"Flags">
=back
$obj-E<gt>B<statusToLabels>
=over 4
See L<Mail::Message/"Flags">
=back
=head2 The whole message as text
$obj-E<gt>B<file>
=over 4
See L<Mail::Message::Construct::Text/"The whole message as text">
=back
$obj-E<gt>B<lines>
=over 4
See L<Mail::Message::Construct::Text/"The whole message as text">
=back
$obj-E<gt>B<printStructure>([FILEHANDLE|undef],[INDENT])
=over 4
See L<Mail::Message::Construct::Text/"The whole message as text">
=back
$obj-E<gt>B<string>
=over 4
See L<Mail::Message::Construct::Text/"The whole message as text">
=back
=head2 Internals
$obj-E<gt>B<clonedFrom>
=over 4
See L<Mail::Message/"Internals">
=back
Mail::Box::Message-E<gt>B<coerce>(MESSAGE, OPTIONS)
=over 4
See L<Mail::Message/"Internals">
=back
$obj-E<gt>B<diskDelete>
=over 4
Remove a message from disk. This is not from the folder, but everything
else, like parts of the message which are stored outside from the
folder.
=back
$obj-E<gt>B<isDelayed>
=over 4
See L<Mail::Message/"Internals">
=back
$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
=over 4
Read the body of one message. The PARSER gives access to the folder file.
The HEAD has been read with L<readHead()|Mail::Message/"Internals">. The optional BODYTYPE supplies
the class name of the body to be created, or a code reference to a
routine which can produce a body type based on the head (passed as
first argument).
By default, the BODYTYPE will call L<Mail::Box::determineBodyType()|Mail::Box/"Internals">
where the message will be added to.
=back
$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
=over 4
See L<Mail::Message/"Internals">
=back
$obj-E<gt>B<readHead>(PARSER [,CLASS])
=over 4
See L<Mail::Message/"Internals">
=back
$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
=over 4
See L<Mail::Message::Construct::Rebuild/"Internals">
=back
$obj-E<gt>B<storeBody>(BODY)
=over 4
See L<Mail::Message/"Internals">
=back
$obj-E<gt>B<takeMessageId>([STRING])
=over 4
See L<Mail::Message/"Internals">
=back
=head2 Error handling
$obj-E<gt>B<AUTOLOAD>
=over 4
See L<Mail::Message::Construct/"METHODS">
=back
$obj-E<gt>B<addReport>(OBJECT)
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<defaultTrace>([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])
Mail::Box::Message-E<gt>B<defaultTrace>([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<errors>
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<log>([LEVEL [,STRINGS]])
Mail::Box::Message-E<gt>B<log>([LEVEL [,STRINGS]])
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<logPriority>(LEVEL)
Mail::Box::Message-E<gt>B<logPriority>(LEVEL)
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<logSettings>
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<notImplemented>
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<report>([LEVEL])
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<reportAll>([LEVEL])
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<shortSize>([VALUE])
Mail::Box::Message-E<gt>B<shortSize>([VALUE])
=over 4
See L<Mail::Message/"Error handling">
=back
$obj-E<gt>B<shortString>
=over 4
See L<Mail::Message/"Error handling">
=back
$obj-E<gt>B<trace>([LEVEL])
=over 4
See L<Mail::Reporter/"Error handling">
=back
$obj-E<gt>B<warnings>
=over 4
See L<Mail::Reporter/"Error handling">
=back
=head2 Cleanup
$obj-E<gt>B<DESTROY>
=over 4
See L<Mail::Message/"Cleanup">
=back
$obj-E<gt>B<destruct>
=over 4
Removes most of the memory occupied by the message by detaching the header
and body. Then, the object changes into a L<Mail::Box::Message::Destructed|Mail::Box::Message::Destructed>
which will catch all attempts to access the header and body. Be careful
with the usage of this method.
=back
$obj-E<gt>B<inGlobalDestruction>
=over 4
See L<Mail::Reporter/"Cleanup">
=back
=head1 DETAILS
=head1 DIAGNOSTICS
Error: Cannot coerce a $class object into a $class object
=over 4
=back
Error: Cannot include forward source as $include.
=over 4
Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">. Valid choices are
C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
=back
Error: Cannot include reply source as $include.
=over 4
Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">. Valid
choices are C<NO>, C<INLINE>, and C<ATTACH>.
=back
Error: Method bounce requires To, Cc, or Bcc
=over 4
The message L<bounce()|Mail::Message::Construct::Bounce/"Constructing a message"> method forwards a received message off to someone
else without modification; you must specified it's new destination.
If you have the urge not to specify any destination, you probably
are looking for L<reply()|Mail::Message::Construct::Reply/"Constructing a message">. When you wish to modify the content, use
L<forward()|Mail::Message::Construct::Forward/"Constructing a message">.
=back
Error: Method forwardAttach requires a preamble
=over 4
=back
Error: Method forwardEncapsulate requires a preamble
=over 4
=back
Error: No address to create forwarded to.
=over 4
If a forward message is created, a destination address must be specified.
=back
Error: No default mailer found to send message.
=over 4
The message L<send()|Mail::Message/"The message"> mechanism had not enough information to automatically
find a mail transfer agent to sent this message. Specify a mailer
explicitly using the C<via> options.
=back
Error: No rebuild rule $name defined.
=over 4
=back
Error: Only build() Mail::Message's; they are not in a folder yet
=over 4
You may wish to construct a message to be stored in a some kind
of folder, but you need to do that in two steps. First, create a
normal L<Mail::Message|Mail::Message>, and then add it to the folder. During this
L<Mail::Box::addMessage()|Mail::Box/"The folder"> process, the message will get L<coerce()|Mail::Message/"Internals">-d
into the right message type, adding storage information and the like.
=back
Error: Package $package does not implement $method.
=over 4
Fatal error: the specific package (or one of its superclasses) does not
implement this method where it should. This message means that some other
related classes do implement this method however the class at hand does
not. Probably you should investigate this and probably inform the author
of the package.
=back
Error: coercion starts with some object
=over 4
=back
=head1 SEE ALSO
This module is part of Mail-Box distribution version 2.082,
built on April 28, 2008. Website: F<http://perl.overmeer.net/mailbox/>
=head1 LICENSE
Copyrights 2001-2008 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>
| carlgao/lenga | images/lenny64-peon/usr/share/perl5/Mail/Box/Message.pod | Perl | mit | 17,065 |
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Getopt::Long;
use List::Util qw/max/;
use File::Basename qw/basename/;
$0=basename $0;
exit(main());
sub main{
my $settings={};
GetOptions($settings,qw(help outfile=s indels! depth=i badsites=s));
my @infile=@ARGV;
$$settings{outfile}||="$0.out.vcf";
$$settings{depth}||=0;
$$settings{indels}=1 if(!defined($$settings{indels}));
die usage($settings) if($$settings{help} || !@infile);
filterVcfs(\@infile,$settings);
print "VCF output is in $$settings{outfile}\n";
return 0;
}
sub filterVcfs{
my($infile,$settings)=@_;
my $newVcfStr="";
open(OUT,">",$$settings{outfile}) or die "Could not open $$settings{outfile} for writing:$!";
$newVcfStr.=filterVcf($_,$settings) for(@$infile);
print OUT $newVcfStr;
close OUT;
}
sub filterVcf{
my($infile,$settings)=@_;
my $vcfStr="";
my @badSites;
open(IN,"<",$infile) or die "Could not open $infile for reading:$!";
while(<IN>){
# print comments and then move on
if(/^#/){
$vcfStr.=$_;
next;
}
# get some field information
my @F=split /\t/;
my $numFields=@F;
my ($rseq,$pos)=@F[0..1];
my $posId=join(":",$rseq,$pos);
# find out if it's an indel
if(!$$settings{indels} && (length($F[3]) != length($F[4])) ){
push(@badSites,$posId);
next;
}
# grab other info about the snp call
my @info=split(/;/,$F[7]);
my %info;
for(@info){
my($key,$value)=split /=/;
$key=uc($key); # just to be sure
$info{$key}=$value;
}
# If the cigar line has any indels indicated and indels are not wanted, move on.
# CIGAR is defined in the SAM specifications, http://samtools.sourceforge.net/SAMv1.pdf
$info{CIGAR}||=""; # make sure CIGAR is defined before testing it
next if(!$$settings{indels} && $info{CIGAR}=~/[ID]/);
# multibase snps are printed to a line per position, but this works for single base calls too
my @alt=split(//,$F[4]);
my @ref=split(//,$F[3]);
my $numBases=max(scalar(@alt),scalar(@ref));
for(my $i=0;$i<$numBases;$i++){
$posId=join(":",$rseq,($pos+$i));
# find out if it passes other attributes like depth
if(!defined($info{DP}) || $info{DP}<$$settings{depth}){
push(@badSites,$posId);
next;
}
chomp(@F);
$ref[$i]||="*";
$alt[$i]||="*";
next if($alt[$i] eq $ref[$i]); # if equal, then not a variant
my $newLine=join("\t",$rseq,($pos+$i),$F[2],$ref[$i],$alt[$i],@F[5..($numFields-1)]);
$vcfStr.="$newLine\n";
}
}
close IN;
reportBadSites(\@badSites,$settings) if($$settings{badsites});
return $vcfStr;
}
sub reportBadSites{
my($badSites,$settings)=@_;
open(BADSITES,">",$$settings{badsites}) or die "Could not open $$settings{badsites} for writing: $!";
print BADSITES $_."\n" for(@$badSites);
close BADSITES;
print "Bad sites have been printed to $$settings{badsites}\n";
return 1;
}
sub usage{
"Filters out variant calls that you do not want in a VCF file
usage: $0 infile.vcf [-o outfile.vcf]
--noindels to remove indels
-d depth
to remove variants with this depth and lower
-b badsites.txt
a file to remember where positions with low quality variations are held
"
}
| lskatz/lyve-SET | scripts/filterVcf.pl | Perl | mit | 3,294 |
:- compile('$REGULUS/Examples/Toy0/Prolog/toy0_slt_app').
:- toy0_slt_app(1975).
:- halt.
| TeamSPoon/logicmoo_workspace | packs_sys/logicmoo_nlu/ext/regulus/Examples/Toy0/scripts/load_and_run_slt_app.pl | Perl | mit | 96 |
#!/usr/bin/perl
# dc:title add_text_index.pl
# dc:creator francoisbelleau at yahoo.ca and manolin at gmail.com
# dc:modified 2010-07-28
# dc:description Create the free text index on a specified endpoint
# -------------------------------------------------------------------------------
# Bio2RDF is a creation Francois Belleau, Marc-Alexandre Nolin and the Bio2RDF community.
# The SPARQL end points are hosted by the Centre de Recherche du CHUL de Quebec.
# This program is release under the GPL v2 licence. The term of this licence are #specified at http://www.gnu.org/copyleft/gpl.html.
#
# You can contact the Bio2RDF team at bio2rdf@gmail.com
# Visit our blog at http://bio2rdf.blogspot.com/
# Visit the main application at http://bio2rdf.org
# This open source project is hosted at http://sourceforge.net/projects/bio2rdf/
# -------------------------------------------------------------------------------
# perl add_text_index.pl <port> <password>
$port = shift;
$password = shift;
print system("isql $port -P $password verbose=on banner=off prompt=off echo=ON errors=stdout exec=\"DB.DBA.RDF_OBJ_FT_RULE_ADD(null, null, 'All'); DB.DBA.vt_inc_index_db_dba_rdf_obj(); checkpoint; \"");
| hansmeets/bio2rdf-scripts | common/perl/add_text_index.pl | Perl | mit | 1,211 |
#!/usr/bin/perl
#===============================================================================
#
# FILE: parse_pinmux.pl
#
# USAGE: ./parse_pinmux.pl
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: YOUR NAME (),
# COMPANY:
# VERSION: 1.0
# CREATED: 23.09.2013 00:02:51
# REVISION: ---
#===============================================================================
use strict;
use warnings;
my $p8 = "../extra/pinmux/beaglebone_pins_p8";
my $p9 = "../extra/pinmux/beaglebone_pins_p9";
use Data::Printer;
use Data::Dumper::Names;
open my $p8_fh,"<", $p8 or die "Could not open $p8";
my @lines = map { "p8".$_ } <$p8_fh>;
chomp @lines;
close $p8_fh;
open my $p9_fh,"<", $p9 or die "Could not open $p9";
my @p9_lines = map { "p9" . $_ } <$p9_fh>;
chomp @p9_lines;
close $p9_fh;
#print Dumper @lines;
my $pins = {};
my $gpio = {};
foreach ( @lines,@p9_lines ) {
my ($o,$x, $pin, $proc, $addr, $name, $mode0, $mode1, $mode2,$mode3, $mode4,$mode5, $mode6, $mode7 ) = map { $_ =~ s/\s+//g; $_ } unpack "A2A4A8A11A13A16A17A23A13A20A22A22A20A20";
if ( $pin =~ /\d/ ) {
$pins->{$o}{$pin} = {
proc => $proc,
addr => $addr,
name => $name,
mode0 => $mode0,
mode1 => $mode1,
mode2 => $mode2,
mode3 => $mode3,
mode4 => $mode4,
mode5 => $mode5,
mode6 => $mode6,
mode7 => $mode7,
};
if ( $mode7 =~ /gpio/ ) {
$gpio->{$mode7} = {
header => $o,
pin => $pin
};
}
}
}
print "package Bego::PinMuxHelper;";
print Dumper $pins;
print Dumper $gpio;
| jegade/bego | service/parse_pinmux.pl | Perl | mit | 1,799 |
#!/usr/bin/perl
###############################################################################
# Copyright (C) 1994 - 2006, Performance Dynamics Company #
# #
# This software is licensed as described in the file COPYING, which #
# you should have received as part of this distribution. The terms #
# are also available at http://www.perfdynamics.com/Tools/copyright.html. #
# #
# You may opt to use, copy, modify, merge, publish, distribute and/or sell #
# copies of the Software, and permit persons to whom the Software is #
# furnished to do so, under the terms of the COPYING file. #
# #
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY #
# KIND, either express or implied. #
###############################################################################
#
# mvaapprox.pl
#
# Updated by NJG on Tue, Feb 14, 2006
# Completely revised Perl code for Schweitzer algorithm
use constant TESTING => 1; # Boolean
########################################
# Mainline code takes keyboard input...#
########################################
printf STDOUT "Enter no. queues (K): ";
$input = <STDIN>;
chop($input);
if (length($input) == 0 or $input > 3) {
last;
} else {
$K = $input;
}
for ($k = 1; $k <= $K; $k++) {
printf STDOUT "Enter demand D[%d]: ", $k;
$input = <STDIN>;
chop($input);
$D[$k] = $input;
}
printf STDOUT "Enter think time (Z): ";
$input = <STDIN>;
chop($input);
$Z = $input;
printf STDOUT "Enter no. users (N): ";
$input = <STDIN>;
chop($input);
if (length($input) == 0) {
last;
} else {
$N = $input;
approx();
report();
example() if (TESTING);
}
########################################
# Subroutines #
########################################
sub approx
{
# Schweitzer algorithm
for ($k = 1; $k <= $K; $k++) {
$Q[$k] = $N / $K; # equi-partition queues initially
}
do {
for ($k = 1; $k <= $K; $k++) {
$Qprev[$k] = $Q[$k];
$R[$k] = $D[$k] * (1.0 + $Q[$k] * ($N - 1) / $N);
}
$rtt = $Z;
for ($k = 1; $k <= $K; $k++) {
$rtt += $R[$k];
}
$X = $N / $rtt;
for ($k = 1; $k <= $K; $k++) {
$Q[$k] = $X * $R[$k];
}
} while (converging())
}
sub converging {
my $k, $threshold = 0.001; # stopping criterion
# Equivalent of Max_i[|(Qnew_i - Qold_i)/Qnew_i|] pseudo-code
# seen in various textbooks
for ($k = 1; $k <= $K; $k++) {
$delta = abs($Q[$k] - $Qprev[$k]) / $Q[$k];
return(1) if($delta > $threshold);
}
return(0); # must've converged below threshold
}
sub report
{
printf("Report for N = %d, Z = %6.2f \n", $N, $Z);
printf("%2s\t%8s\t%8s\t%8s\n", "k", " R_k", " Q_k", " U_k");
for ($k = 1; $k <= $K; $k++) {
printf("%2d\t%8.4f\t%8.4f\t%8.4f\n", $k, $R[$k], $Q[$k], $X * $D[$k]);
}
print "------------------------------------------\n";
printf("X = %8.4f, R = %8.4f\n", $X, ($N / $X) - $Z);
print "------------------------------------------\n";
}
sub example
{
# From Lazowska et al., "QSP" Table on p. 119
my $N = 3.0;
my $Z = 15.0;
my $X = 0.1510;
my @D = (0, 0.605, 2.1, 1.35);
my @Q = (0, 0.0973, 0.4021, 0.2359);
printf("Expected for N = %d, Z = %6.2f\n", $N, $Z);
printf("%2s\t%8s\t%8s\t%8s\n", "k", " R_k", " Q_k", " U_k");
for ($k = 1; $k <= $K; $k++) {
printf("%2d\t%8.4f\t%8.4f\t%8.4f\n", $k, $R[$k], $Q[$k], $X * $D[$k]);
}
print "------------------------------------------\n";
printf("X = %8.4f, R = %8.4f\n", $X, ($N / $X) - $Z);
print "------------------------------------------\n";
}
| peterlharding/PDQ | examples/ppdq_2005/perl_examples/mvaapprox.pl | Perl | mit | 4,198 |
#!/usr/bin/perl
use strict;
use PostScript::Simple;
use PostScript::TextBlock;
use PostScript::Metrics;
use Barcode::Coop2of5;
# create a new PostScript object
my $p = new PostScript::Simple(papersize => "Letter",
eps => 0,
units => "in");
# create a new page
$p->newpage;
my $bc=new Barcode::Coop2of5('addcheck'=>0, 'barchar'=>'#', 'spacechar'=>' ');
my @tests = qw(
0123456789
01234567890
01234567891
01234567892
01234567893
01234567894
01234567895
01234567896
01234567897
01234567898
01234567899
);
my $y=1;
foreach my $test (@tests) {
my $rle=$bc->barcode_rle($test);
# let's do 80 units/inch
my ($total_units,$junk)=split(/:/,$rle);
my $width=$total_units/70;
render_barcode_rle(1.5, $y, 1.5+$width, $y+.45, $rle, $test);
#$p->setcolour('black');
#$p->setfont('Times-Roman',12);
#$p->text( 5.5, 1.5, $bc->{'barcode_type'});
$y+=.9;
}
# write the output to a file
$p->output("matrix.ps");
# make a bar code given an rle string
sub render_barcode_rle() {
my ($x, $y, $x1, $y1, $str, $text)=@_;
my ($total_units, $rle) = split(/:/, $str, 2);
# actually prints the bar code
my $bc_width=$x1-$x;
my $unit_width=$bc_width/$total_units;
my $start=$x;
for (my $i=0 ; $i<length($rle) ; $i++) {
# draw a bar
my $bar_width = substr($rle, $i, 1) * $unit_width;
$p->box( {filled=>1}, $start, $y+(11/72), $start + $bar_width, $y1);
$i++;
# skip over the space to the start of the next bar
my $space_width = substr($rle, $i, 1) * $unit_width;
$start += $bar_width + $space_width;
}
# prints the textual data under the bar code
my $centre=$x+($x1-$x)/2;
my $wordwidth = PostScript::Metrics::stringwidth($text,'Times-Roman',10)/72;
#$p->setcolour('white');
#$p->box( {filled=>1}, $centre-($wordwidth/2)-.1, $y, $centre+($wordwidth/2)+.1, $y+1/8+.02);
$p->setcolour('black');
$p->setfont('Times-Roman',10);
$p->text( {align=>'centre'}, $centre, $y, $text);
}
| mdchaney/barcodes | matrix.pl | Perl | mit | 1,904 |
package GAL::Schema::Result::Feature::three_prime_utr;
use strict;
use warnings;
use base qw(GAL::Schema::Result::Feature::sequence_feature);
=head1 NAME
GAL::Schema::Result::Feature::three_prime_utr - A three_prime_UTR
object for the GAL Library
=head1 VERSION
This document describes GAL::Schema::Result::Feature::three_prime_utr
version 0.2.0
=head1 SYNOPSIS
use GAL::Annotation;
my $feat_store = GAL::Annotation->new(storage => $feat_store_args,
parser => $parser_args,
fasta => $fasta_args,
);
$feat_store->load_files(files => $feature_file,
mode => 'overwrite',
);
my $features = $feat_store->schema->resultset('Feature');
my $mrnas = $features->search({type => 'mRNA'});
while (my $mrna = $mrnas->next) {
my $three_prime_utrs = $mrna->three_prime_UTRs;
while (my $three_prime_utr = $three_prime_utrs->next) {
my $utr_id = $three_prime_utr->feature_id;
my $start = $three_prime_utr->start;
my $end = $three_prime_utr->end;
}
}
=head1 DESCRIPTION
<GAL::Schema::Result::Feature::three_prime_utr> provides a
<GAL::Schema::Result::Feature> subclass for three_prime_utr specific
behavior. A three_prime_utr is a region at the 3' end of a mature
transcript (following the stop codon) that is not translated into a
protein.
=head1 METHODS
There are currenlty no three_prime_utr specific methods implemented
for <GAL::Schema::Result::Feature::three_prime_utr>. See
<GAL::Schema::Result::Feature> for inherited methods.
=cut
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
=head1 DIAGNOSTICS
<GAL::Schema::Result::Feature::three_prime_utr> currently throws no
warnings or errors.
=head1 CONFIGURATION AND ENVIRONMENT
<GAL::Schema::Result::Feature::three_prime_utr> requires no
configuration files or environment variables.
=head1 DEPENDENCIES
<DBIx::Class>
<GAL::Schema::Result::Feature::sequence_feature>
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to:
barry.moore@genetics.utah.edu
=head1 AUTHOR
Barry Moore <barry.moore@genetics.utah.edu>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2010-2014, Barry Moore <barry.moore@genetics.utah.edu>. All
rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself (See LICENSE).
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
=cut
1;
| 4ureliek/TEanalysis | Lib/GAL/Schema/Result/Feature/three_prime_utr.pm | Perl | mit | 3,800 |
#!/usr/bin/env perl
#---------------------------------------------------
%small = ();
%rsmall = ();
print STDERR "reading small names...\n";
open SMALL, "<./small_page.csv" or die $!;
for (<SMALL>) {
if (my ($a,$b) = /^(\d+),(.*)$/) {
$small{$a} = $b;
$rsmall{$b} = $a;
}
}
close(SMALL);
print STDERR " read ".(scalar keys %small)."/".(scalar keys %rsmall)." page entries\n";
#---------------------------------------------------
%ignore = ();
%getlinks = ();
print STDERR "reading ignore names...\n";
open IGNORE, "<./ignorepagelinks.csv" or die $!;
for (<IGNORE>) {
if (my ($a,$b) = /^(\d+),"\[(.*)\]"$/) {
my @c = split(",",$b);
push(@{$ignore{$a}},@c);
}
}
close(IGNORE);
print STDERR " read ".(scalar keys %ignore)." ignore entries\n";
#---------------------------------------------------
%redirect = ();
print STDERR "reading redirect names...\n";
open REDIRECT, "<./small_redirect.csv" or die $!;
for (<REDIRECT>) {
if (my ($a,$b) = /^('.*?(?<!\\)'),(\d+)$/) {
$redirect{$a}=$b;
}
}
close(REDIRECT);
print STDERR " read ".(scalar keys %redirect)." redirect entries\n";
#---------------------------------------------------
print STDERR "injesting pagelinks...\n";
{
my ($last,@array);
sub printEntry {
if (defined($last) and $#array>=0) {
print "$last,\"[".join(",",@array)."]\"\n";
}
}
while (<>) {
if (my ($a,$b) = /^(\d+),0,('.*?(?<!\\)')$/) {
if (defined($small{$a}) && (defined($rsmall{$b})||defined($redirect{$b}))) {
if ($a != $last) {
printEntry();
$last = $a;
@array = ();
}
my $id = (defined($rsmall{$b})?$rsmall{$b}:$redirect{$b});
my @g = grep {$_==$id} @{$ignore{$a}};
if ($#g<0) {
push(@array,$id);
}
}
}
}
printEntry();
}
| erikwilson/wiki-hop | import/filter_pagelinks.pl | Perl | mit | 1,771 |
false :-
main_verifier_error.
addition__1(A,B) :-
true.
addition___0(A,B,C) :-
1*A+ -1*B=0,
1*C=0,
addition__1(B,C).
addition__4(A,B,C) :-
-1*B>0,
addition__1(A,B).
addition__4(A,B,C) :-
1*B>0,
addition__1(A,B).
addition__6(A,B) :-
1*B>0,
addition__4(A,B,C).
addition__10(A,B,C) :-
-1*B>=0,
addition__4(A,B,C).
addition___0(A,B,C) :-
1*C>0,
1*D=1,
1*E=0,
1*F=0,
1*B+ -1*G= -1,
1*C+ -1*H=1,
addition__6(B,C),
addition(D,E,F,G,H,A).
addition__12(A,B) :-
-1*B>0,
addition__10(A,B,C).
addition___0(A,B,C) :-
1*C=0,
addition__10(B,C,A).
addition___0(A,B,C) :-
-1*C>0,
1*D=1,
1*E=0,
1*F=0,
1*B+ -1*G=1,
1*C+ -1*H= -1,
addition__12(B,C),
addition(D,E,F,G,H,A).
addition__split(A,B,C) :-
addition___0(A,B,C).
addition(A,B,C,D,E,F) :-
1*A=1,
1*B=0,
1*C=0,
addition__split(F,D,E).
main_entry :-
true.
main__un :-
-1*D+1*E+ -1*F>0,
1*A=1,
1*B=0,
1*C=0,
main_entry,
addition(A,B,C,E,F,D).
main__un :-
1*D+ -1*E+1*F>0,
1*A=1,
1*B=0,
1*C=0,
main_entry,
addition(A,B,C,E,F,D).
main_verifier_error :-
main__un.
| bishoksan/RAHFT | benchmarks_scp/SVCOMP15/svcomp15-clp-specialised/Addition02_false-unreach-call_false-termination.c.pl.pe.pl | Perl | apache-2.0 | 1,152 |
#
# Copyright 2018 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package cloud::aws::elasticache::mode::cpu;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_metric_output {
my ($self, %options) = @_;
my $node_id = "";
if (defined($options{instance_value}->{node_id}) && $options{instance_value}->{node_id} ne '') {
$node_id = "[Node: $options{instance_value}->{node_id}] ";
}
return "Cluster '" . $options{instance_value}->{display} . "' " . $node_id . $options{instance_value}->{stat} . " ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All CPU metrics are ok", skipped_code => { -10 => 1 } },
];
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
foreach my $metric ('CPUUtilization') {
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' } ],
output_template => $metric . ': %.2f %%',
perfdatas => [
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
};
push @{$self->{maps_counters}->{metric}}, $entry;
}
}
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"region:s" => { name => 'region' },
"name:s@" => { name => 'name' },
"node-id:s" => { name => 'node_id' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
if (!defined($self->{option_results}->{name}) || $self->{option_results}->{name} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --name option.");
$self->{output}->option_exit();
}
foreach my $instance (@{$self->{option_results}->{name}}) {
if ($instance ne '') {
push @{$self->{aws_instance}}, $instance;
}
}
$self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 600;
$self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 60;
$self->{aws_statistics} = ['Average'];
if (defined($self->{option_results}->{statistic})) {
$self->{aws_statistics} = [];
foreach my $stat (@{$self->{option_results}->{statistic}}) {
if ($stat ne '') {
push @{$self->{aws_statistics}}, ucfirst(lc($stat));
}
}
}
push @{$self->{aws_metrics}}, 'CPUUtilization';
}
sub manage_selection {
my ($self, %options) = @_;
my %metric_results;
foreach my $instance (@{$self->{aws_instance}}) {
push @{$self->{aws_dimensions}}, { Name => 'CacheClusterId', Value => $instance };
if (defined($self->{option_results}->{node_id}) && $self->{option_results}->{node_id} ne '') {
push @{$self->{aws_dimensions}}, { Name => 'CacheNodeId', Value => $self->{option_results}->{node_id} };
}
$metric_results{$instance} = $options{custom}->cloudwatch_get_metrics(
region => $self->{option_results}->{region},
namespace => 'AWS/ElastiCache',
dimensions => $self->{aws_dimensions},
metrics => $self->{aws_metrics},
statistics => $self->{aws_statistics},
timeframe => $self->{aws_timeframe},
period => $self->{aws_period},
);
foreach my $metric (@{$self->{aws_metrics}}) {
foreach my $statistic (@{$self->{aws_statistics}}) {
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
$self->{metric}->{$instance . "_" . lc($statistic)}->{node_id} = $self->{option_results}->{node_id};
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
}
}
}
if (scalar(keys %{$self->{metric}}) <= 0) {
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check ElastiCache cluster CPU utilization.
Works with Memcached and Redis backends.
Example:
perl centreon_plugins.pl --plugin=cloud::aws::elasticache::plugin --custommode=paws --mode=cpu --region='eu-west-1'
--name='centreon-front' --statistic='average' --critical-cpuutilization-average='90' --verbose
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elasticache-metricscollected.html' for more informations.
Default statistic: 'average' / All satistics are valid.
=over 8
=item B<--name>
Set the cluster name (Required) (Can be multiple).
=item B<--node-id>
Set the node id (Optional).
=item B<--warning-cpuutilization-$statistic$>
Thresholds warning ($statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
=item B<--critical-cpuutilization-$statistic$>
Thresholds critical ($statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
=back
=cut
| wilfriedcomte/centreon-plugins | cloud/aws/elasticache/mode/cpu.pm | Perl | apache-2.0 | 6,978 |
# Copyright 2020, Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package Google::Ads::GoogleAds::V10::Services::CustomerManagerLinkService::MutateCustomerManagerLinkRequest;
use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseEntity);
use Google::Ads::GoogleAds::Utils::GoogleAdsHelper;
sub new {
my ($class, $args) = @_;
my $self = {
customerId => $args->{customerId},
operations => $args->{operations},
validateOnly => $args->{validateOnly}};
# Delete the unassigned fields in this object for a more concise JSON payload
remove_unassigned_fields($self, $args);
bless $self, $class;
return $self;
}
1;
| googleads/google-ads-perl | lib/Google/Ads/GoogleAds/V10/Services/CustomerManagerLinkService/MutateCustomerManagerLinkRequest.pm | Perl | apache-2.0 | 1,162 |
#
# Copyright 2019 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::protocols::ntp::mode::offset;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use Net::NTP;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"ntp-host:s" => { name => 'ntp_host' },
"port:s" => { name => 'port', default => 123 },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => 30 },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{ntp_host})) {
$self->{output}->add_option_msg(short_msg => "Please set the ntp-host option");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my %ntp;
eval {
$Net::NTP::TIMEOUT = $self->{option_results}->{timeout};
%ntp = get_ntp_response($self->{option_results}->{ntp_host}, $self->{option_results}->{port});
};
if ($@) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => "Couldn't connect to ntp server: " . $@);
$self->{output}->display();
$self->{output}->exit();
}
my $localtime = time();
my $offset = (($ntp{'Receive Timestamp'} - $ntp{'Originate Timestamp'}) + ($ntp{'Transmit Timestamp'} - $localtime)) / 2;
my $exit = $self->{perfdata}->threshold_check(value => $offset,
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Offset: %.3fs", $offset));
$self->{output}->output_add(long_msg => sprintf("Host has an offset of %.5fs with its time server reference %s", $offset, $self->{option_results}->{ntp_host}));
$self->{output}->perfdata_add(label => "time", unit => 's',
value => sprintf('%.3f', $offset),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check Ntp server response.
=over 8
=item B<--ntp-host>
Ntp server address or FQDN
=item B<--port>
Port used (Default: 123)
=item B<--timeout>
Threshold for NTP timeout
=item B<--warning>
Threshold warning in seconds
=item B<--critical>
Threshold critical in seconds (e.g @10:10 means CRITICAL if offset is not between -10 and +10 seconds)
=back
=cut
| Sims24/centreon-plugins | apps/protocols/ntp/mode/offset.pm | Perl | apache-2.0 | 4,264 |
# Copyright 2020, Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package Google::Ads::GoogleAds::V8::Services::ChangeStatusService;
use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseService);
sub get {
my $self = shift;
my $request_body = shift;
my $http_method = 'GET';
my $request_path = 'v8/{+resourceName}';
my $response_type = 'Google::Ads::GoogleAds::V8::Resources::ChangeStatus';
return $self->SUPER::call($http_method, $request_path, $request_body,
$response_type);
}
1;
| googleads/google-ads-perl | lib/Google/Ads/GoogleAds/V8/Services/ChangeStatusService.pm | Perl | apache-2.0 | 1,039 |
package Web::Summarizer::ReferenceTargetSummarizer::Neighborhood;
use strict;
use warnings;
use Vector;
use Carp::Assert;
use Function::Parameters qw/:strict/;
use Memoize;
use Moose;
use namespace::autoclean;
with( 'TypeSignature' );
has 'neighbors' => ( is => 'ro' , isa => 'ArrayRef[Category::UrlData]' , required => 1 );
has '_neighbors' => ( is => 'ro' , isa => 'HashRef[Category::UrlData]' , init_arg => undef ,
lazy => 1 , builder => '_neighbors_builder' );
# TODO : should this be coming from a role ?
has 'target' => ( is => 'ro' , isa => 'Category::UrlData' , required => 1 );
method prior ( $token , :$ignore = undef , :$all_modalities = 0 ) {
# TODO : better done using auto dereference ?
my @selected_neighbors = @{ $self->get_neighbors( $ignore ) };
my $prior = 0;
my $n_neighbors = scalar( @selected_neighbors );
if ( $n_neighbors ) {
foreach my $neighbor (@selected_neighbors) {
if ( ! $all_modalities ) {
$prior += $neighbor->summary_modality->supports( $token ) ? 1 : 0;
}
else {
$prior += $neighbor->supports( $token ) ? 1 : 0;
}
}
$prior /= $n_neighbors;
}
return $prior;
}
sub get_neighbors {
my $this = shift;
my $ignore = shift;
my @neighbors = @{ $this->neighbors };
my @selected_neighbors = grep {
! ( $ignore && ( $_->url eq $ignore->url ) )
} @neighbors;
return \@selected_neighbors;
}
# TODO : optimize
sub get_instance {
my $this = shift;
my $instance_id = shift;
my @neighbors = @{ $this->neighbors };
foreach my $neighbor (@neighbors) {
if ( $neighbor->url eq $instance_id ) {
return $neighbor;
}
}
affirm { 0 } "Cannot request an instance that is not part of this neighborhood : $instance_id" if DEBUG;
}
method get_summary_terms ( $ignore = undef , :$check_not_supported = 0 , :$prior_threshold = 0 ) {
my @selected_neighbors = @{ $self->get_neighbors( $ignore ) };
my %seen;
my %summary_terms;
foreach my $selected_neighbor (@selected_neighbors) {
my $summary_tokens = $selected_neighbor->summary_modality->tokens;
foreach my $summary_token (keys( %{ $summary_tokens } )) {
my $summary_token_object = $summary_tokens->{ $summary_token }->[ 0 ];
if ( $summary_token_object->is_punctuation ) {
next;
}
my $summary_token_id = $summary_token_object->id;
if ( ! defined( $seen{ $summary_token_id } ) ) {
my $summary_token_prior = $self->prior( $summary_token , ignore => $ignore );
if ( $summary_token_prior > $prior_threshold ) {
if ( ! $check_not_supported || ! $selected_neighbor->supports( $summary_token ) ) {
$summary_terms{ $summary_token_id } = $summary_token_prior;
}
}
$seen{ $summary_token_id }++;
}
}
}
return \%summary_terms;
}
has 'neighborhood_density' => ( is => 'ro' , isa => 'HashRef' , init_arg => undef , lazy => 1 , builder => '_neighborhood_density_builder' );
sub _neighborhood_density_builder {
my $this = shift;
my $ignore = shift;
# TODO : should we ignore the reference under consideration ?
my @selected_neighbors = @{ $this->get_neighbors( $ignore ) };
# compute probability of abstractive terms using kernel density estimation
my $neighborhood_summary_terms = $this->get_summary_terms;
my %density;
my $partition_function = 0;
foreach my $selected_neighbor (@selected_neighbors) {
# compute similarity between reference and target
my $similarity = $this->similarity( $this->target , $selected_neighbor );
if ( ! $similarity ) {
next;
}
# update partition function
$partition_function += $similarity;
my $summary_tokens = $selected_neighbor->summary_modality->tokens;
foreach my $summary_token (keys( %{ $summary_tokens } )) {
my $summary_token_object = $summary_tokens->{ $summary_token }->[ 0 ];
if ( $summary_token_object->is_punctuation ) {
next;
}
my $summary_token_id = $summary_token_object->id;
$density{ $summary_token_id } += $similarity;
}
}
# normalize all entries using parition function
map {
$density{ $_ } /= $partition_function;
} keys( %density );
return \%density;
}
# TODO : the similarity function should become a parameter (specified as a class)
sub similarity {
my $this = shift;
my $object_1 = shift;
my $object_2 = shift;
return Vector::cosine( map { $_->signature } ( $object_1 , $object_2 ) );
}
has 'type_priors' => ( is => 'ro' , isa => 'Vector' , init_arg => undef , lazy => 1 , builder => '_type_priors_builder' );
sub _type_priors_builder {
my $this = shift;
# Note : we use all neighbors but will require relevant types to appear at least twice
my @selected_neighbors = @{ $this->get_neighbors };
my %types;
foreach my $selected_neighbor (@selected_neighbors) {
# TODO : ideally we should look at more than just the named entities, any phrase can be of interest to determine type priors
#my $summary_utterance = $selected_neighbor->summary_modality->utterance;
#my $summary_utterance_named_entities = $summary_utterance->named_entities;
my %_neighbor_named_entities;
map {
my $entities = $_;
foreach my $entity (keys( %{ $entities } )) {
$_neighbor_named_entities{ $entity }++;
}
} values( %{ $selected_neighbor->named_entities } );
my @neighbor_named_entities = keys( %_neighbor_named_entities );
# TODO : we could have a type_signature method in UrlData to take care of this
my %neighbor_types;
foreach my $neighbor_named_entity (@neighbor_named_entities) {
# determine candidate types for this named entity
my $type_signature = $this->type_signature_freebase( lc( $neighbor_named_entity ) );
my $type_signature_types = $type_signature->coordinates;
foreach my $type_signature_type (keys( %{ $type_signature_types } )) {
$neighbor_types{ $type_signature_type }++;
}
}
map {
$types{ $_ }++;
} keys( %neighbor_types );
}
# delete type that occurred only once
my %neighborhood_types;
my $n_neighbors = scalar( @selected_neighbors );
map {
$types{ $_ } / $n_neighbors;
} grep { $types{ $_ } > 1 } keys( %types );
# compute distribution ?
my $neighborhood_type_signature = new Vector( coordinates => \%types );
return $neighborhood_type_signature;
}
memoize( '_mutual_key' );
sub _mutual_key {
my $this = shift;
my $instance_1 = shift;
my $instance_2 = shift;
my $key = join( ':::' , sort { $a cmp $b } map { $_->id } ( $instance_1 , $instance_2 ) );
return $key;
}
# TODO : should this be serialized at some point ?
has '_pairwise_analyses' => ( is => 'ro' , isa => 'HashRef' , init_arg => undef , default => sub { {} } );
method mutual ( $instance_1 , $instance_2 , :$instance_1_threshold = 0 , :$instance_2_threshold) {
# target_threshold => $self->support_threshold_target , reference_threshold => 1 );
my $mutual_key = $self->_mutual_key( $instance_1 , $instance_2 );
if ( ! defined( $self->_pairwise_analyses->{ $mutual_key } ) ) {
# [ instance_1_specific , instance_2_specific ]
# TODO : can we get rid of the target_threshold parameter ? => no notion of target/reference here
$self->_pairwise_analyses->{ $mutual_key } = $self->extractive_analyzer->mutual( $instance_1 , $instance_2 , target_threshold => $instance_1_threshold , reference_threshold => $instance_2_threshold );
}
my $mutual_entry = $self->_pairwise_analyses->{ $mutual_key };
# TODO : mirrored analysis as a service ?
return $mutual_entry;
}
# extractive analyzer
has 'extractive_analyzer' => ( is => 'ro' , isa => 'TargetAdapter::Extractive::Analyzer' , init_arg => undef , lazy => 1 , builder => '_extractive_analyzer_builder' );
sub _extractive_analyzer_builder {
my $this = shift;
return new TargetAdapter::Extractive::Analyzer;
#return new TargetAdapter::Extractive::MirroredAnalyzer;
}
__PACKAGE__->meta->make_immutable;
1;
| ypetinot/web-summarization | summarizers/graph-summarizer-4/src/Web/Summarizer/ReferenceTargetSummarizer/Neighborhood.pm | Perl | apache-2.0 | 8,015 |
#!/usr/bin/env perl
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
use strict;
use warnings;
use qpid_proton;
sub usage {
exit(0);
}
my @addresses = @ARGV;
@addresses = ("~0.0.0.0") unless $addresses[0];
my $messenger = new qpid::proton::Messenger();
my $msg = new qpid::proton::Message();
$messenger->start();
foreach (@addresses)
{
print "Subscribing to $_\n";
$messenger->subscribe($_);
}
for(;;)
{
$messenger->receive(10);
while ($messenger->incoming() > 0)
{
$messenger->get($msg);
print "Address: " . $msg->get_address() . "\n";
print "Subject: " . $msg->get_subject() . "\n";
print "Content: " . $msg->get_content() . "\n";
}
}
die $@ if ($@);
| chirino/proton | proton-c/examples/messenger/perl/recv.pl | Perl | apache-2.0 | 1,463 |
#!/usr/bin/perl -w
#
# Copyright (C) 2004-2007, 2012 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2001 Internet Software Consortium.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# Id: stop.pl,v 1.12 2007/06/19 23:47:00 tbox Exp
# Framework for stopping test servers
# Based on the type of server specified, signal the server to stop, wait
# briefly for it to die, and then kill it if it is still alive.
# If a server is specified, stop it. Otherwise, stop all servers for test.
use strict;
use Cwd 'abs_path';
# Option handling
# [--use-rndc] test [server]
#
# test - name of the test directory
# server - name of the server directory
my $usage = "usage: $0 [--use-rndc] test-directory [server-directory]";
my $use_rndc;
while (@ARGV && $ARGV[0] =~ /^-/) {
my $opt = shift @ARGV;
if ($opt eq '--use-rndc') {
$use_rndc = 1;
} else {
die "$usage\n";
}
}
my $test = $ARGV[0];
my $server = $ARGV[1];
my $errors = 0;
die "$usage\n" unless defined($test);
die "No test directory: \"$test\"\n" unless (-d $test);
die "No server directory: \"$server\"\n" if (defined($server) && !-d "$test/$server");
# Global variables
my $testdir = abs_path($test);
my @servers;
# Determine which servers need to be stopped.
if (defined $server) {
@servers = ($server);
} else {
local *DIR;
opendir DIR, $testdir or die "$testdir: $!\n";
my @files = sort readdir DIR;
closedir DIR;
my @ns = grep /^ns[0-9]*$/, @files;
my @lwresd = grep /^lwresd[0-9]*$/, @files;
my @ans = grep /^ans[0-9]*$/, @files;
push @servers, @ns, @lwresd, @ans;
}
# Stop the server(s), pass 1: rndc.
if ($use_rndc) {
foreach my $server (grep /^ns/, @servers) {
stop_rndc($server);
}
wait_for_servers(30, grep /^ns/, @servers);
}
# Pass 2: SIGTERM
foreach my $server (@servers) {
stop_signal($server, "TERM");
}
wait_for_servers(60, @servers);
# Pass 3: SIGABRT
foreach my $server (@servers) {
stop_signal($server, "ABRT");
}
exit($errors ? 1 : 0);
# Subroutines
# Return the full path to a given server's PID file.
sub server_pid_file {
my($server) = @_;
my $pid_file;
if ($server =~ /^ns/) {
$pid_file = "named.pid";
} elsif ($server =~ /^lwresd/) {
$pid_file = "lwresd.pid";
} elsif ($server =~ /^ans/) {
$pid_file = "ans.pid";
} else {
print "I:Unknown server type $server\n";
exit 1;
}
$pid_file = "$testdir/$server/$pid_file";
}
# Read a PID.
sub read_pid {
my($pid_file) = @_;
local *FH;
my $result = open FH, "< $pid_file";
if (!$result) {
print "I:$pid_file: $!\n";
unlink $pid_file;
return;
}
my $pid = <FH>;
chomp($pid);
return $pid;
}
# Stop a named process with rndc.
sub stop_rndc {
my($server) = @_;
return unless ($server =~ /^ns(\d+)$/);
my $ip = "10.53.0.$1";
# Ugly, but should work.
system("$ENV{RNDC} -c $testdir/../common/rndc.conf -s $ip -p 9953 stop | sed 's/^/I:$server /'");
return;
}
# Stop a server by sending a signal to it.
sub stop_signal {
my($server, $sig) = @_;
my $pid_file = server_pid_file($server);
return unless -f $pid_file;
my $pid = read_pid($pid_file);
return unless defined($pid);
if ($sig eq 'ABRT') {
print "I:$server didn't die when sent a SIGTERM\n";
$errors++;
}
my $result = kill $sig, $pid;
if (!$result) {
print "I:$server died before a SIG$sig was sent\n";
unlink $pid_file;
$errors++;
}
return;
}
sub wait_for_servers {
my($timeout, @servers) = @_;
my @pid_files = grep { defined($_) }
map { server_pid_file($_) } @servers;
while ($timeout > 0 && @pid_files > 0) {
@pid_files = grep { -f $_ } @pid_files;
sleep 1 if (@pid_files > 0);
$timeout--;
}
return;
}
| execunix/vinos | external/bsd/bind/dist/bin/tests/system/stop.pl | Perl | apache-2.0 | 4,304 |
=head1 NAME
tcc - Tiny C Compiler
=head1 SYNOPSIS
usage: tcc [options] [I<infile1> I<infile2>...] [B<-run> I<infile> I<args>...]
=head1 DESCRIPTION
TCC options are a very much like gcc options. The main difference is that TCC
can also execute directly the resulting program and give it runtime
arguments.
Here are some examples to understand the logic:
=over 4
=item C<B<tcc -run a.c>>
Compile F<a.c> and execute it directly
=item C<B<tcc -run a.c arg1>>
Compile a.c and execute it directly. arg1 is given as first argument to
the C<main()> of a.c.
=item C<B<tcc a.c -run b.c arg1>>
Compile F<a.c> and F<b.c>, link them together and execute them. arg1 is given
as first argument to the C<main()> of the resulting program.
=item C<B<tcc -o myprog a.c b.c>>
Compile F<a.c> and F<b.c>, link them and generate the executable F<myprog>.
=item C<B<tcc -o myprog a.o b.o>>
link F<a.o> and F<b.o> together and generate the executable F<myprog>.
=item C<B<tcc -c a.c>>
Compile F<a.c> and generate object file F<a.o>.
=item C<B<tcc -c asmfile.S>>
Preprocess with C preprocess and assemble F<asmfile.S> and generate
object file F<asmfile.o>.
=item C<B<tcc -c asmfile.s>>
Assemble (but not preprocess) F<asmfile.s> and generate object file
F<asmfile.o>.
=item C<B<tcc -r -o ab.o a.c b.c>>
Compile F<a.c> and F<b.c>, link them together and generate the object file F<ab.o>.
=back
Scripting:
TCC can be invoked from I<scripts>, just as shell scripts. You just
need to add C<#!/usr/local/bin/tcc -run> at the start of your C source:
#!/usr/local/bin/tcc -run
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
TCC can read C source code from I<standard input> when B<-> is used in
place of B<infile>. Example:
echo 'main(){puts("hello");}' | tcc -run -
=head1 OPTIONS
=over 4
=item B<-v>
Display current TCC version, increase verbosity.
=item B<-c>
Generate an object file (B<-o> option must also be given).
=item B<-o outfile>
Put object file, executable, or dll into output file F<outfile>.
=item B<-Bdir>
Set the path where the tcc internal libraries can be found (default is
F<PREFIX/lib/tcc>).
=item B<-bench>
Output compilation statistics.
=item B<-run source [args...]>
Compile file I<source> and run it with the command line arguments
I<args>. In order to be able to give more than one argument to a
script, several TCC options can be given I<after> the
B<-run> option, separated by spaces. Example:
tcc "-run -L/usr/X11R6/lib -lX11" ex4.c
In a script, it gives the following header:
#!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
#include <stdlib.h>
int main(int argc, char **argv)
{
...
}
=back
Preprocessor options:
=over 4
=item B<-Idir>
Specify an additional include path. Include paths are searched in the
order they are specified.
System include paths are always searched after. The default system
include paths are: F</usr/local/include>, F</usr/include>
and F<PREFIX/lib/tcc/include>. (F<PREFIX> is usually
F</usr> or F</usr/local>).
=item B<-Dsym[=val]>
Define preprocessor symbol B<sym> to
val. If val is not present, its value is B<1>. Function-like macros can
also be defined: B<-DF(a)=a+1>
=item B<-Usym>
Undefine preprocessor symbol B<sym>.
=back
Compilation flags:
Note: each of the following warning options has a negative form beginning with
B<-fno->.
=over 4
=item B<-funsigned-char>
Let the C<char> type be unsigned.
=item B<-fsigned-char>
Let the C<char> type be signed.
=item B<-fno-common>
Do not generate common symbols for uninitialized data.
=item B<-fleading-underscore>
Add a leading underscore at the beginning of each C symbol.
=back
Warning options:
=over 4
=item B<-w>
Disable all warnings.
=back
Note: each of the following warning options has a negative form beginning with
B<-Wno->.
=over 4
=item B<-Wimplicit-function-declaration>
Warn about implicit function declaration.
=item B<-Wunsupported>
Warn about unsupported GCC features that are ignored by TCC.
=item B<-Wwrite-strings>
Make string constants be of type C<const char *> instead of C<char
*>.
=item B<-Werror>
Abort compilation if warnings are issued.
=item B<-Wall>
Activate all warnings, except B<-Werror>, B<-Wunusupported> and
B<-Wwrite-strings>.
=back
Linker options:
=over 4
=item B<-Ldir>
Specify an additional static library path for the B<-l> option. The
default library paths are F</usr/local/lib>, F</usr/lib> and F</lib>.
=item B<-lxxx>
Link your program with dynamic library libxxx.so or static library
libxxx.a. The library is searched in the paths specified by the
B<-L> option.
=item B<-shared>
Generate a shared library instead of an executable (B<-o> option
must also be given).
=item B<-static>
Generate a statically linked executable (default is a shared linked
executable) (B<-o> option must also be given).
=item B<-rdynamic>
Export global symbols to the dynamic linker. It is useful when a library
opened with C<dlopen()> needs to access executable symbols.
=item B<-r>
Generate an object file combining all input files (B<-o> option must
also be given).
=item B<-Wl,-Ttext,address>
Set the start of the .text section to I<address>.
=item B<-Wl,--oformat,fmt>
Use I<fmt> as output format. The supported output formats are:
=over 4
=item C<elf32-i386>
ELF output format (default)
=item C<binary>
Binary image (only for executable output)
=item C<coff>
COFF output format (only for executable output for TMS320C67xx target)
=back
=back
Debugger options:
=over 4
=item B<-g>
Generate run time debug information so that you get clear run time
error messages: C< test.c:68: in function 'test5()': dereferencing
invalid pointer> instead of the laconic C<Segmentation
fault>.
=item B<-b>
Generate additional support code to check
memory allocations and array/pointer bounds. B<-g> is implied. Note
that the generated code is slower and bigger in this case.
=item B<-bt N>
Display N callers in stack traces. This is useful with B<-g> or
B<-b>.
=back
Note: GCC options B<-Ox>, B<-fx> and B<-mx> are
ignored.
=head1 SEE ALSO
gcc(1)
=head1 AUTHOR
Fabrice Bellard
| dreamsxin/ultimatepp | bazaar/plugin/tcc/tcc.pod | Perl | bsd-2-clause | 6,224 |
#!/bin/env perl
#
use strict;
use warnings;
use DBI;
my $dbname = "mauricio";
my $dbh = DBI->connect("dbi:Pg:dbname=$dbname", "", "") || die "Erro DBI->connect: $DBI::errstr\n";
my $sth = $dbh->prepare("select * from simples;") || die "Erro DBI->prepare: $DBI::errstr\n";
$sth->execute() || die "Erro DBI->execute: $DBI::errstr\n";
while ( my ($chave, $atrib) = $sth->fetchrow_array) {
print "$chave = $atrib\n";
}
$sth->finish();
$dbh->disconnect();
| vinnix/PerlLab | Day03/database.pl | Perl | bsd-2-clause | 455 |
package App::Netdisco::SSHCollector::Platform::PaloAlto;
# vim: set expandtab tabstop=8 softtabstop=4 shiftwidth=4:
=head1 NAME
App::Netdisco::SSHCollector::Platform::PaloAlto
=head1 DESCRIPTION
Collect ARP entries from PaloAlto devices.
=cut
use strict;
use warnings;
use Dancer ':script';
use Expect;
use Moo;
=head1 PUBLIC METHODS
=over 4
=item B<arpnip($host, $ssh)>
Retrieve ARP entries from device. C<$host> is the hostname or IP address
of the device. C<$ssh> is a Net::OpenSSH connection to the device.
Returns an array of hashrefs in the format { mac => MACADDR, ip => IPADDR }.
=cut
sub arpnip{
my ($self, $hostlabel, $ssh, @args) = @_;
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);
my $prompt = qr/> \r?$/;
($pos, $error, $match, $before, $after) = $expect->expect(20, -re, $prompt);
$expect->send("set cli pager off\n");
($pos, $error, $match, $before, $after) = $expect->expect(10, -re, $prompt);
$expect->send("show arp all\n");
($pos, $error, $match, $before, $after) = $expect->expect(10, -re, $prompt);
my @arpentries;
for (split(/\r\n/, $before)){
next unless $_ =~ m/(\d{1,3}\.){3}\d{1,3}/;
my ($tmp, $ip, $mac) = split(/\s+/);
if ($ip =~ m/(\d{1,3}\.){3}\d{1,3}/ && $mac =~ m/([0-9a-f]{2}:){5}[0-9a-f]{2}/i) {
push(@arpentries, { ip => $ip, mac => $mac });
}
}
$expect->send("exit\n");
$expect->soft_close();
return @arpentries;
}
1;
| gitpan/App-Netdisco | lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm | Perl | bsd-3-clause | 1,623 |
package Paws::CodeDeploy::BatchGetDeploymentsOutput;
use Moose;
has DeploymentsInfo => (is => 'ro', isa => 'ArrayRef[Paws::CodeDeploy::DeploymentInfo]', traits => ['NameInRequest'], request_name => 'deploymentsInfo' );
has _request_id => (is => 'ro', isa => 'Str');
### main pod documentation begin ###
=head1 NAME
Paws::CodeDeploy::BatchGetDeploymentsOutput
=head1 ATTRIBUTES
=head2 DeploymentsInfo => ArrayRef[L<Paws::CodeDeploy::DeploymentInfo>]
Information about the deployments.
=head2 _request_id => Str
=cut
1; | ioanrogers/aws-sdk-perl | auto-lib/Paws/CodeDeploy/BatchGetDeploymentsOutput.pm | Perl | apache-2.0 | 537 |
#
# Copyright 2017 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::nortel::standard::snmp::mode::components::fan;
use strict;
use warnings;
use network::nortel::standard::snmp::mode::components::resources qw($map_fan_status);
my $mapping = {
rcChasFanOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.2', map => $map_fan_status },
rcChasFanAmbientTemperature => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.3' },
};
my $oid_rcChasFanEntry = '.1.3.6.1.4.1.2272.1.4.7.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_rcChasFanEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fans");
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
return if ($self->check_filter(section => 'fan'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcChasFanEntry}})) {
next if ($oid !~ /^$mapping->{rcChasFanOperStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rcChasFanEntry}, instance => $instance);
next if ($self->check_filter(section => 'fan', instance => $instance));
$self->{components}->{fan}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance: %s, value: %s].",
$instance, $result->{rcChasFanOperStatus},
$instance, $result->{rcChasFanAmbientTemperature}
));
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{rcChasFanOperStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' status is '%s'",
$instance, $result->{rcChasFanOperStatus}));
}
my ($exit2, $warn, $crit) = $self->get_severity_numeric(section => 'fan.temperature', instance => $instance, value => $result->{rcChasFanAmbientTemperature});
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Fan temperature '%s' is %s degree centigrade", $instance, $result->{rcChasFanAmbientTemperature}));
}
$self->{output}->perfdata_add(label => 'fan_temp_' . $instance, unit => 'C',
value => $result->{rcChasFanAmbientTemperature},
warning => $warn,
critical => $crit,
);
}
}
1; | maksimatveev/centreon-plugins | network/nortel/standard/snmp/mode/components/fan.pm | Perl | apache-2.0 | 3,645 |
% Frame number: 0
happens( interacting( grp_ID0, [ id0, id1 ]), 0). holdsAt( coord( grp_ID0 )=( 166, 91 ), 0 ).
% Frame number: 1
happens( interacting( grp_ID0, [ id0, id1 ]), 40). holdsAt( coord( grp_ID0 )=( 166, 91 ), 40 ).
% Frame number: 2
happens( interacting( grp_ID0, [ id0, id1 ]), 80). holdsAt( coord( grp_ID0 )=( 167, 91 ), 80 ).
% Frame number: 3
happens( interacting( grp_ID0, [ id0, id1 ]), 120). holdsAt( coord( grp_ID0 )=( 167, 91 ), 120 ).
% Frame number: 4
happens( interacting( grp_ID0, [ id0, id1 ]), 160). holdsAt( coord( grp_ID0 )=( 167, 91 ), 160 ).
% Frame number: 5
happens( interacting( grp_ID0, [ id0, id1 ]), 200). holdsAt( coord( grp_ID0 )=( 166, 91 ), 200 ).
% Frame number: 6
happens( interacting( grp_ID0, [ id0, id1 ]), 240). holdsAt( coord( grp_ID0 )=( 164, 91 ), 240 ).
% Frame number: 7
happens( interacting( grp_ID0, [ id0, id1 ]), 280). holdsAt( coord( grp_ID0 )=( 163, 91 ), 280 ).
% Frame number: 8
happens( interacting( grp_ID0, [ id0, id1 ]), 320). holdsAt( coord( grp_ID0 )=( 162, 91 ), 320 ).
% Frame number: 9
happens( interacting( grp_ID0, [ id0, id1 ]), 360). holdsAt( coord( grp_ID0 )=( 162, 91 ), 360 ).
% Frame number: 10
happens( interacting( grp_ID0, [ id0, id1 ]), 400). holdsAt( coord( grp_ID0 )=( 160, 91 ), 400 ).
% Frame number: 11
happens( interacting( grp_ID0, [ id0, id1 ]), 440). holdsAt( coord( grp_ID0 )=( 160, 91 ), 440 ).
% Frame number: 12
happens( interacting( grp_ID0, [ id0, id1 ]), 480). holdsAt( coord( grp_ID0 )=( 159, 91 ), 480 ).
% Frame number: 13
happens( interacting( grp_ID0, [ id0, id1 ]), 520). holdsAt( coord( grp_ID0 )=( 158, 91 ), 520 ).
% Frame number: 14
happens( interacting( grp_ID0, [ id0, id1 ]), 560). holdsAt( coord( grp_ID0 )=( 158, 91 ), 560 ).
% Frame number: 15
happens( interacting( grp_ID0, [ id0, id1 ]), 600). holdsAt( coord( grp_ID0 )=( 158, 91 ), 600 ).
% Frame number: 16
happens( interacting( grp_ID0, [ id0, id1 ]), 640). holdsAt( coord( grp_ID0 )=( 158, 91 ), 640 ).
% Frame number: 17
happens( interacting( grp_ID0, [ id0, id1 ]), 680). holdsAt( coord( grp_ID0 )=( 157, 91 ), 680 ).
% Frame number: 18
happens( interacting( grp_ID0, [ id0, id1 ]), 720). holdsAt( coord( grp_ID0 )=( 157, 91 ), 720 ).
% Frame number: 19
happens( interacting( grp_ID0, [ id0, id1 ]), 760). holdsAt( coord( grp_ID0 )=( 157, 91 ), 760 ).
% Frame number: 20
happens( interacting( grp_ID0, [ id0, id1 ]), 800). holdsAt( coord( grp_ID0 )=( 157, 91 ), 800 ).
% Frame number: 21
happens( interacting( grp_ID0, [ id0, id1 ]), 840). holdsAt( coord( grp_ID0 )=( 156, 90 ), 840 ).
% Frame number: 22
happens( interacting( grp_ID0, [ id0, id1 ]), 880). holdsAt( coord( grp_ID0 )=( 156, 90 ), 880 ).
% Frame number: 23
happens( interacting( grp_ID0, [ id0, id1 ]), 920). holdsAt( coord( grp_ID0 )=( 155, 90 ), 920 ).
% Frame number: 24
happens( interacting( grp_ID0, [ id0, id1 ]), 960). holdsAt( coord( grp_ID0 )=( 155, 90 ), 960 ).
% Frame number: 25
happens( interacting( grp_ID0, [ id0, id1 ]), 1000). holdsAt( coord( grp_ID0 )=( 155, 90 ), 1000 ).
% Frame number: 26
happens( interacting( grp_ID0, [ id0, id1 ]), 1040). holdsAt( coord( grp_ID0 )=( 155, 90 ), 1040 ).
% Frame number: 27
happens( interacting( grp_ID0, [ id0, id1 ]), 1080). holdsAt( coord( grp_ID0 )=( 155, 90 ), 1080 ).
% Frame number: 28
happens( interacting( grp_ID0, [ id0, id1 ]), 1120). holdsAt( coord( grp_ID0 )=( 155, 89 ), 1120 ).
% Frame number: 29
happens( interacting( grp_ID0, [ id0, id1 ]), 1160). holdsAt( coord( grp_ID0 )=( 155, 89 ), 1160 ).
% Frame number: 30
happens( interacting( grp_ID0, [ id0, id1 ]), 1200). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1200 ).
% Frame number: 31
happens( interacting( grp_ID0, [ id0, id1 ]), 1240). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1240 ).
% Frame number: 32
happens( interacting( grp_ID0, [ id0, id1 ]), 1280). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1280 ).
% Frame number: 33
happens( interacting( grp_ID0, [ id0, id1 ]), 1320). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1320 ).
% Frame number: 34
happens( interacting( grp_ID0, [ id0, id1 ]), 1360). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1360 ).
% Frame number: 35
happens( interacting( grp_ID0, [ id0, id1 ]), 1400). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1400 ).
% Frame number: 36
happens( interacting( grp_ID0, [ id0, id1 ]), 1440). holdsAt( coord( grp_ID0 )=( 154, 88 ), 1440 ).
% Frame number: 37
happens( interacting( grp_ID0, [ id0, id1 ]), 1480). holdsAt( coord( grp_ID0 )=( 155, 88 ), 1480 ).
% Frame number: 38
happens( interacting( grp_ID0, [ id0, id1 ]), 1520). holdsAt( coord( grp_ID0 )=( 155, 87 ), 1520 ).
% Frame number: 39
happens( interacting( grp_ID0, [ id0, id1 ]), 1560). holdsAt( coord( grp_ID0 )=( 155, 87 ), 1560 ).
% Frame number: 40
happens( interacting( grp_ID0, [ id0, id1 ]), 1600). holdsAt( coord( grp_ID0 )=( 155, 87 ), 1600 ).
% Frame number: 41
happens( interacting( grp_ID0, [ id0, id1 ]), 1640). holdsAt( coord( grp_ID0 )=( 155, 86 ), 1640 ).
% Frame number: 42
happens( interacting( grp_ID0, [ id0, id1 ]), 1680). holdsAt( coord( grp_ID0 )=( 155, 86 ), 1680 ).
% Frame number: 43
happens( interacting( grp_ID0, [ id0, id1 ]), 1720). holdsAt( coord( grp_ID0 )=( 155, 86 ), 1720 ).
% Frame number: 44
happens( interacting( grp_ID0, [ id0, id1 ]), 1760). holdsAt( coord( grp_ID0 )=( 155, 86 ), 1760 ).
% Frame number: 45
happens( interacting( grp_ID0, [ id0, id1 ]), 1800). holdsAt( coord( grp_ID0 )=( 155, 86 ), 1800 ).
% Frame number: 46
happens( interacting( grp_ID0, [ id0, id1 ]), 1840). holdsAt( coord( grp_ID0 )=( 155, 85 ), 1840 ).
% Frame number: 47
happens( interacting( grp_ID0, [ id0, id1 ]), 1880). holdsAt( coord( grp_ID0 )=( 155, 85 ), 1880 ).
% Frame number: 48
happens( interacting( grp_ID0, [ id0, id1 ]), 1920). holdsAt( coord( grp_ID0 )=( 155, 84 ), 1920 ).
% Frame number: 49
happens( interacting( grp_ID0, [ id0, id1 ]), 1960). holdsAt( coord( grp_ID0 )=( 155, 84 ), 1960 ).
% Frame number: 50
happens( interacting( grp_ID0, [ id0, id1 ]), 2000). holdsAt( coord( grp_ID0 )=( 155, 84 ), 2000 ).
% Frame number: 51
happens( interacting( grp_ID0, [ id0, id1 ]), 2040). holdsAt( coord( grp_ID0 )=( 155, 84 ), 2040 ).
% Frame number: 52
happens( interacting( grp_ID0, [ id0, id1 ]), 2080). holdsAt( coord( grp_ID0 )=( 155, 84 ), 2080 ).
% Frame number: 53
happens( interacting( grp_ID0, [ id0, id1 ]), 2120). holdsAt( coord( grp_ID0 )=( 154, 84 ), 2120 ).
% Frame number: 54
happens( interacting( grp_ID0, [ id0, id1 ]), 2160). holdsAt( coord( grp_ID0 )=( 154, 84 ), 2160 ).
% Frame number: 55
happens( interacting( grp_ID0, [ id0, id1 ]), 2200). holdsAt( coord( grp_ID0 )=( 154, 84 ), 2200 ).
% Frame number: 56
happens( interacting( grp_ID0, [ id0, id1 ]), 2240). holdsAt( coord( grp_ID0 )=( 154, 84 ), 2240 ).
% Frame number: 57
happens( interacting( grp_ID0, [ id0, id1 ]), 2280). holdsAt( coord( grp_ID0 )=( 153, 84 ), 2280 ).
% Frame number: 58
happens( interacting( grp_ID0, [ id0, id1 ]), 2320). holdsAt( coord( grp_ID0 )=( 152, 84 ), 2320 ).
% Frame number: 59
happens( interacting( grp_ID0, [ id0, id1 ]), 2360). holdsAt( coord( grp_ID0 )=( 151, 85 ), 2360 ).
% Frame number: 60
happens( interacting( grp_ID0, [ id0, id1 ]), 2400). holdsAt( coord( grp_ID0 )=( 150, 86 ), 2400 ).
% Frame number: 61
happens( interacting( grp_ID0, [ id0, id1 ]), 2440). holdsAt( coord( grp_ID0 )=( 149, 87 ), 2440 ).
% Frame number: 62
happens( interacting( grp_ID0, [ id0, id1 ]), 2480). holdsAt( coord( grp_ID0 )=( 148, 88 ), 2480 ).
% Frame number: 63
happens( interacting( grp_ID0, [ id0, id1 ]), 2520). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2520 ).
% Frame number: 64
happens( interacting( grp_ID0, [ id0, id1 ]), 2560). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2560 ).
% Frame number: 65
happens( split_up( grp_ID0, [ id0, id1 ]), 2600). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2600 ).
% Frame number: 66
happens( split_up( grp_ID0, [ id0, id1 ]), 2640). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2640 ).
% Frame number: 67
happens( split_up( grp_ID0, [ id0, id1 ]), 2680). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2680 ).
% Frame number: 68
happens( split_up( grp_ID0, [ id0, id1 ]), 2720). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2720 ).
% Frame number: 69
happens( split_up( grp_ID0, [ id0, id1 ]), 2760). holdsAt( coord( grp_ID0 )=( 148, 89 ), 2760 ).
% Frame number: 70
happens( split_up( grp_ID0, [ id0, id1 ]), 2800). holdsAt( coord( grp_ID0 )=( 147, 88 ), 2800 ).
% Frame number: 71
happens( split_up( grp_ID0, [ id0, id1 ]), 2840). holdsAt( coord( grp_ID0 )=( 147, 88 ), 2840 ).
% Frame number: 72
happens( split_up( grp_ID0, [ id0, id1 ]), 2880). holdsAt( coord( grp_ID0 )=( 148, 88 ), 2880 ).
% Frame number: 73
happens( split_up( grp_ID0, [ id0, id1 ]), 2920). holdsAt( coord( grp_ID0 )=( 148, 88 ), 2920 ).
% Frame number: 74
happens( split_up( grp_ID0, [ id0, id1 ]), 2960). holdsAt( coord( grp_ID0 )=( 148, 88 ), 2960 ).
% Frame number: 75
happens( split_up( grp_ID0, [ id0, id1 ]), 3000). holdsAt( coord( grp_ID0 )=( 148, 88 ), 3000 ).
% Frame number: 76
happens( split_up( grp_ID0, [ id0, id1 ]), 3040). holdsAt( coord( grp_ID0 )=( 148, 87 ), 3040 ).
% Frame number: 77
happens( split_up( grp_ID0, [ id0, id1 ]), 3080). holdsAt( coord( grp_ID0 )=( 148, 87 ), 3080 ).
% Frame number: 78
happens( split_up( grp_ID0, [ id0, id1 ]), 3120). holdsAt( coord( grp_ID0 )=( 148, 87 ), 3120 ).
% Frame number: 79
happens( split_up( grp_ID0, [ id0, id1 ]), 3160). holdsAt( coord( grp_ID0 )=( 148, 87 ), 3160 ).
% Frame number: 80
happens( split_up( grp_ID0, [ id0, id1 ]), 3200). holdsAt( coord( grp_ID0 )=( 148, 87 ), 3200 ).
% Frame number: 81
happens( split_up( grp_ID0, [ id0, id1 ]), 3240). holdsAt( coord( grp_ID0 )=( 148, 86 ), 3240 ).
| JasonFil/Prob-EC | dataset/strong-noise/13-Rest_FallOnFloor/rffgtSituationGrp.pl | Perl | bsd-3-clause | 9,723 |
package AsposeBarCodeCloud::Object::StyleIdentifier;
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 base "AsposeBarCodeCloud::Object::BaseObject";
#
#
#
#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
#
my $swagger_types = {
};
my $attribute_map = {
};
# new object
sub new {
my ($class, %args) = @_;
my $self = {
};
return bless $self, $class;
}
# get swagger type of the attribute
sub get_swagger_types {
return $swagger_types;
}
# get attribute mappping
sub get_attribute_map {
return $attribute_map;
}
1;
| asposebarcode/Aspose_BarCode_Cloud | SDKs/Aspose.BarCode-Cloud-SDK-for-Perl/lib/AsposeBarCodeCloud/Object/StyleIdentifier.pm | Perl | mit | 770 |
package DDG::Goodie::Kana;
# ABSTRACT: Convert katakana, hiragana or romaji texts between each other
use utf8;
use DDG::Goodie;
use Lingua::JA::Moji qw/
is_kana
is_romaji
is_hiragana
hira2kata
kata2hira
kana2romaji
romaji2kana
romaji2hiragana/;
zci is_cached => 1;
zci answer_type => 'kana';
triggers end => qw/hiragana katakana romaji/;
my %dispatch = (
'hiragana' => \&to_hiragana,
'katakana' => \&to_katakana,
'romaji' => \&to_romaji
);
my $jp_punc = '{}()[]【】、,…。・「」『』〜:!?0123456789 ー';
my $punc = '{}()[][],,….•\'\'""~:!?0123456789 -';
# Removes all puncuations symbols
# Methods from Lingua::JA::Moji don't work with it
sub trim_punc {
local $_ = shift @_;
my $punc = shift @_;
s/[\Q$punc\E]//g;
return $_;
};
# Translates punctuation between each other
sub punc_from_jp {
local $_ = shift @_;
eval "tr/$jp_punc/$punc/";
return $_;
}
sub punc_to_jp {
local $_ = shift @_;
eval "tr/$punc/$jp_punc/";
return $_;
}
# From romaji or kana to hiragana
sub to_hiragana {
my $text = shift @_;
return kata2hira($text) if is_kana(trim_punc($text, $jp_punc));
return romaji2hiragana(punc_to_jp($text), { ime => 1 }) if is_romaji(trim_punc($text, $punc));
};
# From romaji or kana to katakana
sub to_katakana {
my $text = shift @_;
return hira2kata($text) if is_kana(trim_punc($text, $jp_punc));
return romaji2kana(punc_to_jp($text), { ime => 1 }) if is_romaji(trim_punc($text, $punc));
};
# From kana to romaji
sub to_romaji {
my $text = shift @_;
my $romaji = kana2romaji($text, {style => 'hepburn', wo => 1}) if is_kana(trim_punc($text, $jp_punc));
return unless $romaji;
punc_from_jp($romaji);
};
handle query_lc => sub {
return unless /^
(?<text>.*?)
(?: to| in)?\s+
(?<syll>hiragana|katakana|romaji)
$/x;
my $text = $+{text};
my $syll = $+{syll}; # Output syllable
$text =~ s/^\s+|\s+$//g;
my $answer = $dispatch{$syll}($text);
return unless $answer;
return "$text converted to $syll is $answer",
structured_answer => {
input => [$text],
operation => "Convert to ". ucfirst $syll,
result => $answer
};
};
1;
| regagain/zeroclickinfo-goodies | lib/DDG/Goodie/Kana.pm | Perl | apache-2.0 | 2,320 |
=head1 NAME
Apache2::Connection - Perl API for Apache connection object
=head1 Synopsis
use Apache2::Connection ();
use Apache2::RequestRec ();
my $c = $r->connection;
my $c = $r->connection;
# is connection still open?
$status = $c->aborted;
# base server
$base_server = $c->base_server();
# needed for creating buckets/brigades
$ba = $c->bucket_alloc();
# client's socket
$socket = $c->client_socket;
# unique connection id
$id = $c->id();
# connection filters stack
$input_filters = $c->input_filters();
$output_filters = $c->output_filters();
# keep the connection alive?
$status = $c->keepalive();
# how many requests served over the current connection
$served = $c->keepalives();
# this connection's local and remote socket addresses
$local_sa = $c->local_addr();
$remote_sa = $c->remote_addr();
# local and remote hostnames
$local_host = $c->local_host();
$remote_host = $c->get_remote_host();
$remote_host = $c->remote_host();
# server and remote client's IP addresses
$local_ip = $c->local_ip();
$remote_ip = $c->remote_ip();
# connection level Apache notes
$notes = $c->notes();
# this connection's pool
$p = $c->pool();
=head1 Description
C<Apache2::RequestRec> provides the Perl API for Apache connection
record object.
=head1 API
C<Apache2::Connection> provides the following functions and/or methods:
=head2 C<aborted>
Check whether the connection is still open
$status = $c->aborted();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$status> ( boolean )
true if the connection has been aborted, false if still open
=item since: 2.0.00
=back
=head2 C<base_server>
Physical server this connection came in on (main server or vhost):
$base_server = $c->base_server();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$base_server>
( C<L<Apache2::Server object|docs::2.0::api::Apache2::ServerRec>> )
=item since: 2.0.00
=back
=head2 C<bucket_alloc>
The bucket allocator to use for all bucket/brigade creations
$ba = $c->bucket_alloc();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$ba>
( C<L<APR::BucketAlloc object|docs::2.0::api::APR::BucketAlloc>> )
=item since: 2.0.00
=back
This object is needed by C<L<APR::Bucket|docs::2.0::api::APR::Bucket>>
and C<L<APR::Brigade|docs::2.0::api::APR::Brigade>> methods/functions.
=head2 C<client_socket>
Get/set the client socket
$socket = $c->client_socket;
$prev_socket = $c->client_socket($new_socket);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_socket>
( C<L<APR::Socket object|docs::2.0::api::APR::Socket>> object )
If passed a new socket will be set.
=item ret: C<$socket>
( C<L<APR::Socket object|docs::2.0::api::APR::Socket>> object )
current client socket
if the optional argument C<$new_socket> was passed the previous socket
object is returned.
=item since: 2.0.00
=back
=head2 C<get_remote_host>
Lookup the client's DNS hostname or IP address
$remote_host = $c->remote_host();
$remote_host = $c->remote_host($type);
$remote_host = $c->remote_host($type, $dir_config);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
The current connection
=item opt arg1: C<$type> ( C<L<:remotehost
constant|docs::2.0::api::Apache2::Const/C__remotehost_>> )
The type of lookup to perform:
=over
=item C<Apache2::Const::REMOTE_DOUBLE_REV>
will always force a DNS lookup, and also force a double reverse
lookup, regardless of the C<HostnameLookups> setting. The result is
the (double reverse checked) hostname, or undef if any of the lookups
fail.
=item C<Apache2::Const::REMOTE_HOST>
returns the hostname, or C<undef> if the hostname lookup fails. It
will force a DNS lookup according to the C<HostnameLookups> setting.
=item C<Apache2::Const::REMOTE_NAME>
returns the hostname, or the dotted quad if the hostname lookup fails.
It will force a DNS lookup according to the C<HostnameLookups>
setting.
=item C<Apache2::Const::REMOTE_NOLOOKUP>
is like C<Apache2::Const::REMOTE_NAME> except that a DNS lookup is never
forced.
=back
Default value is C<Apache2::Const::REMOTE_NAME>.
=item opt arg2: C<$dir_config>
( C<L<Apache2::ConfVector object|docs::2.0::api::Apache2::RequestRec/C_per_dir_config_>> )
The directory config vector from the request. It's needed to find the
container in which the directive C<HostnameLookups> is set. To get one
for the current request use
C<L<$r-E<gt>per_dir_config|docs::2.0::api::Apache2::RequestRec/C_per_dir_config_>>.
By default, C<undef> is passed, in which case it's the same as if
C<HostnameLookups> was set to C<Off>.
=item ret: C<$remote_host> ( string/undef )
The remote hostname. If the configuration directive
B<HostNameLookups> is set to off, this returns the dotted decimal
representation of the client's IP address instead. Might return
C<undef> if the hostname is not known.
=item since: 2.0.00
=back
The result of C<get_remote_host> call is cached in
C<L<$c-E<gt>remote_host|/C_remote_host_>>. If the latter is set,
C<get_remote_host> will return that value immediately, w/o doing any
checkups.
=head2 C<id>
ID of this connection; unique at any point in time
$id = $c->id();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$id> (integer)
=item since: 2.0.00
=back
=head2 C<input_filters>
Get/set the first filter in a linked list of protocol level input
filters:
$input_filters = $c->input_filters();
$prev_input_filters = $c->input_filters($new_input_filters);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_input_filters>
Set a new value
=item ret: C<$input_filters>
( C<L<Apache2::Filter object|docs::2.0::api::Apache2::Filter>> )
The first filter in the connection input filters chain.
If C<$new_input_filters> was passed, returns the previous value.
=item since: 2.0.00
=back
For an example see: L<Bucket Brigades-based Protocol
Module|docs::2.0::user::handlers::protocols/Bucket_Brigades_based_Protocol_Module>
=head2 C<keepalive>
This method answers the question: Should the the connection be kept
alive for another HTTP request after the current request is completed?
$status = $c->keepalive();
$status = $c->keepalive($new_status);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_status> ( C<L<:conn_keepalive
constant|docs::2.0::api::Apache2::Const/C__conn_keepalive_>> )
Normally you should not mess with setting this option when handling
the HTTP protocol. If you do (for example when sending your own
headers set with
C<L<$r-E<gt>assbackwards|docs::2.0::api::Apache2::RequestRec/C_assbackwards_>>)
-- take a look at the ap_set_keepalive() function in
F<httpd-2.0/modules/http/http_protocol.c>.
=item ret: C<$status> ( C<L<:conn_keepalive
constant|docs::2.0::api::Apache2::Const/C__conn_keepalive_>> )
The method does B<not> return true or false, but one of the states
which can be compared against (C<L<:conn_keepalive
constants|docs::2.0::api::Apache2::Const/C__conn_keepalive_>>).
=item since: 2.0.00
=back
Unless you set this value yourself when implementing non-HTTP
protocols, it's only relevant for HTTP requests.
For example:
use Apache2::RequestRec ();
use Apache2::Connection ();
use Apache2::Const -compile => qw(:conn_keepalive);
...
my $c = $r->connection;
if ($c->keepalive == Apache2::Const::CONN_KEEPALIVE) {
# do something
}
elsif ($c->keepalive == Apache2::Const::CONN_CLOSE) {
# do something else
}
elsif ($c->keepalive == Apache2::Const::CONN_UNKNOWN) {
# do yet something else
}
else {
# die "unknown state";
}
Notice that new states could be added later by Apache, so your code
should make no assumptions and do things only if the desired state
matches.
=head2 C<keepalives>
How many requests were already served over the current connection.
$served = $c->keepalives();
$served = $c->keepalives($new_served);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_served> (integer)
Set the number of served requests over the current
connection. Normally you won't do that when handling HTTP
requests. (But see below a note regarding
C<L<$r-E<gt>assbackwards|docs::2.0::api::Apache2::RequestRec/C_assbackwards_>>).
=item ret: C<$served> (integer)
How many requests were already served over the current connection.
In most handlers, but HTTP output filter handlers, that value doesn't
count the current request. For the latter it'll count the current
request.
=item since: 2.0.00
=back
This method is only relevant for L<keepalive|/C_keepalive_>
connections. The core connection output filter
C<ap_http_header_filter> increments this value when the response
headers are sent and it decides that the connection should not be
closed (see C<ap_set_keepalive()>).
If you send your own set of HTTP headers with
C<L<$r-E<gt>assbackwards|docs::2.0::api::Apache2::RequestRec/C_assbackwards_>>,
which includes the C<Keep-Alive> HTTP response header, you must make
sure to increment the C<keepalives> counter.
=head2 C<local_addr>
Get this connection's local socket address
$local_sa = $c->local_addr();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$local_sa>
( C<L<APR::SockAddr object|docs::2.0::api::APR::SockAddr>> )
=item since: 2.0.00
=back
=head2 C<local_host>
used for ap_get_server_name when UseCanonicalName is set to DNS
(ignores setting of HostnameLookups)
$local_host = $c->local_host();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$local_host> (string)
=item since: 2.0.00
=back
META: you probably shouldn't use this method, but (
C<L<get_server_name|docs::2.0::api::Apache2::RequestUtil/C_get_server_name_>>
) if inside request and C<$r> is available.
=head2 C<local_ip>
server IP address
$local_ip = $c->local_ip();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$local_ip> (string)
=item since: 2.0.00
=back
=head2 C<notes>
Get/set text notes for the duration of this connection. These notes can
be passed from one module to another (not only mod_perl, but modules
in any other language):
$notes = $c->notes();
$prev_notes = $c->notes($new_notes);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_notes>
( C<L<APR::Table object|docs::2.0::api::APR::Table>> )
=item ret: C<$notes>
( C<L<APR::Table object|docs::2.0::api::APR::Table>> )
the current notes table.
if the C<$new_notes> argument was passed, returns the previous value.
=item since: 2.0.00
=back
Also see
C<L<$r-E<gt>notes|docs::2.0::api::Apache2::RequestRec/C_notes_>>
=head2 C<output_filters>
Get the first filter in a linked list of protocol level output
filters:
$output_filters = $c->output_filters();
$prev_output_filters = $r->output_filters($new_output_filters);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_output_filters>
Set a new value
=item ret: C<$output_filters>
( C<L<Apache2::Filter object|docs::2.0::api::Apache2::Filter>> )
The first filter in the connection output filters chain.
If C<$new_output_filters> was passed, returns the previous value.
=item since: 2.0.00
=back
For an example see: L<Bucket Brigades-based Protocol
Module|docs::2.0::user::handlers::protocols/Bucket_Brigades_based_Protocol_Module>
=head2 C<pool>
Pool associated with this connection
$p = $c->pool();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$p>
( C<L<APR::Pool object|docs::2.0::api::APR::Pool>> )
=item since: 2.0.00
=back
=head2 C<remote_addr>
Get this connection's remote socket address
$remote_sa = $c->remote_addr();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$remote_sa>
( C<L<APR::SockAddr object|docs::2.0::api::APR::SockAddr>> )
=item since: 2.0.00
=back
=head2 C<remote_ip>
Client's IP address
$remote_ip = $c->remote_ip();
$prev_remote_ip = $c->remote_ip($new_remote_ip);
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item opt arg1: C<$new_remote_ip> ( string )
If passed a new value will be set
=item ret: C<$remote_ip> ( string )
current remote ip address
if the optional argument C<$new_remote_ip> was passed the previous
value is returned.
=item since: 2.0.00
=back
=head2 C<remote_host>
Client's DNS name:
$remote_host = $c->remote_host();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$remote_host> ( string/undef )
If C<L<$c-E<gt>get_remote_host|/C_get_remote_host_>> was run it
returns the cached value, which is a client DNS name or C<""> if it
wasn't found. If the check wasn't run -- C<undef> is returned.
=item since: 2.0.00
=back
It's best to to call C<L<$c-E<gt>get_remote_host|/C_get_remote_host_>>
instead of directly accessing this variable.
=head1 Unsupported API
C<Apache2::Connection> also provides auto-generated Perl interface for
a few other methods which aren't tested at the moment and therefore
their API is a subject to change. These methods will be finalized
later as a need arises. If you want to rely on any of the following
methods please contact the L<the mod_perl development mailing
list|maillist::dev> so we can help each other take the steps necessary
to shift the method to an officially supported API.
=head2 C<conn_config>
Config vector containing pointers to connections per-server config
structures
$ret = $c->conn_config();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$ret>
( C<L<Apache2::ConfVector object|docs::2.0::api::Apache2::RequestRec/C_per_dir_config_>> )
=item since: 2.0.00
=back
=head2 C<sbh>
META: Autogenerated - needs to be reviewed/completed
handle to scoreboard information for this connection
$sbh = $c->sbh();
=over 4
=item obj: C<$c>
( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
=item ret: C<$sbh> (XXX)
=item since: 2.0.00
=back
META: Not sure how this can be used from mod_perl at the
moment. Unless C<Apache2::Scoreboard> is extended to provide a hook to
read from this variable.
=head1 See Also
L<mod_perl 2.0 documentation|docs::2.0::index>.
=head1 Copyright
mod_perl 2.0 and its core modules are copyrighted under
The Apache Software License, Version 2.0.
=head1 Authors
L<The mod_perl development team and numerous
contributors|about::contributors::people>.
=cut
| Distrotech/mod_perl | docs/src/docs/2.0/api/Apache2/Connection.pod | Perl | apache-2.0 | 15,443 |
=head1 NAME
XML::LibXML - Perl Binding for libxml2
=head1 SYNOPSIS
use XML::LibXML;
my $dom = XML::LibXML->load_xml(string => <<'EOT');
<some-xml/>
EOT
$Version_String = XML::LibXML::LIBXML_DOTTED_VERSION;
$Version_ID = XML::LibXML::LIBXML_VERSION;
$DLL_Version = XML::LibXML::LIBXML_RUNTIME_VERSION;
$libxmlnode = XML::LibXML->import_GDOME( $node, $deep );
$gdomenode = XML::LibXML->export_GDOME( $node, $deep );
=head1 DESCRIPTION
This module is an interface to libxml2, providing XML and HTML parsers with
DOM, SAX and XMLReader interfaces, a large subset of DOM Layer 3 interface and
a XML::XPath-like interface to XPath API of libxml2. The module is split into
several packages which are not described in this section; unless stated
otherwise, you only need to C<<<<<< use XML::LibXML; >>>>>> in your programs.
For further information, please check the following documentation:
=over 4
=item L<<<<<< XML::LibXML::Parser >>>>>>
Parsing XML files with XML::LibXML
=item L<<<<<< XML::LibXML::DOM >>>>>>
XML::LibXML Document Object Model (DOM) Implementation
=item L<<<<<< XML::LibXML::SAX >>>>>>
XML::LibXML direct SAX parser
=item L<<<<<< XML::LibXML::Reader >>>>>>
Reading XML with a pull-parser
=item L<<<<<< XML::LibXML::Dtd >>>>>>
XML::LibXML frontend for DTD validation
=item L<<<<<< XML::LibXML::RelaxNG >>>>>>
XML::LibXML frontend for RelaxNG schema validation
=item L<<<<<< XML::LibXML::Schema >>>>>>
XML::LibXML frontend for W3C Schema schema validation
=item L<<<<<< XML::LibXML::XPathContext >>>>>>
API for evaluating XPath expressions with enhanced support for the evaluation
context
=item L<<<<<< XML::LibXML::InputCallback >>>>>>
Implementing custom URI Resolver and input callbacks
=item L<<<<<< XML::LibXML::Common >>>>>>
Common functions for XML::LibXML related Classes
=back
The nodes in the Document Object Model (DOM) are represented by the following
classes (most of which "inherit" from L<<<<<< XML::LibXML::Node >>>>>>):
=over 4
=item L<<<<<< XML::LibXML::Document >>>>>>
XML::LibXML class for DOM document nodes
=item L<<<<<< XML::LibXML::Node >>>>>>
Abstract base class for XML::LibXML DOM nodes
=item L<<<<<< XML::LibXML::Element >>>>>>
XML::LibXML class for DOM element nodes
=item L<<<<<< XML::LibXML::Text >>>>>>
XML::LibXML class for DOM text nodes
=item L<<<<<< XML::LibXML::Comment >>>>>>
XML::LibXML class for comment DOM nodes
=item L<<<<<< XML::LibXML::CDATASection >>>>>>
XML::LibXML class for DOM CDATA sections
=item L<<<<<< XML::LibXML::Attr >>>>>>
XML::LibXML DOM attribute class
=item L<<<<<< XML::LibXML::DocumentFragment >>>>>>
XML::LibXML's DOM L2 Document Fragment implementation
=item L<<<<<< XML::LibXML::Namespace >>>>>>
XML::LibXML DOM namespace nodes
=item L<<<<<< XML::LibXML::PI >>>>>>
XML::LibXML DOM processing instruction nodes
=back
=head1 ENCODINGS SUPPORT IN XML::LIBXML
Recall that since version 5.6.1, Perl distinguishes between character strings
(internally encoded in UTF-8) and so called binary data and, accordingly,
applies either character or byte semantics to them. A scalar representing a
character string is distinguished from a byte string by special flag (UTF8).
Please refer to I<<<<<< perlunicode >>>>>> for details.
XML::LibXML's API is designed to deal with many encodings of XML documents
completely transparently, so that the application using XML::LibXML can be
completely ignorant about the encoding of the XML documents it works with. On
the other hand, functions like C<<<<<< XML::LibXML::Document->setEncoding >>>>>> give the user control over the document encoding.
To ensure the aforementioned transparency and uniformity, most functions of
XML::LibXML that work with in-memory trees accept and return data as character
strings (i.e. UTF-8 encoded with the UTF8 flag on) regardless of the original
document encoding; however, the functions related to I/O operations (i.e.
parsing and saving) operate with binary data (in the original document
encoding) obeying the encoding declaration of the XML documents.
Below we summarize basic rules and principles regarding encoding:
=over 4
=item 1.
Do NOT apply any encoding-related PerlIO layers (C<<<<<< :utf8 >>>>>> or C<<<<<< :encoding(...) >>>>>>) to file handles that are an input for the parses or an output for a
serializer of (full) XML documents. This is because the conversion of the data
to/from the internal character representation is provided by libxml2 itself
which must be able to enforce the encoding specified by the C<<<<<< <?xml version="1.0" encoding="..."?> >>>>>> declaration. Here is an example to follow:
use XML::LibXML;
# load
open my $fh, '<', 'file.xml';
binmode $fh; # drop all PerlIO layers possibly created by a use open pragma
$doc = XML::LibXML->load_xml(IO => $fh);
# save
open my $out, '>', 'out.xml';
binmode $out; # as above
$doc->toFH($out);
# or
print {$out} $doc->toString();
=item 2.
All functions working with DOM accept and return character strings (UTF-8
encoded with UTF8 flag on). E.g.
my $doc = XML::LibXML::Document->new('1.0',$some_encoding);
my $element = $doc->createElement($name);
$element->appendText($text);
$xml_fragment = $element->toString(); # returns a character string
$xml_document = $doc->toString(); # returns a byte string
where C<<<<<< $some_encoding >>>>>> is the document encoding that will be used when saving the document, and C<<<<<< $name >>>>>> and C<<<<<< $text >>>>>> contain character strings (UTF-8 encoded with UTF8 flag on). Note that the
method C<<<<<< toString >>>>>> returns XML as a character string if applied to other node than the Document
node and a byte string containing the appropriate
<?xml version="1.0" encoding="..."?>
declaration if applied to a L<<<<<< XML::LibXML::Document >>>>>>.
=item 3.
DOM methods also accept binary strings in the original encoding of the document
to which the node belongs (UTF-8 is assumed if the node is not attached to any
document). Exploiting this feature is NOT RECOMMENDED since it is considered
bad practice.
my $doc = XML::LibXML::Document->new('1.0','iso-8859-2');
my $text = $doc->createTextNode($some_latin2_encoded_byte_string);
# WORKS, BUT NOT RECOMMENDED!
=back
I<<<<<< NOTE: >>>>>> libxml2 support for many encodings is based on the iconv library. The actual
list of supported encodings may vary from platform to platform. To test if your
platform works correctly with your language encoding, build a simple document
in the particular encoding and try to parse it with XML::LibXML to see if the
parser produces any errors. Occasional crashes were reported on rare platforms
that ship with a broken version of iconv.
=head1 THREAD SUPPORT
XML::LibXML since 1.67 partially supports Perl threads in Perl >= 5.8.8.
XML::LibXML can be used with threads in two ways:
By default, all XML::LibXML classes use CLONE_SKIP class method to prevent Perl
from copying XML::LibXML::* objects when a new thread is spawn. In this mode,
all XML::LibXML::* objects are thread specific. This is the safest way to work
with XML::LibXML in threads.
Alternatively, one may use
use threads;
use XML::LibXML qw(:threads_shared);
to indicate, that all XML::LibXML node and parser objects should be shared
between the main thread and any thread spawn from there. For example, in
my $doc = XML::LibXML->load_xml(location => $filename);
my $thr = threads->new(sub{
# code working with $doc
1;
});
$thr->join;
the variable C<<<<<< $doc >>>>>> refers to the exact same XML::LibXML::Document in the spawned thread as in the
main thread.
Without using mutex locks, parallel threads may read the same document (i.e.
any node that belongs to the document), parse files, and modify different
documents.
However, if there is a chance that some of the threads will attempt to modify a
document (or even create new nodes based on that document, e.g. with C<<<<<< $doc->createElement >>>>>>) that other threads may be reading at the same time, the user is responsible
for creating a mutex lock and using it in I<<<<<< both >>>>>> in the thread that modifies and the thread that reads:
my $doc = XML::LibXML->load_xml(location => $filename);
my $mutex : shared;
my $thr = threads->new(sub{
lock $mutex;
my $el = $doc->createElement('foo');
# ...
1;
});
{
lock $mutex;
my $root = $doc->documentElement;
say $root->name;
}
$thr->join;
Note that libxml2 uses dictionaries to store short strings and these
dictionaries are kept on a document node. Without mutex locks, it could happen
in the previous example that the thread modifies the dictionary while other
threads attempt to read from it, which could easily lead to a crash.
=head1 VERSION INFORMATION
Sometimes it is useful to figure out, for which version XML::LibXML was
compiled for. In most cases this is for debugging or to check if a given
installation meets all functionality for the package. The functions
XML::LibXML::LIBXML_DOTTED_VERSION and XML::LibXML::LIBXML_VERSION provide this
version information. Both functions simply pass through the values of the
similar named macros of libxml2. Similarly, XML::LibXML::LIBXML_RUNTIME_VERSION
returns the version of the (usually dynamically) linked libxml2.
=over 4
=item XML::LibXML::LIBXML_DOTTED_VERSION
$Version_String = XML::LibXML::LIBXML_DOTTED_VERSION;
Returns the version string of the libxml2 version XML::LibXML was compiled for.
This will be "2.6.2" for "libxml2 2.6.2".
=item XML::LibXML::LIBXML_VERSION
$Version_ID = XML::LibXML::LIBXML_VERSION;
Returns the version id of the libxml2 version XML::LibXML was compiled for.
This will be "20602" for "libxml2 2.6.2". Don't mix this version id with
$XML::LibXML::VERSION. The latter contains the version of XML::LibXML itself
while the first contains the version of libxml2 XML::LibXML was compiled for.
=item XML::LibXML::LIBXML_RUNTIME_VERSION
$DLL_Version = XML::LibXML::LIBXML_RUNTIME_VERSION;
Returns a version string of the libxml2 which is (usually dynamically) linked
by XML::LibXML. This will be "20602" for libxml2 released as "2.6.2" and
something like "20602-CVS2032" for a CVS build of libxml2.
XML::LibXML issues a warning if the version of libxml2 dynamically linked to it
is less than the version of libxml2 which it was compiled against.
=back
=head1 EXPORTS
By default the module exports all constants and functions listed in the :all
tag, described below.
=head1 EXPORT TAGS
=over 4
=item C<<<<<< :all >>>>>>
Includes the tags C<<<<<< :libxml >>>>>>, C<<<<<< :encoding >>>>>>, and C<<<<<< :ns >>>>>> described below.
=item C<<<<<< :libxml >>>>>>
Exports integer constants for DOM node types.
XML_ELEMENT_NODE => 1
XML_ATTRIBUTE_NODE => 2
XML_TEXT_NODE => 3
XML_CDATA_SECTION_NODE => 4
XML_ENTITY_REF_NODE => 5
XML_ENTITY_NODE => 6
XML_PI_NODE => 7
XML_COMMENT_NODE => 8
XML_DOCUMENT_NODE => 9
XML_DOCUMENT_TYPE_NODE => 10
XML_DOCUMENT_FRAG_NODE => 11
XML_NOTATION_NODE => 12
XML_HTML_DOCUMENT_NODE => 13
XML_DTD_NODE => 14
XML_ELEMENT_DECL => 15
XML_ATTRIBUTE_DECL => 16
XML_ENTITY_DECL => 17
XML_NAMESPACE_DECL => 18
XML_XINCLUDE_START => 19
XML_XINCLUDE_END => 20
=item C<<<<<< :encoding >>>>>>
Exports two encoding conversion functions from XML::LibXML::Common.
encodeToUTF8()
decodeFromUTF8()
=item C<<<<<< :ns >>>>>>
Exports two convenience constants: the implicit namespace of the reserved C<<<<<< xml: >>>>>> prefix, and the implicit namespace for the reserved C<<<<<< xmlns: >>>>>> prefix.
XML_XML_NS => 'http://www.w3.org/XML/1998/namespace'
XML_XMLNS_NS => 'http://www.w3.org/2000/xmlns/'
=back
=head1 RELATED MODULES
The modules described in this section are not part of the XML::LibXML package
itself. As they support some additional features, they are mentioned here.
=over 4
=item L<<<<<< XML::LibXSLT >>>>>>
XSLT 1.0 Processor using libxslt and XML::LibXML
=item L<<<<<< XML::LibXML::Iterator >>>>>>
XML::LibXML Implementation of the DOM Traversal Specification
=item L<<<<<< XML::CompactTree::XS >>>>>>
Uses XML::LibXML::Reader to very efficiently to parse XML document or element
into native Perl data structures, which are less flexible but significantly
faster to process then DOM.
=back
=head1 XML::LIBXML AND XML::GDOME
Note: I<<<<<< THE FUNCTIONS DESCRIBED HERE ARE STILL EXPERIMENTAL >>>>>>
Although both modules make use of libxml2's XML capabilities, the DOM
implementation of both modules are not compatible. But still it is possible to
exchange nodes from one DOM to the other. The concept of this exchange is
pretty similar to the function cloneNode(): The particular node is copied on
the low-level to the opposite DOM implementation.
Since the DOM implementations cannot coexist within one document, one is forced
to copy each node that should be used. Because you are always keeping two nodes
this may cause quite an impact on a machines memory usage.
XML::LibXML provides two functions to export or import GDOME nodes:
import_GDOME() and export_GDOME(). Both function have two parameters: the node
and a flag for recursive import. The flag works as in cloneNode().
The two functions allow to export and import XML::GDOME nodes explicitly,
however, XML::LibXML allows also the transparent import of XML::GDOME nodes in
functions such as appendChild(), insertAfter() and so on. While native nodes
are automatically adopted in most functions XML::GDOME nodes are always cloned
in advance. Thus if the original node is modified after the operation, the node
in the XML::LibXML document will not have this information.
=over 4
=item import_GDOME
$libxmlnode = XML::LibXML->import_GDOME( $node, $deep );
This clones an XML::GDOME node to an XML::LibXML node explicitly.
=item export_GDOME
$gdomenode = XML::LibXML->export_GDOME( $node, $deep );
Allows to clone an XML::LibXML node into an XML::GDOME node.
=back
=head1 CONTACTS
For bug reports, please use the CPAN request tracker on
http://rt.cpan.org/NoAuth/Bugs.html?Dist=XML-LibXML
For suggestions etc., and other issues related to XML::LibXML you may use the
perl XML mailing list (C<<<<<< perl-xml@listserv.ActiveState.com >>>>>>), where most XML-related Perl modules are discussed. In case of problems you
should check the archives of that list first. Many problems are already
discussed there. You can find the list's archives and subscription options at L<<<<<< http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-xml >>>>>>.
=head1 AUTHORS
Matt Sergeant,
Christian Glahn,
Petr Pajas
=head1 VERSION
1.98
=head1 COPYRIGHT
2001-2007, AxKit.com Ltd.
2002-2006, Christian Glahn.
2006-2009, Petr Pajas.
=cut
| leighpauls/k2cro4 | third_party/perl/perl/vendor/lib/XML/LibXML.pod | Perl | bsd-3-clause | 15,035 |
###########################################################################
#
# This file is auto-generated by the Perl DateTime Suite locale
# generator (0.05). This code generator comes with the
# DateTime::Locale distribution in the tools/ directory, and is called
# generate-from-cldr.
#
# This file as generated from the CLDR XML locale data. See the
# LICENSE.cldr file included in this distribution for license details.
#
# This file was generated from the source file id_ID.xml
# The source file version number was 1.47, generated on
# 2009/05/05 23:06:37.
#
# Do not edit this file directly.
#
###########################################################################
package DateTime::Locale::id_ID;
use strict;
use warnings;
use utf8;
use base 'DateTime::Locale::id';
sub cldr_version { return "1\.7\.1" }
{
my $first_day_of_week = "1";
sub first_day_of_week { return $first_day_of_week }
}
{
my $glibc_date_format = "\%d\/\%m\/\%y";
sub glibc_date_format { return $glibc_date_format }
}
{
my $glibc_date_1_format = "\%a\ \%b\ \%e\ \%H\:\%M\:\%S\ \%Z\ \%Y";
sub glibc_date_1_format { return $glibc_date_1_format }
}
{
my $glibc_datetime_format = "\%a\ \%d\ \%b\ \%Y\ \%r\ \%Z";
sub glibc_datetime_format { return $glibc_datetime_format }
}
{
my $glibc_time_format = "\%T";
sub glibc_time_format { return $glibc_time_format }
}
1;
__END__
=pod
=encoding utf8
=head1 NAME
DateTime::Locale::id_ID
=head1 SYNOPSIS
use DateTime;
my $dt = DateTime->now( locale => 'id_ID' );
print $dt->month_name();
=head1 DESCRIPTION
This is the DateTime locale package for Indonesian Indonesia.
=head1 DATA
This locale inherits from the L<DateTime::Locale::id> locale.
It contains the following data.
=head2 Days
=head3 Wide (format)
Senin
Selasa
Rabu
Kamis
Jumat
Sabtu
Minggu
=head3 Abbreviated (format)
Sen
Sel
Rab
Kam
Jum
Sab
Min
=head3 Narrow (format)
2
3
4
5
6
7
1
=head3 Wide (stand-alone)
Senin
Selasa
Rabu
Kamis
Jumat
Sabtu
Minggu
=head3 Abbreviated (stand-alone)
Sen
Sel
Rab
Kam
Jum
Sab
Min
=head3 Narrow (stand-alone)
2
3
4
5
6
7
1
=head2 Months
=head3 Wide (format)
Januari
Februari
Maret
April
Mei
Juni
Juli
Agustus
September
Oktober
November
Desember
=head3 Abbreviated (format)
Jan
Feb
Mar
Apr
Mei
Jun
Jul
Agu
Sep
Okt
Nov
Des
=head3 Narrow (format)
1
2
3
4
5
6
7
8
9
10
11
12
=head3 Wide (stand-alone)
Januari
Februari
Maret
April
Mei
Juni
Juli
Agustus
September
Oktober
November
Desember
=head3 Abbreviated (stand-alone)
Jan
Feb
Mar
Apr
Mei
Jun
Jul
Agu
Sep
Okt
Nov
Des
=head3 Narrow (stand-alone)
1
2
3
4
5
6
7
8
9
10
11
12
=head2 Quarters
=head3 Wide (format)
kuartal pertama
kuartal kedua
kuartal ketiga
kuartal keempat
=head3 Abbreviated (format)
K1
K2
K3
K4
=head3 Narrow (format)
1
2
3
4
=head3 Wide (stand-alone)
kuartal pertama
kuartal kedua
kuartal ketiga
kuartal keempat
=head3 Abbreviated (stand-alone)
K1
K2
K3
K4
=head3 Narrow (stand-alone)
1
2
3
4
=head2 Eras
=head3 Wide
BCE
CE
=head3 Abbreviated
BCE
CE
=head3 Narrow
BCE
CE
=head2 Date Formats
=head3 Full
2008-02-05T18:30:30 = Selasa, 05 Februari 2008
1995-12-22T09:05:02 = Jumat, 22 Desember 1995
-0010-09-15T04:44:23 = Sabtu, 15 September -010
=head3 Long
2008-02-05T18:30:30 = 5 Februari 2008
1995-12-22T09:05:02 = 22 Desember 1995
-0010-09-15T04:44:23 = 15 September -010
=head3 Medium
2008-02-05T18:30:30 = 5 Feb 2008
1995-12-22T09:05:02 = 22 Des 1995
-0010-09-15T04:44:23 = 15 Sep -010
=head3 Short
2008-02-05T18:30:30 = 05/02/08
1995-12-22T09:05:02 = 22/12/95
-0010-09-15T04:44:23 = 15/09/-10
=head3 Default
2008-02-05T18:30:30 = 5 Feb 2008
1995-12-22T09:05:02 = 22 Des 1995
-0010-09-15T04:44:23 = 15 Sep -010
=head2 Time Formats
=head3 Full
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 9:05:02 UTC
-0010-09-15T04:44:23 = 4:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head3 Short
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 09:05
-0010-09-15T04:44:23 = 04:44
=head3 Default
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head2 Datetime Formats
=head3 Full
2008-02-05T18:30:30 = Selasa, 05 Februari 2008 18:30:30 UTC
1995-12-22T09:05:02 = Jumat, 22 Desember 1995 9:05:02 UTC
-0010-09-15T04:44:23 = Sabtu, 15 September -010 4:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 5 Februari 2008 18:30:30 UTC
1995-12-22T09:05:02 = 22 Desember 1995 09:05:02 UTC
-0010-09-15T04:44:23 = 15 September -010 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 5 Feb 2008 18:30:30
1995-12-22T09:05:02 = 22 Des 1995 09:05:02
-0010-09-15T04:44:23 = 15 Sep -010 04:44:23
=head3 Short
2008-02-05T18:30:30 = 05/02/08 18:30
1995-12-22T09:05:02 = 22/12/95 09:05
-0010-09-15T04:44:23 = 15/09/-10 04:44
=head3 Default
2008-02-05T18:30:30 = 5 Feb 2008 18:30:30
1995-12-22T09:05:02 = 22 Des 1995 09:05:02
-0010-09-15T04:44:23 = 15 Sep -010 04:44:23
=head2 Available Formats
=head3 d (d)
2008-02-05T18:30:30 = 5
1995-12-22T09:05:02 = 22
-0010-09-15T04:44:23 = 15
=head3 EEEd (d EEE)
2008-02-05T18:30:30 = 5 Sel
1995-12-22T09:05:02 = 22 Jum
-0010-09-15T04:44:23 = 15 Sab
=head3 Hm (H:mm)
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 9:05
-0010-09-15T04:44:23 = 4:44
=head3 hm (h:mm a)
2008-02-05T18:30:30 = 6:30 PM
1995-12-22T09:05:02 = 9:05 AM
-0010-09-15T04:44:23 = 4:44 AM
=head3 Hms (H:mm:ss)
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 9:05:02
-0010-09-15T04:44:23 = 4:44:23
=head3 hms (h:mm:ss a)
2008-02-05T18:30:30 = 6:30:30 PM
1995-12-22T09:05:02 = 9:05:02 AM
-0010-09-15T04:44:23 = 4:44:23 AM
=head3 M (L)
2008-02-05T18:30:30 = 2
1995-12-22T09:05:02 = 12
-0010-09-15T04:44:23 = 9
=head3 Md (M-d)
2008-02-05T18:30:30 = 2-5
1995-12-22T09:05:02 = 12-22
-0010-09-15T04:44:23 = 9-15
=head3 MEd (E, M-d)
2008-02-05T18:30:30 = Sel, 2-5
1995-12-22T09:05:02 = Jum, 12-22
-0010-09-15T04:44:23 = Sab, 9-15
=head3 MMdd (dd/MM)
2008-02-05T18:30:30 = 05/02
1995-12-22T09:05:02 = 22/12
-0010-09-15T04:44:23 = 15/09
=head3 MMM (LLL)
2008-02-05T18:30:30 = Feb
1995-12-22T09:05:02 = Des
-0010-09-15T04:44:23 = Sep
=head3 MMMd (MMM d)
2008-02-05T18:30:30 = Feb 5
1995-12-22T09:05:02 = Des 22
-0010-09-15T04:44:23 = Sep 15
=head3 MMMEd (E MMM d)
2008-02-05T18:30:30 = Sel Feb 5
1995-12-22T09:05:02 = Jum Des 22
-0010-09-15T04:44:23 = Sab Sep 15
=head3 MMMMd (MMMM d)
2008-02-05T18:30:30 = Februari 5
1995-12-22T09:05:02 = Desember 22
-0010-09-15T04:44:23 = September 15
=head3 MMMMdd (dd MMMM)
2008-02-05T18:30:30 = 05 Februari
1995-12-22T09:05:02 = 22 Desember
-0010-09-15T04:44:23 = 15 September
=head3 MMMMEd (E MMMM d)
2008-02-05T18:30:30 = Sel Februari 5
1995-12-22T09:05:02 = Jum Desember 22
-0010-09-15T04:44:23 = Sab September 15
=head3 mmss (mm:ss)
2008-02-05T18:30:30 = 30:30
1995-12-22T09:05:02 = 05:02
-0010-09-15T04:44:23 = 44:23
=head3 ms (mm:ss)
2008-02-05T18:30:30 = 30:30
1995-12-22T09:05:02 = 05:02
-0010-09-15T04:44:23 = 44:23
=head3 y (y)
2008-02-05T18:30:30 = 2008
1995-12-22T09:05:02 = 1995
-0010-09-15T04:44:23 = -10
=head3 yM (y-M)
2008-02-05T18:30:30 = 2008-2
1995-12-22T09:05:02 = 1995-12
-0010-09-15T04:44:23 = -10-9
=head3 yMEd (EEE, y-M-d)
2008-02-05T18:30:30 = Sel, 2008-2-5
1995-12-22T09:05:02 = Jum, 1995-12-22
-0010-09-15T04:44:23 = Sab, -10-9-15
=head3 yMMM (y MMM)
2008-02-05T18:30:30 = 2008 Feb
1995-12-22T09:05:02 = 1995 Des
-0010-09-15T04:44:23 = -10 Sep
=head3 yMMMEd (EEE, y MMM d)
2008-02-05T18:30:30 = Sel, 2008 Feb 5
1995-12-22T09:05:02 = Jum, 1995 Des 22
-0010-09-15T04:44:23 = Sab, -10 Sep 15
=head3 yMMMM (y MMMM)
2008-02-05T18:30:30 = 2008 Februari
1995-12-22T09:05:02 = 1995 Desember
-0010-09-15T04:44:23 = -10 September
=head3 yQ (y Q)
2008-02-05T18:30:30 = 2008 1
1995-12-22T09:05:02 = 1995 4
-0010-09-15T04:44:23 = -10 3
=head3 yQQQ (y QQQ)
2008-02-05T18:30:30 = 2008 K1
1995-12-22T09:05:02 = 1995 K4
-0010-09-15T04:44:23 = -10 K3
=head3 yyMM (MM/yy)
2008-02-05T18:30:30 = 02/08
1995-12-22T09:05:02 = 12/95
-0010-09-15T04:44:23 = 09/-10
=head3 yyQ (Q yy)
2008-02-05T18:30:30 = 1 08
1995-12-22T09:05:02 = 4 95
-0010-09-15T04:44:23 = 3 -10
=head3 yyyyMMMM (MMMM y)
2008-02-05T18:30:30 = Februari 2008
1995-12-22T09:05:02 = Desember 1995
-0010-09-15T04:44:23 = September -10
=head2 Miscellaneous
=head3 Prefers 24 hour time?
Yes
=head3 Local first day of the week
Senin
=head1 SUPPORT
See L<DateTime::Locale>.
=head1 AUTHOR
Dave Rolsky <autarch@urth.org>
=head1 COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
This module was generated from data provided by the CLDR project, see
the LICENSE.cldr in this distribution for details on the CLDR data's
license.
=cut
| Dokaponteam/ITF_Project | xampp/perl/vendor/lib/DateTime/Locale/id_ID.pm | Perl | mit | 9,609 |
use strict;
use warnings;
use TestLib;
use Test::More tests => 2;
my $tempdir = tempdir;
start_test_server $tempdir;
$ENV{PGOPTIONS} = '--client-min-messages=WARNING';
issues_sql_like(
[ 'reindexdb', '-a' ],
qr/statement: REINDEX.*statement: REINDEX/s,
'reindex all databases');
| amaliujia/CMUDB-peloton | tools/scripts/t/091_reindexdb_all.pl | Perl | apache-2.0 | 285 |
#! /usr/bin/perl
#
# Copyright (c) 2001-2015, PostgreSQL Global Development Group
#
# src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
#
# Generate UTF-8 <--> SJIS code conversion tables from
# map files provided by Unicode organization.
# Unfortunately it is prohibited by the organization
# to distribute the map files. So if you try to use this script,
# you have to obtain SHIFTJIS.TXT from
# the organization's ftp site.
#
# SHIFTJIS.TXT format:
# SHIFTJIS code in hex
# UCS-2 code in hex
# # and Unicode name (not used in this script)
# Warning: SHIFTJIS.TXT contains only JIS0201 and JIS0208. no JIS0212.
require "ucs2utf.pl";
# first generate UTF-8 --> SJIS table
$in_file = "CP932.TXT";
$count = 0;
open(FILE, $in_file) || die("cannot open $in_file");
while (<FILE>)
{
chop;
if (/^#/)
{
next;
}
($c, $u, $rest) = split;
$ucs = hex($u);
$code = hex($c);
if ($code >= 0x80 && $ucs >= 0x0080)
{
$utf = &ucs2utf($ucs);
if ((($code >= 0xed40) && ($code <= 0xeefc))
|| ( ($code >= 0x8754)
&& ($code <= 0x875d))
|| ($code == 0x878a)
|| ($code == 0x8782)
|| ($code == 0x8784)
|| ($code == 0xfa5b)
|| ($code == 0xfa54)
|| ( ($code >= 0x8790)
&& ($code <= 0x8792))
|| ( ($code >= 0x8795)
&& ($code <= 0x8797))
|| ( ($code >= 0x879a)
&& ($code <= 0x879c)))
{
printf STDERR
"Warning: duplicate UTF8 : UCS=0x%04x SJIS=0x%04x\n", $ucs,
$code;
next;
}
$count++;
$array{$utf} = $code;
}
}
close(FILE);
#
# first, generate UTF8 --> SJIS table
#
$file = "utf8_to_sjis.map";
open(FILE, "> $file") || die("cannot open $file");
print FILE "static const pg_utf_to_local ULmapSJIS[ $count ] = {\n";
for $index (sort { $a <=> $b } keys(%array))
{
$code = $array{$index};
$count--;
if ($count == 0)
{
printf FILE " {0x%04x, 0x%04x}\n", $index, $code;
}
else
{
printf FILE " {0x%04x, 0x%04x},\n", $index, $code;
}
}
print FILE "};\n";
close(FILE);
#
# then generate SJIS --> UTF8 table
#
open(FILE, $in_file) || die("cannot open $in_file");
reset 'array';
$count = 0;
while (<FILE>)
{
chop;
if (/^#/)
{
next;
}
($c, $u, $rest) = split;
$ucs = hex($u);
$code = hex($c);
if ($code >= 0x80 && $ucs >= 0x0080)
{
$utf = &ucs2utf($ucs);
$count++;
$array{$code} = $utf;
}
}
close(FILE);
$file = "sjis_to_utf8.map";
open(FILE, "> $file") || die("cannot open $file");
print FILE "static const pg_local_to_utf LUmapSJIS[ $count ] = {\n";
for $index (sort { $a <=> $b } keys(%array))
{
$utf = $array{$index};
$count--;
if ($count == 0)
{
printf FILE " {0x%04x, 0x%04x}\n", $index, $utf;
}
else
{
printf FILE " {0x%04x, 0x%04x},\n", $index, $utf;
}
}
print FILE "};\n";
close(FILE);
| larryxiao/peloton | src/postgres/backend/utils/mb/Unicode/UCS_to_SJIS.pl | Perl | apache-2.0 | 2,714 |
package Haiku;
BEGIN {
use strict;
use vars qw|$VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK|;
require Exporter;
require DynaLoader;
@ISA = qw|Exporter DynaLoader|;
$VERSION = '0.34';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@EXPORT = qw(
);
@EXPORT_OK = qw(
);
}
bootstrap Haiku;
1;
__END__
=head1 NAME
Haiku - Interfaces to some Haiku API Functions
=head1 DESCRIPTION
The Haiku module contains functions to access Haiku APIs.
=head2 Alphabetical Listing of Haiku Functions
=over
=item Haiku::debug_printf(FORMAT,...)
Similar to printf, but prints to system debug output.
=item Haiku::debugger(FORMAT,...)
Drops the program into the debugger. The printf like arguments define the
debugger message.
=item Haiku::ktrace_printf(FORMAT,...)
Similar to printf, but prints to a kernel tracing entry.
=back
=cut
| olapaola/olapaola-android-scripting | perl/src/haiku/Haiku/Haiku.pm | Perl | apache-2.0 | 883 |
#!/usr/bin/perl -w
#
# 25-Nov-09 Display current status and % complete
# 13-Mar-13 Allow script to wait if status is commit pending, and show child engine status
# 28-Jun-13 Change killduplicates options (-k value or -K)
# INDEX_INITIALIZING (-35) is now considered an active state (ie not an error)
# 20-Aug-13 Allow DREREPLACE to be specified - contents in a file which is read and POSTed
# Corrected usage information - If posting always use a suffix of NOOP
# 07-Oct-13 Allow priority to be specified
#
use strict;
use warnings;
use Getopt::Std;
use LWP::UserAgent;
use File::Spec::Functions qw(rel2abs);
my $failed = 0;
BEGIN {
$failed = 0;
};
END {
print "\nFailed: $failed\n" if $failed > 0;
$? = 1 if $failed > 0;
};
use constant DEFAULT_HOST => '127.0.0.1';
use constant DEFAULT_PORTQUERY => 14000;
use constant DEFAULT_PAUSE => 05;
use constant DEFAULT_TIMEOUT => 15;
my $ECHO_RESPONSE = 0;
my $ECHO_URL = 0;
use constant ACTION_ADD => 0;
use constant ACTION_REPLACE => 1;
use constant INDEX_PROCESSING => 0;
use constant INDEX_FINISHED => -1;
use constant INDEX_OUT_OF_DISK => -2;
use constant INDEX_FILE_NOT_FOUND => -3;
use constant INDEX_DATABASE_NOT_FOUND => -4;
use constant INDEX_BAD_PARAMETER => -5;
use constant INDEX_DATABASE_EXISTS => -6;
use constant INDEX_QUEUED => -7;
use constant INDEX_UNAVAILABLE => -8;
use constant INDEX_OUTOFMEMORY => -9;
use constant INDEX_INTERRUPTED => -10;
use constant INDEX_XMLNOTWELLFORMED => -11;
use constant INDEX_RETRYING => -12;
use constant INDEX_BACKUP_IN_PROGRESS => -13;
use constant INDEX_MAX_INDEX_SIZE_EXCEEDED => -14;
use constant INDEX_MAX_NUM_DOCS_EXCEEDED => -15;
use constant INDEX_PAUSED => -16;
use constant INDEX_RESTARTED => -17;
use constant INDEX_CANCELLED => -18;
use constant INDEX_OUT_OF_FILE_DESCRIPTORS => -19;
use constant INDEX_LANGUAGETYPE_NOT_FOUND => -20;
use constant INDEX_SECURITYTYPE_NOT_FOUND => -21;
use constant INDEX_UNSPECIFIED_PROBLEM => -22; # Returned by a DIH to indicate that its children returned irreconcilably different statuses
use constant INDEX_BADLY_FORMATTED_REQUEST => -23;
use constant INDEX_INVALID_INDEX_CODE => -24;
use constant INDEX_TO_BE_QUEUED => -25; # Returned by a DIH to indicate an index command that is to be sent to the DREs
use constant INDEX_NO_DREENDDATA_FOUND => -26; # The DREADDDATA did not contain a #DREENDDATA at the end
use constant INDEX_MAX_RETRIES_EXCEEDED => -27; # The command has failed to be accepted by the child engine more than the configured number of times
use constant INDEX_INVALID_INDEXID => -28; # The engine has no knowledge of the index ID
use constant INDEX_JOB_REDISTRIBUTED => -29; # This command was redistributed to siblings as this engine was either unavailable or not accepting index jobs
use constant INDEX_DATABASE_NAME_TOO_LONG => -30; # The database name is too long
use constant INDEX_IGNORED_IDMATCH => -31; # The command was ignored as its id has already been seen and processed
use constant INDEX_CONFIGURED_LIMIT_EXCEEDED => -32; # A user-configured limit on the index size has been exceeded
use constant INDEX_MAX_DATABASES_EXCEEDED => -33; # Cannot create a new database as we have reached the limit
use constant INDEX_PENDING_COMMIT => -34; # Index job has been finished but has not yet been committed to disk
use constant INDEX_INITIALIZING => -35; # Initial state for the DIH
use constant INDEX_READING_IDX => -36; # State for the DIH as, unlike the DRE, it reads the IDX when creating the index queue structure before processing it
use constant INDEX_GENERIC_FAIL => -37; # Index job failed for some reason other than those listed above (or the reason could not be determined)
use constant INDEX_REMOTE_PROCESSING => -38; # Index job is being processed in a remote engine
sub fail($;$)
{
my ($message, $quiet) = @_;
$quiet = 0 unless defined $quiet;
print "FAIL: $message\n" unless $quiet;
$failed ++;
}
sub getActionName($)
{
my ($action) = @_;
return 'ADD' if $action == ACTION_ADD;
return 'REPLACE' if $action == ACTION_REPLACE;
return "Unknown action $action";
}
sub info($)
{
my ($message) = @_;
print "INFO: $message\n";
}
sub getURL($$)
{
my ($url, $timeout) = @_;
my $result = '';
my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/8.0"); # pretend we are very capable browser
$ua->timeout($timeout);
info("URL: $url") if $ECHO_URL;
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
if ($res->is_success)
{
$result = $res->content;
if ($ECHO_RESPONSE)
{
# Make the XML readable - Insert a line break between '>' and '<'
my $readable = join(">\n<", split(/\>\</, $result));
info("Response\n$readable\n");
}
}
else
{
fail("HTTP Error: " . $res->message);
}
return $result;
}
sub postURL($$$)
{
my ($url, $content, $timeout) = @_;
my $result = '';
my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/8.0"); # pretend we are very capable browser
$ua->timeout($timeout);
info("URL '$url'") if $ECHO_URL;
info("Content:\n\n$content\n") if $ECHO_URL;
my $req = HTTP::Request->new(POST => $url);
$req->content($content);
my $res = $ua->request($req);
if ($res->is_success)
{
$result = $res->content;
if ($ECHO_RESPONSE)
{
# Make the XML readable - Insert a line break between '>' and '<'
my $readable = join(">\n<", split(/\>\</, $result));
info("Response:\n$readable\n");
}
}
else
{
fail("HTTP Error: " . $res->message);
}
return $result;
}
sub getIndexID($)
{
my ($result) = @_;
return $1 if defined($result) && ($result =~ m/INDEXID=(\d+)/);
fail("Index ID was not returned");
if (defined $result)
{
print "---------\n";
print "$result\n" ;
print "---------\n";
}
return -1;
}
sub getIndexAction($$)
{
my ($url, $timeout) = @_;
my $result = getURL($url, $timeout);
return getIndexID($result);
}
sub postIndexAction($$$)
{
my ($url, $content, $timeout) = @_;
my $result = postURL($url, $content, $timeout);
return getIndexID($result);
}
sub isFinished($$)
{
my ($status, $waitPendingCommit) = @_;
return 1 if INDEX_FINISHED == $status;
return 1 if (INDEX_PENDING_COMMIT == $status) && !$waitPendingCommit;
return 0;
}
sub isActive($$)
{
my ($status, $waitPendingCommit) = @_;
return 1 if INDEX_INITIALIZING == $status;
return 1 if INDEX_READING_IDX == $status;
return 1 if INDEX_PROCESSING == $status;
return 1 if INDEX_QUEUED == $status;
return 1 if INDEX_TO_BE_QUEUED == $status;
return 1 if (INDEX_PENDING_COMMIT == $status) && $waitPendingCommit;
return 0;
}
sub waitForIndexAction($$$$$$$)
{
my ($host, $portQuery, $id, $queryChildEngines, $waitPendingCommit, $timeout, $pause) = @_;
my $rc = 0;
return $rc if $id <= 0;
my $url = "http://$host:$portQuery/?Action=indexergetstatus&index=$id";
$url .= "&childdetails=true" if $queryChildEngines;
info("Waiting for index request $id to complete");
print "\n";
while (1)
{
my $result = getURL($url, $timeout);
my $description = '';
my $docIdFrom = 0;
my $docIdTo = 0;
my $duration = 0;
my $percentage = 0;
my $processed = 0;
my $deleted = 0;
last if 0 == length($result);
my $status = $1 if $result =~ m/<status>(-{0,1}\d+)<\/status>/i;
if (not defined $status)
{
fail("Unable to get status for index request $id");
last;
}
$description = $1 if $result =~ m/<description>(.*?)<\/description>/i;
if ($result =~ m/<docidrange>(\d+)-(\d+)<\/docidrange>/i)
{
$docIdFrom = $1;
$docIdTo = $2;
}
$duration = $1 if $result =~ m/<duration_secs>(\d+)<\/duration_secs>/i;
$percentage = $1 if $result =~ m/<percentage_processed>(\d+)<\/percentage_processed>/i;
$processed = $1 if $result =~ m/<documents_processed>(\d+)<\/documents_processed>/i;
$deleted = $1 if $result =~ m/<documents_deleted>(\d+)<\/documents_deleted>/i;
my $info = "ID: $id - $description ($status)";
$info .= " - $duration seconds ($percentage%)" if ($duration > 0) || ($percentage > 0);
if (($processed > 0) || ($deleted > 0))
{
$info .= " processed: $processed" if $processed > 0;
$info .= " deleted: $deleted" if $deleted > 0;
if ($docIdFrom > 0)
{
$info .= " (";
$info .= "$docIdFrom" if $docIdTo == $docIdFrom;
$info .= "$docIdFrom .. $docIdTo" if $docIdTo != $docIdFrom;
$info .= ")";
}
}
info($info);
if ($queryChildEngines)
{
my $first = 1;
while ($result =~ m/<childstatus>(.*?)<\/childstatus>/gi)
{
my $child = $1;
my $engineid;
my $indexid = '';
my $status = '';
my $description = '';
my $percentage = '';
$engineid = $1 if $child =~ m/<engineid>(\d+)<\/engineid>/i;
$indexid = $1 if $child =~ m/<indexid>(\d+)<\/indexid>/i;
$percentage = $1 if $child =~ m/<percentage_processed>(\d+)<\/percentage_processed>/i;
$status = $1 if $child =~ m/<status>(-{0,1}\d+)<\/status>/i;
$description = $1 if $child =~ m/<description>(.*?)<\/description>/i;
my $info = " Engine: $engineid ID: $indexid - $description ($status)";
$info .= " - ($percentage%)" if $percentage > 0;
print "\n" if $first;
info($info);
$first = 0;
}
print "\n" unless $first;
}
if (isFinished($status, $waitPendingCommit))
{
$rc = 1;
last;
}
if (!isActive($status, $waitPendingCommit))
{
fail("Status is $status - $description");
last;
}
sleep($pause);
}
return $rc;
}
sub slurp($)
{
my ($file) = @_;
my $fh;
return undef unless open($fh, "<", $file);
local $/ = undef;
my $content = <$fh>;
close($fh);
return $content;
}
sub addFile($$$$$$$$$$$$$$$$$)
{
my ($host, $portQuery, $portIndex, $action, $post, $dreEndDataSuffix, $database, $file, $priority, $killDuplicates, $queryChildEngines, $wait, $waitPendingCommit, $delete, $timeout, $pause, $checkFileExistence) = @_;
# Get the absolute path of the file, since IDOL needs this
$file = rel2abs($file);
if ($checkFileExistence)
{
unless (-e $file)
{
fail("File '$file' does not exist");
return 0;
}
}
my $id;
if ($action == ACTION_ADD)
{
unless ($post)
{
my $url = "http://$host:$portIndex/DREADD?$file";
$url .= "&Priority=$priority" if defined $priority;
$url .= "&KillDuplicates=$killDuplicates" if defined $killDuplicates;
$url .= "&DELETE" if $delete;
$url .= "&DREDbName=$database" if defined $database;
$id = getIndexAction($url, $timeout);
}
else
{
my $url = "http://$host:$portIndex/DREADDDATA?";
$url .= "&Priority=$priority" if defined $priority;
$url .= "&KillDuplicates=$killDuplicates" if defined $killDuplicates;
$url .= "&DREDbName=$database" if defined $database;
my $content = slurp($file);
unless (defined $content)
{
fail("Unable to read contents of '$file'");
return 0;
}
$content .= "\n#DREENDDATA$dreEndDataSuffix\n\n" if defined $dreEndDataSuffix;
$id = postIndexAction($url, $content, $timeout);
}
}
elsif ($action == ACTION_REPLACE)
{
if ($post)
{
my $url = "http://$host:$portIndex/DREREPLACE?";
$url .= "&Priority=$priority" if defined $priority;
$url .= "&DREDbName=$database" if defined $database;
my $content = slurp($file);
unless (defined $content)
{
fail("Unable to read contents of '$file'");
return 0;
}
$content .= "\n#DREENDDATA$dreEndDataSuffix\n\n" if defined $dreEndDataSuffix;
$id = postIndexAction($url, $content, $timeout);
}
else
{
fail("DREREPLACE must be posted");
return 0;
}
}
else
{
fail("Unknown action '$action'");
return 0;
}
return 0 unless defined $id;
return 0 if -1 == $id;
info("File: $file (ID: $id)");
print "\n";
return 1 unless $wait;
return waitForIndexAction($host, $portQuery, $id, $queryChildEngines, $waitPendingCommit, $timeout, $pause);
}
sub syncDatabase($$$$$$$$)
{
my ($host, $portQuery, $portIndex, $queryChildEngines, $wait, $waitPendingCommit, $timeout, $pause) = @_;
my $url = "http://$host:$portIndex/DRESYNC?";
my $id = getIndexAction($url, $timeout);
return 0 if -1 == $id;
info("Forcing an index sync (ID: $id)");
print "\n";
return waitForIndexAction($host, $portQuery, $id, $queryChildEngines, $waitPendingCommit, $timeout, $pause) if $wait;
return 1;
}
my %Options;
if (!getopts('cd:e:h:i:k:Knop:Pq:rRst:uwy:x', \%Options) || (($#ARGV + 1) <= 0))
{
print "Usage: perl dreadd.pl [-c] [-d database] [-e suffix] [-h host] [-i port] [-k value | -K] [-n] [-o]\n";
print " [-p seconds] [-P] [-q port] [-r] [-R] [-s] [-t seconds] [-u] [-w] [-y priority] [-x] File ...\n";
print "\n";
print " -c - Query child engines\n";
print " -d database - Database to add the file to, if it does not explicitly specify the database\n";
print " -e suffix - #DREENDDATA suffix if posting (Default: NOOP)\n";
print " -h host - DRE host to use (Default: " . DEFAULT_HOST . ")\n";
print " -i port - DRE index port to use (Default: query port + 1 )\n";
print " -k value - Kill duplicates value\n";
print " -K - Do not specify kill duplicates value\n";
print " -n - Do not wait for index request to complete\n";
print " -o - Do not check file existence\n";
print " -p seconds - Pause between indexergetstatus requests (Default: " . DEFAULT_PAUSE . ")\n";
print " -P - POST data (use DREADDDATA if adding)\n";
print " -q port - DRE query port to use (Default: " . DEFAULT_PORTQUERY . ")\n";
print " -r - Echo response\n";
print " -R - Invoke DREEPLACE\n";
print " -s - Perform DRESYNC if at least one file added successfully\n";
print " -t seconds - HTTP timeout (Default: " . DEFAULT_TIMEOUT . ")\n";
print " -u - Echo URL\n";
print " -w - Wait if pending commit\n";
print " -y priority - Priority to be used (0..100)\n";
print " -x - Delete file after processing\n";
print "\n";
print " File - IDX files to add to IDOL via DREADD indexing action\n";
exit;
}
my $action = ACTION_ADD;
my $post = 0;
my $database;
my $host = DEFAULT_HOST;
my $portQuery = DEFAULT_PORTQUERY;
my $portIndex = DEFAULT_PORTQUERY + 1;
my $timeout = DEFAULT_TIMEOUT;
my $pause = DEFAULT_PAUSE;
my $sync = 0;
my $wait = 1;
my $success = 0;
my $delete = 0;
my $waitPendingCommit = 0;
my $queryChildEngines = 0;
my $killDuplicates = 'REFERENCE';
my $dreEndDataSuffix;
my $checkFileExistence = 1;
my $priority;
# Allow environment variables to override static defaults
$action = $ENV{'DREADD_ACTION'} if defined($ENV{'DREADD_ACTION'});
$post = $ENV{'DREADD_POST'} if defined($ENV{'DREADD_POST'});
$queryChildEngines = $ENV{'DREADD_QUERY_CHILD_ENGINES'} if defined($ENV{'DREADD_QUERY_CHILD_ENGINES'});
$database = $ENV{'DREADD_DATABASE'} if defined($ENV{'DREADD_DATABASE'});
$host = $ENV{'DREADD_HOST'} if defined($ENV{'DREADD_HOST'});
$portQuery = $ENV{'DREADD_PORT_QUERY'} if defined($ENV{'DREADD_PORT_QUERY'});
$portIndex = $portQuery + 1;
$portIndex = $ENV{'DREADD_PORT_INDEX'} if defined($ENV{'DREADD_PORT_INDEX'});
$pause = $ENV{'DREADD_PAUSE'} if defined($ENV{'DREADD_PAUSE'});
$timeout = $ENV{'DREADD_TIMEOUT'} if defined($ENV{'DREADD_TIMEOUT'});
$sync = $ENV{'DREADD_SYNC'} if defined($ENV{'DREADD_SYNC'});
$wait = $ENV{'DREADD_WAIT'} if defined($ENV{'DREADD_WAIT'});
$checkFileExistence = $ENV{'DREADD_CHECK_FILE_EXISTENCE'} if defined($ENV{'DREADD_CHECK_FILE_EXISTENCE'});
$waitPendingCommit = $ENV{'DREADD_WAIT_PENDING_COMMIT'} if defined($ENV{'DREADD_WAIT_PENDING_COMMIT'});
$delete = $ENV{'DREADD_DELETE'} if defined($ENV{'DREADD_DELETE'});
$ECHO_URL = $ENV{'DREADD_ECHO_URL'} if defined($ENV{'DREADD_ECHO_URL'});
$ECHO_RESPONSE = $ENV{'DREADD_ECHO_RESPONSE'} if defined($ENV{'DREADD_ECHO_RESPONSE'});
$killDuplicates = $ENV{'DREADD_KILLDUPLICATES'} if defined($ENV{'DREADD_KILLDUPLICATES'});
$dreEndDataSuffix = $ENV{'DREADD_DREENDDATA_SUFFIX'} if defined($ENV{'DREADD_DREENDDATA_SUFFIX'});
# Allow command line to override defaults
$queryChildEngines = 1 if defined($Options{'c'});
$database = $Options{'d'} if defined($Options{'d'});
$dreEndDataSuffix = $Options{'e'} if defined($Options{'e'});
$host = $Options{'h'} if defined($Options{'h'});
$portQuery = $Options{'q'} if defined($Options{'q'}); # NOTE: Set before index port
$portIndex = $portQuery + 1;
$portIndex = $Options{'i'} if defined($Options{'i'});
$killDuplicates = $Options{'k'} if defined($Options{'k'});
undef $killDuplicates if defined($Options{'K'});
$wait = 0 if defined($Options{'n'});
$checkFileExistence = 0 if defined($Options{'o'});
$pause = $Options{'p'} if defined($Options{'p'});
$post = 1 if defined($Options{'P'});
$ECHO_RESPONSE = $Options{'r'} if defined($Options{'r'});
$action = ACTION_REPLACE if defined($Options{'R'});
$sync = $Options{'s'} if defined($Options{'s'});
$timeout = $Options{'t'} if defined($Options{'t'});
$ECHO_URL = $Options{'u'} if defined($Options{'u'});
$waitPendingCommit = 1 if defined($Options{'w'});
$priority = $Options{'y'} if defined($Options{'y'});
$delete = $Options{'x'} if defined($Options{'x'});
$waitPendingCommit = 0 if $sync;
$post = 1 if $action == ACTION_REPLACE;
$dreEndDataSuffix = 'NOOP' if !defined($dreEndDataSuffix) && $post;
print "\n";
print "DRE Indexing Utility\n";
print "\n";
print "Host: $host\n" if defined($host);
print "Port Query: $portQuery\n" if defined($portQuery);
print "Port Index: $portIndex\n" if defined($portIndex);
print "Database: $database\n" if defined($database);
print "Action: " . getActionName($action) . "\n" if defined($action);
print "POST: $post\n" if defined($post);
print "#DREENDDATA Suffix: $dreEndDataSuffix\n" if defined($dreEndDataSuffix);
print "Check File Existence: $checkFileExistence\n" if defined $checkFileExistence;
print "Priority: $priority\n" if defined $priority;
print "Kill Duplicates: $killDuplicates\n" if defined $killDuplicates;
print "Timeout: $timeout\n" if defined($timeout);
print "Pause: $pause\n" if defined($pause);
print "Sync: $sync\n" if defined($sync);
print "Query Child Engines: $queryChildEngines\n" if defined($queryChildEngines);
print "Wait: $wait\n" if defined($wait);
print "Wait Pending Commit: $waitPendingCommit\n" if defined($waitPendingCommit);
print "Delete: $delete\n" if defined($delete);
print "\n";
foreach my $file (@ARGV)
{
$success = 1 if addFile($host, $portQuery, $portIndex, $action, $post, $dreEndDataSuffix, $database, $file, $priority, $killDuplicates, $queryChildEngines, $wait, $waitPendingCommit, $delete, $timeout, $pause, $checkFileExistence);
}
if ($sync && $success)
{
# Force a sync of the database
syncDatabase($host, $portQuery, $portIndex, $queryChildEngines, $wait, $waitPendingCommit, $timeout, $pause);
}
| MartynDavis/utilities | Scripts/dreadd.pl | Perl | mit | 20,239 |
#!/usr/local/bin/perl
##############################################################################
# Script takes list of chr/positions, annotates with rate and k-mer according
# to specified file
#
# Currently used to annotate rocdat with 7-mer rates, which is
# passed to the validation.r script
##############################################################################
use strict;
use warnings;
use POSIX;
use Getopt::Long;
use Pod::Usage;
use File::Basename;
use File::Path qw(make_path);
use List::Util qw(first max maxstr min minstr reduce shuffle sum);
use Benchmark;
use Math::Round;
use FindBin;
use YAML::XS 'LoadFile';
use feature 'say';
my $relpath = $FindBin::Bin;
my $configpath = dirname(dirname($relpath));
my $config = LoadFile("$configpath/_config.yaml");
print "Script will run with the following parameters:\n";
for (sort keys %{$config}) {
say "$_: $config->{$_}";
}
my $adj = $config->{adj};
my $mac = $config->{mac};
my $binw = $config->{binw};
my $data = $config->{data};
my $bin_scheme = $config->{bin_scheme};
my $parentdir = $config->{parentdir};
my $count_motifs = $config->{count_motifs};
my $expand_summ = $config->{expand_summ};
my $help=0;
my $man=0;
# my $chr;
my $adj=1;
# my $f_rates;
my $f_fasta = "$parentdir/reference_data/human_g1k_v37.fasta";
my $f_positions;
my $f_rates;
my $seqflag;
my $outfile;
GetOptions (
# 'chr=i'=> \$chr,
'adj=i' => \$adj,
# 'f_rates=s' => \$f_rates,
'ref=s' => \$f_fasta,
'in=s' => \$f_positions,
'out=s' => \$outfile,
'seq' => \$seqflag,
'rates=s' => \$f_rates,
'help|?'=> \$help,
'ref=s' => \$f_fasta,
man => \$man) or pod2usage(1);
my $subseq = $adj*2+1;
pod2usage(0) if $help;
pod2usage(-verbose => 2) if $man;
my %cathash = (
AT_CG => 0,
AT_GC => 1,
AT_TA => 2,
GC_AT => 3,
GC_CG => 4,
GC_TA => 5,
);
# Initialize and hash rate table
# my $f_rates = "$parentdir/ERV_${subseq}bp_rates.txt";
open my $rates, '<', $f_rates or die "can't open $f_rates: $!";
readline($rates); #<-throws out header
# print "Hashing rate table...\n";
my %hash=();
while (<$rates>){
chomp;
my @line=split(/\t/, $_);
my $key=$line[0];
# my $vals=join("\t", nearest(0.0001, @line[1 .. $#line]));
# my $vals=sum(@line[1 .. $#line]);
$hash{$key}=[@line[1 .. $#line]];
}
# my $f_positions="/net/bipolar/jedidiah/mutation/output/predicted/chr${chr}_full_mask.txt";
# my $f_positions="$parentdir/output/predicted/full/rocdat_comb_sort.txt";
# my $f_positions="$parentdir/output/predicted/full/rocdat_comb_7bp.txt";
# my $f_positions="$parentdir/output/rocdat.txt";
# my $f_positions="/net/bipolar/jedidiah/mutation/reference_data/uk10k_dnms_s.txt";
open my $positions, '<', $f_positions or die "can't open $f_positions: $!";
# Initialize output file
# my $outfile ="$parentdir/output/predicted/full/rocdat_comb2_${subseq}bp.txt";
# my $outfile ="$parentdir/output/rocdat.${subseq}bp.txt";
# my $outfile ="$parentdir/reference_data/uk10kdnms_3mer.txt";
open(OUT, '>', $outfile) or die "can't write to $outfile: $!\n";
# print OUT "CHR\tPOS\tAT_CG\tAT_GC\tAT_TA\tGC_AT\tGC_CG\tGC_TA\n";
# Get reference sequence
# my $seq=&getRef();
# my $altseq=$seq;
# $altseq =~ tr/ACGT/TGCA/;
# print "Indexing sites in chr${chr}...\n";
my @sites;
my $prevchr=0;
my $seq;
my $altseq;
readline($positions);
while(<$positions>){
chomp;
my $linestr=$_;
my @line=split(/\t/, $_);
my $sitechr=$line[0];
my $pos=$line[1];
my $categ=$line[5];
my $catind=$cathash{$categ};
if($sitechr!=$prevchr){
$seq=&getRef($sitechr);
$altseq=$seq;
$altseq =~ tr/ACGT/TGCA/;
}
my $base=substr($seq, $pos, 1);
my $localseq = substr($seq, $pos-$adj-1, $subseq);
# print "$localseq\n";
if($localseq!~/[MNSW]/){
my $altlocalseq = reverse substr($altseq, $pos-$adj-1, $subseq);
my $sequence;
if(substr($localseq,$adj,1) lt substr($altlocalseq,$adj,1)){
$sequence = $localseq . '(' . $altlocalseq . ')';
} else {
$sequence = $altlocalseq . '(' . $localseq . ')';
}
# print OUT "$chr\t$i\t$hash{$sequence}\n";
if($seqflag){
print OUT "$linestr\t$sequence\t$hash{$sequence}[$catind]\t\n";
} else {
print OUT "$linestr\t$hash{$sequence}[$catind]\t\n";
}
}
$prevchr=$sitechr;
}
##############################################################################
# Subroutine for getting mutation type from REF/ALT fields
##############################################################################
##############################################################################
# Subroutine for getting reference sequence
##############################################################################
sub getRef{
my $chr=shift;
my $nextchr;
if ($chr<22) {
$nextchr=$chr+1;
} elsif ($chr==22) {
$nextchr="X";
}
if (-e $f_fasta) {
print "Using reference genome: $f_fasta\n";
} else {
print "Reference genome not found in directory. Would you like to download one? (y/n): ";
my $choice = <>;
chomp $choice;
if ($choice eq "y") {
my $dlcmd="wget -P $parentdir/ ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/technical/reference/human_g1k_v37.fasta.gz";
&forkExecWait($dlcmd);
my $unzipcmd="gunzip $parentdir/human_g1k_v37.fasta";
&forkExecWait($unzipcmd);
} else {
die "Please upload an appropriate reference genome to $parentdir/reference_data/ \n";
}
}
open my $fasta, '<', $f_fasta or die "can't open $f_fasta: $!";
print "Getting reference sequence for chromosome $chr...\n";
my $seq;
while (<$fasta>) {
chomp;
if (/>$chr /../>$nextchr /) {
next if />$chr / || />$nextchr /;
$seq .=$_;
}
}
return $seq;
}
##############################################################################
# fork-exec-wait subroutine
##############################################################################
sub forkExecWait {
my $cmd = shift;
#print "forkExecWait(): $cmd\n";
my $kidpid;
if ( !defined($kidpid = fork()) ) {
die "Cannot fork: $!";
}
elsif ( $kidpid == 0 ) {
exec($cmd);
die "Cannot exec $cmd: $!";
}
else {
waitpid($kidpid,0);
}
}
__END__
=head1 NAME
anno_rate.pl - Whole-genome annotation utility for 5bp motif relative mutation rates
=head1 SYNOPSIS
anno_rate.pl [OPTIONS]
Options:
--help program documentation
--f-rates /path/to/5bp_rates.txt
--ref /path/to/human_g1k_v37.fasta
=head1 OPTIONS
=over 8
=item B<--help>
Display this documentation
=item B<--f-rates>
Path to rate table. Default is same directory as this script.
=item B<--ref>
Path to reference genome. Default is same directory as this script. Tested with ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/technical/reference/human_g1k_v37.fasta.gz
=back
=head1 DESCRIPTION
B<anno_rate.pl> Whole-genome annotation utility for 5bp motif relative mutation rates.
=head1 AUTHOR
=over
Jedidiah Carlson E<10> Department of Bioinformatics E<10> University of Michigan
=cut
| carjed/smaug-genetics | sandbox/process_dnms_deprecated/anno_rate.pl | Perl | mit | 7,163 |
=head1 NAME
CXGN::Transcript::DrawContigAlign - draws alignment graphs of unigenes.
=head1 SYNOPSIS
This should be instantiated (without arguments), have alignment data fed to it, and instructed where to put the image and imagemap.
$imageProgam = CXGN::Transcript::DrawContigAlign->new();
$imageProgram->addAlignment('SGN-E1199194', 'SGN-U508096', '+', 0, 477, 0, 0, 1);
$imageProgram->addAlignment('SGN-E1189844', 'SGN-U508096', '+', 75, 760, 30, 0, 0);
#add more alignments
$imageProgram->writeImageToFile('Image.png', 'Mapfile', 'http://some.domain.name/some/url/thingie/', 'Image name');
=head1 DESCRIPTION
DrawContigAlign receives information about sequences stored in a unigene and produces a graph of the aligned sequences.
=head1 AUTHORS
Rafael Lizarralde <xarbiogeek@gmail.com> (July 2009)
Paraphrased from a C script (draw_contigalign.c) of unknown origin.
=head1 MEMBER FUNCTIONS
This class implements the following functions:
=head2 constructor C<new>
=over 10
=item Usage:
$imageProgram = CXGN::Transcript::DrawContigAlign->new();
=item Ret:
a CXGN::Transcript::DrawContigAlign object
=item Args:
none
=back
=cut
package CXGN::Transcript::DrawContigAlign;
use Moose;
use MooseX::Method::Signatures;
use GD;
use CXGN::Transcript::DrawContigAlign::Pane;
use CXGN::Transcript::DrawContigAlign::ContigAlign;
use CXGN::Transcript::DrawContigAlign::DepthData;
use constant Pane => 'CXGN::Transcript::DrawContigAlign::Pane';
use constant ContigAlign => 'CXGN::Transcript::DrawContigAlign::ContigAlign';
use constant DepthData => 'CXGN::Transcript::DrawContigAlign::DepthData';
#The list of sequences to be aligned
has contigAligns => (is => 'rw', isa => 'ArrayRef', default => sub { my @array = (); return \@array; });
=head2 mutator C<addAlignment>
=over 10
=item Usage:
$imageProgram->addAlignment('SGN-E1189844', 'SGN-U508096', '+', 75, 760, 30, 0, 0);
=item Desc:
adds alignment data to the list of data that will be incorporated in the graph
=item Ret:
nothing
=item Args:
=over 18
=item Str $sourceID
the source ID tag of the segment in a Unigene
=item Str $sequenceID
the sequence ID tag of the Unigene
=item Str $strand
an identifier determining whether it is complementary or not (if not, it should be '+')
=item Int $startLoc
the starting base pair of the segment
=item Int $endLoc
the ending base pair of the segment
=item Int $startTrim
the number of base pairs that have been trimmed (do not match) at the start
=item Int $endTrim
the number of base pairs that have been trimmed (do not match) at the end
=item Bool $highlight
whether or not the segment should be highlighted
=back
=back
=cut
#Adds a sequence to the list of contiguous alignments
method addAlignment (Str $sourceID!, Str $sequenceID!, Str $strand!,
Int $startLoc!, Int $endLoc!, Int $startTrim!, Int $endTrim!, Bool $highlight?) {
my @contigs = @{ $self->contigAligns };
my $contig = ContigAlign->new($sourceID, $sequenceID, $strand,
$startLoc, $endLoc, $startTrim, $endTrim, $highlight);
push @contigs, $contig;
$self->contigAligns( [ @contigs ] );
}
=head2 accessor C<writeImageToFile>
=over 10
=item Usage:
$imageProgram->writeImageToFile('Image.png', 'Mapfile', 'http://some.domain.name/some/url/thingie/', 'Image name');
=item Desc:
produces an image file and map file with the alignment information
=item Ret:
nothing
=item Args:
=over 20
=item Str $imageFilename
the path of the image file
=item Str $mapFilename
the path of the map file
=item Str $linkBasename
the url stub for the EST pages
=item Str $imageName
the name for the image
=back
=back
=cut
#Constants
my ($HISTOGRAM, $ALIGN, $INFO, $LEGEND) = (0..3);
my ($BORDERWIDTH, $PAD, $HISTOGRAMWIDTH) = (5, 10, 350);
my $XTICS = 10;
my ($BLACK, $BLUE, $RED, $YELLOW, $LIGHTGRAY, $DARKGRAY, $FRONTSHADE, $BACKSHADE);
#Creates the image based on the currently-possessed data and stores it in an image and map file
method writeImageToFile (Str $imageFilename!, Str $mapFilename!, Str $linkBasename!, Str $imageName) {
$self->contigAligns( [ sort { $a->compare($b) } @{ $self->contigAligns } ] );
$imageName = '(Unspecified)' if(!defined($imageName));
my @depths = @{ $self->computeDepths() };
my $yMax = $self->computeYMax(\@depths);
my $yScale = $self->computeYScale($yMax);
my $xMax = $self->computeXMax(\@depths);
my $xScale = $self->computeXScale($xMax);
my $font = &gdSmallFont;
my $textHeight = $font->height;
#makes the font height odd so the center is an integer, to match up with lines
$textHeight++ if($textHeight%2 == 0);
my @panes = $self->computePanes($font, $textHeight, $yMax);
#space needed for the histogram, plus labels (3), plus each segment, plus the border, plus padding for each pane
my $imageHeight = $panes[$ALIGN]->south + $PAD + $BORDERWIDTH;
#the rightmost edge of a right pane, plus the padding and the border
my $imageWidth = $panes[$INFO]->east + $PAD + $BORDERWIDTH;
#the width and height, and a true value to use a 24-bit color scheme (RGB 0-255)
my $image = GD::Image->new($imageWidth + 1,$imageHeight + 1);
$self->setColors($image);
$self->drawBorder($image, $imageWidth, $imageHeight);
$self->drawGrayBars($image, \@panes, $textHeight);
$self->drawHighlight($image, \@panes, $textHeight);
$self->drawHistogram(\@depths, $image, $panes[$HISTOGRAM], $font, $textHeight, $xMax, $xScale, $yMax, $yScale);
$self->drawAlignments($image, $panes[$ALIGN], $font, $textHeight, $xMax, $xScale);
$self->drawInfo($image, $panes[$INFO], $font, $textHeight, $mapFilename, $imageName, $linkBasename);
$self->drawLegend($image, $panes[$LEGEND], $font, $imageName, $depths[$#depths]->position);
#prints the image
open my $IMAGEFILE, ">" , $imageFilename or die "Could not create image file: $!";
print $IMAGEFILE $image->png;
close $IMAGEFILE;
}
#Calculates the total depth in each region of the sequence
method computeDepths {
my @contigAligns = @{ $self->contigAligns };
my %depthHash;
#adds all the positions using a hash to eliminate duplicates
for my $est (@contigAligns) {
$depthHash{$est->start} = CXGN::Transcript::DrawContigAlign::DepthData->new($est->start);
$depthHash{$est->end } = CXGN::Transcript::DrawContigAlign::DepthData->new($est->end );
}
my @depths = sort { $a->compare($b) } values %depthHash;
#increments the depths of each position for each sequence that covers it
for my $est (@contigAligns) {
for my $depth (@depths) {
$depth->increment if($depth->position >= $est->start and $depth->position < $est->end);
}
}
return \@depths;
}
#This probably needs to be rewritten to be more intelligent--60 is way bigger than most unigenes
method computeYMax (ArrayRef $depthList!) {
my @depths = @{ $depthList };
my $maxDepth = 0;
for my $depth (@depths) { $maxDepth = $depth->depth if($depth->depth > $maxDepth); }
return 60 if($maxDepth < 60);
return $self->roundTo($maxDepth, 30);
}
#This probably needs to be rewritten to be more intelligent--60 is way bigger than most unigenes
method computeYScale (Int $maxDepth!) {
return (($maxDepth <= 60) ? 15 : 20);
}
#Calculates the total length of the aligned sequence, rounded up to the next 100
method computeXMax (ArrayRef $depthList!) {
my @depths = @{ $depthList };
my $xMax = $depths[$#depths]->position;
return $self->roundTo($xMax, 100);
}
#Calculates the distance between tics on the x-axis
method computeXScale (Int $xMax!) {
return $xMax / $XTICS;
}
#Computes the dimensions of the panes, which are arranged like this:
# --------------------------------
# | | |
# | Histogram | Legend |
# | | |
# |--------------------------------|
# | | |
# | Sequence | Sequence |
# | Alignment | Info |
# | | |
# --------------------------------
method computePanes (Ref $font!, Int $textHeight!, Int $histogramHeight!) {
my $sequences = @{ $self->contigAligns };
#the 4*width accounts for the depth tic labels
my $histogram = Pane->new($BORDERWIDTH+$PAD,
$BORDERWIDTH+(2 * $PAD)+$histogramHeight+(3 * $textHeight),
$BORDERWIDTH+$PAD, $BORDERWIDTH+$PAD+$HISTOGRAMWIDTH+(4 * $font->width)+$textHeight);
my $alignment = Pane->new($histogram->south + $PAD,
$histogram->south + $PAD + ($sequences * $textHeight),
$histogram->west, $histogram->east);
my $info = Pane->new($alignment->north, $alignment->south,
$alignment->east, $alignment->east + (48 * $font->width));
my $legend = Pane->new($histogram->north, $histogram->south,
$info->west, $info->east);
return ($histogram, $alignment, $info, $legend);
}
#Initializes the colors that are used in the graph
method setColors (Ref $image!) {
#sets the background to white
my $bg = 255;
$image->colorAllocate($bg, $bg, $bg);
$BLACK = $image->colorResolve(0, 0, 0);
$BLUE = $image->colorResolve(0, 0, 255);
$RED = $image->colorResolve(255, 0, 0);
$YELLOW = $image->colorResolve(255, 255, 100);
$LIGHTGRAY = $image->colorResolve(200, 200, 200);
$FRONTSHADE = $image->colorResolve($bg - 50, $bg - 50, $bg - 50);
$BACKSHADE = $image->colorResolve($bg - 100, $bg - 100, $bg - 100);
}
#Draws the bevel border
method drawBorder (Ref $image!, Int $width!, Int $height!) {
for my $i (0..($BORDERWIDTH-1)) {
#draws a lighter border on the north and west sides
$image->line($i, $i, $width - ($i + 1), $i, $FRONTSHADE);
$image->line($i, $i, $i, $height - ($i + 1), $FRONTSHADE);
#draws a darker border on the south and east sides
$image->line($i, $height - $i, $width - $i, $height - $i, $BACKSHADE);
$image->line($width - $i, $i, $width - $i, $height - $i, $BACKSHADE);
}
}
#Draws the gray bars in the alignment pane as a visual aid
method drawGrayBars (Ref $image!, ArrayRef $paneList!, Int $textHeight!) {
my @panes = @{ $paneList };
my $sequences = @{ $self->contigAligns };
if($sequences > 6) {
for(my $i = 0; $i < $sequences; $i += 6) {
my $width = ( ($i < $sequences - 3) ? 3 : ($sequences - $i) );
$image->filledRectangle($panes[$ALIGN]->west, $panes[$ALIGN]->north + ($i * $textHeight),
$panes[$INFO]->east, $panes[$ALIGN]->north + (($i + $width) * $textHeight),
$LIGHTGRAY);
}
}
}
#Draws the highlight
method drawHighlight (Ref $image!, ArrayRef $paneList!, Int $textHeight!) {
my @panes = @{ $paneList };
my @contigAligns = @{ $self->contigAligns };
for my $i (0..(@contigAligns - 1)) {
if($contigAligns[$i]->highlight) {
$image->filledRectangle($panes[$ALIGN]->west, $panes[$ALIGN]->north + ($i * $textHeight),
$panes[$INFO]->east, $panes[$ALIGN]->north + (($i+1) * $textHeight), $YELLOW);
}
}
}
#Draws everything in the histogram pane of the image
method drawHistogram (ArrayRef $depthList!, Ref $image!, Object $pane!, Ref $font!,
Int $textHeight!, Int $xMax!, Int $xScale!, Int $yMax!, Int $yScale!) {
my @depths = @{ $depthList };
#defines the place where the histogram is drawn, instead of the axis labels and such
my $grid = Pane->new($pane->north + (3 * $textHeight), $pane->south - $PAD,
$self->round($pane->west + ($font->height * 1.5) + ($font->width * 4)), $pane->east - $PAD);
$self->prepareGraph($image, $font, $grid, $xMax, $xScale, $yMax, $yScale);
my $unitsPerPixel = $xMax/($grid->east - $grid->west);
my $darkGray = $image->colorResolve(128, 128, 128);
for my $i (0..(@depths - 2)) {
my $left = $grid->west + $self->round($depths[$i]->position/$unitsPerPixel);
$left++ if $left == $grid->west;
my $right = $grid->west + $self->round($depths[$i+1]->position/$unitsPerPixel);
my $top = $grid->north + 1;
my $bottom = $grid->north + $depths[$i]->depth + 1;
$image->filledRectangle($left, $top, $right, $bottom, $darkGray);
}
}
#Prepares the grid and axes for the histogram
method prepareGraph (Ref $image!, Ref $font!, Object $pane!,
Int $xMax!, Int $xScale!, Int $yMax!, Int $yScale!) {
my ($x, $y, $label);
#draws the surrounding rectangle
$image->rectangle($pane->west, $pane->north, $pane->east, $pane->south, $BLACK);
#draws the gridlines and tic marks
my $unitsPerPixel = $xMax / ($pane->east - $pane->west);
for my $i (0..$XTICS) {
#draws vertical gridlines
$x = $pane->west + $self->round(($i * $xScale)/$unitsPerPixel);
if($i > 0 and $i < $XTICS) {
for($y = $pane->north; $y < $pane->south; $y += 3) {
$image->setPixel($x, $y, $BLACK);
}
}
#draws horizontal tic marks
$image->line($x, $pane->north, $x, $pane->north - 3, $BLACK);
$image->line($x, $pane->south, $x, $pane->south + 1, $BLACK);
#draws the corresponding x-axis label
$label = $i * $xScale;
$x -= (length($label) * $font->width) / 2;
$y = $pane->north - 4 - $font->height;
$image->string($font, $x, $y, $label, $BLACK);
}
#draws the x-axis description
$label = 'position (bp)';
$x = $pane->west + ($pane->east - $pane->west)/2 - (length($label) * $font->width)/2;
$y = $pane->north - 5 - (2 * $font->height);
$image->string($font, $x, $y, $label, $BLACK);
for(my $i = 0; $i <= $yMax; $i += $yScale) {
#draws horizontal gridlines
$y = $i + $pane->north;
if($i > 0 and $i < $yMax) {
for($x = $pane->west; $x < $pane->east; $x += 3) {
$image->setPixel($x, $y, $BLACK);
}
}
#draws vertical tic marks
$image->line($pane->west, $y, $pane->west - 3, $y, $BLACK);
$image->line($pane->east, $y, $pane->east + 3, $y, $BLACK);
#draws the corresponding y-axis label
$label = $i;
$x = $pane->west - (length($label) * $font->width) - 4;
$y -= $font->height / 2;
$image->string($font, $x, $y, $label, $BLACK);
}
#draws the y-axis description
$label = "Depth";
$x = $pane->west - (4 * $font->width) - $font->height - 1;
$y -= $font->height / 2;
$image->stringUp($font, $x, $y, $label, $BLACK);
}
#Draws the alignment of the sequences
method drawAlignments (Ref $image!, Object $pane!, Ref $font!,
Int $textHeight!, Int $xMax!, Int $xScale!) {
my @contigAligns = @{ $self->contigAligns };
#computes the left and right bounds of the histogram above
my $west = $pane->west + (1.5 * $font->height) + (4 * $font->width);
my $east = $pane->east - $PAD;
my $unitsPerPixel = $xMax / ($east - $west);
my ($x, $y);
#draws the dotted lines corresponding to histogram depth changes
for my $i (0..$XTICS) {
$x = $west + $self->round(($i * $xScale) / $unitsPerPixel);
for($y = $pane->north; $y < $pane->south; $y += 3) {
$image->setPixel($x, $y, $BLACK);
}
}
#draws the lines for each sequence
for my $i (0..(@contigAligns - 1)) {
$y = $pane->north + $self->round($textHeight * ($i + .5));
my $contigAlign = $contigAligns[$i];
#the beginning and end of the matching sequence, excluding trim
my $startCover = $west + $self->round($contigAlign->start / $unitsPerPixel);
my $endCover = $west + $self->round($contigAlign->end / $unitsPerPixel);
my ($start, $end);
#draws a black line if it's the same strand, or a blue one if it's the complementary strand
$image->line($startCover, $y, $endCover, $y, (($contigAlign->strand eq '+') ? $BLACK : $BLUE));
#draws a leading red segment if the sequence was trimmed
if($contigAlign->startTrim > 0) {
if($contigAlign->startLoc < 0) {#This should never happen
$self->drawDottedLine($image, $west - 18, $y, $RED);
my $label = $contigAlign->startLoc . "bp";
$x = $west - ((length($label) + 1) * &gdTinyFont->width);
$image->string(&gdTinyFont, $x, $y - &gdTinyFont->height, $label, $RED);
$start = $west;
} else {#This should always happen
$start = $west + $self->round($contigAlign->startLoc / $unitsPerPixel);
}
$image->line($start, $y, $startCover - 1, $y, $RED);
}
if($contigAlign->endTrim > 0) {
if($contigAlign->endLoc > $xMax) {#This should never happen
$self->drawDottedLine($image, $east, $y, $RED);
my $label = ($contigAlign->endLoc - $xMax) . "bp";
$x = $east + &gdTinyFont->width;
$image->string(&gdTinyFont, $x, $y - &gdTinyFont->height, $label, $RED);
$end = $east;
} else {#This should always happen
$end = $west + $self->round($contigAlign->endLoc / $unitsPerPixel);
}
$image->line($endCover + 1, $y, $end, $y, $RED);
}
}
}
#This should never be called
method drawDottedLine(Ref $image!, Int $x!, Int $y!, Int $color!) {
for(my $i = 0; $i < 18; $i += 6) {
$image->line($x + $i, $y, $x + $i + 2, $y, $color);
}
}
#Draws the info for each of the aligned sequences
method drawInfo (Ref $image!, Object $pane!, Ref $font!,
Int $textHeight!, Str $mapFilename!, Str $imageName!, Str $linkBasename!) {
my @contigAligns = @{ $self->contigAligns };
my $west = $pane->west + (2 * $font->width);
open my $MAPFILE, ">" , $mapFilename or die "$! writing map file $mapFilename";
print $MAPFILE "<map name=\"contigmap_$imageName\">";
#draws the info for each strand in the alignment
for my $i (0..(@contigAligns - 1)) {
my $y = $pane->north + ($i * $textHeight);
my $contigAlign = $contigAligns[$i];
my $total = $contigAlign->endLoc - $contigAlign->startLoc;
my $used = $total - ($contigAlign->startTrim + $contigAlign->endTrim);
#sets the source ID to a 30-character string
my $sourceID = $contigAlign->sourceID;
$sourceID = substr($sourceID, 0, 26) . '... ' if(length($sourceID) > 29);
$sourceID = sprintf("%-30.30s", $sourceID);
#round down to avoid displaying 100% where there it's not a complete match
my $percent = $self->round((($used * 100) / $total ) - .5);
#set the base pair count to a 6-digit string (to even out 3-digit and 4-digit numbers)
my $bpCount = sprintf('%-6.6s', $total . 'bp');
my $label = "$sourceID $bpCount ($percent%)";
$image->string($font, $west, $y, $label, (($contigAlign->strand eq '+') ? $BLACK : $BLUE));
#die $label . "\n" . $contigAlign->sequenceID . "\n" . $linkBasename;
printf $MAPFILE "<area coords=\"%d,%d,%d,%d\" href=\"%s%s\">\n",
($west, $y, $west + (length($label) * $font->width), $y + $font->height,
$linkBasename, $contigAlign->sequenceID);
}
print $MAPFILE "</map>\n";
close $MAPFILE;
}
#Draws the legend for the graph
method drawLegend (Ref $image!, Object $pane!,
Ref $font!, Str $imageName!, Int $length!) {
my $north = $pane->north + $PAD;
my $west = $pane->west + (5 * $PAD);
my $line = $font->height;
my $label;
$label = "Alignment Image: $imageName";
$image->string($font, $west, $north, $label, $BLACK);
my @labels = ("Alignment Image: $imageName", "Given Strand",
"Reverse Complement Strand", "Trimmed (non-matching) Sequence");
my @colors = ($BLACK, $BLACK, $BLUE, $RED);
for my $i (0..($#labels)) {
$image->string($font, $west + 20, $north + (($i + 1.5) * $line), $labels[$i], $colors[$i]);
$image->line($west, $north + (($i + 2) * $line), $west + 15, $north + (($i + 2) * $line), $colors[$i]);
}
$label = "Highlighted Strand";
$image->filledRectangle($west, $north + ((@labels + 1.5) * $line),
$pane->east, $north + ((@labels + 2.5) * $line),
$YELLOW);
$image->string($font, $west + 20, $north + ((@labels + 1.5) * $line), $label, $BLACK);
$label = "Total Length: $length base pairs";
$image->string($font, $west + 20, $north + (7 * $line), $label, $BLACK);
}
#returns the number rounded to the nearest integer
method round (Num $num!) {
$num += .5;
$num =~ s/(\d*)\.\d*/$1/;
return $num;
}
#returns the number rounded up to the next multiple of block
method roundTo (Int $num!, Int $block!) { return $num + $block - ($num % $block); }
###########
no Moose; # Here #
__PACKAGE__->meta->make_immutable; # be #
return 1; # dragons #
###########
=head1 SEE ALSO
CXGN::Transcript::Unigene calls this module.
This has been written with Moose, a postmodern object-orientation system for Perl, and uses the Moose extension MooseX::Method::Signatures.
=cut
| solgenomics/sgn | lib/CXGN/Transcript/DrawContigAlign.pm | Perl | mit | 21,024 |
#------------------------------------------------------------------------------
# File: XMP2.pl
#
# Description: Additional XMP namespace definitions
#
# Revisions: 10/12/2008 - P. Harvey Created
#
# References: 1) PLUS - http://ns.useplus.org/
# 2) PRISM - http://www.prismstandard.org/
# 3) http://www.portfoliofaq.com/pfaq/v7mappings.htm
# 5) http://creativecommons.org/technology/xmp
# --> changed to http://wiki.creativecommons.org/Companion_File_metadata_specification (2007/12/21)
# 6) http://www.optimasc.com/products/fileid/xmp-extensions.pdf
# 9) http://www.w3.org/TR/SVG11/
# 11) http://www.extensis.com/en/support/kb_article.jsp?articleNumber=6102211
# 12) XMPSpecificationPart3_May2013, page 58
#------------------------------------------------------------------------------
package Image::ExifTool::XMP;
use strict;
use Image::ExifTool qw(:Utils);
use Image::ExifTool::XMP;
# xmpDM structure definitions
my %sCuePointParam = (
STRUCT_NAME => 'CuePointParam',
NAMESPACE => 'xmpDM',
key => { },
value => { },
);
my %sMarker = (
STRUCT_NAME => 'Marker',
NAMESPACE => 'xmpDM',
comment => { },
duration => { },
location => { },
name => { },
startTime => { },
target => { },
type => { },
# added Oct 2008
cuePointParams => { Struct => \%sCuePointParam, List => 'Seq' },
cuePointType=> { },
probability => { Writable => 'real' },
speaker => { },
);
my %sTime = (
STRUCT_NAME => 'Time',
NAMESPACE => 'xmpDM',
scale => { Writable => 'rational' },
value => { Writable => 'integer' },
);
my %sTimecode = (
STRUCT_NAME => 'Timecode',
NAMESPACE => 'xmpDM',
timeFormat => {
PrintConv => {
'24Timecode' => '24 fps',
'25Timecode' => '25 fps',
'2997DropTimecode' => '29.97 fps (drop)',
'2997NonDropTimecode' => '29.97 fps (non-drop)',
'30Timecode' => '30 fps',
'50Timecode' => '50 fps',
'5994DropTimecode' => '59.94 fps (drop)',
'5994NonDropTimecode' => '59.94 fps (non-drop)',
'60Timecode' => '60 fps',
'23976Timecode' => '23.976 fps',
},
},
timeValue => { },
value => { Writable => 'integer' },
);
# XMP Dynamic Media namespace properties (xmpDM)
%Image::ExifTool::XMP::xmpDM = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-xmpDM', 2 => 'Image' },
NAMESPACE => 'xmpDM',
NOTES => 'XMP Dynamic Media namespace tags.',
absPeakAudioFilePath=> { },
album => { },
altTapeName => { },
altTimecode => { Struct => \%sTimecode },
artist => { Avoid => 1, Groups => { 2 => 'Author' } },
audioModDate => { Groups => { 2 => 'Time' }, %dateTimeInfo },
audioSampleRate => { Writable => 'integer' },
audioSampleType => {
PrintConv => {
'8Int' => '8-bit integer',
'16Int' => '16-bit integer',
'24Int' => '24-bit integer',
'32Int' => '32-bit integer',
'32Float' => '32-bit float',
'Compressed' => 'Compressed',
'Packed' => 'Packed',
'Other' => 'Other',
},
},
audioChannelType => {
PrintConv => {
'Mono' => 'Mono',
'Stereo' => 'Stereo',
'5.1' => '5.1',
'7.1' => '7.1',
'16 Channel' => '16 Channel',
'Other' => 'Other',
},
},
audioCompressor => { },
beatSpliceParams => {
Struct => {
STRUCT_NAME => 'BeatSpliceStretch',
NAMESPACE => 'xmpDM',
riseInDecibel => { Writable => 'real' },
riseInTimeDuration => { Struct => \%sTime },
useFileBeatsMarker => { Writable => 'boolean' },
},
},
cameraAngle => { },
cameraLabel => { },
cameraModel => { },
cameraMove => { },
client => { },
comment => { Name => 'DMComment' },
composer => { Groups => { 2 => 'Author' } },
contributedMedia => {
Struct => {
STRUCT_NAME => 'Media',
NAMESPACE => 'xmpDM',
duration => { Struct => \%sTime },
managed => { Writable => 'boolean' },
path => { },
startTime => { Struct => \%sTime },
track => { },
webStatement=> { },
},
List => 'Bag',
},
copyright => { Avoid => 1, Groups => { 2 => 'Author' } }, # (deprecated)
director => { },
directorPhotography => { },
discNumber => { }, #12
duration => { Struct => \%sTime },
engineer => { },
fileDataRate => { Writable => 'rational' },
genre => { },
good => { Writable => 'boolean' },
instrument => { },
introTime => { Struct => \%sTime },
key => {
PrintConvColumns => 3,
PrintConv => {
'C' => 'C', 'C#' => 'C#', 'D' => 'D', 'D#' => 'D#',
'E' => 'E', 'F' => 'F', 'F#' => 'F#', 'G' => 'G',
'G#' => 'G#', 'A' => 'A', 'A#' => 'A#', 'B' => 'B',
},
},
logComment => { },
loop => { Writable => 'boolean' },
lyrics => { }, #12
numberOfBeats => { Writable => 'real' },
markers => { Struct => \%sMarker, List => 'Seq' },
metadataModDate => { Groups => { 2 => 'Time' }, %dateTimeInfo },
outCue => { Struct => \%sTime },
partOfCompilation=>{ Writable => 'boolean' }, #12
projectName => { },
projectRef => {
Struct => {
STRUCT_NAME => 'ProjectLink',
NAMESPACE => 'xmpDM',
path => { },
type => {
PrintConv => {
movie => 'Movie',
still => 'Still Image',
audio => 'Audio',
custom => 'Custom',
},
},
},
},
pullDown => {
PrintConvColumns => 2,
PrintConv => {
'WSSWW' => 'WSSWW', 'SSWWW' => 'SSWWW',
'SWWWS' => 'SWWWS', 'WWWSS' => 'WWWSS',
'WWSSW' => 'WWSSW', 'WWWSW' => 'WWWSW',
'WWSWW' => 'WWSWW', 'WSWWW' => 'WSWWW',
'SWWWW' => 'SWWWW', 'WWWWS' => 'WWWWS',
},
},
relativePeakAudioFilePath => { },
relativeTimestamp => { Struct => \%sTime },
releaseDate => { Groups => { 2 => 'Time' }, %dateTimeInfo },
resampleParams => {
Struct => {
STRUCT_NAME => 'ResampleStretch',
NAMESPACE => 'xmpDM',
quality => { PrintConv => { Low => 'Low', Medium => 'Medium', High => 'High' } },
},
},
scaleType => {
PrintConv => {
Major => 'Major',
Minor => 'Minor',
Both => 'Both',
Neither => 'Neither',
},
},
scene => { Avoid => 1 },
shotDate => { Groups => { 2 => 'Time' }, %dateTimeInfo },
shotDay => { },
shotLocation => { },
shotName => { },
shotNumber => { },
shotSize => { },
speakerPlacement=> { },
startTimecode => { Struct => \%sTimecode },
startTimeSampleSize => { Writable => 'integer' }, #PH
startTimeScale => { }, #PH (real?)
stretchMode => {
PrintConv => {
'Fixed length' => 'Fixed length',
'Time-Scale' => 'Time-Scale',
'Resample' => 'Resample',
'Beat Splice' => 'Beat Splice',
'Hybrid' => 'Hybrid',
},
},
takeNumber => { Writable => 'integer' },
tapeName => { },
tempo => { Writable => 'real' },
timeScaleParams => {
Struct => {
STRUCT_NAME => 'TimeScaleStretch',
NAMESPACE => 'xmpDM',
frameOverlappingPercentage => { Writable => 'real' },
frameSize => { Writable => 'real' },
quality => { PrintConv => { Low => 'Low', Medium => 'Medium', High => 'High' } },
},
},
timeSignature => {
PrintConvColumns => 3,
PrintConv => {
'2/4' => '2/4', '3/4' => '3/4', '4/4' => '4/4',
'5/4' => '5/4', '7/4' => '7/4', '6/8' => '6/8',
'9/8' => '9/8', '12/8'=> '12/8', 'other' => 'other',
},
},
trackNumber => { Writable => 'integer' },
Tracks => {
Struct => {
STRUCT_NAME => 'Track',
NAMESPACE => 'xmpDM',
frameRate => { },
markers => { Struct => \%sMarker, List => 'Seq' },
trackName => { },
trackType => { },
},
List => 'Bag',
},
videoAlphaMode => {
PrintConv => {
'straight' => 'Straight',
'pre-multiplied', => 'Pre-multiplied',
'none' => 'None',
},
},
videoAlphaPremultipleColor => { Struct => \%sColorant },
videoAlphaUnityIsTransparent => { Writable => 'boolean' },
videoColorSpace => {
PrintConv => {
'sRGB' => 'sRGB',
'CCIR-601' => 'CCIR-601',
'CCIR-709' => 'CCIR-709',
},
},
videoCompressor => { },
videoFieldOrder => {
PrintConv => {
Upper => 'Upper',
Lower => 'Lower',
Progressive => 'Progressive',
},
},
videoFrameRate => { Writable => 'real' },
videoFrameSize => { Struct => \%sDimensions },
videoModDate => { Groups => { 2 => 'Time' }, %dateTimeInfo },
videoPixelAspectRatio => { Writable => 'rational' },
videoPixelDepth => {
PrintConv => {
'8Int' => '8-bit integer',
'16Int' => '16-bit integer',
'24Int' => '24-bit integer',
'32Int' => '32-bit integer',
'32Float' => '32-bit float',
'Other' => 'Other',
},
},
);
#------------------------------------------------------------------------------
# PRISM
#
# NOTE: The "Avoid" flag is set for all PRISM tags
# my %obsolete = (
# Notes => 'obsolete in 2.0',
# ValueConvInv => sub {
# my ($val, $self) = @_;
# unless ($self->Options('IgnoreMinorErrors')) {
# warn "Warning: [minor] Attempt to write obsolete tag\n";
# return undef;
# }
# return $val;
# }
# );
# PRISM structure definitions
my %prismPublicationDate = (
STRUCT_NAME => 'prismPublicationDate',
NAMESPACE => 'prism',
date => { %dateTimeInfo, Groups => { 2 => 'Time'} },
'a-platform'=> { },
);
# Publishing Requirements for Industry Standard Metadata (prism) (ref 2)
%Image::ExifTool::XMP::prism = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-prism', 2 => 'Document' },
NAMESPACE => 'prism',
NOTES => q{
Publishing Requirements for Industry Standard Metadata 3.0 namespace
tags. (see L<http://www.prismstandard.org/>)
},
acedemicField => { }, # (3.0)
aggregateIssueNumber => { Writable => 'integer' }, # (3.0)
aggregationType => { List => 'Bag' },
alternateTitle => {
List => 'Bag',
Struct => { # (becomes a structure in 3.0)
STRUCT_NAME => 'prismAlternateTitle',
NAMESPACE => 'prism',
text => { },
'a-platform'=> { },
'a-lang' => { },
},
},
blogTitle => { }, # (3.0)
blogURL => { }, # (3.0)
bookEdition => { }, # (3.0)
byteCount => { Writable => 'integer' },
channel => {
List => 'Bag',
Struct => { # (becomes a structure in 3.0)
STRUCT_NAME => 'prismChannel',
NAMESPACE => 'prism',
channel => { },
subchannel1 => { },
subchannel2 => { },
subchannel3 => { },
subchannel4 => { },
'a-lang' => { },
},
},
complianceProfile=>{ PrintConv => { three => 'Three' } },
contentType => { }, # (3.0)
copyrightYear => { }, # (3.0)
# copyright => { Groups => { 2 => 'Author' } }, # (deprecated in 3.0)
corporateEntity => { List => 'Bag' },
coverDate => { %dateTimeInfo, Groups => { 2 => 'Time'} },
coverDisplayDate=> { },
creationDate => { %dateTimeInfo, Groups => { 2 => 'Time'} },
dateRecieved => { %dateTimeInfo, Groups => { 2 => 'Time'} },
device => { }, # (3.0)
distributor => { },
doi => { Name => 'DOI', Description => 'Digital Object Identifier' },
edition => { },
eIssn => { },
#embargoDate => { List => 'Bag', %dateTimeInfo, Groups => { 2 => 'Time'} }, # (deprecated in 3.0)
endingPage => { },
event => { List => 'Bag' },
#expirationDate => { List => 'Bag', %dateTimeInfo, Groups => { 2 => 'Time'} }, # (deprecated in 3.0)
genre => { List => 'Bag' },
hasAlternative => { List => 'Bag' },
hasCorrection => {
Struct => { # (becomes a structure in 3.0)
STRUCT_NAME => 'prismHasCorrection',
NAMESPACE => 'prism',
text => { },
'a-platform'=> { },
'a-lang' => { },
},
},
# hasPreviousVersion => { }, # (not in 3.0)
hasTranslation => { List => 'Bag' },
industry => { List => 'Bag' },
isAlternativeOf => { List => 'Bag' }, # (3.0)
isbn => { Name => 'ISBN', List => 'Bag' }, # 2.1 (becomes a list in 3.0)
isCorrectionOf => { List => 'Bag' },
issn => { Name => 'ISSN' },
issueIdentifier => { },
issueName => { },
issueTeaser => { }, # (3.0)
issueType => { }, # (3.0)
isTranslationOf => { },
keyword => { List => 'Bag' },
killDate => {
Struct => { # (becomes a structure in 3.0)
STRUCT_NAME => 'prismKillDate',
NAMESPACE => 'prism',
date => { %dateTimeInfo, Groups => { 2 => 'Time'} },
'a-platform'=> { }, #PH (missed in spec?)
},
},
'link' => { List => 'Bag' }, # (3.0)
location => { List => 'Bag' },
# metadataContainer => { }, (not valid for PRISM XMP)
modificationDate=> { %dateTimeInfo, Groups => { 2 => 'Time'} },
nationalCatalogNumber => { }, # (3.0)
number => { },
object => { List => 'Bag' },
onSaleDate => { # (3.0)
List => 'Bag',
Struct => {
STRUCT_NAME => 'prismOnSaleDate',
NAMESPACE => 'prism',
date => { %dateTimeInfo, Groups => { 2 => 'Time'} },
'a-platform'=> { },
},
},
onSaleDay => { # (3.0)
List => 'Bag',
Struct => {
STRUCT_NAME => 'prismOnSaleDay',
NAMESPACE => 'prism',
day => { }, #PH (not named in spec)
'a-platform'=> { },
},
},
offSaleDate => { # (3.0)
List => 'Bag',
Struct => {
STRUCT_NAME => 'prismOffSaleDate',
NAMESPACE => 'prism',
date => { %dateTimeInfo, Groups => { 2 => 'Time'} },
'a-platform'=> { },
},
},
organization => { List => 'Bag' },
originPlatform => {
List => 'Bag',
PrintConv => {
email => 'E-Mail',
mobile => 'Mobile',
broadcast => 'Broadcast',
web => 'Web',
'print' => 'Print',
recordableMedia => 'Recordable Media',
other => 'Other',
},
},
pageCount => { Writable => 'integer' }, # (3.0)
pageProgressionDirection => { # (3.0)
PrintConv => { LTR => 'Left to Right', RTL => 'Right to Left' },
},
pageRange => { List => 'Bag' },
person => { },
platform => { }, # (3.0)
productCode => { }, # (3.0)
profession => { }, # (3.0)
publicationDate => {
List => 'Bag',
Struct => \%prismPublicationDate, # (becomes a structure in 3.0)
},
publicationDisplayDate => { # (3.0)
List => 'Bag',
Struct => \%prismPublicationDate,
},
publicationName => { },
publishingFrequency => { }, # (3.0)
rating => { },
# rightsAgent => { }, # (deprecated in 3.0)
samplePageRange => { }, # (3.0)
section => { },
sellingAgency => { }, # (3.0)
seriesNumber => { Writable => 'integer' }, # (3.0)
seriesTitle => { }, # (3.0)
sport => { }, # (3.0)
startingPage => { },
subsection1 => { },
subsection2 => { },
subsection3 => { },
subsection4 => { },
subtitle => { }, # (3.0)
supplementDisplayID => { }, # (3.0)
supplementStartingPage => { }, # (3.0)
supplementTitle => { }, # (3.0)
teaser => { List => 'Bag' },
ticker => { List => 'Bag' },
timePeriod => { },
url => {
Name => 'URL',
List => 'Bag',
Struct => { # (becomes a structure in 3.0)
STRUCT_NAME => 'prismUrl',
NAMESPACE => 'prism',
url => { },
'a-platform'=> { },
},
},
uspsNumber => { }, # (3.0)
versionIdentifier => { },
volume => { },
wordCount => { Writable => 'integer' },
# tags that existed in version 1.3
# category => { %obsolete, List => 'Bag' },
# hasFormat => { %obsolete, List => 'Bag' },
# hasPart => { %obsolete, List => 'Bag' },
# isFormatOf => { %obsolete, List => 'Bag' },
# isPartOf => { %obsolete },
# isReferencedBy => { %obsolete, List => 'Bag' },
# isRequiredBy => { %obsolete, List => 'Bag' },
# isVersionOf => { %obsolete },
# objectTitle => { %obsolete, List => 'Bag' },
# receptionDate => { %obsolete },
# references => { %obsolete, List => 'Bag' },
# requires => { %obsolete, List => 'Bag' },
# tags in older versions
# page
# contentLength
# creationTime
# expirationTime
# hasVersion
# isAlternativeFor
# isBasedOn
# isBasisFor
# modificationTime
# publicationTime
# receptionTime
# releaseTime
);
# PRISM Rights Language namespace (prl) (ref 2)
%Image::ExifTool::XMP::prl = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-prl', 2 => 'Document' },
NAMESPACE => 'prl',
NOTES => q{
PRISM Rights Language 2.1 namespace tags. These tags have been deprecated
since the release of the PRISM Usage Rights 3.0. (see
L<http://www.prismstandard.org/>)
},
geography => { List => 'Bag' },
industry => { List => 'Bag' },
usage => { List => 'Bag' },
);
# PRISM Usage Rights namespace (prismusagerights) (ref 2)
%Image::ExifTool::XMP::pur = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-pur', 2 => 'Document' },
NAMESPACE => 'pur',
NOTES => q{
PRISM Usage Rights 3.0 namespace tags. (see
L<http://www.prismstandard.org/>)
},
adultContentWarning => { List => 'Bag' },
agreement => { List => 'Bag' },
copyright => {
# (not clear in 3.0 spec, which lists only "bag Text", and called
# "copyrightDate" instead of "copyright" the PRISM basic 3.0 spec)
Writable => 'lang-alt',
Groups => { 2 => 'Author' },
},
creditLine => { List => 'Bag' },
embargoDate => { List => 'Bag', %dateTimeInfo, Groups => { 2 => 'Time'} },
exclusivityEndDate => { List => 'Bag', %dateTimeInfo, Groups => { 2 => 'Time'} },
expirationDate => { List => 'Bag', %dateTimeInfo, Groups => { 2 => 'Time'} },
imageSizeRestriction=> { },
optionEndDate => { List => 'Bag', %dateTimeInfo, Groups => { 2 => 'Time'} },
permissions => { List => 'Bag' },
restrictions => { List => 'Bag' },
reuseProhibited => { Writable => 'boolean' },
rightsAgent => { },
rightsOwner => { },
# usageFee => { List => 'Bag' }, # (not in 3.0)
);
# PRISM Metadata for Images namespace (pmi) (ref 2)
%Image::ExifTool::XMP::pmi = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-pmi', 2 => 'Image' },
NAMESPACE => 'pmi',
NOTES => q{
PRISM Metadata for Images 3.0 namespace tags. (see
L<http://www.prismstandard.org/>)
},
color => {
PrintConv => {
bw => 'BW',
color => 'Color',
sepia => 'Sepia',
duotone => 'Duotone',
tritone => 'Tritone',
quadtone => 'Quadtone',
},
},
contactInfo => { },
displayName => { },
distributorProductID => { },
eventAlias => { },
eventEnd => { },
eventStart => { },
eventSubtype => { },
eventType => { },
field => { },
framing => { },
location => { },
make => { },
manufacturer => { },
model => { },
modelYear => { },
objectDescription=>{ },
objectSubtype => { },
objectType => { },
orientation => {
PrintConv => {
horizontal => 'Horizontal',
vertical => 'Vertical',
}
},
positionDescriptor => { },
productID => { },
productIDType => { },
season => {
PrintConv => {
spring => 'Spring',
summer => 'Summer',
fall => 'Fall',
winter => 'Winter',
},
},
sequenceName => { },
sequenceNumber => { },
sequenceTotalNumber => { },
setting => { },
shootID => { },
slideshowName => { },
slideshowNumber => { Writable => 'integer' },
slideshowTotalNumber => { Writable => 'integer' },
viewpoint => { },
visualTechnique => { },
);
# PRISM Recipe Metadata (prm) (ref 2)
%Image::ExifTool::XMP::prm = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-prm', 2 => 'Document' },
NAMESPACE => 'prm',
NOTES => q{
PRISM Recipe Metadata 3.0 namespace tags. (see
L<http://www.prismstandard.org/>)
},
cookingEquipment => { },
cookingMethod => { },
course => { },
cuisine => { },
dietaryNeeds => { },
dishType => { },
duration => { },
ingredientExclusion => { },
mainIngredient => { },
meal => { },
recipeEndingPage => { },
recipePageRange => { },
recipeSource => { },
recipeStartingPage => { },
recipeTitle => { },
servingSize => { },
skillLevel => { },
specialOccasion => { },
yield => { },
);
#------------------------------------------------------------------------------
# DICOM namespace properties (DICOM) (ref PH, written by CS3)
%Image::ExifTool::XMP::DICOM = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-DICOM', 2 => 'Image' },
NAMESPACE => 'DICOM',
NOTES => q{
DICOM namespace tags. These XMP tags allow some DICOM information to be
stored in files of other than DICOM format. See the
L<DICOM Tags documentation|Image::ExifTool::TagNames/DICOM Tags> for a list
of tags available in DICOM-format files.
},
# change some tag names to correspond with DICOM tags
PatientName => { },
PatientID => { },
PatientSex => { },
PatientDOB => {
Name => 'PatientBirthDate',
Groups => { 2 => 'Time' },
%dateTimeInfo,
},
StudyID => { },
StudyPhysician => { },
StudyDateTime => { Groups => { 2 => 'Time' }, %dateTimeInfo },
StudyDescription => { },
SeriesNumber => { },
SeriesModality => { },
SeriesDateTime => { Groups => { 2 => 'Time' }, %dateTimeInfo },
SeriesDescription => { },
EquipmentInstitution => { },
EquipmentManufacturer => { },
);
# PixelLive namespace properties (PixelLive) (ref 3)
%Image::ExifTool::XMP::PixelLive = (
GROUPS => { 1 => 'XMP-PixelLive', 2 => 'Image' },
NAMESPACE => 'PixelLive',
NOTES => q{
PixelLive namespace tags. These tags are not writable becase they are very
uncommon and I haven't been able to locate a reference which gives the
namespace URI.
},
AUTHOR => { Name => 'Author', Avoid => 1, Groups => { 2 => 'Author' } },
COMMENTS => { Name => 'Comments', Avoid => 1 },
COPYRIGHT => { Name => 'Copyright',Avoid => 1, Groups => { 2 => 'Author' } },
DATE => { Name => 'Date', Avoid => 1, Groups => { 2 => 'Time' } },
GENRE => { Name => 'Genre', Avoid => 1 },
TITLE => { Name => 'Title', Avoid => 1 },
);
# Extensis Portfolio tags (extensis) (ref 11)
%Image::ExifTool::XMP::extensis = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-extensis', 2 => 'Image' },
NAMESPACE => 'extensis',
NOTES => 'Tags used by Extensis Portfolio.',
Approved => { Writable => 'boolean' },
ApprovedBy => { },
ClientName => { },
JobName => { },
JobStatus => { },
RoutedTo => { },
RoutingNotes => { },
WorkToDo => { },
);
# IDimager structures (ref PH)
my %sTagStruct;
%sTagStruct = (
STRUCT_NAME => 'TagStructure',
NAMESPACE => 'ics',
LabelName => { },
Reference => { },
ParentReference => { },
SubLabels => { Struct => \%sTagStruct, List => 'Bag' },
);
my %sSubVersion = (
STRUCT_NAME => 'SubVersion',
NAMESPACE => 'ics',
VersRef => { },
FileName => { },
);
# IDimager namespace (ics) (ref PH)
%Image::ExifTool::XMP::ics = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-ics', 2 => 'Image' },
NAMESPACE => 'ics',
NOTES => q{
Tags used by IDimager. Nested TagStructure structures are unrolled to an
arbitrary depth of 6 to avoid infinite recursion.
},
ImageRef => { },
TagStructure => { Struct => \%sTagStruct, List => 'Bag' },
TagStructureLabelName => { Name => 'LabelName1', Flat => 1 },
TagStructureReference => { Name => 'Reference1', Flat => 1 },
TagStructureSubLabels => { Name => 'SubLables1', Flat => 1 },
TagStructureParentReference => { Name => 'ParentReference1', Flat => 1 },
TagStructureSubLabelsLabelName => { Name => 'LabelName2', Flat => 1 },
TagStructureSubLabelsReference => { Name => 'Reference2', Flat => 1 },
TagStructureSubLabelsSubLabels => { Name => 'SubLables2', Flat => 1 },
TagStructureSubLabelsParentReference => { Name => 'ParentReference2', Flat => 1 },
TagStructureSubLabelsSubLabelsLabelName => { Name => 'LabelName3', Flat => 1 },
TagStructureSubLabelsSubLabelsReference => { Name => 'Reference3', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabels => { Name => 'SubLables3', Flat => 1 },
TagStructureSubLabelsSubLabelsParentReference => { Name => 'ParentReference3', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsLabelName => { Name => 'LabelName4', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsReference => { Name => 'Reference4', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabels => { Name => 'SubLabels4', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsParentReference => { Name => 'ParentReference4', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsLabelName => { Name => 'LabelName5', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsReference => { Name => 'Reference5', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsSubLabels => { Name => 'SubLabels5', Flat => 1, NoSubStruct => 1 }, # break infinite recursion
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsParentReference => { Name => 'ParentReference5', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsSubLabelsLabelName => { Name => 'LabelName6', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsSubLabelsReference => { Name => 'Reference6', Flat => 1 },
TagStructureSubLabelsSubLabelsSubLabelsSubLabelsSubLabelsParentReference => { Name => 'ParentReference6', Flat => 1 },
SubVersions => { Struct => \%sSubVersion, List => 'Bag' },
SubVersionsVersRef => { Name => 'SubVersionReference', Flat => 1 },
SubVersionsFileName => { Name => 'SubVersionFileName', Flat => 1 },
);
# ACDSee namespace (acdsee) (ref PH)
%Image::ExifTool::XMP::acdsee = (
%xmpTableDefaults,
GROUPS => { 0 => 'XMP', 1 => 'XMP-acdsee', 2 => 'Image' },
NAMESPACE => 'acdsee',
NOTES => q{
ACD Systems ACDSee namespace tags.
(A note to software developers: Re-inventing your own private tags instead
of using the equivalent tags in standard XMP namespaces defeats one of the
most valuable features of metadata: interoperability. Your applications
mumble to themselves instead of speaking out for the rest of the world to
hear.)
},
author => { Avoid => 1, Groups => { 2 => 'Author' } },
caption => { Avoid => 1 },
categories => { Avoid => 1 },
collections=> { Avoid => 1 },
datetime => { Name => 'DateTime', Avoid => 1, Groups => { 2 => 'Time' }, %dateTimeInfo },
keywords => { Avoid => 1, List => 'Bag' },
notes => { Avoid => 1 },
rating => { Avoid => 1, Writable => 'real' }, # integer?
tagged => { Avoid => 1, Writable => 'boolean' },
rawrppused => { Writable => 'boolean' },
rpp => {
Name => 'RPP',
Writable => 'lang-alt',
Notes => 'raw processing settings in XML format',
Binary => 1,
},
dpp => {
Name => 'DPP',
Writable => 'lang-alt',
Notes => 'newer version of XML raw processing settings',
Binary => 1,
},
# more tags (ref forum6840)
FixtureIdentifier => { Avoid => 1 },
EditStatus => { Avoid => 1 },
ReleaseDate => { Avoid => 1 },
ReleaseTime => { Avoid => 1 },
OriginatingProgram => { Avoid => 1 },
ObjectCycle => { Avoid => 1 },
Snapshots => { Avoid => 1, List => 'Bag', Binary => 1 },
);
# Picture Licensing Universal System namespace properties (xmpPLUS)
%Image::ExifTool::XMP::xmpPLUS = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-xmpPLUS', 2 => 'Author' },
NAMESPACE => 'xmpPLUS',
NOTES => q{
XMP Picture Licensing Universal System (PLUS) tags as written by some older
Adobe applications. See L<PLUS XMP Tags|Image::ExifTool::TagNames/PLUS XMP Tags>
for the current PLUS tags.
},
CreditLineReq => { Writable => 'boolean', Avoid => 1 },
ReuseAllowed => { Writable => 'boolean', Avoid => 1 },
);
# Creative Commons namespace properties (cc) (ref 5)
%Image::ExifTool::XMP::cc = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-cc', 2 => 'Author' },
NAMESPACE => 'cc',
NOTES => q{
Creative Commons namespace tags. Note that the CC specification for XMP is
non-existent, so ExifTool must make some assumptions about the format of the
specific properties in XMP (see L<http://creativecommons.org/ns>).
},
# Work properties
license => { Resource => 1 },
attributionName => { },
attributionURL => { Resource => 1 },
morePermissions => { Resource => 1 },
useGuidelines => { Resource => 1 },
# License properties
permits => {
List => 'Bag',
Resource => 1,
PrintConv => {
'cc:Sharing' => 'Sharing',
'cc:DerivativeWorks' => 'Derivative Works',
'cc:Reproduction' => 'Reproduction',
'cc:Distribution' => 'Distribution',
},
},
requires => {
List => 'Bag',
Resource => 1,
PrintConv => {
'cc:Copyleft' => 'Copyleft',
'cc:LesserCopyleft' => 'Lesser Copyleft',
'cc:SourceCode' => 'Source Code',
'cc:ShareAlike' => 'Share Alike',
'cc:Notice' => 'Notice',
'cc:Attribution' => 'Attribution',
},
},
prohibits => {
List => 'Bag',
Resource => 1,
PrintConv => {
'cc:HighIncomeNationUse' => 'High Income Nation Use',
'cc:CommercialUse' => 'Commercial Use',
},
},
jurisdiction => { Resource => 1 },
legalcode => { Name => 'LegalCode', Resource => 1 },
deprecatedOn => { %dateTimeInfo, Groups => { 2 => 'Time' } },
);
# Description Explorer namespace properties (dex) (ref 6)
%Image::ExifTool::XMP::dex = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-dex', 2 => 'Image' },
NAMESPACE => 'dex',
NOTES => q{
Description Explorer namespace tags. These tags are not very common. The
Source and Rating tags are avoided when writing due to name conflicts with
other XMP tags. (see L<http://www.optimasc.com/products/fileid/>)
},
crc32 => { Name => 'CRC32', Writable => 'integer' },
source => { Avoid => 1 },
shortdescription => {
Name => 'ShortDescription',
Writable => 'lang-alt',
},
licensetype => {
Name => 'LicenseType',
PrintConv => {
unknown => 'Unknown',
shareware => 'Shareware',
freeware => 'Freeware',
adware => 'Adware',
demo => 'Demo',
commercial => 'Commercial',
'public domain' => 'Public Domain',
'open source' => 'Open Source',
},
},
revision => { },
rating => { Avoid => 1 },
os => { Name => 'OS', Writable => 'integer' },
ffid => { Name => 'FFID' },
);
# iView MediaPro namespace properties (mediapro) (ref PH)
%Image::ExifTool::XMP::MediaPro = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-mediapro', 2 => 'Image' },
NAMESPACE => 'mediapro',
NOTES => 'iView MediaPro namespace tags.',
Event => {
Avoid => 1,
Notes => 'avoided due to conflict with XMP-iptcExt:Event',
},
Location => {
Avoid => 1,
Groups => { 2 => 'Location' },
Notes => 'avoided due to conflict with XMP-iptcCore:Location',
},
Status => { },
People => { List => 'Bag' },
UserFields => { List => 'Bag' },
CatalogSets => { List => 'Bag' },
);
# Microsoft ExpressionMedia namespace properties (expressionmedia)
# (ref http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4235.0.html)
%Image::ExifTool::XMP::ExpressionMedia = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-expressionmedia', 2 => 'Image' },
NAMESPACE => 'expressionmedia',
NOTES => q{
Microsoft Expression Media namespace tags. These tags are avoided when
writing due to name conflicts with tags in other schemas.
},
Event => { Avoid => 1 },
Status => { Avoid => 1 },
People => { Avoid => 1, List => 'Bag' },
CatalogSets => { Avoid => 1, List => 'Bag' },
);
# DigiKam namespace tags (ref PH)
%Image::ExifTool::XMP::digiKam = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-digiKam', 2 => 'Image' },
NAMESPACE => 'digiKam',
NOTES => 'DigiKam namespace tags.',
CaptionsAuthorNames => { Writable => 'lang-alt' },
CaptionsDateTimeStamps => { Writable => 'lang-alt', Groups => { 2 => 'Time' } },
TagsList => { List => 'Seq' },
ColorLabel => { },
PickLabel => { },
ImageHistory => { Avoid => 1, Notes => 'different format from EXIF:ImageHistory' },
LensCorrectionSettings => { },
ImageUniqueID => { Avoid => 1 },
);
# SWF namespace tags (ref PH)
%Image::ExifTool::XMP::swf = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-swf', 2 => 'Image' },
NAMESPACE => 'swf',
NOTES => 'Adobe SWF namespace tags.',
type => { Avoid => 1 },
bgalpha => { Name => 'BackgroundAlpha', Writable => 'integer' },
forwardlock => { Name => 'ForwardLock', Writable => 'boolean' },
maxstorage => { Name => 'MaxStorage', Writable => 'integer' }, # (CS5)
);
# Sony Ericsson cell phone location tags
# refs: http://www.opencellid.org/api
# http://zonetag.research.yahoo.com/faq_location.php
# http://www.cs.columbia.edu/sip/drafts/LIF%20TS%20101%20v2.0.0.pdf
%Image::ExifTool::XMP::cell = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-cell', 2 => 'Location' },
NAMESPACE => 'cell',
NOTES => 'Location tags written by some Sony Ericsson phones.',
mcc => { Name => 'MobileCountryCode' },
mnc => { Name => 'MobileNetworkCode' },
lac => { Name => 'LocationAreaCode' },
cellid => { Name => 'CellTowerID' },
cgi => { Name => 'CellGlobalID' },
r => { Name => 'CellR' }, # (what is this? Radius?)
);
# Apple adjustment settings (ref PH)
%Image::ExifTool::XMP::aas = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-aas', 2 => 'Image' },
NAMESPACE => 'aas',
NOTES => 'Apple Adjustment Settings used by iPhone/iPad.',
CropX => { Writable => 'integer', Avoid => 1 },
CropY => { Writable => 'integer', Avoid => 1 },
CropW => { Writable => 'integer', Avoid => 1 },
CropH => { Writable => 'integer', Avoid => 1 },
AffineA => { Writable => 'real' },
AffineB => { Writable => 'real' },
AffineC => { Writable => 'real' },
AffineD => { Writable => 'real' },
AffineX => { Writable => 'real' },
AffineY => { Writable => 'real' },
Vibrance => { Writable => 'real', Avoid => 1 },
Curve0x => { Writable => 'real' },
Curve0y => { Writable => 'real' },
Curve1x => { Writable => 'real' },
Curve1y => { Writable => 'real' },
Curve2x => { Writable => 'real' },
Curve2y => { Writable => 'real' },
Curve3x => { Writable => 'real' },
Curve3y => { Writable => 'real' },
Curve4x => { Writable => 'real' },
Curve4y => { Writable => 'real' },
Shadows => { Writable => 'real', Avoid => 1 },
Highlights => { Writable => 'real', Avoid => 1 },
# the following from StarGeek
FaceBalanceOrigI => { Writable => 'real' },
FaceBalanceOrigQ => { Writable => 'real' },
FaceBalanceStrength => { Writable => 'real' },
FaceBalanceWarmth => { Writable => 'real' },
);
# Adobe creatorAtom properties (ref PH)
%Image::ExifTool::XMP::creatorAtom = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-creatorAtom', 2 => 'Image' },
NAMESPACE => 'creatorAtom',
NOTES => 'Adobe creatorAtom tags, written by After Effects.',
macAtom => {
Struct => {
STRUCT_NAME => 'MacAtom',
NAMESPACE => 'creatorAtom',
applicationCode => { },
invocationAppleEvent => { },
posixProjectPath => { },
},
},
windowsAtom => {
Struct => {
STRUCT_NAME => 'WindowsAtom',
NAMESPACE => 'creatorAtom',
extension => { },
invocationFlags => { },
uncProjectPath => { },
},
},
aeProjectLink => { # (After Effects Project Link)
Struct => {
STRUCT_NAME => 'AEProjectLink',
NAMESPACE => 'creatorAtom',
renderTimeStamp => { Writable => 'integer' },
compositionID => { },
renderQueueItemID => { },
renderOutputModuleIndex => { },
fullPath => { },
},
},
);
# FastPictureViewer namespace properties (http://www.fastpictureviewer.com/help/#rtfcomments)
%Image::ExifTool::XMP::fpv = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-fpv', 2 => 'Image' },
NAMESPACE => 'fpv',
NOTES => q{
Fast Picture Viewer tags (see
L<http://www.fastpictureviewer.com/help/#rtfcomments>).
},
RichTextComment => { },
);
# Apple FaceInfo namespace properties (ref PH)
%Image::ExifTool::XMP::apple_fi = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-apple-fi', 2 => 'Image' },
NAMESPACE => 'apple-fi',
NOTES => q{
Face information tags written by the Apple iPhone 5 inside the mwg-rs
RegionExtensions.
},
Timestamp => {
Name => 'TimeStamp',
Writable => 'integer',
# (don't know how to convert this)
},
FaceID => { Writable => 'integer' },
AngleInfoRoll => { Writable => 'integer' },
AngleInfoYaw => { Writable => 'integer' },
ConfidenceLevel => { Writable => 'integer' },
);
# Google panorama namespace properties
# (ref http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4569.0.html)
%Image::ExifTool::XMP::GPano = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-GPano', 2 => 'Image' },
NAMESPACE => 'GPano',
NOTES => q{
Panorama tags written by Google Photosphere. See
L<https://developers.google.com/panorama/metadata/> for the specification.
},
UsePanoramaViewer => { Writable => 'boolean' },
CaptureSoftware => { },
StitchingSoftware => { },
ProjectionType => { },
PoseHeadingDegrees => { Writable => 'real' },
PosePitchDegrees => { Writable => 'real' },
PoseRollDegrees => { Writable => 'real' },
InitialViewHeadingDegrees => { Writable => 'real' },
InitialViewPitchDegrees => { Writable => 'real' },
InitialViewRollDegrees => { Writable => 'real' },
InitialHorizontalFOVDegrees => { Writable => 'real' },
FirstPhotoDate => { %dateTimeInfo, Groups => { 2 => 'Time' } },
LastPhotoDate => { %dateTimeInfo, Groups => { 2 => 'Time' } },
SourcePhotosCount => { Writable => 'integer' },
ExposureLockUsed => { Writable => 'boolean' },
CroppedAreaImageWidthPixels => { Writable => 'real' },
CroppedAreaImageHeightPixels => { Writable => 'real' },
FullPanoWidthPixels => { Writable => 'real' },
FullPanoHeightPixels => { Writable => 'real' },
CroppedAreaLeftPixels => { Writable => 'real' },
CroppedAreaTopPixels => { Writable => 'real' },
InitialCameraDolly => { Writable => 'real' },
# (the following have been observed, but are not in the specification)
LargestValidInteriorRectLeft => { Writable => 'real' },
LargestValidInteriorRectTop => { Writable => 'real' },
LargestValidInteriorRectWidth => { Writable => 'real' },
LargestValidInteriorRectHeight => { Writable => 'real' },
);
# Getty Images namespace (ref PH)
%Image::ExifTool::XMP::GettyImages = (
%xmpTableDefaults,
GROUPS => { 1 => 'XMP-getty', 2 => 'Image' },
NAMESPACE => 'GettyImagesGIFT',
NOTES => q{
The actual Getty Images namespace prefix is "GettyImagesGIFT", which is the
prefix recorded in the file, but ExifTool shortens this for the family 1
group name.
},
Personality => { },
OriginalFilename => { Name => 'OriginalFileName' },
ParentMEID => { },
# the following from StarGeek
AssetID => { },
CallForImage => { },
CameraFilename => { },
CameraMakeModel => { Avoid => 1 },
Composition => { },
CameraSerialNumber => { Avoid => 1 },
ExclusiveCoverage => { },
GIFTFtpPriority => { },
ImageRank => { },
MediaEventIdDate => { },
OriginalCreateDateTime => { %dateTimeInfo, Groups => { 2 => 'Time' }, Avoid => 1 },
ParentMediaEventID => { },
PrimaryFTP => { List => 'Bag' },
RoutingDestinations => { List => 'Bag' },
RoutingExclusions => { List => 'Bag' },
SecondaryFTP => { List => 'Bag' },
TimeShot => { },
);
# Google Spherical Images namespace (ref https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md)
%Image::ExifTool::XMP::GSpherical = (
%xmpTableDefaults,
WRITABLE => 0,
GROUPS => { 1 => 'XMP-GSpherical', 2 => 'Image' },
NAMESPACE => 'GSpherical',
NOTES => q{
Not actually XMP. These RDF/XML tags are used in Google spherical MP4
videos. See
L<https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md>
for the specification.
},
Spherical => { },
Stitched => { },
StitchingSoftware => { },
ProjectionType => { },
StereoMode => { },
SourceCount => { },
InitialViewHeadingDegrees => { },
InitialViewPitchDegrees => { },
InitialViewRollDegrees => { },
Timestamp => {
Name => 'TimeStamp',
Groups => { 2 => 'Time' },
ValueConv => 'ConvertUnixTime($val)', #(NC)
PrintConv => '$self->ConvertDateTime($val)',
},
FullPanoWidthPixels => { },
FullPanoHeightPixels => { },
CroppedAreaImageWidthPixels => { },
CroppedAreaImageHeightPixels=> { },
CroppedAreaLeftPixels => { },
CroppedAreaTopPixels => { },
);
# SVG namespace properties (ref 9)
%Image::ExifTool::XMP::SVG = (
GROUPS => { 0 => 'SVG', 1 => 'SVG', 2 => 'Image' },
NAMESPACE => 'svg',
LANG_INFO => \&GetLangInfo,
NOTES => q{
SVG (Scalable Vector Graphics) image tags. By default, only the top-level
SVG and Metadata tags are extracted from these images, but all graphics tags
may be extracted by setting the Unknown option to 2 (-U on the command
line). The SVG tags are not part of XMP as such, but are included with the
XMP module for convenience. (see L<http://www.w3.org/TR/SVG11/>)
},
version => 'SVGVersion',
id => 'ID',
metadataId => 'MetadataID',
width => {
Name => 'ImageWidth',
ValueConv => '$val =~ s/px$//; $val',
},
height => {
Name => 'ImageHeight',
ValueConv => '$val =~ s/px$//; $val',
},
);
# table to add tags in other namespaces
%Image::ExifTool::XMP::otherSVG = (
GROUPS => { 0 => 'SVG', 2 => 'Unknown' },
LANG_INFO => \&GetLangInfo,
NAMESPACE => undef, # variable namespace
);
# set "Avoid" flag for all PRISM tags
my ($table, $key);
foreach $table (
\%Image::ExifTool::XMP::prism,
\%Image::ExifTool::XMP::prl,
\%Image::ExifTool::XMP::pur,
\%Image::ExifTool::XMP::pmi,
\%Image::ExifTool::XMP::prm)
{
foreach $key (TagTableKeys($table)) {
$$table{$key}{Avoid} = 1;
}
}
1; #end
__END__
=head1 NAME
Image::ExifTool::XMP2.pl - Additional XMP namespace definitions
=head1 SYNOPSIS
This module is loaded automatically by Image::ExifTool when required.
=head1 DESCRIPTION
This file contains definitions for less common XMP namespaces.
=head1 AUTHOR
Copyright 2003-2016, Phil Harvey (phil at owl.phy.queensu.ca)
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 REFERENCES
=over 4
=item L<http://ns.useplus.org/>
=item L<http://www.prismstandard.org/>
=item L<http://www.portfoliofaq.com/pfaq/v7mappings.htm>
=item L<http://creativecommons.org/technology/xmp>
=item L<http://www.optimasc.com/products/fileid/xmp-extensions.pdf>
=item L<http://www.w3.org/TR/SVG11/>
=back
=head1 SEE ALSO
L<Image::ExifTool::TagNames/XMP Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
| dmitrypisanko/exif_keywords_generator | exiftool/lib/Image/ExifTool/XMP2.pl | Perl | mit | 48,312 |
#!/usr/bin/env perl
=head1 NAME
AddFamilyTypeCvterm
=head1 SYNOPSIS
mx-run AddFamilyTypeCvterm [options] -H hostname -D dbname -u username [-F]
this is a subclass of L<CXGN::Metadata::Dbpatch>
see the perldoc of parent class for more details.
=head1 DESCRIPTION
This patch adds family_type stock_property cvterm
This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
=head1 AUTHOR
Titima Tantikanjana <tt15@cornell.edu>
=head1 COPYRIGHT & LICENSE
Copyright 2010 Boyce Thompson Institute for Plant Research
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
package AddFamilyTypeCvterm;
use Moose;
use Bio::Chado::Schema;
use Try::Tiny;
use SGN::Model::Cvterm;
extends 'CXGN::Metadata::Dbpatch';
has '+description' => ( default => <<'' );
This patch adds the 'family_type' stock_property cvterm
has '+prereq' => (
default => sub {
[],
},
);
sub patch {
my $self=shift;
print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
print STDOUT "\nExecuting the SQL commands.\n";
my $schema = Bio::Chado::Schema->connect( sub { $self->dbh->clone } );
print STDERR "INSERTING CV TERMS...\n";
my $terms = {
'stock_property' => [
'family_type',
]
};
foreach my $t (keys %$terms){
foreach (@{$terms->{$t}}){
$schema->resultset("Cv::Cvterm")->create_with({
name => $_,
cv => $t
});
}
}
#add missing family_type stockprop
my $family_name_cvterm_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'family_name', 'stock_type')->cvterm_id();
my $family_type_cvterm = SGN::Model::Cvterm->get_cvterm_row($schema, 'family_type', 'stock_property');
my $family_name_rs = $schema->resultset("Stock::Stock")->search({type_id => $family_name_cvterm_id});
if ($family_name_rs) {
while(my $family = $family_name_rs->next()){
my $family_id = $family->stock_id."\n";
my $stored_family_type = $schema->resultset("Stock::Stockprop")->find({ stock_id => $family_id, type_id => $family_type_cvterm->cvterm_id()});
if (!$stored_family_type) {
$family->create_stockprops({$family_type_cvterm->name() => 'same_parents'});
}
}
}
print "You're done!\n";
}
####
1; #
####
| solgenomics/sgn | db/00154/AddFamilyTypeCvterm.pm | Perl | mit | 2,554 |
package WebService::Technorati::AuthorinfoApiQuery;
use strict;
use utf8;
use WebService::Technorati::ApiQuery;
use WebService::Technorati::Author;
use WebService::Technorati::Blog;
use WebService::Technorati::Exception;
use base 'WebService::Technorati::ApiQuery';
use constant API_URI => '/getinfo';
BEGIN {
use vars qw ($VERSION $DEBUG);
$VERSION = 0.04;
$DEBUG = 0;
}
sub new {
my ($class, %params) = @_;
if (! exists $params{'key'}) {
WebService::Technorati::InstantiationException->throw(
"WebService::Technorati::AuthorinfoApiQuery must be " .
"instantiated with at least 'key => theverylongkeystring'");
}
my $data = {};
if (! exists $params{'username'}) {
$data->{'needs_username'}++;
}
for my $k (keys %params) {
$data->{'args'}{$k} = $params{$k};
}
my $self = bless ($data, ref ($class) || $class);
return $self;
}
sub username {
my $self = shift;
my $username = shift;
if ($username) {
$self->{'username'} = $username;
delete($self->{'needs_username'});
}
return $self->{'username'};
}
sub execute {
my $self = shift;
my $apiUrl = $self->apiHostUrl() . API_URI;
if (exists $self->{'needs_username'}) {
WebService::Technorati::StateValidationException->throw(
"WebService::Technorati::AuthorinfoApiQuery must have a " .
"'username' attribute set prior to query execution");
}
$self->SUPER::execute($apiUrl,$self->{'args'});
}
sub readResults {
my $self = shift;
my $result_xp = shift;
my $error = $result_xp->find('/tapi/document/result/error');
if ($error) {
WebService::Technorati::DataException->throw($error);
}
my $nodeset = $result_xp->find("/tapi/document/result");
my $node = $nodeset->shift;
my $authorSubject = WebService::Technorati::Author->new_from_node($node);
$nodeset = $result_xp->find('/tapi/document/item/weblog');
my @blogs = ();
for my $node ($nodeset->get_nodelist) {
my $blog = WebService::Technorati::Blog->new_from_node($node);
push(@blogs, $blog);
}
$self->{'subject'} = $authorSubject;
$self->{'blogs'} = \@blogs;
}
=head2 getSubjectAuthor
Usage : getSubjectAuthor();
Purpose :
Returns : a scalar WebService::Technorati::Author instance
Argument : none
Throws : none
Comments : the member entity (author or not) is returned with what
Technorati knows about it
See Also : WebService::Technorati
=cut
sub getSubjectAuthor {
my $self = shift;
return $self->{'subject'};
}
=head2 getClaimedBlogs
Usage : getClaimedBlogs();
Purpose :
Returns : an array of WebService::Technorati::Blog instances
Argument : none
Throws : none
Comments : the claimed blogs are returned with what Technorati
knows about them
See Also : WebService::Technorati
=cut
sub getClaimedBlogs {
my $self = shift;
return (wantarray) ? @{$self->{'blogs'}} : $self->{'blogs'};
}
1;
| carlgao/lenga | images/lenny64-peon/usr/share/perl5/WebService/Technorati/AuthorinfoApiQuery.pm | Perl | mit | 3,072 |
:-consult('../../Game').
addStrongIAs :- not(addStrongIA), not(addStrongIA).
/* IAs play automatically until one IA win. */
test :- addStrongIAs, startGame. | H4305/battleship | Game/Tests/8. Strong IA play - bug/strongIAPlay.pl | Perl | mit | 158 |
package #
Date::Manip::TZ::ambele00;
# Copyright (c) 2008-2015 Sullivan Beck. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
# This file was automatically generated. Any changes to this file will
# be lost the next time 'tzdata' is run.
# Generated on: Wed Nov 25 11:33:43 EST 2015
# Data version: tzdata2015g
# Code version: tzcode2015g
# This module contains data from the zoneinfo time zone database. The original
# data was obtained from the URL:
# ftp://ftp.iana.org/tz
use strict;
use warnings;
require 5.010000;
our (%Dates,%LastRule);
END {
undef %Dates;
undef %LastRule;
}
our ($VERSION);
$VERSION='6.52';
END { undef $VERSION; }
%Dates = (
1 =>
[
[ [1,1,2,0,0,0],[1,1,1,20,46,4],'-03:13:56',[-3,-13,-56],
'LMT',0,[1914,1,1,3,13,55],[1913,12,31,23,59,59],
'0001010200:00:00','0001010120:46:04','1914010103:13:55','1913123123:59:59' ],
],
1914 =>
[
[ [1914,1,1,3,13,56],[1914,1,1,0,13,56],'-03:00:00',[-3,0,0],
'BRT',0,[1931,10,3,13,59,59],[1931,10,3,10,59,59],
'1914010103:13:56','1914010100:13:56','1931100313:59:59','1931100310:59:59' ],
],
1931 =>
[
[ [1931,10,3,14,0,0],[1931,10,3,12,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1932,4,1,1,59,59],[1932,3,31,23,59,59],
'1931100314:00:00','1931100312:00:00','1932040101:59:59','1932033123:59:59' ],
],
1932 =>
[
[ [1932,4,1,2,0,0],[1932,3,31,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1932,10,3,2,59,59],[1932,10,2,23,59,59],
'1932040102:00:00','1932033123:00:00','1932100302:59:59','1932100223:59:59' ],
[ [1932,10,3,3,0,0],[1932,10,3,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1933,4,1,1,59,59],[1933,3,31,23,59,59],
'1932100303:00:00','1932100301:00:00','1933040101:59:59','1933033123:59:59' ],
],
1933 =>
[
[ [1933,4,1,2,0,0],[1933,3,31,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1949,12,1,2,59,59],[1949,11,30,23,59,59],
'1933040102:00:00','1933033123:00:00','1949120102:59:59','1949113023:59:59' ],
],
1949 =>
[
[ [1949,12,1,3,0,0],[1949,12,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1950,4,16,2,59,59],[1950,4,16,0,59,59],
'1949120103:00:00','1949120101:00:00','1950041602:59:59','1950041600:59:59' ],
],
1950 =>
[
[ [1950,4,16,3,0,0],[1950,4,16,0,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1950,12,1,2,59,59],[1950,11,30,23,59,59],
'1950041603:00:00','1950041600:00:00','1950120102:59:59','1950113023:59:59' ],
[ [1950,12,1,3,0,0],[1950,12,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1951,4,1,1,59,59],[1951,3,31,23,59,59],
'1950120103:00:00','1950120101:00:00','1951040101:59:59','1951033123:59:59' ],
],
1951 =>
[
[ [1951,4,1,2,0,0],[1951,3,31,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1951,12,1,2,59,59],[1951,11,30,23,59,59],
'1951040102:00:00','1951033123:00:00','1951120102:59:59','1951113023:59:59' ],
[ [1951,12,1,3,0,0],[1951,12,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1952,4,1,1,59,59],[1952,3,31,23,59,59],
'1951120103:00:00','1951120101:00:00','1952040101:59:59','1952033123:59:59' ],
],
1952 =>
[
[ [1952,4,1,2,0,0],[1952,3,31,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1952,12,1,2,59,59],[1952,11,30,23,59,59],
'1952040102:00:00','1952033123:00:00','1952120102:59:59','1952113023:59:59' ],
[ [1952,12,1,3,0,0],[1952,12,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1953,3,1,1,59,59],[1953,2,28,23,59,59],
'1952120103:00:00','1952120101:00:00','1953030101:59:59','1953022823:59:59' ],
],
1953 =>
[
[ [1953,3,1,2,0,0],[1953,2,28,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1963,12,9,2,59,59],[1963,12,8,23,59,59],
'1953030102:00:00','1953022823:00:00','1963120902:59:59','1963120823:59:59' ],
],
1963 =>
[
[ [1963,12,9,3,0,0],[1963,12,9,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1964,3,1,1,59,59],[1964,2,29,23,59,59],
'1963120903:00:00','1963120901:00:00','1964030101:59:59','1964022923:59:59' ],
],
1964 =>
[
[ [1964,3,1,2,0,0],[1964,2,29,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1965,1,31,2,59,59],[1965,1,30,23,59,59],
'1964030102:00:00','1964022923:00:00','1965013102:59:59','1965013023:59:59' ],
],
1965 =>
[
[ [1965,1,31,3,0,0],[1965,1,31,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1965,3,31,1,59,59],[1965,3,30,23,59,59],
'1965013103:00:00','1965013101:00:00','1965033101:59:59','1965033023:59:59' ],
[ [1965,3,31,2,0,0],[1965,3,30,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1965,12,1,2,59,59],[1965,11,30,23,59,59],
'1965033102:00:00','1965033023:00:00','1965120102:59:59','1965113023:59:59' ],
[ [1965,12,1,3,0,0],[1965,12,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1966,3,1,1,59,59],[1966,2,28,23,59,59],
'1965120103:00:00','1965120101:00:00','1966030101:59:59','1966022823:59:59' ],
],
1966 =>
[
[ [1966,3,1,2,0,0],[1966,2,28,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1966,11,1,2,59,59],[1966,10,31,23,59,59],
'1966030102:00:00','1966022823:00:00','1966110102:59:59','1966103123:59:59' ],
[ [1966,11,1,3,0,0],[1966,11,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1967,3,1,1,59,59],[1967,2,28,23,59,59],
'1966110103:00:00','1966110101:00:00','1967030101:59:59','1967022823:59:59' ],
],
1967 =>
[
[ [1967,3,1,2,0,0],[1967,2,28,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1967,11,1,2,59,59],[1967,10,31,23,59,59],
'1967030102:00:00','1967022823:00:00','1967110102:59:59','1967103123:59:59' ],
[ [1967,11,1,3,0,0],[1967,11,1,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1968,3,1,1,59,59],[1968,2,29,23,59,59],
'1967110103:00:00','1967110101:00:00','1968030101:59:59','1968022923:59:59' ],
],
1968 =>
[
[ [1968,3,1,2,0,0],[1968,2,29,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1985,11,2,2,59,59],[1985,11,1,23,59,59],
'1968030102:00:00','1968022923:00:00','1985110202:59:59','1985110123:59:59' ],
],
1985 =>
[
[ [1985,11,2,3,0,0],[1985,11,2,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1986,3,15,1,59,59],[1986,3,14,23,59,59],
'1985110203:00:00','1985110201:00:00','1986031501:59:59','1986031423:59:59' ],
],
1986 =>
[
[ [1986,3,15,2,0,0],[1986,3,14,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1986,10,25,2,59,59],[1986,10,24,23,59,59],
'1986031502:00:00','1986031423:00:00','1986102502:59:59','1986102423:59:59' ],
[ [1986,10,25,3,0,0],[1986,10,25,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1987,2,14,1,59,59],[1987,2,13,23,59,59],
'1986102503:00:00','1986102501:00:00','1987021401:59:59','1987021323:59:59' ],
],
1987 =>
[
[ [1987,2,14,2,0,0],[1987,2,13,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[1987,10,25,2,59,59],[1987,10,24,23,59,59],
'1987021402:00:00','1987021323:00:00','1987102502:59:59','1987102423:59:59' ],
[ [1987,10,25,3,0,0],[1987,10,25,1,0,0],'-02:00:00',[-2,0,0],
'BRST',1,[1988,2,7,1,59,59],[1988,2,6,23,59,59],
'1987102503:00:00','1987102501:00:00','1988020701:59:59','1988020623:59:59' ],
],
1988 =>
[
[ [1988,2,7,2,0,0],[1988,2,6,23,0,0],'-03:00:00',[-3,0,0],
'BRT',0,[9999,12,31,0,0,0],[9999,12,30,21,0,0],
'1988020702:00:00','1988020623:00:00','9999123100:00:00','9999123021:00:00' ],
],
);
%LastRule = (
);
1;
| jkb78/extrajnm | local/lib/perl5/Date/Manip/TZ/ambele00.pm | Perl | mit | 7,852 |
package Paws::Net::SigninCaller;
use Moose::Role;
use JSON::MaybeXS;
use URI::Template;
sub _call_uri {
my ($self, $call, $qparams) = @_;
my $uri_template = $call->meta->name->_api_uri;
my $t = URI::Template->new( $uri_template );
my $uri = $t->process({});
$uri->query_form(%$qparams);
return $uri->as_string;
}
sub prepare_request_for_call {
my ($self, $call) = @_;
my $request = Paws::Net::APIRequest->new();
$request->method('GET');
my $qparams;
if ($call->_api_call eq 'getSigninToken') {
#Until we have a way to declare objects that get json-encoded to API calls, we
#will have to "hand-encode" the Session Parameter
$qparams = { Action => $call->_api_call,
SessionType => 'json',
(defined $call->SessionDuration)?(SessionDuration => $call->SessionDuration):(),
Session => encode_json({
sessionId => $call->SessionId,
sessionKey => $call->SessionKey,
sessionToken => $call->SessionToken
}),
};
} elsif ($call->_api_call eq 'login') {
$qparams = { Action => $call->_api_call,
Destination => $call->Destination,
Issuer => $call->Issuer,
SigninToken => $call->SigninToken
};
} else {
die "Don't know how to call " . $call->_api_call;
}
my $uri = $self->_call_uri($call, $qparams);
$request->url($self->_api_endpoint . $uri);
$request->uri($uri);
$self->sign($request);
return $request;
}
1;
| ioanrogers/aws-sdk-perl | lib/Paws/Net/SigninCaller.pm | Perl | apache-2.0 | 1,648 |
package Google::Ads::AdWords::v201402::Feed::Status;
use strict;
use warnings;
sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201402'};
# derivation by restriction
use base qw(
SOAP::WSDL::XSD::Typelib::Builtin::string);
1;
__END__
=pod
=head1 NAME
=head1 DESCRIPTION
Perl data type class for the XML Schema defined simpleType
Feed.Status from the namespace https://adwords.google.com/api/adwords/cm/v201402.
Status of the Feed.
This clase is derived from
SOAP::WSDL::XSD::Typelib::Builtin::string
. SOAP::WSDL's schema implementation does not validate data, so you can use it exactly
like it's base type.
# Description of restrictions not implemented yet.
=head1 METHODS
=head2 new
Constructor.
=head2 get_value / set_value
Getter and setter for the simpleType's value.
=head1 OVERLOADING
Depending on the simple type's base type, the following operations are overloaded
Stringification
Numerification
Boolification
Check L<SOAP::WSDL::XSD::Typelib::Builtin> for more information.
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
| gitpan/GOOGLE-ADWORDS-PERL-CLIENT | lib/Google/Ads/AdWords/v201402/Feed/Status.pm | Perl | apache-2.0 | 1,081 |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. 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 Search::Elasticsearch::Client::6_0::Direct::XPack::SQL;
use Moo;
with 'Search::Elasticsearch::Client::6_0::Role::API';
with 'Search::Elasticsearch::Role::Client::Direct';
use namespace::clean;
__PACKAGE__->_install_api('xpack.sql');
1;
# ABSTRACT: Plugin providing SQL for Search::Elasticsearch 6.x
=head1 SYNOPSIS
my $response = $es->xpack->sql->query( body => {...} )
=head2 DESCRIPTION
This class extends the L<Search::Elasticsearch> client with an C<sql>
namespace, to support the
L<SQL APIs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html>.
The full documentation for the SQL feature is available here:
L<https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html>
=head1 GENERAL METHODS
=head2 C<query()>
$response = $es->xpack->sql->query(
body => {...} # required
)
The C<query()> method executes an SQL query and returns the results.
Query string parameters:
C<error_trace>,
C<filter_path>,
C<format>,
C<human>
See the L<query docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html>
for more information.
=head2 C<translate()>
$response = $es->xpack->sql->translate(
body => {...} # required
)
The C<translate()> method takes an SQL query and returns the query DSL which would be executed.
Query string parameters:
C<error_trace>,
C<filter_path>,
C<human>
See the L<translate docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate.html>
for more information.
=head2 C<clear_cursor()>
$response = $es->xpack->sql->clear_cursor(
body => {...} # required
)
The C<clear_cursor()> method cleans up an ongoing scroll request.
Query string parameters:
C<error_trace>,
C<filter_path>,
C<human>
See the L<query docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html>
for more information.
| elastic/elasticsearch-perl | lib/Search/Elasticsearch/Client/6_0/Direct/XPack/SQL.pm | Perl | apache-2.0 | 2,734 |
#
# Copyright 2021 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::inin::mediaserver::snmp::mode::component;
use base qw(centreon::plugins::templates::hardware);
use strict;
use warnings;
sub set_system {
my ($self, %options) = @_;
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
device => [
['unknown', 'UNKNOWN'],
['up', 'OK'],
['down', 'CRITICAL'],
['congested', 'WARNING'],
['restarting', 'OK'],
['quiescing', 'OK'],
['testing', 'OK'],
],
};
$self->{components_path} = 'apps::inin::mediaserver::snmp::mode::components';
$self->{components_module} = ['device'];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_performance => 1, no_load_components => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
});
return $self;
}
sub snmp_execute {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
}
1;
=head1 MODE
Check hardware devices.
=over 8
=item B<--component>
Which component to check (Default: '.*').
Can be: 'device'.
=item B<--no-component>
Return an error if no compenents are checked.
If total (with skipped) is 0. (Default: 'critical' returns).
=item B<--threshold-overload>
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='device,WARNING,restarting'
=back
=cut
package apps::inin::mediaserver::snmp::mode::components::device;
use strict;
use warnings;
my %map_status = (1 => 'unknown', 2 => 'up', 3 => 'down', 4 => 'congested',
5 => 'restarting', 6 => 'quiescing', 7 => 'testing'
);
my $mapping = {
i3MsGeneralInfoOperStatus => { oid => '.1.3.6.1.4.1.2793.8227.1.2', map => \%map_status },
};
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $mapping->{i3MsGeneralInfoOperStatus}->{oid} };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking devices");
$self->{components}->{device} = {name => 'devices', total => 0, skip => 0};
return if ($self->check_filter(section => 'device'));
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{i3MsGeneralInfoOperStatus}->{oid}}, instance => '0');
return if (!defined($result->{i3MsGeneralInfoOperStatus}));
$self->{components}->{device}->{total}++;
$self->{output}->output_add(long_msg => sprintf("device status is '%s' [instance = %s]",
$result->{i3MsGeneralInfoOperStatus}, '0'));
my $exit = $self->get_severity(section => 'device', value => $result->{i3MsGeneralInfoOperStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Device status is '%s'", $result->{i3MsGeneralInfoOperStatus}));
}
}
1;
| Tpo76/centreon-plugins | apps/inin/mediaserver/snmp/mode/component.pm | Perl | apache-2.0 | 4,012 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is part of VivoMind Prolog Unicode Resources
% SPDX-License-Identifier: CC0-1.0
%
% VivoMind Prolog Unicode Resources is free software distributed using the
% Creative Commons CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication
% license
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Last modified: April 27, 2013
% from the Unicode 6.2 "UnicodeData.txt" official file:
% D800;<Non Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;;
% DB7F;<Non Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;;
unicode_category_range_(0xD800, 0xDB7F, 'Cs').
% DB80;<Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;;
% DBFF;<Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;;
unicode_category_range_(0xDB80, 0xDBFF, 'Cs').
% DC00;<Low Surrogate, First>;Cs;0;L;;;;;N;;;;;
% DFFF;<Low Surrogate, Last>;Cs;0;L;;;;;N;;;;;
unicode_category_range_(0xDC00, 0xDFFF, 'Cs').
| LogtalkDotOrg/logtalk3 | library/unicode_data/unicode_categories/unicode_category_cs_other_surrogate.pl | Perl | apache-2.0 | 999 |
package VMOMI::DvsNetworkRuleQualifier;
use parent 'VMOMI::DynamicData';
use strict;
use warnings;
our @class_ancestors = (
'DynamicData',
);
our @class_members = (
['key', undef, 0, 1],
);
sub get_class_ancestors {
return @class_ancestors;
}
sub get_class_members {
my $class = shift;
my @super_members = $class->SUPER::get_class_members();
return (@super_members, @class_members);
}
1;
| stumpr/p5-vmomi | lib/VMOMI/DvsNetworkRuleQualifier.pm | Perl | apache-2.0 | 420 |
=head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
=cut
=head1 NAME
Bio::EnsEMBL::PredictionExon - A class representing an Exon from an ab
initio prediction method
=head1 SYNOPSIS
$exon = new Bio::EnsEMBL::PredictionExon(
-START => 100,
-END => 200,
-STRAND => 1,
-SLICE => $slice,
-DBID => $dbID,
-P_VALUE => 23.5,
-SCORE => 99
);
# seq() returns a Bio::Seq
my $seq = $exon->seq->seq();
# peptide() only makes sense within transcript context
my $pep = $exon->peptide($transcript)->seq();
# Normal feature operations can be performed:
$exon = $exon->transform('clone');
$exon->move( $new_start, $new_end, $new_strand );
print $exon->slice->seq_region_name();
=head1 DESCRIPTION
This is a class which represents an prediction exon which is part of a
predcition transcript. See Bio::EnsEMBL:PredictionTranscript
=head1 METHODS
=cut
package Bio::EnsEMBL::PredictionExon;
use vars qw(@ISA);
use strict;
use Bio::EnsEMBL::Feature;
use Bio::EnsEMBL::Exon;
use Bio::EnsEMBL::Utils::Exception qw( warning throw deprecate );
use Bio::EnsEMBL::Utils::Argument qw( rearrange );
@ISA = qw(Bio::EnsEMBL::Exon);
=head2 new
Args : see SUPERCLASS Bio::EnsEMBL::Exon
Example : none
Description: create an Exon object
Returntype : Bio::EnsEMBL::PredictionExon
Exceptions : none
Caller : general
Status : Stable
=cut
sub new {
my $class = shift;
$class = ref $class || $class;
my $self = $class->SUPER::new( @_ );
my ( $p_value, $score ) =
rearrange( [ "P_VALUE", "SCORE" ], @_ );
$self->{'p_value'} = $p_value;
$self->{'score'} = $score;
return $self;
}
=head2 score
Arg [1] : string $newval (optional)
The new value to set the score attribute to
Example : $score = $obj->score()
Description: Getter/Setter for the score attribute
Returntype : string
Exceptions : none
Caller : general
Status : Stable
=cut
sub score{
my $self = shift;
$self->{'score'} = shift if(@_);
return $self->{'score'};
}
=head2 p_value
Arg [1] : string $newval (optional)
The new value to set the p_value attribute to
Example : $p_value = $obj->p_value()
Description: Getter/Setter for the p_value attribute
Returntype : string
Exceptions : none
Caller : general
Status : Stable
=cut
sub p_value{
my $self = shift;
$self->{'p_value'} = shift if(@_);
return $self->{'p_value'};
}
=head2 end_phase
Arg [1] : (optional) int $end_phase
Example : $end_phase = $feat->end_phase;
Description: Gets/Sets the end phase of the exon.
end_phase = number of bases from the last incomplete codon of
this exon.
Usually, end_phase = (phase + exon_length)%3
but end_phase could be -1 if the exon is half-coding and its 3
prime end is UTR.
Returntype : int
Exceptions : warning if end_phase is called without an argument and the
value is not set.
Caller : general
Status : Stable
=cut
sub end_phase {
my $self = shift;
if( @_ ) {
throw( "End_phase setting not supported" );
}
return ($self->phase() + $self->length()) % 3;
}
=head2 transform
Arg 1 : String $coordinate_system_name
Arg [2] : String $coordinate_system_version
Description: moves this exon to the given coordinate system. If this exon has
attached supporting evidence, they move as well.
Returntype : Bio::EnsEMBL::Exon
Exceptions : wrong parameters
Caller : general
Status : Stable
=cut
sub transform {
my $self = shift;
# catch for old style transform calls
if( !@_ || ( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" )))) {
throw( "transform needs coordinate systems details now," .
"please use transfer" );
}
my $new_exon = Bio::EnsEMBL::Feature::transform( $self, @_ );
return undef unless $new_exon;
#dont want to share the same sequence cache
delete $new_exon->{'_seq_cache'};
return $new_exon;
}
=head2 transfer
Arg [1] : Bio::EnsEMBL::Slice $destination_slice
Example : none
Description: Moves this Exon to given target slice coordinates. If Features
are attached they are moved as well. Returns a new exon.
Returntype : Bio::EnsEMBL::Gene
Exceptions : none
Caller : general
Status : Stable
=cut
sub transfer {
my $self = shift;
my $new_exon = Bio::EnsEMBL::Feature::transfer( $self, @_ );
return undef unless $new_exon;
#dont want to share the same sequence cache
delete $new_exon->{'_seq_cache'};
return $new_exon;
}
=head2 add_supporting_features
Description: For compatibility with Bio::EnsEMBL::Exon
Does nothing.
Returntype : none
Status : Stable
=cut
sub add_supporting_features { }
=head2 get_all_supporting_features
Description: For compatibility with Bio::EnsEMBL::Exon
Does nothing and returns empty list
Returntype : empty list.
Status : Stable
=cut
sub get_all_supporting_features { return []; }
=head2 find_supporting_evidence
Description: For compatibility with Bio::EnsEMBL::Exon
Does nothing.
Returntype : empty list.
Status : Stable
=cut
sub find_supporting_evidence { return []; }
1;
| at7/ensembl | modules/Bio/EnsEMBL/PredictionExon.pm | Perl | apache-2.0 | 6,236 |
=head1 LICENSE
Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
=cut
=head1 NAME
Bio::EnsEMBL::Variation::DBSQL::MotifFeatureVariationAdaptor
=head1 SYNOPSIS
my $reg = 'Bio::EnsEMBL::Registry';
$reg->load_registry_from_db(-host => 'ensembldb.ensembl.org',-user => 'anonymous');
my $mfa = $reg->get_adaptor('human', 'funcgen', 'MotifFeature');
my $va = $reg->get_adaptor('human', 'variation', 'Variation');
my $vfa = $reg->get_adaptor('human', 'variation', 'VariationFeature');
my $mfva = $reg->get_adaptor('human','variation','MotifFeatureVariation');
# fetch MotifFeature by dbID
my $mf_dbID = 928174;
my $mf = $mfa->fetch_by_dbID($mf_dbID);
# fetch all MotifFeatureVariations falling in the MotifFeature
my $mfvs = $mfva->fetch_all_by_MotifFeatures([$mf]);
# fetch by VariationFeatures
my $variation_name = 'rs191666497';
my $v = $va->fetch_by_name($variation_name);
my $vfs = $vfa->fetch_all_by_Variation($v);
# fetch all MotifFeatureVariations for the list of VariationFeatures
$mfvs = $mfva->fetch_all_by_VariationFeatures($vfs);
=head1 DESCRIPTION
This adaptor allows you to fetch MotifFeatureVariation objects either by the MotifFeature
the associated VariationFeature falls in, or by VariationFeature directly. Storing
MotifFeatureVariation objects in a variation schema database is also supported. In the
database there will be a separate row for each alternative allele of a MotifFeatureVariation,
but the methods here will fetch all alleles associated with the MotifFeatureVariation
at once.
=cut
use strict;
use warnings;
package Bio::EnsEMBL::Variation::DBSQL::MotifFeatureVariationAdaptor;
use Bio::EnsEMBL::Variation::MotifFeatureVariation;
use Bio::EnsEMBL::Variation::MotifFeatureVariationAllele;
use Bio::EnsEMBL::Utils::Exception qw(throw warning);
use Bio::EnsEMBL::Variation::Utils::Constants qw(%OVERLAP_CONSEQUENCES);
use base qw(Bio::EnsEMBL::Variation::DBSQL::VariationFeatureOverlapAdaptor);
=head2 store
Arg [1] : Bio::EnsEMBL::Variation::MotifFeatureVariation $mfv
Description: Store the MotifFeatureVariation in the database
Status : At risk
=cut
sub store {
my ($self, $mfv, $rf) = @_;
my $dbh = $self->dbc->db_handle;
my $sth = $dbh->prepare_cached(q{
INSERT DELAYED INTO motif_feature_variation (
variation_feature_id,
feature_stable_id,
motif_feature_id,
allele_string,
somatic,
consequence_types,
motif_name,
motif_start,
motif_end,
motif_score_delta,
in_informative_position
) VALUES (?,?,?,?,?,?,?,?,?,?,?)
});
for my $allele (@{ $mfv->get_all_alternate_MotifFeatureVariationAlleles }) {
$sth->execute(
$mfv->variation_feature->dbID,
$rf->stable_id,
$mfv->feature->dbID,
$allele->allele_string,
$mfv->variation_feature->is_somatic,
(join ',', map { $_->SO_term } @{ $allele->get_all_OverlapConsequences }),
$mfv->motif_feature->display_label,
$allele->motif_start,
$allele->motif_end,
$allele->motif_score_delta,
$allele->in_informative_position,
);
}
}
=head2 fetch_all_by_MotifFeatures
Arg [1] : listref of Bio::EnsEMBL::Funcgen::MotifFeature
Description: Fetch all germline MotifFeatureVariations associated with the
given list of MotifFeatures
Returntype : listref of Bio::EnsEMBL::Variation::MotifFeatureVariation
Status : Stable
=cut
sub fetch_all_by_MotifFeatures {
my ($self, $motif_features) = @_;
my $regulatory_features = $self->_associated_regulatory_features($motif_features);
return $self->fetch_all_by_MotifFeatures_with_constraint($regulatory_features, $motif_features, 'somatic = 0');
}
=head2 fetch_all_somatic_by_MotifFeatures
Arg [1] : listref of Bio::EnsEMBL::Funcgen::MotifFeature
Description: Fetch all somatic MotifFeatureVariations associated with the
given list of MotifFeatures
Returntype : listref of Bio::EnsEMBL::Variation::MotifFeatureVariation
Status : Stable
=cut
sub fetch_all_somatic_by_MotifFeatures {
my ($self, $motif_features) = @_;
my $regulatory_features = $self->_associated_regulatory_features($motif_features);
return $self->fetch_all_by_MotifFeatures_with_constraint($regulatory_features, $motif_features, 'somatic = 1');
}
=head2 fetch_all_by_MotifFeatures_SO_terms
Arg [1] : listref of Bio::EnsEMBL::Funcgen::MotifFeature
Arg [2] : listref of SO terms
Description: Fetch all germline MotifFeatureVariations associated with the
given list of MotifFeatures and with consequences from given list of SO terms
Returntype : listref of Bio::EnsEMBL::Variation::MotifFeatureVariation
Status : At risk
=cut
sub fetch_all_by_MotifFeatures_SO_terms {
my ($self, $motif_features, $terms) = @_;
my $regulatory_features = $self->_associated_regulatory_features($motif_features);
my $constraint = $self->_get_consequence_constraint($terms);
return $self->fetch_all_by_MotifFeatures_with_constraint($regulatory_features, $motif_features, $constraint.' AND somatic = 0');
}
=head2 fetch_all_somatic_by_MotifFeatures_SO_terms
Arg [1] : listref of Bio::EnsEMBL::Funcgen::MotifFeature
Arg [2] : listref of SO terms
Description: Fetch all somatic MotifFeatureVariations associated with the
given list of MotifFeatures and with consequences from given list of SO terms
Returntype : listref of Bio::EnsEMBL::Variation::MotifFeatureVariation
Status : At risk
=cut
sub fetch_all_somatic_by_MotifFeatures_SO_terms {
my ($self, $motif_features, $terms) = @_;
my $regulatory_features = $self->_associated_regulatory_features($motif_features);
my $constraint = $self->_get_consequence_constraint($terms);
return $self->fetch_all_by_MotifFeatures_with_constraint($regulatory_features, $motif_features, $constraint.' AND somatic = 1');
}
sub _associated_regulatory_features {
my ($self, $motif_features) = @_;
my $rfa = Bio::EnsEMBL::DBSQL::MergedAdaptor->new(
-species => $self->db->species,
-type => 'RegulatoryFeature',
);
my @regulatory_features;
for my $mf (@$motif_features) {
my $rf = $rfa->fetch_all_by_attribute_feature($mf)->[0];
push @regulatory_features, $rf;
}
return \@regulatory_features;
}
=head2 fetch_all_by_VariationFeatures_SO_terms
Arg [1] : listref of Bio::EnsEMBL::Variation::VariationFeature
Arg [2] : listref of SO terms
Description: Fetch all germline MotifFeatureVariations associated with the
given list of VariationFeatures and with consequences from given list of SO terms
Returntype : listref of Bio::EnsEMBL::Variation::MotifFeatureVariation
Status : At risk
=cut
sub fetch_all_by_VariationFeatures_SO_terms {
my ($self, $vfs, $motif_features, $terms, $without_children, $included_so) = @_;
my $constraint = $self->_get_consequence_constraint($terms, $without_children, $included_so);
if (!$constraint) {
return [];
}
return $self->SUPER::fetch_all_by_VariationFeatures_with_constraint($vfs, $motif_features, $constraint);
}
=head2 count_all_by_VariationFeatures_SO_terms
Arg [1] : listref of Bio::EnsEMBL::Variation::VariationFeatures
Arg [2] : listref of SO terms
Description: Count MotifFeatureVariations associated with given
VariationFeatures and with consequences from given list of SO terms
Returntype : int
Status : At risk
=cut
sub count_all_by_VariationFeatures_SO_terms {
my ($self, $vfs, $motif_features, $terms, $included_so) = @_;
my $constraint = $self->_get_consequence_constraint($terms, 1, $included_so);
if (!$constraint) {
return 0;
}
return $self->SUPER::count_all_by_VariationFeatures_with_constraint($vfs, $motif_features, $constraint);
}
=head2 fetch_all_by_MotifFeatures_with_constraint
Arg [1] : listref of Bio::EnsEMBL::Funcgen::MotifFeature
Arg [2] : extra SQL constraint for the query
Description: Fetch all MotifFeatureVariations associated with the
given list of MotifFeatures
Returntype : listref of Bio::EnsEMBL::Variation::MotifFeatureVariation
Status : At risk
=cut
sub fetch_all_by_MotifFeatures_with_constraint {
my ($self, $regulatory_features, $motif_features, $constraint) = @_;
my $mf_ids = join ',', map {$_->dbID} @$motif_features;
my $features = $self->SUPER::fetch_all_by_Features_with_constraint($regulatory_features, $constraint . " AND motif_feature_id IN ($mf_ids)");
for my $feature (@$features) {
$feature->{feature} = undef;
$feature->{feature} = $feature->motif_feature;
}
return $features;
}
sub _objs_from_sth {
my ($self, $sth) = @_;
#warn $sth->sql;
my (
$motif_feature_variation_id,
$variation_feature_id,
$feature_stable_id,
$motif_feature_id,
$allele_string,
$somatic,
$consequence_types,
$motif_name,
$motif_start,
$motif_end,
$motif_score_delta,
$in_informative_position,
);
$sth->bind_columns(
\$motif_feature_variation_id,
\$variation_feature_id,
\$feature_stable_id,
\$motif_feature_id,
\$allele_string,
\$somatic,
\$consequence_types,
\$motif_name,
\$motif_start,
\$motif_end,
\$motif_score_delta,
\$in_informative_position,
);
my %mfvs;
while ($sth->fetch) {
my ($ref_allele, $alt_allele) = split /\//, $allele_string;
my $key = $variation_feature_id.'_'.$feature_stable_id.'_'.$motif_feature_id;
my $mfv = $mfvs{$key};
unless ($mfv) {
$mfv = Bio::EnsEMBL::Variation::MotifFeatureVariation->new_fast({
_variation_feature_id => $variation_feature_id,
_feature_stable_id => $feature_stable_id,
regulatory_feature_stable_id => $feature_stable_id,
motif_feature_id => $motif_feature_id,
motif_name => $motif_name,
adaptor => $self,
});
$mfvs{$key} = $mfv;
my $ref_allele = Bio::EnsEMBL::Variation::MotifFeatureVariationAllele->new_fast({
is_reference => 1,
variation_feature_seq => $ref_allele,
motif_feature_variation => $mfv,
motif_start => $motif_start,
motif_end => $motif_end,
dbID => $motif_feature_variation_id,
});
$mfv->add_MotifFeatureVariationAllele($ref_allele);
}
my $overlap_consequences = [ map { $OVERLAP_CONSEQUENCES{$_} } split /,/, $consequence_types ];
my $allele = Bio::EnsEMBL::Variation::MotifFeatureVariationAllele->new_fast({
is_reference => 0,
variation_feature_seq => $alt_allele,
motif_feature_variation => $mfv,
overlap_consequences => $overlap_consequences,
motif_start => $motif_start,
motif_end => $motif_end,
motif_score_delta => $motif_score_delta,
in_informative_position => $in_informative_position,
dbID => $motif_feature_variation_id,
});
$mfv->add_MotifFeatureVariationAllele($allele);
}
return [values %mfvs];
}
sub _tables {
return (
['motif_feature_variation', 'mfv']
);
}
sub _columns {
return
qw(
motif_feature_variation_id
variation_feature_id
feature_stable_id
motif_feature_id
allele_string
somatic
consequence_types
motif_name
motif_start
motif_end
motif_score_delta
in_informative_position
);
}
1;
| dbolser-ebi/ensembl-variation | modules/Bio/EnsEMBL/Variation/DBSQL/MotifFeatureVariationAdaptor.pm | Perl | apache-2.0 | 13,204 |
package Paws::CloudDirectory::ListFacetNames;
use Moose;
has MaxResults => (is => 'ro', isa => 'Int');
has NextToken => (is => 'ro', isa => 'Str');
has SchemaArn => (is => 'ro', isa => 'Str', traits => ['ParamInHeader'], header_name => 'x-amz-data-partition', required => 1);
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'ListFacetNames');
class_has _api_uri => (isa => 'Str', is => 'ro', default => '/amazonclouddirectory/2017-01-11/facet/list');
class_has _api_method => (isa => 'Str', is => 'ro', default => 'POST');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::CloudDirectory::ListFacetNamesResponse');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::CloudDirectory::ListFacetNames - Arguments for method ListFacetNames on Paws::CloudDirectory
=head1 DESCRIPTION
This class represents the parameters used for calling the method ListFacetNames on the
Amazon CloudDirectory service. Use the attributes of this class
as arguments to method ListFacetNames.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to ListFacetNames.
As an example:
$service_obj->ListFacetNames(Att1 => $value1, Att2 => $value2, ...);
Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object.
=head1 ATTRIBUTES
=head2 MaxResults => Int
The maximum number of results to retrieve.
=head2 NextToken => Str
The pagination token.
=head2 B<REQUIRED> SchemaArn => Str
The Amazon Resource Name (ARN) to retrieve facet names from.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method ListFacetNames in L<Paws::CloudDirectory>
=head1 BUGS and CONTRIBUTIONS
The source code is located here: https://github.com/pplu/aws-sdk-perl
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues
=cut
| ioanrogers/aws-sdk-perl | auto-lib/Paws/CloudDirectory/ListFacetNames.pm | Perl | apache-2.0 | 2,130 |
#!/usr/bin/perl
package Format::MergeFastq;
use strict;
use warnings;
use File::Basename;
use CQS::PBS;
use CQS::ConfigUtils;
use CQS::SystemUtils;
use CQS::FileUtils;
use CQS::Task;
use CQS::StringUtils;
our @ISA = qw(CQS::Task);
sub new {
my ($class) = @_;
my $self = $class->SUPER::new();
$self->{_name} = __PACKAGE__;
$self->{_suffix} = "_mf";
bless $self, $class;
return $self;
}
sub perform {
my ( $self, $config, $section ) = @_;
my ( $task_name, $path_file, $pbs_desc, $target_dir, $log_dir, $pbs_dir, $result_dir, $option, $sh_direct, $cluster ) = $self->init_parameter( $config, $section );
my $ispaired = get_is_paired_end_option( $config, $section );
my $is_collated = get_option( $config, $section, "is_collated", 0 );
my $is_bzipped = get_option( $config, $section, "is_bzipped", 0 );
my $cat_command = $is_bzipped ? "bzcat" : "zcat";
my %raw_files = %{ get_raw_files( $config, $section ) };
my $shfile = $self->get_task_filename( $pbs_dir, $task_name );
open( my $sh, ">$shfile" ) or die "Cannot create $shfile";
print $sh get_run_command($sh_direct) . "\n";
for my $sample_name ( sort keys %raw_files ) {
my @sample_files = @{ $raw_files{$sample_name} };
my $pbs_file = $self->get_pbs_filename( $pbs_dir, $sample_name );
my $pbs_name = basename($pbs_file);
my $log = $self->get_log_filename( $log_dir, $sample_name );
print $sh "\$MYCMD ./$pbs_name \n";
if ($ispaired) {
my $final_1_fastq = $sample_name . ".1.fastq";
my $final_1_file = $sample_name . ".1.fastq.gz";
my $final_2_fastq = $sample_name . ".2.fastq";
my $final_2_file = $sample_name . ".2.fastq.gz";
my $log_desc = $cluster->get_log_description($log);
my $pbs = $self->open_pbs( $pbs_file, $pbs_desc, $log_desc, $path_file, $result_dir, $final_1_file );
my $file_count = scalar(@sample_files);
die "file count $file_count is not even for sample $sample_name @sample_files " if $file_count % 2 != 0;
if ( ( scalar(@sample_files) == 2 ) && ( !$is_bzipped ) ) {
print $pbs "ln -s $sample_files[0] $final_1_file \n";
print $pbs "ln -s $sample_files[1] $final_2_file \n";
#print $pbs "cp $sample_files[0] $final_file \n";
}
else {
print $pbs "
if [ -s $final_1_fastq ]; then
rm $final_1_fastq
fi
if [ -s $final_2_fastq ]; then
rm $final_2_fastq
fi
";
if ($is_collated) {
for ( my $sample_index = 0 ; $sample_index < $file_count / 2 ; $sample_index++ ) {
my $curSample = $sample_files[$sample_index];
my $curCommand = $cat_command;
if ($curSample =~ /.gz$/){
$curCommand = "zcat";
}
print $pbs "
echo merging $sample_files[$sample_index] ...
$curCommand $sample_files[$sample_index] >> $final_1_fastq
";
}
for ( my $sample_index = $file_count / 2 ; $sample_index < $file_count ; $sample_index++ ) {
my $curSample = $sample_files[$sample_index];
my $curCommand = ($curSample =~ /.gz$/)?"zcat":$cat_command;
print $pbs "
echo merging $sample_files[$sample_index] ...
$curCommand $sample_files[$sample_index] >> $final_2_fastq
";
}
}
else {
for ( my $sample_index = 0 ; $sample_index < $file_count ; $sample_index += 2 ) {
my $curSample = $sample_files[$sample_index];
my $curCommand = ($curSample =~ /.gz$/)?"zcat":$cat_command;
print $pbs "
echo merging $sample_files[$sample_index] ...
$curCommand $sample_files[$sample_index] >> $final_1_fastq
echo merging $sample_files[$sample_index+1] ...
$curCommand $sample_files[$sample_index+1] >> $final_2_fastq
";
}
}
print $pbs "
echo gzipping $final_1_fastq ...
gzip $final_1_fastq
echo gzipping $final_2_fastq ...
gzip $final_2_fastq
";
}
$self->close_pbs( $pbs, $pbs_file );
}
else {
my $final_fastq = $sample_name . ".fastq";
my $final_file = $sample_name . ".fastq.gz";
my $log_desc = $cluster->get_log_description($log);
my $pbs = $self->open_pbs( $pbs_file, $pbs_desc, $log_desc, $path_file, $result_dir, $final_file );
if ( scalar(@sample_files) == 1 ) {
print $pbs "ln -s $sample_files[0] $final_file \n";
#print $pbs "cp $sample_files[0] $final_file \n";
}
else {
print $pbs "if [ -s $final_fastq ]; then
rm $final_fastq
fi
";
for my $sample_file (@sample_files) {
my $curCommand = ($sample_file =~ /.gz$/)?"zcat":$cat_command;
print $pbs "
echo merging $sample_file ...
$curCommand $sample_file >> $final_fastq
";
}
print $pbs "
echo gzipping $final_fastq ...
gzip $final_fastq \n";
}
$self->close_pbs( $pbs, $pbs_file );
}
}
close $sh;
if ( is_linux() ) {
chmod 0755, $shfile;
}
print "!!!shell file $shfile created, you can run this shell file to submit all Bam2Fastq tasks.\n";
#`qsub $pbs_file`;
}
sub result {
my ( $self, $config, $section, $pattern ) = @_;
my ( $task_name, $path_file, $pbs_desc, $target_dir, $log_dir, $pbs_dir, $result_dir, $option, $sh_direct ) = $self->init_parameter( $config, $section, 0 );
my $ispaired = get_is_paired_end_option( $config, $section );
my %raw_files = %{ get_raw_files( $config, $section ) };
my $result = {};
for my $sample_name ( keys %raw_files ) {
my @result_files = ();
if ($ispaired) {
my $final_1_file = $sample_name . ".1.fastq.gz";
my $final_2_file = $sample_name . ".2.fastq.gz";
push( @result_files, $result_dir . "/" . $final_1_file );
push( @result_files, $result_dir . "/" . $final_2_file );
}
else {
my $final_file = $sample_name . ".fastq.gz";
push( @result_files, $result_dir . "/" . $final_file );
}
$result->{$sample_name} = filter_array( \@result_files, $pattern );
}
return $result;
}
1;
| shengqh/ngsperl | lib/Format/MergeFastq.pm | Perl | apache-2.0 | 6,012 |
=head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
=cut
=head1 NAME
Bio::EnsEMBL::ApiVersion
=head1 SYNOPSIS
use Bio::EnsEMBL::ApiVersion;
printf( "The API version used is %s\n", software_version() );
=head1 DESCRIPTION
The module exports the software_version() subroutine which returns the
release version of the Ensembl Core API.
=cut
package Bio::EnsEMBL::ApiVersion;
use strict;
use warnings;
use Exporter;
use base qw( Exporter );
our @EXPORT = qw( software_version );
my $API_VERSION = 79;
sub software_version { return $API_VERSION }
1;
| at7/ensembl | modules/Bio/EnsEMBL/ApiVersion.pm | Perl | apache-2.0 | 1,409 |
#
# Copyright 2021 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package os::linux::local::mode::liststorages;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-type:s' => { name => 'filter_type' },
'filter-fs:s' => { name => 'filter_fs' },
'filter-mount:s' => { name => 'filter_mount' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = $options{custom}->execute_command(
command => 'df',
command_options => '-P -k -T 2>&1',
no_quit => 1
);
my $results = {};
my @lines = split /\n/, $stdout;
foreach my $line (@lines) {
next if ($line !~ /^(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)/);
my ($fs, $type, $size, $used, $available, $percent, $mount) = ($1, $2, $3, $4, $5, $6, $7);
if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
$fs !~ /$self->{option_results}->{filter_fs}/) {
$self->{output}->output_add(long_msg => "skipping storage '" . $mount . "': no matching filter filesystem", debug => 1);
next;
}
if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
$type !~ /$self->{option_results}->{filter_type}/) {
$self->{output}->output_add(long_msg => "skipping storage '" . $mount . "': no matching filter filesystem type", debug => 1);
next;
}
if (defined($self->{option_results}->{filter_mount}) && $self->{option_results}->{filter_mount} ne '' &&
$mount !~ /$self->{option_results}->{filter_mount}/) {
$self->{output}->output_add(long_msg => "skipping storage '" . $mount . "': no matching filter mount point", debug => 1);
next;
}
$results->{$mount} = { fs => $fs, type => $type };
}
return $results;
}
sub run {
my ($self, %options) = @_;
my $results = $self->manage_selection(custom => $options{custom});
foreach my $name (sort(keys %$results)) {
$self->{output}->output_add(long_msg => "'" . $name . "' [fs = " . $results->{$name}->{fs} . '] [type = ' . $results->{$name}->{type} . ']');
}
$self->{output}->output_add(
severity => 'OK',
short_msg => 'List storages:'
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['name', 'fs', 'type']);
}
sub disco_show {
my ($self, %options) = @_;
my $results = $self->manage_selection(custom => $options{custom});
foreach my $name (sort(keys %$results)) {
$self->{output}->add_disco_entry(
name => $name,
fs => $results->{$name}->{fs},
type => $results->{$name}->{type},
);
}
}
1;
__END__
=head1 MODE
List storages.
Command used: df -P -k -T 2>&1
=over 8
=item B<--filter-type>
Filter filesystem type (regexp can be used).
=item B<--filter-fs>
Filter filesystem (regexp can be used).
=item B<--filter-mount>
Filter mount point (regexp can be used).
=back
=cut
| Tpo76/centreon-plugins | os/linux/local/mode/liststorages.pm | Perl | apache-2.0 | 4,266 |
#! /usr/bin/perl -w
use strict;
use warnings;
use RSTools;
my $set = $ARGV[0] || 'AS-LONAP';
my @pfxlist = RSTools::getFilterPfx4($set);
print "# IPV4:\n";
foreach my $pfx (@pfxlist)
{
print $pfx . "\n";
}
my @pfxlistsix = RSTools::getFilterPfx6($set);
print "\n\n# IPv6:\n";
foreach my $pfx (@pfxlistsix)
{
print $pfx . "\n";
}
print " # Donezo\n";
| andydavidson/rs-config | filterbuild.pl | Perl | apache-2.0 | 365 |
#!/usr/bin/env perl
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
=head1 NAME
find_assembly_patches.pl
=head1 SYNOPSIS
find_assembly_patches.pl --help
find_assembly_patches.pl
-new_core_url "mysql://ensro@ens-staging1:3306/homo_sapiens_core_68_37?group=core&species=homo_sapiens"
-prev_core_url "mysql://ensro@ens-livemirror:3306/homo_sapiens_core_67_37?group=core&species=homo_sapiens"
-compara_url mysql://ensro@compara1:3306/mm14_ensembl_compara_master
=head1 DESCRIPTION
Find new, changed and deleted patches in the database defined by new_core_url with respect to the prev_core_url
=head1 OPTIONS
=head2 GETTING HELP
=over
=item B<[--help]>
Prints help message and exits.
=back
=head2 GENERAL CONFIGURATION
=over
=item B<--new_core_url>
Location of the newest core database. Must be of the format:
mysql://user@host:port/species_core_db?group=core&species=species
eg mysql://ensro@ens-staging1:3306/homo_sapiens_core_68_37?group=core&species=homo_sapiens
=item B<--prev_core_url>
Location of the previous core database. Must be of the format:
mysql://user@host:port/species_core_db?group=core&species=species
eg mysql://ensro@ens-livemirror:3306/homo_sapiens_core_67_37?group=core&species=homo_sapiens
=item B<--compara_url>
Location of the master database, used for finding the dnafrag_id of any CHANGED or DELETED patches. Must be of the format:
mysql://user@host:port/compara_database
=back
=cut
use strict;
use warnings;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Utils::URI qw/parse_uri/;
use Getopt::Long;
my $registry = 'Bio::EnsEMBL::Registry';
my $help;
my $new_core;
my $prev_core;
my $compara_url;
GetOptions(
"help" => \$help,
"new_core_url=s" => \$new_core,
"prev_core_url=s" => \$prev_core,
"compara_url=s" => \$compara_url,
);
# Print Help and exit if help is requested
if ($help) {
exec("/usr/bin/env perldoc $0");
}
my ($new_species, $new_core_patches) = get_patches($new_core);
my ($prev_species, $prev_core_patches) = get_patches($prev_core);
#$new_species and $prev_species should be the same
if ($new_species ne $prev_species) {
die "The new_core species $new_species and prev_core species $prev_species are not the same";
}
#Group patches together
my ($new_patches, $changed_patches, $deleted_patches);
my $patch_names;
foreach my $name (keys %$new_core_patches) {
if (!defined $prev_core_patches->{$name}) {
$patch_names .= $new_core_patches->{$name}->{coord_system} . ":" . $name . ",";
$new_patches->{$name} = $new_core_patches->{$name};
} else {
if ($prev_core_patches->{$name}->{date} ne $new_core_patches->{$name}->{date}) {
$patch_names .= $new_core_patches->{$name}->{coord_system} . ":" . $name . ",";
push @{$changed_patches->{$name}}, $new_core_patches->{$name};
push @{$changed_patches->{$name}}, $prev_core_patches->{$name};
}
}
}
foreach my $name (keys %$prev_core_patches) {
if (!defined $new_core_patches->{$name}) {
$deleted_patches->{$name} = $prev_core_patches->{$name};
}
}
print "NEW patches\n";
foreach my $name (keys %$new_patches) {
print " $name " . $new_patches->{$name}->{seq_region_id} . " " . $new_patches->{$name}->{date} . "\n";
}
print "CHANGED patches\n";
my @dnafrags;
my @delete_names = ();
foreach my $name (keys %$changed_patches) {
my ($new, $prev) = @{$changed_patches->{$name}};
my $dnafrag = get_dnafrag($compara_url, $new_species, $name);
print " $name new=" . $new->{seq_region_id} . " " . $new->{date} . "\t";
print "prev=" . $prev->{seq_region_id} . " " . $prev->{date} . "\t";
print "dnafrag_id=" . $dnafrag->dbID . "\n";
push @delete_names, "\"$name\"";
push @dnafrags, $dnafrag->dbID;
}
print "DELETED patches\n";
foreach my $name (keys %$deleted_patches) {
my $dnafrag = get_dnafrag($compara_url, $new_species, $name);
print " $name " . $deleted_patches->{$name}->{seq_region_id} . " " . $deleted_patches->{$name}->{date} . "\t";
print "dnafrag_id=" . $dnafrag->dbID . "\n";
push @delete_names, "\"$name\"";
push @dnafrags, $dnafrag->dbID;
}
my $delete_str = @delete_names ? "(".(join ",", @delete_names).")" : "";
my $dnafrag_str = @dnafrags ? "(".(join ",", @dnafrags).")" : "";
print "\nDnaFrags to delete:\n";
print " names: $delete_str\n";
print " dnafrag_ids: $dnafrag_str\n";
if ($patch_names) {
print "Input for create_patch_pairaligner_conf.pl:\n";
chop $patch_names;
print "--patches $patch_names\n";
}
sub get_patches {
my ($core) = @_;
my $uri = parse_uri($core);
my %params = $uri->generate_dbsql_params();
$params{-SPECIES} = $params{-DBNAME} unless $params{-SPECIES};
my $new_core_dba = new Bio::EnsEMBL::DBSQL::DBAdaptor(%params);
my $sql = "SELECT seq_region.seq_region_id, seq_region.name, value, coord_system.name FROM seq_region JOIN seq_region_attrib USING (seq_region_id) JOIN attrib_type USING (attrib_type_id) JOIN coord_system using (coord_system_id) WHERE code IN (\"patch_fix\", \"patch_novel\") ORDER BY value";
my $sth = $new_core_dba->dbc->prepare($sql);
$sth->execute();
my ($seq_region_id, $seq_region_name, $date, $coord_system);
$sth->bind_columns(\$seq_region_id, \$seq_region_name, \$date, \$coord_system);
my $patches;
while ($sth->fetch()) {
#print "$seq_region_id $seq_region_name $value\n";
my $patch;
$patch->{'seq_region_id'} = $seq_region_id;
$patch->{date} = $date;
$patch->{coord_system} = $coord_system,
$patches->{$seq_region_name} = $patch;
}
return ($params{-SPECIES}, $patches);
}
sub get_dnafrag {
my ($compara_url, $species, $name) = @_;
#get compara_dba from url
my $compara_dba = new Bio::EnsEMBL::Compara::DBSQL::DBAdaptor(-url=>$compara_url);
#get adapator from dba
my $genome_db_adaptor = $compara_dba->get_GenomeDBAdaptor();
my $genome_db = $genome_db_adaptor->fetch_by_registry_name($species);
my $dnafrag_adaptor = $compara_dba->get_DnaFragAdaptor();
return ($dnafrag_adaptor->fetch_by_GenomeDB_and_name($genome_db, $name));
}
| Ensembl/ensembl-compara | scripts/pipeline/find_assembly_patches.pl | Perl | apache-2.0 | 7,023 |
package WordGraph::EdgeFeature::NodeSemantics;
use Moose;
use strict;
use warnings;
use Similarity;
use Vocabulary;
use JSON;
use Moose;
use namespace::autoclean;
with 'Feature::ServicedFeature';
extends 'WordGraph::EdgeFeature::MultiModalityFeature';
# ODP/DMOZ vocabulary
# Used only if specified at construction-time
has 'vocabulary' => ( is => 'ro' , isa => 'Vocabulary' , builder => '_build_node_vocabulary' , lazy => 1 );
sub _build_node_vocabulary {
my $this = shift;
my $vocabulary = Vocabulary->load( $this->params->{ 'vocabulary_file' } );
return $vocabulary;
}
my $COMMON_SEMANTIC_REPRESENTATION_SOURCE_SINK = 'semantic-representation-source-sink';
my $COMMON_SEMANTIC_REPRESENTATION_INSTANCE_MODALITY = 'semantic-representation-instance';
sub _get_resources {
my $this = shift;
my $graph = shift;
my $edge = shift;
my $instance = shift;
my %common_resources;
foreach my $modality (@{ $this->modalities }) {
# instance semantic representation
$common_resources{ $modality }{ $COMMON_SEMANTIC_REPRESENTATION_INSTANCE_MODALITY } = $instance->semantic_representation( $modality );
# source/sink semantic representations (will be populated next)
$common_resources{ $modality }{ $COMMON_SEMANTIC_REPRESENTATION_SOURCE_SINK } = [];
}
return \%common_resources;
}
sub _value_node {
my $this = shift;
my $graph = shift;
my $edge = shift;
my $instance = shift;
my $common_resources = shift;
my $node_index = shift;
my $modality = shift;
my $node = $edge->[ $node_index ];
# --> static vector (i.e. concepts appearing)
# --> top K semantics appearings in modality
# 1 - get semantic representation for target node
my $node_semantic_representation = $this->_node_semantic_representation( $node );
push @{ $common_resources->{ $COMMON_SEMANTIC_REPRESENTATION_SOURCE_SINK } } , $node_semantic_representation;
# 2 - get semantic representation for target modality
my $modality_semantic_representation = $common_resources->{ $COMMON_SEMANTIC_REPRESENTATION_INSTANCE_MODALITY };
# 3 - compute distance between semantic representations
my $semantic_distance = $this->_compute_semantic_distance( $node_semantic_representation , $modality_semantic_representation );
# print STDERR join( "\t" , "SEMANTICS" , $instance->url() , $node_surface , $semantic_distance ) . "\n";
return $semantic_distance;
}
=pod
sub _node_semantic_representation {
my $this = shift;
my $edge = shift;
my $index = shift;
my $node_surface = lc( $edge->[ $index ]->surface );
my $node_semantic_representation = $this->vocabulary()->semantic_representation( $node_surface );
return $node_semantic_representation;
}
=cut
sub _node_semantic_representation {
my $this = shift;
my $node = shift;
my $node_surface = lc( $node->surface() );
my $feature_request_data = $this->feature_request( 'get_word_semantics' , $node_surface );
my $node_semantic_representation = undef;
if ( $feature_request_data ) {
$node_semantic_representation = new Vector( coordinates => $feature_request_data );
}
return $node_semantic_representation;
}
sub _compute_semantic_distance {
my $this = shift;
my $semantic_object_1 = shift;
my $semantic_object_2 = shift;
my $similarity = 0;
if ( $semantic_object_1 && $semantic_object_2 ) {
# cosine similarity using TFIDF weights ?
$similarity = Vector::cosine( $semantic_object_1 , $semantic_object_2 );
}
return $similarity;
}
sub _value_edge {
my $this = shift;
my $graph = shift;
my $edge = shift;
my $instance = shift;
my $common_resources = shift;
my $source_features = shift;
my $sink_features = shift;
my $modality = shift;
# 1 - get semantic representation for source
my $source_semantic_representation = $common_resources->{ $COMMON_SEMANTIC_REPRESENTATION_SOURCE_SINK }->[ 0 ];
# 2 - get semantic representation for target
my $target_semantic_representation = $common_resources->{ $COMMON_SEMANTIC_REPRESENTATION_SOURCE_SINK }->[ 1 ];
# 3 - projected semantic representation (source onto target)
my $projected_semantic_representation_target = defined( $source_semantic_representation ) ? $source_semantic_representation->project( $target_semantic_representation ) : 0;
my $projected_semantic_representation_source = defined( $target_semantic_representation ) ? $target_semantic_representation->project( $source_semantic_representation ) : 0;
# 4 - get semantic representation for target modality
my $modality_semantic_representation = $common_resources->{ $COMMON_SEMANTIC_REPRESENTATION_INSTANCE_MODALITY };
# 5 - semantic distance between #3 and #4
my $semantic_distances = {
'target_projection' => $this->_compute_semantic_distance( $projected_semantic_representation_target , $modality_semantic_representation ),
'source_projection' => $this->_compute_semantic_distance( $projected_semantic_representation_source , $modality_semantic_representation ),
};
return $semantic_distances;
}
__PACKAGE__->meta->make_immutable;
1;
| ypetinot/web-summarization | summarizers/graph-summarizer-4/src/WordGraph/EdgeFeature/NodeSemantics.pm | Perl | apache-2.0 | 5,222 |
# Copyright 2020, Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package Google::Ads::GoogleAds::V10::Services::CustomerNegativeCriterionService;
use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseService);
sub mutate {
my $self = shift;
my $request_body = shift;
my $http_method = 'POST';
my $request_path =
'v10/customers/{+customerId}/customerNegativeCriteria:mutate';
my $response_type =
'Google::Ads::GoogleAds::V10::Services::CustomerNegativeCriterionService::MutateCustomerNegativeCriteriaResponse';
return $self->SUPER::call($http_method, $request_path, $request_body,
$response_type);
}
1;
| googleads/google-ads-perl | lib/Google/Ads/GoogleAds/V10/Services/CustomerNegativeCriterionService.pm | Perl | apache-2.0 | 1,158 |
package XML::Schema::LocatingRules;
use strict;
use vars qw($VERSION @ISA @EXPORT);
use Text::DelimMatch;
use XML::Parser::PerlSAX;
use XML::Schema::LocatingRules::LRScanner;
use XML::Schema::LocatingRules::DocumentInfo;
require 5.000;
require Exporter;
require AutoLoader;
@ISA = qw(Exporter AutoLoader);
@EXPORT = qw();
$VERSION = '0.5';
my $DEBUG = 0;
sub new {
my $type = shift;
my $self = {};
$self->{'rules'} = [];
$self->{'info'} = new XML::Schema::LocatingRules::DocumentInfo;
return bless $self, $type;
}
sub load {
my $self = shift;
my @files = @_;
my @rules = ();
@files = $self->schemaLocatingFiles(".emacs") if !@files;
foreach my $file (@files) {
my $absFile = File::Spec->rel2abs($file);
next if ! -f $absFile;
push (@{$self->{'rules'}}, $self->loadFile($absFile));
}
$self->fixupApplyFollowingRules();
}
sub schema {
my $self = shift;
my $root = shift;
my $namespace = shift;
my $publicId = shift;
my $docInfo = undef;
if (ref $root) {
# assumed to be a DocumentInfo
$docInfo = $root;
} else {
$docInfo = $self->{'info'};
$docInfo->publicId($publicId) if defined $publicId;
$docInfo->namespace($namespace) if defined $namespace;
$docInfo->root($root) if defined $root;
}
foreach my $rule (@{$self->{'rules'}}) {
my $match = $rule->match($self, $docInfo);
return $match if defined $match;
}
return undef;
}
# ======================================================================
sub loadFile {
my $self = shift;
my $file = shift;
my @rules = ();
print "LocatingRules: loading $file\n" if $self->debug() > 1;
my $handler = new XML::Schema::LocatingRules::LRScanner($file);
$handler->debug($DEBUG);
my $parser = new XML::Parser::PerlSAX (Handler => $handler);
$parser->parse (Source => { 'SystemId' => $file });
foreach my $rule ($handler->rules()) {
if (ref $rule eq 'XML::Schema::LocatingRules::Include') {
push (@rules, $self->loadFile($rule->rules()));
} else {
push (@rules, $rule);
}
}
return @rules;
}
sub schemaLocatingFiles {
my $self = shift;
my $dotName = shift;
my $dotEmacs = $ENV{'HOME'} . "/$dotName";
my @files = ();
local $_;
open (F, $dotEmacs);
read (F, $_, -s $dotEmacs);
close (F);
if (/rng-schema-locating-files\s/) {
# discard everything that comes before it.
s/^.*?rng-schema-locating-files//sg;
my $mc = new Text::DelimMatch '\(', '\)';
my ($prefix, $match, $remainder);
$mc->quote('"');
$mc->escape("\\");
($prefix, $_, $remainder) = $mc->match($_);
$mc = new Text::DelimMatch '"';
$mc->returndelim(0);
while ($_ ne '') {
($prefix, $match, $remainder) = $mc->match($_);
push (@files, $match) if $match ne '';
$_ = $remainder;
}
}
return @files;
}
sub fixupApplyFollowingRules {
my $self = shift;
my @rules = ();
for (my $count = 0; $count <= $#{$self->{'rules'}}; $count++) {
my $rule = $self->{'rules'}->[$count];
if ($rule->type eq 'applyFollowingRules') {
if ($rule->ruleType() ne 'applyFollowingRules') {
for (my $aCount = $count+1; $aCount <= $#{$self->{'rules'}}; $aCount++) {
my $fRule = $self->{'rules'}->[$aCount];
if ($fRule->type() eq $rule->ruleType()) {
push (@rules, $fRule);
}
}
}
} else {
push (@rules, $rule);
}
}
@{$self->{'rules'}} = @rules;
}
sub schemaForTypeId {
my $self = shift;
my $typeid = shift;
foreach my $rule (@{$self->{'rules'}}) {
if ($rule->type() eq 'typeId') {
next if $rule->id() ne $typeid;
if ($rule->typeId()) {
return $self->schemaForTypeId($rule->typeId());
} else {
return $rule->uri() if -f $rule->uri();
}
} elsif ($rule->type() eq 'typeIdBase') {
my $uri = $rule->{'_baseURI'};
$uri .= "/" if $uri !~ /\/$/;
$uri .= $typeid;
$uri .= $rule->{'append'};
return $uri if -f $uri;
} else {
# nop;
}
}
return undef;
}
sub showRules {
my $self = shift;
foreach my $rule (@{$self->{'rules'}}) {
print $rule->toString(), "\n";
}
}
sub debug {
my $self = shift;
my $debug = shift;
$DEBUG = $debug if defined $debug;
return $DEBUG;
}
# ======================================================================
sub uri {
my $self = shift;
return $self->{'info'}->uri(@_);
}
sub publicId {
my $self = shift;
return $self->{'info'}->publicId(@_);
}
sub systemId {
my $self = shift;
return $self->{'info'}->systemId(@_);
}
sub namespace {
my $self = shift;
return $self->{'info'}->namespace(@_);
}
sub localName {
my $self = shift;
return $self->{'info'}->localName(@_);
}
sub prefix {
my $self = shift;
return $self->{'info'}->prefix(@_);
}
sub root {
my $self = shift;
return $self->{'info'}->root(@_);
}
sub processingInstruction {
my $self = shift;
return $self->{'info'}->processingInstruction(@_);
}
sub processingInstructions {
my $self = shift;
return $self->{'info'}->processingInstructions(@_);
}
1;
| ndw/LocatingRules | XML/Schema/LocatingRules.pm | Perl | apache-2.0 | 5,104 |
# <@LICENSE>
# 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.
# </@LICENSE>
=head1 NAME
RelayCountry - add message metadata indicating the country code of each relay
=head1 SYNOPSIS
loadplugin Mail::SpamAssassin::Plugin::RelayCountry
=head1 DESCRIPTION
The RelayCountry plugin attempts to determine the domain country codes
of each relay used in the delivery path of messages and add that information
to the message metadata as "X-Relay-Countries", or the C<_RELAYCOUNTRY_>
header markup.
=head1 REQUIREMENT
This plugin requires the Geo::IP module from CPAN. For backward
compatibility IP::Country::Fast is used if Geo::IP is not installed.
=cut
package Mail::SpamAssassin::Plugin::RelayCountry;
use Mail::SpamAssassin::Plugin;
use Mail::SpamAssassin::Logger;
use Mail::SpamAssassin::Constants qw(:ip);
use strict;
use warnings;
use bytes;
use re 'taint';
use vars qw(@ISA);
@ISA = qw(Mail::SpamAssassin::Plugin);
my ($db, $dbv6);
my $ip_to_cc; # will hold a sub() for the lookup
my $db_info; # will hold a sub() for database info
# Try to load Geo::IP first
eval {
require Geo::IP;
$db = Geo::IP->open_type(Geo::IP->GEOIP_COUNTRY_EDITION, Geo::IP->GEOIP_STANDARD);
die "GeoIP.dat not found" unless $db;
# IPv6 requires version Geo::IP 1.39+ with GeoIP C API 1.4.7+
if (Geo::IP->VERSION >= 1.39 && Geo::IP->api eq 'CAPI') {
$dbv6 = Geo::IP->open_type(Geo::IP->GEOIP_COUNTRY_EDITION_V6, Geo::IP->GEOIP_STANDARD);
if (!$dbv6) {
dbg("metadata: RelayCountry: IPv6 support not enabled, GeoIPv6.dat not found");
}
} else {
dbg("metadata: RelayCountry: IPv6 support not enabled, versions Geo::IP 1.39, GeoIP C API 1.4.7 required");
}
$ip_to_cc = sub {
if ($dbv6 && $_[0] =~ /:/) {
return $dbv6->country_code_by_addr_v6($_[0]) || "XX";
} else {
return $db->country_code_by_addr($_[0]) || "XX";
}
};
$db_info = sub { return "Geo::IP " . ($db->database_info || '?') };
1;
} or do {
my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
dbg("metadata: RelayCountry: failed to load 'Geo::IP', skipping: $eval_stat");
# Try IP::Country::Fast as backup
eval {
require IP::Country::Fast;
$db = IP::Country::Fast->new();
$ip_to_cc = sub {
return $db->inet_atocc($_[0]) || "XX";
};
$db_info = sub { return "IP::Country::Fast ".localtime($db->db_time()); };
1;
} or do {
my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
dbg("metadata: RelayCountry: failed to load 'IP::Country::Fast', skipping: $eval_stat");
return 1;
};
};
# constructor: register the eval rule
sub new {
my $class = shift;
my $mailsaobject = shift;
# some boilerplate...
$class = ref($class) || $class;
my $self = $class->SUPER::new($mailsaobject);
bless ($self, $class);
return $self;
}
sub extract_metadata {
my ($self, $opts) = @_;
return 1 unless $db;
dbg("metadata: RelayCountry: Using database: ".$db_info->());
my $msg = $opts->{msg};
my $countries = '';
my $IP_PRIVATE = IP_PRIVATE;
foreach my $relay (@{$msg->{metadata}->{relays_untrusted}}) {
my $ip = $relay->{ip};
# Private IPs will always be returned as '**'
my $cc = $ip =~ /^$IP_PRIVATE$/o ? '**' : $ip_to_cc->($ip);
$countries .= $cc." ";
}
chop $countries;
$msg->put_metadata("X-Relay-Countries", $countries);
dbg("metadata: X-Relay-Countries: $countries");
return 1;
}
sub parsed_metadata {
my ($self, $opts) = @_;
return 1 unless $db;
my $countries =
$opts->{permsgstatus}->get_message->get_metadata('X-Relay-Countries');
my @c_list = split(' ', $countries);
$opts->{permsgstatus}->set_tag("RELAYCOUNTRY",
@c_list == 1 ? $c_list[0] : \@c_list);
return 1;
}
1;
| gitpan/Mail-SpamAssassin | lib/Mail/SpamAssassin/Plugin/RelayCountry.pm | Perl | apache-2.0 | 4,496 |
#
# 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 cloud::azure::database::cosmosdb::mode::usage;
use base qw(cloud::azure::custom::mode);
use strict;
use warnings;
sub get_metrics_mapping {
my ($self, %options) = @_;
my $metrics_mapping = {
'datausage' => {
'output' => 'Data Usage',
'label' => 'data-usage',
'nlabel' => 'cosmosdb.account.data.usage.bytes',
'unit' => 'B',
'min' => '0'
},
'indexusage' => {
'output' => 'Index Usage',
'label' => 'index-usage',
'nlabel' => 'cosmosdb.account.index.usage.bytes',
'unit' => 'B',
'min' => '0'
}
};
return $metrics_mapping;
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
$self->{output}->option_exit();
}
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DocumentDB\/databaseAccounts\/(.*)$/) {
$resource_group = $1;
$resource = $2;
}
$self->{az_resource} = $resource;
$self->{az_resource_group} = $resource_group;
$self->{az_resource_type} = 'databaseAccounts';
$self->{az_resource_namespace} = 'Microsoft.DocumentDB';
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
$self->{az_aggregations} = ['Total'];
if (defined($self->{option_results}->{aggregation})) {
$self->{az_aggregations} = [];
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
if ($stat ne '') {
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
}
}
}
foreach my $metric (keys %{$self->{metrics_mapping}}) {
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
&& $metric !~ /$self->{option_results}->{filter_metric}/);
push @{$self->{az_metrics}}, $metric;
}
}
1;
__END__
=head1 MODE
Check Azure Cosmos DB Accounts usage statistics.
Example:
Using resource name :
perl centreon_plugins.pl --plugin=cloud::azure::database::cosmosdb::plugin --mode=usage --custommode=api
--resource=<cosmosdbaccount_id> --resource-group=<resourcegroup_id> --aggregation='total'
--warning-data-usage='80000' --critical-data-usage='90000'
Using resource id :
perl centreon_plugins.pl --plugin=cloud::azure::database::cosmosdb::plugin --mode=usage --custommode=api
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.DocumentDB/databaseAccounts/<cosmosdbaccount_id>'
--aggregation='total' --warning-data-usage='80000' --critical-data-usage='90000'
Default aggregation: 'total' / 'minimum', 'maximum' and 'average' are valid.
=over 8
=item B<--resource>
Set resource name or id (Required).
=item B<--resource-group>
Set resource group (Required if resource's name is used).
=item B<--warning-*>
Warning threshold where '*' can be:
'data-usage', 'index-usage'.
=item B<--critical-*>
Critical threshold where '*' can be:
'data-usage', 'index-usage'.
=back
=cut
| centreon/centreon-plugins | cloud/azure/database/cosmosdb/mode/usage.pm | Perl | apache-2.0 | 4,879 |
#
# Copyright 2021 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::mq::vernemq::restapi::mode::sessions;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_session_output {
my ($self, %options) = @_;
return 'Sessions ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_session_output', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'online', nlabel => 'sessions.online.count', set => {
key_values => [ { name => 'online' } ],
output_template => 'current online: %s',
perfdatas => [
{ value => 'online', template => '%s', min => 0 }
]
}
},
{ label => 'total', nlabel => 'sessions.total.count', set => {
key_values => [ { name => 'total' } ],
output_template => 'current total: %s',
perfdatas => [
{ value => 'total', template => '%s', min => 0 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $sessions = $options{custom}->request_api(
endpoint => '/session/show'
);
$self->{global} = { total => 0, online => 0 };
foreach (@{$sessions->{table}}) {
$self->{global}->{online}++ if ($_->{is_online});
$self->{global}->{total}++;
}
}
1;
__END__
=head1 MODE
Check sessions.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'total', 'online'.
=back
=cut
| Tpo76/centreon-plugins | apps/mq/vernemq/restapi/mode/sessions.pm | Perl | apache-2.0 | 2,620 |
#
# 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::hp::storeonce::ssh::custom::custom;
use strict;
use warnings;
use centreon::plugins::ssh;
use centreon::plugins::misc;
sub new {
my ($class, %options) = @_;
my $self = {};
bless $self, $class;
if (!defined($options{output})) {
print "Class Custom: Need to specify 'output' argument.\n";
exit 3;
}
if (!defined($options{options})) {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'hostname:s' => { name => 'hostname' },
'timeout:s' => { name => 'timeout', default => 45 },
'command:s' => { name => 'command' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'SSH OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{ssh} = centreon::plugins::ssh->new(%options);
return $self;
}
sub set_options {
my ($self, %options) = @_;
$self->{option_results} = $options{option_results};
}
sub set_defaults {}
sub check_options {
my ($self, %options) = @_;
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
$self->{ssh}->check_options(option_results => $self->{option_results});
}
return 0;
}
##############
# Specific methods
##############
sub execute_command {
my ($self, %options) = @_;
$self->{ssh_commands} = '';
foreach (@{$options{commands}}) {
$self->{ssh_commands} .= "$_\n";
}
my $content;
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
($content) = $self->{ssh}->execute(
ssh_pipe => 1,
hostname => $self->{option_results}->{hostname},
command => defined($self->{option_results}->{command}) && $self->{option_results}->{command} ne '' ? $self->{option_results}->{command} : $self->{ssh_commands},
command_path => $self->{option_results}->{command_path},
command_options => defined($self->{option_results}->{command_options}) && $self->{option_results}->{command_options} ne '' ? $self->{option_results}->{command_options} : undef,
timeout => $self->{option_results}->{timeout}
);
} else {
if (!defined($self->{option_results}->{command}) || $self->{option_results}->{command} eq '') {
$self->{output}->add_option_msg(short_msg => 'please set --hostname option for ssh connection (or --command for local)');
$self->{output}->option_exit();
}
($content) = centreon::plugins::misc::execute(
ssh_pipe => 1,
output => $self->{output},
options => { timeout => $self->{option_results}->{timeout} },
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => defined($self->{option_results}->{command_options}) && $self->{option_results}->{command_options} ne '' ? $self->{option_results}->{command_options} : undef
);
}
return $content;
}
1;
__END__
=head1 NAME
ssh
=head1 SYNOPSIS
my ssh
=head1 SSH OPTIONS
=over 8
=item B<--hostname>
Hostname to query.
=item B<--timeout>
Timeout in seconds for the command (Default: 45).
=item B<--command>
Command to get information. Used it you have output in a file.
=item B<--command-path>
Command path.
=item B<--command-options>
Command options.
=back
=head1 DESCRIPTION
B<custom>.
=cut
| centreon/centreon-plugins | storage/hp/storeonce/ssh/custom/custom.pm | Perl | apache-2.0 | 4,609 |
#!/usr/bin/perl -w
#
# Copyright 2019, 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.
#
# This example gets all image and video files.
use strict;
use warnings;
use utf8;
use FindBin qw($Bin);
use lib "$Bin/../../lib";
use Google::Ads::GoogleAds::Client;
use Google::Ads::GoogleAds::Utils::GoogleAdsHelper;
use Google::Ads::GoogleAds::Utils::SearchGoogleAdsIterator;
use
Google::Ads::GoogleAds::V10::Services::GoogleAdsService::SearchGoogleAdsRequest;
use Getopt::Long qw(:config auto_help);
use Pod::Usage;
use Cwd qw(abs_path);
use constant PAGE_SIZE => 1000;
# The following parameter(s) should be provided to run the example. You can
# either specify these by changing the INSERT_XXX_ID_HERE values below, or on
# the command line.
#
# Parameters passed on the command line will override any parameters set in
# code.
#
# Running the example with -h will print the command line usage.
my $customer_id = "INSERT_CUSTOMER_ID_HERE";
sub get_all_videos_and_images {
my ($api_client, $customer_id) = @_;
# Create a search Google Ads request that will retrieve all video and image
# files using pages of the specified page size.
my $search_request =
Google::Ads::GoogleAds::V10::Services::GoogleAdsService::SearchGoogleAdsRequest
->new({
customerId => $customer_id,
query => "SELECT media_file.id, media_file.name, media_file.type " .
"FROM media_file ORDER BY media_file.id",
pageSize => PAGE_SIZE
});
# Get the GoogleAdsService.
my $google_ads_service = $api_client->GoogleAdsService();
my $iterator = Google::Ads::GoogleAds::Utils::SearchGoogleAdsIterator->new({
service => $google_ads_service,
request => $search_request
});
# Iterate over all rows in all pages and print the requested field values for
# the media file in each row.
while ($iterator->has_next) {
my $google_ads_row = $iterator->next;
printf "Media file with ID %d, name '%s', and type '%s' was found.\n",
$google_ads_row->{mediaFile}{id}, $google_ads_row->{mediaFile}{name},
$google_ads_row->{mediaFile}{type};
}
return 1;
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Get Google Ads Client, credentials will be read from ~/googleads.properties.
my $api_client = Google::Ads::GoogleAds::Client->new();
# By default examples are set to die on any server returned fault.
$api_client->set_die_on_faults(1);
# Parameters passed on the command line will override any parameters set in code.
GetOptions("customer_id=s" => \$customer_id);
# Print the help message if the parameters are not initialized in the code nor
# in the command line.
pod2usage(2) if not check_params($customer_id);
# Call the example.
get_all_videos_and_images($api_client, $customer_id =~ s/-//gr);
=pod
=head1 NAME
get_all_videos_and_images
=head1 DESCRIPTION
This example gets all image and video files.
=head1 SYNOPSIS
get_all_videos_and_images.pl [options]
-help Show the help message.
-customer_id The Google Ads customer ID.
=cut
| googleads/google-ads-perl | examples/misc/get_all_videos_and_images.pl | Perl | apache-2.0 | 3,622 |
#
# Copyright 2021 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package database::postgres::mode::databasesize;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'databases', type => 1, cb_prefix_output => 'prefix_database_output', message_multiple => 'All databases are ok' },
];
$self->{maps_counters}->{databases} = [
{ label => 'size', set => {
key_values => [ { name => 'size' }, { name => 'display' } ],
output_template => 'size : %s %s',
output_change_bytes => 1,
perfdatas => [
{ label => 'size', value => 'size', template => '%s',
min => 0, unit => 'B', label_extra_instance => 1, instance_use => 'display' },
],
}
},
];
}
sub prefix_database_output {
my ($self, %options) = @_;
return "Database '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-database:s" => { name => 'filter_database' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
}
sub manage_selection {
my ($self, %options) = @_;
$self->{sql} = $options{sql};
$self->{sql}->connect();
$self->{sql}->query(query => "SELECT pg_database.datname, pg_database_size(pg_database.datname) FROM pg_database;");
my $result = $self->{sql}->fetchall_arrayref();
$self->{databases} = {};
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_database}) && $self->{option_results}->{filter_database} ne ''
&& $$row[0] !~ /$self->{option_results}->{filter_database}/);
$self->{databases}->{$$row[0]}->{display} = $$row[0];
$self->{databases}->{$$row[0]}->{size} = $$row[1];
}
if (scalar(keys %{$self->{databases}}) <= 0) {
$self->{output}->add_option_msg(short_msg => 'No databases found');
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check databases size
=over 8
=item B<--filter-database>
Filter database to checks (Can use regexp).
=item B<--warning-size>
Threshold warning in bytes, maximum size allowed.
=item B<--critical-size>
Threshold critical in bytes, maximum size allowed.
=back
=cut
| Tpo76/centreon-plugins | database/postgres/mode/databasesize.pm | Perl | apache-2.0 | 3,392 |
#!/usr/bin/perl -w
# PPath@Cornell
# Surya Saha July 8, 2011
use strict;
use warnings;
use Getopt::Long;
use POSIX;
use Bio::SeqIO;
use lib "/home/surya/bin/modules";
use SS;
=head1 NAME
joinPairs.v1.pl - Generate paired files from trimmed and fq-joined dataset
=head1 SYNOPSIS
% joinPairs.v3.pl -comm names --fwd file --rev file --joined file --ns 15 --informat Fasta/fastq
=head1 DESCRIPTION
This script reads in paired read files that have been quality trimmed and overlapping reads joined so the order
has been disturbed. Produces a joined paired-read files and fwd/rev unpaired read files. Low memory requirement
but long runtime (4-6hrs for 30mill reads).
Accounting for out of order reads was unnecessary since fq-join files are in order. See bash commands
=head1 BASH COMMANDS
export LANG=C; export LC_ALL=C
fgrep --color=auto '@' s_6_1_sequence.txt.trim28.fastq | sed 's,\/1,,'| sed 's,\@,,' | sort > 1.names.trimmed.sorted
fgrep --color=auto '@' s_6_2_sequence.txt.trim28.fastq | sed 's,\/2,,'| sed 's,\@,,' | sort > 2.names.trimmed.sorted
comm -12 1.names.trimmed.sorted 2.names.trimmed.sorted > commnames
=head1 TODO
Ver 2 Output in Fastq and Fasta using Bio::SeqIO
=head1 VERSION HISTORY
Version 1: Shell commands + perl code. Order of paired reads is dependent on reads being in order in input files.
Input: Common name file produced by comm, fwd/rev filtered paired end files
Output: Joined ordered paired end files, fwd/rev unpaired files
=head1 COMMAND-LINE OPTIONS
Command-line options can be abbreviated to single-letter options, e.g. -f instead of --file. Some options
are mandatory (see below).
--comm <> List of common read names (required)
--fwd <> File with fwd reads (required)
--rev <> File with rev reads (required)
--joined <> Name for joined file (required)
--ns <> Number of N's in join (default=15)
--informat <> Fasta, genbank, EMBL, fastq (required)
=head1 AUTHOR
Surya Saha, ss2489@cornell.edu
=cut
my ($i,$j,$k,$fwd,$rev,$comm,$iformat,$n,$out,@temp,$rec,%cnames,@ctrs,%fData);
GetOptions (
'comm=s'=> \$comm,
'fwd=s' => \$fwd,
'rev=s' => \$rev,
'joined=s' => \$out,
'ns:i' => \$n,
'informat=s' => \$iformat) or (system('pod2text',$0), exit 1);
# defaults and checks
defined($comm) or (system('pod2text',$0), exit 1);
if (!(-e $comm)){print STDERR "$comm not found: $!\n"; exit 1;}
defined($fwd) or (system('pod2text',$0), exit 1);
if (!(-e $fwd)){print STDERR "$fwd not found: $!\n"; exit 1;}
defined($rev) or (system('pod2text',$0), exit 1);
if (!(-e $rev)){print STDERR "$rev not found: $!\n"; exit 1;}
defined($out) or (system('pod2text',$0), exit 1);
$n ||= 15;
if(($iformat ne 'Fasta') && ($iformat ne 'genbank') && ($iformat ne 'EMBL') && ($iformat ne 'fastq')){
system('pod2text',$0), exit 1;
}
my $infwd = Bio::SeqIO->new(-file=>$fwd, -format=>$iformat);
my $inrev = Bio::SeqIO->new(-file=>$rev, -format=>$iformat);
unless(open(COMM,"<$comm")){print "not able to open $comm\n\n";exit 1;}
unless(open(OUTJ,">${out}")){print "not able to open joined.${out}\n\n";exit 1;}
unless(open(OUTFU,">unpaired.${fwd}.fas")){print "not able to open unpaired.${fwd}.fas\n\n";exit 1;}
unless(open(OUTRU,">unpaired.${rev}.fas")){print "not able to open unpaired.${rev}.fas\n\n";exit 1;}
#read in common names
while($rec=<COMM>){
chomp $rec; $cnames{$rec}='';
}
#initing ctrs
for $i (0..3){$ctrs[$i]=0;} #fwd paired, fwd unpaired, rev paired, rev unpaired
print STDERR "NOTE: Output paired file order is dependent on order in input files.\n";
print STDERR "NOTE: Call fasta_formatter to format joined fasta file.\nStarting parse...\n";
#parsing fwd seqs
while (my $obj = $infwd->next_seq()){
$i=$obj->display_id();
$i=~ s/^\@//; $i=~ s/\/1$//;
#print STDOUT "Read $i from fwd\n";#debug
if(exists $cnames{$i}){
$ctrs[0]++;
$cnames{$i}=$obj->seq();#using cnames to remember fwd seq
# if($oformat eq 'fastq'){
# $outpfwd->write_fastq($obj);
# #print STDOUT "Wrote $i to fwd paired\n";#debug
# }
# else{
# $outpfwd->write_seq($obj);
# }
}
else{
$ctrs[1]++;
print OUTFU '>',$ctrs[1],"\n",$obj->seq(),"\n";
# if($oformat eq 'fastq'){
# $outufwd->write_fastq($obj);
# #print STDOUT "\tWrote $i to fwd unpaired\n";#debug
# }
# else{
# $outufwd->write_seq($obj);
# }
}
}
print STDERR "Finished parsing Fwds..starting on Revs\n";
#parsing rev seqs
while (my $obj = $inrev->next_seq()){
$i=$obj->display_id();
$i=~ s/^\@//; $i=~ s/\/2$//;
#print STDOUT "Read $i from rev\n";#debug
if(exists $cnames{$i}){
$ctrs[2]++;
print OUTJ '>',$ctrs[2],"\n",$cnames{$i};
for $j (1..$n){ print OUTJ 'N';}
print OUTJ $obj->seq(),"\n";
# if($oformat eq 'fastq'){
# $outprev->write_fastq($obj);
# #print STDOUT "Wrote $i to rev paired\n";#debug
# }
# else{
# $outprev->write_seq($obj);
# }
}
else{
$ctrs[3]++;
print OUTRU '>',$ctrs[3],"\n",$obj->seq(),"\n";
# if($oformat eq 'fastq'){
# $outurev->write_fastq($obj);
# #print STDOUT "\tWrote $i to rev unpaired\n";#debug
# }
# else{
# $outurev->write_seq($obj);
# }
}
}
print STDERR "Finished parsing Revs\n\n";
close(OUTJ);
close(OUTFU);
close(OUTRU);
if($ctrs[0]!=$ctrs[2]){ print STDERR "Err in counts: fwd paired not equal rev paired\n\n"; exit 1;}
# print ctrs
print STDERR "Paired reads: $ctrs[0]\nUnpaired forwards: $ctrs[1]\nUnpaired reverses: $ctrs[3]\n\n";
# delete empty unpaired files
if($ctrs[1]==0){unlink "unpaired.${fwd}.fas";}
if($ctrs[3]==0){unlink "unpaired.${rev}.fas";}
&SS::mem_used();
&SS::runtime();
exit; | suryasaha/NGS | joinPairs.v1.pl | Perl | bsd-2-clause | 5,611 |
package Net::LDNS::RR::NSEC3;
use parent 'Net::LDNS::RR';
1;
=head1 NAME
Net::LDNS::RR::NSEC3 - Type NSEC3 record
=head1 DESCRIPTION
A subclass of L<Net::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item algorithm()
Returns the algorithm number.
=item flags()
Returns the flags field.
=item optout()
Returns the optout flag.
=item iterations()
Returns the iteration count.
=item salt()
Returns the cryptographic salt, in binary form.
=item next_owner()
Returns the next owner field.
=item typelist()
Returns the typelist as a space-separated string.
=item typehref()
Returns the typelist as a reference to a hash where the included types are keys storing true values.
=item covers($name)
Returns true or false depending on if the record covers the given name or not.
=back
| gitpan/Net-LDNS | lib/Net/LDNS/RR/NSEC3.pm | Perl | bsd-2-clause | 879 |
package WSST::Schema;
use strict;
use Storable qw(dclone);
use WSST::Schema::Data;
our $VERSION = '0.1.1';
sub new {
my $class = shift;
my $data = shift || {};
my $self = {
lang => $ENV{WSST_LANG},
data => WSST::Schema::Data->new($data),
};
bless($self, $class);
$self->_update_lang() if $self->{lang};
return $self;
}
sub clone_data {
my $self = shift;
return dclone($self->data);
}
sub data {
my $self = shift;
return $self->{data};
}
sub lang {
my $self = shift;
if (@_) {
$self->{lang} = shift;
$self->_update_lang();
}
return $self->{lang};
}
sub _update_lang {
my $self = shift;
my $lang = $self->{lang} || "default";
my $hash_list = [$self->{data}];
while (my $hash = shift(@$hash_list)) {
foreach my $key (keys %$hash) {
next if $key =~ /_m17n$/;
my $key_m17n = $key . "_m17n";
if ($hash->{$key_m17n} && ref($hash->{$key_m17n}) eq 'HASH') {
$hash->{$key_m17n}->{default} = $hash->{$key}
unless exists $hash->{$key_m17n}->{default};
$hash->{$key} = $hash->{$key_m17n}->{$lang};
next;
}
if (ref($hash->{$key}) eq 'HASH') {
push(@$hash_list, $hash->{$key});
next;
}
if (ref($hash->{$key}) eq 'ARRAY') {
foreach my $val (@{$hash->{$key}}) {
push(@$hash_list, $val)
if ref($val) eq 'HASH';
}
}
}
}
}
=head1 NAME
WSST::Schema - Schema class of WSST
=head1 DESCRIPTION
Schema is container class of parsed schema data.
=head1 METHODS
=head2 new
Constructor.
=head2 clone_data
Returns schema data which copied deeply.
=head2 data
Returns schema data.
=head2 lang
Accessor method for lang value.
=head1 SEE ALSO
http://code.google.com/p/wsst/
=head1 AUTHORS
Mitsuhisa Oshikawa <mitsuhisa [at] gmail.com>
Yusuke Kawasaki <u-suke [at] kawa.net>
=head1 COPYRIGHT AND LICENSE
Copyright 2008 WSS Project Team
=cut
1;
| gitpan/WSST | lib/WSST/Schema.pm | Perl | bsd-3-clause | 2,148 |
#!/usr/bin/perl
use Term::ANSIColor qw(:constants);
#$firstPassCompileType="pipelined";
$firstPassCompileType="firstPass";
if ($#ARGV > 0) {
print {STDERR} "$#ARGV Error: input file should be passed to generateTop\n";
exit;
}
if ($#ARGV == -1) {
#We want this for debug
$topModuleName="Top";
} elsif ($#ARGV == 0) {
$topModuleName=$ARGV[0];
} else {
print "Error too many arguments for generateTop\n";
}
$headersCompileType="multiThread";
open FILE, "<", "$topModuleName" . "LibGenerated.scala" or die "cannot open input file\n";
@file_line_array = <FILE>;
close FILE;
$enginesMDFile="../../../compiler/engineCompiler/$compileType/enginesMD";
sub initializeMacrosAndTypes {
my $compileType = shift;
`> ../../../compiler/engineCompiler/$compileType/typedef.magillac`;
`> ../../../compiler/engineCompiler/$compileType/macros.magillac`;
}
sub copyMacrosAndTypesFromHeaderFiles {
my $compileType = shift;
`../../../compiler/engineCompiler/$compileType/print_macros.pl < ../src/include/$fileName >> ../../../compiler/engineCompiler/$compileType/macros.magillac`;
`../../../compiler/engineCompiler/$compileType/print_typedef.pl < ../src/include/$fileName >> ../../../compiler/engineCompiler/$compileType/typedef.magillac`;
`awk '!/typedef/ || /struct/' < ../src/include/$fileName > ../../../compiler/engineCompiler/$compileType/$fileName`;
}
sub generate_engine_metaData {
my $name = shift;
my $compileType = $compileTypes{$name};
$fileName = "../src/engines/" . $name . ".c";
`grep CONCURRENT_SAFE $fileName && echo "$name CONCURRENT_SAFE\n">> $enginesMDFile`;
$numOfProcessingSteps=`wc ../../../compiler/engineCompiler/$compileType/instr.magillac | awk '{print $1}'`;
$pipelineStages = $numOfProcessingSteps * 2;
if ($pipelinable{$name}) {
`echo "$name PIPELINABLE $pipelineStages\n" >> $enginesMDFile`;
}
}
sub compile_engine {
my $moduleOrHeader = shift;
my $mhName = shift;
my $compileType;
if ($moduleOrHeader eq "header") {
$compileType = $headersCompileType;
}
if ($moduleOrHeader eq "module") {
$compileType = $compileTypes{$mhName};
$numOfThreads = shift;
}
print {STDERR} "compile_engine called " . $moduleOrHeader . " " . $mhName . "\n";
#print "module type is $moduleOrHeader name is $mhName\n";
if ($moduleOrHeader eq "module") {
$fileName = $mhName . ".c";
} else {
$fileName = $mhName . ".h";
}
if ($moduleOrHeader eq "module") {
`cp ../src/engines/$fileName ../../../compiler/engineCompiler/$compileType/$fileName`;
#copy to pipelined anyway because we need to do the first pass
`cp ../src/engines/$fileName ../../../compiler/engineCompiler/$firstPassCompileType/$fileName`;
}
if ($moduleOrHeader eq "header") {
copyMacrosAndTypesFromHeaderFiles("multiThread");
copyMacrosAndTypesFromHeaderFiles("pipelined");
}
######################First pass Compile########################
if ($moduleOrHeader ne "header") {
$out=`cd ../../../compiler/engineCompiler/$firstPassCompileType/; java -cp .:antlr-3.4-complete.jar Main_fp $fileName 2>&1 | egrep 'Error|line'`;
`cd ../../../compiler/engineCompiler/$firstPassCompileType/; cp instr.magillac ../$compileType/instrFp.magillac; cp globalLvalues.magillac ../$compileType/globalLvalues.magillac`;
if ($out !~ /not pipelin/) {
$pipelinable{$mhName} = 1;
} else {
if ($compileType eq "pipelined") {
print {STDERR} "Gorilla++Error: cannot pipeline engine " . $fileName . " \n";
}
}
}
######################Second pass Compile########################
$out=`cd ../../../compiler/engineCompiler/$compileType/; java -cp .:antlr-3.4-complete.jar Main $fileName 2>&1 | egrep 'Error| line'`;
print {STDERR} RED, $out, RESET;
if ($moduleOrHeader eq "module") {
$out=`cd ../../../compiler/engineCompiler/$compileType/; ./thread_engine_gen.pl $mhName $numOfThreads| tee $mhName.scala`;
#print $out;
`cp ../../../compiler/engineCompiler/$compileType/$mhName.scala .`;
open FILE, "<", "../../../compiler/engineCompiler/$compileType/io.magillac" or die "cannot open io.magillac file\n";
@io_file_line_array = <FILE>;
close FILE;
}
if ($moduleOrHeader eq "header") {
`cp ../../../compiler/engineCompiler/$compileType/genericHeader ./$mhName.scala`;
`cat ../../../compiler/engineCompiler/$compileType/definition.magillac >> ./$mhName.scala`;
}
}
###################### Create the macro file ################
`cp ../../../compiler/engineCompiler/$headersCompileType/genericHeader macros.scala`;
`echo "trait include extends GorillaUtil {\n val dummy = 0 \n" >> macros.scala`;
###################### Compile the header files ##############
initializeMacrosAndTypes("multiThread");
initializeMacrosAndTypes("pipelined");
$buffer = `ls ../src/include/`;
chomp($buffer);
@headerFiles = split (' ', $buffer);
foreach $hFile (@headerFiles) {
chomp($hFile);
#print "Header file " . $hFile . "\n";
if ($hFile =~ /(.*)\.h/) {
$hFile =~ s/(.*)\.h/$1/;
compile_engine("header", $hFile);
`cat ../../../compiler/engineCompiler/$headersCompileType/macroDefintions.magillac >> macros.scala`;
}
}
###################
`echo "}\n" >> macros.scala`;
################# Find the engines ###################
@engineFileNames = ();
%numOfThreads = ();
%compileTypes = ();
%pipelinable = ();
foreach $line (@file_line_array) {
%efnHash = map {$_ => 1} @engineFileNames;
if ($line =~ /.*Engine\(\"(.*)\.c\"\).*/ && !exists($efnHash{$1})) {
push(@engineFileNames, $1);
$numOfThreads{$1} = "1";
$compileTypes{$1} = "multiThread";
#$compileTypes{$1} = "simpleStateMachine"; //THIS COMPILER HAS A BUG
}
if ($line =~ /.*MTEngine\(\"(.*)\.c\"\,\W*(\w*)\W*\).*/ && !exists($efnHash{$1})) {
push(@engineFileNames, $1);
$numOfThreads{$1} = $2;
$compileTypes{$1} = "multiThread";
}
if ($line =~ /.*PipeEngine\(\"(.*)\.c\"\).*/ && !exists($efnHash{$1})) {
push(@engineFileNames, $1);
$numOfThreads{$1} = "4";
$compileTypes{$1} = "pipelined";
}
}
################# Compile the engines #################
`>> $enginesMDFile`;
`> $enginesMDFile`;
%ioStrings = ();
foreach $ef (@engineFileNames) {
#print "compiling module" . $ef . "\n";
if (!exists $ioStrings{$ef}) {
compile_engine("module", $ef, $numOfThreads{$ef});
$ioStrings{$ef} = $io_file_line_array[0];
generate_engine_metaData($ef);
}
}
`cp $enginesMDFile .`;
################# Generate the top #################
%generatedMD = ();
foreach $line (@file_line_array) {
if ($line =~ /.*(Engine)\(\"(.*)\.c\"\).*/ ||
$line =~ /.*(MTEngine)\(\"(.*)\.c\"\,\W*\w*\W*\).*/) {
$engineName = $2;
$ioString = $ioStrings{$engineName};
$ioString =~ s/\((.*)\)\((.*)\) \((.*)\)/\($1, $2, $3\)/;
if (!exists($generatedMD{$engineName})) {
print " val " . $engineName . "_MD =" . " new gComponentMD" . $ioString . "\n";
$generatedMD{$engineName} = 1;
}
$engine_MD = $engineName . "_MD";
$line =~ s/(\W*)(\w+)?\b(\w+)\W*=\W*Engine\(\"(.*)\.c\"\)(.*)/$1$2 $3 = ($engine_MD , () => new $engineName (extCompName=\"$3\") ).asInstanceOf[(gComponentMD[Chisel.Data,Chisel.Data], () => gComponent[Chisel.Data,Chisel.Data])]/;
$line =~ s/(\W*)(\w+)?\b(\w+)\W*=\W*MTEngine\(\"(.*)\.c\"\,\W*\w*\W*\)(.*)/$1$2 $3 = ($engine_MD , () => new $engineName (extCompName=\"$3\")).asInstanceOf[(gComponentMD[Chisel.Data,Chisel.Data], () => gComponent[Chisel.Data,Chisel.Data])]/;
###Pipeline compiler Active
$line =~ s/(\W*)(\w+)?\b(\w+)\W*=\W*PipeEngine\(\"(.*)\.c\"\)(.*)/$1$2 $3 = ($engine_MD , () => new $engineName (extCompName=\"$3\")).asInstanceOf[(gComponentMD[Chisel.Data,Chisel.Data], () => gComponent[Chisel.Data,Chisel.Data])]/;
}
if ($line =~ /(\W*)(\w+)?\b(\w+)\W*=\W*DummyPipeEngine\(\W*(\w*)\W*\)(.*)/) {
$pipeDef = "gPipe(" . $4 . ")";
$line = "$1$2 $3 = ($3" . "_MD , () => (new $pipeDef)).asInstanceOf[(gComponentMD[Chisel.Data,Chisel.Data], () => gComponent[Chisel.Data,Chisel.Data])]\n";
}
if ($line =~ /.*Offload.*/) {
$line =~ s/(\W*)(\w+)?\b(\w+)\W*=\W*Offload\((.*)\)/$1$2 $3 = Offload \($4, extCompName="$3")/;
}
if ($line =~ /.*Chain.*/) {
$line =~ s/(\W*)(\w+)?\b(\w+)\W*=\W*Chain\((.*)\)/$1$2 $3 = Chain \($4, extCompName="$3")/;
}
if ($line =~ /.*Replicate.*/) {
$line =~ s/(\W*)(\w+)?\b(\w+)\W*=\W*Replicate\((.*)\)/$1$2 $3 = Replicate \($4, extCompName="$3")/;
}
if ($line =~ /.*result.*/ && ! ($line =~ /\/\/.*/)) {
print $line;
print " val generatedTop = result._2()\n";
print " generatedTop.io <> io\n";
} else {
print $line;
}
}
| seyedmaysamlavasani/GorillaPP | compiler/topCompiler/generateTop.pl | Perl | bsd-3-clause | 8,670 |
#!/usr/bin/perl
##
## Copyright (C) Fujitsu Technology Solutions 2016
## All rights reserved
##
# version string
our $version = '3.30.02';
# Version: 3.30.02
# Date: 2016-08-24
use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case bundling);
use Getopt::Long qw(GetOptions);
use Pod::Usage;
#use Time::Local 'timelocal';
#use Time::localtime 'ctime';
use utf8;
#------ This Script uses curl -------#
#### HELP ##############################################
=head1 NAME
check_fujitsu_server_REST.pl - Monitor server using ServerView REST interfaces
=head1 SYNOPSIS
check_fujitsu_server_REST.pl
{ -H|--host=<host> [-A|--admin=<host>]
{ [-P|--port=<port>]
[-T|--transport=<type>]
[-S|--service=<type>]
[-u|--user=<username> -p|--password=<pwd>]
[--cert=<certfile> [--certpassword=<pwd>]]
[--privkey=<keyfile> [--privkeypassword=<pwd>]]
[--cacert=<cafile>]
} |
-I|--inputfile=<filename>
{ --chkidentify | --systeminfo | --agentinfo
} |
{ [--chksystem]
{[--chkenv] | [--chkfan|--chkcooling] [--chktemp] }
[--chkpower]
{[--chkboard|--chkhardware] |
[--chkcpu] [--chkvoltage] [--chkmemmodule]}
[--chkstorage]
[--chkdrvmonitor]
[--chkupdate [{--difflist|--instlist} [-O|--outputdir=<dir>]]]
} |
{ [--chkmemperf [-w<percent>] [-c<percent>] ] |
[--chkfsperf [-w<percent>] [-c<percent>] ] |
[--chkcpuperf]
} |
{ -X|--rest={GET|POST|PUT|DELETE}
[-R|--requesturl=<urlpath>]
[-D|--data=<string>]
[--headers=<headerlines-list>]
[--ctimeout=<connection timeout in seconds>]
}
[-t|--timeout=<timeout in seconds>]
[-v|--verbose=<verbose mode level>]
} |
[-h|--help] | [-V|--version]
Checks a Fujitsu server using ServerView REST interfaces.
=head1 OPTIONS
=over 4
=item -H|--host=<name-or-ip> [-A|--admin=<ip>]
Host address as DNS name or ip address of the server.
With optional option -A an administrative ip address can be specified.
This might be the address of iRMC as an example.
The communication is done via the admin address if specified.
These options are used for curl calles without any preliminary checks.
=item [-P|--port=<port>] [-T|--transport=<type>]
REST service port number and transport type.
In the transport type 'http' or 'https' can be specified.
These options are used for curl calles without any preliminary checks.
=item [-S|--service=<type>]
Type of the REST Service.
"A", "Agent" - ServerView Server Control REST Service
"R", "REPORT" - iRMC Report (XML)
=item -u|--user=<username> -p|--password=<pwd>
Authentication data.
These options are used for curl calles without any preliminary checks.
=item [--cert=<certfile> [--certpassword=<pwd>]]
[--privkey=<keyfile> [--privkeypassword=<pwd>]]
[--cacert=<cafile>]
certfile|keyfile:
Client certificate file and Client private key file with optional password.
The certfile should include the key information if privkey is not specified.
cafile: CA certificate file is for the verification of the REST service certificates.
=item -I|--inputfile=<filename>
Host specific options read from <filename>. All options but '-I' can be
set in <filename>. These options overwrite options from command line.
=item --chkidentify
Tool option to check the access to the REST service.
This option can not be combined with other check options.
There are REST services which require and check no authentication for these requests.
=item --systeminfo
Only print available system information (dependent on server type).
This option can not be combined with other check options
=item --agentinfo
Only print available agent, provider or firmware version (dependent on server type).
This option can not be combined with other check options
=item --chksystem
=item --chkenv | [--chkfan|--chkcooling] [--chktemp]
=item --chkpower
=item --chkboard|--chkhardware | [--chkcpu] [--chkvoltage] [--chkmemmodule]
=item --chkstorage
Select range of system monitoring information: "chksystem" meaning anything besides
Environment (Cooling Devices, Temperature) or Power (Supply units and consumption).
Options chkenv and chkboard can be splitted to select only single components of
the above mentioned ranges.
Within functionality behind chkstorage is the monitoring of ServerView RAID data
if available and running.
Hint: --chkfan is an option available for compatibility reasons.
The selected functionality is identic to chkcooling which supports the monitoring
for any cooling device: fans and liquid pumps
=item --chkdrvmonitor
For server where ServerView Agent is installed: monitor "DriverMonitor" parts.
=item --chkupdate [{--difflist|--instlist} [-O|--outputdir=<dir>]]
For server where ServerView Agent is installed: monitor "Update Agent" status.
difflist:
Fetch Update component difference list and print the first 10 ones of these and store
all of these in an host specific output file in directory <dir> if specified.
instlist:
Fetch Update installed component list and print the first 10 ones of these and store
all of these in an host specific output file in directory <dir> if specified.
=item Pure REST: -X|--rest={GET|POST|PUT|DELETE} [-R|--requesturl=<urlpath>] [-D|--data=<string>]
=item Pure REST: [--headers=<headerlines-list>]
=item Pure REST: [--ctimeout=<connection timeout in seconds>]
REST calls - a wrapper around curl
=item -t|--timeout=<timeout in seconds>
Timeout for the script processing.
=item -v|--verbose=<verbose mode level>
Enable verbose mode (levels: 1,2).
Generates Multi-line output with verbose level 2.
=item -V|--version
Print version information and help text.
=item -h|--help
Print help text.
=cut
#### GLOBAL OPTIONS ###################################
# init main options
our $argvCnt = $#ARGV + 1;
our $optHost = '';
our $optTimeout = 0;
our $optShowVersion = undef;
our $optHelp = undef;
our $optPort = undef;
our $optAdminHost = undef;
our $optTransportType = undef;
# Authentication
our $optUserName = undef;
our $optPassword = undef;
our $optCert = undef;
our $optCertPassword = undef;
our $optPrivKey = undef;
our $optPrivKeyPassword = undef;
our $optCacert = undef;
# special sub options
our $optWarningLimit = undef;
our $optCriticalLimit = undef;
our $optInputFile = undef;
#our $optEncryptFile = undef;
#### global option and data
$main::verbose = 0;
$main::verboseTable = 0;
$main::scriptPath = undef;
#### GLOBAL DATA BESIDE OPTIONS
# global control definitions
our $skipInternalNamesForNotifies = 1; # suppress print of internal product or model names
our $useDegree = 0;
# define states
our @state = ('OK', 'WARNING', 'CRITICAL', 'UNKNOWN');
# option cross check result
our $setOverallStatus = undef; # no chkoptions
our $setOnlySystem = undef; # only --chksystem
# pure REST options
our $optRestAction = undef;
our $optRestData = undef;
our $optRestUrlPath = undef;
our $optRestHeaderLines = undef;
our $optConnectTimeout = undef;
# REST service specific options
our $optServiceType = undef; # AGENT, REPORT, iRMC, ISM, SOA
our $optChkIdentify = undef;
our $optSystemInfo = undef;
our $optAgentInfo = undef;
our $optUseDegree = undef;
our $optChkSystem = undef;
our $optChkEnvironment = undef;
our $optChkEnv_Fan = undef;
our $optChkFanPerformance = undef;
our $optChkEnv_Temp = undef;
our $optChkPower = undef;
our $optChkHardware = undef;
our $optChkCPU = undef;
our $optChkVoltage = undef;
our $optChkMemMod = undef;
our $optChkStorage = undef;
our $optChkDrvMonitor = undef;
#
our $optChkCpuLoadPerformance = undef;
our $optChkMemoryPerformance = undef;
our $optChkFileSystemPerformance = undef;
our $optChkNetworkPerformance = undef;
#
our $optChkUpdate = undef;
our $optChkUpdDiffList = undef;
our $optChkUpdInstList = undef;
our $optOutdir = undef;
# init output data
our $exitCode = 3;
our $error = '';
our $msg = '';
our $notifyMessage = '';
our $longMessage = '';
our $variableVerboseMessage = '';
our $performanceData = '';
our $serverID = undef;
# Other Adapter Collection (SCCI) - reference on Hash
our $otherPowerAdapters = undef;
our $otherPowerAdaptersExitCode = undef;
our $otherSystemBoardAdapters = undef;
our $otherSystemBoardAdaptersExitCode = undef;
our $otherStorageAdapters = undef;
our $otherStorageAdaptersExitCode = undef;
our $noSummaryStatus = 0;
our $statusOverall = undef;
our $statusEnv = undef;
our $allFanStatus = undef;
our $allTempStatus = undef;
our $statusPower = undef;
our $statusSystemBoard = undef;
our $allVoltageStatus = undef;
our $allCPUStatus = undef;
our $allMemoryStatus = undef;
our $statusMassStorage = undef;
our $raidCtrl = undef;
our $raidLDrive = undef;
our $raidPDevice = undef;
our $statusDrvMonitor = undef;
#### PRINT / FORMAT FUNCTIONS ##########################################
#-----------
sub finalize {
my $tmpExitCode = shift;
my $tmpState = shift;
#$|++; # for unbuffered stdout print (due to Perl documentation)
my $string = "@_";
$string = "$tmpState $string" if ($tmpState);
$string =~ s/^\s+//;
$string =~ s/\s+$//;
print "$string" if ($string);
print "\n";
alarm(0); # stop timeout
close(STDOUT);
close(STDERR);
exit($tmpExitCode);
}
#----------- miscelaneous helpers
sub addExitCode {
my $addCode = shift;
if (defined $addCode) {
if ($exitCode == 3) {
$exitCode = $addCode;
} else {
$exitCode = $addCode if ($addCode < 3 and $addCode > $exitCode);
}
}
} #addExitCode
sub addTmpExitCode {
my $addCode = shift;
my $tmpCode = shift;
if (defined $addCode) {
if ($tmpCode == 3 or !defined $tmpCode) {
$tmpCode = $addCode;
} else {
$tmpCode = $addCode if ($addCode < 3 and $addCode > $tmpCode);
}
}
return $tmpCode;
} #addTmpExitCode
sub negativeValueCheck {
my $val = shift;
my $maxval = 0xFFFFFFFF;
return undef if (!defined $val);
return $val if ($val < 0x7FFFFFFF);
#return 0 if ($val == 4294967295); # -0 ... for Perl::Net::SNMP
return -1 if ($val == 4294967295); # -0 ... for CIM
#my $diffval = $maxval - $val; #... for Perl::Net::SNMP
my $diffval = $maxval - $val +1; #... for CIM
my $newval = "-" . "$diffval";
return $newval;
} #negativeValueCheck
sub utf8tohex {
my $maxlen = shift;
my $string = shift;
my $result = "";
my $rest = $string;
# maxlen is required because length could not be calculated if there are
# control bytes inside like \0 or \f
for (my $i=0;$i<=$maxlen;$i++) {
if ($rest) {
for (my $t=0;$t<=255;$t++) {
my $subs = sprintf("%02X", $t);
if ($rest =~ m/^\x$subs/) { # found hex value
$result = $result . "$subs";
$rest =~ s/^\x$subs//; # cut with care
#print ">>>$rest\n";
$t = 256; # ... break loop
}
}
} # rest is not empty
else {
$i = $maxlen + 1;
}
} #for
return $result;
}
sub calcPercent {
my $max = shift;
my $current = shift;
return undef if (!$max or !$current);
return undef if ($max !~ m/^\d+$/ or $current !~ m/^\d+$/);
return undef if ($current > $max);
my $onePercent = $max / 100;
my $percentFloat = $current / $onePercent;
my $percent = undef;
$percent = sprintf("%.2f", $percentFloat);
return $percent;
} # calcPercent
#----------- performance data functions
sub addKeyUnitToPerfdata {
my $name = shift;
my $suffix = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
my $min = shift;
my $max = shift;
return if (!defined $current);
if (defined $name and $current) {
$performanceData .= ' ' . $name . '=' if ($name);
$performanceData .= $current;
$performanceData .= $suffix;
$performanceData .= ';'
if (defined $warning or defined $critical
or defined $min or defined $max);
$performanceData .= "$warning" if ($warning);
$performanceData .= ';'
if (defined $critical
or defined $min or defined $max);
$performanceData .= "$critical" if ($critical);
$performanceData .= ';'
if (defined $min or defined $max);
$performanceData .= "$min" if (defined $min);
$performanceData .= ';'
if (defined $max);
$performanceData .= "$max" if (defined $max);
}
} #addKeyUnitToPerfdata
sub addRpmToPerfdata {
my $name = shift;
my $speed = shift;
my $warning = shift;
my $critical = shift;
$speed = undef if (defined $speed and $speed == -1);
return if (!$name or !defined $speed);
$performanceData .= ' ' . $name . '=' . $speed . 'rpm' if (defined $speed);
$performanceData .= ';' if ($warning or $critical);
$performanceData .= "$warning" if ($warning);
$performanceData .= ';' if ($critical);
$performanceData .= "$critical" if ($critical);
} #addRpmToPerfdata
sub addTemperatureToPerfdata {
my $name = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
#my $min = shift;
#my $max = shift;
if (defined $name and $current) {
$name =~ s/[\(\)\.]/_/g;
while ($name =~ m/__/) {
$name =~ s/__/_/g;
} #while
$name =~ s/_+$//;
$performanceData .= ' ' . $name . '=' if ($name);
$performanceData .= $current;
$performanceData .= "\xc2\xb0" if ($useDegree);
$performanceData .= 'C';
$performanceData .= ';' if ($warning or $critical);
$performanceData .= "$warning" if ($warning);
$performanceData .= ';' if ($critical);
$performanceData .= "$critical" if ($critical);
}
} #addTemperatureToPerfdata
our $PSConsumptionBTUH = 0;
sub addPowerConsumptionToPerfdata {
my $current = shift;
my $warning = shift;
my $critical = shift;
my $min = shift;
my $max = shift;
$current = 0 if (defined $current and $current == 4294967295); # -0
$current = undef if (defined $current and $current == -1);
if (defined $current) {
$current = negativeValueCheck($current);
$warning = undef if (defined $warning and ($warning == 0 or $warning ==-1));
$critical = undef if (defined $critical and ($critical == 0 or $critical ==-1));
$min = undef if (defined $min and ($min == 0 or $min == -1));
$max = undef if (defined $max and ($max == 0 or $max == -1));
$warning = negativeValueCheck($warning);
$critical = negativeValueCheck($critical);
$min = negativeValueCheck($min);
$max = negativeValueCheck($max);
$warning = '' if (!defined $warning and (defined $critical or defined $min or defined $max));
$critical = '' if (!defined $critical and (defined $min or defined $max));
$min = '' if (!defined $min and defined $max);
my $unit = "Watt";
$unit = "Btu/h" if ($PSConsumptionBTUH);
$performanceData .= " PowerConsumption=$current" . $unit;
$performanceData .= ";$warning" if (defined $warning);
$performanceData .= ";$critical" if (defined $critical);
$performanceData .= ";$min" if (defined $min);
$performanceData .= ";$max" if (defined $max);
}
} #addPowerConsumptionToPerfdata
sub addPercentageToPerfdata {
my $name = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
return if (!defined $current and !defined $warning and !defined $critical);
$current = 0 if ($current and $current == 4294967295);
$warning = 0 if ($warning and $warning == 4294967295);
$critical = 0 if ($critical and $critical == 4294967295);
$performanceData .= ' ' . $name if ($name);
$performanceData .= '=' . $current . '%' if (defined $current);
$performanceData .= ';' if ($warning or $critical);
$performanceData .= "$warning" if ($warning);
$performanceData .= ';' if ($critical);
$performanceData .= "$critical" if ($critical);
} #addPercentageToPerfdata
#----------- output format functions
sub addMessage {
my $container = shift;
my $string = "@_";
$string =~ s/\x00(.)/$1/g;
if ($string) {
$msg .= $string if ($container =~ m/.*m.*/);
$notifyMessage .= $string if ($container =~ m/.*n.*/);
$longMessage .= $string if ($container =~ m/.*l.*/);
$variableVerboseMessage .= $string if ($container =~ m/.*v.*/);
}
}
sub addTopicInLine {
my $container = shift;
my $topic = shift;
my $tmp = '';
return if (!$topic);
$tmp .= " - $topic:";
addMessage($container, $tmp);
}
sub addComponentStatus {
my $container = shift;
my $comp = shift;
my $status = shift;
my $tmp = '';
$tmp .= " $comp($status)" if ($comp and defined $status);
addMessage($container, $tmp);
}
sub addStatusCount {
my $container = shift;
my $status = shift;
my $count = shift;
my $tmp = '';
return if (!$status or !$count);
$tmp .= "-$status($count)";
addMessage($container, $tmp);
}
sub addStatusTopic {
my $container = shift;
my $status = shift;
my $topic = shift;
my $index = shift;
my $tmp = '';
$tmp .= "$status:" if (defined $status);
$tmp .= " " if (defined $status and ($topic or $index));
$tmp .= "$topic" if ($topic);
$tmp .= "[$index]" if (defined $index);
$tmp .= " -" if (!defined $status and ($topic or $index));
addMessage($container,$tmp);
}
sub addTableHeader {
my $container = shift;
my $header = shift;
my $tmp = '';
$tmp .= "* $header:\n" if ($header);
addMessage($container,$tmp);
}
sub addKeyValue {
my $container = shift;
my $key = shift;
my $value = shift;
my $tmp = '';
$tmp .= " $key=$value" if ($value);
addMessage($container, $tmp);
}
sub addKeyLongValue {
my $container = shift;
my $key = shift;
my $value = shift;
my $tmp = '';
$tmp .= " $key=\"$value\"" if ($value);
addMessage($container, $tmp);
}
sub addKeyIntValue {
my $container = shift;
my $key = shift;
my $value = shift;
my $tmp = '';
$tmp .= " $key=$value" if (defined $value);
addMessage($container, $tmp);
}
sub addKeyUnsignedIntValue {
my $container = shift;
my $key = shift;
my $value = shift;
my $tmp = '';
$tmp .= " $key=..undef.." if (!defined $value and $main::verbose > 9);
$value = undef if (defined $value and $value < 0);
$tmp .= " $key=$value" if (defined $value);
addMessage($container, $tmp);
}
sub addKeyValueUnit {
my $container = shift;
my $key = shift;
my $value = shift;
my $addon = shift;
my $tmp = '';
if ($value) {
$tmp .= " $key=$value";
$tmp .= "$addon";
addMessage($container, $tmp);
}
}
sub addKeyIntValueUnit {
my $container = shift;
my $key = shift;
my $value = shift;
my $addon = shift;
my $tmp = '';
if (defined $value) {
$tmp .= " $key=$value";
$tmp .= "$addon";
addMessage($container, $tmp);
}
}
sub addKeyThresholdsUnit { # container, first-named-key, unit-string and than all thresholds
my $container = shift;
my $key = shift;
my $unit = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
my $min = shift;
my $max = shift;
my $tmp = '';
$unit = '???' if (!defined $unit);
$current = negativeValueCheck($current);
$warning = negativeValueCheck($warning);
$critical = negativeValueCheck($critical);
$min = negativeValueCheck($min);
$max = negativeValueCheck($max);
if (defined $current) {
$tmp .= " $key=$current" . $unit if (defined $current);
$tmp .= " Warning=$warning" . $unit if (defined $warning);
$tmp .= " Critical=$critical" . $unit if (defined $critical);
$tmp .= " Min=$min" . $unit if (defined $min);
$tmp .= " Max=$max" . $unit if (defined $max);
addMessage($container, $tmp);
}
} #addKeyThresholdsUnit
#----------- output format functions -for special items
sub addName {
my $container = shift;
my $name = shift;
my $forcequotes = shift;
my $tmp = '';
$name = undef if (defined $name and $name eq '');
$name = "\"$name\"" if ($name and ($forcequotes or $name =~ m/\s/));
$tmp .= " Name=$name" if ($name);
addMessage($container,$tmp);
}
sub addProductModel {
my $container = shift;
my $product = shift;
my $model = shift;
my $tmp = '';
if ((defined $product)
&& ($product =~ m/0xffffffff/)
) {
$product = undef;
}
if ($container =~ m/.*n.*/ and defined $product and $skipInternalNamesForNotifies
and ($product =~ m/^D\d{4}$/)
) {
$product = undef;
}
if ((defined $model)
&& ($model =~ m/0xfffffff/)) {
$model = undef;
}
if ($container =~ m/.*n.*/ and defined $model and $skipInternalNamesForNotifies
and ($model =~ m/A3C\d{8}/)) {
$model = undef;
}
$tmp .= " Product=\"$product\"" if ($product);
$tmp .= " Model=\"$model\"" if ($model);
addMessage($container, $tmp);
}
sub addSerialIDs {
my $container = shift;
my $id = shift;
my $id2 = shift;
my $tmp = '';
if ((defined $id) && ($id =~ m/00000000000/)) {
$id = undef;
}
if ((defined $id) && ($id =~ m/0xffffffff/)) {
$id = undef;
}
$id = "\"" . $id . "\"" if ($id and $id =~ m/\s/);
$id = "" if (!$id and $container =~ m/.*m.*/);
$tmp .= " ID=$id" if ($id);
$tmp .= " ID2=$id2" if ($id2);
addMessage($container, $tmp);
}
sub addLocationContact {
my $container = shift;
my $location = shift;
my $contact = shift;
my $tmp = '';
$location = undef if(defined $location and $location eq '');
$contact = undef if(defined $contact and $contact eq '');
$tmp .= " Location=\"$location\"" if ($location);
$tmp .= " Contact=\"$contact\"" if ($contact);
addMessage($container, $tmp);
}
sub addAdminURL {
my $container = shift;
my $admURL = shift;
my $tmp = '';
$admURL = undef if ($admURL and ($admURL !~ m/http/));
$admURL = undef if ($admURL and ($admURL =~ m/0\.0\.0\.0/));
$admURL = undef if ($admURL and ($admURL =~ m/255\.255\.255\.255/));
$admURL = undef if ($admURL and ($admURL =~ m/\/\/127\./));
$tmp .= " AdminURL=$admURL" if ($admURL);
addMessage($container, $tmp);
}
sub addIP {
my $container = shift;
my $ip = shift;
my $ip6 = shift;
my $tmp = '';
$ip = undef if (($ip) and ($ip =~ m/0\.0\.0\.0/));
$tmp .= " IP=$ip" if ($ip);
$tmp .= " IPv6=$ip6" if ($ip6);
return if (!defined $ip and !defined $ip6);
addMessage($container, $tmp);
}
sub addCelsius {
my $container = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
my $tmp = '';
my $suf = undef;
$suf .= "\xc2\xb0" if ($useDegree);
$suf .= "C";
if ($current) {
$tmp .= " Temperature=$current" . $suf;
$tmp .= " Warning=$warning" . $suf if (defined $warning and $warning !~ m/:/);
$tmp .= " Critical=$critical" . $suf if (defined $critical and $critical !~ m/:/);
$tmp .= " WarningRange=$warning" . $suf if (defined $warning and $warning =~ m/:/);
$tmp .= " CriticalRange=$critical" . $suf if (defined $critical and $critical =~ m/:/);
}
addMessage($container,$tmp);
}
sub add100dthVolt {
my $container = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
my $min = shift;
my $max = shift;
my $tmp = '';
#
$current = $current / 100 if ($current);
$warning = $warning / 100 if ($warning and $warning !~ m/:/);
$critical = $critical / 100 if ($critical and $critical !~ m/:/);
$min = $min / 100 if ($min);
$max = $max / 100 if ($max);
#
$current = sprintf("%.2f", $current) if ($current);
$warning = sprintf("%.2f", $warning) if ($warning and $warning !~ m/:/);
$critical = sprintf("%.2f", $critical) if ($critical and $critical !~ m/:/);
$min = sprintf("%.2f", $min) if ($min);
$max = sprintf("%.2f", $max) if ($max);
if ($warning and $warning =~ m/^(\d*):(\d*)$/) {
my $min = $1;
my $max = $2;
$min = $min / 100 if ($min);
$max = $max / 100 if ($max);
$min = sprintf("%.2f", $min) if ($min);
$max = sprintf("%.2f", $max) if ($max);
$warning = "$min:$max";
}
if ($critical and $critical =~ m/^(\d*):(\d*)$/) {
my $min = $1;
my $max = $2;
$min = $min / 100 if ($min);
$max = $max / 100 if ($max);
$min = sprintf("%.2f", $min) if ($min);
$max = sprintf("%.2f", $max) if ($max);
$critical = "$min:$max";
}
#
$tmp .= " Current=$current" . "V" if (defined $current);
$tmp .= " Warning=$warning" . "V" if (defined $warning);
$tmp .= " Critical=$critical" . "V" if (defined $critical);
$tmp .= " Min=$min" . "V" if (defined $min);
$tmp .= " Max=$max" . "V" if (defined $max);
addMessage($container,$tmp);
} # add100dthVolt
sub addKey100dthVolt {
my $container = shift;
my $key = shift;
my $current = shift;
my $tmp = '';
return if (!$key);
#
$current = $current / 100 if ($current);
#
$current = sprintf("%.2f", $current) if ($current);
#
$tmp .= " $key=$current" . "V" if (defined $current);
addMessage($container,$tmp);
} # addKey100dthVolt
sub addKeyVolt {
my $container = shift;
my $key = shift;
my $current = shift;
my $tmp = '';
return if (!$key);
#
$tmp .= " $key=$current" . "V" if (defined $current);
addMessage($container,$tmp);
} # addKeyVolt
sub addKeyRpm {
my $container = shift;
my $key = shift;
my $speed = shift;
my $tmp = '';
$speed = undef if (defined $speed and $speed == -1);
$tmp .= " $key=$speed" . "rpm" if ($speed);
addMessage($container,$tmp);
}
sub addKeyPercent {
my $container = shift;
my $key = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
my $min = shift;
my $max = shift;
my $tmp = '';
$current = 0 if ($current and $current == 4294967295);
$warning = 0 if ($warning and $warning == 4294967295);
$critical = 0 if ($critical and $critical == 4294967295);
$min = 0 if ($min and $min == 4294967295);
$max = 0 if ($max and $max == 4294967295);
$tmp .= " $key=$current" . "%" if (defined $current and $current != -1);
$tmp .= " Warning=$warning" . "%" if (defined $warning and $warning != -1);
$tmp .= " Critical=$critical" . "%" if (defined $critical and $critical != -1);
$tmp .= " Min=$min" . "%" if (defined $min and $min != -1);
$tmp .= " Max=$max" . "%" if (defined $max and $max != -1);
addMessage($container, $tmp);
}
sub addKeyWatt {
my $container = shift;
my $key = shift;
my $current = shift;
my $warning = shift;
my $critical = shift;
my $min = shift;
my $max = shift;
my $tmp = '';
my $unit = "Watt";
$unit = "Btu/h" if ($PSConsumptionBTUH);
$tmp .= " $key=$current" . $unit if ($current and $current != -1);
$tmp .= " Warning=$warning" . $unit if ($warning and $warning != -1);
$tmp .= " Critical=$critical" . $unit if ($critical and $critical != -1);
$tmp .= " Min=$min" . $unit if ($min and $min != -1);
$tmp .= " Max=$max" . $unit if ($max and $max != -1);
addMessage($container,$tmp);
}
sub addKeyMHz {
my $container = shift;
my $key = shift;
my $speed = shift;
my $tmp = '';
$speed = undef if (defined $speed and $speed == -1);
$tmp .= " $key=$speed" . "MHz" if ($speed);
addMessage($container,$tmp);
}
sub addKeyMB {
my $container = shift;
my $key = shift;
my $mbytes = shift;
my $tmp = '';
$mbytes = undef if (defined $mbytes and $mbytes < 0);
$tmp .= " $key=$mbytes" . "MB" if (defined $mbytes);
addMessage($container, $tmp);
}
###############################################################################
# FILE
sub writeTxtFile {
my $host = shift;
my $type = shift;
my $result = shift;
return if (!$optOutdir);
my $txt = undef;
my $txtFileName = $optOutdir . "/$host" . "_$type.txt";
open ($txt, ">", $txtFileName);
print $txt $result if ($result and $txt);
close $txt if ($txt);
} #writeTxtFile
#### OPTION FUNCTION ######
sub readDataFile {
my( $fileName ) = shift;
if (! $fileName) {
$exitCode = 10;
print "readDataFile: no filename \n" if ($main::verbose >= 60);
return undef;
}
print "readDataFile [$fileName] \n" if ($main::verbose >= 60);
if (! -r $fileName) {
$exitCode = 11;
print "readDataFile: [$fileName] not found \n" if ($main::verbose >= 60);
return undef;
}
my $fileText = undef;
open (my $infile, "<", $fileName);
if (!$infile) {
$exitCode = 12;
return undef;
} else {
$fileText = join('', <$infile> );
close $infile;
print "readDataFile: fileText [$fileText]\n" if ($main::verbose >= 60);
}
return ( $fileText );
} #readDataFile
sub getScriptOpts { # script specific
my $stringInput = shift;
my $inputType = shift;
my %options = ();
print "getScriptOpts: stringInput = $stringInput\n" if ($stringInput && $main::verbose >= 60);
print "getScriptOpts: inputType = $inputType\n" if ($inputType && $main::verbose >= 60);
if (! $stringInput) {
GetOptions(\%options,
"V|version",
"h|help",
"H|host=s",
"A|admin=s",
"P|port=i",
"T|transport=s",
"t|timeout=i",
"vtab=i",
"v|verbose=i",
"w|warning=i",
"c|critical=i",
"u|user=s",
"p|password=s",
"I|inputfile=s",
"inputdir=s",
"adigest",
"degree!",
"cert=s",
"certpassword=s",
"privkey=s",
"privkeypassword=s",
"cacert=s",
"X|rest=s",
"D|data=s",
"R|requesturlpath=s",
"headers=s",
"ctimeout=i",
"S|service=s" ,
"chkidentify" ,
"systeminfo" ,
"agentinfo" ,
"chksystem" ,
"chkenv" ,
"chkenv-fan|chkfan|chkcooling" ,
"chkenv-temp|chktemp" ,
"chkpower" ,
"chkhardware|chkboard" ,
"chkcpu" ,
"chkvoltage" ,
"chkmemmodule" ,
"chkdrvmonitor" ,
"chkstorage" ,
"chkfanperf" ,
"chkupdate" ,
"difflist",
"instlist",
"O|outputdir=s",
"chkcpuperf|chkcpuload" ,
"chkmemperf" ,
"chkfsperf" ,
"chknetperf" ,
) or pod2usage({
-msg => "\n" . 'Invalid argument!' . "\n",
-verbose => 1,
-exitval => 3
});
}
else {
if ($inputType && $inputType == 1) { #inputFile
# same options as above, but without '-I'
# @ARGV = split(/\s/,$stringInput);
require Text::ParseWords;
my $argsRef = [ Text::ParseWords::shellwords($stringInput)];
@ARGV = @{$argsRef};
#GetOptionsFromString($stringInput, \%options,
GetOptions(\%options,
"V|version",
"h|help",
"H|host=s",
"A|admin=s",
"P|port=i",
"T|transport=s",
"t|timeout=i",
"v|verbose=i",
"w|warning=i",
"c|critical=i",
"u|user=s",
"p|password=s",
"adigest",
"degree!",
"cert=s",
"certpassword=s",
"privkey=s",
"privkeypassword=s",
"cacert=s",
"ctimeout=i",
"S|service=s",
"chkidentify" ,
"systeminfo" ,
"agentinfo" ,
"chksystem" ,
"chkenv" ,
"chkenv-fan|chkfan|chkcooling" ,
"chkenv-temp|chktemp" ,
"chkpower" ,
"chkhardware|chkboard" ,
"chkcpu" ,
"chkvoltage" ,
"chkmemmodule" ,
"chkdrvmonitor" ,
"chkstorage" ,
"chkfanperf" ,
"chkupdate" ,
"difflist",
"instlist",
"O|outputdir=s",
"chkcpuperf|chkcpuload" ,
"chkmemperf" ,
"chkfsperf" ,
"chknetperf" ,
) or pod2usage({
-msg => "\n" . 'Invalid argument!' . "\n",
-verbose => 1,
-exitval => 3
});
# "E|encryptfile=s"
} # type = 1
} # inputstring
return ( %options );
} #getScriptOpts
sub getOptionsFromFile {
my $filename = shift;
my $inputType = shift;
my %options = ();
my $infileString = readDataFile( $filename);
if (defined $infileString) {
%options = getScriptOpts($infileString, $inputType);
#foreach my $ent (sort keys %options) {
#print "getOptionsFromFile: $ent = $options{$ent}\n";
#}
}
else {
print "+++getOptionsFromFile: no data read from [$filename]" if ($main::verbose >= 60);
}
return ( %options );
} #getOptionsFromFile
sub readOptions {
my %mainOptions; # command line optiond
my %ifileOptions; # -I inputfile options (command line)
#my %efileOptions; # -E encryptfile options (command line)
#my %iefileOptions; # -E encryptfile options (from -I inputfile)
#my $mainEncFilename = undef; # -E encryptfilename from command line
#my $ifileEncFilename = undef; # -E encryptfilename from -I inputfile
#
# command line options first
#
%mainOptions = getScriptOpts();
my $ibasename = $mainOptions{"I"};
my $idirname = $mainOptions{"inputdir"};
if ($ibasename) {
my $chkFileName = "";
$chkFileName .= $idirname . "/" if ($idirname
and $ibasename and $ibasename !~ m/^\//);
$chkFileName .= $ibasename;
$optInputFile = $chkFileName;
%ifileOptions = getOptionsFromFile($chkFileName, 1);
if ($exitCode == 10 or $exitCode == 11 or $exitCode == 12 and $chkFileName) {
pod2usage(
-msg => "\n" . "-I $chkFileName: filename empty !" . "\n",
-verbose => 0,
-exitval => 3
) if ($exitCode == 10);
pod2usage(
-msg => "\n" . "-I $chkFileName: file not existing or readable !" . "\n",
-verbose => 0,
-exitval => 3
) if ($exitCode == 11);
pod2usage(
-msg => "\n" . "-I $chkFileName: error reading file !" . "\n",
-verbose => 0,
-exitval => 3
) if ($exitCode == 12);
}
} # ibasename
#
# store all read options in %mainOptions
# options from -I inputFile overwrite command line options and
# options from -E encFile overwrite both, command line and input file
#
print "\n+++mainOptions before merge with file contents\n" if ($main::verbose >= 60);
foreach my $key_m (sort keys %mainOptions) {
print " $key_m = $mainOptions{$key_m}\n" if ($main::verbose >= 60);
}
print "+++\n" if ($main::verbose >= 60);
foreach my $key_i (sort keys %ifileOptions) {
print "inputfile: $key_i = $ifileOptions{$key_i}\n" if ($main::verbose >= 60);
$mainOptions{$key_i} = $ifileOptions{$key_i};
}
print "\n+++mainOptions at the end\n" if ($main::verbose >= 60);
foreach my $key_m (sort keys %mainOptions) {
print " $key_m = $mainOptions{$key_m}\n" if ($main::verbose >= 60);
}
print "+++\n" if ($main::verbose >= 60);
return ( %mainOptions);
} #readOptions
sub setOptions { # script specific
my $refOptions = shift;
my %options =%$refOptions;
#
# assign to global variables
# for options like 'x|xample' the hash key is always 'x'
#
my $k=undef;
$k="A"; $optAdminHost = $options{$k} if (defined $options{$k});
$k="degree"; $optUseDegree = $options{$k} if (defined $options{$k});
$k="vtab"; $main::verboseTable = $options{$k} if (defined $options{$k});
# pure REST specific
$k="D"; $optRestData = $options{$k} if (defined $options{$k});
$k="X"; $optRestAction = $options{$k} if (defined $options{$k});
$k="R"; $optRestUrlPath = $options{$k} if (defined $options{$k});
$k="ctimeout"; $optConnectTimeout = $options{$k} if (defined $options{$k});
$k="headers"; $optRestHeaderLines = $options{$k} if (defined $options{$k});
$k="cacert"; $optCacert = $options{$k} if (defined $options{$k});
$k="cert"; $optCert = $options{$k} if (defined $options{$k});
$k="certpassword"; $optCertPassword = $options{$k} if (defined $options{$k});
$k="privkey"; $optPrivKey = $options{$k} if (defined $options{$k});
$k="privkeypassword"; $optPrivKeyPassword = $options{$k} if (defined $options{$k});
# ACTIONS
$k="S"; $optServiceType = $options{$k} if (defined $options{$k});
$k="agentinfo"; $optAgentInfo = $options{$k} if (defined $options{$k});
$k="systeminfo"; $optSystemInfo = $options{$k} if (defined $options{$k});
$k="chkidentify"; $optChkIdentify = $options{$k} if (defined $options{$k});
$k="chksystem"; $optChkSystem = $options{$k} if (defined $options{$k});
$k="chkenv"; $optChkEnvironment = $options{$k} if (defined $options{$k});
$k="chkenv-fan"; $optChkEnv_Fan = $options{$k} if (defined $options{$k});
$k="chkenv-temp"; $optChkEnv_Temp = $options{$k} if (defined $options{$k});
$k="chkpower"; $optChkPower = $options{$k} if (defined $options{$k});
$k="chkhardware"; $optChkHardware = $options{$k} if (defined $options{$k});
$k="chkcpu"; $optChkCPU = $options{$k} if (defined $options{$k});
$k="chkvoltage"; $optChkVoltage = $options{$k} if (defined $options{$k});
$k="chkmemmodule"; $optChkMemMod = $options{$k} if (defined $options{$k});
$k="chkdrvmonitor"; $optChkDrvMonitor = $options{$k} if (defined $options{$k});
$k="chkstorage"; $optChkStorage = $options{$k} if (defined $options{$k});
$k="chkfanperf"; $optChkFanPerformance = $options{$k} if (defined $options{$k});
$k="chkcpuperf"; $optChkCpuLoadPerformance = $options{$k} if (defined $options{$k});
$k="chkmemperf"; $optChkMemoryPerformance = $options{$k} if (defined $options{$k});
$k="chkfsperf"; $optChkFileSystemPerformance = $options{$k} if (defined $options{$k});
$k="chknetperf"; $optChkNetworkPerformance = $options{$k} if (defined $options{$k});
$k="chkupdate"; $optChkUpdate = $options{$k} if (defined $options{$k});
$k="difflist"; $optChkUpdDiffList = $options{$k} if (defined $options{$k});
$k="instlist"; $optChkUpdInstList = $options{$k} if (defined $options{$k});
$k="O"; $optOutdir = $options{$k} if (defined $options{$k});
# ... the loop below is not realy necessary ... (kae)
foreach my $key (sort keys %options) {
#print "options: $key = $options{$key}\n";
$optShowVersion = $options{$key} if ($key eq "V" );
$optHelp = $options{$key} if ($key eq "h" );
$optHost = $options{$key} if ($key eq "H" );
$optPort = $options{$key} if ($key eq "P" );
$optTransportType = $options{$key} if ($key eq "T" );
$optTimeout = $options{$key} if ($key eq "t" );
$main::verbose = $options{$key} if ($key eq "v" );
$optWarningLimit = $options{$key} if ($key eq "w" );
$optCriticalLimit = $options{$key} if ($key eq "c" );
$optUserName = $options{$key} if ($key eq "u" );
$optPassword = $options{$key} if ($key eq "p" );
#$optInputFile = $options{$key} if ($key eq "I" ); # this is already set !
}
} #setOptions
sub evaluateOptions { # script specific
my $wrongCombination = undef;
# check command-line parameters
pod2usage(
-verbose => 2,
-exitval => 0,
) if ((defined $optHelp) || !$argvCnt);
pod2usage(
-msg => "\n$0" . ' - version: ' . $version . "\n",
-verbose => 0,
-exitval => 0,
) if (defined $optShowVersion);
pod2usage(
-msg => "\n" . 'Missing host address !' . "\n",
-verbose => 0,
-exitval => 3
) if ((!$optHost or $optHost eq '') and (!$optAdminHost or $optAdminHost eq ''));
#pod2usage(
# -msg => "\n" . 'Missing port number!' . "\n",
# -verbose => 0,
# -exitval => 3
#) if (!$optPort and ($optRestAction or $optRestData or $optRestUrlPath));
pod2usage(
-msg => "\n" . 'Missing password!' . "\n",
-verbose => 0,
-exitval => 3
) if (!$optPassword and $optUserName);
pod2usage(
-msg => "\n" . 'Missing PUT data!' . "\n",
-verbose => 0,
-exitval => 3
) if (!$optRestData and $optRestAction and ($optRestAction eq "PUT"));
# wrong combination tests
#pod2usage({
# -msg => "\n" . "Invalid argument combination \"$wrongCombination\"!" . "\n",
# -verbose => 0,
# -exitval => 3
#}) if ($wrongCombination);
#
if ($main::verbose > 100) {
$main::verboseTable = $main::verbose;
$main::verbose = 0;
}
# after readin of options set defaults
$optRestAction = "GET" if (!defined $optRestAction and ($optRestData or $optRestUrlPath));
#$optChkIdentify = 999 if (!defined $optRestAction and !defined $optChkIdentify
# and !defined $optAgentInfo and !defined $optSystemInfo);
$optTransportType = "https" if (!defined $optTransportType);
if (!defined $optChkUpdate and ($optChkUpdDiffList or $optChkUpdInstList)) {
$optChkUpdate = 999;
}
if (!defined $optRestAction and !defined $optChkIdentify
and !defined $optAgentInfo and !defined $optSystemInfo and (!defined $optChkUpdate))
{
if ((!defined $optChkSystem)
and (!defined $optChkEnvironment) and (!defined $optChkPower)
and (!defined $optChkHardware) and (!defined $optChkStorage)
and (!defined $optChkDrvMonitor)
and (!defined $optChkCpuLoadPerformance) and (!defined $optChkMemoryPerformance)
and (!defined $optChkFileSystemPerformance) and (!defined $optChkNetworkPerformance)
and (!defined $optChkEnv_Fan) and (!defined $optChkEnv_Temp)
and (!defined $optChkCPU) and (!defined $optChkVoltage) and (!defined $optChkMemMod)
and (!defined $optChkUpdate)
) {
$optChkSystem = 999;
$optChkEnvironment = 999;
$optChkPower = 999;
# exotic values if somebody needs to see if an optchk was explizit set via argv or if this
# is default
$setOverallStatus = 1;
}
if ((defined $optChkSystem)
and (!defined $optChkEnvironment) and (!defined $optChkPower)
and (!defined $optChkHardware) and (!defined $optChkStorage)
and (!defined $optChkDrvMonitor)
and (!defined $optChkCpuLoadPerformance) and (!defined $optChkMemoryPerformance)
and (!defined $optChkFileSystemPerformance) and (!defined $optChkNetworkPerformance)
and (!defined $optChkEnv_Fan) and (!defined $optChkEnv_Temp)
and (!defined $optChkCPU) and (!defined $optChkVoltage) and (!defined $optChkMemMod)
and (!defined $optChkUpdate)
) {
$setOnlySystem = 1;
}
if ($optChkSystem) {
$optChkStorage = 999;
}
} # no REST action
$useDegree = 1 if (defined $optUseDegree and $optUseDegree);
#
} #evaluateOptions
#
# main routine to handle options from command line and -I/-E filename
#
sub handleOptions {
# read all options and return prioritized
my %options = readOptions();
# assign to global variables
setOptions(\%options);
# evaluateOptions expects options set in global variables
evaluateOptions();
} #handleOptions
#########################################################################
# HELPER
#########################################################################
sub splitColonKeyValueOptionArray { # colon separated variant ! for HTTP header
my $optionString = shift;
my @keyValueArray = ();
my %keyValues = ();
return %keyValues if (!$optionString);
my $rest = $optionString;
while ($rest) {
my $key = undef;
my $value = undef;
$key = $1 if ($rest =~ m/^([^:]+):/);
$rest =~ s/^[^:]+:// if (defined $key); # strip key
if ($rest =~ m/^\s*[\"]/) {
$value = $1 if ($rest =~ m/^(\s*\"[^\"]+\")/);
$rest =~ s/^\s*\"[^\"]+\"// if (defined $value);
if (!defined $value) {
$value = '' if ($rest =~ m/^\s*\"\"/);
$rest =~ s/^\s\"\"// if (defined $value);
}
}
elsif ($rest =~ m/^\s*[\']/) {
$value = $1 if ($rest =~ m/^(\s*\'[^\']+\')/);
$rest =~ s/^\s*\'[^\']+\'// if (defined $value);
if (!defined $value) {
$value = '' if ($rest =~ m/^\s*\'\'/);
$rest =~ s/^\s*\'\'// if (defined $value);
}
}
else {
$value = $1 if ($rest =~ m/^(\s*[^,]+)/);
$rest =~ s/^\s*[^,]+// if (defined $value);
if (!defined $value and $rest =~ m/^,/) {
$value = '';
}
}
$value='' if (!defined $value);
$value=~ s/\'//g;
$value=~ s/\"//g;
$value = " $value" if ($value and $value !~ m/^\s+/);
my $oneKeyValue = undef;
$key =~ s/^\s*// if ($key);
$oneKeyValue .= "$key:" if ($key);
$oneKeyValue .= "$value";
push (@keyValueArray, $oneKeyValue);
$rest =~ s/^,// if ($rest);
} # while
if ($main::verbose >= 60) {
foreach my $keyValue (@keyValueArray) {
print "SPLIT ARRAY - $keyValue\n";
}
}
return @keyValueArray;
} #splitColonKeyValueOptionArray
#########################################################################
# Pure Socket
#########################################################################
use IO::Socket;
sub socket_checkSSM {
my $host = shift;
my $agentVersion = shift;
return undef if (!$host);
my $EOL = "\015\012";
my $BLANK = $EOL x 2;
my $ssmDocument = "/ssm/index.html";
my $lt720document = "/ssm/desktop/index.html";
my $versionDocument = "/ssm/version.txt";
my $versionlt720Document = "/ssm/desktop/version.txt";
my $remote = undef;
# with IO::SOCKET we try only http
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => $host,
PeerPort => "3172",
);
return undef if (!$remote); # no connection
$remote->autoflush(1);
print $remote "GET $versionDocument HTTP/1.0" . $EOL . "Host: $optHost:3172" . $BLANK;
my $response = undef;
while ( <$remote> ) { $response .= $_; }
close $remote;
undef $remote;
if ($main::verbose >= 10 and $response) {
print $response;
print "\n";
}
my $address = undef;
#### older version ( less than 7.20.10 )
# TODO ... with 7.20.10 ssm/index.html is living ... check agent version
if ( $response and $response !~ m/HTTP.*404/
and ($response =~ m/HTTP.*301/ or $response =~ m/^\s*$/))
{
my $isOld = 0;
if ($agentVersion =~ m/^(\d+)[^\d](\d+)/) {
my $main = $1;
my $sec = $2;
$isOld = 1 if ($main < 7);
$isOld = 1 if (!$isOld and $main==7 and $sec < 20);
}
if (!$isOld) {
$address = "https://$optHost:3172$ssmDocument" if ($optHost !~ m/:/);
$address = "https://[$optHost]:3172$ssmDocument" if ($optHost =~ m/:/);
} else {
$address = "https://$optHost:3172$lt720document" if ($optHost !~ m/:/);
$address = "https://[$optHost]:3172$lt720document" if ($optHost =~ m/:/);
}
}
return $address;
} #socket_checkSSM
#########################################################################
# REST
#########################################################################
our $useRESTverbose = 0;
sub restAuthenticationOptions {
my $outoptions = undef;
# ???? -K/--config <file> Specify which config file to read
$outoptions .= " -u'$optUserName':'$optPassword'" if ($optUserName and $optPassword);
return $outoptions if ($optTransportType and $optTransportType eq "http");
#### Certificates
# --cert <cert[:passwd]> Client certificate file and password (SSL)
# CITE: Note that this option assumes a "certificate" file that is the private
# key and the private certificate concatenated!
$outoptions .= " --cacert $optCacert" if ($optCacert);
$outoptions .= " --cert $optCacert" if ($optCert);
$outoptions .= ":$optCertPassword" if ($optCert and $optCertPassword);
$outoptions .= " --key $optPrivKey" if ($optPrivKey);
$outoptions .= " --pass $optPrivKeyPassword" if ($optPrivKeyPassword);
# --capath ?
# --cert-type <type> Certificate file type (DER/PEM/ENG) (SSL)
# --key-type <type> Private key file type (DER/PEM/ENG) (SSL)
# --egd-file <file> EGD socket path for random data (SSL)
# --engine <eng> Crypto engine to use (SSL). "--engine list" for list
# --random-file <file> File for reading random data from (SSL)
#### SSL Mode
# --ciphers <list> SSL ciphers to use (SSL)
# -2/--sslv2 Use SSLv2 (SSL)
# -3/--sslv3 Use SSLv3 (SSL)
# -1/--tlsv1 Use TLSv1 (SSL)
# ... TLSv1.1 ??? , TLSV1.2 ???
return $outoptions;
} #restAuthenticationOptions
our $pRestHandle = undef;
sub restCall {
my $action = shift;
my $url = shift;
my $data = shift;
# global optPort,optTransportType, optRestHeaderLines
my $host = $optHost;
$host = $optAdminHost if ($optAdminHost);
#
#### build the command
my $cmd = undef;
# -s -S ... ommit progrss bar or default statistic but print error messages
# -w '\n' not used if -v is set
# --no-keepalive or --keepalive-time nn does not result in corresponding HTTP Header part !
{ $cmd = "curl --stderr - -s -S";
$cmd .= " -v" if ($useRESTverbose or $main::verbose >= 60 or $optRestAction);
$cmd .= " --insecure" if ($optTransportType and $optTransportType eq "https");
$cmd .= " --connect-timeout $optConnectTimeout" if ($optConnectTimeout);
$cmd .= " --max-time $optConnectTimeout" if ($optConnectTimeout);
$cmd .= " -X $action" if (!($action eq "GET" and !$data));
# ... URL
my $fullURL = $optTransportType . "://";
$fullURL .= "[$host]" if ($host =~ m/:/); # IPv6
$fullURL .= "$host" if ($host !~ m/:/);
$fullURL .= ":$optPort" if ($optPort);
$fullURL .= "$url" if ($url);
$cmd .= " --url \'$fullURL\'";
$cmd .= " -g -6" if ($host =~ m/:/); # IPv6
# ... Data
$cmd .= " --data \"$data\"" if ($data);
# ... HTTP Header Parts
$cmd .= " -H'Connection: close'";
my @headerlines = splitColonKeyValueOptionArray($optRestHeaderLines);
foreach my $keyValue (@headerlines) {
$cmd .= " -H\'$keyValue\'";
} # foreach
# ... Authentication
my $addon = restAuthenticationOptions();
$cmd .= $addon if ($addon);
# ...
if ($main::verbose >= 10) {
my $printcmd = $cmd;
$printcmd =~ s/ \-u[^\s]+/ \-u****:****/;
print "**** cmd=` $printcmd `\n";
}
} # build command
#### CALL
open ($pRestHandle, '-|', $cmd);
print "**** read data ...\n" if ($main::verbose >= 20);
my $verboseText = undef;
my $outHeader = undef
my $outPayload = undef;
my $inData = undef;
my $errText = undef;
while (<$pRestHandle>) {
my $tmpStream = $_;
$tmpStream =~ s/\r\n/\n/g;
$tmpStream =~ s/\r/\n/g;
print "$tmpStream" if ($main::verbose >= 60); # $_
my $mergedVerbose = undef;
if ($tmpStream =~ m/\* Connection.+to host/) {
$mergedVerbose = $1 if ($tmpStream =~ /(\* Connection.+to host.*)/);
$tmpStream =~ s/\* Connection.+to host.*//;
$tmpStream =~ s/^\s*//;
} elsif ($tmpStream =~ m/\* Closing connection/) {
$mergedVerbose = $1 if ($tmpStream =~ /(\* Closing connection.*)/);
$tmpStream =~ s/\* Closing connection.*//;
$tmpStream =~ s/^\s*//;
}
my $donotuse = 0;
$donotuse = 1 if ($tmpStream =~ m/data not shown/ or $tmpStream =~ m/^\s*$/);
if (!$donotuse) {
if ($tmpStream =~ m/^\* /) {
#print "VERB\n";
$verboseText .= $tmpStream;
} elsif ($tmpStream =~ m/^> /) {
#print "IN\n";
$inData .= $tmpStream;
} elsif ($tmpStream =~ m/^< /) {
#print "OUTH\n";
$outHeader .= $tmpStream;
} elsif ($tmpStream =~ m/^curl:/) {
#print "ERR\n";
$errText .= $tmpStream;
} else {
#print "OUTP\n";
$outPayload .= $tmpStream;
}
if ($mergedVerbose) {
$verboseText .= $mergedVerbose;
$verboseText .= "\n" if ($verboseText !~ m/\n$/);
}
}
}
close $pRestHandle;
undef $pRestHandle;
####
$outPayload =~ s/\s+$// if ($outPayload);
#### print something for direct calls of REST actions
if ($optRestAction) {
print "HEADER:\n$outHeader\nBODY: " if ($outHeader and $main::verbose);
addExitCode(0) if ($outPayload);
if (!$outPayload and $outHeader and $outHeader =~ m/HTTP.* 20/) {
addExitCode(0);
}
addExitCode(2) if ($errText);
addMessage("l",$outPayload) if ($outPayload);
addMessage("l",$errText) if ($errText);
addMessage("v",$inData) if ($inData and $main::verboseTable == 100);
addMessage("v",$outHeader) if ($outHeader and $main::verboseTable == 100);
} elsif ($main::verbose >= 20) {
print "**** RESPONSE: \n$outPayload\n" if ($outPayload);
}
####
return ($outPayload,$outHeader,$errText);
} #restCall
#########################################################################
# JSON HELPER
#########################################################################
sub jsonUnescape {
my $value = shift;
return undef if (!$value);
my $rest = $value;
my $out = undef;
while ($rest) {
my $noesc = undef;
$noesc = $1 if ($rest =~ m/^([^\\]*)/);
$out .= $noesc if ($noesc);
$rest =~ s/^[^\\]*// if ($noesc);
# \" \\ \/ \b \f \n \r \t \u
# skip \r in a special way
$out .= "\"" if ($rest =~ m/^\\\"/);
$out .= "\\" if ($rest =~ m/^\\\\/);
$out .= "/" if ($rest =~ m/^\\[\/]/);
#$out .= "\b" if ($rest =~ m/^\\b/);
$out .= "\f" if ($rest =~ m/^\\f/);
if ($rest =~ m/^\\r\\n/) {
$out .= "";
} elsif ($rest =~ m/^\\r/) {
$out .= "\n";
}
$out .= "\n" if ($rest =~ m/^\\n/);
$out .= "\t" if ($rest =~ m/^\\t/);
#$out .= "\u" if ($rest =~ m/^\\u/);
$rest =~ s/^\\.// if ($rest =~ m/^\\/);
$rest = undef if (!$rest or $rest =~ m/^\s*$/);
} #while
return $out;
} # jsonUnescape
sub jsonEscape {
my $value = shift;
return undef if (!$value);
my $out = $value;
$out =~ s/\\/\\\\\\\\/g;
# \" \\ \/ \b \f \n \r \t \u
$out =~ s/\"/\\\\\\\"/g;
#$out =~ s/\b/\\\\\\b/g;
$out =~ s/\f/\\\\\\f/g;
$out =~ s/\n/\\\\\\n/g;
$out =~ s/\r/\\\\\\r/g;
$out =~ s/\t/\\\\\\t/g;
#$out =~ s/\u/\\\\\\u/g;
return $out;
} # jsonEscape
# ... "print" - build json stream
sub jsonPrintSimpleKeyValue {
my $key = shift;
my $value = shift;
my $stream = undef;
$stream .= "\\\"$key\\\":" if (defined $key);
if (defined $value) {
if ($value =~ m/^\d+$/) {
$stream .= "$value";
} elsif ($value =~ m/^true$/i or $value =~ m/^false$/i
or $value =~ m/^null$/i
) { # boolean and null
$stream .= "$value";
} else {
if ($value =~ m/^[A-Z]\:[\\\/]/) { # Windows-File-Name
# ATTENTION: SCCI Update-Management uses mixed / and \ in filename
$value =~ s/[\\]+/\\/g;
$value =~ s/\\/\\\\\\\\/g;
} elsif ($value =~ m/[\"\n\t\r\b\f\u\\]/) { # other escaped chars
$value = jsonEscape($value);
}
$stream .= "\\\"$value\\\"";
}
}
return $stream;
} #jsonPrintSimpleKeyValue
sub jsonPrintArray {
my $key = shift;
my $refArray = shift;
return undef if (!$refArray);
my @array = @{$refArray};
my $stream = undef;
my $prefix = undef;
$prefix = "\\\"$key\\\":" if (defined $key);
foreach my $refkeyvalue (@array) {
next if (!$refkeyvalue);
$stream .= "," if ($stream); # be sequence aware: first , and than { check !
$stream .= "[" if (!$stream);
#
if ($refkeyvalue->{"TYPE"} eq "ELEMENT") {
$stream .= $refkeyvalue->{"STREAM"};
}
elsif ($refkeyvalue->{"TYPE"} eq "ARRAY") {
$stream .= jsonPrintArray($refkeyvalue->{"KEY"},$refkeyvalue->{"VALUE"});
}
elsif ($refkeyvalue->{"TYPE"} eq "OBJECT") {
$stream .= jsonPrintObject($refkeyvalue->{"KEY"},$refkeyvalue->{"VALUE"});
}
} # foreach
$stream .= "]" if ($stream);
$stream = $prefix . $stream if ($prefix and $stream);
return $stream;
} # jsonPrintArray
sub jsonPrintObject {
my $key = shift;
my $refObject = shift;
return undef if (!$refObject);
my @array = @{$refObject};
my $stream = undef;
my $prefix = undef;
$prefix = "\\\"$key\\\":" if (defined $key);
foreach my $refkeyvalue (@array) {
next if (!$refkeyvalue);
$stream .= "," if ($stream); # be sequence aware: first , and than { check !
$stream .= "{" if (!$stream);
#
if ($refkeyvalue->{"TYPE"} eq "ELEMENT") {
$stream .= $refkeyvalue->{"STREAM"};
}
elsif ($refkeyvalue->{"TYPE"} eq "ARRAY") {
$stream .= jsonPrintArray($refkeyvalue->{"KEY"},$refkeyvalue->{"VALUE"});
}
elsif ($refkeyvalue->{"TYPE"} eq "OBJECT") {
$stream .= jsonPrintObject($refkeyvalue->{"KEY"},$refkeyvalue->{"VALUE"});
}
}
$stream .= "}" if ($stream);
$stream = $prefix . $stream if ($prefix and $stream);
return $stream;
} # jsonPrintObject
sub jsonPrintMain {
my $refObject = shift;
my $quiet = shift;
return undef if (!$refObject);
my $type = undef;
my $value = undef;
my $stream = undef;
$type = $refObject->{"TYPE"};
$value = $refObject->{"VALUE"};
return undef if ($type ne "OBJECT" or !$value);
my @objarray = @{$value};
foreach my $refkeyvalue (@objarray) {
$stream .= "," if ($stream);
$stream .= "{" if (!$stream);
if ($refkeyvalue->{"TYPE"} eq "ELEMENT") {
$stream .= $refkeyvalue->{"STREAM"};
}
elsif ($refkeyvalue->{"TYPE"} eq "ARRAY") {
$stream .= jsonPrintArray($refkeyvalue->{"KEY"},$refkeyvalue->{"VALUE"});
}
elsif ($refkeyvalue->{"TYPE"} eq "OBJECT") {
$stream .= jsonPrintObject($refkeyvalue->{"KEY"},$refkeyvalue->{"VALUE"});
}
} # foreach
$stream .= "}" if ($stream);
print "**** JSON: $stream\n" if ($stream and !$quiet and $main::verbose >= 60);
return $stream;
} #jsonPrintMain
# ... Create from the center to the outer object
sub jsonCreateSimpleKeyValue {
my $key = shift;
my $value = shift;
my %out = ();
return %out if (!defined $key and !defined $value);
$out{"KEY"} = $key if ($key);
$out{"VALUE"} = $value if (defined $value);
$out{"TYPE"} = "ELEMENT";
my $stream = jsonPrintSimpleKeyValue($key,$value);
$out{"STREAM"} = $stream if (defined $stream);
return \%out;
} #jsonCreateSimpleKeyValue
sub jsonCreateArrayKeyValue {
my $key = shift;
my $refArray = shift;
my %out = ();
my @array = ();
$refArray = \@array if (!$refArray);
$out{"KEY"} = $key;
$out{"VALUE"} = $refArray;
$out{"TYPE"} = "ARRAY";
return wantarray ? (\%out, $refArray) : \%out;
} # jsonCreateArrayKeyValue
sub jsonCreateObjectKeyValue {
my $key = shift;
my $refObject = shift;
my %out = ();
my @array = ();
$refObject = \@array if (!$refObject);
$out{"KEY"} = $key;
$out{"VALUE"} = $refObject;
$out{"TYPE"} = "OBJECT";
return wantarray ? (\%out, $refObject) : \%out;
} # jsonCreateObjectKeyValue
our $jsonIndent = undef;
# ... Create from the outer object to the center
sub jsonAddElement {
my $refArray = shift;
my $refKeyValue = shift;
return if (!$refArray or !$refKeyValue);
push ( @{$refArray}, $refKeyValue);
} # jsonAddElement
sub jsonAddSimpleKeyValue {
my $refArray = shift;
my $key = shift;
my $value = shift;
return if (!defined $value or !$refArray);
my $refKeyValue = jsonCreateSimpleKeyValue($key, $value);
jsonAddElement($refArray, $refKeyValue);
} # jsonAddSimpleKeyValue
sub jsonAddObject {
my $refArray = shift;
my $key = shift;
(my $refObject, my $refArrObjectParts) = jsonCreateObjectKeyValue($key);
jsonAddElement($refArray, $refObject);
return $refArrObjectParts;
} # jsonAddObject
sub jsonAddArray {
my $refArray = shift;
my $key = shift;
(my $refOutArray, my $refArrParts) = jsonCreateArrayKeyValue($key);
jsonAddElement($refArray, $refOutArray);
return $refArrParts;
} # jsonAddArray
# ... Split
sub jsonSplitQuoted {
my $response = shift;
my $rest = $response;
my $value = undef;
if ($rest =~ m/^\s*\"\"/) {
$value = "";
$rest =~ s/^\s*\"\"//;
} else {
$value = $1 if ($rest =~ m/^\s*[\"]([^\"]*)\"/); # "..."
if ($value) {
$rest =~ s/^\s*[\"][^\"]*\"//; # remove "..."
# check inserted \" !!!
if ($value =~ m/[\\]$/ and $value !~ m/[\\][\\]$/) {
my $search = 1;
while ($search) {
my $next = undef;
$next = $1 if ($rest =~ m/^([^\"]*)\"/);
if (defined $next and $next =~ m/^\s*$/) {
$search = 0;
$value .= "\"";
$rest =~ s/^\s*\"\s*//;
} elsif ($next) {
$value .= "\"";
$value .= $next;
$rest =~ s/^[^\"]*\"//;
} else {
$search = 0;
}
$search = 0 if ($value !~ m/[\\]$/);
} #while
} # if \"
}
$value = jsonUnescape($value) if ($value =~ m/\\/);
} # string
return ($rest, $value);
} # jsonSplitQuoted
sub jsonSplitUnQuoted {
my $response = shift;
my $rest = $response;
my $value = undef;
$value = $1 if ($rest =~ m/^([^,\]\}]+)/);
$rest =~ s/^[^,\]\}]+//;
return ($rest, $value);
} # jsonSplitUnQuoted
sub jsonSplitObjectList {
my $response = shift;
my @objList = ();
return \@objList if (!$response);
$response =~ s/^\s*\{//;
while ($response and $response !~ m/^\s*}/) {
my $key = undef;
my $value = undef;
my $type = undef;
my $refKeyValue = undef;
$key = $1 if ($response =~ m/^([^:]+):/);
$key =~ s/^\s*[\"\']// if ($key);
$key =~ s/[\"\']\s*$// if ($key);
$response =~ s/^[^:]+://;
if ($response =~ m/^\s*{/) { # OBJECT
my $save_jsonIndent = $jsonIndent;
$jsonIndent .= " ";
(my $rest, my $refObjList) = jsonSplitObjectList($response);
$refKeyValue = jsonCreateObjectKeyValue($key,$refObjList);
$response = $rest;
$jsonIndent = $save_jsonIndent;
} elsif ($response =~ m/^\s*\[/) { # ARRAY
my $save_jsonIndent = $jsonIndent;
$jsonIndent .= " ";
(my $rest, my $refArrList) = jsonSplitArray($response);
$refKeyValue = jsonCreateArrayKeyValue($key, $refArrList);
$response = $rest;
$jsonIndent = $save_jsonIndent;
} elsif ($response =~ m/^\s*[\"]/) { # ELEMENT (string)
($response, $value) = jsonSplitQuoted($response);
$refKeyValue = jsonCreateSimpleKeyValue($key,$value);
} else { # ELEMENT (unquoted types)
($response, $value) = jsonSplitUnQuoted($response);
$refKeyValue = jsonCreateSimpleKeyValue($key,$value);
}
if ($refKeyValue) {
push (@objList, $refKeyValue);
my $key = $refKeyValue->{"KEY"};
my $type = $refKeyValue->{"TYPE"};
my $value = $refKeyValue->{"VALUE"};
print "OBJECTLIST$jsonIndent-$key-$type-$value-\n" if ($main::verbose >= 30);
}
$response =~ s/^\s*,\s*// if ($response);
} # while
$response =~ s/\}\s*//;
return ($response, \@objList);
} # jsonSplitObjectList
sub jsonSplitArray {
my $response = shift;
my $rest = $response;
my @arrList = ();
return ($response, \@arrList) if (!$response);
$rest =~ s/^\s*\[//;
while ($rest and $rest !~ m/^\s*\]/) {
my $refKeyValue = undef;
if ($rest =~ m/^\s*{/) { # OBJECT
my $save_jsonIndent = $jsonIndent;
$jsonIndent .= " ";
($rest, my $refObj) = jsonSplitObjectList($rest);
$refKeyValue = jsonCreateObjectKeyValue(undef,$refObj);
$jsonIndent = $save_jsonIndent;
} elsif ($rest =~ m/^\s*\[/) { # ARRAY
my $save_jsonIndent = $jsonIndent;
$jsonIndent .= " ";
($rest, my $refArrList) = jsonSplitArray($response);
$refKeyValue = jsonCreateArrayKeyValue(undef, $refArrList);
$jsonIndent = $save_jsonIndent;
} elsif ($rest =~ m/^\s*[\"]/) { # ELEMENT (string)
my $value = undef;
($rest, $value) = jsonSplitQuoted($rest);
$refKeyValue = jsonCreateSimpleKeyValue(undef,$value);
} else { # ELEMENT (unquoted types)
my $value = undef;
($rest, $value) = jsonSplitUnQuoted($rest);
$refKeyValue = jsonCreateSimpleKeyValue(undef,$value);
}
if ($refKeyValue) {
push (@arrList, $refKeyValue);
my $type = $refKeyValue->{"TYPE"};
my $value = $refKeyValue->{"VALUE"};
print "OBJECTLIST$jsonIndent--$type-$value-\n" if ($main::verbose >= 30);
}
$rest =~ s/^\s*,\s*// if ($rest);
} # while
$rest =~ s/^\s*\]// if ($rest);
return ($rest, \@arrList);
} # jsonSplitArray
sub jsonSplitResponse { # expects only one main object !
my $response = shift;
my $refKeyValueObject = undef;
my $refKeyvalueMain = undef;
return undef if (!$response or $response !~ m/^\s*{.*}\s*$/m);
print "**** split response\n" if ($main::verbose >= 20);
$jsonIndent="";
(my $restnada, my $refArray) = jsonSplitObjectList($response);
$refKeyvalueMain = jsonCreateObjectKeyValue(undef, $refArray);
return $refKeyvalueMain;
} #jsonSplitResponse
# ... search or walk through json data
sub jsonGetSubKeyValue {
my $refParentObject = shift;
my $key = shift;
return undef if (!$refParentObject);
my $type = $refParentObject->{"TYPE"};
my $value = $refParentObject->{"VALUE"};
return undef if (!$value or $type eq "ELEMENT");
#
my @list = @{$value};
foreach my $refKeyValue ( @list) {
next if (!$refKeyValue);
my $t=$refKeyValue->{"TYPE"};
my $k=$refKeyValue->{"KEY"};
my $v=$refKeyValue->{"VALUE"};
print "**** ... compare $key with $k $t $v\n" if ($main::verboseTable == 100);
return $refKeyValue if ($refKeyValue->{"KEY"} =~ m/$key/i);
} # foreach
} # jsonGetSubKeyValue
sub jsonGetArrayList {
my $refKeyValue = shift;
return () if (!$refKeyValue);
my $type = $refKeyValue->{"TYPE"};
return () if ($type and $type ne "ARRAY");
my $refArray = $refKeyValue->{"VALUE"};
return @{$refArray};
} # jsonGetArrayList
sub jsonGetValue {
my $refKeyValue = shift;
return undef if (!$refKeyValue);
my $type = $refKeyValue->{"TYPE"};
return undef if ($type and $type ne "ELEMENT");
return $refKeyValue->{"VALUE"};
} #jsonGetValue
#########################################################################
# Simple XML Helper
#########################################################################
sub sxmlSplitObjectTag {
my $object = shift;
my @array = (); # stream array
return () if (!$object);
my $maintag = undef;
$maintag = $1 if ($object =~ m/\<*([^>\s]+)/); # main tag
return () if (!$maintag);
my $rest = $object;
# attention: be aware that tags might contain expression relevant signs !
$rest =~ s/^\<[^>]+\>//;
$rest =~ s!\s*\<[^<]+\>\s*$!!;
if ($rest !~ m/\</) { # simple content
push (@array, $rest);
return @array;
}
my $stream = undef;
my $tag = undef;
while ($rest) {
my $oneendtag = undef;
my $nextpart = undef;
$tag = $1 if (!$stream and $rest =~ m/^\s*\<([^>\s]+)/); # tag
#my $part = sprintf ("%.100s...", $rest);
if ($stream and $rest =~ m!^\s*\</!) {
$oneendtag = $1 if ($rest =~ m!^\s*\</([^\>\s]+)!); # endtag
if ($tag and $oneendtag and $tag eq $oneendtag) {
$nextpart = $1 if ($rest =~ m/^\s*([^\>]+\>)/);
$stream .= $nextpart;
$rest =~ s/^\s*([^\>]+\>)//;
push (@array, $stream);
$stream = undef;
$tag = undef;
} else {
$nextpart = $1 if ($rest =~ m/^(\<[^\<]*)/);
$stream .= $nextpart if ($nextpart);
$rest =~ s/^\<[^\<]*//;
}
} elsif (!$stream and $tag) {
$stream = "<$tag";
$rest =~ s/^\s*[^\>\s]+//;
} else {
$nextpart = $1 if ($rest =~ m/^(\<*[^\<]*)/);
$stream .= $nextpart if ($nextpart);
$rest =~ s/^\<*[^<]*//;
}
$rest =~ s/^\s+//;
#my $part = sprintf ("%.100s...", $rest);
} #while
return @array;
} # sxmlSplitObjectTag
#########################################################################
# SvAgent SCS-REST - SCCI Provider
#########################################################################
# OC OperationCode
# OE Operation ExtensionCode
# OI Operation Index
# 0xE222 "IdentificationParentIpAddress" did not work !!!
our $gAgentSCSversion = undef;
our $gAgentSCCIversion = undef;
our $gAgentSCCIcompany = undef;
our @gAgentCabinetNumbers = ();
our $gAgentHasMultiCabinets = undef;
our $gAgentGotAllNumbers = undef;
our %gAgentCoolingNumber = ();
our %gAgentTemperatureNumber = ();
our %gAgentPSUNumber = ();
our %gAgentCPUNumber = ();
our %gAgentVoltageNumber = ();
our %gAgentMemModNumber = ();
our %gAgentDrvMonNumber = ();
our $gAgentGotAllRAIDNumbers = undef;
our $gAgentRAIDCtrlNumber = undef;
our %gAgentRAIDPDeviceNumber = ();
our %gAgentRAIDLDriveNumber = ();
our %gAgentRAIDBatteryNumber = ();
our %gAgentRAIDPortNumber = ();
our %gAgentRAIDEnclosureNumber = ();
our %gAgentOC = (
"DetectedSECabinets" => 0x0220,
"PowerConsumptionCurrentValue" => 0x0533,
"PowerConsumptionLimitStatus" => 0x0534,
"UtilizationNominalSystemPowerConsumption" => 0x0930,
"UtilizationCurrentSystemPowerConsumption" => 0x0931,
"UtilizationCurrentPerformanceControlStatus" => 0x0932,
"UtilizationNominalMinSystemPowerConsumption" => 0x0933,
"UtilizationPowerConsumptionRedundancyLimit" => 0x0934,
#"ReadSystemInformation" => 0x0C00,
"CabinetSerialNumber" => 0x0C00,
"CabinetModel" => 0x0C00,
"ChassisModel" => 0x0C00,
"StatusTreeSubsystemStatus" => 0x2301,
"StatusTreeSubsystemName" => 0x2302,
"StatusTreeNumberSubsysComponents" => 0x2305,
"StatusTreeSubsysComponentStatus" => 0x2306,
"StatusTreeSubsysComponentName" => 0x2307,
"StatusTreeSystemStatus" => 0x230F,
"NumberFans" => 0x0300,
"NumberTempSensors" => 0x0400,
"NumberPowerSupplies" => 0x0500,
"NumberVoltages" => 0x0520,
"NumberCPUs" => 0x0600,
"NumberMemoryModules" => 0x0700,
"NetworkInfoNumberInterfaces" => 0x1700,
"DrvMonNumberComponents" => 0x1800,
"FanStatus" => 0x0301,
"CurrentFanSpeed" => 0x0302,
"FanDesignation" => 0x0304,
"CoolingDeviceType" => 0x0306,
"FanMaximumSpeed" => 0x0313,
"TempSensorStatus" => 0x0401,
"CurrentTemperature" => 0x0402,
"TempSensorDesignation" => 0x0404,
"PowerSupplyStatus" => 0x0501,
"PowerSupplyDesignation" => 0x0504,
"PowerSupplyLoad" => 0x0506,
"PowerSupplyNominal" => 0x0507,
"VoltageStatus" => 0x0521,
"VoltageDesignation" => 0x0522,
"VoltageThresholds" => 0x0523,
"CurrentVoltage" => 0x0524,
"VoltageOutputLoad" => 0x0525,
"VoltageFrequency" => 0x0526,
"VoltageNominal" => 0x0527,
"VoltageWarningThresholds" => 0x052A,
"CPUStatus" => 0x0601,
"CPUSocketDesignation" => 0x0602,
"CPUManufacturer" => 0x0604,
"CPUModelName" => 0x0605,
"CpuUsage" => 0x0612,
"CPUFrequency" => 0x061D,
"CPUInfo" => 0x0603,
"CpuOverallUsage" => 0x0613,
"MemoryModuleStatus" => 0x0701,
"MemoryModuleSocketDesignation" => 0x0702,
"MemoryModuleConfiguration" => 0x0707,
"MemoryModuleFrequency" => 0x0709,
"MemoryModuleSize" => 0x070A,
"MemoryModuleType" => 0x070B,
"MemoryModuleFrequencyMax" => 0x070E,
"MemoryModuleVoltage" => 0x070F,
"MemoryBoardDesignation" => 0x0752,
"MemoryModuleInfo" => 0x0703,
"UtilizationSystemMemory" => 0x0920,
"FileSystemNumberVolumes" => 0x1510,
"FileSystemVolumePathNames" => 0x1511,
"FileSystemVolumeDevicePath" => 0x1512,
"FileSystemVolumeTotalSize" => 0x1513,
"FileSystemVolumeFreeSize" => 0x1514,
"FileSystemVolumeFileSystemName" => 0x1515,
"FileSystemVolumeSerialNumber" => 0x1516,
"FileSystemVolumeLabel" => 0x1517,
"FileSystemVolumeUsage" => 0x1518,
"FileSystemVolumeType" => 0x1519,
"NetworkInfoIfDescription" => 0x1702,
"NetworkInfoIfIpAddress" => 0x1703,
"NetworkInfoIfMacAddress" => 0x1707,
"NetworkInfoIfConnectionName" => 0x170D,
"NetworkInfoIfAdapterIndex" => 0x1720,
"NetworkInfoAdapterNumber" => 0x1710,
"NetworkInfoAdapterName" => 0x1712,
"NetworkInfoAdapterDescription" => 0x1713,
"NetworkInfoIfUsage" => 0x170B,
"NetworkInfoIfSpeed" => 0x170C,
"NetworkInfoUtilization" => 0x170E,
"DrvMonComponentStatus" => 0x1801,
"DrvMonComponentName" => 0x1803,
"DrvMonComponentLocation" => 0x1804,
"DrvMonComponentClass" => 0x1805,
"DrvMonComponentDriverName" => 0x1807,
"RaidOverallStatus" => 0x2120,
"RaidAdapterOverallStatus" => 0x2121,
"RaidLogicalDrivesOverallStatus" => 0x2122,
"RaidPhysicalDrivesOverallStatus" => 0x2123,
"RaidOverallSmartStatus" => 0x2125,
"RaidNumberAdapters" => 0x2110,
"RaidNumberPhysicalDrives" => 0x2130,
"RaidNumberLogicalDrives" => 0x2150,
"RaidNumberBatteryBackupUnits" => 0x2160,
"RaidNumberAdapterPorts" => 0x2180,
"RaidNumberEnclosures" => 0x2190,
"RaidAdapterName" => 0x2111,
"RaidAdapterType" => 0x2112,
"RaidAdapterStatus" => 0x2116,
"RaidAdapterProperty" => 0x211D,
"RaidPhysicalDriveStatus" => 0x2131,
"RaidPhysicalDriveSmartStatus" => 0x2132,
"RaidPhysicalDriveName" => 0x2133,
"RaidPhysicalDriveBusType" => 0x2134,
"RaidPhysicalDrivePhysicalSize" => 0x2135,
"RaidPhysicalDriveProperty" => 0x213D,
"RaidPhysicalDriveEnclosureOid" => 0x213B,
"RaidPhysicalDriveAdapterPortOid" => 0x213C,
"RaidLogicalDriveStatus" => 0x2151,
"RaidLogicalDriveName" => 0x2152,
"RaidLogicalDriveLogicalSize" => 0x2153,
"RaidLogicalDrivePhysicalSize" => 0x2154,
"RaidLogicalDriveRaidLevel" => 0x2155,
"RaidLogicalDriveProperty" => 0x215D,
"RaidBatteryBackupUnitName" => 0x2161,
"RaidBatteryBackupUnitStatus" => 0x2162,
"RaidAdapterPortName" => 0x2181,
"RaidAdapterPortStatus" => 0x2182,
"RaidEnclosureName" => 0x2191,
"RaidEnclosureStatus" => 0x2192,
"RaidEnclosureAdapterPortOid" => 0x219C,
"UmServerStatus" => 0x3330,
"UmDiffNumberComponents" => 0x3300,
"UmDiffComponentPath" => 0x3301,
"UmDiffComponentVersion" => 0x3304,
"UmDiffInstalledVersion" => 0x3305,
"UmDiffRepos2InstRanking" => 0x3308,
"UmDiffIsMandatoryComponent" => 0x3309,
"UmDiffPreRequisitesText" => 0x330A,
"UmDiffUpdateVendorSeverity" => 0x330B,
"UmDiffRebootRequired" => 0x3310,
"UmDiffInstallDuration" => 0x3311,
"UmDiffDownloadSize" => 0x3312,
"UmDiffVendor" => 0x3315,
#"ReadConfigurationSpace" => 0xE001,
"ConfCabinetLocation" => 0xE001,
"ConfSystemDescription" => 0xE001,
"ConfSystemContact" => 0xE001,
"ConfSystemName" => 0xE001,
"ConfServerChassisModel" => 0xE001,
"ConfServerMgmtIpAddress" => 0xE001,
"ConfWarningTempThresh" => 0xE001,
"ConfCriticalTempThresh" => 0xE001,
"ConfPowerLimitModeMaxUsage" => 0xE001,
"ConfPowerLimitModeThreshold" => 0xE001,
"ConfBMCIpAddr" => 0xE001,
"ConfBmcIpv6Address" => 0xE001,
"ConfBMCMACAddr" => 0xE001,
"ConfBMCNetworkName" => 0xE001,
"SystemHostName" => 0xE107,
"SystemHostNameFQDN" => 0xE107,
"IdentificationCabinetNumber" => 0xE204,
"IdentificationPartitionId" => 0xE207,
"IdentificationPartitionName" => 0xE208,
"IdentificationChassisCabinetNumber" => 0xE209,
"IdentificationUuid" => 0xE20B,
"IdentificationUuidBigEndian" => 0xE20C,
"IdentificationAdminURLasIP" => 0xE20D,
"IdentificationParentIpAddress" => 0xE222,
"IdentificationParentMacAddress" => 0xE226,
"OsDesignation" => 0xE252,
"OsVersion" => 0xE254,
);
our %gAgentOE = (
"SystemHostName" => 0,
"SystemHostNameFQDN" => 1,
"IdentificationAdminURLasIP" => 0,
"OsVersion" => 0,
"ChassisModel" => 0x0108,
"CabinetSerialNumber" => 0x0600,
"CabinetModel" => 0x0608,
"ConfServerMgmtIpAddress" => 0x000C,
"ConfWarningTempThresh" => 0x0090,
"ConfCriticalTempThresh" => 0x0091,
"ConfCabinetLocation" => 0x0200,
"ConfSystemName" => 0x0201,
"ConfSystemDescription" => 0x0203,
"ConfSystemContact" => 0x0204,
"ConfServerChassisModel" => 0x0206,
"ConfBMCIpAddr" => 0x1440,
"ConfBMCMACAddr" => 0x1445,
"ConfBMCNetworkName" => 0x1430,
"ConfBmcIpv6Address" => 0x1A25,
"ConfPowerLimitModeMaxUsage" => 0x1A06,
"ConfPowerLimitModeThreshold" => 0x1A09,
);
####
sub agentJson_CreateJsonCmd {
(my $refMain, my $refArrMainParts) = jsonCreateObjectKeyValue(undef);
my $refArrSIPParts = jsonAddObject($refArrMainParts, "SIP");
jsonAddSimpleKeyValue($refArrSIPParts,"V",1);
my $refArrCmdParts = jsonAddArray($refArrSIPParts, "CMD");
return ($refMain,$refArrCmdParts);
} #agentJson_CreateJsonCmd
sub agentJson_AddCmd {
my $refCmdArray = shift;
my $scci = shift;
my $currentOE = shift;
my $currentOI = shift;
my $currentCA = shift;
my $currentDA = shift;
my $refArrParts = jsonAddObject($refCmdArray, undef);
my $oc = undef;
my $oe = $currentOE; # numeric OE
$oe = $gAgentOE{$currentOE} if (defined $currentOE and $currentOE !~ m/^\d*$/); # named OE
$oc = $gAgentOC{$scci};
$oe = $gAgentOE{$scci} if (!defined $currentOE);
return if (!$oc);
jsonAddSimpleKeyValue($refArrParts,"OC",$oc);
jsonAddSimpleKeyValue($refArrParts,"OE",$oe);
jsonAddSimpleKeyValue($refArrParts,"OI",$currentOI);
jsonAddSimpleKeyValue($refArrParts,"CA",$currentCA);
jsonAddSimpleKeyValue($refArrParts,"DA",$currentDA);
} #agentJson_AddCmd
sub agentJson_CallCmd {
my $refMain = shift;
my $stream = jsonPrintMain($refMain);
(my $providerout, my $outheader, my $errtext) =
restCall("POST","/rest/scci/JsonRequest?aid=SvNagios",$stream);
my $rc = agent_CheckError($providerout, $outheader, $errtext);
return ($rc, undef) if ($rc == 2);
return ($rc, $providerout);
} # agentJson_CallCmd
sub agentJson_ExtractCmd {
my $providerout = shift;
return undef if (!$providerout);
my $refoutMain = undef;
$refoutMain = jsonSplitResponse($providerout);
my $sipobj = jsonGetSubKeyValue($refoutMain, "SIP");
return undef if (!$sipobj);
my $refCmdarr = jsonGetSubKeyValue($sipobj, "CMD");
return $refCmdarr;
} # agentJson_ExtractCmd
sub agentJson_GetCmdSimpleData { # this is for simple "DA" values !
my $refCmdArray = shift;
my $scci = shift;
my $currentOE = shift;
my $currentOI = shift;
my $currentCA = shift;
return undef if (!$refCmdArray or!$scci);
my @cmdKeyValues = jsonGetArrayList($refCmdArray);
return undef if ($#cmdKeyValues < 0);
my $oc = undef;
my $oe = $currentOE; # numeric OE
$oe = $gAgentOE{$currentOE} if (defined $currentOE and $currentOE !~ m/^\d*$/); # named OE
$oc = $gAgentOC{$scci};
$oe = $gAgentOE{$scci} if (!defined $currentOE);
#
foreach my $refCmdKeyValue (@cmdKeyValues) {
next if (!$refCmdKeyValue);
my $responseOC = undef;
my $responseOE = undef;
my $responseOI = undef;
my $responseCA = undef;
my $responseDA = undef;
$responseOC = jsonGetSubKeyValue($refCmdKeyValue, "OC");
$responseOE = jsonGetSubKeyValue($refCmdKeyValue, "OE") if (defined $oe);
$responseOI = jsonGetSubKeyValue($refCmdKeyValue, "OI") if (defined $currentOI);
$responseCA = jsonGetSubKeyValue($refCmdKeyValue, "CA") if (defined $currentCA);
$responseDA = jsonGetSubKeyValue($refCmdKeyValue, "DA");
my $valueOC = undef;
my $valueOE = undef;
my $valueOI = undef;
my $valueCA = undef;
my $valueDA = undef;
$valueOC = jsonGetValue($responseOC) if (defined $responseOC);
$valueOE = jsonGetValue($responseOE) if ($oe and defined $responseOE);
$valueOI = jsonGetValue($responseOI) if (defined $currentOI and defined $responseOI);
$valueCA = jsonGetValue($responseCA) if (defined $currentCA and defined $responseDA);
$valueOE = 0 if (!defined $valueOE);
$valueOI = 0 if (!defined $valueOI);
$valueCA = 0 if (!defined $valueCA);
# ... OI is ommited in JSON response if 0
next if (defined $oc and (!defined $valueOC or $valueOC ne $oc));
next if (defined $oe and ($valueOE ne $oe));
next if (defined $currentOI and ($valueOI ne $currentOI));
next if (defined $currentCA and ($valueCA ne $currentCA));
if ($responseDA) {
if ($responseDA->{"TYPE"} eq "ELEMENT") {
$valueDA = jsonGetValue($responseDA);
} elsif ($responseDA->{"TYPE"} eq "OBJECT") {
$valueDA = jsonPrintMain($responseDA,1);
} elsif ($responseDA->{"TYPE"} eq "ARRAY") {
my $str = $responseDA->{"VALUE"};
my $k = $responseDA->{"KEY"};
#$valueDA = jsonPrintArray(undef, $responseDA);
$valueDA = jsonPrintArray(undef, $responseDA->{"VALUE"});
}
}
#$valueDA = jsonUnescape($valueDA) if ($valueDA =~ m/[\\]/);
return $valueDA;
} # foreach
return undef;
} # agentJson_GetCmdSimpleData
sub agentJson_RawWordSplit {
my $raw = shift;
my @nrarr = ();
return @nrarr if (!defined $raw or $raw !~ m/RAW/);
#my @nrarr = ($raw =~ m/[^\d]*(\d+)[^\d]*/); ... not working :-(
$raw =~ s/^.*\[//;
$raw =~ s/\].*$//;
@nrarr = split(/,/,$raw);
my @outarr = ();
for (my $i=0; $i <= $#nrarr; $i++) {
my $nr = $nrarr[$i];
$i++;
my $next = $nrarr[$i];
next if ($nr !~ m/^\d+$/ or $next !~ m/^\d+$/);
$nr += $next * 256;
push (@outarr, $nr);
} # for
return @outarr;
} # agentJson_RawWordSplit
sub agentJson_RawDWordSplit {
my $raw = shift;
my @nrarr = ();
return @nrarr if (!defined $raw or $raw !~ m/RAW/);
#my @nrarr = ($raw =~ m/[^\d]*(\d+)[^\d]*/); ... not working :-(
$raw =~ s/^.*\[//;
$raw =~ s/\].*$//;
@nrarr = split(/,/,$raw);
my @outarr = ();
for (my $i=0; $i <= $#nrarr; ) {
last if ($i+3 >$#nrarr);
my $n1 = $nrarr[$i];
my $n2 = $nrarr[$i+1]; # 256
my $n3 = $nrarr[$i+2]; # 65536
my $n4 = $nrarr[$i+3]; # 16777216
next if ($n1 !~ m/^\d+$/ or $n2 !~ m/^\d+$/ or $n3 !~ m/^\d+$/ or $n4 !~ m/^\d+$/);
$n1 += $n2 * 256;
$n1 += $n3 * 65536;
$n1 += $n4 * 16777216;
push (@outarr, $n1);
$i += 4;
} # for
return @outarr;
} # agentJson_RawDWordSplit
sub agentJson_RawDWordLongSplit {
my $raw = shift;
my @nrarr = ();
return @nrarr if (!defined $raw or $raw !~ m/RAW/);
#my @nrarr = ($raw =~ m/[^\d]*(\d+)[^\d]*/); ... not working :-(
$raw =~ s/^.*\[//;
$raw =~ s/\].*$//;
@nrarr = split(/,/,$raw);
my @outarr = ();
for (my $i=0; $i <= $#nrarr; ) {
last if ($i+7 >$#nrarr);
my $n1 = $nrarr[$i];
my $n2 = $nrarr[$i+1]; # 256
my $n3 = $nrarr[$i+2]; # 65536
my $n4 = $nrarr[$i+3]; # 16777216
my $n5 = $nrarr[$i+4]; #
my $n6 = $nrarr[$i+5]; #
my $n7 = $nrarr[$i+6]; #
my $n8 = $nrarr[$i+7]; #
if (!$n1 and !$n2 and !$n3 and !$n4 and !$n5 and !$n6 and !$n7 and !$n8) {
push (@outarr, 0);
$i += 8;
next;
}
last if ($n1 !~ m/^\d+$/ or $n2 !~ m/^\d+$/ or $n3 !~ m/^\d+$/ or $n4 !~ m/^\d+$/
or $n5 !~ m/^\d+$/ or $n6 !~ m/^\d+$/ or $n7 !~ m/^\d+$/ or $n8 !~ m/^\d+$/);
if ($n1 == 255 and $n2 == 255 and $n3 == 255 and $n4 == 255
and $n5 == 255 and $n6 == 255 and $n7 == 255 and $n8 == 255) {
push (@outarr, -1);
$i += 8;
next;
}
$n1 += $n2 * 256 if ($n2);
$n1 += ($n3* 256)* 256 if ($n3);
$n1 += (($n4* 256)* 256)* 256 if ($n4);
$n1 += ((($n5* 256)* 256)* 256)* 256 if ($n5);
$n1 += (((($n6* 256)* 256)* 256)* 256)* 256 if ($n6);
$n1 += ((((($n7* 256)* 256)* 256)* 256)* 256)*256 if ($n7);
push (@outarr, $n1);
$i += 8;
} # for
return @outarr;
} # agentJson_RawDWordLongSplit
sub agentJson_RawIPv4Address {
my $raw = shift;
return undef if (!defined $raw or $raw !~ m/RAW/);
$raw =~ s/^.*\[//;
$raw =~ s/\].*$//;
my $ip = $raw;
$ip =~ s/,/\./g if ($ip);
return $ip;
} # agentJson_RawIPv4Address
sub agentJson_RawIPAddresses {
my $raw = shift;
return undef if (!defined $raw or $raw !~ m/RAW/);
my $chk = $raw;
$chk =~ s/^.*\[//;
$chk =~ s/\].*$//;
my @nrarr = ();
@nrarr = split(/,/,$chk);
my $ipv4 = undef;
my $ipv6 = undef;
if ($#nrarr == 3) {
return (agentJson_RawIPv4Address($raw),undef);
} elsif ($#nrarr == 15) {
for (my $i=0; $i <= $#nrarr; $i++) {
my $nr = $nrarr[$i];
next if (!defined $nr);
my $hex = sprintf ("%02x", $nr);
$ipv6 .= ":" if ($ipv6);
$ipv6 .= "$hex";
$i++;
$nr = $nrarr[$i];
$hex = sprintf ("%02x", $nr);
$ipv6 .= "$hex";
} # for
} elsif ($#nrarr == 19) {
for (my $i=0; $i <= 3; $i++) {
my $nr = $nrarr[$i];
next if (!defined $nr);
$ipv4 .= "." if ($ipv4);
$ipv4 .= "$nr";
} # for
for (my $i=4; $i <= $#nrarr; $i++) {
my $nr = $nrarr[$i];
next if (!defined $nr);
my $hex = sprintf ("%02x", $nr);
$ipv6 .= ":" if ($ipv6);
$ipv6 .= "$hex";
$i++;
$nr = $nrarr[$i];
$hex = sprintf ("%02x", $nr);
$ipv6 .= "$hex";
} # for
}
return ($ipv4,$ipv6);
} #agentJson_RawIPAddresses
sub agentJson_RawMacAdresses {
my $raw = shift;
my @nrarr = ();
return @nrarr if (!defined $raw or $raw !~ m/RAW/);
$raw =~ s/^.*\[//;
$raw =~ s/\].*$//;
@nrarr = split(/,/,$raw);
my $mac = undef;
my $eui = undef;
for (my $i=0; $i <= $#nrarr; $i++) {
my $nr = $nrarr[$i];
next if (!defined $nr);
my $hex = sprintf ("%02X", $nr);
if ($i < 6 and ($#nrarr == 5 or $#nrarr == 11)) {
$mac .= ":" if ($mac);
$mac .= "$hex";
} elsif ($#nrarr == 7 or ($i > 5 and $#nrarr == 11) ) {
$eui .= ":" if ($eui);
$eui .= "$hex";
}
} # for
return ( $mac, $eui );
} # agentJson_RawMacAdresses
####
sub agent_CheckError {
my $providerout = shift;
my $outheader = shift;
my $errtext = shift;
my $tmpExitCode = 3;
if ($outheader and $outheader =~ m/HTTP.[\d\.]+ 401/) {
addMessage("m","- ") if (!$msg);
addMessage("m", "Authentication failed !");
addExitCode(2);
$tmpExitCode = 2;
if ($providerout and $providerout =~ m/faultdata=\"{/) {
my $providererr = $providerout;
$providererr =~ s/\n//g;
$providererr =~ s/.*faultdata=\"//;
$providererr =~ s/\" fault.receiver.url.*//;
addMessage("l",$providererr);
} elsif ($providerout) {
addMessage("l",$providerout);
}
} # 401
elsif ($outheader and $outheader !~ m/HTTP.[\d\.]+ 20\d/) {
addMessage("m","- ") if (!$msg);
addMessage("m", "Failure response !");
addExitCode(2);
$tmpExitCode = 2;
if ($providerout and $providerout =~ m/faultdata=\"{/) {
my $providererr = $providerout;
$providererr =~ s/\n//g;
$providererr =~ s/.*faultdata=\"//;
$providererr =~ s/\" fault.receiver.url.*//;
addMessage("l",$providererr);
} elsif ($providerout) {
addMessage("l",$providerout);
}
} elsif ($providerout and $providerout =~ m/\"error\"/) {
addMessage("m","- ") if (!$msg);
addMessage("m", "Some error !");
addMessage("l",$providerout);
addMessage("l","\n") if ($errtext);
addMessage("l",$errtext) if ($errtext);
addExitCode(2);
$tmpExitCode = 2;
} elsif (!defined $providerout) {
addMessage("m","- ") if (!$msg);
addMessage("m", "Empty response !");
addMessage("l",$errtext) if ($errtext);
addExitCode(2);
$tmpExitCode = 2;
}
return $tmpExitCode;
} # agent_CheckError
sub agent_getNumberOfSensors {
return if ($gAgentGotAllNumbers);
# IDEA: get all numbers in ONE call
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"NumberFans");
agentJson_AddCmd($refArrayCmd,"NumberTempSensors");
agentJson_AddCmd($refArrayCmd,"NumberPowerSupplies");
agentJson_AddCmd($refArrayCmd,"NumberCPUs");
agentJson_AddCmd($refArrayCmd,"NumberVoltages");
agentJson_AddCmd($refArrayCmd,"NumberMemoryModules");
agentJson_AddCmd($refArrayCmd,"DrvMonNumberComponents");
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
agentJson_AddCmd($refArrayCmd,"NumberFans",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"NumberTempSensors",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"NumberPowerSupplies",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"NumberCPUs",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"NumberVoltages",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"NumberMemoryModules",undef,undef,$ca);
}
}
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
{
my $refCmd = agentJson_ExtractCmd($providerout);
$gAgentCoolingNumber{0} = agentJson_GetCmdSimpleData($refCmd,"NumberFans");
$gAgentTemperatureNumber{0} = agentJson_GetCmdSimpleData($refCmd,"NumberTempSensors");
$gAgentPSUNumber{0} = agentJson_GetCmdSimpleData($refCmd,"NumberPowerSupplies");
$gAgentCPUNumber{0} = agentJson_GetCmdSimpleData($refCmd,"NumberCPUs");
$gAgentVoltageNumber{0} = agentJson_GetCmdSimpleData($refCmd,"NumberVoltages");
$gAgentMemModNumber{0} = agentJson_GetCmdSimpleData($refCmd,"NumberMemoryModules");
$gAgentDrvMonNumber{0} = agentJson_GetCmdSimpleData($refCmd,"DrvMonNumberComponents");
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
$gAgentCoolingNumber{$ca} =
agentJson_GetCmdSimpleData($refCmd,"NumberFans",undef,undef,$ca);
$gAgentTemperatureNumber{$ca}=
agentJson_GetCmdSimpleData($refCmd,"NumberTempSensors",undef,undef,$ca);
$gAgentPSUNumber{$ca} =
agentJson_GetCmdSimpleData($refCmd,"NumberPowerSupplies",undef,undef,$ca);
$gAgentCPUNumber{$ca} =
agentJson_GetCmdSimpleData($refCmd,"NumberCPUs",undef,undef,$ca);
$gAgentVoltageNumber{$ca} =
agentJson_GetCmdSimpleData($refCmd,"NumberVoltages",undef,undef,$ca);
$gAgentMemModNumber{$ca} =
agentJson_GetCmdSimpleData($refCmd,"NumberMemoryModules",undef,undef,$ca);
# storage has fan, temp, psu
}
}
}
$gAgentGotAllNumbers = 1;
} # agent_getNumberOfSensors
sub agent_getNumberforRAID {
return if ($gAgentGotAllRAIDNumbers);
# IDEA: get all numbers in TWO calls
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"RaidNumberAdapters");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
{
my $refCmd = agentJson_ExtractCmd($providerout);
$gAgentRAIDCtrlNumber = agentJson_GetCmdSimpleData($refCmd,"RaidNumberAdapters");
}
if (!$gAgentRAIDCtrlNumber) {
$gAgentGotAllRAIDNumbers = 1;
return;
}
#### BUILD
($refMain, $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0; $i<$gAgentRAIDCtrlNumber;$i++) {
agentJson_AddCmd($refArrayCmd,"RaidNumberPhysicalDrives",$i);
agentJson_AddCmd($refArrayCmd,"RaidNumberLogicalDrives",$i);
if ($main::verbose >= 3) {
agentJson_AddCmd($refArrayCmd,"RaidNumberBatteryBackupUnits",$i);
agentJson_AddCmd($refArrayCmd,"RaidNumberAdapterPorts",$i);
agentJson_AddCmd($refArrayCmd,"RaidNumberEnclosures",$i);
}
} # for
#### CALL REST/JSON
($rc, $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $i=0; $i<$gAgentRAIDCtrlNumber;$i++) {
$gAgentRAIDPDeviceNumber{$i}= agentJson_GetCmdSimpleData($refCmd,"RaidNumberPhysicalDrives",$i);
$gAgentRAIDLDriveNumber{$i} = agentJson_GetCmdSimpleData($refCmd,"RaidNumberLogicalDrives",$i);
$gAgentRAIDBatteryNumber{$i} = agentJson_GetCmdSimpleData($refCmd,"RaidNumberBatteryBackupUnits",$i);
$gAgentRAIDPortNumber{$i} = agentJson_GetCmdSimpleData($refCmd,"RaidNumberAdapterPorts",$i);
$gAgentRAIDEnclosureNumber{$i} = agentJson_GetCmdSimpleData($refCmd,"RaidNumberEnclosures",$i);
}
$gAgentGotAllRAIDNumbers = 1;
} # agent_getNumberforRAID
sub agent_negativeCheck {
my $current = shift;
return undef if (!defined $current);
if ($current >= 0x8000) {
$current = 65536 - $current;
$current = "-$current";
}
return $current;
} # agent_negativeCheck
sub agent_nextIFIPAddress {
my $ifnr = shift;
my $n = shift;
my @ips = ();
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfIpAddress", undef, ($n<<16) + $ifnr);
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return () if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
my $rawips = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfIpAddress", undef, ($n<<16) + $ifnr);
@ips = agentJson_RawIPAddresses($rawips) if (defined $rawips);
return @ips;
} # agent_nextIFIPAddress
####
sub agentConnectionTest {
# initial tests with http is faster than https !
my $save_optTransportType = $optTransportType;
$optTransportType = "http"; $optPort = "3172"; $optRestHeaderLines = undef;
my $save_optConnectTimeout = $optConnectTimeout;
$optConnectTimeout = 20 if (!defined $optConnectTimeout or $optConnectTimeout > 20);
(my $scsout, my $outheader, my $errtext) =
restCall("GET","/cmd?t=connector.NumericVersion",undef);
my $providerout = undef;
$scsout = undef if ($scsout and $scsout !~ m/^\d+$/); # 3172-OLD-Remote-Manager
$gAgentSCSversion = $scsout if ($scsout);
my $oldAgent = 0;
if ($scsout and $scsout >= 21000) {
($providerout, $outheader, $errtext) =
restCall("GET","/rest/scci/JsonWhat?aid=SvNagios",undef);
} elsif ($scsout) {
$oldAgent = 1;
}
# { "SVRemConSCCI": { "version":"7.10.16.04", "date":"Jul 15 2015 16:30:28", "company":"Fujitsu" }}
if ($providerout) {
$gAgentSCCIversion = $providerout;
$gAgentSCCIversion =~ s/.*version\"\s*:\s*\"//;
$gAgentSCCIversion =~ s/\".*//;
$gAgentSCCIcompany = undef;
$gAgentSCCIcompany = $1 if ($providerout =~ m/company.\:.([^\"]+)\"/);
}
#
addExitCode(0) if ($scsout and $providerout);
addExitCode(2) if (!$scsout or !$providerout);
if ($exitCode == 0 and $optChkIdentify) {
addMessage("m","- ") if (!$msg);
addKeyLongValue("m","REST-Service", "ServerView Server Control");
}
if ($exitCode == 2) {
if ($optServiceType) {
addMessage("m","- ") if (!$msg);
addMessage("m","[ERROR] Unable to connect to ServerView Server Control");
addMessage("l", $errtext) if ($errtext);
} else {
$errtext = "older ServerView Agent" if ($oldAgent and !defined $errtext);
$errtext = "missing error hint" if (!defined $errtext);
addMessage("l","[ERROR] Unable to connect to ServerView Server Control ($errtext)\n");
}
}
if ($exitCode == 0) {
$optServiceType = "Agent" if (!defined $optServiceType);
$optPort = "3172";
} else {
$optPort = undef;
}
$optRestHeaderLines = undef;
$optTransportType = $save_optTransportType;
$optConnectTimeout = $save_optConnectTimeout;
} #agentConnectionTest
sub agentSerialID {
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"CabinetSerialNumber");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $serialid = undef;
{
my $refCmd = agentJson_ExtractCmd($providerout);
$serialid = agentJson_GetCmdSimpleData($refCmd,"CabinetSerialNumber");
}
agentAllCabinetNumbers(); # may influence inventory and status monitoring !
return $serialid;
} # agentSerialID
sub agentOverallStatusValues {
my @statusText = ("Unknown",
"OK", "Warning", "Error", "Not present", "Not manageable",
"..unexpected..",
);
#### BUILD JSON
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"StatusTreeSystemStatus");
#agentJson_AddCmd($refArrayCmd,"StatusTreeNumberSubsystems");
for (my $i=0; $i < 7; $i++) { # no more than seven Subsystems
agentJson_AddCmd($refArrayCmd,"StatusTreeSubsystemStatus", $i);
agentJson_AddCmd($refArrayCmd,"StatusTreeSubsystemName", $i);
agentJson_AddCmd($refArrayCmd,"StatusTreeNumberSubsysComponents", $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT REST/JSON
my %statusTable = ();
my %nameTable = ();
my %numberTable = ();
my $tmpStatusOverall = undef;
{
my $refCmd = agentJson_ExtractCmd($providerout);
$tmpStatusOverall = agentJson_GetCmdSimpleData($refCmd,"StatusTreeSystemStatus");
$tmpStatusOverall = 6 if (!defined $tmpStatusOverall or $tmpStatusOverall < 0 or $tmpStatusOverall > 4);
if (defined $tmpStatusOverall) {
$statusOverall = 3;
$statusOverall = 0 if ($tmpStatusOverall == 1);
$statusOverall = 1 if ($tmpStatusOverall == 2);
$statusOverall = 2 if ($tmpStatusOverall == 3);
}
for (my $i=0; $i < 7; $i++) { # no more than seven Subsystems
my $status = agentJson_GetCmdSimpleData($refCmd,"StatusTreeSubsystemStatus", $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"StatusTreeSubsystemName", $i);
my $number = agentJson_GetCmdSimpleData($refCmd,"StatusTreeNumberSubsysComponents", $i);
$statusTable{$i} = $status;
$nameTable{$i} = $name;
$numberTable{$i} = $number;
} # for
}
#### EVAL System
if ($tmpStatusOverall == 6) {
addMessage("m","- ") if (!$msg);
addMessage("m", "ATTENTION: Missing system overall status");
} elsif ($optChkSystem) {
addExitCode($statusOverall) if (defined $statusOverall);
#addMessage("m","-") if (!$msg);
addComponentStatus("m", "Overall", $statusText[$tmpStatusOverall]);
}
$noSummaryStatus = 0;
#### EVAL Sub-Components 1st Level
my $iEnvironment = undef;
my $iPower = undef;
my $iSystemBoard = undef;
my $iStorage = undef;
my $iDrvMonitor = undef;
my $iNetwork = undef;
for (my $i=0; $i < 7; $i++) { # no more than seven Subsystems
my $printthis = 0;
my $name = $nameTable{$i};
my $status = $statusTable{$i};
my $tmpExitCode = 3;
next if (!$name or !defined $status);
$tmpExitCode = 2 if ($status == 3);
$tmpExitCode = 1 if ($status == 2);
$tmpExitCode = 0 if ($status == 1);
if ($name =~ m/Environment/i) {
$iEnvironment = $i;
$statusEnv = $tmpExitCode;
$printthis = 1 if ($optChkEnvironment);
addExitCode($tmpExitCode) if ($optChkEnvironment and $optChkEnvironment != 999);
} elsif ($name =~ m/PowerSupply/i) {
$iPower = $i;
$statusPower = $tmpExitCode;
$printthis = 1 if ($optChkPower);
addExitCode($tmpExitCode) if ($optChkPower and $optChkPower != 999);
} elsif ($name =~ m/MassStorage/i) {
$iStorage = $i;
$statusMassStorage = $tmpExitCode;
$printthis = 1 if ($optChkStorage);
addExitCode($tmpExitCode) if ($optChkStorage and $optChkStorage != 999);
} elsif ($name =~ m/Systemboard/i) {
$iSystemBoard = $i;
$statusSystemBoard = $tmpExitCode;
$printthis = 1 if ($optChkSystem);
addExitCode($tmpExitCode) if ($optChkSystem or $optChkHardware);
} elsif ($name =~ m/Deployment/i) {
$printthis = 1 if ($optChkSystem and $main::verbose and $tmpExitCode != 3);
} elsif ($name =~ m/Network/i) {
$iNetwork = $i;
$printthis = 1 if ($optChkSystem and $main::verbose and $tmpExitCode != 3);
} elsif ($name =~ m/DrvMonitor/i) {
$iDrvMonitor = $i;
$statusDrvMonitor = $tmpExitCode;
$printthis = 1 if ($optChkDrvMonitor);
addExitCode($tmpExitCode) if ($optChkDrvMonitor and $optChkDrvMonitor != 999);
}
#addMessage("m","-") if (!$msg);
addComponentStatus("m", $name,$statusText[$status]) if ($printthis);
} # for
$allFanStatus = 0 if (defined $iEnvironment
and defined $statusEnv and $statusEnv ==0);
$allTempStatus = 0 if (defined $iEnvironment
and defined $statusEnv and $statusEnv == 0);
$allVoltageStatus = 0 if (defined $iSystemBoard
and defined $statusSystemBoard and $statusSystemBoard == 0);
$allCPUStatus = 0 if (defined $iSystemBoard
and defined $statusSystemBoard and $statusSystemBoard == 0);
$allMemoryStatus = 0 if (defined $iSystemBoard
and defined $statusSystemBoard and $statusSystemBoard == 0);
my $tmpAllFanStatus = undef;
my $tmpAllTempStatus = undef;
my $tmpAllVoltageStatus = undef;
my $tmpAllCPUStatus = undef;
my $tmpAllMemoryStatus = undef;
#### Sub-Components 2nd Level
{
#### BUILD JSON
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
#agentJson_AddCmd($refArrayCmd,"StatusTreeSystemStatus");
my $addedCmd = 0;
for (my $i=0; $i < 7; $i++) { # no more than seven Subsystems
my $status = $statusTable{$i};
my $number = $numberTable{$i};
my $getPartCmds = 0;
next if (!defined $number or !defined $status or !$status);
if (defined $iEnvironment and $iEnvironment == $i) {
next if (!$optChkEnvironment and !$optChkEnv_Fan and !$optChkEnv_Temp);
$getPartCmds = 1 if ($optChkEnv_Fan or $optChkEnv_Temp);
$getPartCmds = 1 if ($status == 2 or $status == 3);
$getPartCmds = 1 if ($main::verbose >= 2);
} elsif (defined $iPower and $iPower == $i) {
next if (!$optChkPower);
$getPartCmds = 1 if ($status == 2 or $status == 3);
$getPartCmds = 1 if ($main::verbose >= 2);
} elsif (defined $iStorage and $iStorage == $i) {
next if (!$optChkStorage);
$getPartCmds = 1 if ($status == 2 or $status == 3);
$getPartCmds = 1 if ($main::verbose >= 2);
} elsif (defined $iSystemBoard and $iSystemBoard == $i) {
next if (!$optChkSystem and !$optChkHardware
and !$optChkCPU and !$optChkVoltage and !$optChkMemMod);
$getPartCmds = 1 if ($optChkHardware or $optChkCPU or $optChkVoltage or $optChkMemMod);
$getPartCmds = 1 if ($status == 2 or $status == 3);
$getPartCmds = 1 if ($main::verbose >= 2);
} elsif (defined $iNetwork and $iNetwork == $i) {
next if (!$optChkSystem);
$getPartCmds = 1 if ($status == 2 or $status == 3);
$getPartCmds = 1 if ($main::verbose >= 2);
} elsif (defined $iDrvMonitor and $iDrvMonitor == $i) {
next if (!$optChkDrvMonitor);
$getPartCmds = 1 if ($status == 2 or $status == 3);
$getPartCmds = 1 if ($main::verbose >= 2);
}
if ($getPartCmds) {
$addedCmd = 1;
for (my $i2nd=0; $i2nd < $number; $i2nd++) {
agentJson_AddCmd($refArrayCmd,"StatusTreeSubsysComponentStatus", $i, $i2nd);
agentJson_AddCmd($refArrayCmd,"StatusTreeSubsysComponentName", $i, $i2nd);
} # for 2nd Level
}
} #for 1st Level
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain) if ($addedCmd);
return if ($addedCmd and defined $rc and $rc == 2);
#### SPLIT REST/JSON
my %statusTable2nd = ();
my %nameTable2nd = ();
if ($addedCmd) {
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $i=0; $i < 7; $i++) { # no more than seven Subsystems
my $number = $numberTable{$i};
next if (!defined $number);
for (my $i2nd=0; $i2nd < $number; $i2nd++) {
my $status = agentJson_GetCmdSimpleData($refCmd,
"StatusTreeSubsysComponentStatus", $i, $i2nd);
next if (!defined $status);
my $name = agentJson_GetCmdSimpleData($refCmd,
"StatusTreeSubsysComponentName", $i, $i2nd);
$status = 0 if (!defined $name and !defined $name);
$name = '..undefined..' if (!defined $name);
$statusTable2nd{"$i-$i2nd"} = $status;
$nameTable2nd{"$i-$i2nd"} = $name;
} # for 2nd Level
} # for
} # get 2nd level data
#### EVAL 2nd Level
if ($addedCmd) {
for (my $i=0; $i < 7; $i++) { # no more than seven Subsystems
my $status = $statusTable{$i};
my $number = $numberTable{$i};
my $name = $nameTable{$i};
my $printPartCmds = 0;
my $getOtherAdapter = 0;
my $searchNotOK = 0;
my $getSingleComponent = 0;
next if (!defined $number or !defined $status or !$status);
if (defined $iEnvironment and $iEnvironment == $i) {
next if (!$optChkEnvironment and !$optChkEnv_Fan and !$optChkEnv_Temp);
$searchNotOK = 1 if ($status == 2 or $status == 3);
$getSingleComponent = 1 if ($optChkEnv_Fan or $optChkEnv_Temp);
} elsif (defined $iPower and $iPower == $i) {
next if (!$optChkPower);
$searchNotOK = 1 if ($status == 2 or $status == 3);
$getOtherAdapter = 1;
} elsif (defined $iStorage and $iStorage == $i) {
next if (!$optChkStorage);
$searchNotOK = 1 if ($status == 2 or $status == 3);
$getOtherAdapter = 1;
} elsif (defined $iSystemBoard and $iSystemBoard == $i) {
next if (!$optChkSystem and !$optChkHardware
and !$optChkCPU and !$optChkVoltage and !$optChkMemMod);
$searchNotOK = 1 if ($status == 2 or $status == 2);
$getSingleComponent = 1 if ($optChkCPU or $optChkVoltage or $optChkMemMod);
$getOtherAdapter = 1;
} elsif (defined $iNetwork and $iNetwork == $i) {
next if (!$optChkSystem);
$searchNotOK = 1 if ($status == 2 or $status == 3);
} elsif (defined $iDrvMonitor and $iDrvMonitor == $i) {
next if (!$optChkDrvMonitor);
$searchNotOK = 1 if ($status == 2 or $status == 3);
}
if ($searchNotOK or $getOtherAdapter or $getSingleComponent) {
addTableHeader("v", $name . " Adapters") if ($main::verbose >= 2
and $printPartCmds);
for (my $i2nd=0; $i2nd < $number; $i2nd++) {
my $status2nd = $statusTable2nd{"$i-$i2nd"};
my $name2nd = $nameTable2nd{"$i-$i2nd"};
next if (!defined $status2nd or !defined $name2nd);
# set global 2nd Level Status
my $tmpExitCode = 3;
$tmpExitCode = 2 if ($status2nd == 3);
$tmpExitCode = 1 if ($status2nd == 2);
$tmpExitCode = 0 if ($status2nd == 1);
if ($getOtherAdapter) {
if (defined $iPower and $i == $iPower
and $name2nd !~ m/SvPowerSupplies/)
{
my $adaptername = $name2nd;
$adaptername =~ s/^Sv//;
$adaptername =~ s/^Oem//;
$otherPowerAdapters->{$adaptername} =
$statusText[$status2nd];
$otherPowerAdaptersExitCode->{$adaptername} =
$tmpExitCode;
} elsif (defined $iSystemBoard and $iSystemBoard == $i
and $name2nd !~ m/SvVoltages/
and $name2nd !~ m/SvMemModules/
and $name2nd !~ m/SvCPUs/)
{
my $adaptername = $name2nd;
$adaptername =~ s/^Sv//;
$adaptername =~ s/^Oem//;
$otherSystemBoardAdapters->{$adaptername} =
$statusText[$status2nd];
$otherSystemBoardAdaptersExitCode->{$adaptername} =
$tmpExitCode;
} elsif (defined $iStorage and $iStorage == $i
and $name2nd !~ m/SvRaid/)
{
my $adaptername = $name2nd;
$adaptername =~ s/^Sv//;
$adaptername =~ s/^Oem//;
$otherStorageAdapters->{$adaptername} =
$statusText[$status2nd];
$otherStorageAdaptersExitCode->{$adaptername} =
$tmpExitCode;
}
} # other Adapter
if (defined $iEnvironment and $i == $iEnvironment) {
if ($name2nd =~ m/SvFans/) {
$allFanStatus = $tmpExitCode;
$tmpAllFanStatus = $status2nd;
}
elsif ($name2nd =~ m/SvTemp/) {
$allTempStatus = $tmpExitCode;
$tmpAllTempStatus = $status2nd;
}
}
if (defined $iSystemBoard and $i == $iSystemBoard) {
if ($name2nd =~ m/SvVoltages/) {
$allVoltageStatus = $tmpExitCode;
$tmpAllVoltageStatus = $status2nd;
}
elsif ($name2nd =~ m/SvCPUs/) {
$allCPUStatus = $tmpExitCode;
$tmpAllCPUStatus = $status2nd;
}
elsif ($name2nd =~ m/SvMemModules/) {
$allMemoryStatus = $tmpExitCode;
$tmpAllMemoryStatus = $status2nd;
}
}
#
if ($main::verbose >= 2 and $printPartCmds) {
if (defined $status2nd or $main::verbose >= 5) {
addStatusTopic("v",$statusText[$status2nd],"Adapter",'');
addName("v",$name2nd);
addMessage("v","\n");
}
}
elsif ($searchNotOK and ($status2nd == 2 or $status2nd == 3)) {
addStatusTopic("l",$statusText[$status2nd],"Adapter",'');
addName("l",$name2nd);
addMessage("l","\n");
} # warn, error
} # for 2nd Level
}
} # for 1st Level
} # print 2nd Level
} # 2ndLevel
addComponentStatus("m", "Cooling", $statusText[$tmpAllFanStatus])
if (defined $allFanStatus and $optChkEnv_Fan);
addComponentStatus("m", "TemperatureSensors", $statusText[$tmpAllTempStatus])
if (defined $allTempStatus and $optChkEnv_Temp);
addComponentStatus("m", "Voltages", $statusText[$tmpAllVoltageStatus])
if (defined $allVoltageStatus and ($optChkHardware or $optChkVoltage));
addComponentStatus("m", "CPUs", $statusText[$tmpAllCPUStatus])
if (defined $allCPUStatus and ($optChkHardware or $optChkCPU));
addComponentStatus("m", "MemoryModules", $statusText[$tmpAllMemoryStatus])
if (defined $allMemoryStatus and ($optChkHardware or $optChkMemMod));
} # agentOverallStatusValues
sub agentSystemInventoryInfo {
#### AGENT INFO
if ($gAgentSCCIversion) {
my $scsversion = undef;
if ($gAgentSCSversion) {
my $first = $1 if ($gAgentSCSversion =~ m/(\d+)\d\d\d\d$/);
my $second = $1 if ($gAgentSCSversion =~ m/\d+(\d\d)\d\d$/);
my $third = $1 if ($gAgentSCSversion =~ m/\d+\d\d(\d\d)$/);
$scsversion = "V$first.$second.$third";
}
if ($optAgentInfo) {
addKeyValue("m","Version",$gAgentSCCIversion);
addStatusTopic("l",undef,"AgentInfo", undef);
addName("l","SrvView Agent Server Control");
addKeyValue("l","Version",$gAgentSCCIversion);
addKeyLongValue("l","Base-REST-Service","ServerView Remote Connector $scsversion")
if ($scsversion);
addMessage("l","\n");
$exitCode = 0;
} elsif ($main::verbose >= 3) {
addStatusTopic("v",undef,"AgentInfo", undef);
addName("v","SrvView Agent Server Control");
addKeyValue("v","Version",$gAgentSCCIversion) if ($gAgentSCCIversion !~ m/\s/);
addKeyLongValue("v","Version",$gAgentSCCIversion) if ($gAgentSCCIversion =~ m/\s/);
addKeyLongValue("v","Company",$gAgentSCCIcompany);
addKeyLongValue("v","Base-REST-Service","ServerView Remote Connector $scsversion")
if ($scsversion);
addMessage("v","\n");
}
}
#### Other System infos beside IP and MAC
my $agentNetworkNumber = undef;
my $agentNetworkAdapterNumber = undef;
#### BUILD JSON
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"IdentificationUuid");
agentJson_AddCmd($refArrayCmd,"IdentificationUuidBigEndian");
agentJson_AddCmd($refArrayCmd,"IdentificationParentIpAddress");
agentJson_AddCmd($refArrayCmd,"IdentificationParentMacAddress");
agentJson_AddCmd($refArrayCmd,"ConfBMCIpAddr");
agentJson_AddCmd($refArrayCmd,"ConfBMCMACAddr");
agentJson_AddCmd($refArrayCmd,"ConfBMCNetworkName");
agentJson_AddCmd($refArrayCmd,"ConfBmcIpv6Address");
agentJson_AddCmd($refArrayCmd,"NetworkInfoNumberInterfaces");
agentJson_AddCmd($refArrayCmd,"NetworkInfoAdapterNumber")
if ($main::verbose >= 3);
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
{
$agentNetworkNumber =
agentJson_GetCmdSimpleData($refCmd,"NetworkInfoNumberInterfaces");
$agentNetworkAdapterNumber =
agentJson_GetCmdSimpleData($refCmd,"NetworkInfoAdapterNumber")
if ($main::verbose >= 3);
####
my $uuid = agentJson_GetCmdSimpleData($refCmd,"IdentificationUuid");
my $biguuid = agentJson_GetCmdSimpleData($refCmd,"IdentificationUuidBigEndian");
addStatusTopic("v",undef,"ServerInfo", undef);
addKeyValue("v","Uuid",$uuid);
addKeyValue("v","Uuid-BigEndian",$biguuid);
addMessage("v","\n");
####
my $mmbIP = agentJson_GetCmdSimpleData($refCmd,"IdentificationParentIpAddress");
my $mmbMAC = agentJson_GetCmdSimpleData($refCmd,"IdentificationParentMacAddress");
$mmbIP = agentJson_RawIPv4Address($mmbIP);
my @macs = agentJson_RawMacAdresses($mmbMAC);
if ($mmbIP or $#macs >= 0) {
addStatusTopic("v",undef,"ParentInfo",undef);
addKeyValue("v","IP",$mmbIP);
addKeyValue("v","MAC",$macs[0]);
addKeyValue("v","EUI",$macs[1]) if ($#macs >= 1);
addMessage("v","\n");
}
####
my $bmcIP = agentJson_GetCmdSimpleData($refCmd,"ConfBMCIpAddr");
my $bmcIP6raw = agentJson_GetCmdSimpleData($refCmd,"ConfBmcIpv6Address");
my $bmcMAC = agentJson_GetCmdSimpleData($refCmd,"ConfBMCMACAddr");
my $bmcName = agentJson_GetCmdSimpleData($refCmd,"ConfBMCNetworkName");
$bmcIP = agentJson_RawIPv4Address($bmcIP);
@macs = agentJson_RawMacAdresses($bmcMAC);
my @ips = agentJson_RawIPAddresses($bmcIP6raw);
my $ip6 = undef;
$ip6 = $ips[1] if ($#ips >= 1);
if ($bmcIP or $bmcIP6raw or $#macs >= 0) {
addStatusTopic("v",undef,"BMCInfo",undef);
addName("v",$bmcName);
addIP("v",$bmcIP, $ip6);
addKeyValue("v","MAC",$macs[0]);
addKeyValue("v","EUI",$macs[1]) if ($#macs >= 1);
addMessage("v","\n");
}
}
#### Network parts
return if (!$agentNetworkNumber);
#### BUILD
($refMain, $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$agentNetworkNumber;$i++) {
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfDescription", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfIpAddress", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfMacAddress", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfConnectionName", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfAdapterIndex", undef, $i)
if ($main::verbose >= 3);
} # for
#### CALL REST/JSON
($rc, $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
$refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","Network Nodes");
for (my $i=0;$i<$agentNetworkNumber;$i++) {
my $name = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfDescription", undef, $i);
my $rawips = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfIpAddress", undef, $i);
my $rawmac = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfMacAddress", undef, $i);
my $conn = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfConnectionName", undef, $i);
my $adapter = undef;
$adapter = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfAdapterIndex", undef, $i)
if ($main::verbose >= 3);
my @macs = agentJson_RawMacAdresses($rawmac);
my @ips = agentJson_RawIPAddresses($rawips);
my $ip4 = undef;
my $ip6 = undef;
$ip4 = $ips[0] if ($#ips >=0);
$ip6 = $ips[1] if ($#ips >=1);
addStatusTopic("v",undef, "Node", $i);
addName("v",$conn,1);
addKeyLongValue("v","Description",$name) if ($name and (!$conn or $conn ne $name));
# ... in Linux is $conn == $name
addIP("v",$ip4,$ip6);
if ($ip4 or $ip6) {
my @nextIP = ();
my $n = 1;
while ($n==1 or $#nextIP >= 0) {
$ip4 = undef; $ip6 = undef;
@nextIP = agent_nextIFIPAddress($i,$n);
$ip4 = $nextIP[0] if ($#nextIP >=0);
$ip6 = $nextIP[1] if ($#nextIP >=1);
addIP("v",$ip4,$ip6);
$n++;
} #while
}
addKeyValue("v","MAC",$macs[0]) if ($#macs >=0);
addKeyValue("v","EUI",$macs[1]) if ($#macs >=1);
addKeyIntValue("v","NICID", $adapter) if ($main::verbose >= 3);
addMessage("v","\n");
} # for
#
#### Network Adapter (NIC)
return if (!$agentNetworkAdapterNumber or $main::verbose < 3);
#### BUILD
($refMain, $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$agentNetworkAdapterNumber;$i++) {
agentJson_AddCmd($refArrayCmd,"NetworkInfoAdapterName", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoAdapterDescription", undef, $i);
} # for
#### CALL REST/JSON
($rc, $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
$refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","Network Adapter NIC");
for (my $i=0;$i<$agentNetworkAdapterNumber;$i++) {
my $name = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoAdapterName", undef, $i);
my $descr = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoAdapterDescription", undef, $i);
addStatusTopic("v",undef, "NetAdapter", $i);
addName("v",$name,1);
addKeyLongValue("v","Description",$descr);
addMessage("v","\n");
} # for
} # agentSystemInventoryInfo
sub agentSystemNotifyInformation {
my $multiChassisNr = undef;
#### BUILD JSON
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"CabinetModel");
agentJson_AddCmd($refArrayCmd,"SystemHostName");
agentJson_AddCmd($refArrayCmd,"SystemHostNameFQDN");
agentJson_AddCmd($refArrayCmd,"ConfCabinetLocation");
agentJson_AddCmd($refArrayCmd,"ConfSystemDescription");
agentJson_AddCmd($refArrayCmd,"ConfSystemContact");
agentJson_AddCmd($refArrayCmd,"ConfServerChassisModel");
agentJson_AddCmd($refArrayCmd,"IdentificationAdminURLasIP");
agentJson_AddCmd($refArrayCmd,"ConfServerMgmtIpAddress");
agentJson_AddCmd($refArrayCmd,"OsDesignation");
agentJson_AddCmd($refArrayCmd,"OsVersion");
agentJson_AddCmd($refArrayCmd,"IdentificationParentIpAddress");
agentJson_AddCmd($refArrayCmd,"IdentificationChassisCabinetNumber");
agentJson_AddCmd($refArrayCmd,"IdentificationPartitionId");
agentJson_AddCmd($refArrayCmd,"IdentificationPartitionName");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT REST/JSON
my $gotSomeInfos = 0;
my $refCmd = agentJson_ExtractCmd($providerout);
{
my $sysname = agentJson_GetCmdSimpleData($refCmd,"SystemHostName");
my $fqdn = agentJson_GetCmdSimpleData($refCmd,"SystemHostNameFQDN");
my $model = agentJson_GetCmdSimpleData($refCmd,"CabinetModel");
my $location = agentJson_GetCmdSimpleData($refCmd,"ConfCabinetLocation");
my $descr = agentJson_GetCmdSimpleData($refCmd,"ConfSystemDescription");
my $contact = agentJson_GetCmdSimpleData($refCmd,"ConfSystemContact");
my $housing = agentJson_GetCmdSimpleData($refCmd,"ConfServerChassisModel");
my $admURL = agentJson_GetCmdSimpleData($refCmd,"IdentificationAdminURLasIP");
my $manIp = agentJson_GetCmdSimpleData($refCmd,"ConfServerMgmtIpAddress");
my $osdescr = agentJson_GetCmdSimpleData($refCmd,"OsDesignation");
my $osversion = agentJson_GetCmdSimpleData($refCmd,"OsVersion");
my $parent = agentJson_GetCmdSimpleData($refCmd,"IdentificationParentIpAddress");
$multiChassisNr = agentJson_GetCmdSimpleData($refCmd,"IdentificationChassisCabinetNumber");
my $partID = agentJson_GetCmdSimpleData($refCmd,"IdentificationPartitionId");
my $partName = agentJson_GetCmdSimpleData($refCmd,"IdentificationPartitionName");
#
$osversion =~ s/\s+$// if ($osversion);
$parent = agentJson_RawIPv4Address($parent);
$gotSomeInfos = 1 if ($sysname or $model);
#
my $ssmURL = socket_checkSSM($optHost, $gAgentSCCIversion);
addName("n", $sysname);
addKeyLongValue("n", "Description", $descr);
addProductModel("n", undef, $model);
addKeyLongValue("n", "Housing", $housing);
addLocationContact("n", $location, $contact);
addKeyValue("n","MonitorURL", $ssmURL);
addAdminURL("n",$admURL);
addKeyValue("v","ManagementIP", $manIp);
addKeyValue("n","ParentMMB", $parent);
addKeyLongValue("n","OS",$osdescr);
addKeyLongValue("n","OS-Revision",$osversion);
if ($fqdn) {
$fqdn = undef if ($sysname and ($sysname eq $fqdn));
$fqdn = undef if ($fqdn and $sysname and ($sysname =~ m/$fqdn/i));
addKeyLongValue("n","FQDN",$fqdn);
}
if (defined $partID or $partName) {
addKeyIntValue("n","PartitionID",$partID);
addKeyLongValue("n","PartitionName",$partName);
}
} # get parts
if (defined $multiChassisNr) { # MultiNode CX series
#### BUILD JSON
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"CabinetModel",undef,undef,$multiChassisNr);
agentJson_AddCmd($refArrayCmd,"CabinetSerialNumber",undef,undef,$multiChassisNr);
agentJson_AddCmd($refArrayCmd,"ChassisModel",undef,undef,$multiChassisNr);
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT REST/JSON
my $refCmd = agentJson_ExtractCmd($providerout);
{
my $model = agentJson_GetCmdSimpleData($refCmd,"CabinetModel",
undef,undef,$multiChassisNr);
my $serial = agentJson_GetCmdSimpleData($refCmd,"CabinetSerialNumber",
undef,undef,$multiChassisNr);
my $name = agentJson_GetCmdSimpleData($refCmd,"ChassisModel",
undef,undef,$multiChassisNr);
addMessage("n","\n");
addStatusTopic("n", undef,"Multi Node System", undef);
addSerialIDs("n", $serial, undef);
addName("n", $name);
addProductModel("n",undef, $model);
}
} # MultiNode
if ($gAgentHasMultiCabinets) { # Additional Storage Cabinets
#our @gAgentCabinetNumbers = ();
#### BUILD JSON
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0; $i<=$#gAgentCabinetNumbers ; $i++) {
my $ca = $gAgentCabinetNumbers[$i];
next if (!defined $ca);
agentJson_AddCmd($refArrayCmd,"CabinetModel",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"CabinetSerialNumber",undef,undef,$ca);
agentJson_AddCmd($refArrayCmd,"ChassisModel",undef,undef,$ca);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT REST/JSON
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $i=0; $i<=$#gAgentCabinetNumbers ; $i++) {
my $ca = $gAgentCabinetNumbers[$i];
next if (!defined $ca);
my $model = agentJson_GetCmdSimpleData($refCmd,"CabinetModel",
undef,undef,$ca);
my $serial = agentJson_GetCmdSimpleData($refCmd,"CabinetSerialNumber",
undef,undef,$ca);
my $name = agentJson_GetCmdSimpleData($refCmd,"ChassisModel",
undef,undef,$ca);
addMessage("n","\n");
addStatusTopic("n", undef,"Storage Cabinet", $ca);
addSerialIDs("n", $serial, undef);
addName("n", $name);
addProductModel("n",undef, $model);
}
} # # Additional Storage Cabinets
addExitCode(0) if ($optSystemInfo and ($serverID or $gotSomeInfos));
if ($optSystemInfo and !$serverID and !$gotSomeInfos) {
addMessage("m"," - ATTENTION: Missing system information");
}
} #agentSystemNotifyInformation
####
sub agentPrintOneFan {
my $notify = shift;
my $verbose = shift;
my $i = shift;
my $status = shift;
my $speed = shift;
my $name = shift;
my $type = shift;
my $maxarr = shift;
my @statusFanText = ( "disabled",
"ok", "failed", "predicted-failure", "redundant-failed", "not-managable",
"not-installed", "..unexpected..",
);
$status = 7 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
#
my @maxvalues = agentJson_RawWordSplit($maxarr);
my $percent = undef;
if ($#maxvalues >= 1) {
$percent = calcPercent($maxvalues[1], $speed);
}
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status > 1 and $status < 4);
if ($medium) {
addStatusTopic($medium,$statusFanText[$status], "Fan", $i)
if (!$type);
addStatusTopic($medium,$statusFanText[$status], "Liquid",$i)
if ($type);
addName($medium,$name);
addKeyRpm($medium,"Speed", $speed);
addKeyPercent($medium,"NominalPercent", $percent);
addMessage($medium,"\n");
}
if ($optChkFanPerformance) {
$name =~ s/[\s\,\.\$\(\)]+/_/g;
$name =~ s/_+/_/g;
if ($i =~ m/([\d]+)\./) {
$name .= $1;
}
addRpmToPerfdata($name, $speed, undef, undef);
}
} # agentPrintOneFan
sub agentPrintOneTemperature {
my $notify = shift;
my $verbose = shift;
my $i = shift;
my $status = shift;
my $current = shift;
my $name = shift;
my $warn = shift;
my $crit = shift;
my @statusTempText = ( "not-available",
"OK", "..unexpected..", "failed", "warning-hot", "critical-hot",
"normal", "warning", "..unexpected..",
);
$status = 8 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 7);
#
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status >=3 and $status <= 7 and $status != 6 );
if ($medium) {
addStatusTopic($medium,$statusTempText[$status], "Sensor", $i);
addName($medium,$name);
addCelsius($medium,$current, $warn, $crit);
addMessage($medium,"\n");
}
#... Performance
$name =~ s/[\s\,\.\$\(\)]+/_/g;
$name =~ s/_+/_/g;
if ($i =~ m/([\d]+)\./) {
$name .= $1;
}
addTemperatureToPerfdata($name, $current, $warn, $crit)
if (!$main::verboseTable);
} # agentPrintOneTemperature
sub agentPrintOnePSU {
my $notify = shift;
my $verbose = shift;
my $i = shift;
my $status = shift;
my $current = shift;
my $name = shift;
my $nominal = shift;
my @statusPSUText = ( "not-present",
"ok", "failed", "AC-fail", "DC-fail","temperature-critical",
"not-manageable","fan-failure-prediction","fan-failure","power-save-mode",
"non-redundant-DC-fail","non-redundant-AC-fail","..unexpected..",
);
$status = 12 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 11);
#
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status > 1 and $status <= 11
and $status != 5 and $status != 9);
if ($medium) {
addStatusTopic($medium,$statusPSUText[$status], "PSU", $i);
addName($medium,$name);
addKeyWatt($medium,"CurrentLoad", $current, undef, undef, undef, $nominal);
addMessage($medium,"\n");
}
} # agentPrintOnePSU
####
sub agentAllCabinetNumbers {
# our @gAgentCabinetNumbers = ();
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"DetectedSECabinets");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
my $allCabinetsStream = agentJson_GetCmdSimpleData($refCmd,"DetectedSECabinets");
$gAgentHasMultiCabinets = 0 if (!defined $allCabinetsStream);
return if (!defined $allCabinetsStream);
@gAgentCabinetNumbers = agentJson_RawWordSplit($allCabinetsStream);
if ($#gAgentCabinetNumbers >= 0) {
$gAgentHasMultiCabinets = 1;
print "**** detect system with multiple cabinets\n" if ($main::verbose >=20);
}
} # agentAllCabinetNumbers
sub agentAllFanSensors {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentCoolingNumber{0});
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentCoolingNumber{0};$i++) {
agentJson_AddCmd($refArrayCmd,"FanStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"CurrentFanSpeed", undef, $i);
agentJson_AddCmd($refArrayCmd,"FanDesignation", undef, $i);
agentJson_AddCmd($refArrayCmd,"CoolingDeviceType", undef, $i);
agentJson_AddCmd($refArrayCmd,"FanMaximumSpeed", undef, $i);
} # for
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
for (my $i=0;$i<$gAgentCoolingNumber{$ca};$i++) {
agentJson_AddCmd($refArrayCmd,"FanStatus", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"CurrentFanSpeed", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"FanDesignation", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"CoolingDeviceType", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"FanMaximumSpeed", undef, $i,$ca);
} # for
} # foreach
} # cabinets
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
addTableHeader("v","Cooling Devices") if ($verbose);
{
my $refCmd = agentJson_ExtractCmd($providerout);
# TODO - Multi Cabinet
for (my $i=0;$i<$gAgentCoolingNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"FanStatus", undef, $i);
my $speed = agentJson_GetCmdSimpleData($refCmd,"CurrentFanSpeed", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"FanDesignation", undef, $i);
my $type = agentJson_GetCmdSimpleData($refCmd,"CoolingDeviceType", undef, $i);
my $maxarr = agentJson_GetCmdSimpleData($refCmd,"FanMaximumSpeed", undef, $i);
agentPrintOneFan($notify,$verbose,"$i",$status,$speed,$name,$type,$maxarr);
} # for
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
for (my $i=0;$i<$gAgentCoolingNumber{$ca};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"FanStatus", undef, $i,$ca);
my $speed = agentJson_GetCmdSimpleData($refCmd,"CurrentFanSpeed", undef, $i,$ca);
my $name = agentJson_GetCmdSimpleData($refCmd,"FanDesignation", undef, $i,$ca);
my $type = agentJson_GetCmdSimpleData($refCmd,"CoolingDeviceType", undef, $i,$ca);
my $maxarr = agentJson_GetCmdSimpleData($refCmd,"FanMaximumSpeed", undef, $i,$ca);
agentPrintOneFan($notify,$verbose,"$ca.$i",$status,$speed,$name,$type,$maxarr);
} # for
} # foreach
} # cabinets
}
} # agentAllFanSensors
sub agentAllTemperatureSensors {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentTemperatureNumber{0});
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentTemperatureNumber{0};$i++) {
agentJson_AddCmd($refArrayCmd,"TempSensorStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"CurrentTemperature", undef, $i);
agentJson_AddCmd($refArrayCmd,"TempSensorDesignation", undef, $i);
agentJson_AddCmd($refArrayCmd,"ConfWarningTempThresh", undef, $i);
agentJson_AddCmd($refArrayCmd,"ConfCriticalTempThresh", undef, $i);
# TODO - Multi Cabinet
} # for
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
for (my $i=0;$i<$gAgentTemperatureNumber{$ca};$i++) {
agentJson_AddCmd($refArrayCmd,"TempSensorStatus", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"CurrentTemperature", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"TempSensorDesignation", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"ConfWarningTempThresh", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"ConfCriticalTempThresh", undef, $i,$ca);
} # for
} # foreach
} # cabinets
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
addTableHeader("v","Temperature Sensors") if ($verbose);
{
my $refCmd = agentJson_ExtractCmd($providerout);
# TODO - Multi Cabinet
for (my $i=0;$i<$gAgentTemperatureNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"TempSensorStatus", undef, $i);
my $current = agentJson_GetCmdSimpleData($refCmd,"CurrentTemperature", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"TempSensorDesignation", undef, $i);
my $warn = agentJson_GetCmdSimpleData($refCmd,"ConfWarningTempThresh", undef, $i);
my $crit = agentJson_GetCmdSimpleData($refCmd,"ConfCriticalTempThresh", undef, $i);
agentPrintOneTemperature($notify,$verbose,$i,$status,$current,$name,$warn,$crit);
} # for
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
for (my $i=0;$i<$gAgentTemperatureNumber{$ca};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"TempSensorStatus", undef, $i,$ca);
my $current = agentJson_GetCmdSimpleData($refCmd,"CurrentTemperature", undef, $i,$ca);
my $name = agentJson_GetCmdSimpleData($refCmd,"TempSensorDesignation", undef, $i,$ca);
my $warn = agentJson_GetCmdSimpleData($refCmd,"ConfWarningTempThresh", undef, $i,$ca);
my $crit = agentJson_GetCmdSimpleData($refCmd,"ConfCriticalTempThresh", undef, $i,$ca);
agentPrintOneTemperature($notify,$verbose,"$ca.$i",$status,$current,$name,$warn,$crit);
} # for
} # foreach
} # cabinets
}
} # agentAllTemperatureSensors
sub agentAllPowerSupplies {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentPSUNumber{0});
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentPSUNumber{0};$i++) {
agentJson_AddCmd($refArrayCmd,"PowerSupplyStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"PowerSupplyDesignation", undef, $i);
agentJson_AddCmd($refArrayCmd,"PowerSupplyLoad", undef, $i);
agentJson_AddCmd($refArrayCmd,"PowerSupplyNominal", undef, $i);
} # for
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
for (my $i=0;$i<$gAgentPSUNumber{$ca};$i++) {
agentJson_AddCmd($refArrayCmd,"PowerSupplyStatus", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"PowerSupplyDesignation", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"PowerSupplyLoad", undef, $i,$ca);
agentJson_AddCmd($refArrayCmd,"PowerSupplyNominal", undef, $i,$ca);
} # for
} # foreach
} # cabinets
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
addTableHeader("v","Power Supplies") if ($verbose);
{
my $refCmd = agentJson_ExtractCmd($providerout);
# TODO - Multi Cabinet
for (my $i=0;$i<$gAgentPSUNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyStatus", undef, $i);
my $current = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyLoad", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyDesignation", undef, $i);
my $nominal = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyNominal", undef, $i);
agentPrintOnePSU($notify,$verbose,$i,$status,$current,$name,$nominal);
} # for
if ($gAgentHasMultiCabinets and $#gAgentCabinetNumbers >= 0) {
foreach my $ca (@gAgentCabinetNumbers) {
for (my $i=0;$i<$gAgentPSUNumber{$ca};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyStatus", undef, $i,$ca);
my $current = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyLoad", undef, $i,$ca);
my $name = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyDesignation", undef, $i,$ca);
my $nominal = agentJson_GetCmdSimpleData($refCmd,"PowerSupplyNominal", undef, $i,$ca);
agentPrintOnePSU($notify,$verbose,"$ca.$i",$status,$current,$name,$nominal);
} # for
} # foreach
} # cabinets
}
} # agentAllPowerSupplies
sub agentAllPowerConsumption {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
# explizit 0xE0 for "Total Power"
agentJson_AddCmd($refArrayCmd,"PowerConsumptionCurrentValue",0xE0);
agentJson_AddCmd($refArrayCmd,"PowerConsumptionLimitStatus",0xE0);
agentJson_AddCmd($refArrayCmd,"UtilizationNominalSystemPowerConsumption");
agentJson_AddCmd($refArrayCmd,"UtilizationCurrentSystemPowerConsumption"); # double
agentJson_AddCmd($refArrayCmd,"UtilizationCurrentPerformanceControlStatus");
agentJson_AddCmd($refArrayCmd,"UtilizationNominalMinSystemPowerConsumption");
agentJson_AddCmd($refArrayCmd,"UtilizationPowerConsumptionRedundancyLimit");
agentJson_AddCmd($refArrayCmd,"ConfPowerLimitModeMaxUsage");
agentJson_AddCmd($refArrayCmd,"ConfPowerLimitModeThreshold");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusConsText = ( "ok",
"warning","critical","no-limit","undefined","..unexpected.."
);
my @controlStatusText = ( "Power management disabled",
"Best performance", "Minimum power consumption", "Automatic mode",
"Scheduled",
"Power limit", "Low noise", "..unexpected..",
);
my $refCmd = agentJson_ExtractCmd($providerout);
my $status = agentJson_GetCmdSimpleData($refCmd,"PowerConsumptionLimitStatus", 0xE0);
my $current = agentJson_GetCmdSimpleData($refCmd,"PowerConsumptionCurrentValue", 0xE0);
my $nominal = agentJson_GetCmdSimpleData($refCmd,"UtilizationNominalSystemPowerConsumption");
my $nominalmin = agentJson_GetCmdSimpleData($refCmd,"UtilizationNominalMinSystemPowerConsumption");
my $ctrl = agentJson_GetCmdSimpleData($refCmd,"UtilizationCurrentPerformanceControlStatus");
my $crit = agentJson_GetCmdSimpleData($refCmd,"UtilizationPowerConsumptionRedundancyLimit");
my $warnlimit = agentJson_GetCmdSimpleData($refCmd,"ConfPowerLimitModeMaxUsage");
my $warnpercent = agentJson_GetCmdSimpleData($refCmd,"ConfPowerLimitModeThreshold");
#
$status = 4 if (!defined $status);
$status = 5 if ($status < 0 or $status > 4);
$ctrl = 7 if (!defined $ctrl or $ctrl < 0 or $ctrl > 6);
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 0 and $status < 3);
if ($medium) {
addTableHeader($medium,"Power Consumption");
addStatusTopic($medium,$statusConsText[$status],"PowerConsumption","");
addKeyWatt($medium,"Current", $current,
$warnlimit,$crit);
addKeyLongValue($medium,"PowerControl",$controlStatusText[$ctrl]);
addKeyPercent($medium,"WarningLimit",$warnpercent);
addKeyWatt($medium,"Nominal", $nominal);
addKeyWatt($medium,"NominalMin", $nominalmin);
addMessage($medium,"\n");
}
addPowerConsumptionToPerfdata($current, $warnlimit,$crit)
if (!$main::verboseTable);
} # agentAllPowerConsumption
sub agentAllCPU {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentCPUNumber{0});
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentCPUNumber{0};$i++) {
agentJson_AddCmd($refArrayCmd,"CPUStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"CPUSocketDesignation", undef, $i);
agentJson_AddCmd($refArrayCmd,"CPUManufacturer", undef, $i);
agentJson_AddCmd($refArrayCmd,"CPUModelName", undef, $i);
agentJson_AddCmd($refArrayCmd,"CPUFrequency", undef, $i);
agentJson_AddCmd($refArrayCmd,"CPUInfo", undef, $i);
agentJson_AddCmd($refArrayCmd,"CpuUsage", 0, $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusCPUText = ( "not-inserted",
"ok", "disabled", "error", "failed", "..obsolete..",
"prefailure-warning", "..unexpected..",
);
my $refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","CPU Table") if ($verbose);
for (my $i=0;$i<$gAgentCPUNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"CPUStatus", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"CPUSocketDesignation", undef, $i);
my $current = agentJson_GetCmdSimpleData($refCmd,"CPUFrequency", undef, $i);
my $manufact = agentJson_GetCmdSimpleData($refCmd,"CPUManufacturer", undef, $i);
my $model = agentJson_GetCmdSimpleData($refCmd,"CPUModelName", undef, $i);
my $infoobject = agentJson_GetCmdSimpleData($refCmd,"CPUInfo", undef, $i);
my $usage = agentJson_GetCmdSimpleData($refCmd,"CpuUsage", 0, $i);
$status = 6 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
#
if (!$current) {
my @nr = agentJson_RawWordSplit($infoobject);
if ($#nr >= 1) {
$current = $nr[1];
}
}
my $medium = undef;
$medium = "v" if ($verbose
and (($status and $status != 2) or $main::verbose >= 3));
$medium = "l" if ($notify and $status >= 3 and $status <= 5);
if ($medium) {
addStatusTopic($medium,$statusCPUText[$status], "CPU", $i);
addName($medium,$name);
addKeyMHz($medium, "Frequency", $current);
addKeyPercent($medium,"Usage",$usage);
addProductModel($medium,undef,$model);
addKeyLongValue($medium,"Manufacturer", $manufact);
addMessage($medium,"\n");
}
} # for
} # agentAllCPU
sub agentAllVoltages {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentVoltageNumber{0});
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentVoltageNumber{0};$i++) {
agentJson_AddCmd($refArrayCmd,"VoltageStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"VoltageDesignation", undef, $i);
agentJson_AddCmd($refArrayCmd,"VoltageThresholds", undef, $i);
agentJson_AddCmd($refArrayCmd,"CurrentVoltage", undef, $i);
agentJson_AddCmd($refArrayCmd,"VoltageOutputLoad", undef, $i);
agentJson_AddCmd($refArrayCmd,"VoltageFrequency", undef, $i);
agentJson_AddCmd($refArrayCmd,"VoltageNominal", undef, $i);
agentJson_AddCmd($refArrayCmd,"VoltageWarningThresholds", undef, $i);
# TODO - Multi Cabinet
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusVoltageText = ( "not-available",
"ok", "too-low", "too-high", "out-of-range", "warning-battery",
"..unexpected..",
);
my $refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","Voltages") if ($verbose);
for (my $i=0;$i<$gAgentVoltageNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"VoltageStatus", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"VoltageDesignation", undef, $i);
my $current = agentJson_GetCmdSimpleData($refCmd,"CurrentVoltage", undef, $i);
my $critthres = agentJson_GetCmdSimpleData($refCmd,"VoltageThresholds", undef, $i);
my $warnthres = agentJson_GetCmdSimpleData($refCmd,"VoltageWarningThresholds", undef, $i);
my $nominal = agentJson_GetCmdSimpleData($refCmd,"VoltageNominal", undef, $i);
my $outload = agentJson_GetCmdSimpleData($refCmd,"VoltageOutputLoad", undef, $i);
my $frequenzy = agentJson_GetCmdSimpleData($refCmd,"VoltageFrequency", undef, $i);
#
$status = 6 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
#
$current = agent_negativeCheck($current);
$nominal = agent_negativeCheck($nominal);
#
my @thres = ();
@thres = agentJson_RawWordSplit($warnthres);
my $warn = undef;
if ($#thres>=0) {
my $min = undef;
my $max = undef;
$min = $thres[0];
$max = $thres[1] if ($#thres > 0);
$min = agent_negativeCheck($min);
$max = agent_negativeCheck($max);
$warn = "$min" if (defined $min);
$warn .= ":" if (defined $min and defined $max);
$warn .= "$max";
}
@thres = agentJson_RawWordSplit($critthres);
my $crit = undef;
if ($#thres>=0) {
my $min = undef;
my $max = undef;
$min = $thres[0];
$max = $thres[1] if ($#thres > 0);
$min = agent_negativeCheck($min);
$max = agent_negativeCheck($max);
$crit = "$min" if (defined $min);
$crit .= ":" if (defined $min and defined $max);
$crit .= "$max";
}
#
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status > 1);
if ($medium) {
addStatusTopic($medium,$statusVoltageText[$status], "Voltage", $i);
addName($medium,$name);
add100dthVolt($medium,$current,$warn,$crit);
addKey100dthVolt($medium,"Nominal", $nominal);
addKeyIntValueUnit($medium,"Frequency",$frequenzy,"Hz");
addKeyPercent($medium,"OutputLoad", $outload);
addMessage($medium,"\n");
}
} # for
} # agentAllVoltages
sub agentAllMemoryModules {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentMemModNumber{0});
my @memModIndex = (); # TODO: Multi Cabinet
#### BUILD
(my $crefMain, my $crefArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentMemModNumber{0};$i++) {
agentJson_AddCmd($crefArrayCmd,"MemoryModuleStatus", undef, $i);
# TODO - Multi Cabinet
} # for
#### CALL REST/JSON
(my $crc, my $cproviderout) = agentJson_CallCmd($crefMain);
return if ($crc == 2);
#### SPLIT
my $crefCmd = agentJson_ExtractCmd($cproviderout);
for (my $i=0;$i<$gAgentMemModNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($crefCmd,"MemoryModuleStatus", undef, $i);
next if (!defined $status);
$status = 10 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 9);
next if (!$status); # empty slots
push (@memModIndex, $i);
} # for
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
#for (my $i=0;$i<$gAgentMemModNumber{0};$i++) {
for (my $j=0;$j<=$#memModIndex;$j++) {
my $i = $memModIndex[$j];
agentJson_AddCmd($refArrayCmd,"MemoryModuleStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleSocketDesignation", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleConfiguration", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleFrequency", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleSize", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleType", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleFrequencyMax", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleVoltage", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleVoltage", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryModuleVoltage", undef, $i);
agentJson_AddCmd($refArrayCmd,"MemoryBoardDesignation", undef, $i);
#agentJson_AddCmd($refArrayCmd,"MemoryModuleInfo", undef, $i);
# TODO - Multi Cabinet
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusMemModText = ( "empty-slot",
"ok", "disabled", "error", "failed", "prefailure-warning",
"hot-spare", "mirrored", "raid", "hidden", "..unexpected..",
);
my @configMemModText = ( "normal",
"manually disabled", "hotspare", "mirror", "raid", "not usable",
"configuration error", "..unexpected..",
);
my $refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","Memory Modules Table") if ($verbose);
#for (my $i=0;$i<$gAgentMemModNumber{0};$i++) {
for (my $j=0;$j<=$#memModIndex;$j++) {
my $i = $memModIndex[$j];
my $status = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleStatus", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleSocketDesignation", undef, $i);
my $confnr = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleConfiguration", undef, $i);
my $frequency = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleFrequency", undef, $i);
my $size = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleSize", undef, $i);
my $type = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleType", undef, $i);
my $max = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleFrequencyMax", undef, $i);
my $volt = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleVoltage", undef, $i);
my $board = agentJson_GetCmdSimpleData($refCmd,"MemoryBoardDesignation", undef, $i);
#my $info = agentJson_GetCmdSimpleData($refCmd,"MemoryModuleInfo", undef, $i);
#
next if (!defined $status and !defined $name);
$status = 10 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 9);
$confnr = 6 if (!defined $confnr or $confnr !~ m/^\d+$/
or $confnr < 0 or $confnr > 6);
my $conf = undef;
$conf = $configMemModText[$confnr] if ($confnr);
#
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status > 2 and $status < 5);
if ($medium) {
addStatusTopic($medium,$statusMemModText[$status], "Memory", $i);
addName($medium,$name);
addKeyLongValue($medium,"Board", $board);
addKeyLongValue($medium,"Type", $type);
addKeyLongValue($medium,"Config", $conf);
addKeyMB($medium,"Capacity", $size);
addKeyMHz($medium,"Frequency", $frequency);
addKeyMHz($medium,"Frequency-Max", $max);
addKeyValue($medium,"Voltage", $volt);
addMessage($medium,"\n");
}
} # for
} # agentAllMemoryModules
sub agentAllDrvMonAdapter {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agent_getNumberOfSensors();
return if (!$gAgentDrvMonNumber{0});
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentDrvMonNumber{0};$i++) {
agentJson_AddCmd($refArrayCmd,"DrvMonComponentStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"DrvMonComponentName", undef, $i);
agentJson_AddCmd($refArrayCmd,"DrvMonComponentLocation", undef, $i);
agentJson_AddCmd($refArrayCmd,"DrvMonComponentClass", undef, $i);
agentJson_AddCmd($refArrayCmd,"DrvMonComponentDriverName", undef, $i);
# TODO - Multi Cabinet
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusDrvCompText = ( "unknown",
"ok", "warning","error", "not-present", "not-manageable",
"..unexpected..",
);
my @classDrvCompText = ( "Unknown",
"Software", "Network", "Storage",
"..unexpected..",
); # + 0xFF "Other"
my $refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","Driver Monitor Component Table") if ($verbose);
for (my $i=0;$i<$gAgentDrvMonNumber{0};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"DrvMonComponentStatus", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"DrvMonComponentName", undef, $i);
my $location = agentJson_GetCmdSimpleData($refCmd,"DrvMonComponentLocation", undef, $i);
my $classnr = agentJson_GetCmdSimpleData($refCmd,"DrvMonComponentClass", undef, $i);
my $driver = agentJson_GetCmdSimpleData($refCmd,"DrvMonComponentDriverName", undef, $i);
#
$status = 6 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
$classnr = 4 if (!defined $classnr or $classnr !~ m/^\d+$/
or $classnr < 0 or ($classnr > 4 and $classnr != 255));
my $class = undef;
$class = "Other" if ($classnr == 255);
$class = $classDrvCompText[$classnr] if ($classnr != 255);
#
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status > 1 and $status < 4);
if ($medium) {
addStatusTopic($medium,$statusDrvCompText[$status], "DrvMon", $i);
addName($medium,$name);
addKeyLongValue($medium,"Location",$location);
addKeyLongValue($medium,"Driver", $driver);
addKeyValue($medium,"Class", $class);
addMessage($medium,"\n");
}
} # for
# OPEN: There are additional Information about DrvMon-Drivers
} # agentAllDrvMonAdapter
sub agentAllStorageAdapter {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
agentRAID($setExitCode,$notify,$verbose);
} # agentAllStorageAdapter
####
sub agentRAIDStatus {
my $notify = shift;
my $verbose = shift;
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
{
agentJson_AddCmd($refArrayCmd,"RaidOverallStatus");
agentJson_AddCmd($refArrayCmd,"RaidAdapterOverallStatus");
agentJson_AddCmd($refArrayCmd,"RaidLogicalDrivesOverallStatus");
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDrivesOverallStatus");
agentJson_AddCmd($refArrayCmd,"RaidOverallSmartStatus");
}
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @raidCompStatusText = ( "Unknown",
"OK", "Warning", "Error", "..unexpected..",
);
my @raidSMARTText = ( "OK",
"Failure", "Unknown", "..unexpected..",
);
my $refCmd = agentJson_ExtractCmd($providerout);
my $overall = agentJson_GetCmdSimpleData($refCmd,"RaidOverallStatus");
my $stCtrl = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterOverallStatus");
my $stLDrive = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDrivesOverallStatus");
my $stPDevice = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDrivesOverallStatus");
my $smart = agentJson_GetCmdSimpleData($refCmd,"RaidOverallSmartStatus");
#
$overall = 4 if (!defined $overall or $overall !~ m/^\d+$/
or $overall < 0 or $overall > 4);
$stCtrl = 4 if (!defined $stCtrl or $stCtrl !~ m/^\d+$/
or $stCtrl < 0 or $stCtrl > 4);
$stLDrive = 4 if (!defined $stLDrive or $stLDrive !~ m/^\d+$/
or $stLDrive < 0 or $stLDrive > 4);
$stPDevice = 4 if (!defined $stPDevice or $stPDevice !~ m/^\d+$/
or $stPDevice < 0 or $stPDevice > 4);
$smart = 2 if (defined $smart and $smart =~ m/^\d+$/ and $smart == 255);
$smart = 3 if (!defined $smart or $smart !~ m/^\d+$/
or $smart < 0 or $smart > 3);
#### PRINT
addTableHeader("v","RAID Overview") if ($verbose);
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if (!$medium and $notify);
if ($medium) {
#$variableVerboseMessage .= "\n";
addStatusTopic($medium,$raidCompStatusText[$overall],
"RAID -", undef);
addComponentStatus($medium,"Controller", $raidCompStatusText[$stCtrl])
if (defined $stCtrl);
addComponentStatus($medium,"PhysicalDevice", $raidCompStatusText[$stPDevice])
if (defined $stPDevice);
addComponentStatus($medium,"LogicalDrive", $raidCompStatusText[$stLDrive])
if (defined $stLDrive);
addComponentStatus($medium,"S.M.A.R.T", $raidSMARTText[$smart])
if (defined $smart);
addMessage($medium,"\n");
}
$raidCtrl = 3 if (defined $stCtrl);
$raidCtrl = $stCtrl - 1 if ($stCtrl and $stCtrl <= 3);
$raidLDrive = 3 if (defined $stLDrive);
$raidPDevice = $stLDrive - 1 if ($stLDrive and $stLDrive <= 3);
$raidPDevice = 3 if (defined $stPDevice);
$raidPDevice = $stPDevice - 1 if ($stPDevice and $stPDevice <= 3);
} # agentRAIDStatus
sub agentRAIDCtrlTable {
my $notify = shift;
my $verbose = shift;
return if (!$gAgentRAIDCtrlNumber);
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$gAgentRAIDCtrlNumber;$i++) {
agentJson_AddCmd($refArrayCmd,"RaidAdapterStatus", undef, $i);
agentJson_AddCmd($refArrayCmd,"RaidAdapterName", undef, $i);
agentJson_AddCmd($refArrayCmd,"RaidAdapterType", undef, $i);
agentJson_AddCmd($refArrayCmd,"RaidAdapterProperty", undef, $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusText = ( "ok",
"warning","error","unknown","..unexpected..",
); # + 255: StatusUnknown
my @typeText = ( "SCSI",
"ATAPI","PATA","Firewire IEEE 1394","SSA","Fibre",
"USB","SATA","SAS","RAID","MMC",
"SD card bus","..unexpected..",
); # + 0xFF "Uknown"
addTableHeader("v","RAID Controller") if ($verbose);
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $i=0;$i<$gAgentRAIDCtrlNumber;$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterStatus", undef, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterName", undef, $i);
my $typenr = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterType", undef, $i);
my $prop = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterProperty", undef, $i);
#
$status = 3 if ($status and $status =~ m/^\d+$/ and $status == 255);
$status = 4 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 4);
$typenr = 12 if (!defined $typenr or $typenr !~ m/^\d+$/
or $typenr < 0 or ($typenr > 12 and $typenr != 255));
my $type = undef;
$type = "Other" if ($typenr == 255);
$type = $typeText[$typenr] if ($typenr != 255);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 0 and $status < 3);
if ($medium) {
addStatusTopic($medium,$statusText[$status], "RAIDCtrl", $i);
addName($medium,$name);
addKeyLongValue($medium,"Type",$type);
addKeyLongValue($medium,"Property", $prop);
addMessage($medium,"\n");
}
} # for
} # agentRAIDCtrlTable
sub agentRAIDPhysicalDeviceTable {
# TODO --- agentRAIDPhysicalDeviceTable - calculate GB instead of MB ?
my $notify = shift;
my $verbose = shift;
my $addedCmd = 0;
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
$addedCmd = 1 if ($gAgentRAIDPDeviceNumber{$c});
for (my $i=0;$i<$gAgentRAIDPDeviceNumber{$c};$i++) {
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveStatus", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveSmartStatus", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveName", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveBusType", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDrivePhysicalSize", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveProperty", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveEnclosureOid", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidPhysicalDriveAdapterPortOid", $c, $i);
} # for
} # for ctrl
return if (!$addedCmd);
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusText = ( "Operational",
"Copyback","Available-not-configured","Unconfigured-failed","Dedicated-hot-spare","Global-hot-spare",
"Rebuilding","Rebuild-necessary","Rebuild-failed","JBOD disk","Migrating",
"Failed","Failed-missing","Offline","Shielded","Unknown", "..unexpected..",
); # + 255: Unknown
my @smartText = ( "ok",
"failure","unknown","..unexpected..",
); # + 255: S.M.A.R.T. status unknown
my @typeText = ( "SCSI",
"ATAPI","PATA","Firewire IEEE 1394","SSA","Fibre",
"USB","SATA","SAS","RAID","MMC",
"SD card bus","..unexpected..",
); # + 0xFF "Uknown"
addTableHeader("v","RAID Physical Device") if ($verbose);
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
for (my $i=0;$i<$gAgentRAIDPDeviceNumber{$c};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveStatus", $c, $i);
my $smart = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveSmartStatus", $c, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveName", $c, $i);
my $typenr = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveBusType", $c, $i);
my $prop = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveProperty", $c, $i);
my $size = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDrivePhysicalSize", $c, $i);
my $encID = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveEnclosureOid", $c, $i);
my $portID = agentJson_GetCmdSimpleData($refCmd,"RaidPhysicalDriveAdapterPortOid", $c, $i);
#
$status = 15 if ($status and $status =~ m/^\d+$/ and $status == 255);
$status = 16 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 16);
$smart = 2 if ($smart and $smart =~ m/^\d+$/ and $smart == 255);
$smart = 2 if (!defined $smart or $smart !~ m/^\d+$/
or $smart < 0 or $smart > 2);
$typenr = 12 if (!defined $typenr or $typenr !~ m/^\d+$/
or $typenr < 0 or ($typenr > 12 and $typenr != 255));
my $type = undef;
$type = "Other" if ($typenr == 255);
$type = $typeText[$typenr] if ($typenr != 255);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 0);
if ($medium) {
if (defined $smart and $smart < 2) {
addStatusTopic($medium,$smartText[$smart], undef, undef);
}
addStatusTopic($medium,$statusText[$status], "RAIDPhysicalDevice", "$c.$i");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$c);
addKeyLongValue($medium,"Type",$type);
addKeyMB($medium,"Capacity", $size);
addKeyUnsignedIntValue($medium,"EnclosureNr",$encID) if (defined $encID);
addKeyUnsignedIntValue($medium,"PortNr",$portID) if (defined $portID);
addKeyLongValue($medium,"Property", $prop);
addMessage($medium,"\n");
}
} # for
} # for ctrl
} # agentRAIDPhysicalDeviceTable
sub agentRAIDLogicalDriveTable {
# TODO --- agentRAIDLogicalDriveTable - calculate GB instead of MB ?
my $notify = shift;
my $verbose = shift;
my $addedCmd = 0;
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
$addedCmd = 1 if ($gAgentRAIDLDriveNumber{$c});
for (my $i=0;$i<$gAgentRAIDLDriveNumber{$c};$i++) {
agentJson_AddCmd($refArrayCmd,"RaidLogicalDriveStatus", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidLogicalDriveName", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidLogicalDriveLogicalSize", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidLogicalDrivePhysicalSize", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidLogicalDriveRaidLevel", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidLogicalDriveProperty", $c, $i);
} # for
} # for ctrl
return if (!$addedCmd);
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusText = ( "Operational",
"Degraded","Partially-Degraded","Failed","Impacted","Unknown",
"..unexpected..",
); # + 255: Unknown
addTableHeader("v","RAID Logical Drive") if ($verbose);
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
for (my $i=0;$i<$gAgentRAIDLDriveNumber{$c};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDriveStatus", $c, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDriveName", $c, $i);
my $prop = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDriveProperty", $c, $i);
my $size = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDrivePhysicalSize", $c, $i);
my $lsize = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDriveLogicalSize", $c, $i);
my $level = agentJson_GetCmdSimpleData($refCmd,"RaidLogicalDriveRaidLevel", $c, $i);
#
$status = 5 if ($status and $status =~ m/^\d+$/ and $status == 255);
$status = 6 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 0);
if ($medium) {
addStatusTopic($medium,$statusText[$status], "LogicalDrive", "$c.$i");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$c);
addKeyLongValue($medium,"Level", $level);
addKeyMB($medium,"LogicalSize", $lsize);
addKeyMB($medium,"Capacity", $size);
addKeyLongValue($medium,"Property", $prop);
addMessage($medium,"\n");
}
} # for
} # for ctrl
} # agentRAIDLogicalDriveTable
sub agentRAIDAdditional {
my $notify = shift;
my $verbose = shift;
my $addedCmd = 0;
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
$addedCmd = 1 if ($gAgentRAIDBatteryNumber{$c});
$gAgentRAIDBatteryNumber{$c} = 0 if (!defined $gAgentRAIDBatteryNumber{$c});
for (my $i=0;$i<$gAgentRAIDBatteryNumber{$c};$i++) {
agentJson_AddCmd($refArrayCmd,"RaidBatteryBackupUnitName", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidBatteryBackupUnitStatus", $c, $i);
};# for
$addedCmd = 1 if ($gAgentRAIDPortNumber{$c});
$gAgentRAIDPortNumber{$c} = 0 if (!defined $gAgentRAIDPortNumber{$c});
for (my $i=0;$i<$gAgentRAIDPortNumber{$c};$i++) {
agentJson_AddCmd($refArrayCmd,"RaidAdapterPortName", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidAdapterPortStatus", $c, $i);
} # for
$addedCmd = 1 if ($gAgentRAIDEnclosureNumber{$c});
$gAgentRAIDEnclosureNumber{$c} = 0 if (!defined $gAgentRAIDEnclosureNumber{$c});
for (my $i=0;$i<$gAgentRAIDEnclosureNumber{$c};$i++) {
agentJson_AddCmd($refArrayCmd,"RaidEnclosureName", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidEnclosureStatus", $c, $i);
agentJson_AddCmd($refArrayCmd,"RaidEnclosureAdapterPortOid", $c, $i);
} # for
} # for ctrl
return if (!$addedCmd);
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my @statusBatteryText = ( "online",
"on-battery","battery-low","charging","discharging","Warning",
"failed","relearn-required","temperature-failure","Unknown",
"..unexpected..",
); # + 255: Unknown
my @statusText = ( "unknown",
"ok","warning","error","not-present","not-manageable",
"undefined", "..unexpected..",
);
my $refCmd = agentJson_ExtractCmd($providerout);
my $printedHeader = 0;
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
for (my $i=0;$i<$gAgentRAIDBatteryNumber{$c};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"RaidBatteryBackupUnitStatus", $c, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"RaidBatteryBackupUnitName", $c, $i);
#
next if (!defined $status and !defined $name);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Battery");
$printedHeader = 1;
}
$status = 9 if ($status and $status =~ m/^\d+$/ and $status == 255);
$status = 10 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 10);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 1);
if ($medium) {
addStatusTopic($medium,$statusBatteryText[$status], "RAIDBattery", "$c.$i");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$c);
addMessage($medium,"\n");
}
} # for
} # for ctrl
$printedHeader = 0;
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
for (my $i=0;$i<$gAgentRAIDPortNumber{$c};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterPortStatus", $c, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"RaidAdapterPortName", $c, $i);
#
next if (!defined $status and !defined $name);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Port");
$printedHeader = 1;
}
$status = 6 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 1);
if ($medium) {
my $printStatus = undef;
$printStatus = $statusText[$status] if ($notify);
addStatusTopic($medium,$printStatus, "RAIDPort", "$c.$i");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$c);
addMessage($medium,"\n");
}
} # for
} # for ctrl
$printedHeader = 0;
for (my $c=0;$c<$gAgentRAIDCtrlNumber;$c++) {
for (my $i=0;$i<$gAgentRAIDEnclosureNumber{$c};$i++) {
my $status = agentJson_GetCmdSimpleData($refCmd,"RaidEnclosureStatus", $c, $i);
my $name = agentJson_GetCmdSimpleData($refCmd,"RaidEnclosureName", $c, $i);
my $portID = agentJson_GetCmdSimpleData($refCmd,"RaidEnclosureAdapterPortOid", $c, $i);
#
next if (!defined $status and !defined $name);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Enclosure");
$printedHeader = 1;
}
$status = 6 if (!defined $status or $status !~ m/^\d+$/
or $status < 0 or $status > 6);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status > 1);
if ($medium) {
addStatusTopic($medium,$statusText[$status], "RAIDEnclosure", "$c.$i");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$c);
addKeyUnsignedIntValue($medium,"PortNr",$portID) if (defined $portID);
addMessage($medium,"\n");
}
} # for
} # for ctrl
} # agentRAIDAdditional
sub agentRAID {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
if ($optChkSystem or $optChkStorage) {
agentRAIDStatus($notify,$verbose);
return if (!$verbose and !$notify and !$setExitCode);
agent_getNumberforRAID();
if ($verbose and !$gAgentRAIDCtrlNumber and defined $statusMassStorage
and $statusMassStorage != 3)
{
addTableHeader("v","RAID Controller");
addMessage("v","MISSING: - There is no control adapter information available !\n");
}
return if (!$gAgentRAIDCtrlNumber);
my $componentNotify = 0;
$componentNotify = 1 if ($notify and $raidCtrl and $raidCtrl < 3);
agentRAIDCtrlTable($componentNotify,$verbose);
$componentNotify = 0;
$componentNotify = 1 if ($notify and $raidPDevice and $raidPDevice < 3);
agentRAIDPhysicalDeviceTable($componentNotify,$verbose);
$componentNotify = 0;
$componentNotify = 1 if ($notify and $raidLDrive and $raidLDrive < 3);
agentRAIDLogicalDriveTable($componentNotify,$verbose);
$componentNotify = 0;
$componentNotify = 1 if ($notify and $raidPDevice and $raidPDevice < 3);
if ($main::verbose >= 3 or $componentNotify) {
agentRAIDAdditional($componentNotify,$verbose);
}
} #optChkSystem
} # agentRAID
####
sub agentPerfCPU {
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<6;$i++) {
agentJson_AddCmd($refArrayCmd,"CpuOverallUsage", $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
my $totalaverage = agentJson_GetCmdSimpleData($refCmd,"CpuOverallUsage", 0);
my $totalcurrent = agentJson_GetCmdSimpleData($refCmd,"CpuOverallUsage", 1);
my $kernelaverage = agentJson_GetCmdSimpleData($refCmd,"CpuOverallUsage", 2);
my $kernelcurrent = agentJson_GetCmdSimpleData($refCmd,"CpuOverallUsage", 3);
my $useraverage = agentJson_GetCmdSimpleData($refCmd,"CpuOverallUsage", 4);
my $usercurrent = agentJson_GetCmdSimpleData($refCmd,"CpuOverallUsage", 5);
if (defined $totalaverage) {
$exitCode = 0;
addKeyPercent("m", "TotalAverage", $totalaverage, undef,undef, undef,undef);
addKeyPercent("m", "Total", $totalcurrent, undef,undef, undef,undef);
addKeyPercent("m", "KernelAverage", $kernelaverage, undef,undef, undef,undef);
addKeyPercent("m", "Kernel", $kernelcurrent, undef,undef, undef,undef);
addKeyPercent("m", "UserAverage", $useraverage, undef,undef, undef,undef);
addKeyPercent("m", "User", $usercurrent, undef,undef, undef,undef);
addPercentageToPerfdata("CPUTotalAverage", $totalaverage, $optWarningLimit, $optCriticalLimit)
if (!$main::verboseTable);
if ($totalaverage and $optWarningLimit and $totalaverage > $optWarningLimit) {
$exitCode = 1 if ($exitCode != 2);
}
if ($totalaverage and $optCriticalLimit and $totalaverage > $optCriticalLimit) {
$exitCode = 2;
}
}
} # agentPerfCPU
sub agentPerfPhysicalMemory {
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<3;$i++) {
agentJson_AddCmd($refArrayCmd,"UtilizationSystemMemory", undef, $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
my $rawPhysMem = agentJson_GetCmdSimpleData($refCmd,"UtilizationSystemMemory", undef, 0);
my $rawVirtMem = agentJson_GetCmdSimpleData($refCmd,"UtilizationSystemMemory", undef, 1);
my $rawPagedMem = agentJson_GetCmdSimpleData($refCmd,"UtilizationSystemMemory", undef, 2);
my @physMem = agentJson_RawDWordSplit($rawPhysMem);
my @virtMem = agentJson_RawDWordSplit($rawVirtMem);
my @pagedMem = agentJson_RawDWordSplit($rawPagedMem);
if ($#physMem >= 0) {
$exitCode = 0;
my $percent = undef;
$percent = calcPercent($physMem[1], $physMem[0]) if ($#physMem > 0);
addKeyPercent("m","PhysicalPercent", $percent);
addKeyValueUnit("m", "PhysicalMem", $physMem[0], "KB");
addKeyValueUnit("m", "PhysicalMax", $physMem[1], "KB") if ($#physMem > 0);
# TODO ... MB calc
addPercentageToPerfdata("PhysicalMemory", $percent,$optWarningLimit,$optCriticalLimit)
if (!$main::verboseTable);
if ($percent and $optWarningLimit and $percent > $optWarningLimit) {
$exitCode = 1 if ($exitCode != 2);
}
if ($percent and $optCriticalLimit and $percent > $optCriticalLimit) {
$exitCode = 2;
}
}
if ($#virtMem >= 0) {
addKeyValueUnit("m", "VirtualMem", $virtMem[0], "KB");
addKeyValueUnit("m", "VirtualMax", $virtMem[1], "KB");
}
if ($#pagedMem >= 0) {
addKeyValueUnit("m", "PagedMem", $pagedMem[0], "KB");
addKeyValueUnit("m", "PagedMax", $pagedMem[1], "KB");
}
} # agentPerfPhysicalMemory
sub agentPerfFileSystem {
my $nrFileSystems = 0;
{ # nr FS
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"FileSystemNumberVolumes");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
$nrFileSystems = agentJson_GetCmdSimpleData($refCmd,"FileSystemNumberVolumes");
}
return if (!$nrFileSystems);
$exitCode = 0;
{ # get data
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$nrFileSystems;$i++) {
agentJson_AddCmd($refArrayCmd,"FileSystemVolumePathNames",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeDevicePath",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeTotalSize",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeFreeSize",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeFileSystemName",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeSerialNumber",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeLabel",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeUsage",undef,$i);
agentJson_AddCmd($refArrayCmd,"FileSystemVolumeType",undef,$i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
my @typeText = ( "fixed",
"CDROM/DVDROM", "removable", "remote", "RAM","unknown",
"..unexpected..",
);
my $all_notify = 0;
my $is_linux = 0;
for (my $i=0;$i<$nrFileSystems;$i++) {
my $rawpath = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumePathNames", undef, $i);
# string or multi string !!!
my $device = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeDevicePath", undef, $i);
my $size = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeTotalSize", undef, $i);
my $free = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeFreeSize", undef, $i);
my $tname = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeFileSystemName",
undef, $i);
my $serial = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeSerialNumber", undef, $i);
my $label = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeLabel", undef, $i);
my $usage = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeUsage", undef, $i);
my $type = agentJson_GetCmdSimpleData($refCmd,"FileSystemVolumeType", undef, $i);
$type = 5 if ($type and $type == 15);
$type = 6 if (!defined $type or $type < 0 or $type > 6);
my $firstname = $rawpath;
my @allnames = ();
if ($rawpath =~ m/^\[/) { # array
#TODO FileSystemVolumePathNames: what to do with the rest of names ?
$rawpath =~ s/\\\"/\"/g;
(my $rest, my $refallnames) = jsonSplitArray($rawpath);
@allnames = @{$refallnames};
my $refKeyValue = undef;
$refKeyValue = $allnames[0] if ($#allnames >= 0);
$firstname = $refKeyValue->{"VALUE"} if ($#allnames >= 0);
}
addStatusTopic("v",undef, "FS", $i);
addName("v",$firstname,1);
addKeyLongValue("v","Label", $label);
addKeyPercent("v","Usage",$usage);
addKeyValueUnit("v","Size",$size,"B");
addKeyValueUnit("v","FreeSpace",$free,"B");
addKeyValue("v","FSType", $tname);
addKeyValue("v","VolumeType", $typeText[$type]) if ($type); # ignore 0
addSerialIDs("v",$serial);
addKeyLongValue("v","DevicePath", $device) if ($main::verbose >= 4);
addMessage("v","\n");
### performance ?
if ($usage) {
my $name = $firstname;
$name = "FS_$i" if (!$name);
if ($name =~ m/([A-Z]+):\\/) { # windows
$name = $1;
$name .= "_$label" if ($label);
}
if ($name =~ m/^[\/]$/) { # linux
$name = "ROOT";
$is_linux = 1;
}
$name =~ s/[ ,;=]/_/g;
$name =~ s/[:()]//g;
$name =~ s/_[_]+/_/;
$usage = undef if ($is_linux and $usage == 100 and $type != 0);
# mounted types or other have aleays usage 100%
addPercentageToPerfdata($name,$usage,
$optWarningLimit,$optCriticalLimit) if (defined $usage);
my $notify = 0;
if ($usage and $optWarningLimit
and $usage > $optWarningLimit) {
$exitCode = 1 if ($exitCode != 2);
$notify = 1;
$all_notify = 1;
}
if ($usage and $optCriticalLimit and $usage > $optCriticalLimit) {
$exitCode = 2;
$notify = 1;
$all_notify = 1;
}
$notify = 0 if ($main::verbose >= 2); # allready printed
if ($notify and $usage) {
addStatusTopic("l",undef, "FS", $i);
addName("l",$rawpath,1);
addKeyLongValue("l","Label", $label);
addKeyLongValue("l","Type", $type);
addKeyIntValueUnit("l","Use",$usage,"%");
addMessage("l","\n");
}
} # usage not 0
} # for
$msg .= "- file system limit reached" if ($all_notify);
} # data
} # agentPerfFileSystem
sub agentPerfNetwork {
my $nrNetwork = 0;
{ # nr FS
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"NetworkInfoNumberInterfaces");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
$nrNetwork = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoNumberInterfaces");
}
return if (!$nrNetwork);
$exitCode = 0;
{ # get data
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$nrNetwork;$i++) {
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfConnectionName", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfUsage", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoIfSpeed", undef, $i);
agentJson_AddCmd($refArrayCmd,"NetworkInfoUtilization", undef, $i)
if ($main::verbose >=3);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
addTableHeader("v","Network Performance");
for (my $i=0;$i<$nrNetwork;$i++) {
my $conn = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfConnectionName", undef, $i);
my $usage = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfUsage", undef, $i);
my $speed = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoIfSpeed", undef, $i);
my $rawUtil = agentJson_GetCmdSimpleData($refCmd,"NetworkInfoUtilization", undef, $i);
my $interfaceSpeed = undef;
my $maxTransfer = undef;
my $iTransfer = undef;
my $oTransfer = undef;
if ($main::verboseTable == 250) {
my @util = agentJson_RawDWordLongSplit($rawUtil); # seen for LINUX
$interfaceSpeed = $util[0] if ($#util >= 0);
$maxTransfer = $util[1] if ($#util >= 1);
$iTransfer = $util[2] if ($#util >= 2);
$oTransfer = $util[3] if ($#util >= 3);
}
addStatusTopic("v",undef, "Node", $i);
addName("v",$conn,1);
addKeyPercent("v","Usage",$usage);
addKeyValueUnit("v","Speed", $speed, "Kbit/sec");
addKeyLongValue("v","UtilRAW", $rawUtil) if ($main::verboseTable == 250);
if ($rawUtil and $main::verboseTable == 250) {
addKeyValueUnit("v","InterfaceSpeed",$interfaceSpeed,"B/sec");
addKeyValueUnit("v","MaxTransfer",$maxTransfer,"B/sec");
addKeyValueUnit("v","InputTransfer",$iTransfer,"B/sec");
addKeyValueUnit("v","OutputTransfer",$oTransfer,"B/sec");
}
addMessage("v","\n");
} # for
} # data
} # agentPerfNetwork
sub agentPerformanceInformation {
agentPerfCPU() if ($optChkCpuLoadPerformance);
agentPerfPhysicalMemory() if ($optChkMemoryPerformance);
agentPerfFileSystem() if ($optChkFileSystemPerformance);
agentPerfNetwork() if ($optChkNetworkPerformance);
} # agentPerformanceInformation
####
sub agentUpdateSystemStatus {
#"UmServerStatus" => 0x3330,
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"UmServerStatus");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
my $updStatus = agentJson_GetCmdSimpleData($refCmd,"UmServerStatus");
my @updText = ("ok",
"recommended", "mandatory","unknown","undefined","..unexpected..");
$updStatus = 4 if (!defined $updStatus);
$updStatus = 5 if ($updStatus < 0 or $updStatus > 3);
addExitCode($updStatus) if ($updStatus < 3);
addComponentStatus("m", "UpdateStatus",$updText[$updStatus]);
} # agentUpdateSystemStatus
sub agentUpdateDiffTable {
my $fileHost = $optHost;
$fileHost =~ s/[^A-Z,a-z,.,\-,0-9]//g if ($fileHost);
my $printLimit = 10;
my $printIndex = 0;
$printLimit = 0 if ($main::verbose >= 3);
my @severityText = ( "optional",
"recommended", "mandatory", "..unexpected..",
);
my @rebootText = ( "no",
"immediate", "asConfigured", "dynamic", "..unexpected..",
);
my $save_variableVerboseMessage = $variableVerboseMessage;
$variableVerboseMessage = '';
####
my $nrComponent = 0;
{ # nr of Update Components
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"UmDiffNumberComponents");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
$nrComponent = agentJson_GetCmdSimpleData($refCmd,"UmDiffNumberComponents");
}
if (!$nrComponent) {
addMessage("m", " - ") if ($msg);
addMessage("m","No update difference list available") if (!$nrComponent);
return if (!$nrComponent);
}
{ # get components
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$nrComponent;$i++) {
agentJson_AddCmd($refArrayCmd,"UmDiffComponentPath", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffComponentVersion", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffInstalledVersion", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffRepos2InstRanking", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffIsMandatoryComponent", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffPreRequisitesText", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffUpdateVendorSeverity", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffRebootRequired", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffInstallDuration", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffDownloadSize", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffVendor", undef, $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $i=0;$i<$nrComponent;$i++) {
my $componentVersion = agentJson_GetCmdSimpleData($refCmd,"UmDiffComponentVersion", undef, $i);
my $installedVersion = agentJson_GetCmdSimpleData($refCmd,"UmDiffInstalledVersion", undef, $i);
my $repos2InstRanking = agentJson_GetCmdSimpleData($refCmd,"UmDiffRepos2InstRanking", undef, $i);
next if (!$componentVersion or !$installedVersion);
next if ($repos2InstRanking and ($repos2InstRanking < 0 or $repos2InstRanking > 2) );
my $componentPath =
agentJson_GetCmdSimpleData($refCmd,"UmDiffComponentPath", undef, $i);
my $updateVendorSeverity=
agentJson_GetCmdSimpleData($refCmd,"UmDiffUpdateVendorSeverity", undef, $i);
my $isMandatoryComponent=
agentJson_GetCmdSimpleData($refCmd,"UmDiffIsMandatoryComponent", undef, $i);
my $downloadSize =
agentJson_GetCmdSimpleData($refCmd,"UmDiffDownloadSize", undef, $i);
my $installDuration =
agentJson_GetCmdSimpleData($refCmd,"UmDiffInstallDuration", undef, $i);
my $rebootRequired =
agentJson_GetCmdSimpleData($refCmd,"UmDiffRebootRequired", undef, $i);
my $vendor =
agentJson_GetCmdSimpleData($refCmd,"UmDiffVendor", undef, $i);
my $prereq =
agentJson_GetCmdSimpleData($refCmd,"UmDiffPreRequisitesText", undef, $i);
$updateVendorSeverity = 3
if (!defined $updateVendorSeverity or $updateVendorSeverity < 0 or $updateVendorSeverity > 2);
$rebootRequired = 4 if (!defined $rebootRequired or $rebootRequired < 0 or $rebootRequired > 3);
#### PRINT
if (!$printLimit or $printIndex < $printLimit) { # stdout
addStatusTopic("l",$severityText[$updateVendorSeverity], "",undef);
addKeyLongValue("l", "Path", $componentPath);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyLongValue("l", "Installed", $installedVersion);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyLongValue("l", "Available", $componentVersion);
addMessage("l", "\n");
if ($main::verbose >= 2) {
addMessage("l", "#\t");
addKeyLongValue("l", "Vendor", $vendor);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyValue("l", "Mandatory", $isMandatoryComponent);
addKeyValue("l", "Severity", $severityText[$updateVendorSeverity]);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyMB("l", "Size", $downloadSize);
addKeyValueUnit("l", "Duration", $installDuration, "sec");
addKeyValue("l", "RebootMode", $rebootText[$rebootRequired]);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyLongValue("l", "Prerequisites", $prereq);
addMessage("l", "\n");
}
$printIndex++;
} #... print next
if ($optOutdir) { # file
addMessage("v",$componentPath);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Installed", $installedVersion);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Available", $componentVersion);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Vendor", $vendor);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyValue("v", "Mandatory", $isMandatoryComponent);
addKeyValue("v", "Severity", $severityText[$updateVendorSeverity]);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyMB("v", "Size", $downloadSize);
addKeyValueUnit("v", "Duration", $installDuration, "sec");
addKeyValue("v", "RebootMode", $rebootText[$rebootRequired]);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Prerequisites", $prereq);
addMessage("v", "\n");
}#outdir
} # for
} # components
####
addMessage("l", "#...\n") if ($printLimit and $printLimit == $printIndex);
if ($optOutdir) {
writeTxtFile($fileHost, "DIFF", $variableVerboseMessage);
}
$variableVerboseMessage = $save_variableVerboseMessage;
} # agentUpdateDiffTable
sub agentUpdateInstTable {
my $fileHost = $optHost;
$fileHost =~ s/[^A-Z,a-z,.,\-,0-9]//g if ($fileHost);
my $printLimit = 10;
my $printIndex = 0;
$printLimit = 0 if ($main::verbose >= 3);
my @severityText = ( "optional",
"recommended", "mandatory", "..unexpected..",
);
my @rebootText = ( "no",
"immediate", "asConfigured", "dynamic", "..unexpected..",
);
my $save_variableVerboseMessage = $variableVerboseMessage;
$variableVerboseMessage = '';
####
my $nrComponent = 0;
{ # nr of Update Components
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
agentJson_AddCmd($refArrayCmd,"UmDiffNumberComponents");
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
$nrComponent = agentJson_GetCmdSimpleData($refCmd,"UmDiffNumberComponents");
}
if (!$nrComponent) {
addMessage("m", " - ") if ($msg);
addMessage("m","No update installation list available") if (!$nrComponent);
return if (!$nrComponent);
}
{ # get components
#### BUILD
(my $refMain, my $refArrayCmd) = agentJson_CreateJsonCmd();
for (my $i=0;$i<$nrComponent;$i++) {
agentJson_AddCmd($refArrayCmd,"UmDiffComponentPath", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffComponentVersion", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffInstalledVersion", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffRepos2InstRanking", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffIsMandatoryComponent", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffPreRequisitesText", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffUpdateVendorSeverity", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffRebootRequired", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffInstallDuration", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffDownloadSize", undef, $i);
agentJson_AddCmd($refArrayCmd,"UmDiffVendor", undef, $i);
} # for
#### CALL REST/JSON
(my $rc, my $providerout) = agentJson_CallCmd($refMain);
return if ($rc == 2);
#### SPLIT
my $refCmd = agentJson_ExtractCmd($providerout);
for (my $i=0;$i<$nrComponent;$i++) {
my $componentVersion = agentJson_GetCmdSimpleData($refCmd,"UmDiffComponentVersion", undef, $i);
my $installedVersion = agentJson_GetCmdSimpleData($refCmd,"UmDiffInstalledVersion", undef, $i);
my $repos2InstRanking = agentJson_GetCmdSimpleData($refCmd,"UmDiffRepos2InstRanking", undef, $i);
next if (!$installedVersion);
my $uptodate = 0;
$uptodate = 1 if ($repos2InstRanking
and ($repos2InstRanking < 0 or $repos2InstRanking > 2) );
my $componentPath =
agentJson_GetCmdSimpleData($refCmd,"UmDiffComponentPath", undef, $i);
my $updateVendorSeverity=
agentJson_GetCmdSimpleData($refCmd,"UmDiffUpdateVendorSeverity", undef, $i);
my $isMandatoryComponent=
agentJson_GetCmdSimpleData($refCmd,"UmDiffIsMandatoryComponent", undef, $i);
my $downloadSize =
agentJson_GetCmdSimpleData($refCmd,"UmDiffDownloadSize", undef, $i);
my $installDuration =
agentJson_GetCmdSimpleData($refCmd,"UmDiffInstallDuration", undef, $i);
my $rebootRequired =
agentJson_GetCmdSimpleData($refCmd,"UmDiffRebootRequired", undef, $i);
my $vendor =
agentJson_GetCmdSimpleData($refCmd,"UmDiffVendor", undef, $i);
my $prereq =
agentJson_GetCmdSimpleData($refCmd,"UmDiffPreRequisitesText", undef, $i);
$updateVendorSeverity = 3
if (!defined $updateVendorSeverity or $updateVendorSeverity < 0 or $updateVendorSeverity > 2);
$rebootRequired = 4 if (!defined $rebootRequired or $rebootRequired < 0 or $rebootRequired > 3);
#### PRINT
if (!$printLimit or $printIndex < $printLimit) { # stdout
addStatusTopic("l",$severityText[$updateVendorSeverity], "",undef) if (!$uptodate);
addStatusTopic("l","uptodate", "",undef) if ($uptodate);
addKeyLongValue("l", "Path", $componentPath);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyLongValue("l", "Installed", $installedVersion);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyLongValue("l", "Available", $componentVersion);
addMessage("l", "\n");
if ($main::verbose >= 2) {
addMessage("l", "#\t");
addKeyLongValue("l", "Vendor", $vendor);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyValue("l", "Mandatory", $isMandatoryComponent);
addKeyValue("l", "Severity", $severityText[$updateVendorSeverity]);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyMB("l", "Size", $downloadSize);
addKeyValueUnit("l", "Duration", $installDuration, "sec");
addKeyValue("l", "RebootMode", $rebootText[$rebootRequired]);
addMessage("l", "\n");
addMessage("l", "#\t");
addKeyLongValue("l", "Prerequisites", $prereq);
addMessage("l", "\n");
}
$printIndex++;
} #... print next
if ($optOutdir) { # file
addMessage("v",$componentPath);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyValue("v", "UpToDate", "yes") if ($uptodate);
addKeyValue("v", "UpToDate", "no") if (!$uptodate);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Installed", $installedVersion);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Available", $componentVersion);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Vendor", $vendor);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyValue("v", "Mandatory", $isMandatoryComponent);
addKeyValue("v", "Severity", $severityText[$updateVendorSeverity]);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyMB("v", "Size", $downloadSize);
addKeyValueUnit("v", "Duration", $installDuration, "sec");
addKeyValue("v", "RebootMode", $rebootText[$rebootRequired]);
addMessage("v", "\n");
addMessage("v", "#\t");
addKeyLongValue("v", "Prerequisites", $prereq);
addMessage("v", "\n");
}#outdir
} # for
} # components
####
addMessage("l", "#...\n") if ($printLimit and $printLimit == $printIndex);
if ($optOutdir) {
writeTxtFile($fileHost, "INST", $variableVerboseMessage);
}
$variableVerboseMessage = $save_variableVerboseMessage;
} # agentUpdateInstTable
sub agentUpdateStatus {
agentUpdateSystemStatus();
return if ($exitCode == 3);
agentUpdateDiffTable() if ($optChkUpdDiffList);
agentUpdateInstTable() if ($optChkUpdInstList);
} # agentUpdateStatus
#########################################################################
# iRMC Report.xml
#########################################################################
our $iRMCFullReport = undef;
our $iRMCStatusOverallString = undef;
our $iRMCReportIDPROMS = undef;
sub iRMCReport_ScanIPROMS {
my $searchClass = shift;
my $searchValueName = shift;
my $refClass = shift;
my $out = undef;
return undef if (!$refClass or !$searchClass or !$searchValueName);
my @class = @{$refClass};
for (my $i=0; $i<=$#class; $i++) {
my $classStream = $class[$i];
my $search = undef;
if ($classStream =~ m/\"$searchClass\"/ and $classStream =~ m/$searchValueName/) {
$search = $searchValueName;
}
next if (!$search);
# perl has sometimes trouble with < and > in expressions
$out = $1 if ($classStream =~ m/($search[^<]+)/);
$out =~ s/^.*\>// if ($out);
last if ($out);
} # for
return $out;
} # iRMCReport_ScanIPROMS
#
my $iRMCConnectedAgent = undef;
sub iRMCReportConnectionTest {
# initial tests with http is faster than https !
$optRestHeaderLines = undef;
my $save_optConnectTimeout = $optConnectTimeout;
$optConnectTimeout = 20 if (!defined $optConnectTimeout or $optConnectTimeout > 20);
$useRESTverbose = 1; # for 401 discovery
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/Status",undef);
#
$useRESTverbose = 0;
my $chkOut = $out;
$chkOut =~ s/[\r\n]//g if ($chkOut);
my $gotOverall = 0;
if ($chkOut and $chkOut =~ m/xml.*Root.*SystemStatus/ ) {
addExitCode(0);
my $tmpStatusOverall = $1 if ($chkOut =~ m/SystemStatus(.*)SystemStatus/);
#next if (!defined $tmpStatusOverall);
if (defined $tmpStatusOverall) {
$gotOverall = 1;
$iRMCStatusOverallString = $1 if ($tmpStatusOverall =~ m/Description=\"([^\"]*)\"/);
$tmpStatusOverall =~s/.*>//;
$tmpStatusOverall =~s/<.*//;
$statusOverall = 3;
$statusOverall = 0 if ($tmpStatusOverall =~ m/^1$/);
$statusOverall = 1 if ($tmpStatusOverall =~ m/^2$/);
$statusOverall = 2 if ($tmpStatusOverall =~ m/^3$/);
}
# ... iRMC says this is SCCI status
#my @statusText = ("Unknown",
#"OK", "Warning", "Error", "Not present", "Not manageable",
#"..unexpected..",
#);
$iRMCConnectedAgent = $1 if ($chkOut =~ m/AgentConnected(.*)AgentConnected/);
$iRMCConnectedAgent =~ s/^>// if ($iRMCConnectedAgent);
$iRMCConnectedAgent =~ s!</$!! if ($iRMCConnectedAgent);
if ($chkOut and $chkOut =~ m/xml.*Root.*Summary/) { # older Firmware
$out =~ s/\s+/ /gm if ($out);
$iRMCFullReport = $out;
}
} elsif ($chkOut and $chkOut =~ m/xml.*Root.*Summary/) { # older Firmware
addExitCode(0);
$out =~ s/\s+/ /gm if ($out);
$iRMCFullReport = $out;
} else {
addExitCode(2);
}
$gotOverall = 1 if ($main::verboseTable == 900); # try to use old fw
if ($exitCode == 0 and $gotOverall and $optChkIdentify) {
addMessage("m","- ") if (!$msg);
addKeyLongValue("m","REST-Service", "ServerView iRMC Report");
}
if ($exitCode == 2) {
if ($optServiceType) {
if ($outheader and $outheader =~ m/401/) {
addMessage("m","- ") if (!$msg);
addMessage("m","[ERROR] Authentication fault for ServerView iRMC Report");
addMessage("l", $errtext) if ($errtext);
$exitCode = 1;
} else {
addMessage("m","- ") if (!$msg);
addMessage("m","[ERROR] Unable to connect to ServerView iRMC Report");
addMessage("l", $errtext) if ($errtext);
}
} else {
if ($outheader and $outheader =~ m/401/) {
addMessage("l","[ERROR] Authentication fault for ServerView iRMC Report");
addMessage("l", $errtext) if ($errtext);
$exitCode = 1;
} else {
$errtext = '' if (!defined $errtext);
addMessage("l","[ERROR] Unable to connect to ServerView iRMC Report ($errtext)\n");
}
}
}
if (!$gotOverall and $exitCode != 2 and $exitCode != 1) {
if ($optServiceType) {
addMessage("m","- ") if (!$msg);
addMessage("m","[ERROR] Too old firmware of ServerView iRMC Report");
} else {
addMessage("l","[ERROR] Too old firmware of ServerView iRMC Report\n");
}
$exitCode = 1;
}
$optServiceType = "REPORT" if ($exitCode == 0 and !defined $optServiceType);
$optRestHeaderLines = undef;
$optConnectTimeout = $save_optConnectTimeout;
} # iRMCReportConnectionTest
sub iRMCReportSerialID {
my $stream = undef;
my $serialid = undef;
=begin NOFULLIRMCREPORT
if (!$iRMCFullReport and $setOverallStatus) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml",undef);
$out =~ s/\s+/ /gm if ($out);
$iRMCFullReport = $out;
}
=end NOFULLIRMCREPORT
=cut
$stream = $iRMCFullReport;
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/IDPROMS",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
$iRMCReportIDPROMS = $stream; # Multi used part
}
return undef if (!$stream);
my $idproms = undef;
$idproms = $1 if ($stream =~ m/(\<IDPROMS.*IDPROMS\>)/);
return undef if (!$idproms);
my @class = sxmlSplitObjectTag($idproms);
$serialid = iRMCReport_ScanIPROMS("Product","Product Serial Number", \@class);
$serialid = iRMCReport_ScanIPROMS("System Board","System Board Serial Number", \@class)
if (!$serialid);
return $serialid;
} # iRMCReportSerialID
sub iRMCReportOverallStatusValues {
$noSummaryStatus = 1;
#### System
if ($optChkSystem) {
addExitCode($statusOverall) if (defined $statusOverall);
#addMessage("m","-") if (!$msg);
addComponentStatus("m", "Overall", $iRMCStatusOverallString);
}
#
=begin NOFULLIRMCREPORT
if (!$iRMCFullReport and $setOverallStatus) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml",undef);
$out =~ s/\s+/ /gm if ($out);
$iRMCFullReport = $out;
}
=end NOFULLIRMCREPORT
=cut
} # iRMCReportOverallStatusValues
sub iRMCReportSystemInventoryInfo {
#return if (!$optAgentInfo and $main::verbose < 3);
#### AGENT INFO
{
my $stream = undef;
$stream = $iRMCFullReport;
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/ManagementControllers",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
my $ctrls = undef;
$ctrls = $1 if ($stream =~ m/(\<ManagementControllers.*ManagementControllers\>)/);
return undef if (!$ctrls);
my $iRMC = undef;
$iRMC = $1 if ($ctrls =~ m/(\<iRMC.*iRMC\>)/);
return undef if (!$iRMC);
my $fwversion = undef;
my $name = undef;
$fwversion = $1 if ($iRMC =~ m/Firmware[^\>]*\>([^\<]*)\<.Firmware/);
$name = $1 if ($iRMC =~ m/Name=\"([^\"]*)\"/);
if ($fwversion and $optAgentInfo) {
addKeyValue("m","Version",$fwversion);
addStatusTopic("l",undef,"AgentInfo", undef);
addName("l",$name);
addKeyValue("l","Version",$fwversion);
addKeyLongValue("l","ConnectedAgent", $iRMCConnectedAgent);
addMessage("l","\n");
$exitCode = 0;
} elsif ($main::verbose >= 3) {
addStatusTopic("v",undef,"AgentInfo", undef);
addName("v",$name);
addKeyValue("v","Version",$fwversion) if ($fwversion !~ m/\s/);
addKeyLongValue("v","Version",$fwversion) if ($fwversion =~ m/\s/);
addKeyLongValue("v","ConnectedAgent", $iRMCConnectedAgent);
#addKeyLongValue("v","Company",$company);
addMessage("v","\n");
} #verbose
} # agent
} # iRMCReportSystemInventoryInfo
sub iRMCReportSystemNotifyInformation {
my $stream = undef;
$stream = $iRMCReportIDPROMS;
$stream = $iRMCFullReport if (!$stream);
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/IDPROMS",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
$iRMCReportIDPROMS = $stream; # Multi used part
}
return undef if (!$stream);
my $idproms = undef;
$idproms = $1 if ($stream =~ m/(\<IDPROMS.*IDPROMS\>)/);
return undef if (!$idproms);
#### iRMC Name
my $iRMCName = undef;
if ($iRMCFullReport) {
my $summary = undef;
$summary = $1 if ($stream =~ m/(\<Summary.*Summary\>)/);
$iRMCName = $1 if ($summary and $summary =~ m/Computer(.*)Computer/);
$iRMCName =~ s/^[^\>]*\>// if ($iRMCName);
$iRMCName =~ s/\<.*// if ($iRMCName);
}
#### MODEL
my $model = undef;
my @class = sxmlSplitObjectTag($idproms);
$model = iRMCReport_ScanIPROMS("Product","Product Model", \@class);
$model = iRMCReport_ScanIPROMS("System Board","System Board Model", \@class)
if (!$model);
####
if ($model or $iRMCName) {
addKeyLongValue("n","iRMC-Name", $iRMCName);
addProductModel("n", undef, $model);
}
addExitCode(0) if ($optSystemInfo);
} # iRMCReportSystemNotifyInformation
####
sub iRMCReportAllFanSensors {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/Fans",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
my $fans = undef;
$fans = $1 if ($stream =~ m/(\<Fans.*Fans\>)/);
return undef if (!$fans); # no fan collection available
#
my @fanArray = sxmlSplitObjectTag($fans);
# <Fan Name="FAN1 SYS" CSS="true">
# <Status Description="ok">1</Status>
# <CurrSpeed>5160</CurrSpeed>
# <CurrMaxSpeed>5100</CurrMaxSpeed>
# <NomMaxSpeed>5100</NomMaxSpeed>
# </Fan>
#define CMV_FANSTAT_DISABLE (BYTE) 0
#define CMV_FANSTAT_OK (BYTE) 1
#define CMV_FANSTAT_FAIL (BYTE) 2
#define CMV_FANSTAT_PREFAIL (BYTE) 3
#define CMV_FANSTAT_REDUND_FAIL (BYTE) 4
#define CMV_FANSTAT_NOT_MANAGE (BYTE) 5
#define CMV_FANSTAT_NOT_PRESENT (BYTE) 6
addTableHeader("v","Fans") if ($verbose and $#fanArray > 0);
for (my $i=0;$i <= $#fanArray; $i++) {
my $sensor = $fanArray[$i];
next if (!$sensor);
my $name = undef;
my $status = undef;
my $statusdescr = undef;
my $speed = undef;
$name = $1 if ($sensor =~ m/Name=\"([^\"]*)\"/);
$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$speed = $1 if ($sensor =~ m/CurrSpeed[^\>]*\>([\d]+)/);
#$statusdescr =~ s/\"//g;
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and defined $status
and ($status == 2 or $status == 3 or $status == 4 ));
if ($medium) {
addStatusTopic($medium,$statusdescr, "Fan", $i);
addName($medium,$name);
addKeyRpm($medium,"Speed", $speed);
addMessage($medium,"\n");
}
if ($optChkFanPerformance) {
$name =~ s/[\s\,\.\$\(\)]+/_/g;
$name =~ s/_+/_/g;
addRpmToPerfdata($name, $speed, undef, undef);
}
if ($setExitCode and defined $status) {
my $localExitCode = 3;
$localExitCode = 0 if ($status == 1);
$localExitCode = 1 if ($status == 3 or $status == 4);
$localExitCode = 2 if ($status == 2);
$tmpExitCode = addTmpExitCode($localExitCode,$tmpExitCode);
}
} # for
if ($setExitCode) {
$allFanStatus = $tmpExitCode if (!defined $allFanStatus);
if ($allFanStatus and $allFanStatus < 3
and defined $statusOverall and $statusOverall != 3)
{
$allFanStatus = $statusOverall if ($statusOverall < $allFanStatus);
}
if ($optChkEnv_Fan and !$optChkEnvironment) {
addComponentStatus("m", "Fans",$state[$allFanStatus]);
}
}
} # iRMCReportAllFanSensors
sub iRMCReportAllTemperatureSensors {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
#
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/Temperatures",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
#
my $sensors = undef;
$sensors = $1 if ($stream =~ m/(\<Temperatures.*Temperatures\>)/);
return undef if (!$sensors); # no sensors collection available
#
my @sensorArray = sxmlSplitObjectTag($sensors);
# <Temperature Name="Ambient" CSS="false">
# <Status Description="ok">6</Status>
# <CurrValue>30</CurrValue>
# <WarningThreshold>37</WarningThreshold>
# <CriticalThreshold>42</CriticalThreshold>
# </Temperature>
#define CMV_SENSSTAT_NOTAVAIL (BYTE) 0
#define CMV_SENSSTAT_OK (BYTE) 1
#define CMV_SENSSTAT_FAIL (BYTE) 3
#define CMV_SENSSTAT_TEMPWARN (BYTE) 4
#define CMV_SENSSTAT_TEMPCRIT (BYTE) 5
#define CMV_SENSSTAT_TEMPOK (BYTE) 6
#define CMV_SENSSTAT_TEMPPREWARN (BYTE) 7
addTableHeader("v","Temperature Sensors") if ($verbose and $#sensorArray > 0);
for (my $i=0;$i <= $#sensorArray; $i++) {
my $sensor = $sensorArray[$i];
next if (!$sensor);
my $name = undef;
my $status = undef;
my $statusdescr = undef;
my $current = undef;
my $warn = undef;
my $crit = undef;
$name = $1 if ($sensor =~ m/Name=\"([^\"]*)\"/);
$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$current = $1 if ($sensor =~ m/CurrValue[^\>]*\>([\d]+)/);
$warn = $1 if ($sensor =~ m/WarningThreshold[^\>]*\>([\d]+)/);
$crit = $1 if ($sensor =~ m/CriticalThreshold[^\>]*\>([\d]+)/);
$status = 0 if (!defined $status);
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and defined $status
and $status >= 3 and $status <= 7 and $status != 6);
if ($medium) {
addStatusTopic($medium,$statusdescr, "Sensor", $i);
addName($medium,$name);
addCelsius($medium,$current, $warn, $crit);
addMessage($medium,"\n");
}
{ # performance
$name =~ s/[\s\,\.\$\(\)]+/_/g;
$name =~ s/_+/_/g;
addTemperatureToPerfdata($name, $current, $warn, $crit)
if (!$main::verboseTable);
}
if ($setExitCode and defined $status) {
my $localExitCode = 3;
$localExitCode = 0 if ($status == 1 or $status == 6);
$localExitCode = 1 if ($status == 4 or $status == 7);
$localExitCode = 2 if ($status == 3 or $status == 5);
$tmpExitCode = addTmpExitCode($localExitCode,$tmpExitCode);
}
} # for
if ($setExitCode) {
$allTempStatus = $tmpExitCode if (!defined $allTempStatus);
if ($allTempStatus and $allTempStatus < 3
and defined $statusOverall and $statusOverall != 3)
{
$allTempStatus = $statusOverall if ($statusOverall < $allTempStatus);
}
if ($optChkEnv_Temp and !$optChkEnvironment) {
addComponentStatus("m", "TemperatureSensors",$state[$allTempStatus]);
}
}
} # iRMCReportAllTemperatureSensors
sub iRMCReportAllPowerSupplies {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/PowerSupplies",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
#
my $sensors = undef;
$sensors = $1 if ($stream =~ m/(\<PowerSupplies.*PowerSupplies\>)/);
return undef if (!$sensors); # no sensors collection available
#
my @sensorArray = sxmlSplitObjectTag($sensors);
# <PowerSupply Name="PSU1" CSS="true">
# <Status Description="ok">1</Status>
# <Load>110</Load>
# </PowerSupply>
#define CMV_PSSTAT_NOT_PRES (BYTE) 0
#define CMV_PSSTAT_OK (BYTE) 1
#define CMV_PSSTAT_FAIL (BYTE) 2
#define CMV_PSSTAT_AC_FAIL (BYTE) 3
#define CMV_PSSTAT_DC_FAIL (BYTE) 4
#define CMV_PSSTAT_TEMPCRIT (BYTE) 5
#define CMV_PSSTAT_NOTMANAGE (BYTE) 6
#define CMV_PSSTAT_FAN_PREFAIL (BYTE) 7
#define CMV_PSSTAT_FAN_FAIL (BYTE) 8
#define CMV_PSSTAT_PWR_SAVE_MODE (BYTE) 9
#define CMV_PSSTAT_NONRED_DC_FAIL (BYTE) 10
#define CMV_PSSTAT_NONRED_AC_FAIL (BYTE) 11
addTableHeader("v","Power Supplies") if ($verbose and $#sensorArray > 0);
for (my $i=0;$i <= $#sensorArray; $i++) {
my $sensor = $sensorArray[$i];
next if (!$sensor);
my $name = undef;
my $status = undef;
my $statusdescr = undef;
my $load = undef;
$name = $1 if ($sensor =~ m/Name=\"([^\"]*)\"/);
$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$load = $1 if ($sensor =~ m/Load[^\>]*\>([\d]+)/);
$status = 0 if (!defined $status);
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and defined $status
and $status >= 2 and $status <= 11 and $status != 6);
if ($medium) {
addStatusTopic($medium,$statusdescr, "PSU", $i);
addName($medium,$name);
addKeyWatt($medium, "CurrentLoad", $load);
addMessage($medium,"\n");
}
if ($setExitCode and defined $status) {
my $localExitCode = 3;
$localExitCode = 0 if ($status == 1);
$localExitCode = 1 if ($status == 7);
$localExitCode = 2 if ($status >= 2 and $status <= 11
and $status != 6 and $status != 7);
$tmpExitCode = addTmpExitCode($localExitCode,$tmpExitCode);
}
} # for
if ($setExitCode) {
$statusPower = $tmpExitCode if (!defined $statusPower);
if ($statusPower and $statusPower < 3
and defined $statusOverall and $statusOverall != 3)
{
$statusPower = $statusOverall if ($statusOverall < $statusPower);
}
}
} # iRMCReportAllPowerSupplies
sub iRMCReportAllPowerConsumption {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/PowerConsumption",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
#
my $allconsumption = undef;
$allconsumption = $1 if ($stream =~ m/(\<PowerConsumption.*PowerConsumption\>)/);
return undef if (!$allconsumption); # no data available
#
my $sensors = undef;
$sensors = $1 if ($allconsumption =~ m/(\<Sensors.*Sensors\>)/);
return undef if (!$sensors); # no data available
#
my @sensorArray = sxmlSplitObjectTag($sensors);
addTableHeader("v","Power Consumption") if ($verbose and $#sensorArray > 0);
for (my $i=0;$i <= $#sensorArray; $i++) {
my $sensor = $sensorArray[$i];
next if (!$sensor);
my $name = undef;
my $current = undef;
my $warn = undef;
my $crit = undef;
my $status = undef;
my $statusdescr = undef;
$name = $1 if ($sensor =~ m/Name=\"([^\"]*)\"/);
if ($name =~ m/Total Power Out/) {
$current = $1 if ($sensor =~ m/CurrentValue[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
} elsif ($name =~ m/Total Power/) {
#$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
# MISSING description of status numbers !!!
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$current = $1 if ($sensor =~ m/CurrentValue[^\>]*\>([\d]+)/);
$warn = $1 if ($sensor =~ m/WarningThreshold[^\>]*\>([\d]+)/);
$crit = $1 if ($sensor =~ m/CriticalThreshold[^\>]*\>([\d]+)/);
$status = 0 if ($warn and $current < $warn);
$status = 1 if ($crit and !defined $status and $current < $crit);
$status = 2 if ($crit and !defined $status);
addPowerConsumptionToPerfdata($current, $warn,$crit)
if (!$main::verboseTable);
}
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and $status);
if ($medium and defined $current) {
addStatusTopic($medium,$statusdescr, "PSCons", $i);
addName($medium,$name);
addKeyWatt($medium, "Current", $current, $warn, $crit);
addMessage($medium,"\n");
}
} # end for
} # iRMCReportAllPowerConsumption
sub iRMCReportAllCPU {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
#
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/Processor",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
#
my $sensors = undef;
$sensors = $1 if ($stream =~ m/(\<Processor.*Processor\>)/);
return undef if (!$sensors); # no sensors collection available
#
my @sensorArray = sxmlSplitObjectTag($sensors);
#<CPU Boot="true">
# <SocketDesignation>CPU1</SocketDesignation>
# <Manufacturer>Intel</Manufacturer>
# <Model>
# <Version>Intel(R) Xeon(R) CPU E7-4850 v3 @ 2.20GHz</Version>
# <BrandName>Intel(R) Xeon(R) CPU E7-4850 v3 @ 2.20GHz</BrandName>
# </Model>
# <Speed>2200</Speed>
# <Status Description="ok">1</Status>
# <CoreNumber>14</CoreNumber>
# <LogicalCpuNumber>28</LogicalCpuNumber>
# <QPISpeed Unit="MT/s">8000</QPISpeed>
# <Level1CacheSize Unit="KByte">896</Level1CacheSize>
# <Level2CacheSize Unit="KByte">3584</Level2CacheSize>
# <Level3CacheSize Unit="MByte">35</Level3CacheSize>
#</CPU>
#define CMV_CPUSTAT_EMPTYSOCK (BYTE) 0
#define CMV_CPUSTAT_OK (BYTE) 1
#define CMV_CPUSTAT_DISABLE (BYTE) 2
#define CMV_CPUSTAT_ERROR (BYTE) 3
#define CMV_CPUSTAT_FAIL (BYTE) 4
#define CMV_CPUSTAT_NOTERMINATE (BYTE) 5
#define CMV_CPUSTAT_PREFAIL (BYTE) 6
addTableHeader("v","CPU Table") if ($verbose and $#sensorArray > 0);
for (my $i=0;$i <= $#sensorArray; $i++) {
my $sensor = $sensorArray[$i];
next if (!$sensor);
my $name = undef;
my $status = undef;
my $statusdescr = undef;
my $model = undef;
my $manufact = undef;
my $speed = undef;
$name = $1 if ($sensor =~ m/SocketDesignation[^\>]*\>([^\<]+)/);
$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$speed = $1 if ($sensor =~ m/Speed[^\>]*\>([\d]+)/);
$model = $1 if ($sensor =~ m/Version[^\>]*\>([^\<]+)/);
$manufact = $1 if ($sensor =~ m/Manufacturer[^\>]*\>([^\<]+)/);
$status = 0 if (!defined $status);
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and defined $status and $status >= 3 and $status <= 6);
if ($medium) {
addStatusTopic($medium,$statusdescr, "CPU", $i);
addName($medium,$name);
addKeyMHz($medium, "Speed", $speed);
addProductModel($medium,undef,$model);
addKeyLongValue($medium,"Manufacturer", $manufact);
addMessage($medium,"\n");
}
if ($setExitCode and defined $status) {
my $localExitCode = 3;
$localExitCode = 0 if ($status == 1);
$localExitCode = 1 if ($status == 3 or $status == 6);
$localExitCode = 2 if ($status == 4 or $status == 5);
$tmpExitCode = addTmpExitCode($localExitCode,$tmpExitCode);
}
} # for
if ($setExitCode) {
$allCPUStatus = $tmpExitCode if (!defined $allCPUStatus);
if ($allCPUStatus and $allCPUStatus < 3
and defined $statusOverall and $statusOverall != 3)
{
$allCPUStatus = $statusOverall if ($statusOverall < $allCPUStatus);
}
if (($optChkCPU or $optChkHardware) and !$optChkSystem) {
addComponentStatus("m", "CPUs",$state[$allCPUStatus]);
}
}
} # iRMCReportAllCPU
sub iRMCReportAllVoltages {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
#
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/Voltages",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
#
my $sensors = undef;
$sensors = $1 if ($stream =~ m/(\<Voltages.*Voltages\>)/);
return undef if (!$sensors); # no sensors collection available
#
my @sensorArray = sxmlSplitObjectTag($sensors);
# <Voltage Name="BATT 3.0V" CSS="false">
# <Status Description="ok">1</Status>
# <CurrValue>2.79</CurrValue>
# <NomValue>3.00</NomValue>
# <Thresholds>
# <MinValue>1.50</MinValue>
# <MaxValue>3.50</MaxValue>
# </Thresholds>
# </Voltage>
#define CMV_VOLTAGE_NOTAVAIL (BYTE) 0
#define CMV_VOLTAGE_OK (BYTE) 1
#define CMV_VOLTAGE_TOO_LOW (BYTE) 2
#define CMV_VOLTAGE_TOO_HIGH (BYTE) 3
#define CMV_VOLTAGE_NOT_OK (BYTE) 4
#define CMV_VOLTAGE_PREFAILURE (BYTE) 5
addTableHeader("v","Voltages") if ($verbose and $#sensorArray > 0);
for (my $i=0;$i <= $#sensorArray; $i++) {
my $sensor = $sensorArray[$i];
next if (!$sensor);
my $name = undef;
my $status = undef;
my $statusdescr = undef;
my $current = undef;
my $nominal = undef;
my $critmin = undef;
my $critmax = undef;
$name = $1 if ($sensor =~ m/Name=\"([^\"]*)\"/);
$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$current = $1 if ($sensor =~ m/CurrValue[^\>]*\>([\d\.]+)/);
$nominal = $1 if ($sensor =~ m/NomValue[^\>]*\>([\d\.]+)/);
$critmin = $1 if ($sensor =~ m/MinValue[^\>]*\>([\d\.]+)/);
$critmax = $1 if ($sensor =~ m/MaxValue[^\>]*\>([\d\.]+)/);
#
$status = 0 if (!defined $status);
my $crit = undef;
if (defined $critmin and defined $critmax and $critmin != $critmax) {
$crit = "$critmin:$critmax";
} elsif (defined $critmin and defined $critmax and $critmin == $critmax) {
$crit = "$critmin";
} elsif (defined $critmin and !defined $critmax) {
$crit = "$critmin";
} elsif (!defined $critmin and defined $critmax) {
$crit = "$critmax";
}
#
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and defined $status and $status > 1 and $status < 6);
if ($medium) {
addStatusTopic($medium,$statusdescr, "Voltage", $i);
addName($medium,$name);
addKeyIntValueUnit($medium,"Current",$current,"V");
addKeyIntValueUnit($medium,"Critical",$crit,"V");
addKeyIntValueUnit($medium,"Nominal",$nominal,"V");
addMessage($medium,"\n");
}
if ($setExitCode) {
my $localExitCode = 3;
$localExitCode = 0 if ($status == 1);
$localExitCode = 1 if ($status == 5);
$localExitCode = 2 if ($status >= 2 and $status <= 4);
$tmpExitCode = addTmpExitCode($localExitCode,$tmpExitCode);
}
} # for
if ($setExitCode) {
$allVoltageStatus = $tmpExitCode if (!defined $allVoltageStatus);
if ($allVoltageStatus and $allVoltageStatus < 3
and defined $statusOverall and $statusOverall != 3)
{
$allVoltageStatus = $statusOverall if ($statusOverall < $allVoltageStatus);
}
if (($optChkVoltage or $optChkHardware) and !$optChkSystem) {
addComponentStatus("m", "Voltages",$state[$allVoltageStatus]);
}
}
} # iRMCReportAllVoltages
sub iRMCReportAllMemoryModules {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
#
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=System/Memory",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
#
# <Memory Schema="2">
# <Installed>32768</Installed>
# <Modules Count="96"> ...
my $sensors = undef;
$sensors = $1 if ($stream =~ m/(\<Modules.*Modules\>)/);
return undef if (!$sensors); # no sensors collection available
#
my @sensorArray = sxmlSplitObjectTag($sensors);
#<Module Name="MEM3_DIMM-A1" CSS="true">
# <Status Description="ok">1</Status>
# <Approved>false</Approved>
# <Size>8192</Size>
# <Type>DDR4</Type>
# <BusFrequency Unit="MHz">1333</BusFrequency>
# <SPD Size="512" Revision="1.0" Checksum="true">
# <Checksum>
# <Data>4751</Data>
# <Calculated>4751</Calculated>
# </Checksum>
# <ModuleManufacturer>Samsung</ModuleManufacturer>
# <ModuleManufacturingDate>2014,26</ModuleManufacturingDate>
# <ModulePartNumber>M393A1G40DB0-CPB </ModulePartNumber>
# <ModuleRevisionCode>0</ModuleRevisionCode>
# <ModuleSerialNumber AsString="B1550602">-1319827966</ModuleSerialNumber>
# <ModuleType>RDIMM</ModuleType>
# <DeviceType>DDR4</DeviceType>
# <DeviceTechnology>1Gx4/16x10x4</DeviceTechnology>
# <BusFrequency Unit="MHz">2133</BusFrequency>
# <VoltageInterface>1.2V</VoltageInterface>
# <CASLatencies>10;11;12;13;14;15;16;</CASLatencies>
# <DataWith>72</DataWith>
# <NumberRanks>1</NumberRanks>
# </SPD>
# <ConfigStatus Description="Normal">0</ConfigStatus>
#</Module>
#define CMV_MEMSTAT_EMPTYSLOT (BYTE) 0
#define CMV_MEMSTAT_OK (BYTE) 1
#define CMV_MEMSTAT_DISABLE (BYTE) 2
#define CMV_MEMSTAT_ERROR (BYTE) 3
#define CMV_MEMSTAT_FAIL (BYTE) 4
#define CMV_MEMSTAT_PREFAIL (BYTE) 5
#define CMV_MEMSTAT_HOT_SPARE (BYTE) 6
#define CMV_MEMSTAT_MIRROR (BYTE) 7
#define CMV_MEMSTAT_RAID (BYTE) 8
#define CMV_MEMSTAT_HIDDEN (BYTE) 9
addTableHeader("v","Memory Modules Table") if ($verbose and $#sensorArray > 0);
for (my $i=0;$i <= $#sensorArray; $i++) {
my $sensor = $sensorArray[$i];
next if (!$sensor);
my $name = undef;
my $status = undef;
my $statusdescr = undef;
my $size = undef;
my $sizeunit = undef;
my $type = undef;
my $frequency = undef;
my $volt = undef;
$name = $1 if ($sensor =~ m/Name=\"([^\"]*)\"/);
$status = $1 if ($sensor =~ m/Status[^\>]*\>([\d]+)/);
$statusdescr = $1 if ($sensor =~ m/Status Description=\"([^\"]+)\"/);
$size = $1 if ($sensor =~ m/Size[^\>]*\>([\d]+)/);
$sizeunit = $1 if ($sensor =~ m/\<Size Unit=\"([^\"]+)\"/);
$frequency = $1 if ($sensor =~ m/BusFrequency[^\>]*\>([\d]+)/);
$type = $1 if ($sensor =~ m/Type[^\>]*\>([^\<]+)/);
$volt = $1 if ($sensor =~ m/VoltageInterface[^\>]*\>([^\<]+)/);
#
$status = 0 if (!defined $status);
#
if ($sizeunit and $size and $sizeunit =~ m/GByte/i) {
$size *= 1000;
}
my $max = undef;
if ($status) {
my $spd = undef;
$spd = $1 if ($stream =~ m/(\<SPD.*SPD\>)/);
$max = $1 if ($spd and $spd =~ m/BusFrequency[^\>]*\>([\d]+)/);
}
my $medium = undef;
$medium = "v" if ($verbose and ($status or $main::verbose >= 3));
$medium = "l" if ($notify and defined $status and $status > 2 and $status < 9);
if ($medium) {
addStatusTopic($medium,$statusdescr, "Memory", $i);
addName($medium,$name);
addKeyLongValue($medium,"Type", $type);
addKeyMB($medium,"Capacity", $size);
addKeyMHz($medium,"Frequency", $frequency);
addKeyMHz($medium,"Frequency-Max", $max);
addKeyValue($medium,"Voltage", $volt);
addMessage($medium,"\n");
}
if ($setExitCode) {
my $localExitCode = 3;
$localExitCode = 0 if ($status == 1);
$localExitCode = 1 if ($status == 5);
$localExitCode = 2 if ($status >= 2 and $status <= 4);
$tmpExitCode = addTmpExitCode($localExitCode,$tmpExitCode);
}
} # for
if ($setExitCode) {
$allMemoryStatus = $tmpExitCode if (!defined $allMemoryStatus);
if ($allMemoryStatus and $allMemoryStatus < 3
and defined $statusOverall and $statusOverall != 3)
{
$allMemoryStatus = $statusOverall if ($statusOverall < $allMemoryStatus);
}
if (($optChkMemMod or $optChkHardware) and !$optChkSystem) {
addComponentStatus("m", "MemoryModules",$state[$allMemoryStatus]);
}
}
} # iRMCReportAllMemoryModules
sub iRMCReportAllStorageAdapter {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
iRMCReportRAID($setExitCode,$notify,$verbose);
} # iRMCReportAllStorageAdapter
####
sub iRMCReportRAID_ExitCode {
my $stString = shift;
return undef if (!defined $stString);
my $tmpExitCode = 3;
$tmpExitCode = 0 if ($stString and $stString =~ m/ok/i);
$tmpExitCode = 1 if ($tmpExitCode == 3 and $stString and ($stString =~ m/warning/i) );
$tmpExitCode = 2 if ($tmpExitCode == 3 and $stString and ($stString =~ m/failed/i) );
return $tmpExitCode;
} # iRMCReportRAID_ExitCode
sub iRMCReportRAIDStatus {
my $stream = shift;
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
my $part = undef;
$part = $1 if ($stream =~ m/(\<Multiplexer.*Multiplexer\>)/);
return if (!$part);
# <Multiplexer>
# <Status>Operational</Status>
# <StatusOverall>OK</StatusOverall>
# <StatusAdapters>OK</StatusAdapters>
# <StatusLogicalDrives>OK</StatusLogicalDrives>
# <StatusDisks>OK</StatusDisks>
# </Multiplexer>
my $stringOverall = undef;
my $stringCtrl = undef;
my $stringPDevice = undef;
my $stringLDrive = undef;
$stringOverall = $1 if ($part =~ m/StatusOverall[^\>]*\>([^\<]+)/);
$stringCtrl = $1 if ($part =~ m/StatusAdapters[^\>]*\>([^\<]+)/);
$stringPDevice = $1 if ($part =~ m/StatusDisks[^\>]*\>([^\<]+)/);
$stringLDrive = $1 if ($part =~ m/StatusLogicalDrives[^\>]*\>([^\<]+)/);
#### PRINT
addTableHeader("v","RAID Overview") if ($verbose);
my $tmpExitCode = iRMCReportRAID_ExitCode($stringOverall);
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if (!$medium and $notify and $tmpExitCode and $tmpExitCode < 3);
if ($medium and defined $stringOverall) {
addStatusTopic($medium,$stringOverall,
"RAID -", undef);
addComponentStatus($medium,"Controller", $stringCtrl)
if (defined $stringCtrl);
addComponentStatus($medium,"PhysicalDevice", $stringPDevice)
if (defined $stringPDevice);
addComponentStatus($medium,"LogicalDrive", $stringLDrive)
if (defined $stringLDrive);
addMessage($medium,"\n");
}
$raidCtrl = iRMCReportRAID_ExitCode($stringCtrl);
$raidLDrive = iRMCReportRAID_ExitCode($stringLDrive);
$raidPDevice = iRMCReportRAID_ExitCode($stringPDevice);
if ($setExitCode) {
$statusMassStorage = 3;
$statusMassStorage = addTmpExitCode($tmpExitCode, $statusMassStorage)
}
} # iRMCReportRAIDStatus
###
our %gHashiRMCAdapter = ();
sub iRMCReportRAIDCtrlTable {
my $notify = shift;
my $verbose = shift;
my $refadapter = shift;
my @adapter = @$refadapter;
addTableHeader("v","RAID Controller") if ($verbose);
# Split next layer
for (my $a=0;$a<=$#adapter;$a++) {
my $oneAdapter = $adapter[$a];
next if (!defined $oneAdapter);
my @adapterElemArray = sxmlSplitObjectTag($oneAdapter);
$gHashiRMCAdapter{$a} = \@adapterElemArray;
} # for
#
my $status = undef;
my $serial = undef;
my $name = undef;
my $size = undef;
my $prot = undef;
my $drvname = undef;
my $drvversion = undef;
for (my $a=0;$a<=$#adapter;$a++) {
my $refadapter = $gHashiRMCAdapter{$a};
my @adapterElemArray = @$refadapter;
for (my $e=0;$e<=$#adapterElemArray;$e++) {
my $adapterElement = $adapterElemArray[$e];
next if (!defined $adapterElement);
$status = $1 if (!defined $status and $adapterElement =~ m/Status[^\>]*\>([^\<]+)/);
$serial = $1 if (!defined $serial and $adapterElement =~ m/SerialNumber[^\>]*\>([^\<]+)/);
$name = $1 if (!defined $name and $adapterElement =~ m/Name[^\>]*\>([^\<]+)/);
$size = $1 if (!defined $size and $adapterElement =~ m/MemorySize[^\>]*\>([\d]+)/);
$prot = $1 if (!defined $prot and $adapterElement =~ m/Protocol[^\>]*\>([^\<]+)/);
$drvname = $1 if (!defined $drvname and $adapterElement =~ m/DriverName[^\>]*\>([^\<]+)/);
$drvversion = $1 if (!defined $drvversion and $adapterElement =~ m/DriverVersion[^\>]*\>([^\<]+)/);
last if (defined $size);
} # for
#
my $statusNr = iRMCReportRAID_ExitCode($status);
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if (!$medium and $notify and $statusNr and $statusNr < 3);
if ($medium) {
addStatusTopic($medium,$status,"RAIDCtrl", $a);
addSerialIDs($medium,$serial, undef);
addKeyLongValue($medium,"Name", $name);
addKeyMB($medium,"Cache", $size);
addKeyLongValue($medium,"Protocol", $prot);
addKeyValue($medium,"Driver", $drvname);
addKeyLongValue($medium,"DriverVersion", $drvversion);
addMessage($medium,"\n");
}
} # for adapter
# TODO --- hostname of the <System>
} # iRMCReportRAIDCtrlTable
sub iRMCReportRAIDPhysicalDeviceTable {
my $notify = shift;
my $verbose = shift;
my $refadapter = shift;
my @adapter = @$refadapter;
my $printedHeader = 0;
my %physicalDriveStreams = ();
for (my $a=0;$a<=$#adapter;$a++) {
my $adapterStream = $adapter[$a];
my $ports = undef;
$ports = $1 if ($adapterStream =~ m/(\<Ports.*Ports\>)/);
next if (!$ports);
my @portArray = sxmlSplitObjectTag($ports);
my @driveArray = ();
for (my $p=0;$p<=$#portArray;$p++) {
my $portStream = $portArray[$p];
next if (!defined $portStream);
my @portElemArray = sxmlSplitObjectTag($portStream);
for (my $e=0;$e<=$#portElemArray;$e++) {
my $portElemStream = $portElemArray[$e];
if ($portElemStream =~ m/^\s*\<PhysicalDrive/) {
push(@driveArray, $portElemStream);
} elsif ($portElemStream =~ m/^\s*\<Enclosure/) {
my @enclosureElemArray = sxmlSplitObjectTag($portElemStream);
next if ($#enclosureElemArray < 0);
for (my $ence=0;$ence<=$#enclosureElemArray;$ence++) {
my $encElemStream = $enclosureElemArray[$ence];
if ($encElemStream =~ m/^\s*\<PhysicalDrive/) {
push(@driveArray, $encElemStream);
}
} # for
}
} # for
} # for
$physicalDriveStreams{$a} = \@driveArray;
} # for adapter
addTableHeader("v","RAID Physical Device") if ($verbose);
for (my $a=0;$a<=$#adapter;$a++) {
my $refDriver = $physicalDriveStreams{$a};
my @driveArray = @$refDriver;
for (my $d=0;$d<=$#driveArray;$d++) {
my $oneStream = $driveArray[$d];
my $compstatus = undef;
my $status = undef;
my $name = undef;
my $devnr = undef;
my $portID = undef;
my $encID = undef;
my $slotnr = undef;
my $size = undef;
my $interface = undef;
my $serial = undef;
$devnr = $1 if ($oneStream =~ m/DeviceNumber=\"([^\"]+)/);
$name = $1 if ($oneStream =~ m/Name=\"([^\"]+)/);
$compstatus = $1 if ($oneStream =~ m/ComponentStatus=\"([^\"]+)/);
$status = $1 if ($oneStream =~ m/\<Status[^\>]*\>([^\<]+)/);
$portID = $1 if ($oneStream =~ m/\<PortNumber[^\>]*\>([^\<]+)/);
$encID = $1 if ($oneStream =~ m/\<EnclosureNumber[^\>]*\>([^\<]+)/);
$slotnr = $1 if ($oneStream =~ m/\<Slot[^\>]*\>([^\<]+)/);
$size = $1 if ($oneStream =~ m/\<PhysicalSize[^\>]*\>([^\<]+)/);
$interface = $1 if ($oneStream =~ m/\<Type[^\>]*\>([^\<]+)/);
$serial = $1 if ($oneStream =~ m/\<SerialNumber[^\>]*\>([^\<]+)/);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $compstatus and $compstatus > 1);
if ($medium) {
addStatusTopic($medium,$status, "RAIDPhysicalDevice", "$a.$devnr");
addName($medium,$name);
addSerialIDs($medium,$serial);
addKeyUnsignedIntValue($medium,"Slot",$slotnr) if (defined $slotnr);
addKeyUnsignedIntValue($medium,"Ctrl",$a);
addKeyMB($medium,"Capacity", $size);
addKeyLongValue($medium,"Interface",$interface);
addKeyUnsignedIntValue($medium,"EnclosureNr",$encID) if (defined $encID);
addKeyUnsignedIntValue($medium,"PortNr",$portID) if (defined $portID);
addMessage($medium,"\n");
}
} # for
} # for adapter
} # iRMCReportRAIDPhysicalDeviceTable
sub iRMCReportRAIDLogicalDriveTable {
my $notify = shift;
my $verbose = shift;
my $maxadapterindex = shift;
my $printedHeader = 0;
for (my $a=0;$a<=$maxadapterindex;$a++) {
my $refadapter = $gHashiRMCAdapter{$a};
my @adapterElemArray = @$refadapter;
my @logicalDriveStream = ();
for (my $e=0;$e<=$#adapterElemArray;$e++) {
push (@logicalDriveStream, $adapterElemArray[$e])
if ($adapterElemArray[$e] =~ m/^\s*\<LogicalDrive/);
} # for
if ($verbose and $#logicalDriveStream >= 0 and !$printedHeader) {
addTableHeader("v","RAID Logical Drive");
$printedHeader = 1;
}
for (my $l=0;$l<=$#logicalDriveStream;$l++) {
my $oneStream = $logicalDriveStream[$l];
next if (!defined $oneStream);
my $status = undef;
my $name = undef;
my $size = undef;
my $lsize = undef;
my $level = undef;
my $osdev = undef;
$name = $1 if ($oneStream =~ m/Name=\"([^\"]+)/);
$status = $1 if ($oneStream =~ m/Status[^\>]*\>([^\<]+)/);
$size = $1 if ($oneStream =~ m/PhysicalSize[^\>]*\>([\d]+)/);
$lsize = $1 if ($oneStream =~ m/LogicalSize[^\>]*\>([\d]+)/);
$level = $1 if ($oneStream =~ m/RAIDLevel[^\>]*\>([^\<]+)/);
$osdev = $1 if ($oneStream =~ m/OSDevice[^\>]*\>([^\<]+)/);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $status and $status !~ m/Operation/);
if ($medium) {
addStatusTopic($medium,$status, "LogicalDrive", "$a.$l");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$a);
addKeyLongValue($medium,"Level", $level);
addKeyMB($medium,"LogicalSize", $lsize);
addKeyMB($medium,"Capacity", $size);
addKeyLongValue($medium,"OSDeviceName", $osdev);
addMessage($medium,"\n");
}
} # for
} # for adapter
} # iRMCReportRAIDLogicalDriveTable
sub iRMCReportRAIDSensors {
my $notify = shift;
my $verbose = shift;
my $refadapter = shift;
my @adapter = @$refadapter;
my %fanStreamArray = ();
my %temperatureStreamArray = ();
my %psuStreamArray = ();
#### SPLIT
for (my $a=0;$a<=$#adapter;$a++) {
my $adapterStream = $adapter[$a];
my $oneAdapter = $adapter[$a];
next if (!defined $oneAdapter);
my @adapterElemArray = sxmlSplitObjectTag($oneAdapter);
#### SPLIT
my $portsStream = undef;
for (my $e=0;$e<=$#adapterElemArray;$e++) {
my $aelem = $adapterElemArray[$e];
next if (!defined $aelem);
$portsStream = $1 if ($aelem =~ m/(\<Ports.*Ports\>)/);
last if (defined $portsStream);
} # for
next if (!defined $portsStream);
my @portArray = ();
@portArray = sxmlSplitObjectTag($portsStream);
next if ($#portArray < 0);
my %enclosureStream = ();
for (my $p=0;$p<=$#portArray;$p++) {
my $onePort = $portArray[$p];
next if (!$onePort);
my @portElemArray = ();
@portElemArray = sxmlSplitObjectTag($onePort);
for (my $e=0;$e<=$#portElemArray;$e++) {
my $oneElem = $portElemArray[$e];
next if (!defined $oneElem);
$enclosureStream{"$a.$p"} = $oneElem if ($oneElem =~ m/^\s*\<Enclosure/);
} # for
} # for
my %processorStream = ();
foreach my $key (keys %enclosureStream) {
my $oneEnclosure = $enclosureStream{$key};
next if (!defined $oneEnclosure);
my @encElemArray = ();
@encElemArray = sxmlSplitObjectTag($oneEnclosure);
next if ($#encElemArray < 0);
for (my $e=0;$e<=$#encElemArray;$e++) {
my $oneElem = $encElemArray[$e];
next if (!defined $oneElem);
$processorStream{"$key"} = $oneElem if ($oneElem =~ m/^\s*\<Processor/);
} # for
} # foreach enclosure
foreach my $key (keys %processorStream) {
my $oneProcessor = $processorStream{$key};
next if (!defined $oneProcessor);
my @elemArray = ();
@elemArray = sxmlSplitObjectTag($oneProcessor);
next if ($#elemArray < 0);
my @fanArray = ();
my @temperatureArray = ();
my @psuArray = ();
for (my $e=0;$e<=$#elemArray;$e++) {
my $oneElem = $elemArray[$e];
next if (!defined $oneElem);
push (@fanArray, $oneElem) if ($oneElem =~ m/^\s*\<Fan/);
push (@temperatureArray, $oneElem) if ($oneElem =~ m/^\s*\<TemperatureSensor/);
push (@psuArray, $oneElem) if ($oneElem =~ m/^\s*\<PowerSupply/);
} # for
$fanStreamArray{"$key"} = \@fanArray if ($#fanArray >= 0);
$temperatureStreamArray{"$key"} = \@temperatureArray if ($#temperatureArray >= 0);
$psuStreamArray{"$key"} = \@psuArray if ($#psuArray >= 0);
} # foreach processor
} # for adapters
#### EVAL
my $printedHeader = 0;
if ($notify or $verbose) {
foreach my $key (keys %fanStreamArray) {
my $refArray = $fanStreamArray{$key};
next if (!defined $refArray);
my @fanArray = @$refArray;
next if (!defined $#fanArray < 0);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Fan Sensors");
$printedHeader = 1;
}
for (my $i=0;$i<=$#fanArray;$i++) {
my $oneStream = $fanArray[$i];
my $name = undef;
my $status = undef;
my $speed = undef;
$name = $1 if ($oneStream =~ m/Name=\"([^\"]+)/);
$status = $1 if ($oneStream =~ m/\<Status[^\>]*\>([^\<]+)/);
$speed = $1 if ($oneStream =~ m/\<FanSpeed[^\>]*\>([^\<]+)/);
my $statuscode = iRMCReportRAID_ExitCode($status);
$statuscode = 3 if (!defined $statuscode);
my $portID = $1 if ($key =~ m/\d+.(\d+)/);
my $ctrlID = $1 if ($key =~ m/(\d+).\d+/);
#
my $medium = undef;
$medium = "v" if ($verbose and ($statuscode != 3 or $main::verbose >= 3));
$medium = "l" if ($notify and ($statuscode == 1 or $statuscode == 2));
if ($medium) {
addStatusTopic($medium,$status, "Fan", "$key.$i");
addName($medium,$name);
addKeyValue($medium,"SpeedLevel", $speed);
addKeyIntValue($medium,"Ctrl", $ctrlID);
addKeyIntValue($medium,"Port", $portID);
addMessage($medium,"\n");
}
} # for
} # foreach fan stream
}
$printedHeader = 0;
{ # always
foreach my $key (keys %temperatureStreamArray) {
my $refArray = $temperatureStreamArray{$key};
next if (!defined $refArray);
my @temperatureStreamArray = @$refArray;
next if (!defined $#temperatureStreamArray < 0);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Temperature Sensors");
$printedHeader = 1;
}
for (my $i=0;$i<=$#temperatureStreamArray;$i++) {
my $oneStream = $temperatureStreamArray[$i];
my $name = undef;
my $status = undef;
my $location = undef;
my $current = undef; my $warn = undef; my $crit = undef;
$name = $1 if ($oneStream =~ m/Name=\"([^\"]+)/);
$status = $1 if ($oneStream =~ m/\<Status[^\>]*\>([^\<]+)/);
$location = $1 if ($oneStream =~ m/\<Location[^\>]*\>([^\<]+)/);
$current = $1 if ($oneStream =~ m/\<Temperature\>([^\<]+)/);
$warn = $1 if ($oneStream =~ m/\<WarningTemperatureH[^\>]*\>([^\<]+)/);
$crit = $1 if ($oneStream =~ m/\<CriticalTemperatureH[^\>]*\>([^\<]+)/);
my $statuscode = iRMCReportRAID_ExitCode($status);
$statuscode = 3 if (!defined $statuscode);
my $portID = $1 if ($key =~ m/\d+.(\d+)/);
my $ctrlID = $1 if ($key =~ m/(\d+).\d+/);
#
my $medium = undef;
$medium = "v" if ($verbose and ($statuscode != 3 or $main::verbose >= 3));
$medium = "l" if ($notify and ($statuscode == 1 or $statuscode == 2));
if ($medium) {
addStatusTopic($medium,$status, "Sensor", "$key.$i");
addName($medium,$name);
addCelsius($medium,$current, $warn, $crit);
addKeyLongValue($medium,"Location",$location);
addKeyIntValue($medium,"Ctrl", $ctrlID);
addKeyIntValue($medium,"Port", $portID);
addMessage($medium,"\n");
}
{ # performance
$name =~ s/[\s\,\.\$\(\)]+/_/g;
$name =~ s/_+/_/g;
$name .= "_$key";
addTemperatureToPerfdata($name, $current, $warn, $crit)
if (!$main::verboseTable);
}
} # for
} # foreach temperature stream
}
$printedHeader = 0;
if ($notify or $verbose) {
foreach my $key (keys %psuStreamArray) {
my $refArray = $psuStreamArray{$key};
next if (!defined $refArray);
my @psuArray = @$refArray;
next if (!defined $#psuArray < 0);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Power Supplies");
$printedHeader = 1;
}
for (my $i=0;$i<=$#psuArray;$i++) {
my $oneStream = $psuArray[$i];
my $name = undef;
my $status = undef;
$name = $1 if ($oneStream =~ m/Name=\"([^\"]+)/);
$status = $1 if ($oneStream =~ m/\<Status[^\>]*\>([^\<]+)/);
my $statuscode = iRMCReportRAID_ExitCode($status);
$statuscode = 3 if (!defined $statuscode);
my $portID = $1 if ($key =~ m/\d+.(\d+)/);
my $ctrlID = $1 if ($key =~ m/(\d+).\d+/);
#
my $medium = undef;
$medium = "v" if ($verbose and ($statuscode != 3 or $main::verbose >= 3));
$medium = "l" if ($notify and ($statuscode == 1 or $statuscode == 2));
if ($medium) {
addStatusTopic($medium,$status, "PSU", "$key.$i");
addName($medium,$name);
addKeyIntValue($medium,"Ctrl", $ctrlID);
addKeyIntValue($medium,"Port", $portID);
addMessage($medium,"\n");
}
} # for
} # foreach psu stream
}
} # iRMCReportRAIDSensors
sub iRMCReportRAIDAdditional {
my $notify = shift;
my $verbose = shift;
my $maxadapterindex = shift;
# TODO ... RAID Additional and sort for "header prints"
for (my $a=0;$a<=$maxadapterindex;$a++) {
my $refadapter = $gHashiRMCAdapter{$a};
my @adapterElemArray = @$refadapter;
#### SPLIT
my @batteryStream = ();
my $portsStream = undef;
for (my $e=0;$e<=$#adapterElemArray;$e++) {
my $aelem = $adapterElemArray[$e];
next if (!defined $aelem);
push (@batteryStream, $aelem)
if ($aelem =~ m/^\s*\<Battery/);
$portsStream = $1 if ($aelem =~ m/(\<Ports.*Ports\>)/);
last if (defined $portsStream);
} # for
my @portArray = ();
@portArray = sxmlSplitObjectTag($portsStream);
my %enclosureStream = ();
for (my $p=0;$p<=$#portArray;$p++) {
my $onePort = $portArray[$p];
next if (!$onePort);
my @portElemArray = ();
@portElemArray = sxmlSplitObjectTag($onePort);
for (my $e=0;$e<=$#portElemArray;$e++) {
my $oneElem = $portElemArray[$e];
$enclosureStream{"$a.$p"} = $oneElem if ($oneElem =~ m/^\s*\<Enclosure/);
} # for
} # for
#### EVAL
my $printedHeader = 0;
for (my $b=0;$b<=$#batteryStream;$b++) { # will be only one battery
my $oneBattery = $batteryStream[$b];
next if (!defined $oneBattery);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Battery");
$printedHeader = 1;
}
my $name = undef;
my $status = undef;
my $nomVoltage = undef;
my $curVoltage = undef;
my $capacitance = undef;
my $temp = undef;
$name = $1 if ($oneBattery =~ m/\<Name[^\>]*\>([^\<]+)/);
$status = $1 if ($oneBattery =~ m/\<Status[^\>]*\>([^\<]+)/);
$nomVoltage = $1 if ($oneBattery =~ m/\<DesignVoltage[^\>]*\>([^\<]+)/);
$curVoltage = $1 if ($oneBattery =~ m/\<Voltage[^\>]*\>([^\<]+)/);
$capacitance = $1 if ($oneBattery =~ m/\<Capacitance[^\>]*\>([^\<]+)/);
$temp = $1 if ($oneBattery =~ m/\<Temperature[^\>]*\>([^\<]+)/);
my $statuscode = iRMCReportRAID_ExitCode($status);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $statuscode > 1);
if ($medium) {
addStatusTopic($medium,$status, "RAIDBattery", "$a.$b");
addName($medium,$name);
addKeyVolt($medium,"Voltage",$curVoltage);
addKeyVolt($medium,"NominalVoltage",$nomVoltage);
addKeyPercent($medium,"Capacitance",$capacitance);
addCelsius($medium,$temp);
addKeyUnsignedIntValue($medium,"Ctrl",$a);
addMessage($medium,"\n");
}
} # for
$printedHeader = 0;
for (my $p=0;$p<=$#portArray;$p++) {
my $onePort = $portArray[$p];
next if !defined $onePort;
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Port");
$printedHeader = 1;
}
my $pnr = undef;
my $name = undef;
$pnr = $1 if ($onePort =~ m/Nr=\"([^\"]+)/);
$name = $1 if ($onePort =~ m/Name=\"([^\"]+)/);
my $medium = undef;
$medium = "v" if ($verbose);
if ($medium) {
addStatusTopic($medium,undef, "RAIDPort", "$a.$pnr");
addName($medium,$name);
addKeyUnsignedIntValue($medium,"Ctrl",$a);
addMessage($medium,"\n");
}
} # for
$printedHeader = 0;
foreach my $key (keys %enclosureStream) {
my $oneEnclosure = $enclosureStream{$key};
next if (!defined $oneEnclosure);
if ($verbose and !$printedHeader) {
addTableHeader("v","RAID Enclosure");
$printedHeader = 1;
}
my $portID = undef;
my $encnr = undef;
my $status = undef;
my $name = undef;
$portID = $1 if ($key =~ m/\d+.(\d+)/);
$name = $1 if ($oneEnclosure =~ m/Name=\"([^\"]+)/);
$encnr = $1 if ($oneEnclosure =~ m/EnclosureNumber[^\>]*\>([^\<]+)/);
$status = $1 if ($oneEnclosure =~ m/Status[^\>]*\>([^\<]+)/);
my $statuscode = iRMCReportRAID_ExitCode($status);
#
my $medium = undef;
$medium = "v" if ($verbose);
$medium = "l" if ($notify and $statuscode > 1);
if ($medium) {
addStatusTopic($medium,$status, "RAIDEnclosure", $encnr);
addName($medium,$name);
addKeyUnsignedIntValue($medium,"PortNr",$portID) if (defined $portID);
addKeyUnsignedIntValue($medium,"Ctrl",$a);
addMessage($medium,"\n");
}
} # foreach
} # for adapters
} # iRMCReportRAIDAdditional
sub iRMCReportRAID {
my $setExitCode = shift;
my $notify = shift;
my $verbose = shift;
#
my $stream = undef;
my $tmpExitCode = 3;
$stream = $iRMCFullReport;
#
if (!$stream) {
(my $out, my $outheader, my $errtext) =
restCall("GET","/report.xml?Item=Software/ServerView/ServerViewRaid",undef);
$out =~ s/\s+/ /gm if ($out);
$stream = $out;
}
return undef if (!$stream);
my $RAID = undef;
$RAID = $1 if ($stream =~ m/(\<ServerViewRaid.*ServerViewRaid\>)/);
return undef if (!$RAID);
my $system = undef;
$system = $1 if ($RAID =~ m/(\<System.*System\>)/);
return undef if (!$system);
iRMCReportRAIDStatus($system,$setExitCode,$notify,$verbose);
$notify = 0;
$notify = 1 if ($statusMassStorage and $statusMassStorage < 3);
my @adapterArray = ();
my @systemElemArray = sxmlSplitObjectTag($system);
for (my $i=0;$i<=$#systemElemArray;$i++) {
my $onepart = $systemElemArray[$i];
next if (!$onepart);
push (@adapterArray,$onepart) if ($onepart =~ m/^\s*\<Adapter/);
} # for
if ($notify or $verbose) {
my $componentNotify = 0;
$componentNotify = 1 if ($notify and $raidCtrl and $raidCtrl < 3);
iRMCReportRAIDCtrlTable($componentNotify,$verbose,\@adapterArray);
$componentNotify = 0;
$componentNotify = 1 if ($notify and $raidPDevice and $raidPDevice < 3);
iRMCReportRAIDPhysicalDeviceTable($componentNotify,$verbose,\@adapterArray);
$componentNotify = 0;
$componentNotify = 1 if ($notify and $raidLDrive and $raidLDrive < 3);
iRMCReportRAIDLogicalDriveTable($componentNotify,$verbose,$#adapterArray);
$componentNotify = 0;
$componentNotify = 1 if ($notify and $raidPDevice and $raidPDevice < 3);
if ($main::verbose >= 3 or $componentNotify) {
# Ports have no status
iRMCReportRAIDAdditional($componentNotify,$verbose,$#adapterArray);
}
}
my $componentNotify = 0;
$componentNotify = 1 if ($notify and $raidCtrl and $raidCtrl < 3);
iRMCReportRAIDSensors($componentNotify,$verbose,\@adapterArray);
# There are performance checks for temperatures !
} # iRMCReportRAID
#########################################################################
# iRMC REST
#########################################################################
# provisoric ! This version does not support Status Monitoring
sub iRMCRestConnectionTest {
$optRestHeaderLines = "Accept: application/json";
my $save_optConnectTimeout = $optConnectTimeout;
$optConnectTimeout = 20 if (!defined $optConnectTimeout or $optConnectTimeout > 20);
(my $out, my $outheader, my $errtext) =
restCall("GET","/sessionInformation",undef);
#
if ($out and $out =~ m/^\s*\{/) { # must be a JSON answer
$optServiceType = "iREST" if ($out and !$optServiceType);
addExitCode(0);
}
if ($out and $out =~ m/ServerView Remote Management/) {
addMessage("l","[ERROR] Detected iRMC - but no REST service available\n");
addExitCode(1); # prevent SCS test
}
if ($exitCode == 0 and $optChkIdentify) {
addMessage("m","- ") if (!$msg);
addKeyLongValue("m","REST-Service", "iRMC REST Service");
}
$optRestHeaderLines = undef;
$optConnectTimeout = $save_optConnectTimeout;
} # iRMCRestConnectionTest
sub iRMCRedfishConnectionTest {
$optRestHeaderLines = "Accept: application/json";
my $save_optConnectTimeout = $optConnectTimeout;
$optConnectTimeout = 20 if (!defined $optConnectTimeout or $optConnectTimeout > 20);
$useRESTverbose = 1; # for 401 or 503 discovery
(my $out, my $outheader, my $errtext) =
restCall("GET","/redfish",undef);
#
$useRESTverbose = 0;
my $mustwait = 0;
if ($out and $out =~ m/^\s*\{/) { # must be a JSON answer
$optServiceType = "iRed" if ($out and !$optServiceType);
addExitCode(0);
} elsif ($outheader and $outheader =~ m/ 503 /) {
$optServiceType = "iRedWAIT" if ($out and !$optServiceType);
$mustwait = 1;
addExitCode(0);
}
if ($out and $out =~ m/ServerView Remote Management/) {
addMessage("l","[ERROR] Detected iRMC - but no REST service available\n");
addExitCode(1); # prevent SCS test
}
if ($exitCode == 0 and $optChkIdentify) {
addMessage("m","- ") if (!$msg);
addKeyLongValue("m","REST-Service", "iRMC Redfish Service") if (!$mustwait);
addKeyLongValue("m","REST-Service", "iRMC Redfish Service (Uninitialized)") if ($mustwait);
}
$optRestHeaderLines = undef;
$optConnectTimeout = $save_optConnectTimeout;
} # iRMCRedfishConnectionTest
#########################################################################
# ANY REST Provider
#########################################################################
sub getAllFanSensors {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $allFanStatus and ($allFanStatus==1 or $allFanStatus==2));
$searchNotifies = 1 if (!defined $allFanStatus);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllFanSensors($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllFanSensors($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllFanSensors
sub getAllTemperatureSensors {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $allTempStatus and ($allTempStatus==1 or $allTempStatus==2));
$searchNotifies = 1 if (!defined $allTempStatus);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllTemperatureSensors($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllTemperatureSensors($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllTemperatureSensors
sub getAllPowerSupplies {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $statusPower and ($statusPower==1 or $statusPower==2));
$searchNotifies = 1 if (!defined $statusPower);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllPowerSupplies($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllPowerSupplies($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllPowerSupplies
sub getAllPowerConsumption {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $statusPower and ($statusPower==1 or $statusPower==2));
$searchNotifies = 1 if (!defined $statusPower);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllPowerConsumption($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllPowerConsumption($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllPowerConsumption
sub getAllCPU {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $allCPUStatus and ($allCPUStatus==1 or $allCPUStatus==2));
$searchNotifies = 1 if (!defined $allCPUStatus);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllCPU($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllCPU($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllCPU
sub getAllVoltages {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $allVoltageStatus and ($allVoltageStatus==1 or $allVoltageStatus==2));
$searchNotifies = 1 if (!defined $allVoltageStatus);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllVoltages($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllVoltages($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllVoltages
sub getAllMemoryModules {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $allMemoryStatus and ($allMemoryStatus==1 or $allMemoryStatus==2));
$searchNotifies = 1 if (!defined $allMemoryStatus);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllMemoryModules($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportAllMemoryModules($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
} # getAllMemoryModules
sub getAllDrvMonAdapter {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $statusDrvMonitor
and ($statusDrvMonitor==1 or $statusDrvMonitor==2));
$searchNotifies = 1 if (!defined $statusDrvMonitor);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllDrvMonAdapter($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
} # getAllDrvMonAdapter
sub getAllStorageAdapter {
my $setExitCode = shift;
my $searchNotifies = 0;
$searchNotifies = 1 if (defined $statusMassStorage
and ($statusMassStorage==1 or $statusMassStorage==2));
$searchNotifies = 1 if (!defined $statusMassStorage);
my $verbose = 0;
$verbose = 1 if ($main::verbose >= 2);
return agentAllStorageAdapter($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^A/i);
=begin NOIRMCSTORAGE
return iRMCReportAllStorageAdapter($setExitCode, $searchNotifies, $verbose)
if ($optServiceType and $optServiceType =~ m/^R/i);
=end NOIRMCSTORAGE
=cut
} # getAllStorageAdapter
sub getOtherPowerAdapter {
my $notify = 0;
$notify = 1 if ($statusPower and $statusPower < 3);
if ($otherPowerAdapters and ($main::verbose >= 2 or $notify)) {
my %adapter = %$otherPowerAdapters;
addTableHeader("v","Other Power Components") if ($main::verbose >=2);
foreach my $key (keys %adapter) {
next if (!$key); # never reached point
my $localStateString = $adapter{$key};
my $localState = $otherPowerAdaptersExitCode->{$key};
my $medium = undef;
$medium = "v" if ($main::verbose >= 2 and ($localState != 3 or $main::verbose >= 3));
$medium = "l" if (!$medium and ($localState == 1 or $localState == 2));
if ($medium) {
addStatusTopic($medium,$localStateString,"PowerComponent",'');
addName($medium,$key);
addMessage($medium,"\n");
}
} # loop
} # Adapter
} # getOtherPowerAdapter
sub getOtherSystemBoardAdapter {
my $notify = 0;
$notify = 1 if ($statusSystemBoard and $statusSystemBoard < 3);
if ($otherSystemBoardAdapters and ($main::verbose >= 2 or $notify)) {
my %adapter = %$otherSystemBoardAdapters;
addTableHeader("v","Other System Board Components") if ($main::verbose >=2);
foreach my $key (keys %adapter) {
next if (!$key); # never reached point
my $localStateString = $adapter{$key};
my $localState = $otherSystemBoardAdaptersExitCode->{$key};
my $medium = undef;
$medium = "v" if ($main::verbose >= 2 and ($localState != 3 or $main::verbose >= 3));
$medium = "l" if (!$medium and ($localState == 1 or $localState == 2));
if ($medium) {
addStatusTopic($medium,$localStateString,"SystemBoardComponent",'');
addName($medium,$key);
addMessage($medium,"\n");
}
} # loop
} # Adapter
} # getOtherSystemBoardAdapter
sub getOtherStorageAdapter {
my $notify = 0;
$notify = 1 if ($statusMassStorage and $statusMassStorage < 3);
if ($otherStorageAdapters and ($main::verbose >= 2 or $notify)) {
my %adapter = %$otherStorageAdapters;
addTableHeader("v","Other Storage Components") if ($main::verbose >=2);
foreach my $key (keys %adapter) {
next if (!$key); # never reached point
my $localStateString = $adapter{$key};
my $localState = $otherStorageAdaptersExitCode->{$key};
my $medium = undef;
$medium = "v" if ($main::verbose >= 2 and ($localState != 3 or $main::verbose >= 3));
$medium = "l" if (!$medium and ($localState == 1 or $localState == 2));
if ($medium) {
addStatusTopic($medium,$localStateString,"StorageComponent",'');
addName($medium,$key);
addMessage($medium,"\n");
}
} # loop
} # Adapter
} # getOtherStorageAdapter
####
sub getEnvironment {
return if (!defined $statusEnv and !$noSummaryStatus);
my $setExitCode = 0;
# FanSensors
# if chkenv-fans is entered and it is "iRMC Report" than the exitcode
# nust be calculated to get All-Fans-Status !!!
#
# Enter into details only if system ,env or env-fan is selected AND the status of
# All-Fans is not-ok !
if ($optChkEnvironment or $optChkEnv_Fan) {
my $getInfos = 0;
$setExitCode = 0;
if (!defined $allFanStatus) { # iRMC Report
$setExitCode = 1 if ($optChkEnv_Fan and !$optChkEnvironment);
$setExitCode = 1 if ($noSummaryStatus);
$getInfos = 1 if ($optChkEnv_Fan and !$optChkEnvironment);
$getInfos = 1 if (!defined $statusEnv or $statusEnv==1 or $statusEnv==2);
}
$getInfos = 1 if (defined $allFanStatus and ($allFanStatus==1 or $allFanStatus==2));
$getInfos = 1 if ($main::verbose >= 2);
$getInfos = 1 if (!$optChkEnvironment and $optChkEnv_Fan and $optChkFanPerformance);
getAllFanSensors($setExitCode) if ($getInfos);
if (defined $allFanStatus and $setExitCode and $noSummaryStatus) {
$statusEnv = 3 if (!defined $statusEnv);
$statusEnv = addTmpExitCode($allFanStatus,$statusEnv);
addExitCode($allFanStatus);
} elsif (!$optChkEnvironment and $optChkEnv_Fan) {
addExitCode($allFanStatus);
}
}
# TemperatureSensors
# if chkenv-temp is entered and it is "iRMC Report" than the exitcode
# nust be calculated to get All-Temp-Status !!!
#
# Enter into details only if system ,env or env-temp is selected.
# This is independent on status since the performance values should be fetched everytime.
if ($optChkEnvironment or $optChkEnv_Temp) {
$setExitCode = 0;
if (!defined $allTempStatus) { #
$setExitCode = 1 if ($optChkEnv_Temp and !$optChkEnvironment);
$setExitCode = 1 if ($noSummaryStatus);
}
getAllTemperatureSensors($setExitCode);
if (defined $allTempStatus and $setExitCode and $noSummaryStatus) {
$statusEnv = 3 if (!defined $statusEnv);
$statusEnv = addTmpExitCode($allTempStatus,$statusEnv);
addExitCode($allTempStatus);
} elsif (!$optChkEnvironment and $optChkEnv_Temp) {
addExitCode($allTempStatus);
}
}
if ($optChkEnvironment and $noSummaryStatus and defined $statusEnv) {
addComponentStatus("m", "Environment",$state[$statusEnv]);
}
} # getEnvironment
sub getPower {
return if (!$optChkPower);
return if (!defined $statusPower and !$noSummaryStatus);
# PowerSupplies
# if chkmemmod is entered and it is "iRMC Report" than the exitcode
# nust be calculated to get All-PSU-Status !!!
#
# Enter into details only if the status of All-PSU is not-ok !
{
my $getInfos = 0;
my $setExitCode = 0;
$getInfos = 1 if (!defined $statusPower
or $statusPower==1 or $statusPower==2);
$getInfos = 1 if ($main::verbose >= 2);
$setExitCode = 1 if (!defined $statusPower); #
getAllPowerSupplies($setExitCode) if ($getInfos);
if (defined $statusPower and $setExitCode and $noSummaryStatus) {
addExitCode($statusPower);
}
}
# PowerConsumption
# always
{
my $setExitCode = 0;
$setExitCode = 1 if (!defined $statusPower); #
getAllPowerConsumption($setExitCode);
}
if ($optChkPower and $noSummaryStatus and defined $statusPower) {
addComponentStatus("m", "PowerSupplies",$state[$statusPower]);
}
# Other Power Adapters
getOtherPowerAdapter();
} # getPower
sub getSystemBoard {
return if (!defined $statusSystemBoard and !$noSummaryStatus);
# CPU
# if chkcpu is entered and it is "iRMC Report" than the exitcode
# nust be calculated to get All-CPU-Status !!!
#
# Enter into details only if the status of All-CPU is not-ok !
if ($optChkSystem or $optChkHardware or $optChkCPU) {
my $getInfos = 0;
my $setExitCode = 0;
if (!defined $allCPUStatus) { #
$setExitCode = 1 if ($optChkCPU and !$optChkHardware and !$optChkSystem);
$setExitCode = 1 if ($noSummaryStatus);
$getInfos = 1 if ($optChkCPU and !$optChkHardware and !$optChkSystem);
$getInfos = 1 if (!defined $statusSystemBoard or $statusSystemBoard==1 or $statusSystemBoard==2);
}
$getInfos = 1 if (defined $allCPUStatus and ($allCPUStatus==1 or $allCPUStatus==2));
$getInfos = 1 if ($main::verbose >= 2);
getAllCPU($setExitCode) if ($getInfos);
if (defined $allCPUStatus and $setExitCode and $noSummaryStatus) {
$statusSystemBoard = 3 if (!defined $statusSystemBoard);
$statusSystemBoard = addTmpExitCode($allCPUStatus,$statusSystemBoard);
addExitCode($allCPUStatus);
} elsif (!$optChkHardware and !$optChkSystem and $optChkCPU) {
addExitCode($allCPUStatus);
}
}
# Voltage
# if chkvoltage is entered and it is "iRMC Report" than the exitcode
# nust be calculated to get All-Volt-Status !!!
#
# Enter into details only if the status of All-Votl is not-ok !
if ($optChkSystem or $optChkHardware or $optChkVoltage) {
my $getInfos = 0;
my $setExitCode = 0;
if (!defined $allVoltageStatus) { # older ESXi, iRMC S4
$setExitCode = 1 if ($optChkVoltage and !$optChkHardware and !$optChkSystem);
$setExitCode = 1 if ($noSummaryStatus);
$getInfos = 1 if ($optChkVoltage and !$optChkHardware and !$optChkSystem);
$getInfos = 1 if (!defined $statusSystemBoard or $statusSystemBoard==1 or $statusSystemBoard==2);
}
$getInfos = 1 if (defined $allVoltageStatus and ($allVoltageStatus==1 or $allVoltageStatus==2));
$getInfos = 1 if ($main::verbose >= 2);
getAllVoltages($setExitCode) if ($getInfos);
if (defined $allVoltageStatus and $setExitCode and $noSummaryStatus) {
$statusSystemBoard = 3 if (!defined $statusSystemBoard);
$statusSystemBoard = addTmpExitCode($allVoltageStatus,$statusSystemBoard);
addExitCode($allVoltageStatus);
} elsif (!$optChkHardware and !$optChkSystem and $optChkVoltage) {
addExitCode($allVoltageStatus);
}
}
# MemoryModules
# if chkmemmod is entered and it is "old" ESXi provider than the exitcode
# nust be calculated to get All-Mem-Status !!!
#
# Enter into details only if the status of All-MemMod is not-ok !
if ($optChkSystem or $optChkHardware or $optChkMemMod) {
my $getInfos = 0;
my $setExitCode = 0;
if (!defined $allMemoryStatus) { # older ESXi, iRMC S4
$setExitCode = 1 if ($optChkMemMod and !$optChkHardware and !$optChkSystem);
$setExitCode = 1 if ($noSummaryStatus);
$getInfos = 1 if ($optChkMemMod and !$optChkHardware and !$optChkSystem);
$getInfos = 1 if (!defined $statusSystemBoard or $statusSystemBoard==1 or $statusSystemBoard==2);
}
$getInfos = 1 if (defined $allMemoryStatus and ($allMemoryStatus==1 or $allMemoryStatus==2));
$getInfos = 1 if ($main::verbose >= 2);
getAllMemoryModules($setExitCode) if ($getInfos);
if (defined $allMemoryStatus and $setExitCode and $noSummaryStatus) {
$statusSystemBoard = 3 if (!defined $statusSystemBoard);
$statusSystemBoard = addTmpExitCode($allMemoryStatus,$statusSystemBoard);
addExitCode($allMemoryStatus);
} elsif (!$optChkHardware and !$optChkSystem and $optChkMemMod) {
addExitCode($allMemoryStatus);
}
}
# Other SystemBoard Adapters ?
getOtherSystemBoardAdapter() if ($optChkSystem or $optChkHardware);
if ($optChkSystem and $noSummaryStatus and defined $statusSystemBoard) {
addComponentStatus("m", "SystemBoard",$state[$statusSystemBoard]);
}
} # getSystemBoard
sub getStorage {
return if (!defined $statusMassStorage and !$noSummaryStatus);
return if (!$optChkStorage);
# Mass Storage Adapters ... RAID ?
{
my $getInfos = 0;
my $setExitCode = 0;
$getInfos = 1 if (!defined $statusMassStorage
or $statusMassStorage==1 or $statusMassStorage==2);
$getInfos = 1 if ($main::verbose >= 2);
$setExitCode = 1 if (!defined $statusMassStorage);
getAllStorageAdapter($setExitCode) if ($getInfos);
if (defined $statusMassStorage and $setExitCode and $noSummaryStatus) {
addExitCode($statusMassStorage);
}
}
# Other Adapters
getOtherStorageAdapter();
#
if ($optChkStorage and $noSummaryStatus and defined $statusMassStorage) {
if ($optServiceType and $optServiceType =~ m/^R/i
and !defined $raidCtrl and !defined $raidLDrive and !defined $raidPDevice)
{
addComponentStatus("m", "MassStorage","MISSING"); # older FW
} else {
addComponentStatus("m", "MassStorage",$state[$statusMassStorage]);
}
}
} # getStorage
sub getDrvMonitor {
return if (!defined $statusDrvMonitor and !$noSummaryStatus);
return if (!$optChkDrvMonitor);
getAllDrvMonAdapter();
} # getDrvMonitor
sub getUpdateStatus {
return agentUpdateStatus()
if ($optServiceType and $optServiceType =~ m/^A/i);
} # getUpdateStatus
####
sub connectionTest {
my $checknext = 1;
$exitCode = 3;
iRMCReportConnectionTest() if (!$optServiceType or $optServiceType =~ m/^R/i);
$checknext = 0 if ($exitCode == 1); # too old iRMC FW
$exitCode = 2 if ($exitCode == 1);
if ($checknext) {
$exitCode = 3 if ($exitCode != 0);
iRMCRestConnectionTest() if (!$optServiceType or $optServiceType =~ m/^irest/i
or ($optServiceType =~ m/report/i and $optChkIdentify and $main::verboseTable==100));
$checknext = 0 if ($exitCode == 1); # iRMC FW REST
}
if ($checknext) {
$exitCode = 3 if ($exitCode != 0);
iRMCRedfishConnectionTest() if (!$optServiceType or $optServiceType =~ m/^ired/i
or ($optServiceType =~ m/report/i and $optChkIdentify and $main::verboseTable==100));
$checknext = 0 if ($exitCode == 1); # iRMC FW REDFISH
}
if ($checknext) {
$exitCode = 3 if ($exitCode != 0);
# check of 3172 after iRMC because of bad Remote Manager on 3172
agentConnectionTest() if (!$optServiceType or $optServiceType =~ m/^A/i);
}
# reset longMessage if an additional REST type is added ....
if (!$optServiceType) {
addMessage("m","- ") if (!$msg);
addMessage("m","[ERROR] Unable to detect REST Service");
addExitCode(2);
} else {
$longMessage = undef;
}
} # connectionTest
sub getSerialID {
$serverID = agentSerialID() if (!$optServiceType or $optServiceType =~ m/^A/i);
$serverID = iRMCReportSerialID() if (!$optServiceType or $optServiceType =~ m/^R/i);
if ($serverID and ($optChkSystem or $optChkHardware)) {
addMessage("m", "-"); # separator
addSerialIDs("m", $serverID, undef);
addMessage("m", " -"); # separator
addExitCode(0);
}
addSerialIDs("n", $serverID, undef);
} # getSerialID
sub getOverallStatusValues {
return agentOverallStatusValues() if ($optServiceType and $optServiceType =~ m/^A/i);
return iRMCReportOverallStatusValues() if ($optServiceType and $optServiceType =~ m/^R/i);
} # getOverallStatusValues
sub getComponentInformation {
getEnvironment() if ($optChkEnvironment or $optChkEnv_Fan or $optChkEnv_Temp);
getPower() if ($optChkPower);
getSystemBoard() if ($optChkSystem or $optChkHardware or $optChkCPU or $optChkVoltage or $optChkMemMod);
getDrvMonitor() if ($optChkDrvMonitor);
getStorage() if ($optChkStorage);
getUpdateStatus() if ($optChkUpdate);
} # getComponentInformation
sub getPerformanceInformation {
return agentPerformanceInformation() if ($optServiceType and $optServiceType =~ m/^A/i);
} # getPerformanceInformation
sub getSystemInventoryInfo {
agentSystemInventoryInfo() if ($optServiceType and $optServiceType =~ m/^A/i);
iRMCReportSystemInventoryInfo() if ($optServiceType and $optServiceType =~ m/^R/i);
} # getSystemInventoryInfo
sub getSystemNotifyInformation {
agentSystemNotifyInformation() if (!$optServiceType or $optServiceType =~ m/^A/i);
iRMCReportSystemNotifyInformation() if (!$optServiceType or $optServiceType =~ m/^R/i);
} # getSystemNotifyInformation
sub getAllCheckData {
$useRESTverbose = 1;
getSerialID(); # always
return if ($exitCode == 2);
$useRESTverbose = 0; # optimization
$exitCode = 3;
my $onlyPerformance = 0;
$onlyPerformance = 1 if ($optChkCpuLoadPerformance or $optChkMemoryPerformance
or $optChkFileSystemPerformance or $optChkNetworkPerformance);
getSystemInventoryInfo() if (($main::verbose == 3 and $optChkSystem)
or ($main::verbose == 3 and $optSystemInfo)
or $main::verboseTable==200
or $optAgentInfo);
getOverallStatusValues() if (!$optSystemInfo and !$optAgentInfo and !$onlyPerformance);
if ($optChkSystem and $exitCode and $exitCode != 3
and !$allVoltageStatus
and !$allCPUStatus
and !$allMemoryStatus)
{
$longMessage .= "- Hint: Please check the status on the system itself or via administrative url - \n";
}
getComponentInformation() if (!$optSystemInfo and !$optAgentInfo and !$onlyPerformance);
getPerformanceInformation() if ($onlyPerformance);
getSystemNotifyInformation() if (!$optAgentInfo
and ($optSystemInfo or $exitCode > 0 or $main::verbose));
$main::verbose = 1 if ($optSystemInfo and !$main::verbose);
$notifyMessage = undef if ($optAgentInfo);
$exitCode = 0 if ($optAgentInfo and $longMessage and $longMessage =~ m/AgentInfo/);
} # getAllCheckData
#########################################################################
sub processData {
$exitCode = 3;
if ($optRestAction) {
restCall($optRestAction, $optRestUrlPath, $optRestData);
return;
}
connectionTest(); # includes --chkidentify
return if ($exitCode != 0);
if (!$optTimeout and $optServiceType and $optServiceType =~ m/R/) {
alarm(300);
} elsif (!$optTimeout and $optServiceType and $optServiceType =~ m/A/) {
alarm(300);
}
getAllCheckData() if (!$optChkIdentify);
} # processData
#### MAIN ################################################################
# store script path
my $path = $0;
handleOptions();
$exitCode = 3;
$main::scriptPath = $path;
$main::scriptPath =~ s/[^\/]+$//;
#print "... scriptPath = $main::scriptPath\n";
#### set timeout
local $SIG{ALRM} = sub {
print 'UNKNOWN: Timeout' . "\n";
if (defined $pRestHandle) { # this might need some time :-( !
close $pRestHandle;
undef $pRestHandle;
}
exit(3);
};
#local $SIG{PIPE} = "IGNORE";
alarm($optTimeout);
##### DO SOMETHING
$exitCode = 3;
$|++; # for unbuffered stdout print (due to Perl documentation)
processData();
####
# output to nagios
#$|++; # for unbuffered stdout print (due to Perl documentation)
if ($msg) {
$msg =~ s/^\s*//gm; # remove leading blanks
$msg =~ s/^\-\s*/- /gm; # remove leading blanks
}
if ($notifyMessage) {
$notifyMessage =~ s/^\s*//gm; # remove leading blanks
$notifyMessage =~ s/\s*$//m; # remove last blanks
$notifyMessage =~ s/\n$//m; # remove last break
}
$notifyMessage = undef if ($main::verbose < 1 and ($exitCode==0));
if ($longMessage) {
$longMessage =~ s/^\s*//m; # remove leading blanks
$longMessage =~ s/\s*$//m; # remove last blanks
$longMessage =~ s/\n$//m; # remove last break
}
if ($variableVerboseMessage) {
$variableVerboseMessage =~ s/^\s*//m; # remove leading blanks
$variableVerboseMessage =~ s/\n$//m; # remove last break
}
$variableVerboseMessage = undef if ($main::verbose < 2 and !$main::verboseTable);
$longMessage = undef if ($longMessage and $longMessage eq '');
my $stateString = '';
$stateString = $state[$exitCode] if ($state[$exitCode]);
finalize(
$exitCode,
$stateString,
$msg,
(! $notifyMessage ? '': "\n" . $notifyMessage),
(! $longMessage ? '' : "\n" . $longMessage),
($variableVerboseMessage ? "\n" . $variableVerboseMessage : ""),
($performanceData ? "\n |" . $performanceData : ""),
);
################ EOSCRIPT
| EXASOL/nagios-monitoring | opt/fujitsu/ServerViewSuite/nagios/plugin/check_fujitsu_server_REST.pl | Perl | mit | 272,133 |
%% ---
%% Excerpted from "Seven Languages in Seven Weeks",
%% published by The Pragmatic Bookshelf.
%% Copyrights apply to this code. It may not be used to create training material,
%% courses, books, articles, and the like. Contact us if you are in doubt.
%% We make no guarantees that this code is fit for any purpose.
%% Visit http://www.pragmaticprogrammer.com/titles/btlang for more book information.
%%---
valid_queen((Row, Col)) :- member(Col, [1,2,3,4,5,6,7,8]).
valid_board([]).
valid_board([Head|Tail]) :- valid_queen(Head), valid_board(Tail).
cols([], []).
cols([(_, Col)|QueensTail], [Col|ColsTail]) :-
cols(QueensTail, ColsTail).
diags1([], []).
diags1([(Row, Col)|QueensTail], [Diagonal|DiagonalsTail]) :-
Diagonal is Col - Row,
diags1(QueensTail, DiagonalsTail).
diags2([], []).
diags2([(Row, Col)|QueensTail], [Diagonal|DiagonalsTail]) :-
Diagonal is Col + Row,
diags2(QueensTail, DiagonalsTail).
eight_queens(Board) :-
Board = [(1, _), (2, _), (3, _), (4, _), (5, _), (6, _), (7, _), (8, _)],
valid_board(Board),
cols(Board, Cols),
diags1(Board, Diags1),
diags2(Board, Diags2),
fd_all_different(Cols),
fd_all_different(Diags1),
fd_all_different(Diags2). | nmcl/scratch | prolog/optimized_queens.pl | Perl | apache-2.0 | 1,235 |
#
# Copyright 2017 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package centreon::common::powershell::hyperv::2012::scvmmvmstatus;
use strict;
use warnings;
use centreon::plugins::misc;
sub get_powershell {
my (%options) = @_;
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = '
$culture = new-object "System.Globalization.CultureInfo" "en-us"
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
$ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
Import-Module -Name "virtualmachinemanager"
$username = "' . $options{scvmm_username} . '"
$password = ConvertTo-SecureString "' . $options{scvmm_password} . '" -AsPlainText -Force
$UserCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password
$connection = Get-VMMServer -ComputerName "' . $options{scvmm_hostname} . '" -TCPPort ' . $options{scvmm_port} . ' -Credential $UserCredential
$vms = Get-SCVirtualMachine -VMMServer $connection
Foreach ($vm in $vms) {
$desc = $vm.description -replace "\r",""
$desc = $desc -replace "\n"," - "
Write-Host "[name=" $vm.Name "][description=" $desc "][status=" $vm.Status "][cloud=" $vm.Cloud "][hostgrouppath=" $vm.HostGroupPath "]"
}
} Catch {
Write-Host $Error[0].Exception
exit 1
}
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
}
1;
__END__
=head1 DESCRIPTION
Method to get hyper-v informations.
=cut | maksimatveev/centreon-plugins | centreon/common/powershell/hyperv/2012/scvmmvmstatus.pm | Perl | apache-2.0 | 2,252 |
#
# Copyright 2017 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::xtremio::restapi::mode::xenvscpu;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.1';
$options{options}->add_options(arguments =>
{
"filter:s@" => { name => 'filter' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
$self->{filter} = [];
foreach my $val (@{$self->{option_results}->{filter}}) {
next if (!defined($val) || $val eq '');
my @values = split (/,/, $val);
push @{$self->{filter}}, { filter => $values[0], instance => $values[1] };
}
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) = @_;
my $xtremio = $options{custom};
my $urlbase = '/api/json/types/';
my @items = $xtremio->get_items(url => $urlbase,
obj => 'xenvs');
$self->{output}->output_add(severity => 'OK',
short_msg => 'All Xenvs CPU Usage are OK');
foreach my $item (@items) {
next if ($self->check_filter(section => 'cpu', instance => $item));
my $details = $xtremio->get_details(url => $urlbase,
obj => 'xenvs',
name => $item);
$self->{output}->output_add(long_msg => sprintf("Xenvs '%s' CPU Usage is %i%%",
$item,
$details->{'cpu-usage'}));
my $exit = $self->{perfdata}->threshold_check(value => $details->{'cpu-usage'}, threshold => [ { label => 'warning', 'exit_litteral' => 'warning' }, { label => 'critical', exit_litteral => 'critical' } ]);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Xenvs '%s' cpu-Usage is %i%%",
$item,
$details->{'cpu-usage'}));
}
$self->{output}->perfdata_add(label => 'cpu_' . $item, unit => '%',
value => $details->{'cpu-usage'},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0, max => 100);
}
$self->{output}->display();
$self->{output}->exit();
}
sub check_filter {
my ($self, %options) = @_;
foreach (@{$self->{filter}}) {
if ($options{section} =~ /$_->{filter}/) {
if (!defined($options{instance}) && !defined($_->{instance})) {
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section."));
return 1;
} elsif (defined($options{instance}) && $options{instance} =~ /$_->{instance}/) {
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance."));
return 1;
}
}
}
return 0;
}
1;
__END__
=head1 MODE
Check Xenvs CPU usage
=over 8
=item B<--filter>
Filter some parts (comma seperated list)
Can also exclude specific instance: --filter=cpu,XENVS-NAME-NUMBER
=item B<--warning>
Value to trigger a warning alarm on CPU usage
=item B<--critical>
Value to trigger a critical alarm on CPU usage
=back
=cut
| Shini31/centreon-plugins | storage/emc/xtremio/restapi/mode/xenvscpu.pm | Perl | apache-2.0 | 5,392 |
% Frame number: 8
happens( walking( id0 ), 320 ). holdsAt( coord( id0 )=( 10, 72 ), 320 ).
% Frame number: 9
happens( walking( id0 ), 360 ). holdsAt( coord( id0 )=( 10, 72 ), 360 ).
% Frame number: 10
happens( walking( id0 ), 400 ). holdsAt( coord( id0 )=( 10, 72 ), 400 ).
% Frame number: 11
happens( walking( id0 ), 440 ). holdsAt( coord( id0 )=( 10, 72 ), 440 ).
% Frame number: 12
happens( walking( id0 ), 480 ). holdsAt( coord( id0 )=( 10, 71 ), 480 ).
% Frame number: 13
happens( walking( id0 ), 520 ). holdsAt( coord( id0 )=( 10, 71 ), 520 ).
% Frame number: 14
happens( walking( id0 ), 560 ). holdsAt( coord( id0 )=( 10, 70 ), 560 ).
% Frame number: 15
happens( walking( id0 ), 600 ). holdsAt( coord( id0 )=( 10, 70 ), 600 ).
% Frame number: 16
happens( walking( id0 ), 640 ). holdsAt( coord( id0 )=( 11, 70 ), 640 ).
% Frame number: 17
happens( walking( id0 ), 680 ). holdsAt( coord( id0 )=( 12, 69 ), 680 ).
% Frame number: 18
happens( walking( id0 ), 720 ). holdsAt( coord( id0 )=( 12, 69 ), 720 ).
% Frame number: 19
happens( walking( id0 ), 760 ). holdsAt( coord( id0 )=( 12, 69 ), 760 ).
% Frame number: 20
happens( walking( id0 ), 800 ). holdsAt( coord( id0 )=( 12, 69 ), 800 ).
% Frame number: 21
happens( walking( id0 ), 840 ). holdsAt( coord( id0 )=( 13, 68 ), 840 ).
% Frame number: 22
happens( walking( id0 ), 880 ). holdsAt( coord( id0 )=( 13, 67 ), 880 ).
% Frame number: 23
happens( walking( id0 ), 920 ). holdsAt( coord( id0 )=( 13, 66 ), 920 ).
% Frame number: 24
happens( walking( id0 ), 960 ). holdsAt( coord( id0 )=( 13, 66 ), 960 ).
% Frame number: 25
happens( walking( id0 ), 1000 ). holdsAt( coord( id0 )=( 13, 66 ), 1000 ).
% Frame number: 26
happens( walking( id0 ), 1040 ). holdsAt( coord( id0 )=( 13, 66 ), 1040 ).
% Frame number: 27
happens( walking( id0 ), 1080 ). holdsAt( coord( id0 )=( 13, 65 ), 1080 ).
% Frame number: 28
happens( walking( id0 ), 1120 ). holdsAt( coord( id0 )=( 13, 64 ), 1120 ).
% Frame number: 29
happens( walking( id0 ), 1160 ). holdsAt( coord( id0 )=( 13, 63 ), 1160 ).
% Frame number: 30
happens( walking( id0 ), 1200 ). holdsAt( coord( id0 )=( 13, 62 ), 1200 ).
% Frame number: 31
happens( walking( id0 ), 1240 ). holdsAt( coord( id0 )=( 14, 61 ), 1240 ).
% Frame number: 32
happens( walking( id0 ), 1280 ). holdsAt( coord( id0 )=( 14, 61 ), 1280 ).
% Frame number: 33
happens( walking( id0 ), 1320 ). holdsAt( coord( id0 )=( 14, 61 ), 1320 ).
% Frame number: 34
happens( walking( id0 ), 1360 ). holdsAt( coord( id0 )=( 15, 61 ), 1360 ).
% Frame number: 35
happens( walking( id0 ), 1400 ). holdsAt( coord( id0 )=( 15, 60 ), 1400 ).
% Frame number: 36
happens( walking( id0 ), 1440 ). holdsAt( coord( id0 )=( 15, 60 ), 1440 ).
% Frame number: 37
happens( walking( id0 ), 1480 ). holdsAt( coord( id0 )=( 15, 60 ), 1480 ).
% Frame number: 38
happens( walking( id0 ), 1520 ). holdsAt( coord( id0 )=( 16, 60 ), 1520 ).
% Frame number: 39
happens( walking( id0 ), 1560 ). holdsAt( coord( id0 )=( 16, 59 ), 1560 ).
% Frame number: 40
happens( walking( id0 ), 1600 ). holdsAt( coord( id0 )=( 16, 59 ), 1600 ).
% Frame number: 41
happens( walking( id0 ), 1640 ). holdsAt( coord( id0 )=( 16, 59 ), 1640 ).
% Frame number: 42
happens( walking( id0 ), 1680 ). holdsAt( coord( id0 )=( 17, 59 ), 1680 ).
% Frame number: 43
happens( walking( id0 ), 1720 ). holdsAt( coord( id0 )=( 17, 58 ), 1720 ).
% Frame number: 44
happens( walking( id0 ), 1760 ). holdsAt( coord( id0 )=( 18, 58 ), 1760 ).
% Frame number: 45
happens( walking( id0 ), 1800 ). holdsAt( coord( id0 )=( 18, 57 ), 1800 ).
% Frame number: 46
happens( walking( id0 ), 1840 ). holdsAt( coord( id0 )=( 18, 57 ), 1840 ).
% Frame number: 47
happens( walking( id0 ), 1880 ). holdsAt( coord( id0 )=( 19, 56 ), 1880 ).
% Frame number: 48
happens( walking( id0 ), 1920 ). holdsAt( coord( id0 )=( 19, 56 ), 1920 ).
% Frame number: 49
happens( walking( id0 ), 1960 ). holdsAt( coord( id0 )=( 19, 56 ), 1960 ).
% Frame number: 50
happens( walking( id0 ), 2000 ). holdsAt( coord( id0 )=( 19, 55 ), 2000 ).
% Frame number: 51
happens( walking( id0 ), 2040 ). holdsAt( coord( id0 )=( 19, 55 ), 2040 ).
% Frame number: 52
happens( walking( id0 ), 2080 ). holdsAt( coord( id0 )=( 20, 55 ), 2080 ).
% Frame number: 53
happens( walking( id0 ), 2120 ). holdsAt( coord( id0 )=( 20, 55 ), 2120 ).
% Frame number: 54
happens( walking( id0 ), 2160 ). holdsAt( coord( id0 )=( 20, 54 ), 2160 ).
% Frame number: 55
happens( walking( id0 ), 2200 ). holdsAt( coord( id0 )=( 20, 54 ), 2200 ).
% Frame number: 56
happens( walking( id0 ), 2240 ). holdsAt( coord( id0 )=( 20, 54 ), 2240 ).
% Frame number: 57
happens( walking( id0 ), 2280 ). holdsAt( coord( id0 )=( 20, 53 ), 2280 ).
% Frame number: 58
happens( walking( id0 ), 2320 ). holdsAt( coord( id0 )=( 20, 53 ), 2320 ).
% Frame number: 59
happens( walking( id0 ), 2360 ). holdsAt( coord( id0 )=( 20, 53 ), 2360 ).
% Frame number: 60
happens( walking( id0 ), 2400 ). holdsAt( coord( id0 )=( 20, 53 ), 2400 ).
% Frame number: 61
happens( walking( id0 ), 2440 ). holdsAt( coord( id0 )=( 21, 52 ), 2440 ).
% Frame number: 62
happens( walking( id0 ), 2480 ). holdsAt( coord( id0 )=( 21, 51 ), 2480 ).
% Frame number: 63
happens( walking( id0 ), 2520 ). holdsAt( coord( id0 )=( 22, 50 ), 2520 ).
% Frame number: 64
happens( walking( id0 ), 2560 ). holdsAt( coord( id0 )=( 22, 49 ), 2560 ).
% Frame number: 65
happens( walking( id0 ), 2600 ). holdsAt( coord( id0 )=( 22, 49 ), 2600 ).
% Frame number: 66
happens( walking( id0 ), 2640 ). holdsAt( coord( id0 )=( 22, 49 ), 2640 ).
% Frame number: 67
happens( walking( id0 ), 2680 ). holdsAt( coord( id0 )=( 22, 49 ), 2680 ).
% Frame number: 68
happens( walking( id0 ), 2720 ). holdsAt( coord( id0 )=( 23, 48 ), 2720 ).
% Frame number: 69
happens( walking( id0 ), 2760 ). holdsAt( coord( id0 )=( 23, 48 ), 2760 ).
% Frame number: 70
happens( walking( id0 ), 2800 ). holdsAt( coord( id0 )=( 23, 48 ), 2800 ).
% Frame number: 71
happens( walking( id0 ), 2840 ). holdsAt( coord( id0 )=( 23, 47 ), 2840 ).
% Frame number: 72
happens( walking( id0 ), 2880 ). holdsAt( coord( id0 )=( 24, 47 ), 2880 ).
% Frame number: 73
happens( walking( id0 ), 2920 ). holdsAt( coord( id0 )=( 24, 47 ), 2920 ).
% Frame number: 74
happens( walking( id0 ), 2960 ). holdsAt( coord( id0 )=( 24, 46 ), 2960 ).
% Frame number: 75
happens( walking( id0 ), 3000 ). holdsAt( coord( id0 )=( 25, 45 ), 3000 ).
% Frame number: 76
happens( walking( id0 ), 3040 ). holdsAt( coord( id0 )=( 25, 45 ), 3040 ).
% Frame number: 77
happens( walking( id0 ), 3080 ). holdsAt( coord( id0 )=( 26, 44 ), 3080 ).
% Frame number: 78
happens( walking( id0 ), 3120 ). holdsAt( coord( id0 )=( 26, 43 ), 3120 ).
% Frame number: 79
happens( walking( id0 ), 3160 ). holdsAt( coord( id0 )=( 26, 43 ), 3160 ).
% Frame number: 80
happens( walking( id0 ), 3200 ). holdsAt( coord( id0 )=( 26, 43 ), 3200 ).
% Frame number: 81
happens( walking( id0 ), 3240 ). holdsAt( coord( id0 )=( 26, 42 ), 3240 ).
% Frame number: 82
happens( walking( id0 ), 3280 ). holdsAt( coord( id0 )=( 26, 42 ), 3280 ).
% Frame number: 83
happens( walking( id0 ), 3320 ). holdsAt( coord( id0 )=( 27, 42 ), 3320 ).
% Frame number: 84
happens( walking( id0 ), 3360 ). holdsAt( coord( id0 )=( 27, 42 ), 3360 ).
% Frame number: 85
happens( walking( id0 ), 3400 ). holdsAt( coord( id0 )=( 27, 41 ), 3400 ).
% Frame number: 86
happens( walking( id0 ), 3440 ). holdsAt( coord( id0 )=( 27, 40 ), 3440 ).
% Frame number: 87
happens( walking( id0 ), 3480 ). holdsAt( coord( id0 )=( 28, 39 ), 3480 ).
% Frame number: 88
happens( walking( id0 ), 3520 ). holdsAt( coord( id0 )=( 28, 39 ), 3520 ).
% Frame number: 89
happens( walking( id0 ), 3560 ). holdsAt( coord( id0 )=( 28, 38 ), 3560 ).
% Frame number: 90
happens( walking( id0 ), 3600 ). holdsAt( coord( id0 )=( 29, 38 ), 3600 ).
% Frame number: 91
happens( walking( id0 ), 3640 ). holdsAt( coord( id0 )=( 29, 38 ), 3640 ).
% Frame number: 92
happens( walking( id0 ), 3680 ). holdsAt( coord( id0 )=( 29, 38 ), 3680 ).
% Frame number: 93
happens( walking( id0 ), 3720 ). holdsAt( coord( id0 )=( 30, 37 ), 3720 ).
% Frame number: 94
happens( walking( id0 ), 3760 ). holdsAt( coord( id0 )=( 31, 37 ), 3760 ).
% Frame number: 95
happens( walking( id0 ), 3800 ). holdsAt( coord( id0 )=( 31, 36 ), 3800 ).
% Frame number: 96
happens( walking( id0 ), 3840 ). holdsAt( coord( id0 )=( 31, 36 ), 3840 ).
% Frame number: 97
happens( walking( id0 ), 3880 ). holdsAt( coord( id0 )=( 32, 36 ), 3880 ).
% Frame number: 98
happens( walking( id0 ), 3920 ). holdsAt( coord( id0 )=( 32, 36 ), 3920 ).
% Frame number: 99
happens( walking( id0 ), 3960 ). holdsAt( coord( id0 )=( 32, 35 ), 3960 ).
% Frame number: 100
happens( walking( id0 ), 4000 ). holdsAt( coord( id0 )=( 32, 34 ), 4000 ).
% Frame number: 101
happens( walking( id0 ), 4040 ). holdsAt( coord( id0 )=( 32, 34 ), 4040 ).
% Frame number: 102
happens( walking( id0 ), 4080 ). holdsAt( coord( id0 )=( 33, 33 ), 4080 ).
% Frame number: 103
happens( walking( id0 ), 4120 ). holdsAt( coord( id0 )=( 33, 33 ), 4120 ).
% Frame number: 104
happens( walking( id0 ), 4160 ). holdsAt( coord( id0 )=( 34, 32 ), 4160 ).
% Frame number: 105
happens( walking( id0 ), 4200 ). holdsAt( coord( id0 )=( 34, 32 ), 4200 ).
% Frame number: 106
happens( walking( id0 ), 4240 ). holdsAt( coord( id0 )=( 34, 31 ), 4240 ).
% Frame number: 107
happens( walking( id0 ), 4280 ). holdsAt( coord( id0 )=( 35, 31 ), 4280 ).
% Frame number: 108
happens( walking( id0 ), 4320 ). holdsAt( coord( id0 )=( 35, 31 ), 4320 ).
% Frame number: 109
happens( walking( id0 ), 4360 ). holdsAt( coord( id0 )=( 36, 31 ), 4360 ).
% Frame number: 110
happens( walking( id0 ), 4400 ). holdsAt( coord( id0 )=( 36, 30 ), 4400 ).
% Frame number: 111
happens( walking( id0 ), 4440 ). holdsAt( coord( id0 )=( 37, 30 ), 4440 ).
% Frame number: 112
happens( walking( id0 ), 4480 ). holdsAt( coord( id0 )=( 37, 30 ), 4480 ).
% Frame number: 113
happens( walking( id0 ), 4520 ). holdsAt( coord( id0 )=( 37, 28 ), 4520 ).
% Frame number: 114
happens( walking( id0 ), 4560 ). holdsAt( coord( id0 )=( 37, 28 ), 4560 ).
% Frame number: 115
happens( walking( id0 ), 4600 ). holdsAt( coord( id0 )=( 38, 28 ), 4600 ).
% Frame number: 116
happens( walking( id0 ), 4640 ). holdsAt( coord( id0 )=( 38, 26 ), 4640 ).
% Frame number: 117
happens( walking( id0 ), 4680 ). holdsAt( coord( id0 )=( 38, 26 ), 4680 ).
% Frame number: 118
happens( walking( id0 ), 4720 ). holdsAt( coord( id0 )=( 39, 25 ), 4720 ).
% Frame number: 119
happens( walking( id0 ), 4760 ). holdsAt( coord( id0 )=( 41, 25 ), 4760 ).
% Frame number: 120
happens( walking( id0 ), 4800 ). holdsAt( coord( id0 )=( 42, 24 ), 4800 ).
% Frame number: 121
happens( walking( id0 ), 4840 ). holdsAt( coord( id0 )=( 42, 24 ), 4840 ).
% Frame number: 122
happens( walking( id0 ), 4880 ). holdsAt( coord( id0 )=( 42, 23 ), 4880 ).
% Frame number: 123
happens( walking( id0 ), 4920 ). holdsAt( coord( id0 )=( 43, 22 ), 4920 ).
% Frame number: 124
happens( walking( id0 ), 4960 ). holdsAt( coord( id0 )=( 43, 21 ), 4960 ).
% Frame number: 125
happens( walking( id0 ), 5000 ). holdsAt( coord( id0 )=( 43, 21 ), 5000 ).
% Frame number: 126
happens( walking( id0 ), 5040 ). holdsAt( coord( id0 )=( 44, 20 ), 5040 ).
% Frame number: 127
happens( walking( id0 ), 5080 ). holdsAt( coord( id0 )=( 43, 20 ), 5080 ).
% Frame number: 128
happens( walking( id0 ), 5120 ). holdsAt( coord( id0 )=( 44, 20 ), 5120 ).
% Frame number: 129
happens( walking( id0 ), 5160 ). holdsAt( coord( id0 )=( 47, 19 ), 5160 ).
% Frame number: 130
happens( walking( id0 ), 5200 ). holdsAt( coord( id0 )=( 48, 19 ), 5200 ).
% Frame number: 131
happens( walking( id0 ), 5240 ). holdsAt( coord( id0 )=( 50, 18 ), 5240 ).
% Frame number: 132
happens( walking( id0 ), 5280 ). holdsAt( coord( id0 )=( 51, 18 ), 5280 ).
% Frame number: 133
happens( walking( id0 ), 5320 ). holdsAt( coord( id0 )=( 51, 17 ), 5320 ).
% Frame number: 134
happens( walking( id0 ), 5360 ). holdsAt( coord( id0 )=( 52, 17 ), 5360 ).
% Frame number: 135
happens( walking( id0 ), 5400 ). holdsAt( coord( id0 )=( 52, 16 ), 5400 ).
% Frame number: 136
happens( walking( id0 ), 5440 ). holdsAt( coord( id0 )=( 52, 15 ), 5440 ).
% Frame number: 137
happens( walking( id0 ), 5480 ). holdsAt( coord( id0 )=( 52, 15 ), 5480 ).
% Frame number: 138
happens( walking( id0 ), 5520 ). holdsAt( coord( id0 )=( 52, 14 ), 5520 ).
% Frame number: 139
happens( walking( id0 ), 5560 ). holdsAt( coord( id0 )=( 53, 14 ), 5560 ).
% Frame number: 140
happens( walking( id0 ), 5600 ). holdsAt( coord( id0 )=( 53, 13 ), 5600 ).
% Frame number: 141
happens( walking( id0 ), 5640 ). holdsAt( coord( id0 )=( 55, 14 ), 5640 ).
% Frame number: 142
happens( walking( id0 ), 5680 ). holdsAt( coord( id0 )=( 56, 12 ), 5680 ).
% Frame number: 143
happens( walking( id0 ), 5720 ). holdsAt( coord( id0 )=( 58, 12 ), 5720 ).
% Frame number: 144
happens( walking( id0 ), 5760 ). holdsAt( coord( id0 )=( 61, 13 ), 5760 ).
% Frame number: 145
happens( walking( id0 ), 5800 ). holdsAt( coord( id0 )=( 62, 13 ), 5800 ).
% Frame number: 146
happens( walking( id0 ), 5840 ). holdsAt( coord( id0 )=( 64, 11 ), 5840 ).
% Frame number: 147
happens( walking( id0 ), 5880 ). holdsAt( coord( id0 )=( 64, 11 ), 5880 ).
% Frame number: 148
happens( walking( id0 ), 5920 ). holdsAt( coord( id0 )=( 63, 11 ), 5920 ).
% Frame number: 149
happens( walking( id0 ), 5960 ). holdsAt( coord( id0 )=( 64, 11 ), 5960 ).
% Frame number: 150
happens( walking( id0 ), 6000 ). holdsAt( coord( id0 )=( 65, 10 ), 6000 ).
happens( immobile( id1 ), 6000 ). holdsAt( coord( id1 )=( 201, 283 ), 6000 ).
% Frame number: 151
happens( walking( id0 ), 6040 ). holdsAt( coord( id0 )=( 67, 10 ), 6040 ).
happens( immobile( id1 ), 6040 ). holdsAt( coord( id1 )=( 199, 282 ), 6040 ).
% Frame number: 152
happens( walking( id0 ), 6080 ). holdsAt( coord( id0 )=( 68, 9 ), 6080 ).
happens( immobile( id1 ), 6080 ). holdsAt( coord( id1 )=( 196, 282 ), 6080 ).
% Frame number: 153
happens( walking( id0 ), 6120 ). holdsAt( coord( id0 )=( 71, 9 ), 6120 ).
happens( immobile( id1 ), 6120 ). holdsAt( coord( id1 )=( 195, 281 ), 6120 ).
% Frame number: 154
happens( walking( id0 ), 6160 ). holdsAt( coord( id0 )=( 73, 10 ), 6160 ).
happens( immobile( id1 ), 6160 ). holdsAt( coord( id1 )=( 193, 282 ), 6160 ).
% Frame number: 155
happens( walking( id0 ), 6200 ). holdsAt( coord( id0 )=( 77, 9 ), 6200 ).
happens( immobile( id1 ), 6200 ). holdsAt( coord( id1 )=( 191, 279 ), 6200 ).
% Frame number: 156
happens( walking( id0 ), 6240 ). holdsAt( coord( id0 )=( 79, 9 ), 6240 ).
happens( immobile( id1 ), 6240 ). holdsAt( coord( id1 )=( 189, 279 ), 6240 ).
% Frame number: 157
happens( walking( id0 ), 6280 ). holdsAt( coord( id0 )=( 80, 8 ), 6280 ).
happens( immobile( id1 ), 6280 ). holdsAt( coord( id1 )=( 188, 280 ), 6280 ).
% Frame number: 158
happens( walking( id0 ), 6320 ). holdsAt( coord( id0 )=( 80, 7 ), 6320 ).
happens( immobile( id1 ), 6320 ). holdsAt( coord( id1 )=( 186, 280 ), 6320 ).
% Frame number: 159
happens( walking( id0 ), 6360 ). holdsAt( coord( id0 )=( 82, 7 ), 6360 ).
happens( immobile( id1 ), 6360 ). holdsAt( coord( id1 )=( 182, 280 ), 6360 ).
% Frame number: 160
happens( walking( id0 ), 6400 ). holdsAt( coord( id0 )=( 84, 6 ), 6400 ).
happens( immobile( id1 ), 6400 ). holdsAt( coord( id1 )=( 180, 280 ), 6400 ).
% Frame number: 161
happens( walking( id0 ), 6440 ). holdsAt( coord( id0 )=( 85, 5 ), 6440 ).
happens( immobile( id1 ), 6440 ). holdsAt( coord( id1 )=( 177, 280 ), 6440 ).
% Frame number: 162
happens( walking( id0 ), 6480 ). holdsAt( coord( id0 )=( 86, 5 ), 6480 ).
happens( immobile( id1 ), 6480 ). holdsAt( coord( id1 )=( 173, 280 ), 6480 ).
% Frame number: 163
happens( immobile( id1 ), 6520 ). holdsAt( coord( id1 )=( 171, 280 ), 6520 ).
% Frame number: 164
happens( immobile( id1 ), 6560 ). holdsAt( coord( id1 )=( 170, 280 ), 6560 ).
% Frame number: 165
happens( immobile( id1 ), 6600 ). holdsAt( coord( id1 )=( 169, 280 ), 6600 ).
% Frame number: 166
happens( immobile( id1 ), 6640 ). holdsAt( coord( id1 )=( 168, 280 ), 6640 ).
% Frame number: 167
happens( immobile( id1 ), 6680 ). holdsAt( coord( id1 )=( 166, 280 ), 6680 ).
% Frame number: 168
happens( immobile( id1 ), 6720 ). holdsAt( coord( id1 )=( 163, 280 ), 6720 ).
% Frame number: 169
happens( immobile( id1 ), 6760 ). holdsAt( coord( id1 )=( 162, 280 ), 6760 ).
% Frame number: 170
happens( immobile( id1 ), 6800 ). holdsAt( coord( id1 )=( 160, 280 ), 6800 ).
% Frame number: 171
happens( immobile( id1 ), 6840 ). holdsAt( coord( id1 )=( 157, 280 ), 6840 ).
% Frame number: 172
happens( immobile( id1 ), 6880 ). holdsAt( coord( id1 )=( 155, 280 ), 6880 ).
% Frame number: 173
happens( immobile( id1 ), 6920 ). holdsAt( coord( id1 )=( 155, 279 ), 6920 ).
% Frame number: 174
happens( immobile( id1 ), 6960 ). holdsAt( coord( id1 )=( 150, 279 ), 6960 ).
% Frame number: 175
happens( immobile( id1 ), 7000 ). holdsAt( coord( id1 )=( 150, 280 ), 7000 ).
% Frame number: 176
happens( immobile( id1 ), 7040 ). holdsAt( coord( id1 )=( 146, 280 ), 7040 ).
% Frame number: 177
happens( immobile( id1 ), 7080 ). holdsAt( coord( id1 )=( 144, 279 ), 7080 ).
% Frame number: 178
happens( immobile( id1 ), 7120 ). holdsAt( coord( id1 )=( 143, 278 ), 7120 ).
% Frame number: 179
happens( immobile( id1 ), 7160 ). holdsAt( coord( id1 )=( 140, 278 ), 7160 ).
% Frame number: 180
happens( immobile( id1 ), 7200 ). holdsAt( coord( id1 )=( 139, 278 ), 7200 ).
% Frame number: 181
happens( immobile( id1 ), 7240 ). holdsAt( coord( id1 )=( 138, 278 ), 7240 ).
% Frame number: 182
happens( immobile( id1 ), 7280 ). holdsAt( coord( id1 )=( 137, 278 ), 7280 ).
happens( browsing( id2 ), 7280 ). holdsAt( coord( id2 )=( 29, 163 ), 7280 ).
% Frame number: 183
happens( immobile( id1 ), 7320 ). holdsAt( coord( id1 )=( 136, 278 ), 7320 ).
happens( browsing( id2 ), 7320 ). holdsAt( coord( id2 )=( 29, 163 ), 7320 ).
% Frame number: 184
happens( immobile( id1 ), 7360 ). holdsAt( coord( id1 )=( 136, 278 ), 7360 ).
happens( browsing( id2 ), 7360 ). holdsAt( coord( id2 )=( 29, 163 ), 7360 ).
% Frame number: 185
happens( immobile( id1 ), 7400 ). holdsAt( coord( id1 )=( 133, 278 ), 7400 ).
happens( browsing( id2 ), 7400 ). holdsAt( coord( id2 )=( 29, 163 ), 7400 ).
% Frame number: 186
happens( immobile( id1 ), 7440 ). holdsAt( coord( id1 )=( 131, 278 ), 7440 ).
happens( browsing( id2 ), 7440 ). holdsAt( coord( id2 )=( 29, 163 ), 7440 ).
% Frame number: 187
happens( immobile( id1 ), 7480 ). holdsAt( coord( id1 )=( 129, 277 ), 7480 ).
happens( browsing( id2 ), 7480 ). holdsAt( coord( id2 )=( 29, 163 ), 7480 ).
% Frame number: 188
happens( immobile( id1 ), 7520 ). holdsAt( coord( id1 )=( 126, 277 ), 7520 ).
happens( browsing( id2 ), 7520 ). holdsAt( coord( id2 )=( 30, 163 ), 7520 ).
% Frame number: 189
happens( immobile( id1 ), 7560 ). holdsAt( coord( id1 )=( 125, 277 ), 7560 ).
happens( browsing( id2 ), 7560 ). holdsAt( coord( id2 )=( 30, 163 ), 7560 ).
% Frame number: 190
happens( immobile( id1 ), 7600 ). holdsAt( coord( id1 )=( 125, 276 ), 7600 ).
happens( browsing( id2 ), 7600 ). holdsAt( coord( id2 )=( 30, 164 ), 7600 ).
% Frame number: 191
happens( immobile( id1 ), 7640 ). holdsAt( coord( id1 )=( 124, 276 ), 7640 ).
happens( browsing( id2 ), 7640 ). holdsAt( coord( id2 )=( 30, 164 ), 7640 ).
% Frame number: 192
happens( immobile( id1 ), 7680 ). holdsAt( coord( id1 )=( 123, 275 ), 7680 ).
happens( browsing( id2 ), 7680 ). holdsAt( coord( id2 )=( 30, 164 ), 7680 ).
% Frame number: 193
happens( immobile( id1 ), 7720 ). holdsAt( coord( id1 )=( 122, 273 ), 7720 ).
happens( browsing( id2 ), 7720 ). holdsAt( coord( id2 )=( 30, 164 ), 7720 ).
% Frame number: 194
happens( immobile( id1 ), 7760 ). holdsAt( coord( id1 )=( 122, 273 ), 7760 ).
happens( browsing( id2 ), 7760 ). holdsAt( coord( id2 )=( 31, 164 ), 7760 ).
% Frame number: 195
happens( immobile( id1 ), 7800 ). holdsAt( coord( id1 )=( 122, 273 ), 7800 ).
happens( browsing( id2 ), 7800 ). holdsAt( coord( id2 )=( 31, 164 ), 7800 ).
% Frame number: 196
happens( immobile( id1 ), 7840 ). holdsAt( coord( id1 )=( 121, 273 ), 7840 ).
happens( browsing( id2 ), 7840 ). holdsAt( coord( id2 )=( 31, 164 ), 7840 ).
% Frame number: 197
happens( immobile( id1 ), 7880 ). holdsAt( coord( id1 )=( 120, 273 ), 7880 ).
happens( browsing( id2 ), 7880 ). holdsAt( coord( id2 )=( 31, 164 ), 7880 ).
% Frame number: 198
happens( immobile( id1 ), 7920 ). holdsAt( coord( id1 )=( 118, 273 ), 7920 ).
happens( browsing( id2 ), 7920 ). holdsAt( coord( id2 )=( 31, 164 ), 7920 ).
% Frame number: 199
happens( immobile( id1 ), 7960 ). holdsAt( coord( id1 )=( 117, 272 ), 7960 ).
happens( browsing( id2 ), 7960 ). holdsAt( coord( id2 )=( 31, 164 ), 7960 ).
% Frame number: 200
happens( immobile( id1 ), 8000 ). holdsAt( coord( id1 )=( 116, 271 ), 8000 ).
happens( browsing( id2 ), 8000 ). holdsAt( coord( id2 )=( 31, 164 ), 8000 ).
% Frame number: 201
happens( immobile( id1 ), 8040 ). holdsAt( coord( id1 )=( 115, 271 ), 8040 ).
happens( browsing( id2 ), 8040 ). holdsAt( coord( id2 )=( 32, 164 ), 8040 ).
% Frame number: 202
happens( immobile( id1 ), 8080 ). holdsAt( coord( id1 )=( 115, 271 ), 8080 ).
happens( browsing( id2 ), 8080 ). holdsAt( coord( id2 )=( 32, 164 ), 8080 ).
% Frame number: 203
happens( immobile( id1 ), 8120 ). holdsAt( coord( id1 )=( 114, 271 ), 8120 ).
happens( browsing( id2 ), 8120 ). holdsAt( coord( id2 )=( 32, 164 ), 8120 ).
% Frame number: 204
happens( immobile( id1 ), 8160 ). holdsAt( coord( id1 )=( 113, 271 ), 8160 ).
happens( browsing( id2 ), 8160 ). holdsAt( coord( id2 )=( 32, 164 ), 8160 ).
% Frame number: 205
happens( immobile( id1 ), 8200 ). holdsAt( coord( id1 )=( 111, 270 ), 8200 ).
happens( browsing( id2 ), 8200 ). holdsAt( coord( id2 )=( 33, 165 ), 8200 ).
% Frame number: 206
happens( immobile( id1 ), 8240 ). holdsAt( coord( id1 )=( 110, 270 ), 8240 ).
happens( browsing( id2 ), 8240 ). holdsAt( coord( id2 )=( 33, 165 ), 8240 ).
% Frame number: 207
happens( immobile( id1 ), 8280 ). holdsAt( coord( id1 )=( 109, 270 ), 8280 ).
happens( browsing( id2 ), 8280 ). holdsAt( coord( id2 )=( 33, 165 ), 8280 ).
% Frame number: 208
happens( immobile( id1 ), 8320 ). holdsAt( coord( id1 )=( 108, 268 ), 8320 ).
happens( browsing( id2 ), 8320 ). holdsAt( coord( id2 )=( 33, 165 ), 8320 ).
% Frame number: 209
happens( immobile( id1 ), 8360 ). holdsAt( coord( id1 )=( 107, 267 ), 8360 ).
happens( browsing( id2 ), 8360 ). holdsAt( coord( id2 )=( 33, 165 ), 8360 ).
% Frame number: 210
happens( immobile( id1 ), 8400 ). holdsAt( coord( id1 )=( 105, 267 ), 8400 ).
happens( browsing( id2 ), 8400 ). holdsAt( coord( id2 )=( 33, 165 ), 8400 ).
% Frame number: 211
happens( immobile( id1 ), 8440 ). holdsAt( coord( id1 )=( 104, 266 ), 8440 ).
happens( browsing( id2 ), 8440 ). holdsAt( coord( id2 )=( 33, 165 ), 8440 ).
% Frame number: 212
happens( immobile( id1 ), 8480 ). holdsAt( coord( id1 )=( 103, 266 ), 8480 ).
happens( browsing( id2 ), 8480 ). holdsAt( coord( id2 )=( 34, 165 ), 8480 ).
% Frame number: 213
happens( immobile( id1 ), 8520 ). holdsAt( coord( id1 )=( 103, 265 ), 8520 ).
happens( browsing( id2 ), 8520 ). holdsAt( coord( id2 )=( 34, 165 ), 8520 ).
% Frame number: 214
happens( immobile( id1 ), 8560 ). holdsAt( coord( id1 )=( 102, 264 ), 8560 ).
happens( browsing( id2 ), 8560 ). holdsAt( coord( id2 )=( 34, 165 ), 8560 ).
% Frame number: 215
happens( immobile( id1 ), 8600 ). holdsAt( coord( id1 )=( 101, 264 ), 8600 ).
happens( browsing( id2 ), 8600 ). holdsAt( coord( id2 )=( 35, 165 ), 8600 ).
% Frame number: 216
happens( immobile( id1 ), 8640 ). holdsAt( coord( id1 )=( 100, 264 ), 8640 ).
happens( browsing( id2 ), 8640 ). holdsAt( coord( id2 )=( 35, 165 ), 8640 ).
% Frame number: 217
happens( immobile( id1 ), 8680 ). holdsAt( coord( id1 )=( 100, 264 ), 8680 ).
happens( browsing( id2 ), 8680 ). holdsAt( coord( id2 )=( 35, 165 ), 8680 ).
% Frame number: 218
happens( immobile( id1 ), 8720 ). holdsAt( coord( id1 )=( 99, 264 ), 8720 ).
happens( browsing( id2 ), 8720 ). holdsAt( coord( id2 )=( 35, 165 ), 8720 ).
% Frame number: 219
happens( immobile( id1 ), 8760 ). holdsAt( coord( id1 )=( 98, 264 ), 8760 ).
happens( browsing( id2 ), 8760 ). holdsAt( coord( id2 )=( 35, 165 ), 8760 ).
% Frame number: 220
happens( immobile( id1 ), 8800 ). holdsAt( coord( id1 )=( 98, 263 ), 8800 ).
happens( browsing( id2 ), 8800 ). holdsAt( coord( id2 )=( 35, 165 ), 8800 ).
% Frame number: 221
happens( immobile( id1 ), 8840 ). holdsAt( coord( id1 )=( 97, 263 ), 8840 ).
happens( browsing( id2 ), 8840 ). holdsAt( coord( id2 )=( 35, 166 ), 8840 ).
% Frame number: 222
happens( immobile( id1 ), 8880 ). holdsAt( coord( id1 )=( 96, 263 ), 8880 ).
happens( browsing( id2 ), 8880 ). holdsAt( coord( id2 )=( 35, 166 ), 8880 ).
% Frame number: 223
happens( immobile( id1 ), 8920 ). holdsAt( coord( id1 )=( 94, 263 ), 8920 ).
happens( browsing( id2 ), 8920 ). holdsAt( coord( id2 )=( 35, 166 ), 8920 ).
% Frame number: 224
happens( immobile( id1 ), 8960 ). holdsAt( coord( id1 )=( 94, 263 ), 8960 ).
happens( browsing( id2 ), 8960 ). holdsAt( coord( id2 )=( 35, 166 ), 8960 ).
% Frame number: 225
happens( immobile( id1 ), 9000 ). holdsAt( coord( id1 )=( 94, 262 ), 9000 ).
happens( browsing( id2 ), 9000 ). holdsAt( coord( id2 )=( 35, 166 ), 9000 ).
% Frame number: 226
happens( immobile( id1 ), 9040 ). holdsAt( coord( id1 )=( 93, 262 ), 9040 ).
happens( browsing( id2 ), 9040 ). holdsAt( coord( id2 )=( 37, 166 ), 9040 ).
% Frame number: 227
happens( immobile( id1 ), 9080 ). holdsAt( coord( id1 )=( 92, 260 ), 9080 ).
happens( browsing( id2 ), 9080 ). holdsAt( coord( id2 )=( 37, 166 ), 9080 ).
% Frame number: 228
happens( immobile( id1 ), 9120 ). holdsAt( coord( id1 )=( 91, 260 ), 9120 ).
happens( browsing( id2 ), 9120 ). holdsAt( coord( id2 )=( 38, 166 ), 9120 ).
% Frame number: 229
happens( immobile( id1 ), 9160 ). holdsAt( coord( id1 )=( 89, 259 ), 9160 ).
happens( browsing( id2 ), 9160 ). holdsAt( coord( id2 )=( 38, 166 ), 9160 ).
% Frame number: 230
happens( immobile( id1 ), 9200 ). holdsAt( coord( id1 )=( 88, 259 ), 9200 ).
happens( browsing( id2 ), 9200 ). holdsAt( coord( id2 )=( 38, 166 ), 9200 ).
% Frame number: 231
happens( immobile( id1 ), 9240 ). holdsAt( coord( id1 )=( 87, 258 ), 9240 ).
happens( browsing( id2 ), 9240 ). holdsAt( coord( id2 )=( 38, 166 ), 9240 ).
% Frame number: 232
happens( immobile( id1 ), 9280 ). holdsAt( coord( id1 )=( 87, 257 ), 9280 ).
happens( browsing( id2 ), 9280 ). holdsAt( coord( id2 )=( 39, 166 ), 9280 ).
% Frame number: 233
happens( immobile( id1 ), 9320 ). holdsAt( coord( id1 )=( 86, 257 ), 9320 ).
happens( browsing( id2 ), 9320 ). holdsAt( coord( id2 )=( 39, 166 ), 9320 ).
% Frame number: 234
happens( immobile( id1 ), 9360 ). holdsAt( coord( id1 )=( 86, 257 ), 9360 ).
happens( browsing( id2 ), 9360 ). holdsAt( coord( id2 )=( 39, 166 ), 9360 ).
% Frame number: 235
happens( immobile( id1 ), 9400 ). holdsAt( coord( id1 )=( 86, 257 ), 9400 ).
happens( browsing( id2 ), 9400 ). holdsAt( coord( id2 )=( 39, 165 ), 9400 ).
% Frame number: 236
happens( immobile( id1 ), 9440 ). holdsAt( coord( id1 )=( 86, 257 ), 9440 ).
happens( browsing( id2 ), 9440 ). holdsAt( coord( id2 )=( 39, 165 ), 9440 ).
% Frame number: 237
happens( immobile( id1 ), 9480 ). holdsAt( coord( id1 )=( 86, 257 ), 9480 ).
happens( browsing( id2 ), 9480 ). holdsAt( coord( id2 )=( 39, 165 ), 9480 ).
% Frame number: 238
happens( immobile( id1 ), 9520 ). holdsAt( coord( id1 )=( 86, 257 ), 9520 ).
happens( browsing( id2 ), 9520 ). holdsAt( coord( id2 )=( 39, 165 ), 9520 ).
% Frame number: 239
happens( immobile( id1 ), 9560 ). holdsAt( coord( id1 )=( 86, 257 ), 9560 ).
happens( browsing( id2 ), 9560 ). holdsAt( coord( id2 )=( 39, 165 ), 9560 ).
% Frame number: 240
happens( immobile( id1 ), 9600 ). holdsAt( coord( id1 )=( 85, 257 ), 9600 ).
happens( browsing( id2 ), 9600 ). holdsAt( coord( id2 )=( 39, 165 ), 9600 ).
% Frame number: 241
happens( immobile( id1 ), 9640 ). holdsAt( coord( id1 )=( 85, 256 ), 9640 ).
happens( browsing( id2 ), 9640 ). holdsAt( coord( id2 )=( 40, 165 ), 9640 ).
% Frame number: 242
happens( immobile( id1 ), 9680 ). holdsAt( coord( id1 )=( 85, 256 ), 9680 ).
happens( browsing( id2 ), 9680 ). holdsAt( coord( id2 )=( 40, 165 ), 9680 ).
% Frame number: 243
happens( immobile( id1 ), 9720 ). holdsAt( coord( id1 )=( 85, 256 ), 9720 ).
happens( browsing( id2 ), 9720 ). holdsAt( coord( id2 )=( 41, 165 ), 9720 ).
% Frame number: 244
happens( immobile( id1 ), 9760 ). holdsAt( coord( id1 )=( 85, 256 ), 9760 ).
happens( browsing( id2 ), 9760 ). holdsAt( coord( id2 )=( 41, 165 ), 9760 ).
% Frame number: 245
happens( immobile( id1 ), 9800 ). holdsAt( coord( id1 )=( 85, 255 ), 9800 ).
happens( browsing( id2 ), 9800 ). holdsAt( coord( id2 )=( 41, 165 ), 9800 ).
% Frame number: 246
happens( immobile( id1 ), 9840 ). holdsAt( coord( id1 )=( 85, 255 ), 9840 ).
happens( browsing( id2 ), 9840 ). holdsAt( coord( id2 )=( 42, 165 ), 9840 ).
% Frame number: 247
happens( immobile( id1 ), 9880 ). holdsAt( coord( id1 )=( 85, 255 ), 9880 ).
happens( browsing( id2 ), 9880 ). holdsAt( coord( id2 )=( 42, 165 ), 9880 ).
% Frame number: 248
happens( immobile( id1 ), 9920 ). holdsAt( coord( id1 )=( 85, 255 ), 9920 ).
happens( browsing( id2 ), 9920 ). holdsAt( coord( id2 )=( 42, 165 ), 9920 ).
% Frame number: 249
happens( immobile( id1 ), 9960 ). holdsAt( coord( id1 )=( 85, 255 ), 9960 ).
happens( browsing( id2 ), 9960 ). holdsAt( coord( id2 )=( 42, 165 ), 9960 ).
% Frame number: 250
happens( immobile( id1 ), 10000 ). holdsAt( coord( id1 )=( 85, 254 ), 10000 ).
happens( browsing( id2 ), 10000 ). holdsAt( coord( id2 )=( 42, 165 ), 10000 ).
% Frame number: 251
happens( immobile( id1 ), 10040 ). holdsAt( coord( id1 )=( 85, 254 ), 10040 ).
happens( browsing( id2 ), 10040 ). holdsAt( coord( id2 )=( 42, 165 ), 10040 ).
% Frame number: 252
happens( immobile( id1 ), 10080 ). holdsAt( coord( id1 )=( 85, 254 ), 10080 ).
happens( browsing( id2 ), 10080 ). holdsAt( coord( id2 )=( 42, 165 ), 10080 ).
% Frame number: 253
happens( immobile( id1 ), 10120 ). holdsAt( coord( id1 )=( 85, 254 ), 10120 ).
happens( browsing( id2 ), 10120 ). holdsAt( coord( id2 )=( 42, 165 ), 10120 ).
% Frame number: 254
happens( immobile( id1 ), 10160 ). holdsAt( coord( id1 )=( 85, 254 ), 10160 ).
happens( browsing( id2 ), 10160 ). holdsAt( coord( id2 )=( 42, 165 ), 10160 ).
% Frame number: 255
happens( immobile( id1 ), 10200 ). holdsAt( coord( id1 )=( 85, 253 ), 10200 ).
happens( browsing( id2 ), 10200 ). holdsAt( coord( id2 )=( 42, 165 ), 10200 ).
% Frame number: 256
happens( immobile( id1 ), 10240 ). holdsAt( coord( id1 )=( 85, 253 ), 10240 ).
happens( browsing( id2 ), 10240 ). holdsAt( coord( id2 )=( 43, 165 ), 10240 ).
% Frame number: 257
happens( immobile( id1 ), 10280 ). holdsAt( coord( id1 )=( 86, 252 ), 10280 ).
happens( browsing( id2 ), 10280 ). holdsAt( coord( id2 )=( 44, 165 ), 10280 ).
% Frame number: 258
happens( immobile( id1 ), 10320 ). holdsAt( coord( id1 )=( 86, 252 ), 10320 ).
happens( browsing( id2 ), 10320 ). holdsAt( coord( id2 )=( 45, 165 ), 10320 ).
% Frame number: 259
happens( immobile( id1 ), 10360 ). holdsAt( coord( id1 )=( 87, 252 ), 10360 ).
happens( browsing( id2 ), 10360 ). holdsAt( coord( id2 )=( 46, 165 ), 10360 ).
% Frame number: 260
happens( immobile( id1 ), 10400 ). holdsAt( coord( id1 )=( 87, 251 ), 10400 ).
happens( browsing( id2 ), 10400 ). holdsAt( coord( id2 )=( 46, 165 ), 10400 ).
% Frame number: 261
happens( immobile( id1 ), 10440 ). holdsAt( coord( id1 )=( 87, 250 ), 10440 ).
happens( browsing( id2 ), 10440 ). holdsAt( coord( id2 )=( 46, 165 ), 10440 ).
% Frame number: 262
happens( immobile( id1 ), 10480 ). holdsAt( coord( id1 )=( 88, 250 ), 10480 ).
happens( browsing( id2 ), 10480 ). holdsAt( coord( id2 )=( 46, 165 ), 10480 ).
% Frame number: 263
happens( immobile( id1 ), 10520 ). holdsAt( coord( id1 )=( 88, 249 ), 10520 ).
happens( browsing( id2 ), 10520 ). holdsAt( coord( id2 )=( 47, 165 ), 10520 ).
% Frame number: 264
happens( immobile( id1 ), 10560 ). holdsAt( coord( id1 )=( 88, 248 ), 10560 ).
happens( browsing( id2 ), 10560 ). holdsAt( coord( id2 )=( 47, 165 ), 10560 ).
% Frame number: 265
happens( immobile( id1 ), 10600 ). holdsAt( coord( id1 )=( 89, 248 ), 10600 ).
happens( browsing( id2 ), 10600 ). holdsAt( coord( id2 )=( 47, 165 ), 10600 ).
% Frame number: 266
happens( immobile( id1 ), 10640 ). holdsAt( coord( id1 )=( 89, 248 ), 10640 ).
happens( browsing( id2 ), 10640 ). holdsAt( coord( id2 )=( 47, 165 ), 10640 ).
% Frame number: 267
happens( immobile( id1 ), 10680 ). holdsAt( coord( id1 )=( 89, 248 ), 10680 ).
happens( browsing( id2 ), 10680 ). holdsAt( coord( id2 )=( 47, 165 ), 10680 ).
% Frame number: 268
happens( immobile( id1 ), 10720 ). holdsAt( coord( id1 )=( 90, 248 ), 10720 ).
happens( browsing( id2 ), 10720 ). holdsAt( coord( id2 )=( 47, 165 ), 10720 ).
% Frame number: 269
happens( immobile( id1 ), 10760 ). holdsAt( coord( id1 )=( 90, 249 ), 10760 ).
happens( browsing( id2 ), 10760 ). holdsAt( coord( id2 )=( 47, 165 ), 10760 ).
% Frame number: 270
happens( immobile( id1 ), 10800 ). holdsAt( coord( id1 )=( 92, 249 ), 10800 ).
happens( browsing( id2 ), 10800 ). holdsAt( coord( id2 )=( 47, 165 ), 10800 ).
% Frame number: 271
happens( immobile( id1 ), 10840 ). holdsAt( coord( id1 )=( 92, 249 ), 10840 ).
happens( browsing( id2 ), 10840 ). holdsAt( coord( id2 )=( 47, 165 ), 10840 ).
% Frame number: 272
happens( immobile( id1 ), 10880 ). holdsAt( coord( id1 )=( 93, 250 ), 10880 ).
happens( browsing( id2 ), 10880 ). holdsAt( coord( id2 )=( 47, 165 ), 10880 ).
% Frame number: 273
happens( immobile( id1 ), 10920 ). holdsAt( coord( id1 )=( 93, 251 ), 10920 ).
happens( browsing( id2 ), 10920 ). holdsAt( coord( id2 )=( 48, 165 ), 10920 ).
% Frame number: 274
happens( immobile( id1 ), 10960 ). holdsAt( coord( id1 )=( 93, 251 ), 10960 ).
happens( browsing( id2 ), 10960 ). holdsAt( coord( id2 )=( 49, 165 ), 10960 ).
% Frame number: 275
happens( immobile( id1 ), 11000 ). holdsAt( coord( id1 )=( 94, 252 ), 11000 ).
happens( browsing( id2 ), 11000 ). holdsAt( coord( id2 )=( 49, 165 ), 11000 ).
% Frame number: 276
happens( immobile( id1 ), 11040 ). holdsAt( coord( id1 )=( 94, 253 ), 11040 ).
happens( browsing( id2 ), 11040 ). holdsAt( coord( id2 )=( 49, 165 ), 11040 ).
% Frame number: 277
happens( immobile( id1 ), 11080 ). holdsAt( coord( id1 )=( 94, 254 ), 11080 ).
happens( browsing( id2 ), 11080 ). holdsAt( coord( id2 )=( 50, 165 ), 11080 ).
% Frame number: 278
happens( immobile( id1 ), 11120 ). holdsAt( coord( id1 )=( 95, 256 ), 11120 ).
happens( browsing( id2 ), 11120 ). holdsAt( coord( id2 )=( 50, 165 ), 11120 ).
% Frame number: 279
happens( immobile( id1 ), 11160 ). holdsAt( coord( id1 )=( 95, 256 ), 11160 ).
happens( browsing( id2 ), 11160 ). holdsAt( coord( id2 )=( 51, 165 ), 11160 ).
% Frame number: 280
happens( immobile( id1 ), 11200 ). holdsAt( coord( id1 )=( 95, 257 ), 11200 ).
happens( browsing( id2 ), 11200 ). holdsAt( coord( id2 )=( 51, 165 ), 11200 ).
% Frame number: 281
happens( immobile( id1 ), 11240 ). holdsAt( coord( id1 )=( 95, 257 ), 11240 ).
happens( browsing( id2 ), 11240 ). holdsAt( coord( id2 )=( 51, 165 ), 11240 ).
% Frame number: 282
happens( immobile( id1 ), 11280 ). holdsAt( coord( id1 )=( 95, 257 ), 11280 ).
happens( browsing( id2 ), 11280 ). holdsAt( coord( id2 )=( 51, 165 ), 11280 ).
% Frame number: 283
happens( immobile( id1 ), 11320 ). holdsAt( coord( id1 )=( 95, 258 ), 11320 ).
happens( browsing( id2 ), 11320 ). holdsAt( coord( id2 )=( 51, 165 ), 11320 ).
% Frame number: 284
happens( immobile( id1 ), 11360 ). holdsAt( coord( id1 )=( 95, 258 ), 11360 ).
happens( browsing( id2 ), 11360 ). holdsAt( coord( id2 )=( 51, 165 ), 11360 ).
% Frame number: 285
happens( immobile( id1 ), 11400 ). holdsAt( coord( id1 )=( 95, 259 ), 11400 ).
happens( browsing( id2 ), 11400 ). holdsAt( coord( id2 )=( 52, 165 ), 11400 ).
% Frame number: 286
happens( immobile( id1 ), 11440 ). holdsAt( coord( id1 )=( 97, 260 ), 11440 ).
happens( browsing( id2 ), 11440 ). holdsAt( coord( id2 )=( 52, 165 ), 11440 ).
% Frame number: 287
happens( immobile( id1 ), 11480 ). holdsAt( coord( id1 )=( 99, 260 ), 11480 ).
happens( browsing( id2 ), 11480 ). holdsAt( coord( id2 )=( 52, 165 ), 11480 ).
% Frame number: 288
happens( immobile( id1 ), 11520 ). holdsAt( coord( id1 )=( 100, 261 ), 11520 ).
happens( browsing( id2 ), 11520 ). holdsAt( coord( id2 )=( 53, 164 ), 11520 ).
% Frame number: 289
happens( immobile( id1 ), 11560 ). holdsAt( coord( id1 )=( 101, 261 ), 11560 ).
happens( browsing( id2 ), 11560 ). holdsAt( coord( id2 )=( 53, 164 ), 11560 ).
% Frame number: 290
happens( immobile( id1 ), 11600 ). holdsAt( coord( id1 )=( 101, 262 ), 11600 ).
happens( browsing( id2 ), 11600 ). holdsAt( coord( id2 )=( 54, 164 ), 11600 ).
% Frame number: 291
happens( immobile( id1 ), 11640 ). holdsAt( coord( id1 )=( 101, 262 ), 11640 ).
happens( browsing( id2 ), 11640 ). holdsAt( coord( id2 )=( 55, 164 ), 11640 ).
% Frame number: 292
happens( immobile( id1 ), 11680 ). holdsAt( coord( id1 )=( 102, 262 ), 11680 ).
happens( browsing( id2 ), 11680 ). holdsAt( coord( id2 )=( 56, 164 ), 11680 ).
% Frame number: 293
happens( immobile( id1 ), 11720 ). holdsAt( coord( id1 )=( 102, 262 ), 11720 ).
happens( browsing( id2 ), 11720 ). holdsAt( coord( id2 )=( 56, 164 ), 11720 ).
% Frame number: 294
happens( immobile( id1 ), 11760 ). holdsAt( coord( id1 )=( 102, 262 ), 11760 ).
happens( browsing( id2 ), 11760 ). holdsAt( coord( id2 )=( 56, 164 ), 11760 ).
% Frame number: 295
happens( immobile( id1 ), 11800 ). holdsAt( coord( id1 )=( 103, 263 ), 11800 ).
happens( browsing( id2 ), 11800 ). holdsAt( coord( id2 )=( 57, 164 ), 11800 ).
% Frame number: 296
happens( immobile( id1 ), 11840 ). holdsAt( coord( id1 )=( 103, 263 ), 11840 ).
happens( browsing( id2 ), 11840 ). holdsAt( coord( id2 )=( 57, 163 ), 11840 ).
% Frame number: 297
happens( immobile( id1 ), 11880 ). holdsAt( coord( id1 )=( 103, 263 ), 11880 ).
happens( browsing( id2 ), 11880 ). holdsAt( coord( id2 )=( 57, 163 ), 11880 ).
% Frame number: 298
happens( immobile( id1 ), 11920 ). holdsAt( coord( id1 )=( 103, 263 ), 11920 ).
happens( browsing( id2 ), 11920 ). holdsAt( coord( id2 )=( 57, 163 ), 11920 ).
% Frame number: 299
happens( immobile( id1 ), 11960 ). holdsAt( coord( id1 )=( 103, 263 ), 11960 ).
happens( browsing( id2 ), 11960 ). holdsAt( coord( id2 )=( 57, 163 ), 11960 ).
% Frame number: 300
happens( immobile( id1 ), 12000 ). holdsAt( coord( id1 )=( 103, 263 ), 12000 ).
happens( browsing( id2 ), 12000 ). holdsAt( coord( id2 )=( 57, 162 ), 12000 ).
% Frame number: 301
happens( immobile( id1 ), 12040 ). holdsAt( coord( id1 )=( 104, 264 ), 12040 ).
happens( browsing( id2 ), 12040 ). holdsAt( coord( id2 )=( 57, 162 ), 12040 ).
% Frame number: 302
happens( immobile( id1 ), 12080 ). holdsAt( coord( id1 )=( 104, 264 ), 12080 ).
happens( browsing( id2 ), 12080 ). holdsAt( coord( id2 )=( 57, 162 ), 12080 ).
% Frame number: 303
happens( immobile( id1 ), 12120 ). holdsAt( coord( id1 )=( 104, 264 ), 12120 ).
happens( browsing( id2 ), 12120 ). holdsAt( coord( id2 )=( 58, 162 ), 12120 ).
% Frame number: 304
happens( immobile( id1 ), 12160 ). holdsAt( coord( id1 )=( 104, 264 ), 12160 ).
happens( browsing( id2 ), 12160 ). holdsAt( coord( id2 )=( 58, 162 ), 12160 ).
% Frame number: 305
happens( immobile( id1 ), 12200 ). holdsAt( coord( id1 )=( 104, 264 ), 12200 ).
happens( browsing( id2 ), 12200 ). holdsAt( coord( id2 )=( 59, 162 ), 12200 ).
% Frame number: 306
happens( immobile( id1 ), 12240 ). holdsAt( coord( id1 )=( 104, 264 ), 12240 ).
happens( browsing( id2 ), 12240 ). holdsAt( coord( id2 )=( 59, 162 ), 12240 ).
% Frame number: 307
happens( immobile( id1 ), 12280 ). holdsAt( coord( id1 )=( 104, 264 ), 12280 ).
happens( browsing( id2 ), 12280 ). holdsAt( coord( id2 )=( 60, 161 ), 12280 ).
% Frame number: 308
happens( immobile( id1 ), 12320 ). holdsAt( coord( id1 )=( 104, 264 ), 12320 ).
happens( browsing( id2 ), 12320 ). holdsAt( coord( id2 )=( 61, 161 ), 12320 ).
% Frame number: 309
happens( immobile( id1 ), 12360 ). holdsAt( coord( id1 )=( 104, 264 ), 12360 ).
happens( browsing( id2 ), 12360 ). holdsAt( coord( id2 )=( 62, 161 ), 12360 ).
% Frame number: 310
happens( immobile( id1 ), 12400 ). holdsAt( coord( id1 )=( 104, 264 ), 12400 ).
happens( browsing( id2 ), 12400 ). holdsAt( coord( id2 )=( 62, 161 ), 12400 ).
% Frame number: 311
happens( immobile( id1 ), 12440 ). holdsAt( coord( id1 )=( 104, 264 ), 12440 ).
happens( browsing( id2 ), 12440 ). holdsAt( coord( id2 )=( 62, 161 ), 12440 ).
% Frame number: 312
happens( immobile( id1 ), 12480 ). holdsAt( coord( id1 )=( 105, 264 ), 12480 ).
happens( browsing( id2 ), 12480 ). holdsAt( coord( id2 )=( 62, 161 ), 12480 ).
% Frame number: 313
happens( immobile( id1 ), 12520 ). holdsAt( coord( id1 )=( 105, 264 ), 12520 ).
happens( browsing( id2 ), 12520 ). holdsAt( coord( id2 )=( 63, 161 ), 12520 ).
% Frame number: 314
happens( immobile( id1 ), 12560 ). holdsAt( coord( id1 )=( 105, 264 ), 12560 ).
happens( browsing( id2 ), 12560 ). holdsAt( coord( id2 )=( 63, 161 ), 12560 ).
% Frame number: 315
happens( immobile( id1 ), 12600 ). holdsAt( coord( id1 )=( 105, 264 ), 12600 ).
happens( browsing( id2 ), 12600 ). holdsAt( coord( id2 )=( 63, 161 ), 12600 ).
% Frame number: 316
happens( immobile( id1 ), 12640 ). holdsAt( coord( id1 )=( 105, 264 ), 12640 ).
happens( browsing( id2 ), 12640 ). holdsAt( coord( id2 )=( 63, 161 ), 12640 ).
% Frame number: 317
happens( immobile( id1 ), 12680 ). holdsAt( coord( id1 )=( 105, 264 ), 12680 ).
happens( browsing( id2 ), 12680 ). holdsAt( coord( id2 )=( 63, 161 ), 12680 ).
% Frame number: 318
happens( immobile( id1 ), 12720 ). holdsAt( coord( id1 )=( 105, 264 ), 12720 ).
happens( browsing( id2 ), 12720 ). holdsAt( coord( id2 )=( 63, 161 ), 12720 ).
% Frame number: 319
happens( immobile( id1 ), 12760 ). holdsAt( coord( id1 )=( 105, 264 ), 12760 ).
happens( browsing( id2 ), 12760 ). holdsAt( coord( id2 )=( 64, 161 ), 12760 ).
% Frame number: 320
happens( immobile( id1 ), 12800 ). holdsAt( coord( id1 )=( 105, 264 ), 12800 ).
happens( browsing( id2 ), 12800 ). holdsAt( coord( id2 )=( 65, 161 ), 12800 ).
% Frame number: 321
happens( immobile( id1 ), 12840 ). holdsAt( coord( id1 )=( 105, 264 ), 12840 ).
happens( browsing( id2 ), 12840 ). holdsAt( coord( id2 )=( 65, 161 ), 12840 ).
% Frame number: 322
happens( immobile( id1 ), 12880 ). holdsAt( coord( id1 )=( 105, 264 ), 12880 ).
happens( browsing( id2 ), 12880 ). holdsAt( coord( id2 )=( 66, 161 ), 12880 ).
% Frame number: 323
happens( immobile( id1 ), 12920 ). holdsAt( coord( id1 )=( 105, 264 ), 12920 ).
happens( browsing( id2 ), 12920 ). holdsAt( coord( id2 )=( 67, 161 ), 12920 ).
% Frame number: 324
happens( immobile( id1 ), 12960 ). holdsAt( coord( id1 )=( 105, 264 ), 12960 ).
happens( browsing( id2 ), 12960 ). holdsAt( coord( id2 )=( 68, 160 ), 12960 ).
% Frame number: 325
happens( immobile( id1 ), 13000 ). holdsAt( coord( id1 )=( 105, 264 ), 13000 ).
happens( browsing( id2 ), 13000 ). holdsAt( coord( id2 )=( 68, 160 ), 13000 ).
% Frame number: 326
happens( immobile( id1 ), 13040 ). holdsAt( coord( id1 )=( 105, 264 ), 13040 ).
happens( browsing( id2 ), 13040 ). holdsAt( coord( id2 )=( 69, 160 ), 13040 ).
% Frame number: 327
happens( immobile( id1 ), 13080 ). holdsAt( coord( id1 )=( 105, 264 ), 13080 ).
happens( browsing( id2 ), 13080 ). holdsAt( coord( id2 )=( 69, 160 ), 13080 ).
% Frame number: 328
happens( immobile( id1 ), 13120 ). holdsAt( coord( id1 )=( 105, 264 ), 13120 ).
happens( browsing( id2 ), 13120 ). holdsAt( coord( id2 )=( 70, 160 ), 13120 ).
% Frame number: 329
happens( immobile( id1 ), 13160 ). holdsAt( coord( id1 )=( 105, 264 ), 13160 ).
happens( browsing( id2 ), 13160 ). holdsAt( coord( id2 )=( 70, 160 ), 13160 ).
% Frame number: 330
happens( immobile( id1 ), 13200 ). holdsAt( coord( id1 )=( 105, 264 ), 13200 ).
happens( browsing( id2 ), 13200 ). holdsAt( coord( id2 )=( 70, 160 ), 13200 ).
% Frame number: 331
happens( immobile( id1 ), 13240 ). holdsAt( coord( id1 )=( 105, 264 ), 13240 ).
happens( browsing( id2 ), 13240 ). holdsAt( coord( id2 )=( 70, 160 ), 13240 ).
% Frame number: 332
happens( immobile( id1 ), 13280 ). holdsAt( coord( id1 )=( 105, 264 ), 13280 ).
happens( browsing( id2 ), 13280 ). holdsAt( coord( id2 )=( 70, 160 ), 13280 ).
% Frame number: 333
happens( immobile( id1 ), 13320 ). holdsAt( coord( id1 )=( 105, 264 ), 13320 ).
happens( browsing( id2 ), 13320 ). holdsAt( coord( id2 )=( 70, 160 ), 13320 ).
% Frame number: 334
happens( immobile( id1 ), 13360 ). holdsAt( coord( id1 )=( 105, 264 ), 13360 ).
happens( browsing( id2 ), 13360 ). holdsAt( coord( id2 )=( 70, 159 ), 13360 ).
% Frame number: 335
happens( immobile( id1 ), 13400 ). holdsAt( coord( id1 )=( 105, 264 ), 13400 ).
happens( browsing( id2 ), 13400 ). holdsAt( coord( id2 )=( 71, 159 ), 13400 ).
% Frame number: 336
happens( immobile( id1 ), 13440 ). holdsAt( coord( id1 )=( 105, 264 ), 13440 ).
happens( browsing( id2 ), 13440 ). holdsAt( coord( id2 )=( 72, 159 ), 13440 ).
% Frame number: 337
happens( immobile( id1 ), 13480 ). holdsAt( coord( id1 )=( 105, 264 ), 13480 ).
happens( browsing( id2 ), 13480 ). holdsAt( coord( id2 )=( 73, 159 ), 13480 ).
% Frame number: 338
happens( immobile( id1 ), 13520 ). holdsAt( coord( id1 )=( 105, 264 ), 13520 ).
happens( browsing( id2 ), 13520 ). holdsAt( coord( id2 )=( 75, 159 ), 13520 ).
% Frame number: 339
happens( immobile( id1 ), 13560 ). holdsAt( coord( id1 )=( 105, 264 ), 13560 ).
happens( browsing( id2 ), 13560 ). holdsAt( coord( id2 )=( 75, 159 ), 13560 ).
% Frame number: 340
happens( immobile( id1 ), 13600 ). holdsAt( coord( id1 )=( 105, 264 ), 13600 ).
happens( browsing( id2 ), 13600 ). holdsAt( coord( id2 )=( 76, 159 ), 13600 ).
% Frame number: 341
happens( immobile( id1 ), 13640 ). holdsAt( coord( id1 )=( 105, 264 ), 13640 ).
happens( browsing( id2 ), 13640 ). holdsAt( coord( id2 )=( 76, 159 ), 13640 ).
% Frame number: 342
happens( immobile( id1 ), 13680 ). holdsAt( coord( id1 )=( 105, 264 ), 13680 ).
happens( browsing( id2 ), 13680 ). holdsAt( coord( id2 )=( 76, 159 ), 13680 ).
% Frame number: 343
happens( immobile( id1 ), 13720 ). holdsAt( coord( id1 )=( 105, 264 ), 13720 ).
happens( browsing( id2 ), 13720 ). holdsAt( coord( id2 )=( 76, 159 ), 13720 ).
% Frame number: 344
happens( immobile( id1 ), 13760 ). holdsAt( coord( id1 )=( 105, 264 ), 13760 ).
happens( browsing( id2 ), 13760 ). holdsAt( coord( id2 )=( 76, 159 ), 13760 ).
% Frame number: 345
happens( immobile( id1 ), 13800 ). holdsAt( coord( id1 )=( 105, 264 ), 13800 ).
happens( browsing( id2 ), 13800 ). holdsAt( coord( id2 )=( 76, 159 ), 13800 ).
% Frame number: 346
happens( immobile( id1 ), 13840 ). holdsAt( coord( id1 )=( 105, 264 ), 13840 ).
happens( browsing( id2 ), 13840 ). holdsAt( coord( id2 )=( 76, 159 ), 13840 ).
% Frame number: 347
happens( immobile( id1 ), 13880 ). holdsAt( coord( id1 )=( 105, 264 ), 13880 ).
happens( browsing( id2 ), 13880 ). holdsAt( coord( id2 )=( 77, 159 ), 13880 ).
% Frame number: 348
happens( immobile( id1 ), 13920 ). holdsAt( coord( id1 )=( 105, 264 ), 13920 ).
happens( browsing( id2 ), 13920 ). holdsAt( coord( id2 )=( 77, 158 ), 13920 ).
% Frame number: 349
happens( immobile( id1 ), 13960 ). holdsAt( coord( id1 )=( 105, 264 ), 13960 ).
happens( browsing( id2 ), 13960 ). holdsAt( coord( id2 )=( 77, 158 ), 13960 ).
% Frame number: 350
happens( immobile( id1 ), 14000 ). holdsAt( coord( id1 )=( 105, 264 ), 14000 ).
happens( browsing( id2 ), 14000 ). holdsAt( coord( id2 )=( 78, 158 ), 14000 ).
% Frame number: 351
happens( immobile( id1 ), 14040 ). holdsAt( coord( id1 )=( 105, 264 ), 14040 ).
happens( browsing( id2 ), 14040 ). holdsAt( coord( id2 )=( 80, 158 ), 14040 ).
% Frame number: 352
happens( immobile( id1 ), 14080 ). holdsAt( coord( id1 )=( 105, 264 ), 14080 ).
happens( browsing( id2 ), 14080 ). holdsAt( coord( id2 )=( 82, 158 ), 14080 ).
% Frame number: 353
happens( immobile( id1 ), 14120 ). holdsAt( coord( id1 )=( 105, 264 ), 14120 ).
happens( browsing( id2 ), 14120 ). holdsAt( coord( id2 )=( 83, 158 ), 14120 ).
% Frame number: 354
happens( immobile( id1 ), 14160 ). holdsAt( coord( id1 )=( 105, 264 ), 14160 ).
happens( browsing( id2 ), 14160 ). holdsAt( coord( id2 )=( 84, 158 ), 14160 ).
% Frame number: 355
happens( immobile( id1 ), 14200 ). holdsAt( coord( id1 )=( 105, 264 ), 14200 ).
happens( browsing( id2 ), 14200 ). holdsAt( coord( id2 )=( 84, 157 ), 14200 ).
% Frame number: 356
happens( immobile( id1 ), 14240 ). holdsAt( coord( id1 )=( 105, 264 ), 14240 ).
happens( browsing( id2 ), 14240 ). holdsAt( coord( id2 )=( 85, 157 ), 14240 ).
% Frame number: 357
happens( immobile( id1 ), 14280 ). holdsAt( coord( id1 )=( 105, 264 ), 14280 ).
happens( browsing( id2 ), 14280 ). holdsAt( coord( id2 )=( 85, 157 ), 14280 ).
% Frame number: 358
happens( immobile( id1 ), 14320 ). holdsAt( coord( id1 )=( 105, 264 ), 14320 ).
happens( browsing( id2 ), 14320 ). holdsAt( coord( id2 )=( 85, 156 ), 14320 ).
% Frame number: 359
happens( immobile( id1 ), 14360 ). holdsAt( coord( id1 )=( 105, 264 ), 14360 ).
happens( browsing( id2 ), 14360 ). holdsAt( coord( id2 )=( 85, 156 ), 14360 ).
% Frame number: 360
happens( immobile( id1 ), 14400 ). holdsAt( coord( id1 )=( 105, 264 ), 14400 ).
happens( browsing( id2 ), 14400 ). holdsAt( coord( id2 )=( 86, 155 ), 14400 ).
% Frame number: 361
happens( immobile( id1 ), 14440 ). holdsAt( coord( id1 )=( 105, 264 ), 14440 ).
happens( browsing( id2 ), 14440 ). holdsAt( coord( id2 )=( 86, 155 ), 14440 ).
% Frame number: 362
happens( immobile( id1 ), 14480 ). holdsAt( coord( id1 )=( 105, 264 ), 14480 ).
happens( browsing( id2 ), 14480 ). holdsAt( coord( id2 )=( 87, 155 ), 14480 ).
% Frame number: 363
happens( immobile( id1 ), 14520 ). holdsAt( coord( id1 )=( 105, 264 ), 14520 ).
happens( browsing( id2 ), 14520 ). holdsAt( coord( id2 )=( 87, 154 ), 14520 ).
% Frame number: 364
happens( immobile( id1 ), 14560 ). holdsAt( coord( id1 )=( 105, 264 ), 14560 ).
happens( browsing( id2 ), 14560 ). holdsAt( coord( id2 )=( 87, 154 ), 14560 ).
% Frame number: 365
happens( immobile( id1 ), 14600 ). holdsAt( coord( id1 )=( 105, 264 ), 14600 ).
happens( browsing( id2 ), 14600 ). holdsAt( coord( id2 )=( 87, 154 ), 14600 ).
% Frame number: 366
happens( immobile( id1 ), 14640 ). holdsAt( coord( id1 )=( 105, 264 ), 14640 ).
happens( browsing( id2 ), 14640 ). holdsAt( coord( id2 )=( 88, 154 ), 14640 ).
% Frame number: 367
happens( immobile( id1 ), 14680 ). holdsAt( coord( id1 )=( 105, 264 ), 14680 ).
happens( browsing( id2 ), 14680 ). holdsAt( coord( id2 )=( 89, 153 ), 14680 ).
% Frame number: 368
happens( immobile( id1 ), 14720 ). holdsAt( coord( id1 )=( 105, 264 ), 14720 ).
happens( browsing( id2 ), 14720 ). holdsAt( coord( id2 )=( 90, 152 ), 14720 ).
% Frame number: 369
happens( immobile( id1 ), 14760 ). holdsAt( coord( id1 )=( 105, 264 ), 14760 ).
happens( browsing( id2 ), 14760 ). holdsAt( coord( id2 )=( 92, 152 ), 14760 ).
% Frame number: 370
happens( immobile( id1 ), 14800 ). holdsAt( coord( id1 )=( 105, 264 ), 14800 ).
happens( browsing( id2 ), 14800 ). holdsAt( coord( id2 )=( 93, 152 ), 14800 ).
% Frame number: 371
happens( immobile( id1 ), 14840 ). holdsAt( coord( id1 )=( 105, 264 ), 14840 ).
happens( browsing( id2 ), 14840 ). holdsAt( coord( id2 )=( 93, 152 ), 14840 ).
% Frame number: 372
happens( immobile( id1 ), 14880 ). holdsAt( coord( id1 )=( 105, 264 ), 14880 ).
happens( browsing( id2 ), 14880 ). holdsAt( coord( id2 )=( 94, 152 ), 14880 ).
% Frame number: 373
happens( immobile( id1 ), 14920 ). holdsAt( coord( id1 )=( 105, 264 ), 14920 ).
happens( browsing( id2 ), 14920 ). holdsAt( coord( id2 )=( 95, 152 ), 14920 ).
% Frame number: 374
happens( immobile( id1 ), 14960 ). holdsAt( coord( id1 )=( 105, 264 ), 14960 ).
happens( browsing( id2 ), 14960 ). holdsAt( coord( id2 )=( 95, 152 ), 14960 ).
% Frame number: 375
happens( immobile( id1 ), 15000 ). holdsAt( coord( id1 )=( 105, 264 ), 15000 ).
happens( browsing( id2 ), 15000 ). holdsAt( coord( id2 )=( 96, 152 ), 15000 ).
% Frame number: 376
happens( immobile( id1 ), 15040 ). holdsAt( coord( id1 )=( 105, 264 ), 15040 ).
happens( browsing( id2 ), 15040 ). holdsAt( coord( id2 )=( 96, 152 ), 15040 ).
% Frame number: 377
happens( immobile( id1 ), 15080 ). holdsAt( coord( id1 )=( 105, 264 ), 15080 ).
happens( browsing( id2 ), 15080 ). holdsAt( coord( id2 )=( 96, 151 ), 15080 ).
% Frame number: 378
happens( immobile( id1 ), 15120 ). holdsAt( coord( id1 )=( 105, 264 ), 15120 ).
happens( browsing( id2 ), 15120 ). holdsAt( coord( id2 )=( 96, 151 ), 15120 ).
% Frame number: 379
happens( immobile( id1 ), 15160 ). holdsAt( coord( id1 )=( 105, 264 ), 15160 ).
happens( browsing( id2 ), 15160 ). holdsAt( coord( id2 )=( 96, 151 ), 15160 ).
% Frame number: 380
happens( immobile( id1 ), 15200 ). holdsAt( coord( id1 )=( 105, 264 ), 15200 ).
happens( browsing( id2 ), 15200 ). holdsAt( coord( id2 )=( 97, 151 ), 15200 ).
% Frame number: 381
happens( immobile( id1 ), 15240 ). holdsAt( coord( id1 )=( 105, 264 ), 15240 ).
happens( browsing( id2 ), 15240 ). holdsAt( coord( id2 )=( 97, 151 ), 15240 ).
% Frame number: 382
happens( immobile( id1 ), 15280 ). holdsAt( coord( id1 )=( 105, 264 ), 15280 ).
happens( browsing( id2 ), 15280 ). holdsAt( coord( id2 )=( 98, 150 ), 15280 ).
% Frame number: 383
happens( immobile( id1 ), 15320 ). holdsAt( coord( id1 )=( 105, 264 ), 15320 ).
happens( browsing( id2 ), 15320 ). holdsAt( coord( id2 )=( 101, 150 ), 15320 ).
% Frame number: 384
happens( immobile( id1 ), 15360 ). holdsAt( coord( id1 )=( 105, 264 ), 15360 ).
happens( browsing( id2 ), 15360 ). holdsAt( coord( id2 )=( 102, 149 ), 15360 ).
% Frame number: 385
happens( immobile( id1 ), 15400 ). holdsAt( coord( id1 )=( 105, 264 ), 15400 ).
happens( browsing( id2 ), 15400 ). holdsAt( coord( id2 )=( 103, 149 ), 15400 ).
% Frame number: 386
happens( immobile( id1 ), 15440 ). holdsAt( coord( id1 )=( 105, 264 ), 15440 ).
happens( browsing( id2 ), 15440 ). holdsAt( coord( id2 )=( 104, 149 ), 15440 ).
% Frame number: 387
happens( immobile( id1 ), 15480 ). holdsAt( coord( id1 )=( 105, 264 ), 15480 ).
happens( browsing( id2 ), 15480 ). holdsAt( coord( id2 )=( 105, 149 ), 15480 ).
% Frame number: 388
happens( immobile( id1 ), 15520 ). holdsAt( coord( id1 )=( 105, 264 ), 15520 ).
happens( browsing( id2 ), 15520 ). holdsAt( coord( id2 )=( 106, 149 ), 15520 ).
% Frame number: 389
happens( immobile( id1 ), 15560 ). holdsAt( coord( id1 )=( 105, 264 ), 15560 ).
happens( browsing( id2 ), 15560 ). holdsAt( coord( id2 )=( 106, 148 ), 15560 ).
% Frame number: 390
happens( immobile( id1 ), 15600 ). holdsAt( coord( id1 )=( 105, 264 ), 15600 ).
happens( browsing( id2 ), 15600 ). holdsAt( coord( id2 )=( 106, 148 ), 15600 ).
% Frame number: 391
happens( immobile( id1 ), 15640 ). holdsAt( coord( id1 )=( 105, 264 ), 15640 ).
happens( browsing( id2 ), 15640 ). holdsAt( coord( id2 )=( 107, 147 ), 15640 ).
% Frame number: 392
happens( immobile( id1 ), 15680 ). holdsAt( coord( id1 )=( 105, 264 ), 15680 ).
happens( browsing( id2 ), 15680 ). holdsAt( coord( id2 )=( 108, 147 ), 15680 ).
% Frame number: 393
happens( immobile( id1 ), 15720 ). holdsAt( coord( id1 )=( 105, 264 ), 15720 ).
happens( browsing( id2 ), 15720 ). holdsAt( coord( id2 )=( 108, 147 ), 15720 ).
% Frame number: 394
happens( immobile( id1 ), 15760 ). holdsAt( coord( id1 )=( 105, 264 ), 15760 ).
happens( browsing( id2 ), 15760 ). holdsAt( coord( id2 )=( 108, 146 ), 15760 ).
% Frame number: 395
happens( immobile( id1 ), 15800 ). holdsAt( coord( id1 )=( 105, 264 ), 15800 ).
happens( browsing( id2 ), 15800 ). holdsAt( coord( id2 )=( 109, 146 ), 15800 ).
% Frame number: 396
happens( immobile( id1 ), 15840 ). holdsAt( coord( id1 )=( 105, 264 ), 15840 ).
happens( browsing( id2 ), 15840 ). holdsAt( coord( id2 )=( 109, 146 ), 15840 ).
% Frame number: 397
happens( immobile( id1 ), 15880 ). holdsAt( coord( id1 )=( 105, 264 ), 15880 ).
happens( browsing( id2 ), 15880 ). holdsAt( coord( id2 )=( 109, 146 ), 15880 ).
% Frame number: 398
happens( immobile( id1 ), 15920 ). holdsAt( coord( id1 )=( 105, 264 ), 15920 ).
happens( browsing( id2 ), 15920 ). holdsAt( coord( id2 )=( 110, 146 ), 15920 ).
% Frame number: 399
happens( immobile( id1 ), 15960 ). holdsAt( coord( id1 )=( 105, 264 ), 15960 ).
happens( browsing( id2 ), 15960 ). holdsAt( coord( id2 )=( 112, 146 ), 15960 ).
% Frame number: 400
happens( immobile( id1 ), 16000 ). holdsAt( coord( id1 )=( 105, 264 ), 16000 ).
happens( browsing( id2 ), 16000 ). holdsAt( coord( id2 )=( 114, 146 ), 16000 ).
% Frame number: 401
happens( immobile( id1 ), 16040 ). holdsAt( coord( id1 )=( 105, 264 ), 16040 ).
happens( browsing( id2 ), 16040 ). holdsAt( coord( id2 )=( 115, 146 ), 16040 ).
% Frame number: 402
happens( immobile( id1 ), 16080 ). holdsAt( coord( id1 )=( 105, 264 ), 16080 ).
happens( browsing( id2 ), 16080 ). holdsAt( coord( id2 )=( 115, 146 ), 16080 ).
% Frame number: 403
happens( immobile( id1 ), 16120 ). holdsAt( coord( id1 )=( 105, 264 ), 16120 ).
happens( browsing( id2 ), 16120 ). holdsAt( coord( id2 )=( 116, 146 ), 16120 ).
% Frame number: 404
happens( immobile( id1 ), 16160 ). holdsAt( coord( id1 )=( 105, 264 ), 16160 ).
happens( browsing( id2 ), 16160 ). holdsAt( coord( id2 )=( 117, 146 ), 16160 ).
% Frame number: 405
happens( immobile( id1 ), 16200 ). holdsAt( coord( id1 )=( 105, 264 ), 16200 ).
happens( browsing( id2 ), 16200 ). holdsAt( coord( id2 )=( 118, 146 ), 16200 ).
% Frame number: 406
happens( immobile( id1 ), 16240 ). holdsAt( coord( id1 )=( 105, 264 ), 16240 ).
happens( browsing( id2 ), 16240 ). holdsAt( coord( id2 )=( 118, 146 ), 16240 ).
% Frame number: 407
happens( immobile( id1 ), 16280 ). holdsAt( coord( id1 )=( 105, 264 ), 16280 ).
happens( browsing( id2 ), 16280 ). holdsAt( coord( id2 )=( 119, 146 ), 16280 ).
% Frame number: 408
happens( immobile( id1 ), 16320 ). holdsAt( coord( id1 )=( 105, 264 ), 16320 ).
happens( browsing( id2 ), 16320 ). holdsAt( coord( id2 )=( 119, 146 ), 16320 ).
% Frame number: 409
happens( immobile( id1 ), 16360 ). holdsAt( coord( id1 )=( 105, 264 ), 16360 ).
happens( browsing( id2 ), 16360 ). holdsAt( coord( id2 )=( 119, 146 ), 16360 ).
% Frame number: 410
happens( immobile( id1 ), 16400 ). holdsAt( coord( id1 )=( 105, 264 ), 16400 ).
happens( browsing( id2 ), 16400 ). holdsAt( coord( id2 )=( 120, 146 ), 16400 ).
% Frame number: 411
happens( immobile( id1 ), 16440 ). holdsAt( coord( id1 )=( 105, 264 ), 16440 ).
happens( browsing( id2 ), 16440 ). holdsAt( coord( id2 )=( 120, 146 ), 16440 ).
% Frame number: 412
happens( immobile( id1 ), 16480 ). holdsAt( coord( id1 )=( 105, 264 ), 16480 ).
happens( browsing( id2 ), 16480 ). holdsAt( coord( id2 )=( 120, 146 ), 16480 ).
% Frame number: 413
happens( immobile( id1 ), 16520 ). holdsAt( coord( id1 )=( 105, 264 ), 16520 ).
happens( browsing( id2 ), 16520 ). holdsAt( coord( id2 )=( 121, 146 ), 16520 ).
% Frame number: 414
happens( immobile( id1 ), 16560 ). holdsAt( coord( id1 )=( 105, 264 ), 16560 ).
happens( browsing( id2 ), 16560 ). holdsAt( coord( id2 )=( 123, 146 ), 16560 ).
% Frame number: 415
happens( immobile( id1 ), 16600 ). holdsAt( coord( id1 )=( 105, 264 ), 16600 ).
happens( browsing( id2 ), 16600 ). holdsAt( coord( id2 )=( 125, 146 ), 16600 ).
% Frame number: 416
happens( immobile( id1 ), 16640 ). holdsAt( coord( id1 )=( 105, 264 ), 16640 ).
happens( browsing( id2 ), 16640 ). holdsAt( coord( id2 )=( 127, 146 ), 16640 ).
% Frame number: 417
happens( immobile( id1 ), 16680 ). holdsAt( coord( id1 )=( 105, 264 ), 16680 ).
happens( browsing( id2 ), 16680 ). holdsAt( coord( id2 )=( 129, 146 ), 16680 ).
% Frame number: 418
happens( immobile( id1 ), 16720 ). holdsAt( coord( id1 )=( 105, 264 ), 16720 ).
happens( browsing( id2 ), 16720 ). holdsAt( coord( id2 )=( 130, 146 ), 16720 ).
% Frame number: 419
happens( immobile( id1 ), 16760 ). holdsAt( coord( id1 )=( 105, 264 ), 16760 ).
happens( browsing( id2 ), 16760 ). holdsAt( coord( id2 )=( 131, 146 ), 16760 ).
% Frame number: 420
happens( immobile( id1 ), 16800 ). holdsAt( coord( id1 )=( 105, 264 ), 16800 ).
happens( browsing( id2 ), 16800 ). holdsAt( coord( id2 )=( 132, 146 ), 16800 ).
% Frame number: 421
happens( immobile( id1 ), 16840 ). holdsAt( coord( id1 )=( 105, 264 ), 16840 ).
happens( browsing( id2 ), 16840 ). holdsAt( coord( id2 )=( 132, 146 ), 16840 ).
% Frame number: 422
happens( immobile( id1 ), 16880 ). holdsAt( coord( id1 )=( 105, 264 ), 16880 ).
happens( browsing( id2 ), 16880 ). holdsAt( coord( id2 )=( 133, 145 ), 16880 ).
% Frame number: 423
happens( immobile( id1 ), 16920 ). holdsAt( coord( id1 )=( 105, 264 ), 16920 ).
happens( browsing( id2 ), 16920 ). holdsAt( coord( id2 )=( 133, 145 ), 16920 ).
% Frame number: 424
happens( immobile( id1 ), 16960 ). holdsAt( coord( id1 )=( 105, 264 ), 16960 ).
happens( browsing( id2 ), 16960 ). holdsAt( coord( id2 )=( 134, 144 ), 16960 ).
% Frame number: 425
happens( immobile( id1 ), 17000 ). holdsAt( coord( id1 )=( 105, 264 ), 17000 ).
happens( browsing( id2 ), 17000 ). holdsAt( coord( id2 )=( 134, 144 ), 17000 ).
% Frame number: 426
happens( immobile( id1 ), 17040 ). holdsAt( coord( id1 )=( 105, 264 ), 17040 ).
happens( browsing( id2 ), 17040 ). holdsAt( coord( id2 )=( 134, 144 ), 17040 ).
% Frame number: 427
happens( immobile( id1 ), 17080 ). holdsAt( coord( id1 )=( 105, 264 ), 17080 ).
happens( browsing( id2 ), 17080 ). holdsAt( coord( id2 )=( 134, 144 ), 17080 ).
% Frame number: 428
happens( immobile( id1 ), 17120 ). holdsAt( coord( id1 )=( 105, 264 ), 17120 ).
happens( browsing( id2 ), 17120 ). holdsAt( coord( id2 )=( 135, 144 ), 17120 ).
% Frame number: 429
happens( immobile( id1 ), 17160 ). holdsAt( coord( id1 )=( 105, 264 ), 17160 ).
happens( browsing( id2 ), 17160 ). holdsAt( coord( id2 )=( 135, 144 ), 17160 ).
% Frame number: 430
happens( immobile( id1 ), 17200 ). holdsAt( coord( id1 )=( 105, 264 ), 17200 ).
happens( browsing( id2 ), 17200 ). holdsAt( coord( id2 )=( 136, 144 ), 17200 ).
% Frame number: 431
happens( immobile( id1 ), 17240 ). holdsAt( coord( id1 )=( 105, 264 ), 17240 ).
happens( browsing( id2 ), 17240 ). holdsAt( coord( id2 )=( 138, 145 ), 17240 ).
% Frame number: 432
happens( immobile( id1 ), 17280 ). holdsAt( coord( id1 )=( 105, 264 ), 17280 ).
happens( browsing( id2 ), 17280 ). holdsAt( coord( id2 )=( 140, 145 ), 17280 ).
% Frame number: 433
happens( immobile( id1 ), 17320 ). holdsAt( coord( id1 )=( 105, 264 ), 17320 ).
happens( browsing( id2 ), 17320 ). holdsAt( coord( id2 )=( 141, 145 ), 17320 ).
% Frame number: 434
happens( immobile( id1 ), 17360 ). holdsAt( coord( id1 )=( 105, 264 ), 17360 ).
happens( browsing( id2 ), 17360 ). holdsAt( coord( id2 )=( 142, 146 ), 17360 ).
% Frame number: 435
happens( immobile( id1 ), 17400 ). holdsAt( coord( id1 )=( 105, 264 ), 17400 ).
happens( browsing( id2 ), 17400 ). holdsAt( coord( id2 )=( 144, 146 ), 17400 ).
% Frame number: 436
happens( immobile( id1 ), 17440 ). holdsAt( coord( id1 )=( 105, 264 ), 17440 ).
happens( browsing( id2 ), 17440 ). holdsAt( coord( id2 )=( 144, 146 ), 17440 ).
% Frame number: 437
happens( immobile( id1 ), 17480 ). holdsAt( coord( id1 )=( 105, 264 ), 17480 ).
happens( browsing( id2 ), 17480 ). holdsAt( coord( id2 )=( 145, 146 ), 17480 ).
% Frame number: 438
happens( immobile( id1 ), 17520 ). holdsAt( coord( id1 )=( 105, 264 ), 17520 ).
happens( browsing( id2 ), 17520 ). holdsAt( coord( id2 )=( 146, 146 ), 17520 ).
% Frame number: 439
happens( immobile( id1 ), 17560 ). holdsAt( coord( id1 )=( 105, 264 ), 17560 ).
happens( browsing( id2 ), 17560 ). holdsAt( coord( id2 )=( 146, 147 ), 17560 ).
% Frame number: 440
happens( immobile( id1 ), 17600 ). holdsAt( coord( id1 )=( 105, 264 ), 17600 ).
happens( browsing( id2 ), 17600 ). holdsAt( coord( id2 )=( 146, 147 ), 17600 ).
% Frame number: 441
happens( immobile( id1 ), 17640 ). holdsAt( coord( id1 )=( 105, 264 ), 17640 ).
happens( browsing( id2 ), 17640 ). holdsAt( coord( id2 )=( 146, 147 ), 17640 ).
% Frame number: 442
happens( immobile( id1 ), 17680 ). holdsAt( coord( id1 )=( 105, 264 ), 17680 ).
happens( browsing( id2 ), 17680 ). holdsAt( coord( id2 )=( 146, 147 ), 17680 ).
% Frame number: 443
happens( immobile( id1 ), 17720 ). holdsAt( coord( id1 )=( 105, 264 ), 17720 ).
happens( browsing( id2 ), 17720 ). holdsAt( coord( id2 )=( 148, 147 ), 17720 ).
% Frame number: 444
happens( immobile( id1 ), 17760 ). holdsAt( coord( id1 )=( 105, 264 ), 17760 ).
happens( browsing( id2 ), 17760 ). holdsAt( coord( id2 )=( 148, 147 ), 17760 ).
% Frame number: 445
happens( immobile( id1 ), 17800 ). holdsAt( coord( id1 )=( 105, 264 ), 17800 ).
happens( browsing( id2 ), 17800 ). holdsAt( coord( id2 )=( 148, 147 ), 17800 ).
% Frame number: 446
happens( immobile( id1 ), 17840 ). holdsAt( coord( id1 )=( 105, 264 ), 17840 ).
happens( browsing( id2 ), 17840 ). holdsAt( coord( id2 )=( 151, 147 ), 17840 ).
% Frame number: 447
happens( immobile( id1 ), 17880 ). holdsAt( coord( id1 )=( 105, 264 ), 17880 ).
happens( browsing( id2 ), 17880 ). holdsAt( coord( id2 )=( 153, 147 ), 17880 ).
% Frame number: 448
happens( immobile( id1 ), 17920 ). holdsAt( coord( id1 )=( 105, 264 ), 17920 ).
happens( browsing( id2 ), 17920 ). holdsAt( coord( id2 )=( 155, 148 ), 17920 ).
% Frame number: 449
happens( immobile( id1 ), 17960 ). holdsAt( coord( id1 )=( 105, 264 ), 17960 ).
happens( browsing( id2 ), 17960 ). holdsAt( coord( id2 )=( 156, 148 ), 17960 ).
% Frame number: 450
happens( immobile( id1 ), 18000 ). holdsAt( coord( id1 )=( 105, 264 ), 18000 ).
happens( browsing( id2 ), 18000 ). holdsAt( coord( id2 )=( 158, 148 ), 18000 ).
% Frame number: 451
happens( immobile( id1 ), 18040 ). holdsAt( coord( id1 )=( 105, 264 ), 18040 ).
happens( browsing( id2 ), 18040 ). holdsAt( coord( id2 )=( 159, 149 ), 18040 ).
% Frame number: 452
happens( immobile( id1 ), 18080 ). holdsAt( coord( id1 )=( 105, 264 ), 18080 ).
happens( browsing( id2 ), 18080 ). holdsAt( coord( id2 )=( 160, 149 ), 18080 ).
% Frame number: 453
happens( immobile( id1 ), 18120 ). holdsAt( coord( id1 )=( 105, 264 ), 18120 ).
happens( browsing( id2 ), 18120 ). holdsAt( coord( id2 )=( 160, 149 ), 18120 ).
% Frame number: 454
happens( immobile( id1 ), 18160 ). holdsAt( coord( id1 )=( 105, 264 ), 18160 ).
happens( browsing( id2 ), 18160 ). holdsAt( coord( id2 )=( 161, 149 ), 18160 ).
% Frame number: 455
happens( immobile( id1 ), 18200 ). holdsAt( coord( id1 )=( 105, 264 ), 18200 ).
happens( browsing( id2 ), 18200 ). holdsAt( coord( id2 )=( 161, 149 ), 18200 ).
% Frame number: 456
happens( immobile( id1 ), 18240 ). holdsAt( coord( id1 )=( 105, 264 ), 18240 ).
happens( browsing( id2 ), 18240 ). holdsAt( coord( id2 )=( 162, 148 ), 18240 ).
% Frame number: 457
happens( immobile( id1 ), 18280 ). holdsAt( coord( id1 )=( 105, 264 ), 18280 ).
happens( browsing( id2 ), 18280 ). holdsAt( coord( id2 )=( 162, 148 ), 18280 ).
% Frame number: 458
happens( immobile( id1 ), 18320 ). holdsAt( coord( id1 )=( 105, 264 ), 18320 ).
happens( browsing( id2 ), 18320 ). holdsAt( coord( id2 )=( 162, 148 ), 18320 ).
% Frame number: 459
happens( immobile( id1 ), 18360 ). holdsAt( coord( id1 )=( 105, 264 ), 18360 ).
happens( browsing( id2 ), 18360 ). holdsAt( coord( id2 )=( 162, 148 ), 18360 ).
% Frame number: 460
happens( immobile( id1 ), 18400 ). holdsAt( coord( id1 )=( 105, 264 ), 18400 ).
happens( browsing( id2 ), 18400 ). holdsAt( coord( id2 )=( 163, 148 ), 18400 ).
% Frame number: 461
happens( immobile( id1 ), 18440 ). holdsAt( coord( id1 )=( 105, 264 ), 18440 ).
happens( browsing( id2 ), 18440 ). holdsAt( coord( id2 )=( 163, 149 ), 18440 ).
% Frame number: 462
happens( immobile( id1 ), 18480 ). holdsAt( coord( id1 )=( 105, 264 ), 18480 ).
happens( browsing( id2 ), 18480 ). holdsAt( coord( id2 )=( 164, 150 ), 18480 ).
% Frame number: 463
happens( immobile( id1 ), 18520 ). holdsAt( coord( id1 )=( 105, 264 ), 18520 ).
happens( browsing( id2 ), 18520 ). holdsAt( coord( id2 )=( 164, 151 ), 18520 ).
% Frame number: 464
happens( immobile( id1 ), 18560 ). holdsAt( coord( id1 )=( 105, 264 ), 18560 ).
happens( browsing( id2 ), 18560 ). holdsAt( coord( id2 )=( 164, 152 ), 18560 ).
% Frame number: 465
happens( immobile( id1 ), 18600 ). holdsAt( coord( id1 )=( 105, 264 ), 18600 ).
happens( browsing( id2 ), 18600 ). holdsAt( coord( id2 )=( 165, 154 ), 18600 ).
% Frame number: 466
happens( immobile( id1 ), 18640 ). holdsAt( coord( id1 )=( 105, 264 ), 18640 ).
happens( browsing( id2 ), 18640 ). holdsAt( coord( id2 )=( 165, 155 ), 18640 ).
% Frame number: 467
happens( immobile( id1 ), 18680 ). holdsAt( coord( id1 )=( 105, 264 ), 18680 ).
happens( browsing( id2 ), 18680 ). holdsAt( coord( id2 )=( 166, 157 ), 18680 ).
% Frame number: 468
happens( immobile( id1 ), 18720 ). holdsAt( coord( id1 )=( 105, 264 ), 18720 ).
happens( browsing( id2 ), 18720 ). holdsAt( coord( id2 )=( 166, 158 ), 18720 ).
% Frame number: 469
happens( immobile( id1 ), 18760 ). holdsAt( coord( id1 )=( 105, 264 ), 18760 ).
happens( browsing( id2 ), 18760 ). holdsAt( coord( id2 )=( 167, 160 ), 18760 ).
% Frame number: 470
happens( immobile( id1 ), 18800 ). holdsAt( coord( id1 )=( 105, 264 ), 18800 ).
happens( browsing( id2 ), 18800 ). holdsAt( coord( id2 )=( 167, 160 ), 18800 ).
% Frame number: 471
happens( immobile( id1 ), 18840 ). holdsAt( coord( id1 )=( 105, 264 ), 18840 ).
happens( browsing( id2 ), 18840 ). holdsAt( coord( id2 )=( 168, 161 ), 18840 ).
% Frame number: 472
happens( immobile( id1 ), 18880 ). holdsAt( coord( id1 )=( 105, 264 ), 18880 ).
happens( browsing( id2 ), 18880 ). holdsAt( coord( id2 )=( 168, 161 ), 18880 ).
% Frame number: 473
happens( immobile( id1 ), 18920 ). holdsAt( coord( id1 )=( 105, 264 ), 18920 ).
happens( browsing( id2 ), 18920 ). holdsAt( coord( id2 )=( 168, 162 ), 18920 ).
% Frame number: 474
happens( immobile( id1 ), 18960 ). holdsAt( coord( id1 )=( 105, 264 ), 18960 ).
happens( browsing( id2 ), 18960 ). holdsAt( coord( id2 )=( 168, 163 ), 18960 ).
% Frame number: 475
happens( immobile( id1 ), 19000 ). holdsAt( coord( id1 )=( 105, 264 ), 19000 ).
happens( browsing( id2 ), 19000 ). holdsAt( coord( id2 )=( 168, 163 ), 19000 ).
% Frame number: 476
happens( immobile( id1 ), 19040 ). holdsAt( coord( id1 )=( 105, 264 ), 19040 ).
happens( browsing( id2 ), 19040 ). holdsAt( coord( id2 )=( 168, 164 ), 19040 ).
% Frame number: 477
happens( immobile( id1 ), 19080 ). holdsAt( coord( id1 )=( 105, 264 ), 19080 ).
happens( browsing( id2 ), 19080 ). holdsAt( coord( id2 )=( 168, 164 ), 19080 ).
% Frame number: 478
happens( immobile( id1 ), 19120 ). holdsAt( coord( id1 )=( 105, 264 ), 19120 ).
happens( browsing( id2 ), 19120 ). holdsAt( coord( id2 )=( 169, 165 ), 19120 ).
% Frame number: 479
happens( immobile( id1 ), 19160 ). holdsAt( coord( id1 )=( 105, 264 ), 19160 ).
happens( browsing( id2 ), 19160 ). holdsAt( coord( id2 )=( 169, 165 ), 19160 ).
% Frame number: 480
happens( immobile( id1 ), 19200 ). holdsAt( coord( id1 )=( 105, 264 ), 19200 ).
happens( browsing( id2 ), 19200 ). holdsAt( coord( id2 )=( 170, 165 ), 19200 ).
% Frame number: 481
happens( immobile( id1 ), 19240 ). holdsAt( coord( id1 )=( 105, 264 ), 19240 ).
happens( browsing( id2 ), 19240 ). holdsAt( coord( id2 )=( 171, 166 ), 19240 ).
% Frame number: 482
happens( immobile( id1 ), 19280 ). holdsAt( coord( id1 )=( 105, 264 ), 19280 ).
happens( browsing( id2 ), 19280 ). holdsAt( coord( id2 )=( 172, 166 ), 19280 ).
% Frame number: 483
happens( immobile( id1 ), 19320 ). holdsAt( coord( id1 )=( 105, 264 ), 19320 ).
happens( browsing( id2 ), 19320 ). holdsAt( coord( id2 )=( 174, 168 ), 19320 ).
% Frame number: 484
happens( immobile( id1 ), 19360 ). holdsAt( coord( id1 )=( 105, 264 ), 19360 ).
happens( browsing( id2 ), 19360 ). holdsAt( coord( id2 )=( 175, 168 ), 19360 ).
% Frame number: 485
happens( immobile( id1 ), 19400 ). holdsAt( coord( id1 )=( 105, 264 ), 19400 ).
happens( browsing( id2 ), 19400 ). holdsAt( coord( id2 )=( 176, 170 ), 19400 ).
% Frame number: 486
happens( immobile( id1 ), 19440 ). holdsAt( coord( id1 )=( 105, 264 ), 19440 ).
happens( browsing( id2 ), 19440 ). holdsAt( coord( id2 )=( 177, 172 ), 19440 ).
% Frame number: 487
happens( immobile( id1 ), 19480 ). holdsAt( coord( id1 )=( 105, 264 ), 19480 ).
happens( browsing( id2 ), 19480 ). holdsAt( coord( id2 )=( 178, 174 ), 19480 ).
% Frame number: 488
happens( immobile( id1 ), 19520 ). holdsAt( coord( id1 )=( 105, 264 ), 19520 ).
happens( browsing( id2 ), 19520 ). holdsAt( coord( id2 )=( 178, 175 ), 19520 ).
% Frame number: 489
happens( immobile( id1 ), 19560 ). holdsAt( coord( id1 )=( 105, 264 ), 19560 ).
happens( browsing( id2 ), 19560 ). holdsAt( coord( id2 )=( 179, 176 ), 19560 ).
% Frame number: 490
happens( immobile( id1 ), 19600 ). holdsAt( coord( id1 )=( 105, 264 ), 19600 ).
happens( browsing( id2 ), 19600 ). holdsAt( coord( id2 )=( 179, 177 ), 19600 ).
% Frame number: 491
happens( immobile( id1 ), 19640 ). holdsAt( coord( id1 )=( 105, 264 ), 19640 ).
happens( browsing( id2 ), 19640 ). holdsAt( coord( id2 )=( 179, 177 ), 19640 ).
% Frame number: 492
happens( immobile( id1 ), 19680 ). holdsAt( coord( id1 )=( 105, 264 ), 19680 ).
happens( browsing( id2 ), 19680 ). holdsAt( coord( id2 )=( 179, 177 ), 19680 ).
% Frame number: 493
happens( immobile( id1 ), 19720 ). holdsAt( coord( id1 )=( 105, 264 ), 19720 ).
happens( browsing( id2 ), 19720 ). holdsAt( coord( id2 )=( 179, 178 ), 19720 ).
% Frame number: 494
happens( immobile( id1 ), 19760 ). holdsAt( coord( id1 )=( 105, 264 ), 19760 ).
happens( browsing( id2 ), 19760 ). holdsAt( coord( id2 )=( 179, 178 ), 19760 ).
% Frame number: 495
happens( immobile( id1 ), 19800 ). holdsAt( coord( id1 )=( 105, 264 ), 19800 ).
happens( browsing( id2 ), 19800 ). holdsAt( coord( id2 )=( 180, 179 ), 19800 ).
% Frame number: 496
happens( immobile( id1 ), 19840 ). holdsAt( coord( id1 )=( 105, 264 ), 19840 ).
happens( browsing( id2 ), 19840 ). holdsAt( coord( id2 )=( 180, 180 ), 19840 ).
% Frame number: 497
happens( immobile( id1 ), 19880 ). holdsAt( coord( id1 )=( 104, 263 ), 19880 ).
happens( browsing( id2 ), 19880 ). holdsAt( coord( id2 )=( 180, 180 ), 19880 ).
% Frame number: 498
happens( immobile( id1 ), 19920 ). holdsAt( coord( id1 )=( 104, 263 ), 19920 ).
happens( browsing( id2 ), 19920 ). holdsAt( coord( id2 )=( 181, 181 ), 19920 ).
% Frame number: 499
happens( immobile( id1 ), 19960 ). holdsAt( coord( id1 )=( 104, 263 ), 19960 ).
happens( browsing( id2 ), 19960 ). holdsAt( coord( id2 )=( 181, 182 ), 19960 ).
% Frame number: 500
happens( immobile( id1 ), 20000 ). holdsAt( coord( id1 )=( 104, 263 ), 20000 ).
happens( browsing( id2 ), 20000 ). holdsAt( coord( id2 )=( 181, 183 ), 20000 ).
% Frame number: 501
happens( immobile( id1 ), 20040 ). holdsAt( coord( id1 )=( 104, 263 ), 20040 ).
happens( browsing( id2 ), 20040 ). holdsAt( coord( id2 )=( 181, 183 ), 20040 ).
% Frame number: 502
happens( immobile( id1 ), 20080 ). holdsAt( coord( id1 )=( 104, 263 ), 20080 ).
happens( browsing( id2 ), 20080 ). holdsAt( coord( id2 )=( 181, 184 ), 20080 ).
% Frame number: 503
happens( immobile( id1 ), 20120 ). holdsAt( coord( id1 )=( 104, 263 ), 20120 ).
happens( browsing( id2 ), 20120 ). holdsAt( coord( id2 )=( 181, 186 ), 20120 ).
% Frame number: 504
happens( immobile( id1 ), 20160 ). holdsAt( coord( id1 )=( 103, 263 ), 20160 ).
happens( browsing( id2 ), 20160 ). holdsAt( coord( id2 )=( 181, 188 ), 20160 ).
% Frame number: 505
happens( immobile( id1 ), 20200 ). holdsAt( coord( id1 )=( 103, 263 ), 20200 ).
happens( browsing( id2 ), 20200 ). holdsAt( coord( id2 )=( 181, 189 ), 20200 ).
% Frame number: 506
happens( immobile( id1 ), 20240 ). holdsAt( coord( id1 )=( 103, 263 ), 20240 ).
happens( browsing( id2 ), 20240 ). holdsAt( coord( id2 )=( 181, 190 ), 20240 ).
% Frame number: 507
happens( immobile( id1 ), 20280 ). holdsAt( coord( id1 )=( 103, 263 ), 20280 ).
happens( browsing( id2 ), 20280 ). holdsAt( coord( id2 )=( 181, 192 ), 20280 ).
% Frame number: 508
happens( immobile( id1 ), 20320 ). holdsAt( coord( id1 )=( 103, 263 ), 20320 ).
happens( browsing( id2 ), 20320 ). holdsAt( coord( id2 )=( 181, 192 ), 20320 ).
% Frame number: 509
happens( immobile( id1 ), 20360 ). holdsAt( coord( id1 )=( 103, 263 ), 20360 ).
happens( browsing( id2 ), 20360 ). holdsAt( coord( id2 )=( 181, 193 ), 20360 ).
% Frame number: 510
happens( immobile( id1 ), 20400 ). holdsAt( coord( id1 )=( 102, 263 ), 20400 ).
happens( browsing( id2 ), 20400 ). holdsAt( coord( id2 )=( 181, 193 ), 20400 ).
% Frame number: 511
happens( immobile( id1 ), 20440 ). holdsAt( coord( id1 )=( 102, 263 ), 20440 ).
happens( browsing( id2 ), 20440 ). holdsAt( coord( id2 )=( 181, 194 ), 20440 ).
% Frame number: 512
happens( immobile( id1 ), 20480 ). holdsAt( coord( id1 )=( 102, 263 ), 20480 ).
happens( browsing( id2 ), 20480 ). holdsAt( coord( id2 )=( 181, 195 ), 20480 ).
% Frame number: 513
happens( immobile( id1 ), 20520 ). holdsAt( coord( id1 )=( 102, 263 ), 20520 ).
happens( browsing( id2 ), 20520 ). holdsAt( coord( id2 )=( 181, 195 ), 20520 ).
% Frame number: 514
happens( immobile( id1 ), 20560 ). holdsAt( coord( id1 )=( 102, 263 ), 20560 ).
happens( browsing( id2 ), 20560 ). holdsAt( coord( id2 )=( 181, 196 ), 20560 ).
% Frame number: 515
happens( immobile( id1 ), 20600 ). holdsAt( coord( id1 )=( 102, 262 ), 20600 ).
happens( browsing( id2 ), 20600 ). holdsAt( coord( id2 )=( 181, 196 ), 20600 ).
% Frame number: 516
happens( immobile( id1 ), 20640 ). holdsAt( coord( id1 )=( 102, 262 ), 20640 ).
happens( browsing( id2 ), 20640 ). holdsAt( coord( id2 )=( 180, 196 ), 20640 ).
% Frame number: 517
happens( immobile( id1 ), 20680 ). holdsAt( coord( id1 )=( 101, 261 ), 20680 ).
happens( browsing( id2 ), 20680 ). holdsAt( coord( id2 )=( 180, 197 ), 20680 ).
% Frame number: 518
happens( immobile( id1 ), 20720 ). holdsAt( coord( id1 )=( 101, 261 ), 20720 ).
happens( browsing( id2 ), 20720 ). holdsAt( coord( id2 )=( 180, 197 ), 20720 ).
% Frame number: 519
happens( immobile( id1 ), 20760 ). holdsAt( coord( id1 )=( 101, 261 ), 20760 ).
happens( browsing( id2 ), 20760 ). holdsAt( coord( id2 )=( 180, 197 ), 20760 ).
% Frame number: 520
happens( immobile( id1 ), 20800 ). holdsAt( coord( id1 )=( 101, 260 ), 20800 ).
happens( browsing( id2 ), 20800 ). holdsAt( coord( id2 )=( 180, 198 ), 20800 ).
% Frame number: 521
happens( immobile( id1 ), 20840 ). holdsAt( coord( id1 )=( 101, 260 ), 20840 ).
happens( browsing( id2 ), 20840 ). holdsAt( coord( id2 )=( 179, 198 ), 20840 ).
% Frame number: 522
happens( immobile( id1 ), 20880 ). holdsAt( coord( id1 )=( 101, 259 ), 20880 ).
happens( browsing( id2 ), 20880 ). holdsAt( coord( id2 )=( 179, 199 ), 20880 ).
% Frame number: 523
happens( immobile( id1 ), 20920 ). holdsAt( coord( id1 )=( 101, 259 ), 20920 ).
happens( browsing( id2 ), 20920 ). holdsAt( coord( id2 )=( 179, 201 ), 20920 ).
% Frame number: 524
happens( immobile( id1 ), 20960 ). holdsAt( coord( id1 )=( 101, 258 ), 20960 ).
happens( browsing( id2 ), 20960 ). holdsAt( coord( id2 )=( 177, 202 ), 20960 ).
% Frame number: 525
happens( immobile( id1 ), 21000 ). holdsAt( coord( id1 )=( 101, 258 ), 21000 ).
happens( browsing( id2 ), 21000 ). holdsAt( coord( id2 )=( 177, 204 ), 21000 ).
% Frame number: 526
happens( immobile( id1 ), 21040 ). holdsAt( coord( id1 )=( 100, 257 ), 21040 ).
happens( browsing( id2 ), 21040 ). holdsAt( coord( id2 )=( 177, 205 ), 21040 ).
% Frame number: 527
happens( immobile( id1 ), 21080 ). holdsAt( coord( id1 )=( 100, 257 ), 21080 ).
happens( browsing( id2 ), 21080 ). holdsAt( coord( id2 )=( 176, 206 ), 21080 ).
% Frame number: 528
happens( immobile( id1 ), 21120 ). holdsAt( coord( id1 )=( 100, 257 ), 21120 ).
happens( browsing( id2 ), 21120 ). holdsAt( coord( id2 )=( 175, 207 ), 21120 ).
% Frame number: 529
happens( immobile( id1 ), 21160 ). holdsAt( coord( id1 )=( 100, 257 ), 21160 ).
happens( browsing( id2 ), 21160 ). holdsAt( coord( id2 )=( 175, 207 ), 21160 ).
% Frame number: 530
happens( immobile( id1 ), 21200 ). holdsAt( coord( id1 )=( 100, 257 ), 21200 ).
happens( browsing( id2 ), 21200 ). holdsAt( coord( id2 )=( 175, 207 ), 21200 ).
% Frame number: 531
happens( immobile( id1 ), 21240 ). holdsAt( coord( id1 )=( 100, 257 ), 21240 ).
happens( browsing( id2 ), 21240 ). holdsAt( coord( id2 )=( 175, 207 ), 21240 ).
% Frame number: 532
happens( immobile( id1 ), 21280 ). holdsAt( coord( id1 )=( 100, 257 ), 21280 ).
happens( browsing( id2 ), 21280 ). holdsAt( coord( id2 )=( 174, 207 ), 21280 ).
% Frame number: 533
happens( immobile( id1 ), 21320 ). holdsAt( coord( id1 )=( 100, 256 ), 21320 ).
happens( browsing( id2 ), 21320 ). holdsAt( coord( id2 )=( 174, 207 ), 21320 ).
% Frame number: 534
happens( immobile( id1 ), 21360 ). holdsAt( coord( id1 )=( 99, 255 ), 21360 ).
happens( browsing( id2 ), 21360 ). holdsAt( coord( id2 )=( 174, 208 ), 21360 ).
% Frame number: 535
happens( immobile( id1 ), 21400 ). holdsAt( coord( id1 )=( 99, 255 ), 21400 ).
happens( browsing( id2 ), 21400 ). holdsAt( coord( id2 )=( 173, 208 ), 21400 ).
% Frame number: 536
happens( immobile( id1 ), 21440 ). holdsAt( coord( id1 )=( 99, 254 ), 21440 ).
happens( browsing( id2 ), 21440 ). holdsAt( coord( id2 )=( 172, 209 ), 21440 ).
% Frame number: 537
happens( immobile( id1 ), 21480 ). holdsAt( coord( id1 )=( 99, 254 ), 21480 ).
happens( browsing( id2 ), 21480 ). holdsAt( coord( id2 )=( 171, 210 ), 21480 ).
% Frame number: 538
happens( immobile( id1 ), 21520 ). holdsAt( coord( id1 )=( 99, 254 ), 21520 ).
happens( browsing( id2 ), 21520 ). holdsAt( coord( id2 )=( 171, 211 ), 21520 ).
% Frame number: 539
happens( immobile( id1 ), 21560 ). holdsAt( coord( id1 )=( 99, 253 ), 21560 ).
happens( browsing( id2 ), 21560 ). holdsAt( coord( id2 )=( 170, 211 ), 21560 ).
% Frame number: 540
happens( immobile( id1 ), 21600 ). holdsAt( coord( id1 )=( 99, 253 ), 21600 ).
happens( browsing( id2 ), 21600 ). holdsAt( coord( id2 )=( 170, 212 ), 21600 ).
% Frame number: 541
happens( immobile( id1 ), 21640 ). holdsAt( coord( id1 )=( 99, 253 ), 21640 ).
happens( browsing( id2 ), 21640 ). holdsAt( coord( id2 )=( 169, 212 ), 21640 ).
% Frame number: 542
happens( immobile( id1 ), 21680 ). holdsAt( coord( id1 )=( 99, 253 ), 21680 ).
happens( browsing( id2 ), 21680 ). holdsAt( coord( id2 )=( 168, 212 ), 21680 ).
% Frame number: 543
happens( immobile( id1 ), 21720 ). holdsAt( coord( id1 )=( 99, 252 ), 21720 ).
happens( browsing( id2 ), 21720 ). holdsAt( coord( id2 )=( 168, 212 ), 21720 ).
% Frame number: 544
happens( immobile( id1 ), 21760 ). holdsAt( coord( id1 )=( 99, 252 ), 21760 ).
happens( browsing( id2 ), 21760 ). holdsAt( coord( id2 )=( 167, 212 ), 21760 ).
% Frame number: 545
happens( immobile( id1 ), 21800 ). holdsAt( coord( id1 )=( 99, 252 ), 21800 ).
happens( browsing( id2 ), 21800 ). holdsAt( coord( id2 )=( 167, 212 ), 21800 ).
% Frame number: 546
happens( immobile( id1 ), 21840 ). holdsAt( coord( id1 )=( 99, 252 ), 21840 ).
happens( browsing( id2 ), 21840 ). holdsAt( coord( id2 )=( 166, 211 ), 21840 ).
% Frame number: 547
happens( immobile( id1 ), 21880 ). holdsAt( coord( id1 )=( 99, 252 ), 21880 ).
happens( browsing( id2 ), 21880 ). holdsAt( coord( id2 )=( 166, 211 ), 21880 ).
% Frame number: 548
happens( immobile( id1 ), 21920 ). holdsAt( coord( id1 )=( 99, 250 ), 21920 ).
happens( browsing( id2 ), 21920 ). holdsAt( coord( id2 )=( 166, 210 ), 21920 ).
% Frame number: 549
happens( immobile( id1 ), 21960 ). holdsAt( coord( id1 )=( 99, 250 ), 21960 ).
happens( browsing( id2 ), 21960 ). holdsAt( coord( id2 )=( 165, 209 ), 21960 ).
% Frame number: 550
happens( immobile( id1 ), 22000 ). holdsAt( coord( id1 )=( 99, 250 ), 22000 ).
happens( browsing( id2 ), 22000 ). holdsAt( coord( id2 )=( 165, 208 ), 22000 ).
% Frame number: 551
happens( immobile( id1 ), 22040 ). holdsAt( coord( id1 )=( 99, 250 ), 22040 ).
happens( browsing( id2 ), 22040 ). holdsAt( coord( id2 )=( 164, 208 ), 22040 ).
% Frame number: 552
happens( immobile( id1 ), 22080 ). holdsAt( coord( id1 )=( 99, 249 ), 22080 ).
happens( browsing( id2 ), 22080 ). holdsAt( coord( id2 )=( 163, 207 ), 22080 ).
% Frame number: 553
happens( immobile( id1 ), 22120 ). holdsAt( coord( id1 )=( 99, 249 ), 22120 ).
happens( browsing( id2 ), 22120 ). holdsAt( coord( id2 )=( 162, 207 ), 22120 ).
% Frame number: 554
happens( immobile( id1 ), 22160 ). holdsAt( coord( id1 )=( 99, 249 ), 22160 ).
happens( browsing( id2 ), 22160 ). holdsAt( coord( id2 )=( 160, 206 ), 22160 ).
% Frame number: 555
happens( immobile( id1 ), 22200 ). holdsAt( coord( id1 )=( 99, 249 ), 22200 ).
happens( browsing( id2 ), 22200 ). holdsAt( coord( id2 )=( 158, 206 ), 22200 ).
% Frame number: 556
happens( immobile( id1 ), 22240 ). holdsAt( coord( id1 )=( 99, 249 ), 22240 ).
happens( browsing( id2 ), 22240 ). holdsAt( coord( id2 )=( 158, 205 ), 22240 ).
% Frame number: 557
happens( immobile( id1 ), 22280 ). holdsAt( coord( id1 )=( 99, 249 ), 22280 ).
happens( browsing( id2 ), 22280 ). holdsAt( coord( id2 )=( 155, 205 ), 22280 ).
% Frame number: 558
happens( immobile( id1 ), 22320 ). holdsAt( coord( id1 )=( 99, 249 ), 22320 ).
happens( browsing( id2 ), 22320 ). holdsAt( coord( id2 )=( 154, 205 ), 22320 ).
% Frame number: 559
happens( immobile( id1 ), 22360 ). holdsAt( coord( id1 )=( 99, 249 ), 22360 ).
happens( browsing( id2 ), 22360 ). holdsAt( coord( id2 )=( 153, 205 ), 22360 ).
% Frame number: 560
happens( immobile( id1 ), 22400 ). holdsAt( coord( id1 )=( 99, 249 ), 22400 ).
happens( browsing( id2 ), 22400 ). holdsAt( coord( id2 )=( 153, 205 ), 22400 ).
% Frame number: 561
happens( immobile( id1 ), 22440 ). holdsAt( coord( id1 )=( 99, 249 ), 22440 ).
happens( browsing( id2 ), 22440 ). holdsAt( coord( id2 )=( 152, 205 ), 22440 ).
% Frame number: 562
happens( immobile( id1 ), 22480 ). holdsAt( coord( id1 )=( 99, 249 ), 22480 ).
happens( browsing( id2 ), 22480 ). holdsAt( coord( id2 )=( 152, 206 ), 22480 ).
% Frame number: 563
happens( immobile( id1 ), 22520 ). holdsAt( coord( id1 )=( 99, 248 ), 22520 ).
happens( browsing( id2 ), 22520 ). holdsAt( coord( id2 )=( 152, 206 ), 22520 ).
% Frame number: 564
happens( immobile( id1 ), 22560 ). holdsAt( coord( id1 )=( 99, 248 ), 22560 ).
happens( browsing( id2 ), 22560 ). holdsAt( coord( id2 )=( 152, 206 ), 22560 ).
% Frame number: 565
happens( immobile( id1 ), 22600 ). holdsAt( coord( id1 )=( 99, 248 ), 22600 ).
happens( browsing( id2 ), 22600 ). holdsAt( coord( id2 )=( 151, 206 ), 22600 ).
% Frame number: 566
happens( immobile( id1 ), 22640 ). holdsAt( coord( id1 )=( 99, 248 ), 22640 ).
happens( browsing( id2 ), 22640 ). holdsAt( coord( id2 )=( 151, 206 ), 22640 ).
% Frame number: 567
happens( immobile( id1 ), 22680 ). holdsAt( coord( id1 )=( 99, 248 ), 22680 ).
happens( browsing( id2 ), 22680 ). holdsAt( coord( id2 )=( 151, 206 ), 22680 ).
% Frame number: 568
happens( immobile( id1 ), 22720 ). holdsAt( coord( id1 )=( 99, 248 ), 22720 ).
happens( browsing( id2 ), 22720 ). holdsAt( coord( id2 )=( 150, 206 ), 22720 ).
% Frame number: 569
happens( immobile( id1 ), 22760 ). holdsAt( coord( id1 )=( 99, 248 ), 22760 ).
happens( browsing( id2 ), 22760 ). holdsAt( coord( id2 )=( 150, 207 ), 22760 ).
% Frame number: 570
happens( immobile( id1 ), 22800 ). holdsAt( coord( id1 )=( 99, 248 ), 22800 ).
happens( browsing( id2 ), 22800 ). holdsAt( coord( id2 )=( 149, 208 ), 22800 ).
% Frame number: 571
happens( immobile( id1 ), 22840 ). holdsAt( coord( id1 )=( 99, 248 ), 22840 ).
happens( browsing( id2 ), 22840 ). holdsAt( coord( id2 )=( 148, 209 ), 22840 ).
% Frame number: 572
happens( immobile( id1 ), 22880 ). holdsAt( coord( id1 )=( 99, 249 ), 22880 ).
happens( browsing( id2 ), 22880 ). holdsAt( coord( id2 )=( 147, 209 ), 22880 ).
% Frame number: 573
happens( immobile( id1 ), 22920 ). holdsAt( coord( id1 )=( 99, 249 ), 22920 ).
happens( browsing( id2 ), 22920 ). holdsAt( coord( id2 )=( 145, 209 ), 22920 ).
% Frame number: 574
happens( immobile( id1 ), 22960 ). holdsAt( coord( id1 )=( 99, 249 ), 22960 ).
happens( browsing( id2 ), 22960 ). holdsAt( coord( id2 )=( 144, 209 ), 22960 ).
% Frame number: 575
happens( immobile( id1 ), 23000 ). holdsAt( coord( id1 )=( 99, 249 ), 23000 ).
happens( browsing( id2 ), 23000 ). holdsAt( coord( id2 )=( 143, 209 ), 23000 ).
% Frame number: 576
happens( immobile( id1 ), 23040 ). holdsAt( coord( id1 )=( 99, 249 ), 23040 ).
happens( browsing( id2 ), 23040 ). holdsAt( coord( id2 )=( 141, 210 ), 23040 ).
% Frame number: 577
happens( immobile( id1 ), 23080 ). holdsAt( coord( id1 )=( 99, 249 ), 23080 ).
happens( browsing( id2 ), 23080 ). holdsAt( coord( id2 )=( 141, 210 ), 23080 ).
% Frame number: 578
happens( immobile( id1 ), 23120 ). holdsAt( coord( id1 )=( 99, 249 ), 23120 ).
happens( browsing( id2 ), 23120 ). holdsAt( coord( id2 )=( 139, 210 ), 23120 ).
% Frame number: 579
happens( immobile( id1 ), 23160 ). holdsAt( coord( id1 )=( 100, 249 ), 23160 ).
happens( browsing( id2 ), 23160 ). holdsAt( coord( id2 )=( 138, 210 ), 23160 ).
% Frame number: 580
happens( immobile( id1 ), 23200 ). holdsAt( coord( id1 )=( 100, 249 ), 23200 ).
happens( browsing( id2 ), 23200 ). holdsAt( coord( id2 )=( 138, 210 ), 23200 ).
% Frame number: 581
happens( immobile( id1 ), 23240 ). holdsAt( coord( id1 )=( 100, 249 ), 23240 ).
happens( browsing( id2 ), 23240 ). holdsAt( coord( id2 )=( 137, 210 ), 23240 ).
% Frame number: 582
happens( immobile( id1 ), 23280 ). holdsAt( coord( id1 )=( 100, 249 ), 23280 ).
happens( browsing( id2 ), 23280 ). holdsAt( coord( id2 )=( 137, 210 ), 23280 ).
% Frame number: 583
happens( immobile( id1 ), 23320 ). holdsAt( coord( id1 )=( 100, 249 ), 23320 ).
happens( browsing( id2 ), 23320 ). holdsAt( coord( id2 )=( 136, 210 ), 23320 ).
% Frame number: 584
happens( immobile( id1 ), 23360 ). holdsAt( coord( id1 )=( 100, 249 ), 23360 ).
happens( browsing( id2 ), 23360 ). holdsAt( coord( id2 )=( 136, 210 ), 23360 ).
% Frame number: 585
happens( immobile( id1 ), 23400 ). holdsAt( coord( id1 )=( 100, 249 ), 23400 ).
happens( browsing( id2 ), 23400 ). holdsAt( coord( id2 )=( 136, 211 ), 23400 ).
% Frame number: 586
happens( immobile( id1 ), 23440 ). holdsAt( coord( id1 )=( 100, 249 ), 23440 ).
happens( browsing( id2 ), 23440 ). holdsAt( coord( id2 )=( 136, 211 ), 23440 ).
% Frame number: 587
happens( immobile( id1 ), 23480 ). holdsAt( coord( id1 )=( 100, 249 ), 23480 ).
happens( browsing( id2 ), 23480 ). holdsAt( coord( id2 )=( 136, 211 ), 23480 ).
% Frame number: 588
happens( immobile( id1 ), 23520 ). holdsAt( coord( id1 )=( 100, 249 ), 23520 ).
happens( browsing( id2 ), 23520 ). holdsAt( coord( id2 )=( 135, 211 ), 23520 ).
% Frame number: 589
happens( immobile( id1 ), 23560 ). holdsAt( coord( id1 )=( 100, 249 ), 23560 ).
happens( browsing( id2 ), 23560 ). holdsAt( coord( id2 )=( 135, 211 ), 23560 ).
% Frame number: 590
happens( immobile( id1 ), 23600 ). holdsAt( coord( id1 )=( 100, 249 ), 23600 ).
happens( browsing( id2 ), 23600 ). holdsAt( coord( id2 )=( 135, 211 ), 23600 ).
% Frame number: 591
happens( immobile( id1 ), 23640 ). holdsAt( coord( id1 )=( 100, 249 ), 23640 ).
happens( browsing( id2 ), 23640 ). holdsAt( coord( id2 )=( 135, 211 ), 23640 ).
% Frame number: 592
happens( immobile( id1 ), 23680 ). holdsAt( coord( id1 )=( 100, 249 ), 23680 ).
happens( browsing( id2 ), 23680 ). holdsAt( coord( id2 )=( 135, 211 ), 23680 ).
% Frame number: 593
happens( immobile( id1 ), 23720 ). holdsAt( coord( id1 )=( 100, 249 ), 23720 ).
happens( browsing( id2 ), 23720 ). holdsAt( coord( id2 )=( 134, 211 ), 23720 ).
% Frame number: 594
happens( immobile( id1 ), 23760 ). holdsAt( coord( id1 )=( 100, 249 ), 23760 ).
happens( browsing( id2 ), 23760 ). holdsAt( coord( id2 )=( 134, 211 ), 23760 ).
% Frame number: 595
happens( immobile( id1 ), 23800 ). holdsAt( coord( id1 )=( 100, 249 ), 23800 ).
happens( browsing( id2 ), 23800 ). holdsAt( coord( id2 )=( 134, 211 ), 23800 ).
% Frame number: 596
happens( immobile( id1 ), 23840 ). holdsAt( coord( id1 )=( 100, 249 ), 23840 ).
happens( browsing( id2 ), 23840 ). holdsAt( coord( id2 )=( 134, 211 ), 23840 ).
% Frame number: 597
happens( immobile( id1 ), 23880 ). holdsAt( coord( id1 )=( 100, 249 ), 23880 ).
happens( browsing( id2 ), 23880 ). holdsAt( coord( id2 )=( 134, 211 ), 23880 ).
% Frame number: 598
happens( immobile( id1 ), 23920 ). holdsAt( coord( id1 )=( 100, 249 ), 23920 ).
happens( browsing( id2 ), 23920 ). holdsAt( coord( id2 )=( 134, 211 ), 23920 ).
% Frame number: 599
happens( immobile( id1 ), 23960 ). holdsAt( coord( id1 )=( 100, 249 ), 23960 ).
happens( browsing( id2 ), 23960 ). holdsAt( coord( id2 )=( 134, 211 ), 23960 ).
% Frame number: 600
happens( immobile( id1 ), 24000 ). holdsAt( coord( id1 )=( 101, 250 ), 24000 ).
happens( browsing( id2 ), 24000 ). holdsAt( coord( id2 )=( 134, 211 ), 24000 ).
% Frame number: 601
happens( immobile( id1 ), 24040 ). holdsAt( coord( id1 )=( 101, 250 ), 24040 ).
happens( browsing( id2 ), 24040 ). holdsAt( coord( id2 )=( 134, 211 ), 24040 ).
% Frame number: 602
happens( immobile( id1 ), 24080 ). holdsAt( coord( id1 )=( 101, 250 ), 24080 ).
happens( browsing( id2 ), 24080 ). holdsAt( coord( id2 )=( 134, 211 ), 24080 ).
% Frame number: 603
happens( immobile( id1 ), 24120 ). holdsAt( coord( id1 )=( 101, 250 ), 24120 ).
happens( browsing( id2 ), 24120 ). holdsAt( coord( id2 )=( 134, 211 ), 24120 ).
% Frame number: 604
happens( immobile( id1 ), 24160 ). holdsAt( coord( id1 )=( 101, 250 ), 24160 ).
happens( browsing( id2 ), 24160 ). holdsAt( coord( id2 )=( 134, 211 ), 24160 ).
% Frame number: 605
happens( immobile( id1 ), 24200 ). holdsAt( coord( id1 )=( 101, 250 ), 24200 ).
happens( browsing( id2 ), 24200 ). holdsAt( coord( id2 )=( 135, 211 ), 24200 ).
% Frame number: 606
happens( immobile( id1 ), 24240 ). holdsAt( coord( id1 )=( 101, 250 ), 24240 ).
happens( browsing( id2 ), 24240 ). holdsAt( coord( id2 )=( 135, 211 ), 24240 ).
% Frame number: 607
happens( immobile( id1 ), 24280 ). holdsAt( coord( id1 )=( 101, 250 ), 24280 ).
happens( browsing( id2 ), 24280 ). holdsAt( coord( id2 )=( 135, 211 ), 24280 ).
% Frame number: 608
happens( immobile( id1 ), 24320 ). holdsAt( coord( id1 )=( 101, 250 ), 24320 ).
happens( browsing( id2 ), 24320 ). holdsAt( coord( id2 )=( 135, 212 ), 24320 ).
% Frame number: 609
happens( immobile( id1 ), 24360 ). holdsAt( coord( id1 )=( 101, 250 ), 24360 ).
happens( browsing( id2 ), 24360 ). holdsAt( coord( id2 )=( 136, 212 ), 24360 ).
% Frame number: 610
happens( immobile( id1 ), 24400 ). holdsAt( coord( id1 )=( 101, 251 ), 24400 ).
happens( browsing( id2 ), 24400 ). holdsAt( coord( id2 )=( 137, 212 ), 24400 ).
% Frame number: 611
happens( immobile( id1 ), 24440 ). holdsAt( coord( id1 )=( 101, 251 ), 24440 ).
happens( browsing( id2 ), 24440 ). holdsAt( coord( id2 )=( 138, 211 ), 24440 ).
% Frame number: 612
happens( immobile( id1 ), 24480 ). holdsAt( coord( id1 )=( 101, 251 ), 24480 ).
happens( browsing( id2 ), 24480 ). holdsAt( coord( id2 )=( 139, 211 ), 24480 ).
% Frame number: 613
happens( immobile( id1 ), 24520 ). holdsAt( coord( id1 )=( 101, 251 ), 24520 ).
happens( browsing( id2 ), 24520 ). holdsAt( coord( id2 )=( 139, 210 ), 24520 ).
% Frame number: 614
happens( immobile( id1 ), 24560 ). holdsAt( coord( id1 )=( 101, 251 ), 24560 ).
happens( browsing( id2 ), 24560 ). holdsAt( coord( id2 )=( 140, 209 ), 24560 ).
% Frame number: 615
happens( immobile( id1 ), 24600 ). holdsAt( coord( id1 )=( 101, 252 ), 24600 ).
happens( browsing( id2 ), 24600 ). holdsAt( coord( id2 )=( 140, 208 ), 24600 ).
% Frame number: 616
happens( immobile( id1 ), 24640 ). holdsAt( coord( id1 )=( 101, 252 ), 24640 ).
happens( browsing( id2 ), 24640 ). holdsAt( coord( id2 )=( 141, 207 ), 24640 ).
% Frame number: 617
happens( immobile( id1 ), 24680 ). holdsAt( coord( id1 )=( 101, 253 ), 24680 ).
happens( browsing( id2 ), 24680 ). holdsAt( coord( id2 )=( 142, 206 ), 24680 ).
% Frame number: 618
happens( immobile( id1 ), 24720 ). holdsAt( coord( id1 )=( 101, 253 ), 24720 ).
happens( browsing( id2 ), 24720 ). holdsAt( coord( id2 )=( 142, 206 ), 24720 ).
% Frame number: 619
happens( immobile( id1 ), 24760 ). holdsAt( coord( id1 )=( 101, 253 ), 24760 ).
happens( browsing( id2 ), 24760 ). holdsAt( coord( id2 )=( 143, 207 ), 24760 ).
% Frame number: 620
happens( immobile( id1 ), 24800 ). holdsAt( coord( id1 )=( 101, 253 ), 24800 ).
happens( browsing( id2 ), 24800 ). holdsAt( coord( id2 )=( 144, 206 ), 24800 ).
% Frame number: 621
happens( immobile( id1 ), 24840 ). holdsAt( coord( id1 )=( 101, 254 ), 24840 ).
happens( browsing( id2 ), 24840 ). holdsAt( coord( id2 )=( 144, 207 ), 24840 ).
% Frame number: 622
happens( immobile( id1 ), 24880 ). holdsAt( coord( id1 )=( 101, 254 ), 24880 ).
happens( browsing( id2 ), 24880 ). holdsAt( coord( id2 )=( 145, 207 ), 24880 ).
% Frame number: 623
happens( immobile( id1 ), 24920 ). holdsAt( coord( id1 )=( 101, 254 ), 24920 ).
happens( browsing( id2 ), 24920 ). holdsAt( coord( id2 )=( 146, 207 ), 24920 ).
% Frame number: 624
happens( immobile( id1 ), 24960 ). holdsAt( coord( id1 )=( 101, 254 ), 24960 ).
happens( browsing( id2 ), 24960 ). holdsAt( coord( id2 )=( 146, 207 ), 24960 ).
% Frame number: 625
happens( immobile( id1 ), 25000 ). holdsAt( coord( id1 )=( 101, 254 ), 25000 ).
happens( browsing( id2 ), 25000 ). holdsAt( coord( id2 )=( 149, 207 ), 25000 ).
% Frame number: 626
happens( immobile( id1 ), 25040 ). holdsAt( coord( id1 )=( 101, 255 ), 25040 ).
happens( browsing( id2 ), 25040 ). holdsAt( coord( id2 )=( 152, 208 ), 25040 ).
% Frame number: 627
happens( immobile( id1 ), 25080 ). holdsAt( coord( id1 )=( 101, 255 ), 25080 ).
happens( browsing( id2 ), 25080 ). holdsAt( coord( id2 )=( 155, 209 ), 25080 ).
% Frame number: 628
happens( immobile( id1 ), 25120 ). holdsAt( coord( id1 )=( 101, 255 ), 25120 ).
happens( browsing( id2 ), 25120 ). holdsAt( coord( id2 )=( 157, 209 ), 25120 ).
% Frame number: 629
happens( immobile( id1 ), 25160 ). holdsAt( coord( id1 )=( 102, 256 ), 25160 ).
happens( browsing( id2 ), 25160 ). holdsAt( coord( id2 )=( 160, 211 ), 25160 ).
% Frame number: 630
happens( immobile( id1 ), 25200 ). holdsAt( coord( id1 )=( 102, 256 ), 25200 ).
happens( browsing( id2 ), 25200 ). holdsAt( coord( id2 )=( 164, 211 ), 25200 ).
% Frame number: 631
happens( immobile( id1 ), 25240 ). holdsAt( coord( id1 )=( 102, 256 ), 25240 ).
happens( browsing( id2 ), 25240 ). holdsAt( coord( id2 )=( 164, 211 ), 25240 ).
% Frame number: 632
happens( immobile( id1 ), 25280 ). holdsAt( coord( id1 )=( 102, 256 ), 25280 ).
happens( browsing( id2 ), 25280 ). holdsAt( coord( id2 )=( 165, 211 ), 25280 ).
% Frame number: 633
happens( immobile( id1 ), 25320 ). holdsAt( coord( id1 )=( 102, 256 ), 25320 ).
happens( browsing( id2 ), 25320 ). holdsAt( coord( id2 )=( 167, 212 ), 25320 ).
% Frame number: 634
happens( immobile( id1 ), 25360 ). holdsAt( coord( id1 )=( 102, 256 ), 25360 ).
happens( browsing( id2 ), 25360 ). holdsAt( coord( id2 )=( 167, 212 ), 25360 ).
% Frame number: 635
happens( immobile( id1 ), 25400 ). holdsAt( coord( id1 )=( 102, 257 ), 25400 ).
happens( browsing( id2 ), 25400 ). holdsAt( coord( id2 )=( 168, 213 ), 25400 ).
% Frame number: 636
happens( immobile( id1 ), 25440 ). holdsAt( coord( id1 )=( 102, 257 ), 25440 ).
happens( browsing( id2 ), 25440 ). holdsAt( coord( id2 )=( 169, 215 ), 25440 ).
% Frame number: 637
happens( immobile( id1 ), 25480 ). holdsAt( coord( id1 )=( 102, 257 ), 25480 ).
happens( browsing( id2 ), 25480 ). holdsAt( coord( id2 )=( 169, 215 ), 25480 ).
% Frame number: 638
happens( immobile( id1 ), 25520 ). holdsAt( coord( id1 )=( 102, 257 ), 25520 ).
happens( browsing( id2 ), 25520 ). holdsAt( coord( id2 )=( 170, 216 ), 25520 ).
% Frame number: 639
happens( immobile( id1 ), 25560 ). holdsAt( coord( id1 )=( 102, 257 ), 25560 ).
happens( browsing( id2 ), 25560 ). holdsAt( coord( id2 )=( 174, 217 ), 25560 ).
% Frame number: 640
happens( immobile( id1 ), 25600 ). holdsAt( coord( id1 )=( 102, 257 ), 25600 ).
happens( browsing( id2 ), 25600 ). holdsAt( coord( id2 )=( 178, 217 ), 25600 ).
% Frame number: 641
happens( immobile( id1 ), 25640 ). holdsAt( coord( id1 )=( 102, 257 ), 25640 ).
happens( browsing( id2 ), 25640 ). holdsAt( coord( id2 )=( 180, 217 ), 25640 ).
% Frame number: 642
happens( immobile( id1 ), 25680 ). holdsAt( coord( id1 )=( 102, 257 ), 25680 ).
happens( browsing( id2 ), 25680 ). holdsAt( coord( id2 )=( 183, 216 ), 25680 ).
% Frame number: 643
happens( immobile( id1 ), 25720 ). holdsAt( coord( id1 )=( 102, 257 ), 25720 ).
happens( browsing( id2 ), 25720 ). holdsAt( coord( id2 )=( 185, 218 ), 25720 ).
% Frame number: 644
happens( immobile( id1 ), 25760 ). holdsAt( coord( id1 )=( 102, 257 ), 25760 ).
happens( browsing( id2 ), 25760 ). holdsAt( coord( id2 )=( 187, 218 ), 25760 ).
% Frame number: 645
happens( immobile( id1 ), 25800 ). holdsAt( coord( id1 )=( 102, 257 ), 25800 ).
happens( browsing( id2 ), 25800 ). holdsAt( coord( id2 )=( 188, 219 ), 25800 ).
% Frame number: 646
happens( immobile( id1 ), 25840 ). holdsAt( coord( id1 )=( 102, 257 ), 25840 ).
happens( browsing( id2 ), 25840 ). holdsAt( coord( id2 )=( 189, 220 ), 25840 ).
% Frame number: 647
happens( immobile( id1 ), 25880 ). holdsAt( coord( id1 )=( 102, 257 ), 25880 ).
happens( browsing( id2 ), 25880 ). holdsAt( coord( id2 )=( 190, 221 ), 25880 ).
% Frame number: 648
happens( immobile( id1 ), 25920 ). holdsAt( coord( id1 )=( 102, 257 ), 25920 ).
happens( browsing( id2 ), 25920 ). holdsAt( coord( id2 )=( 190, 223 ), 25920 ).
% Frame number: 649
happens( immobile( id1 ), 25960 ). holdsAt( coord( id1 )=( 102, 257 ), 25960 ).
happens( browsing( id2 ), 25960 ). holdsAt( coord( id2 )=( 191, 224 ), 25960 ).
% Frame number: 650
happens( immobile( id1 ), 26000 ). holdsAt( coord( id1 )=( 102, 257 ), 26000 ).
happens( browsing( id2 ), 26000 ). holdsAt( coord( id2 )=( 192, 226 ), 26000 ).
% Frame number: 651
happens( immobile( id1 ), 26040 ). holdsAt( coord( id1 )=( 102, 257 ), 26040 ).
happens( browsing( id2 ), 26040 ). holdsAt( coord( id2 )=( 193, 228 ), 26040 ).
% Frame number: 652
happens( immobile( id1 ), 26080 ). holdsAt( coord( id1 )=( 102, 257 ), 26080 ).
happens( browsing( id2 ), 26080 ). holdsAt( coord( id2 )=( 193, 230 ), 26080 ).
% Frame number: 653
happens( immobile( id1 ), 26120 ). holdsAt( coord( id1 )=( 102, 257 ), 26120 ).
happens( browsing( id2 ), 26120 ). holdsAt( coord( id2 )=( 194, 232 ), 26120 ).
% Frame number: 654
happens( immobile( id1 ), 26160 ). holdsAt( coord( id1 )=( 102, 257 ), 26160 ).
happens( browsing( id2 ), 26160 ). holdsAt( coord( id2 )=( 196, 235 ), 26160 ).
% Frame number: 655
happens( immobile( id1 ), 26200 ). holdsAt( coord( id1 )=( 102, 257 ), 26200 ).
happens( browsing( id2 ), 26200 ). holdsAt( coord( id2 )=( 198, 237 ), 26200 ).
% Frame number: 656
happens( immobile( id1 ), 26240 ). holdsAt( coord( id1 )=( 102, 257 ), 26240 ).
happens( browsing( id2 ), 26240 ). holdsAt( coord( id2 )=( 199, 239 ), 26240 ).
% Frame number: 657
happens( immobile( id1 ), 26280 ). holdsAt( coord( id1 )=( 102, 257 ), 26280 ).
happens( browsing( id2 ), 26280 ). holdsAt( coord( id2 )=( 200, 239 ), 26280 ).
% Frame number: 658
happens( immobile( id1 ), 26320 ). holdsAt( coord( id1 )=( 102, 257 ), 26320 ).
happens( browsing( id2 ), 26320 ). holdsAt( coord( id2 )=( 201, 240 ), 26320 ).
% Frame number: 659
happens( immobile( id1 ), 26360 ). holdsAt( coord( id1 )=( 102, 257 ), 26360 ).
happens( browsing( id2 ), 26360 ). holdsAt( coord( id2 )=( 203, 240 ), 26360 ).
% Frame number: 660
happens( immobile( id1 ), 26400 ). holdsAt( coord( id1 )=( 102, 257 ), 26400 ).
happens( browsing( id2 ), 26400 ). holdsAt( coord( id2 )=( 205, 241 ), 26400 ).
% Frame number: 661
happens( immobile( id1 ), 26440 ). holdsAt( coord( id1 )=( 102, 257 ), 26440 ).
happens( browsing( id2 ), 26440 ). holdsAt( coord( id2 )=( 205, 242 ), 26440 ).
% Frame number: 662
happens( immobile( id1 ), 26480 ). holdsAt( coord( id1 )=( 102, 257 ), 26480 ).
happens( browsing( id2 ), 26480 ). holdsAt( coord( id2 )=( 205, 244 ), 26480 ).
% Frame number: 663
happens( immobile( id1 ), 26520 ). holdsAt( coord( id1 )=( 102, 257 ), 26520 ).
happens( browsing( id2 ), 26520 ). holdsAt( coord( id2 )=( 205, 246 ), 26520 ).
% Frame number: 664
happens( immobile( id1 ), 26560 ). holdsAt( coord( id1 )=( 102, 257 ), 26560 ).
happens( browsing( id2 ), 26560 ). holdsAt( coord( id2 )=( 206, 249 ), 26560 ).
% Frame number: 665
happens( immobile( id1 ), 26600 ). holdsAt( coord( id1 )=( 102, 257 ), 26600 ).
happens( browsing( id2 ), 26600 ). holdsAt( coord( id2 )=( 206, 252 ), 26600 ).
% Frame number: 666
happens( immobile( id1 ), 26640 ). holdsAt( coord( id1 )=( 102, 257 ), 26640 ).
happens( browsing( id2 ), 26640 ). holdsAt( coord( id2 )=( 208, 255 ), 26640 ).
% Frame number: 667
happens( immobile( id1 ), 26680 ). holdsAt( coord( id1 )=( 102, 257 ), 26680 ).
happens( browsing( id2 ), 26680 ). holdsAt( coord( id2 )=( 211, 258 ), 26680 ).
% Frame number: 668
happens( immobile( id1 ), 26720 ). holdsAt( coord( id1 )=( 102, 257 ), 26720 ).
happens( browsing( id2 ), 26720 ). holdsAt( coord( id2 )=( 214, 260 ), 26720 ).
% Frame number: 669
happens( immobile( id1 ), 26760 ). holdsAt( coord( id1 )=( 102, 257 ), 26760 ).
happens( browsing( id2 ), 26760 ). holdsAt( coord( id2 )=( 215, 262 ), 26760 ).
% Frame number: 670
happens( immobile( id1 ), 26800 ). holdsAt( coord( id1 )=( 102, 257 ), 26800 ).
happens( browsing( id2 ), 26800 ). holdsAt( coord( id2 )=( 216, 263 ), 26800 ).
% Frame number: 671
happens( immobile( id1 ), 26840 ). holdsAt( coord( id1 )=( 102, 257 ), 26840 ).
happens( browsing( id2 ), 26840 ). holdsAt( coord( id2 )=( 217, 264 ), 26840 ).
% Frame number: 672
happens( immobile( id1 ), 26880 ). holdsAt( coord( id1 )=( 102, 257 ), 26880 ).
happens( browsing( id2 ), 26880 ). holdsAt( coord( id2 )=( 218, 265 ), 26880 ).
% Frame number: 673
happens( immobile( id1 ), 26920 ). holdsAt( coord( id1 )=( 102, 257 ), 26920 ).
happens( browsing( id2 ), 26920 ). holdsAt( coord( id2 )=( 219, 267 ), 26920 ).
% Frame number: 674
happens( immobile( id1 ), 26960 ). holdsAt( coord( id1 )=( 102, 257 ), 26960 ).
happens( browsing( id2 ), 26960 ). holdsAt( coord( id2 )=( 219, 268 ), 26960 ).
% Frame number: 675
happens( immobile( id1 ), 27000 ). holdsAt( coord( id1 )=( 102, 257 ), 27000 ).
happens( browsing( id2 ), 27000 ). holdsAt( coord( id2 )=( 220, 269 ), 27000 ).
% Frame number: 676
happens( immobile( id1 ), 27040 ). holdsAt( coord( id1 )=( 102, 257 ), 27040 ).
happens( browsing( id2 ), 27040 ). holdsAt( coord( id2 )=( 220, 271 ), 27040 ).
% Frame number: 677
happens( immobile( id1 ), 27080 ). holdsAt( coord( id1 )=( 102, 257 ), 27080 ).
happens( browsing( id2 ), 27080 ). holdsAt( coord( id2 )=( 220, 273 ), 27080 ).
% Frame number: 678
happens( immobile( id1 ), 27120 ). holdsAt( coord( id1 )=( 102, 257 ), 27120 ).
happens( browsing( id2 ), 27120 ). holdsAt( coord( id2 )=( 221, 274 ), 27120 ).
% Frame number: 679
happens( immobile( id1 ), 27160 ). holdsAt( coord( id1 )=( 102, 257 ), 27160 ).
happens( browsing( id2 ), 27160 ). holdsAt( coord( id2 )=( 221, 276 ), 27160 ).
% Frame number: 680
happens( immobile( id1 ), 27200 ). holdsAt( coord( id1 )=( 102, 257 ), 27200 ).
happens( browsing( id2 ), 27200 ). holdsAt( coord( id2 )=( 221, 278 ), 27200 ).
% Frame number: 681
happens( immobile( id1 ), 27240 ). holdsAt( coord( id1 )=( 102, 257 ), 27240 ).
happens( browsing( id2 ), 27240 ). holdsAt( coord( id2 )=( 221, 279 ), 27240 ).
% Frame number: 682
happens( immobile( id1 ), 27280 ). holdsAt( coord( id1 )=( 102, 257 ), 27280 ).
happens( browsing( id2 ), 27280 ). holdsAt( coord( id2 )=( 222, 279 ), 27280 ).
% Frame number: 683
happens( immobile( id1 ), 27320 ). holdsAt( coord( id1 )=( 102, 257 ), 27320 ).
happens( browsing( id2 ), 27320 ). holdsAt( coord( id2 )=( 222, 279 ), 27320 ).
% Frame number: 684
happens( immobile( id1 ), 27360 ). holdsAt( coord( id1 )=( 102, 257 ), 27360 ).
happens( browsing( id2 ), 27360 ). holdsAt( coord( id2 )=( 228, 279 ), 27360 ).
% Frame number: 685
happens( immobile( id1 ), 27400 ). holdsAt( coord( id1 )=( 102, 257 ), 27400 ).
happens( browsing( id2 ), 27400 ). holdsAt( coord( id2 )=( 229, 279 ), 27400 ).
% Frame number: 686
happens( immobile( id1 ), 27440 ). holdsAt( coord( id1 )=( 102, 257 ), 27440 ).
happens( browsing( id2 ), 27440 ). holdsAt( coord( id2 )=( 234, 279 ), 27440 ).
% Frame number: 687
happens( immobile( id1 ), 27480 ). holdsAt( coord( id1 )=( 102, 257 ), 27480 ).
happens( browsing( id2 ), 27480 ). holdsAt( coord( id2 )=( 236, 279 ), 27480 ).
% Frame number: 688
happens( immobile( id1 ), 27520 ). holdsAt( coord( id1 )=( 102, 257 ), 27520 ).
happens( browsing( id2 ), 27520 ). holdsAt( coord( id2 )=( 236, 279 ), 27520 ).
% Frame number: 689
happens( immobile( id1 ), 27560 ). holdsAt( coord( id1 )=( 102, 257 ), 27560 ).
happens( browsing( id2 ), 27560 ). holdsAt( coord( id2 )=( 237, 279 ), 27560 ).
% Frame number: 690
happens( immobile( id1 ), 27600 ). holdsAt( coord( id1 )=( 102, 257 ), 27600 ).
happens( browsing( id2 ), 27600 ). holdsAt( coord( id2 )=( 237, 281 ), 27600 ).
% Frame number: 691
happens( immobile( id1 ), 27640 ). holdsAt( coord( id1 )=( 102, 257 ), 27640 ).
happens( browsing( id2 ), 27640 ). holdsAt( coord( id2 )=( 237, 283 ), 27640 ).
% Frame number: 692
happens( immobile( id1 ), 27680 ). holdsAt( coord( id1 )=( 102, 257 ), 27680 ).
% Frame number: 693
happens( immobile( id1 ), 27720 ). holdsAt( coord( id1 )=( 102, 257 ), 27720 ).
% Frame number: 694
happens( immobile( id1 ), 27760 ). holdsAt( coord( id1 )=( 102, 257 ), 27760 ).
% Frame number: 695
happens( immobile( id1 ), 27800 ). holdsAt( coord( id1 )=( 102, 257 ), 27800 ).
% Frame number: 696
happens( immobile( id1 ), 27840 ). holdsAt( coord( id1 )=( 102, 257 ), 27840 ).
% Frame number: 697
happens( immobile( id1 ), 27880 ). holdsAt( coord( id1 )=( 102, 257 ), 27880 ).
% Frame number: 698
happens( immobile( id1 ), 27920 ). holdsAt( coord( id1 )=( 102, 257 ), 27920 ).
% Frame number: 699
happens( immobile( id1 ), 27960 ). holdsAt( coord( id1 )=( 102, 257 ), 27960 ).
% Frame number: 700
happens( immobile( id1 ), 28000 ). holdsAt( coord( id1 )=( 102, 257 ), 28000 ).
% Frame number: 701
happens( immobile( id1 ), 28040 ). holdsAt( coord( id1 )=( 102, 257 ), 28040 ).
% Frame number: 702
happens( immobile( id1 ), 28080 ). holdsAt( coord( id1 )=( 102, 257 ), 28080 ).
% Frame number: 703
happens( immobile( id1 ), 28120 ). holdsAt( coord( id1 )=( 102, 257 ), 28120 ).
% Frame number: 704
happens( immobile( id1 ), 28160 ). holdsAt( coord( id1 )=( 102, 257 ), 28160 ).
% Frame number: 705
happens( immobile( id1 ), 28200 ). holdsAt( coord( id1 )=( 102, 257 ), 28200 ).
% Frame number: 706
happens( immobile( id1 ), 28240 ). holdsAt( coord( id1 )=( 102, 257 ), 28240 ).
% Frame number: 707
happens( immobile( id1 ), 28280 ). holdsAt( coord( id1 )=( 102, 257 ), 28280 ).
% Frame number: 708
happens( immobile( id1 ), 28320 ). holdsAt( coord( id1 )=( 102, 257 ), 28320 ).
% Frame number: 709
happens( immobile( id1 ), 28360 ). holdsAt( coord( id1 )=( 102, 257 ), 28360 ).
% Frame number: 710
happens( immobile( id1 ), 28400 ). holdsAt( coord( id1 )=( 102, 257 ), 28400 ).
% Frame number: 711
happens( immobile( id1 ), 28440 ). holdsAt( coord( id1 )=( 102, 257 ), 28440 ).
% Frame number: 712
happens( immobile( id1 ), 28480 ). holdsAt( coord( id1 )=( 102, 257 ), 28480 ).
% Frame number: 713
happens( immobile( id1 ), 28520 ). holdsAt( coord( id1 )=( 102, 257 ), 28520 ).
% Frame number: 714
happens( immobile( id1 ), 28560 ). holdsAt( coord( id1 )=( 102, 257 ), 28560 ).
% Frame number: 715
happens( immobile( id1 ), 28600 ). holdsAt( coord( id1 )=( 101, 257 ), 28600 ).
% Frame number: 716
happens( immobile( id1 ), 28640 ). holdsAt( coord( id1 )=( 101, 257 ), 28640 ).
% Frame number: 717
happens( immobile( id1 ), 28680 ). holdsAt( coord( id1 )=( 101, 257 ), 28680 ).
% Frame number: 718
happens( immobile( id1 ), 28720 ). holdsAt( coord( id1 )=( 101, 257 ), 28720 ).
% Frame number: 719
happens( immobile( id1 ), 28760 ). holdsAt( coord( id1 )=( 101, 257 ), 28760 ).
% Frame number: 720
happens( immobile( id1 ), 28800 ). holdsAt( coord( id1 )=( 101, 257 ), 28800 ).
% Frame number: 721
happens( immobile( id1 ), 28840 ). holdsAt( coord( id1 )=( 101, 256 ), 28840 ).
% Frame number: 722
happens( immobile( id1 ), 28880 ). holdsAt( coord( id1 )=( 101, 256 ), 28880 ).
% Frame number: 723
happens( immobile( id1 ), 28920 ). holdsAt( coord( id1 )=( 101, 255 ), 28920 ).
% Frame number: 724
happens( immobile( id1 ), 28960 ). holdsAt( coord( id1 )=( 101, 254 ), 28960 ).
% Frame number: 725
happens( immobile( id1 ), 29000 ). holdsAt( coord( id1 )=( 101, 254 ), 29000 ).
% Frame number: 726
happens( immobile( id1 ), 29040 ). holdsAt( coord( id1 )=( 101, 253 ), 29040 ).
% Frame number: 727
happens( immobile( id1 ), 29080 ). holdsAt( coord( id1 )=( 101, 253 ), 29080 ).
% Frame number: 728
happens( immobile( id1 ), 29120 ). holdsAt( coord( id1 )=( 101, 253 ), 29120 ).
% Frame number: 729
happens( immobile( id1 ), 29160 ). holdsAt( coord( id1 )=( 101, 252 ), 29160 ).
% Frame number: 730
happens( immobile( id1 ), 29200 ). holdsAt( coord( id1 )=( 101, 252 ), 29200 ).
% Frame number: 731
happens( immobile( id1 ), 29240 ). holdsAt( coord( id1 )=( 101, 252 ), 29240 ).
% Frame number: 732
happens( immobile( id1 ), 29280 ). holdsAt( coord( id1 )=( 101, 252 ), 29280 ).
% Frame number: 733
happens( immobile( id1 ), 29320 ). holdsAt( coord( id1 )=( 101, 252 ), 29320 ).
% Frame number: 734
happens( immobile( id1 ), 29360 ). holdsAt( coord( id1 )=( 101, 251 ), 29360 ).
% Frame number: 735
happens( immobile( id1 ), 29400 ). holdsAt( coord( id1 )=( 101, 251 ), 29400 ).
% Frame number: 736
happens( immobile( id1 ), 29440 ). holdsAt( coord( id1 )=( 101, 251 ), 29440 ).
% Frame number: 737
happens( immobile( id1 ), 29480 ). holdsAt( coord( id1 )=( 101, 251 ), 29480 ).
% Frame number: 738
happens( immobile( id1 ), 29520 ). holdsAt( coord( id1 )=( 101, 251 ), 29520 ).
% Frame number: 739
happens( immobile( id1 ), 29560 ). holdsAt( coord( id1 )=( 101, 250 ), 29560 ).
% Frame number: 740
happens( immobile( id1 ), 29600 ). holdsAt( coord( id1 )=( 101, 250 ), 29600 ).
% Frame number: 741
happens( immobile( id1 ), 29640 ). holdsAt( coord( id1 )=( 101, 250 ), 29640 ).
% Frame number: 742
happens( immobile( id1 ), 29680 ). holdsAt( coord( id1 )=( 101, 250 ), 29680 ).
% Frame number: 743
happens( immobile( id1 ), 29720 ). holdsAt( coord( id1 )=( 101, 250 ), 29720 ).
% Frame number: 744
happens( immobile( id1 ), 29760 ). holdsAt( coord( id1 )=( 101, 250 ), 29760 ).
% Frame number: 745
happens( immobile( id1 ), 29800 ). holdsAt( coord( id1 )=( 101, 250 ), 29800 ).
% Frame number: 746
happens( immobile( id1 ), 29840 ). holdsAt( coord( id1 )=( 101, 250 ), 29840 ).
% Frame number: 747
happens( immobile( id1 ), 29880 ). holdsAt( coord( id1 )=( 101, 250 ), 29880 ).
% Frame number: 748
happens( immobile( id1 ), 29920 ). holdsAt( coord( id1 )=( 101, 250 ), 29920 ).
% Frame number: 749
happens( immobile( id1 ), 29960 ). holdsAt( coord( id1 )=( 100, 250 ), 29960 ).
% Frame number: 750
happens( immobile( id1 ), 30000 ). holdsAt( coord( id1 )=( 100, 250 ), 30000 ).
% Frame number: 751
happens( immobile( id1 ), 30040 ). holdsAt( coord( id1 )=( 100, 250 ), 30040 ).
% Frame number: 752
happens( immobile( id1 ), 30080 ). holdsAt( coord( id1 )=( 100, 250 ), 30080 ).
% Frame number: 753
happens( immobile( id1 ), 30120 ). holdsAt( coord( id1 )=( 100, 249 ), 30120 ).
% Frame number: 754
happens( immobile( id1 ), 30160 ). holdsAt( coord( id1 )=( 100, 249 ), 30160 ).
% Frame number: 755
happens( immobile( id1 ), 30200 ). holdsAt( coord( id1 )=( 99, 249 ), 30200 ).
% Frame number: 756
happens( immobile( id1 ), 30240 ). holdsAt( coord( id1 )=( 99, 249 ), 30240 ).
% Frame number: 757
happens( immobile( id1 ), 30280 ). holdsAt( coord( id1 )=( 99, 249 ), 30280 ).
% Frame number: 758
happens( immobile( id1 ), 30320 ). holdsAt( coord( id1 )=( 99, 249 ), 30320 ).
% Frame number: 759
happens( immobile( id1 ), 30360 ). holdsAt( coord( id1 )=( 99, 249 ), 30360 ).
% Frame number: 760
happens( immobile( id1 ), 30400 ). holdsAt( coord( id1 )=( 99, 249 ), 30400 ).
% Frame number: 761
happens( immobile( id1 ), 30440 ). holdsAt( coord( id1 )=( 99, 249 ), 30440 ).
% Frame number: 762
happens( immobile( id1 ), 30480 ). holdsAt( coord( id1 )=( 99, 249 ), 30480 ).
% Frame number: 763
happens( immobile( id1 ), 30520 ). holdsAt( coord( id1 )=( 99, 249 ), 30520 ).
% Frame number: 764
happens( immobile( id1 ), 30560 ). holdsAt( coord( id1 )=( 99, 249 ), 30560 ).
% Frame number: 765
happens( immobile( id1 ), 30600 ). holdsAt( coord( id1 )=( 99, 249 ), 30600 ).
% Frame number: 766
happens( immobile( id1 ), 30640 ). holdsAt( coord( id1 )=( 99, 249 ), 30640 ).
% Frame number: 767
happens( immobile( id1 ), 30680 ). holdsAt( coord( id1 )=( 99, 248 ), 30680 ).
% Frame number: 768
happens( immobile( id1 ), 30720 ). holdsAt( coord( id1 )=( 99, 248 ), 30720 ).
% Frame number: 769
happens( immobile( id1 ), 30760 ). holdsAt( coord( id1 )=( 99, 248 ), 30760 ).
% Frame number: 770
happens( immobile( id1 ), 30800 ). holdsAt( coord( id1 )=( 99, 248 ), 30800 ).
% Frame number: 771
happens( immobile( id1 ), 30840 ). holdsAt( coord( id1 )=( 99, 248 ), 30840 ).
% Frame number: 772
happens( immobile( id1 ), 30880 ). holdsAt( coord( id1 )=( 99, 248 ), 30880 ).
% Frame number: 773
happens( immobile( id1 ), 30920 ). holdsAt( coord( id1 )=( 99, 248 ), 30920 ).
% Frame number: 774
happens( immobile( id1 ), 30960 ). holdsAt( coord( id1 )=( 99, 248 ), 30960 ).
% Frame number: 775
happens( immobile( id1 ), 31000 ). holdsAt( coord( id1 )=( 99, 248 ), 31000 ).
% Frame number: 776
happens( immobile( id1 ), 31040 ). holdsAt( coord( id1 )=( 99, 248 ), 31040 ).
% Frame number: 777
happens( immobile( id1 ), 31080 ). holdsAt( coord( id1 )=( 99, 248 ), 31080 ).
% Frame number: 778
happens( immobile( id1 ), 31120 ). holdsAt( coord( id1 )=( 99, 248 ), 31120 ).
% Frame number: 779
happens( immobile( id1 ), 31160 ). holdsAt( coord( id1 )=( 99, 248 ), 31160 ).
% Frame number: 780
happens( immobile( id1 ), 31200 ). holdsAt( coord( id1 )=( 99, 248 ), 31200 ).
% Frame number: 781
happens( immobile( id1 ), 31240 ). holdsAt( coord( id1 )=( 99, 248 ), 31240 ).
% Frame number: 782
happens( immobile( id1 ), 31280 ). holdsAt( coord( id1 )=( 99, 248 ), 31280 ).
% Frame number: 783
happens( immobile( id1 ), 31320 ). holdsAt( coord( id1 )=( 99, 248 ), 31320 ).
% Frame number: 784
happens( immobile( id1 ), 31360 ). holdsAt( coord( id1 )=( 99, 248 ), 31360 ).
% Frame number: 785
happens( immobile( id1 ), 31400 ). holdsAt( coord( id1 )=( 99, 248 ), 31400 ).
% Frame number: 786
happens( immobile( id1 ), 31440 ). holdsAt( coord( id1 )=( 99, 248 ), 31440 ).
% Frame number: 787
happens( immobile( id1 ), 31480 ). holdsAt( coord( id1 )=( 99, 248 ), 31480 ).
% Frame number: 788
happens( immobile( id1 ), 31520 ). holdsAt( coord( id1 )=( 99, 248 ), 31520 ).
% Frame number: 789
happens( immobile( id1 ), 31560 ). holdsAt( coord( id1 )=( 99, 248 ), 31560 ).
% Frame number: 790
happens( immobile( id1 ), 31600 ). holdsAt( coord( id1 )=( 99, 248 ), 31600 ).
| JasonFil/Prob-EC | dataset/strong-noise/08-Browse_WhileWaiting1/bww1gtContextIndv.pl | Perl | bsd-3-clause | 119,324 |
###############################################################################
#
# Package: NaturalDocs::Topics
#
###############################################################################
#
# The topic constants and functions to convert them to and from strings used throughout the script. All constants are exported
# by default.
#
###############################################################################
# This file is part of Natural Docs, which is Copyright © 2003-2010 Greg Valure
# Natural Docs is licensed under version 3 of the GNU Affero General Public License (AGPL)
# Refer to License.txt for the complete details
use Text::Wrap ( );
use Tie::RefHash ( );
use strict;
use integer;
use NaturalDocs::Topics::Type;
package NaturalDocs::Topics;
use base 'Exporter';
our @EXPORT = ( 'TOPIC_GENERAL', 'TOPIC_GENERIC', 'TOPIC_GROUP', 'TOPIC_CLASS', 'TOPIC_FILE', 'TOPIC_FUNCTION',
'TOPIC_VARIABLE', 'TOPIC_PROPERTY', 'TOPIC_TYPE', 'TOPIC_ENUMERATION', 'TOPIC_CONSTANT',
'TOPIC_INTERFACE', 'TOPIC_EVENT', 'TOPIC_DELEGATE', 'TOPIC_SECTION' );
###############################################################################
# Group: Types
#
# Type: TopicType
#
# A string representing a topic type as defined in <Topics.txt>. It's format should be treated as opaque; use <MakeTopicType()>
# to get them from topic names. However, they can be compared for equality with string functions.
#
#
# Constants: Default TopicTypes
#
# Exported constants of the default <TopicTypes>, so you don't have to go through <TypeFromName()> every time.
#
# TOPIC_GENERAL - The general <TopicType>, which has the special meaning of none in particular.
# TOPIC_GENERIC - Generic <TopicType>.
# TOPIC_GROUP - Group <TopicType>.
# TOPIC_CLASS - Class <TopicType>.
# TOPIC_INTERFACE - Interface <TopicType>.
# TOPIC_FILE - File <TopicType>.
# TOPIC_SECTION - Section <TopicType>.
# TOPIC_FUNCTION - Function <TopicType>.
# TOPIC_VARIABLE - Variable <TopicType>.
# TOPIC_PROPERTY - Property <TopicType>.
# TOPIC_TYPE - Type <TopicType>.
# TOPIC_CONSTANT - Constant <TopicType>.
# TOPIC_ENUMERATION - Enum <TopicType>.
# TOPIC_DELEGATE - Delegate <TopicType>.
# TOPIC_EVENT - Event <TopicType>.
#
use constant TOPIC_GENERAL => 'general';
use constant TOPIC_GENERIC => 'generic';
use constant TOPIC_GROUP => 'group';
use constant TOPIC_CLASS => 'class';
use constant TOPIC_INTERFACE => 'interface';
use constant TOPIC_FILE => 'file';
use constant TOPIC_SECTION => 'section';
use constant TOPIC_FUNCTION => 'function';
use constant TOPIC_VARIABLE => 'variable';
use constant TOPIC_PROPERTY => 'property';
use constant TOPIC_TYPE => 'type';
use constant TOPIC_CONSTANT => 'constant';
use constant TOPIC_ENUMERATION => 'enumeration';
use constant TOPIC_DELEGATE => 'delegate';
use constant TOPIC_EVENT => 'event';
# Dependency: The values of these constants must match what is generated by MakeTopicType().
# Dependency: These types must be added to requiredTypeNames so that they always exist.
###############################################################################
# Group: Variables
#
# handle: FH_TOPICS
#
# The file handle used when writing to <Topics.txt>.
#
#
# hash: types
#
# A hashref that maps <TopicTypes> to <NaturalDocs::Topics::Type>s.
#
my %types;
#
# hash: names
#
# A hashref that maps various forms of the all-lowercase type names to <TopicTypes>. All are in the same hash because
# two names that reduce to the same thing it would cause big problems, and we need to catch that. Keys include
#
# - Topic names
# - Plural topic names
# - Alphanumeric-only topic names
# - Alphanumeric-only plural topic names
#
my %names;
#
# hash: keywords
#
# A hashref that maps all-lowercase keywords to their <TopicTypes>. Must not have any of the same keys as
# <pluralKeywords>.
#
my %keywords;
#
# hash: pluralKeywords
#
# A hashref that maps all-lowercase plural keywords to their <TopicTypes>. Must not have any of the same keys as
# <keywords>.
#
my %pluralKeywords;
#
# hash: indexable
#
# An existence hash of all the indexable <TopicTypes>.
#
my %indexable;
#
# array: requiredTypeNames
#
# An array of the <TopicType> names which are required to be defined in the main file. Are in the order they should appear
# when reformatting.
#
my @requiredTypeNames = ( 'Generic', 'Class', 'Interface', 'Section', 'File', 'Group', 'Function', 'Variable', 'Property', 'Type',
'Constant', 'Enumeration', 'Event', 'Delegate' );
#
# array: legacyTypes
#
# An array that converts the legacy topic types, which were numeric constants prior to 1.3, to the current <TopicTypes>.
# The legacy types are used as an index into the array. Note that this does not support list type values.
#
my @legacyTypes = ( TOPIC_GENERAL, TOPIC_CLASS, TOPIC_SECTION, TOPIC_FILE, TOPIC_GROUP, TOPIC_FUNCTION,
TOPIC_VARIABLE, TOPIC_GENERIC, TOPIC_TYPE, TOPIC_CONSTANT, TOPIC_PROPERTY );
#
# array: mainTopicNames
#
# An array of the <TopicType> names that are defined in the main <Topics.txt>.
#
my @mainTopicNames;
###############################################################################
# Group: Files
#
# File: Topics.txt
#
# The configuration file that defines or overrides the topic definitions for Natural Docs. One version sits in Natural Docs'
# configuration directory, and another can be in a project directory to add to or override them.
#
# > # [comments]
#
# Everything after a # symbol is ignored.
#
# Except when specifying topic names, everything below is case-insensitive.
#
# > Format: [version]
#
# Specifies the file format version of the file.
#
#
# Sections:
#
# > Ignore[d] Keyword[s]: [keyword], [keyword] ...
# > [keyword]
# > [keyword], [keyword]
# > ...
#
# Ignores the keywords so that they're not recognized as Natural Docs topics anymore. Can be specified as a list on the same
# line and/or following like a normal Keywords section.
#
# > Topic Type: [name]
# > Alter Topic Type: [name]
#
# Creates a new topic type or alters an existing one. The name can only contain <CFChars> and isn't case sensitive, although
# the original case is remembered for presentation.
#
# The name General is reserved. There are a number of default types that must be defined in the main file as well, but those
# are governed by <NaturalDocs::Topics> and are not included here. The default types can have their keywords or behaviors
# changed, though, either by editing the default file or by overriding them in the user file.
#
# Enumeration is a special type. It is indexed with Types and its definition list members are listed with Constants according
# to the rules in <Languages.txt>.
#
#
# Topic Type Sections:
#
# > Plural: [name]
#
# Specifies the plural name of the topic type. Defaults to the singular name. Has the same restrictions as the topic type
# name.
#
# > Index: [yes|no]
#
# Whether the topic type gets an index. Defaults to yes.
#
# > Scope: [normal|start|end|always global]
#
# How the topic affects scope. Defaults to normal.
#
# normal - The topic stays within the current scope.
# start - The topic starts a new scope for all the topics beneath it, like class topics.
# end - The topic resets the scope back to global for all the topics beneath it, like section topics.
# always global - The topic is defined as a global symbol, but does not change the scope for any other topics.
#
# > Class Hierarchy: [yes|no]
#
# Whether the topic is part of the class hierarchy. Defaults to no.
#
# > Page Title if First: [yes|no]
#
# Whether the title of this topic becomes the page title if it is the first topic in a file. Defaults to no.
#
# > Break Lists: [yes|no]
#
# Whether list topics should be broken into individual topics in the output. Defaults to no.
#
# > Can Group With: [topic type], [topic type], ...
#
# The list of <TopicTypes> the topic can possibly be grouped with.
#
# > [Add] Keyword[s]:
# > [keyword]
# > [keyword], [plural keyword]
# > ...
#
# A list of the topic type's keywords. Each line after the heading is the keyword and optionally its plural form. This continues
# until the next line in "keyword: value" format. "Add" isn't required.
#
# - Keywords can only have letters and numbers. No punctuation or spaces are allowed.
# - Keywords are not case sensitive.
# - Subsequent keyword sections add to the list. They don't replace it.
# - Keywords can be redefined by other keyword sections.
#
#
# Revisions:
#
# 1.3:
#
# The initial version of this file.
#
###############################################################################
# Group: File Functions
#
# Function: Load
#
# Loads both the master and the project version of <Topics.txt>.
#
sub Load
{
my $self = shift;
# Add the special General topic type.
$types{::TOPIC_GENERAL()} = NaturalDocs::Topics::Type->New('General', 'General', 1, ::SCOPE_NORMAL(), undef);
$names{'general'} = ::TOPIC_GENERAL();
$indexable{::TOPIC_GENERAL()} = 1;
# There are no keywords for the general topic.
$self->LoadFile(1); # Main
# Dependency: All the default topic types must be checked for existence.
# Check to see if the required types are defined.
foreach my $name (@requiredTypeNames)
{
if (!exists $names{lc($name)})
{ NaturalDocs::ConfigFile->AddError('The ' . $name . ' topic type must be defined in the main topics file.'); };
};
my $errorCount = NaturalDocs::ConfigFile->ErrorCount();
if ($errorCount)
{
NaturalDocs::ConfigFile->PrintErrorsAndAnnotateFile();
NaturalDocs::Error->SoftDeath('There ' . ($errorCount == 1 ? 'is an error' : 'are ' . $errorCount . ' errors')
. ' in ' . NaturalDocs::Project->MainConfigFile('Topics.txt'));
}
$self->LoadFile(); # User
$errorCount = NaturalDocs::ConfigFile->ErrorCount();
if ($errorCount)
{
NaturalDocs::ConfigFile->PrintErrorsAndAnnotateFile();
NaturalDocs::Error->SoftDeath('There ' . ($errorCount == 1 ? 'is an error' : 'are ' . $errorCount . ' errors')
. ' in ' . NaturalDocs::Project->UserConfigFile('Topics.txt'));
}
};
#
# Function: LoadFile
#
# Loads a particular version of <Topics.txt>.
#
# Parameters:
#
# isMain - Whether the file is the main file or not.
#
sub LoadFile #(isMain)
{
my ($self, $isMain) = @_;
my ($file, $status);
if ($isMain)
{
$file = NaturalDocs::Project->MainConfigFile('Topics.txt');
$status = NaturalDocs::Project->MainConfigFileStatus('Topics.txt');
}
else
{
$file = NaturalDocs::Project->UserConfigFile('Topics.txt');
$status = NaturalDocs::Project->UserConfigFileStatus('Topics.txt');
};
my $version;
if ($version = NaturalDocs::ConfigFile->Open($file))
{
# The format hasn't changed since the file was introduced.
if ($status == ::FILE_CHANGED())
{ NaturalDocs::Project->ReparseEverything(); };
my ($topicTypeKeyword, $topicTypeName, $topicType, $topicTypeObject, $inKeywords, $inIgnoredKeywords);
# Keys are topic type objects, values are unparsed strings.
my %canGroupWith;
tie %canGroupWith, 'Tie::RefHash';
while (my ($keyword, $value) = NaturalDocs::ConfigFile->GetLine())
{
if ($keyword)
{
$inKeywords = 0;
$inIgnoredKeywords = 0;
};
if ($keyword eq 'topic type')
{
$topicTypeKeyword = $keyword;
$topicTypeName = $value;
# Resolve conflicts and create the type if necessary.
$topicType = $self->MakeTopicType($topicTypeName);
my $lcTopicTypeName = lc($topicTypeName);
my $lcTopicTypeAName = $lcTopicTypeName;
$lcTopicTypeAName =~ tr/a-z0-9//cd;
if (!NaturalDocs::ConfigFile->HasOnlyCFChars($topicTypeName))
{
NaturalDocs::ConfigFile->AddError('Topic names can only have ' . NaturalDocs::ConfigFile->CFCharNames() . '.');
}
elsif ($topicType eq ::TOPIC_GENERAL())
{
NaturalDocs::ConfigFile->AddError('You cannot define a General topic type.');
}
elsif (defined $types{$topicType} || defined $names{$lcTopicTypeName} || defined $names{$lcTopicTypeAName})
{
NaturalDocs::ConfigFile->AddError('Topic type ' . $topicTypeName . ' is already defined or its name is too '
. 'similar to an existing name. Use Alter Topic Type if you meant to override '
. 'its settings.');
}
else
{
$topicTypeObject = NaturalDocs::Topics::Type->New($topicTypeName, $topicTypeName, 1, ::SCOPE_NORMAL(),
0, 0);
$types{$topicType} = $topicTypeObject;
$names{$lcTopicTypeName} = $topicType;
$names{$lcTopicTypeAName} = $topicType;
$indexable{$topicType} = 1;
if ($isMain)
{ push @mainTopicNames, $topicTypeName; };
};
}
elsif ($keyword eq 'alter topic type')
{
$topicTypeKeyword = $keyword;
$topicTypeName = $value;
# Resolve conflicts and create the type if necessary.
$topicType = $names{lc($topicTypeName)};
if (!defined $topicType)
{ NaturalDocs::ConfigFile->AddError('Topic type ' . $topicTypeName . ' doesn\'t exist.'); }
elsif ($topicType eq ::TOPIC_GENERAL())
{ NaturalDocs::ConfigFile->AddError('You cannot alter the General topic type.'); }
else
{
$topicTypeObject = $types{$topicType};
};
}
elsif ($keyword =~ /^ignored? keywords?$/)
{
$inIgnoredKeywords = 1;
my @ignoredKeywords = split(/ ?, ?/, lc($value));
foreach my $ignoredKeyword (@ignoredKeywords)
{
delete $keywords{$ignoredKeyword};
delete $pluralKeywords{$ignoredKeyword};
};
}
# We continue even if there are errors in the topic type line so that we can find any other errors in the file as well. We'd
# rather them all show up at once instead of them showing up one at a time between Natural Docs runs. So we just ignore
# the settings if $topicTypeObject is undef.
elsif ($keyword eq 'plural')
{
my $pluralName = $value;
my $lcPluralName = lc($pluralName);
my $lcPluralAName = $lcPluralName;
$lcPluralAName =~ tr/a-zA-Z0-9//cd;
if (!NaturalDocs::ConfigFile->HasOnlyCFChars($pluralName))
{
NaturalDocs::ConfigFile->AddError('Plural names can only have '
. NaturalDocs::ConfigFile->CFCharNames() . '.');
}
elsif ($lcPluralAName eq 'general')
{
NaturalDocs::ConfigFile->AddError('You cannot use General as a plural name for ' . $topicTypeName . '.');
}
elsif ( (defined $names{$lcPluralName} && $names{$lcPluralName} ne $topicType) ||
(defined $names{$lcPluralAName} && $names{$lcPluralAName} ne $topicType) )
{
NaturalDocs::ConfigFile->AddError($topicTypeName . "'s plural name, " . $pluralName
. ', is already defined or is too similar to an existing name.');
}
elsif (defined $topicTypeObject)
{
$topicTypeObject->SetPluralName($pluralName);
$names{$lcPluralName} = $topicType;
$names{$lcPluralAName} = $topicType;
};
}
elsif ($keyword eq 'index')
{
$value = lc($value);
if ($value eq 'yes')
{
if (defined $topicTypeObject)
{
$topicTypeObject->SetIndex(1);
$indexable{$topicType} = 1;
};
}
elsif ($value eq 'no')
{
if (defined $topicTypeObject)
{
$topicTypeObject->SetIndex(0);
delete $indexable{$topicType};
};
}
else
{
NaturalDocs::ConfigFile->AddError('Index lines can only be "yes" or "no".');
};
}
elsif ($keyword eq 'class hierarchy')
{
$value = lc($value);
if ($value eq 'yes')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetClassHierarchy(1); };
}
elsif ($value eq 'no')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetClassHierarchy(0); };
}
else
{
NaturalDocs::ConfigFile->AddError('Class Hierarchy lines can only be "yes" or "no".');
};
}
elsif ($keyword eq 'scope')
{
$value = lc($value);
if ($value eq 'normal')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetScope(::SCOPE_NORMAL()); };
}
elsif ($value eq 'start')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetScope(::SCOPE_START()); };
}
elsif ($value eq 'end')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetScope(::SCOPE_END()); };
}
elsif ($value eq 'always global')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetScope(::SCOPE_ALWAYS_GLOBAL()); };
}
else
{
NaturalDocs::ConfigFile->AddError('Scope lines can only be "normal", "start", "end", or "always global".');
};
}
elsif ($keyword eq 'page title if first')
{
$value = lc($value);
if ($value eq 'yes')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetPageTitleIfFirst(1); };
}
elsif ($value eq 'no')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetPageTitleIfFirst(undef); };
}
else
{
NaturalDocs::ConfigFile->AddError('Page Title if First lines can only be "yes" or "no".');
};
}
elsif ($keyword eq 'break lists')
{
$value = lc($value);
if ($value eq 'yes')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetBreakLists(1); };
}
elsif ($value eq 'no')
{
if (defined $topicTypeObject)
{ $topicTypeObject->SetBreakLists(undef); };
}
else
{
NaturalDocs::ConfigFile->AddError('Break Lists lines can only be "yes" or "no".');
};
}
elsif ($keyword eq 'can group with')
{
if (defined $topicTypeObject)
{ $canGroupWith{$topicTypeObject} = lc($value); };
}
elsif ($keyword =~ /^(?:add )?keywords?$/)
{
$inKeywords = 1;
}
elsif (defined $keyword)
{ NaturalDocs::ConfigFile->AddError($keyword . ' is not a valid keyword.'); }
elsif (!$inKeywords && !$inIgnoredKeywords)
{
NaturalDocs::ConfigFile->AddError('All lines in ' . $topicTypeKeyword . ' sections must begin with a keyword.');
}
else # No keyword but in keyword section.
{
$value = lc($value);
if ($value =~ /^([a-z0-9 ]*[a-z0-9]) ?, ?([a-z0-9 ]+)$/)
{
my ($singular, $plural) = ($1, $2);
if ($inIgnoredKeywords)
{
delete $keywords{$singular};
delete $keywords{$plural};
delete $pluralKeywords{$singular};
delete $pluralKeywords{$plural};
}
elsif (defined $topicTypeObject)
{
$keywords{$singular} = $topicType;
delete $pluralKeywords{$singular};
$pluralKeywords{$plural} = $topicType;
delete $keywords{$plural};
};
}
elsif ($value =~ /^[a-z0-9 ]+$/)
{
if ($inIgnoredKeywords)
{
delete $keywords{$value};
delete $pluralKeywords{$value};
}
elsif (defined $topicType)
{
$keywords{$value} = $topicType;
delete $pluralKeywords{$value};
};
}
else
{
NaturalDocs::ConfigFile->AddError('Keywords can only have letters, numbers, and spaces. '
. 'Plurals must be separated by a comma.');
};
};
};
NaturalDocs::ConfigFile->Close();
# Parse out the Can Group With lines now that everything's defined.
while (my ($typeObject, $value) = each %canGroupWith)
{
my @values = split(/ ?, ?/, $value);
my @types;
foreach my $value (@values)
{
# We're just going to ignore invalid items.
if (exists $names{$value})
{ push @types, $names{$value}; };
};
if (scalar @types)
{ $typeObject->SetCanGroupWith(\@types); };
};
}
else # couldn't open file
{
if ($isMain)
{ die "Couldn't open topics file " . $file . "\n"; }
else
{ NaturalDocs::Project->ReparseEverything(); };
};
};
#
# Function: Save
#
# Saves the main and user versions of <Topics.txt>.
#
sub Save
{
my $self = shift;
$self->SaveFile(1); # Main
$self->SaveFile(0); # User
};
#
# Function: SaveFile
#
# Saves a particular version of <Topics.txt>.
#
# Parameters:
#
# isMain - Whether the file is the main file or not.
#
sub SaveFile #(isMain)
{
my ($self, $isMain) = @_;
my $file;
if ($isMain)
{
if (NaturalDocs::Project->MainConfigFileStatus('Topics.txt') == ::FILE_SAME())
{ return; };
$file = NaturalDocs::Project->MainConfigFile('Topics.txt');
}
else
{
# We have to check the main one two because this lists the topics defined in it.
if (NaturalDocs::Project->UserConfigFileStatus('Topics.txt') == ::FILE_SAME() &&
NaturalDocs::Project->MainConfigFileStatus('Topics.txt') == ::FILE_SAME())
{ return; };
$file = NaturalDocs::Project->UserConfigFile('Topics.txt');
};
# Array of topic type names in the order they appear in the file. If Alter Topic Type is used, the name will end with an asterisk.
my @topicTypeOrder;
# Keys are topic type names, values are property hashrefs. Hashref keys are the property names, values the value.
# For keywords, the key is Keywords and the values are arrayrefs of singular and plural pairs. If no plural is defined, the entry
# will be undef.
my %properties;
# List of ignored keywords specified as Ignore Keywords: [keyword], [keyword], ...
my @inlineIgnoredKeywords;
# List of ignored keywords specified in [keyword], [plural keyword] lines. Done in pairs, like for regular keywords.
my @separateIgnoredKeywords;
my $inIgnoredKeywords;
if (NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
my ($keyword, $value, $topicTypeName);
while (($keyword, $value) = NaturalDocs::ConfigFile->GetLine())
{
$keyword = lc($keyword);
if ($keyword eq 'topic type' || $keyword eq 'alter topic type')
{
$topicTypeName = $types{ $names{lc($value)} }->Name();
if ($keyword eq 'alter topic type')
{ $topicTypeName .= '*'; };
push @topicTypeOrder, $topicTypeName;
if (!exists $properties{$topicTypeName})
{ $properties{$topicTypeName} = { 'keywords' => [ ] }; };
}
elsif ($keyword eq 'plural')
{
$properties{$topicTypeName}->{$keyword} = $value;
}
elsif ($keyword eq 'index' ||
$keyword eq 'scope' ||
$keyword eq 'page title if first' ||
$keyword eq 'class hierarchy' ||
$keyword eq 'break lists' ||
$keyword eq 'can group with')
{
$properties{$topicTypeName}->{$keyword} = lc($value);
}
elsif ($keyword =~ /^(?:add )?keywords?$/)
{
$inIgnoredKeywords = 0;
}
elsif ($keyword =~ /^ignored? keywords?$/)
{
$inIgnoredKeywords = 1;
if ($value)
{ push @inlineIgnoredKeywords, split(/ ?, ?/, $value); };
}
elsif (!$keyword)
{
my ($singular, $plural) = split(/ ?, ?/, lc($value));
if ($inIgnoredKeywords)
{ push @separateIgnoredKeywords, $singular, $plural; }
else
{ push @{$properties{$topicTypeName}->{'keywords'}}, $singular, $plural; };
};
};
NaturalDocs::ConfigFile->Close();
};
if (!open(FH_TOPICS, '>' . $file))
{
# The main file may be on a shared volume or some other place the user doesn't have write access to. Since this is only to
# reformat the file, we can ignore the failure.
if ($isMain)
{ return; }
else
{ die "Couldn't save " . $file; };
};
print FH_TOPICS 'Format: ' . NaturalDocs::Settings->TextAppVersion() . "\n\n";
# Remember the 80 character limit.
if ($isMain)
{
print FH_TOPICS
"# This is the main Natural Docs topics file. If you change anything here, it\n"
. "# will apply to EVERY PROJECT you use Natural Docs on. If you'd like to\n"
. "# change something for just one project, edit the Topics.txt in its project\n"
. "# directory instead.\n";
}
else
{
print FH_TOPICS
"# This is the Natural Docs topics file for this project. If you change anything\n"
. "# here, it will apply to THIS PROJECT ONLY. If you'd like to change something\n"
. "# for all your projects, edit the Topics.txt in Natural Docs' Config directory\n"
. "# instead.\n\n\n";
if (scalar @inlineIgnoredKeywords || scalar @separateIgnoredKeywords)
{
if (scalar @inlineIgnoredKeywords == 1 && !scalar @separateIgnoredKeywords)
{
print FH_TOPICS 'Ignore Keyword: ' . $inlineIgnoredKeywords[0] . "\n";
}
else
{
print FH_TOPICS
'Ignore Keywords: ' . join(', ', @inlineIgnoredKeywords) . "\n";
for (my $i = 0; $i < scalar @separateIgnoredKeywords; $i += 2)
{
print FH_TOPICS ' ' . $separateIgnoredKeywords[$i];
if (defined $separateIgnoredKeywords[$i + 1])
{ print FH_TOPICS ', ' . $separateIgnoredKeywords[$i + 1]; };
print FH_TOPICS "\n";
};
};
}
else
{
print FH_TOPICS
"# If you'd like to prevent keywords from being recognized by Natural Docs, you\n"
. "# can do it like this:\n"
. "# Ignore Keywords: [keyword], [keyword], ...\n"
. "#\n"
. "# Or you can use the list syntax like how they are defined:\n"
. "# Ignore Keywords:\n"
. "# [keyword]\n"
. "# [keyword], [plural keyword]\n"
. "# ...\n";
};
};
print FH_TOPICS # [CFChars]
"\n\n"
. "#-------------------------------------------------------------------------------\n"
. "# SYNTAX:\n"
. "#\n";
if ($isMain)
{
print FH_TOPICS
"# Topic Type: [name]\n"
. "# Creates a new topic type. Each type gets its own index and behavior\n"
. "# settings. Its name can have letters, numbers, spaces, and these\n"
. "# charaters: - / . '\n"
. "#\n"
. "# The Enumeration type is special. It's indexed with Types but its members\n"
. "# are indexed with Constants according to the rules in Languages.txt.\n"
. "#\n"
}
else
{
print FH_TOPICS
"# Topic Type: [name]\n"
. "# Alter Topic Type: [name]\n"
. "# Creates a new topic type or alters one from the main file. Each type gets\n"
. "# its own index and behavior settings. Its name can have letters, numbers,\n"
. "# spaces, and these charaters: - / . '\n"
. "#\n";
};
print FH_TOPICS
"# Plural: [name]\n"
. "# Sets the plural name of the topic type, if different.\n"
. "#\n"
. "# Keywords:\n"
. "# [keyword]\n"
. "# [keyword], [plural keyword]\n"
. "# ...\n";
if ($isMain)
{
print FH_TOPICS
"# Defines a list of keywords for the topic type. They may only contain\n"
. "# letters, numbers, and spaces and are not case sensitive. Plural keywords\n"
. "# are used for list topics.\n";
}
else
{
print FH_TOPICS
"# Defines or adds to the list of keywords for the topic type. They may only\n"
. "# contain letters, numbers, and spaces and are not case sensitive. Plural\n"
. "# keywords are used for list topics. You can redefine keywords found in the\n"
. "# main topics file.\n";
}
print FH_TOPICS
"#\n"
. "# Index: [yes|no]\n"
. "# Whether the topics get their own index. Defaults to yes. Everything is\n"
. "# included in the general index regardless of this setting.\n"
. "#\n"
. "# Scope: [normal|start|end|always global]\n"
. "# How the topics affects scope. Defaults to normal.\n"
. "# normal - Topics stay within the current scope.\n"
. "# start - Topics start a new scope for all the topics beneath it,\n"
. "# like class topics.\n"
. "# end - Topics reset the scope back to global for all the topics\n"
. "# beneath it.\n"
. "# always global - Topics are defined as global, but do not change the scope\n"
. "# for any other topics.\n"
. "#\n"
. "# Class Hierarchy: [yes|no]\n"
. "# Whether the topics are part of the class hierarchy. Defaults to no.\n"
. "#\n"
. "# Page Title If First: [yes|no]\n"
. "# Whether the topic's title becomes the page title if it's the first one in\n"
. "# a file. Defaults to no.\n"
. "#\n"
. "# Break Lists: [yes|no]\n"
. "# Whether list topics should be broken into individual topics in the output.\n"
. "# Defaults to no.\n"
. "#\n"
. "# Can Group With: [type], [type], ...\n"
. "# Defines a list of topic types that this one can possibly be grouped with.\n"
. "# Defaults to none.\n"
. "#-------------------------------------------------------------------------------\n\n";
my $listToPrint;
if ($isMain)
{
print FH_TOPICS
"# The following topics MUST be defined in this file:\n"
. "#\n";
$listToPrint = \@requiredTypeNames;
}
else
{
print FH_TOPICS
"# The following topics are defined in the main file, if you'd like to alter\n"
. "# their behavior or add keywords:\n"
. "#\n";
$listToPrint = \@mainTopicNames;
}
print FH_TOPICS
Text::Wrap::wrap('# ', '# ', join(', ', @$listToPrint)) . "\n"
. "\n"
. "# If you add something that you think would be useful to other developers\n"
. "# and should be included in Natural Docs by default, please e-mail it to\n"
. "# topics [at] naturaldocs [dot] org.\n";
# Existence hash. We do this because we want the required ones to go first by adding them to @topicTypeOrder, but we don't
# want them to appear twice.
my %doneTopicTypes;
my ($altering, $numberOfProperties);
if ($isMain)
{ unshift @topicTypeOrder, @requiredTypeNames; };
my @propertyOrder = ('Plural', 'Index', 'Scope', 'Class Hierarchy', 'Page Title If First', 'Break Lists');
foreach my $topicType (@topicTypeOrder)
{
if (!exists $doneTopicTypes{$topicType})
{
if (substr($topicType, -1) eq '*')
{
print FH_TOPICS "\n\n"
. 'Alter Topic Type: ' . substr($topicType, 0, -1) . "\n\n";
$altering = 1;
$numberOfProperties = 0;
}
else
{
print FH_TOPICS "\n\n"
. 'Topic Type: ' . $topicType . "\n\n";
$altering = 0;
$numberOfProperties = 0;
};
foreach my $property (@propertyOrder)
{
if (exists $properties{$topicType}->{lc($property)})
{
print FH_TOPICS
' ' . $property . ': ' . ucfirst( $properties{$topicType}->{lc($property)} ) . "\n";
$numberOfProperties++;
};
};
if (exists $properties{$topicType}->{'can group with'})
{
my @typeStrings = split(/ ?, ?/, lc($properties{$topicType}->{'can group with'}));
my @types;
foreach my $typeString (@typeStrings)
{
if (exists $names{$typeString})
{ push @types, $names{$typeString}; };
};
if (scalar @types)
{
for (my $i = 0; $i < scalar @types; $i++)
{
my $name = NaturalDocs::Topics->NameOfType($types[$i], 1);
if ($i == 0)
{ print FH_TOPICS ' Can Group With: ' . $name; }
else
{ print FH_TOPICS ', ' . $name; };
};
print FH_TOPICS "\n";
$numberOfProperties++;
};
};
if (scalar @{$properties{$topicType}->{'keywords'}})
{
if ($numberOfProperties > 1)
{ print FH_TOPICS "\n"; };
print FH_TOPICS
' ' . ($altering ? 'Add ' : '') . 'Keywords:' . "\n";
my $keywords = $properties{$topicType}->{'keywords'};
for (my $i = 0; $i < scalar @$keywords; $i += 2)
{
print FH_TOPICS ' ' . $keywords->[$i];
if (defined $keywords->[$i + 1])
{ print FH_TOPICS ', ' . $keywords->[$i + 1]; };
print FH_TOPICS "\n";
};
};
$doneTopicTypes{$topicType} = 1;
};
};
close(FH_TOPICS);
};
###############################################################################
# Group: Functions
#
# Function: KeywordInfo
#
# Returns information about a topic keyword.
#
# Parameters:
#
# keyword - The keyword, which may be plural.
#
# Returns:
#
# The array ( topicType, info, isPlural ), or an empty array if the keyword doesn't exist.
#
# topicType - The <TopicType> of the keyword.
# info - The <NaturalDocs::Topics::Type> of its type.
# isPlural - Whether the keyword was plural or not.
#
sub KeywordInfo #(keyword)
{
my ($self, $keyword) = @_;
$keyword = lc($keyword);
my $type = $keywords{$keyword};
if (defined $type)
{ return ( $type, $types{$type}, undef ); };
$type = $pluralKeywords{$keyword};
if (defined $type)
{ return ( $type, $types{$type}, 1 ); };
return ( );
};
#
# Function: NameInfo
#
# Returns information about a topic name.
#
# Parameters:
#
# name - The topic type name, which can be plural and/or alphanumeric only.
#
# Returns:
#
# The array ( topicType, info ), or an empty array if the name doesn't exist. Note that unlike <KeywordInfo()>, this
# does *not* tell you whether the name is plural or not.
#
# topicType - The <TopicType> of the name.
# info - The <NaturalDocs::Topics::Type> of the type.
#
sub NameInfo #(name)
{
my ($self, $name) = @_;
my $type = $names{lc($name)};
if (defined $type)
{ return ( $type, $types{$type} ); }
else
{ return ( ); };
};
#
# Function: TypeInfo
#
# Returns information about a <TopicType>.
#
# Parameters:
#
# type - The <TopicType>.
#
# Returns:
#
# The <NaturalDocs::Topics::Type> of the type, or undef if it didn't exist.
#
sub TypeInfo #(type)
{
my ($self, $type) = @_;
return $types{$type};
};
#
# Function: NameOfType
#
# Returns the name of the passed <TopicType>, or undef if it doesn't exist.
#
# Parameters:
#
# topicType - The <TopicType>.
# plural - Whether to return the plural instead of the singular.
# alphanumericOnly - Whether to strips everything but alphanumeric characters out. Case isn't modified.
#
# Returns:
#
# The topic type name, according to what was specified in the parameters, or undef if it doesn't exist.
#
sub NameOfType #(topicType, plural, alphanumericOnly)
{
my ($self, $topicType, $plural, $alphanumericOnly) = @_;
my $topicObject = $types{$topicType};
if (!defined $topicObject)
{ return undef; };
my $topicName = ($plural ? $topicObject->PluralName() : $topicObject->Name());
if ($alphanumericOnly)
{ $topicName =~ tr/a-zA-Z0-9//cd; };
return $topicName;
};
#
# Function: TypeFromName
#
# Returns a <TopicType> for the passed topic name.
#
# Parameters:
#
# topicName - The name of the topic, which can be plural and/or alphanumeric only.
#
# Returns:
#
# The <TopicType>. It does not specify whether the name was plural or not.
#
sub TypeFromName #(topicName)
{
my ($self, $topicName) = @_;
return $names{lc($topicName)};
};
#
# Function: IsValidType
#
# Returns whether the passed <TopicType> is defined.
#
sub IsValidType #(type)
{
my ($self, $type) = @_;
return exists $types{$type};
};
#
# Function: TypeFromLegacy
#
# Returns a <TopicType> for the passed legacy topic type integer. <TopicTypes> were changed from integer constants to
# strings in 1.3.
#
sub TypeFromLegacy #(legacyInt)
{
my ($self, $int) = @_;
return $legacyTypes[$int];
};
#
# Function: AllIndexableTypes
#
# Returns an array of all possible indexable <TopicTypes>.
#
sub AllIndexableTypes
{
my ($self) = @_;
return keys %indexable;
};
###############################################################################
# Group: Support Functions
#
# Function: MakeTopicType
#
# Returns a <TopicType> for the passed topic name. It does not check to see if it exists already.
#
# Parameters:
#
sub MakeTopicType #(topicName)
{
my ($self, $topicName) = @_;
# Dependency: The values of the default topic type constants must match what is generated here.
# Turn everything to lowercase and strip non-alphanumeric characters.
$topicName = lc($topicName);
$topicName =~ tr/a-z0-9//cd;
return $topicName;
};
1;
| IbpTeam/node-nodegit | vendor/naturaldocs/Modules/NaturalDocs/Topics.pm | Perl | mit | 43,300 |
#------------------------------------------------------------------------------
# File: Unknown.pm
#
# Description: Unknown EXIF maker notes tags
#
# Revisions: 04/07/2004 - P. Harvey Created
#------------------------------------------------------------------------------
package Image::ExifTool::Unknown;
use strict;
use vars qw($VERSION);
use Image::ExifTool::Exif;
$VERSION = '1.13';
# Unknown maker notes
%Image::ExifTool::Unknown::Main = (
WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
GROUPS => { 0 => 'MakerNotes', 1 => 'MakerUnknown', 2 => 'Camera' },
# this seems to be a common fixture, so look for it in unknown maker notes
0x0e00 => {
Name => 'PrintIM',
Description => 'Print Image Matching',
SubDirectory => {
TagTable => 'Image::ExifTool::PrintIM::Main',
},
},
);
1; # end
__END__
=head1 NAME
Image::ExifTool::Unknown - Unknown EXIF maker notes tags
=head1 SYNOPSIS
This module is loaded automatically by Image::ExifTool when required.
=head1 DESCRIPTION
Image::ExifTool has definitions for the maker notes from many manufacturers,
however information can sometimes be extracted from unknown manufacturers if
the maker notes are in standard IFD format. This module contains the
definitions necessary for Image::ExifTool to read the maker notes from
unknown manufacturers.
=head1 AUTHOR
Copyright 2003-2014, 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/Unknown Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
| pericles-project/pet | nativeTools/exiftool_OSX/lib/Image/ExifTool/Unknown.pm | Perl | apache-2.0 | 1,732 |
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use DBI;
use Getopt::Long;
my $usage = "$0 [--verbose] [--load_db] --out <outfile: must be absolute path>\n";
my $verbose = 0;
my $load_db = 0;
my $outfile = '';
my $dbname = "";
my $dbhost = "";
my $dbuser = "";
if ( (@ARGV > 0) && ($ARGV[0] =~ /-h/) ) { print STDERR $usage; exit 1; }
if ( ! GetOptions('verbose!' => \$verbose,
'load_db!' => \$load_db,
'out=s' => \$outfile,
'dbname:s' => \$dbname,
'dbuser:s' => \$dbuser,
'dbhost:s' => \$dbhost
) ) {
print STDERR $usage; exit 1;
}
unless ($outfile) { print STDERR $usage; exit 1; }
my $dbh = DBI->connect("DBI:Pg:dbname=$dbname;host=$dbhost", $dbuser, '', {AutoCommit => 0});
unless ($dbh) { print STDERR "Error: " . $DBI::errstr . "\n"; exit 1; }
print STDERR "Loading organism data ... " if ($verbose);
my $org_map = &get_organism_map($dbh);
print STDERR " Done\n" if ($verbose);
my $src_map = &get_source_map($dbh);
my $md5_org = $dbh->prepare("select md5,organism,source from (select distinct md5,organism,source from md5_protein union select distinct md5,organism,source from md5_rna) as x order by md5");
my $cur_md5 = '';
my $has_lca = 0;
my $all_md5 = 0;
my $no_lca = 0;
my $primary = $src_map->{'RefSeq'};
my $prime_o = {};
my $other_o = {};
print STDERR "Calculating lca for md5s:\n" if ($verbose);
$md5_org->execute();
open(OUTF, ">$outfile") || die "Can not open $outfile: $!\n";
while (my @row = $md5_org->fetchrow_array) {
my ($md5, $org, $src) = @row;
if ($cur_md5 eq '') { $cur_md5 = $md5; }
if ($cur_md5 ne $md5) {
if (scalar(keys %$prime_o) > 0) {
my @lca = &get_lca($cur_md5, $org_map, [keys %$prime_o]);
if (@lca == 9) {
print OUTF join ("\t", ($cur_md5, @lca)) . "\n";
$has_lca += 1;
} else {
$no_lca += 1;
}
}
elsif (scalar(keys %$other_o) > 0) {
my @lca = &get_lca($cur_md5, $org_map, [keys %$other_o]);
if (@lca == 9) {
print OUTF join ("\t", ($cur_md5, @lca)) . "\n";
$has_lca += 1;
} else {
$no_lca += 1;
}
}
else {
print STDERR join ("\t", ("No taxonomy:", $cur_md5, $all_md5)) . "\n";
}
$all_md5 += 1;
$prime_o = {};
$other_o = {};
$cur_md5 = $md5;
}
if ($src == $primary) {
$prime_o->{$org} = 1;
} else {
$other_o->{$org} = 1;
}
}
if (scalar(keys %$prime_o) > 0) {
my @lca = &get_lca($cur_md5, $org_map, [keys %$prime_o]);
if (@lca == 9) {
print OUTF join ("\t", ($cur_md5, @lca)) . "\n";
}
}
elsif (scalar(keys %$other_o) > 0) {
my @lca = &get_lca($cur_md5, $org_map, [keys %$other_o]);
if (@lca == 9) {
print OUTF join ("\t", ($cur_md5, @lca)) . "\n";
}
}
close OUTF;
print STDERR "Done: processed $all_md5 md5s: $has_lca have lca, $no_lca no lca\n" if ($verbose);
if ($load_db) {
print STDERR "Creating table md5_lca ... " if ($verbose);
$dbh->do("DROP TABLE IF EXISTS md5_lca");
$dbh->do("CREATE TABLE md5_lca (md5 text PRIMARY KEY, tax_domain text, tax_phylum text, tax_class text, tax_order text, tax_family text, tax_genus text, tax_species text, tax_strain text, level integer)");
$dbh->commit;
print STDERR "Done.\n" if ($verbose);
print STDERR "Loading data to md5_lca ... " if ($verbose);
$dbh->do("COPY md5_lca FROM '$outfile'");
$dbh->commit;
print STDERR "Done.\n" if ($verbose);
}
exit 0;
sub get_lca {
my ($md5, $org_map, $oids) = @_;
my $coverage = {};
foreach my $o (@$oids) {
if ((exists $org_map->{$o}) && ($org_map->{$o}[0]) && (@{$org_map->{$o}} == 8)) {
my $taxa = $org_map->{$o};
for (my $i = 0; $i < scalar(@$taxa); $i++) {
$coverage->{$i+1}->{ $taxa->[$i] }++ if ($taxa->[$i]);
}
}
}
if ( scalar(keys %$coverage) < 8 ) {
print STDERR "Incomplete Taxonomy:\t$md5\t" . join(",", @$oids) . "\n";
return ();
}
if ( scalar(keys %{$coverage->{1}}) > 1 ) {
print STDERR "No LCA possible:\t$md5\t" . join(",", keys %{$coverage->{1}}) . "\n";
return ();
}
my @lca = ();
my $pos = 0;
my $max = 0;
foreach my $key (sort { $a <=> $b } keys %$coverage) {
my $num = scalar keys %{$coverage->{$key}};
if (($num <= $max) || ($max == 0)) {
$max = $num;
$pos = $key;
}
}
if ( scalar(keys %{$coverage->{$pos}}) == 1 ) {
@lca = map { keys %{$coverage->{$_}} } (1 .. $pos);
push @lca, ( map {'-'} ($pos + 1 .. 8) ) if ($pos < 8);
push @lca, $pos;
}
else {
print STDERR "LCA error ($pos):\t$md5\n";
}
return @lca;
}
sub get_organism_map {
my ($dbh) = @_;
my $data = {};
my $rows = $dbh->selectall_arrayref("select _id, tax_domain, tax_phylum, tax_class, tax_order, tax_family, tax_genus, tax_species, name from organisms_ncbi");
if ($rows && (@$rows > 0)) {
%$data = map { $_->[0], [ @$_[1..8] ] } @$rows;
}
return $data;
}
sub get_source_map {
my ($dbh) = @_;
my $data = {};
my $rows = $dbh->selectall_arrayref("select name, _id from sources");
if ($rows && (@$rows > 0)) {
%$data = map { $_->[0], $_->[1] } @$rows;
}
return $data;
}
| teharrison/MG-RAST | src/Babel/bin/md52lca.pl | Perl | bsd-2-clause | 5,065 |
package Moose::Meta::Method::Accessor::Native::Number::set;
BEGIN {
$Moose::Meta::Method::Accessor::Native::Number::set::AUTHORITY = 'cpan:STEVAN';
}
{
$Moose::Meta::Method::Accessor::Native::Number::set::VERSION = '2.0604';
}
use strict;
use warnings;
use Moose::Role;
with 'Moose::Meta::Method::Accessor::Native::Writer' => {
-excludes => [
qw(
_minimum_arguments
_maximum_arguments
_inline_optimized_set_new_value
)
]
};
sub _minimum_arguments { 1 }
sub _maximum_arguments { 1 }
sub _potential_value { '$_[0]' }
sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
return $slot_access . ' = $_[0];';
}
no Moose::Role;
1;
| Dokaponteam/ITF_Project | xampp/perl/vendor/lib/Moose/Meta/Method/Accessor/Native/Number/set.pm | Perl | mit | 756 |
package Test::Builder::Module;
use strict;
use Test::Builder;
require Exporter;
our @ISA = qw(Exporter);
our $VERSION = '0.80';
# 5.004's Exporter doesn't have export_to_level.
my $_export_to_level = sub {
my $pkg = shift;
my $level = shift;
(undef) = shift; # redundant arg
my $callpkg = caller($level);
$pkg->export($callpkg, @_);
};
=head1 NAME
Test::Builder::Module - Base class for test modules
=head1 SYNOPSIS
# Emulates Test::Simple
package Your::Module;
my $CLASS = __PACKAGE__;
use base 'Test::Builder::Module';
@EXPORT = qw(ok);
sub ok ($;$) {
my $tb = $CLASS->builder;
return $tb->ok(@_);
}
1;
=head1 DESCRIPTION
This is a superclass for Test::Builder-based modules. It provides a
handful of common functionality and a method of getting at the underlying
Test::Builder object.
=head2 Importing
Test::Builder::Module is a subclass of Exporter which means your
module is also a subclass of Exporter. @EXPORT, @EXPORT_OK, etc...
all act normally.
A few methods are provided to do the C<use Your::Module tests => 23> part
for you.
=head3 import
Test::Builder::Module provides an import() method which acts in the
same basic way as Test::More's, setting the plan and controling
exporting of functions and variables. This allows your module to set
the plan independent of Test::More.
All arguments passed to import() are passed onto
C<< Your::Module->builder->plan() >> with the exception of
C<import =>[qw(things to import)]>.
use Your::Module import => [qw(this that)], tests => 23;
says to import the functions this() and that() as well as set the plan
to be 23 tests.
import() also sets the exported_to() attribute of your builder to be
the caller of the import() function.
Additional behaviors can be added to your import() method by overriding
import_extra().
=cut
sub import {
my($class) = shift;
# Don't run all this when loading ourself.
return 1 if $class eq 'Test::Builder::Module';
my $test = $class->builder;
my $caller = caller;
$test->exported_to($caller);
$class->import_extra(\@_);
my(@imports) = $class->_strip_imports(\@_);
$test->plan(@_);
$class->$_export_to_level(1, $class, @imports);
}
sub _strip_imports {
my $class = shift;
my $list = shift;
my @imports = ();
my @other = ();
my $idx = 0;
while( $idx <= $#{$list} ) {
my $item = $list->[$idx];
if( defined $item and $item eq 'import' ) {
push @imports, @{$list->[$idx+1]};
$idx++;
}
else {
push @other, $item;
}
$idx++;
}
@$list = @other;
return @imports;
}
=head3 import_extra
Your::Module->import_extra(\@import_args);
import_extra() is called by import(). It provides an opportunity for you
to add behaviors to your module based on its import list.
Any extra arguments which shouldn't be passed on to plan() should be
stripped off by this method.
See Test::More for an example of its use.
B<NOTE> This mechanism is I<VERY ALPHA AND LIKELY TO CHANGE> as it
feels like a bit of an ugly hack in its current form.
=cut
sub import_extra {}
=head2 Builder
Test::Builder::Module provides some methods of getting at the underlying
Test::Builder object.
=head3 builder
my $builder = Your::Class->builder;
This method returns the Test::Builder object associated with Your::Class.
It is not a constructor so you can call it as often as you like.
This is the preferred way to get the Test::Builder object. You should
I<not> get it via C<< Test::Builder->new >> as was previously
recommended.
The object returned by builder() may change at runtime so you should
call builder() inside each function rather than store it in a global.
sub ok {
my $builder = Your::Class->builder;
return $builder->ok(@_);
}
=cut
sub builder {
return Test::Builder->new;
}
1;
| leighpauls/k2cro4 | third_party/cygwin/lib/perl5/5.10/Test/Builder/Module.pm | Perl | bsd-3-clause | 3,976 |
#
# Maintainers.pm - show information about maintainers
#
package Maintainers;
use strict;
use warnings;
use lib "Porting";
# Please don't use post 5.008 features as this module is used by
# Porting/makemeta, and that in turn has to be run by the perl just built.
use 5.008;
require "Maintainers.pl";
use vars qw(%Modules %Maintainers);
use vars qw(@ISA @EXPORT_OK $VERSION);
@ISA = qw(Exporter);
@EXPORT_OK = qw(%Modules %Maintainers
get_module_files get_module_pat
show_results process_options files_to_modules
finish_tap_output
reload_manifest);
$VERSION = 0.04;
require Exporter;
use File::Find;
use Getopt::Long;
my %MANIFEST;
# (re)read the MANIFEST file, blowing away any previous effort
sub reload_manifest {
%MANIFEST = ();
my $manifest_path = 'MANIFEST';
if (! -e $manifest_path) {
$manifest_path = "../MANIFEST";
}
if (open(my $manfh, $manifest_path )) {
while (<$manfh>) {
if (/^(\S+)/) {
$MANIFEST{$1}++;
}
else {
warn "MANIFEST:$.: malformed line: $_\n";
}
}
close $manfh;
} else {
die "$0: Failed to open MANIFEST for reading: $!\n";
}
}
reload_manifest;
sub get_module_pat {
my $m = shift;
split ' ', $Modules{$m}{FILES};
}
# exand dir/ or foo* into a full list of files
#
sub expand_glob {
sort { lc $a cmp lc $b }
map {
-f $_ ? # File as-is.
$_ :
-d _ ? # Recurse into directories.
do {
my @files;
find(
sub {
push @files, $File::Find::name
if -f $_ && exists $MANIFEST{$File::Find::name};
}, $_);
@files;
}
# The rest are globbable patterns; expand the glob, then
# recurively perform directory expansion on any results
: expand_glob(grep -e $_,glob($_))
} @_;
}
sub get_module_files {
my $m = shift;
my %exclude;
my @files;
for (get_module_pat($m)) {
if (s/^!//) {
$exclude{$_}=1 for expand_glob($_);
}
else {
push @files, expand_glob($_);
}
}
return grep !$exclude{$_}, @files;
}
sub get_maintainer_modules {
my $m = shift;
sort { lc $a cmp lc $b }
grep { $Modules{$_}{MAINTAINER} eq $m }
keys %Modules;
}
sub usage {
warn <<__EOF__;
$0: Usage:
--maintainer M | --module M [--files]
List modules or maintainers matching the pattern M.
With --files, list all the files associated with them
or
--check | --checkmani [commit | file ... | dir ... ]
Check consistency of Maintainers.pl
with a file checks if it has a maintainer
with a dir checks all files have a maintainer
with a commit checks files modified by that commit
no arg checks for multiple maintainers
--checkmani is like --check, but only reports on unclaimed
files if they are in MANIFEST
or
--opened | file ....
List the module ownership of modified or the listed files
--tap-output
Show results as valid TAP output. Currently only compatible
with --check, --checkmani
Matching is case-ignoring regexp, author matching is both by
the short id and by the full name and email. A "module" may
not be just a module, it may be a file or files or a subdirectory.
The options may be abbreviated to their unique prefixes
__EOF__
exit(0);
}
my $Maintainer;
my $Module;
my $Files;
my $Check;
my $Checkmani;
my $Opened;
my $TestCounter = 0;
my $TapOutput;
sub process_options {
usage()
unless
GetOptions(
'maintainer=s' => \$Maintainer,
'module=s' => \$Module,
'files' => \$Files,
'check' => \$Check,
'checkmani' => \$Checkmani,
'opened' => \$Opened,
'tap-output' => \$TapOutput,
);
my @Files;
if ($Opened) {
usage if @ARGV;
chomp (@Files = `git ls-files -m --full-name`);
die if $?;
} elsif (@ARGV == 1 &&
$ARGV[0] =~ /^(?:HEAD|[0-9a-f]{4,40})(?:~\d+)?\^*$/) {
my $command = "git diff --name-only $ARGV[0]^ $ARGV[0]";
chomp (@Files = `$command`);
die "'$command' failed: $?" if $?;
} else {
@Files = @ARGV;
}
usage() if @Files && ($Maintainer || $Module || $Files);
for my $mean ($Maintainer, $Module) {
warn "$0: Did you mean '$0 $mean'?\n"
if $mean && -e $mean && $mean ne '.' && !$Files;
}
warn "$0: Did you mean '$0 -mo $Maintainer'?\n"
if defined $Maintainer && exists $Modules{$Maintainer};
warn "$0: Did you mean '$0 -ma $Module'?\n"
if defined $Module && exists $Maintainers{$Module};
return ($Maintainer, $Module, $Files, @Files);
}
sub files_to_modules {
my @Files = @_;
my %ModuleByFile;
for (@Files) { s:^\./:: }
@ModuleByFile{@Files} = ();
# First try fast match.
my %ModuleByPat;
for my $module (keys %Modules) {
for my $pat (get_module_pat($module)) {
$ModuleByPat{$pat} = $module;
}
}
# Expand any globs.
my %ExpModuleByPat;
for my $pat (keys %ModuleByPat) {
if (-e $pat) {
$ExpModuleByPat{$pat} = $ModuleByPat{$pat};
} else {
for my $exp (glob($pat)) {
$ExpModuleByPat{$exp} = $ModuleByPat{$pat};
}
}
}
%ModuleByPat = %ExpModuleByPat;
for my $file (@Files) {
$ModuleByFile{$file} = $ModuleByPat{$file}
if exists $ModuleByPat{$file};
}
# If still unresolved files...
if (my @ToDo = grep { !defined $ModuleByFile{$_} } keys %ModuleByFile) {
# Cannot match what isn't there.
@ToDo = grep { -e $_ } @ToDo;
if (@ToDo) {
# Try prefix matching.
# Need to try longst prefixes first, else lib/CPAN may match
# lib/CPANPLUS/... and similar
my @OrderedModuleByPat
= sort {length $b <=> length $a} keys %ModuleByPat;
# Remove trailing slashes.
for (@ToDo) { s|/$|| }
my %ToDo;
@ToDo{@ToDo} = ();
for my $pat (@OrderedModuleByPat) {
last unless keys %ToDo;
if (-d $pat) {
my @Done;
for my $file (keys %ToDo) {
if ($file =~ m|^$pat|i) {
$ModuleByFile{$file} = $ModuleByPat{$pat};
push @Done, $file;
}
}
delete @ToDo{@Done};
}
}
}
}
\%ModuleByFile;
}
sub show_results {
my ($Maintainer, $Module, $Files, @Files) = @_;
if ($Maintainer) {
for my $m (sort keys %Maintainers) {
if ($m =~ /$Maintainer/io || $Maintainers{$m} =~ /$Maintainer/io) {
my @modules = get_maintainer_modules($m);
if ($Module) {
@modules = grep { /$Module/io } @modules;
}
if ($Files) {
my @files;
for my $module (@modules) {
push @files, get_module_files($module);
}
printf "%-15s @files\n", $m;
} else {
if ($Module) {
printf "%-15s @modules\n", $m;
} else {
printf "%-15s $Maintainers{$m}\n", $m;
}
}
}
}
} elsif ($Module) {
for my $m (sort { lc $a cmp lc $b } keys %Modules) {
if ($m =~ /$Module/io) {
if ($Files) {
my @files = get_module_files($m);
printf "%-15s @files\n", $m;
} else {
printf "%-15s %-12s %s\n", $m, $Modules{$m}{MAINTAINER}, $Modules{$m}{UPSTREAM}||'unknown';
}
}
}
} elsif ($Check or $Checkmani) {
if( @Files ) {
missing_maintainers(
$Checkmani
? sub { -f $_ and exists $MANIFEST{$File::Find::name} }
: sub { /\.(?:[chty]|p[lm]|xs)\z/msx },
@Files
);
} else {
duplicated_maintainers();
}
} elsif (@Files) {
my $ModuleByFile = files_to_modules(@Files);
for my $file (@Files) {
if (defined $ModuleByFile->{$file}) {
my $module = $ModuleByFile->{$file};
my $maintainer = $Modules{$ModuleByFile->{$file}}{MAINTAINER};
my $upstream = $Modules{$module}{UPSTREAM}||'unknown';
printf "%-15s [%-7s] $module $maintainer $Maintainers{$maintainer}\n", $file, $upstream;
} else {
printf "%-15s ?\n", $file;
}
}
}
elsif ($Opened) {
print STDERR "(No files are modified)\n";
}
else {
usage();
}
}
my %files;
sub maintainers_files {
%files = ();
for my $k (keys %Modules) {
for my $f (get_module_files($k)) {
++$files{$f};
}
}
}
sub duplicated_maintainers {
maintainers_files();
for my $f (keys %files) {
if ($TapOutput) {
if ($files{$f} > 1) {
print "not ok ".++$TestCounter." - File $f appears $files{$f} times in Maintainers.pl\n";
} else {
print "ok ".++$TestCounter." - File $f appears $files{$f} times in Maintainers.pl\n";
}
} else {
if ($files{$f} > 1) {
warn "File $f appears $files{$f} times in Maintainers.pl\n";
}
}
}
}
sub warn_maintainer {
my $name = shift;
if ($TapOutput) {
if ($files{$name}) {
print "ok ".++$TestCounter." - $name has a maintainer\n";
} else {
print "not ok ".++$TestCounter." - $name has NO maintainer\n";
}
} else {
warn "File $name has no maintainer\n" if not $files{$name};
}
}
sub missing_maintainers {
my($check, @path) = @_;
maintainers_files();
my @dir;
for my $d (@path) {
if( -d $d ) { push @dir, $d } else { warn_maintainer($d) }
}
find sub { warn_maintainer($File::Find::name) if $check->() }, @dir if @dir;
}
sub finish_tap_output {
print "1..".$TestCounter."\n";
}
1;
| cristiana214/cristianachavez214-cristianachavez | perl/src/Porting/Maintainers.pm | Perl | apache-2.0 | 9,199 |
use strict;
use CXGN::Page;
use CXGN::Page::FormattingHelpers qw/ page_title_html
blue_section_html /;
my ($intro_content, $example_content, $ref_content);
##########################################
#Define the introdution
$intro_content = "<tr><td><p>Clustal alignment file is the result file from a alignment program, such as clustalw[1] and t_coffee[2].</p></td></tr>";
#########################################
#Define the exaple
$example_content = "<tr><td colspan=\"2\">CLUSTAL W (1.81) multiple sequence alignment<br /><br /></td></tr>";
$example_content .= "<tr><td><tt>seq_1<br />seq_2<br /><br /></tt></td><td><tt>ATAGATCTTAAATTTTATTATTTTTCTTGAGTTCATCATCAACAAAACAACCCAATACAA<br />ATAGATCTTA--TTTTATTATTTTTCTTGAGTTCATCATCAACAAAACAACCCAATACAA<br /><br /></tt></td></tr>";
$example_content .= "<tr><td><tt>seq_1<br />seq_2<br /><br /></tt></td><td><tt>TATATCACAGAGAAACAAATACAAAGGAAAAGAATAGAAATGGCTAAAACTATCATGGTT<br />TATATCACAGAGAAACAAATACAAAGGAAAAGAATAGAAATGGCTAAAACTATCATGGTT<br /><br /></tt></td></tr>";
$example_content .= "<tr><td><tt>seq_1<br />seq_2<br /><br /></tt></td><td><tt>AATTTAACAGGGAAAGATGGGAAGGTTGAGTACCAATGCAAGACATCTGAGGTTGTCGTT<br />AATTTAACAGGGAAAGATGGGAAGGTTGAGTACCAATGCAAGACATCTA----TGGCGAC<br /><br /></tt></td></tr>";
$example_content .= "<tr><td><tt>seq_1<br />seq_2</tt></td><td><tt>GCAAACATGAAAGAACACATTGAGACAGATGAATGTGTCGATGCTTGTGGCGTTGACAGA<br />TTGAGCATGAAAGAACACATTGAGACAGATGAATGTGTCGATGCTTGTGGCGTTGACAGA<br /><br /></tt></td></tr>";
$example_content .= "<tr><td><tt>seq_1<br />seq_2</tt></td><td><tt>TCCCCTGTTTCTTTCTAATTTATTCCCTA<br />TCCCCTGTTTCTTTCTAATTTATTCCCTA<br /><br /></tt></td></tr>";
#################################################
#Define references
$ref_content = "<tr><th valign='top'>[1] </th><td><a href=\"http://www.ebi.ac.uk/clustalw\">www.ebi.ac.uk/clustalw</a></td></tr>";
$ref_content .= "<tr><th valign='top'>[2] </th><td><a href=\"http://www.igs.cnrs-mrs.fr/Tcoffee/tcoffee_cgi/index.cgi\">www.igs.cnrs-mrs.fr/Tcoffee/tcoffee_cgi/index.cgi</a></td></tr>";
################################################
#Generate the page
our $page = CXGN::Page->new( "Clustal Alignment File", "Chenwei Lin");
$page->header();
print page_title_html("Clustal Alignment File");
print blue_section_html('Introduction','<table width="100%" summary="" cellpadding="3" cellspacing="0" border="0">'.$intro_content.'</table>');
print blue_section_html('Example','<table width="100%" summary="" cellpadding="3" cellspacing="0" border="0">'.$example_content.'</table>');
print blue_section_html('References','<table width="100%" summary="" cellpadding="3" cellspacing="0" border="0">'.$ref_content.'</table>');
$page->footer();
| solgenomics/sgn | cgi-bin/about/clustal_file.pl | Perl | mit | 2,718 |
#!/usr/bin/perl -w
use warnings "all";
# ************************************************
# handles2csv.pl
# retrieves handles and writes them to a csv file.
#
# note: to keep it simple, pid-cmdline-0.0.3.jar must be located
# in the same directory. Change if you like.
# ************************************************
# disabled ARGV handling and basic exception handling (didn't work, though)
# **********************
# if no cmd arg (defining the handleinterface .jar) given
#if ($ARGV != 0) {
# print "No path overwrite given. Assuming default location and command";
# print "****";
# capture STDOUT to $handles
# $handles = qx{java -cp pid-cmdline-0.0.3.jar de.mannheim.ids.pid.cmdline.PidCommandLineClient -H handle.ids-mannheim.de -u repos -p wic4UJ3m list};
#}
#else {
# if a command line arg was given use this and capture STDOUT
# $handles = qx{$ARGV[0]};
#}
# ***********************
# option:
# for testing, load prefetched handles
# $handles = open(handlefile, '<', 'handles.txt') or die;
# return STDOUT of the command line call of PidCommandLineClient
$handles = qx{java -cp pid-cmdline-0.0.3.jar de.mannheim.ids.pid.cmdline.PidCommandLineClient -H handle.ids-mannheim.de -u repos -p wic4UJ3m list};
# split $handles into array
@handles_all = split /\n/, $handles;
# iterate over array, extract relevant infos and compose a new array
foreach $handle (@handles_all){
# check for matching dgdid reference
# complete regex for matching dgd items
# [A-Z]{2,4}-{0,3}?(_[ES]_[0-9]{5})?(_SE_\d{2}_[AT]_\d{2})?(_DF_\d{2})
# id=[A-Z]{2,4}-{0,3}?(_[ES]_[0-9]{5})?(_SE_\d{2}_[AT]_\d{2})?(_DF_\d{2})
if ($handle =~ /id=[A-Z]{2,4}-{0,3}?(_[ES]_[0-9]{5})?(_SE_\d{2}_[AT]_\d{2})?(_DF_\d{2})/ or
$handle =~ /id=[A-Z]{2,4}-{0,3}/ or
$handle =~ /id=[A-Z]{2,4}-{0,3}?(_[ES]_[0-9]{5})?(_SE_\d{2}_[AT]_\d{2})/)
{
# extract relevant infos (cumbersome approach)
my @dgd_handle = split /;/, $handle;
my $dgd_id = $dgd_handle[2];
my $url_prefix = "http://hdl.handle.net/";
my @dgd_subid = split("&id=", $dgd_id);
my $dgd_handle_url = join "", $url_prefix, $dgd_handle[1];
# push the id, url pairs to @dgdhandles
$dgd_handlestring = join(",", $dgd_subid[-1], $dgd_handle_url);
push @dgd_handles, join("", $dgd_handlestring, "\n");
}
}
#flush @dgd_handles to a csv file (hand-crafted approach)
open(CSVFILE, '>', 'dgdhandles.csv') or die "Could not open file 'dgdhandles.csv' $!";
print CSVFILE @dgd_handles;
close(CSVFILE);
| fkuhn/resource2pid-perl | cron/handles2csv.pl | Perl | mit | 2,461 |
This example {#invert ? 'will B<not>' : 'will'} return false:
{#./test_code.pod}
| ryangies/lsn-build | builders/perl/pod/case_false.pod | Perl | mit | 82 |
#!/usr/bin/perl -w
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
#
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License.
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#
#use FIGMODEL;
package ModelSaplingLoader;
use strict;
use Tracer;
use ERDB;
use base 'BaseSaplingLoader';
=head1 Sapling Model Load Group Class
=head2 Introduction
The Model Load Group includes a small set of tables that describe reactions and compounds
and how they relate to the models in the main model database.
=head3 new
my $sl = ModelSaplingLoader->new($erdb, $options);
Construct a new ModelSaplingLoader object.
=over 4
=item erdb
L<Sapling> object for the database being loaded.
=item options
Reference to a hash of command-line options.
=back
=cut
sub new {
# Get the parameters.
my ($class, $erdb, $options) = @_;
# Create the table list.
my @tables = qw(Compound Reaction EcNumber Model Media IsTriggeredBy
IsCategorizedInto IsConsistentWith IsModeledBy Involves
IsRequiredBy Complex ComplexName IsSetOf IsExemplarOf);
# Create the BaseSaplingLoader object.
my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);
# Create the reaction tracking hash.
$retVal->{reactions} = {};
# Return it.
return $retVal;
}
=head2 Public Methods
=head3 Generate
$sl->Generate();
Generate the data for the model files.
=cut
sub Generate {
# Get the parameters.
my ($self) = @_;
# Get the database object.
my $erdb = $self->db();
# Is this the global section?
if ($self->global()) {
# Load the tables from the model dump files.
$self->LoadModelFiles();
} else {
# Get the section ID.
my $genomeID = $self->section();
#NO GENOME SPECIFIC MODEL STUFF
}
}
=head3 LoadModelFiles
$sl->LoadModelFiles();
Load the data from the six model dump files.
=cut
# hash of ubiquitous compounds.
use constant UBIQUITOUS => {
cpd00001 => 'OH-',
cpd00002 => 'ATP',
cpd00003 => 'Nicotinamideadeninedinucleotide',
cpd00004 => 'Nicotinamideadeninedinucleotide-reduced',
cpd00005 => 'Nicotinamideadeninedinucleotidephosphate-reduced',
cpd00006 => 'Nicotinamideadeninedinucleotidephosphate',
cpd00007 => 'Oxygen',
cpd00008 => 'ADP',
cpd00009 => 'Orthophosphoric acid',
cpd00010 => 'CoenzymeA',
cpd00011 => 'Carbon dioxide',
cpd00012 => 'PPi',
cpd00018 => 'AMP',
cpd00020 => 'Pyruvic Acid',
cpd00022 => 'Acetyl-CoA',
cpd00025 => 'Hydrogen peroxide',
cpd00067 => 'H+',
cpd00971 => 'Sodium',
cpd15352 => '2-Demethylmenaquinone',
cpd15353 => '2-Demethylmenaquinol',
cpd15499 => 'Menaquinol',
cpd15500 => 'Menaquinone',
cpd15560 => 'Ubiquinone-8',
cpd15561 => 'Ubiquinol-8',
};
sub LoadModelFiles {
# Get the parameters.
my ($self) = @_;
# Get the sapling database.
my $erdb = $self->db();
# Get the model dump file directory.
my $dir = $erdb->LoadDirectory() . "/models";
# First we read the compounds.
my $ih = $self->CheckFile("$dir/CompoundName.txt", qw(CompoundID Name));
while (! eof $ih) {
# Get the next compound.
my ($id, $label) = $self->ReadLine($ih);
# Create a compound record for it.
$self->PutE(Compound => $id, label => $label, ubiquitous => (UBIQUITOUS->{$id} ? 1 : 0));
}
# Next, the compound-reactions relationship. We create the reactions here, too.
$ih = $self->CheckFile("$dir/CompoundReaction.txt", qw(CompoundID ReactionID
Stoichiometry Cofactor));
while (! eof $ih) {
# Get the next link.
my ($compound, $reaction, $stoich, $cofactor) = $self->ReadLine($ih);
# Insure the reaction exists.
$self->CreateReaction($reaction);
# Check for product or substrate.
my $product;
if ($stoich < 0) {
$product = 0;
$stoich = -$stoich;
} else {
$product = 1;
}
# Connect the reaction to the compound.
$self->PutR(Involves => $reaction, $compound, product => $product,
stoichiometry => $stoich, cofactor => $cofactor);
}
# Before we go on, we need to get a map of the modelSEED role IDs to
# the SEED role IDs. This is found in the Role.txt file, along with the
# exemplar data.
my %roleHash;
$ih = $self->CheckFile("$dir/Role.txt", qw(RoleID Name ExemplarID));
while (! eof $ih) {
# Get the next role's record.
my ($roleID, $role, $exemplarList) = $self->ReadLine($ih);
# Map the role ID to the role name (which is the SEED's ID).
$roleHash{$roleID} = $role;
# If there is are exemplars, store them.
if ($exemplarList && $exemplarList ne 'NONE') {
for my $exemplar (split /\s*,\s*/, $exemplarList) {
$self->PutR(IsExemplarOf => $exemplar, $role);
}
}
}
# The next step is to create the complexes. We load into memory a
# hash mapping the complexes to their reactions. This is later
# used to insure we have reaction-to-role coverage.
my %cpxHash;
$ih = $self->CheckFile("$dir/ReactionComplex.txt", qw(ReactionID ComplexID));
while (! eof $ih) {
# Get the next reaction/complex pair.
my ($rxn, $cpx) = $self->ReadLine($ih);
# Is this a new complex?
if (! exists $cpxHash{$cpx}) {
# Yes. Create a record for it.
$self->PutE(Complex => $cpx);
$cpxHash{$cpx} = [];
}
# Insure the reaction exists.
$self->CreateReaction($rxn);
# Connect the complex to the reaction.
$self->PutR(IsSetOf => $cpx, $rxn);
push @{$cpxHash{$cpx}}, $rxn;
}
# Here we connect the complexes to the roles. Along the way, we
# create a hash listing of all of a reaction's roles. That hash
# will be used to check for missing reaction/role links later on.
my %rxnHash;
$ih = $self->CheckFile("$dir/ComplexRole.txt", qw(RoleID ComplexID));
while (! eof $ih) {
# Get the next role/complex pair.
my ($roleID, $cpx) = $self->ReadLine($ih);
# Connect the role to the complex.
$self->PutR(IsTriggeredBy => $cpx, $roleHash{$roleID}, optional => 0);
# Denote that this role is connected to the complex's reactions.
for my $rxn (@{$cpxHash{$cpx}}) {
push @{$rxnHash{$rxn}}, $roleID;
}
}
# We don't need the complex hash any more. Instead, we're going to
# use it to track single-reaction complexes we create.
%cpxHash = ();
# Now we fill in the missing reaction-to-role connections.
$ih = $self->CheckFile("$dir/ReactionRole.txt", qw(ReactionID Role));
while (! eof $ih) {
# Get the next reaction/role pair.
my ($reaction, $role) = $self->ReadLine($ih);
# Insure the reaction exists.
$self->CreateReaction($reaction);
# Is this reaction already connected to this role?
my $roleList = $rxnHash{$reaction};
if (! $roleList || ! (grep { $roleHash{$_} eq $role } @{$rxnHash{$reaction}})) {
# No, so we have to do it the hard way.
if (! exists $cpxHash{$reaction}) {
# Here the reaction has not had a complex created, so we
# must create one.
$self->Add(pseudoComplex => 1);
$self->PutE(Complex => $reaction);
$self->PutR(IsSetOf => $reaction, $reaction);
}
# Connect the reaction's complex to this role.
$self->PutR(IsTriggeredBy => $reaction, $role);
$self->Add(missingTrigger => 1);
}
}
# Now we create the models.
$ih = $self->CheckFile("$dir/ModelGenome.txt", qw(ModelID Name GenomeID));
while (! eof $ih) {
# Get the next model.
my ($model, $name, $genome) = $self->ReadLine($ih);
# Create the model.
$self->PutE(Model => $model);
# Connect it to the genome. Again, the genomes are created elsewhere.
$self->PutR(IsModeledBy => $genome, $model);
}
# Next we connect the reactions to models.
$ih = $self->CheckFile("$dir/ModelReaction.txt", qw(ModelID ReactionID));
while (! eof $ih) {
# Get the next line.
my ($model, $reaction) = $self->ReadLine($ih);
# Only proceed if a reaction is present.
if ($reaction) {
# Insure the reaction exists.
$self->CreateReaction($reaction);
# Connect the reaction to the model.
$self->PutR(IsRequiredBy => $reaction, $model);
}
}
}
=head3 CheckFile
my $ih = $sl->CheckFile($fileName, @fieldNames);
Read the header record of the specified file and verify that the field names match
the names in the input list. If they do not, an error will be thrown; if they do, an
open file handle will be returned, positioned on the first data record.
=over 4
=item fileName
Name for the input file. The file is in standard tab-delimited format. The first record
contains the field names and the remaining records contain the data.
=item fieldNames
List of the field names expected, in order.
=item RETURN
Returns the open file handle if successful. If there is a mismatch, throws an error.
=back
=cut
sub CheckFile {
# Get the parameters.
my ($self, $fileName, @fieldNames) = @_;
# Open the file.
my $retVal = Open(undef, "<$fileName");
$self->Add(files => 1);
# Read in the file header.
my @actualFields = Tracer::GetLine($retVal);
# This will be set to TRUE if there's a mismatch.
my $error = 0;
for (my $i = 0; $i <= $#fieldNames; $i++) {
if ($fieldNames[$i] ne $actualFields[$i]) {
Trace("Field match error: expected $fieldNames[$i], found $actualFields[$i].") if T(0);
$error = 1;
}
}
# Was there an error?
if ($error) {
# Yes, so abort.
Confess("Invalid field name header in $fileName.");
} else {
# No, so trace the open.
Trace("Processing $fileName.") if T(ERDBLoadGroup => 2);
}
# Return the file handle.
return $retVal;
}
=head3 ReadLine
my @fields = $sl->ReadLine($ih);
Read a line of data from an input file.
=over 4
=item ih
Open file handle for the input file.
=item RETURN
Returns a list of the field values for the next record in the file.
=back
=cut
sub ReadLine {
# Get the parameters.
my ($self, $ih) = @_;
# Read the line.
my @retVal = Tracer::GetLine($ih);
# Count this record.
$self->Track(records => $retVal[0], 1000);
# Return the data.
return @retVal;
}
=head3 CheckReaction
$sl->CheckReaction($reaction);
Insure we have created a rectord for the specified reaction.
=over 4
=item reaction
ID of the reaction in question.
=back
=cut
sub CreateReaction {
# Get the parameters.
my ($self, $reaction) = @_;
# Get the reaction hash.
my $reactionH = $self->{reactions};
# See if this reaction is new.
if (! $reactionH->{$reaction}) {
# It is, so create it.
$self->PutE(Reaction => $reaction);
# Insure we don't create it again.
$reactionH->{$reaction} = 1;
}
}
1;
| kbase/kb_seed | lib/ModelSaplingLoader.pm | Perl | mit | 11,801 |
use strict;
use Data::Dumper;
use Bio::KBase::Utilities::ScriptThing;
use Carp;
#
# This is a SAS Component
#
=head1 NAME
get_entity_TaxonomicGrouping
=head1 SYNOPSIS
get_entity_TaxonomicGrouping [-c N] [-a] [--fields field-list] < ids > table.with.fields.added
=head1 DESCRIPTION
We associate with most genomes a "taxonomy" based on
the NCBI taxonomy. This includes, for each genome, a list of
ever larger taxonomic groups. The groups are stored as
instances of this entity, and chained together by the
IsGroupFor relationship.
Example:
get_entity_TaxonomicGrouping -a < ids > table.with.fields.added
would read in a file of ids and add a column for each field in the entity.
The standard input should be a tab-separated table (i.e., each line
is a tab-separated set of fields). Normally, the last field in each
line would contain the id. If some other column contains the id,
use
-c N
where N is the column (from 1) that contains the id.
This is a pipe command. The input is taken from the standard input, and the
output is to the standard output.
=head2 Related entities
The TaxonomicGrouping entity has the following relationship links:
=over 4
=item IsGroupFor TaxonomicGrouping
=item IsInGroup TaxonomicGrouping
=item IsRepresentedBy ObservationalUnit
=item IsTaxonomyOf Genome
=back
=head1 COMMAND-LINE OPTIONS
Usage: get_entity_TaxonomicGrouping [arguments] < ids > table.with.fields.added
-a Return all available fields.
-c num Select the identifier from column num.
-i filename Use filename rather than stdin for input.
--fields list Choose a set of fields to return. List is a comma-separated list of strings.
-a Return all available fields.
--show-fields List the available fields.
The following fields are available:
=over 4
=item domain
TRUE if this is a domain grouping, else FALSE.
=item hidden
TRUE if this is a hidden grouping, else FALSE. Hidden groupings are not typically shown in a lineage list.
=item scientific_name
Primary scientific name for this grouping. This is the name used when displaying a taxonomy.
=item alias
Alternate name for this grouping. A grouping may have many alternate names. The scientific name should also be in this list.
=back
=head1 AUTHORS
L<The SEED Project|http://www.theseed.org>
=cut
our $usage = <<'END';
Usage: get_entity_TaxonomicGrouping [arguments] < ids > table.with.fields.added
-c num Select the identifier from column num
-i filename Use filename rather than stdin for input
--fields list Choose a set of fields to return. List is a comma-separated list of strings.
-a Return all available fields.
--show-fields List the available fields.
The following fields are available:
domain
TRUE if this is a domain grouping, else FALSE.
hidden
TRUE if this is a hidden grouping, else FALSE. Hidden groupings are not typically shown in a lineage list.
scientific_name
Primary scientific name for this grouping. This is the name used when displaying a taxonomy.
alias
Alternate name for this grouping. A grouping may have many alternate names. The scientific name should also be in this list.
END
use Bio::KBase::CDMI::CDMIClient;
use Getopt::Long;
#Default fields
my @all_fields = ( 'domain', 'hidden', 'scientific_name', 'alias' );
my %all_fields = map { $_ => 1 } @all_fields;
my $column;
my $a;
my $f;
my $i = "-";
my @fields;
my $help;
my $show_fields;
my $geO = Bio::KBase::CDMI::CDMIClient->new_get_entity_for_script('c=i' => \$column,
"all-fields|a" => \$a,
"help|h" => \$help,
"show-fields" => \$show_fields,
"fields=s" => \$f,
'i=s' => \$i);
if ($help)
{
print $usage;
exit 0;
}
if ($show_fields)
{
print STDERR "Available fields:\n";
print STDERR "\t$_\n" foreach @all_fields;
exit 0;
}
if ($a && $f)
{
print STDERR "Only one of the -a and --fields options may be specified\n";
exit 1;
}
if ($a)
{
@fields = @all_fields;
}
elsif ($f) {
my @err;
for my $field (split(",", $f))
{
if (!$all_fields{$field})
{
push(@err, $field);
}
else
{
push(@fields, $field);
}
}
if (@err)
{
print STDERR "get_entity_TaxonomicGrouping: unknown fields @err. Valid fields are: @all_fields\n";
exit 1;
}
} else {
print STDERR $usage;
exit 1;
}
my $ih;
if ($i eq '-')
{
$ih = \*STDIN;
}
else
{
open($ih, "<", $i) or die "Cannot open input file $i: $!\n";
}
while (my @tuples = Bio::KBase::Utilities::ScriptThing::GetBatch($ih, undef, $column)) {
my @h = map { $_->[0] } @tuples;
my $h = $geO->get_entity_TaxonomicGrouping(\@h, \@fields);
for my $tuple (@tuples) {
my @values;
my ($id, $line) = @$tuple;
my $v = $h->{$id};
if (! defined($v))
{
#nothing found for this id
print STDERR $line,"\n";
} else {
foreach $_ (@fields) {
my $val = $v->{$_};
push (@values, ref($val) eq 'ARRAY' ? join(",", @$val) : $val);
}
my $tail = join("\t", @values);
print "$line\t$tail\n";
}
}
}
__DATA__
| kbase/kb_seed | scripts/get_entity_TaxonomicGrouping.pl | Perl | mit | 5,184 |
:- module(vworld_apis, [pen_get_vworld/1]).
/** <module> external pengine visible api's
*/
:- use_module(vworld).
%% pen_get_vworld(-List:list) is nondet
%
% binds List to current list of nouns in vworld and
pen_get_vworld(List) :-
repeat, % yes, repeat success loop. get_vworld is volatile
get_vworld(List).
| Anniepoo/games4diversity | server/vworld_apis.pl | Perl | mit | 322 |
package App::KADR::Config;
# ABSTRACT: KADR configuration
use App::KADR::Collate ':all';
use App::KADR::Moose;
use App::KADR::Path 'dir';
use File::HomeDir;
use List::MoreUtils qw(all);
use Moose::Util::TypeConstraints;
with qw(MooseX::Getopt MooseX::SimpleConfig);
MooseX::Getopt::OptionTypeMap->add_option_type_to_map(Collate, '=s');
subtype 'ExistingDir' => as class_type('App::KADR::Path::Dir') => where { -d $_ };
coerce 'ExistingDir' => from 'Str' => via { dir($_)->absolute };
subtype 'ExistingDirs', as 'ArrayRef[ExistingDir]' => where { all { -d $_ } @$_ };
coerce 'ExistingDirs', from 'ArrayRef', via { [map { dir($_)->absolute } @$_] };
my $appdir = dir(File::HomeDir->my_home)->subdir('.kadr');
my $database = 'dbi:SQLite:' . $appdir->file('db');
my @default_config_files
= map { $_->stringify } grep { $_->is_file_exists }
$appdir->file('config.yml'), $appdir->file('login.yml');
has '+configfile',
default => sub{ [@default_config_files] },
documentation => 'Default: ~/.kadr/config.yml';
has [qw(anidb_username anidb_password)], isa => 'Str', required => 1;
has 'cache_timeout_anime', default => 12*24*60*60, isa => 'Int';
has 'cache_timeout_file', default => 12*24*60*60, isa => 'Int';
has 'cache_timeout_mylist_unwatched', default => 12*60*60, isa => 'Int';
has 'cache_timeout_mylist_watched', default => 91*24*60*60, isa => 'Int';
has 'cache_timeout_mylist_watching', default => 2*60*60, isa => 'Int';
has 'collator', default => 'auto', isa => Collate;
has 'database', default => $database, isa => 'Str';
has 'delete_empty_dirs_in_scanned', default => 1, isa => 'Str';
has 'dirs_to_scan', isa => 'ExistingDirs', required => 1;
has 'expire_cache',
default => 1,
documentation => "DEBUG OPTION. Negate to prevent deleting old cached records.",
isa => 'Bool';
has 'file_naming_scheme',
default => sub {
shift->dirs_to_scan->[0] . <<'EOF'
/
<: $file.episode_watched ? 'watched' : $anime_mylist.watched_eps ? 'watching' : 'unwatched' :>/
: if not $file.is_primary_episode {
<: $anime.romaji_name :>/
: }
<: $anime.romaji_name :>
: if $file.is_primary_episode {
: if $file.version > 1 { print ' v' ~ $file.version }
: }
: else {
- <: $file.episode_number_padded :>
: if $file.version > 1 { print 'v' ~ $file.version }
- <: $file.episode_english_name :>
: }
: if $file.group_short_name != 'raw' { print ' [' ~ $file.group_short_name ~ ']' }
.<: $file.file_type :>
EOF
},
isa => 'Str',
lazy => 1;
has 'hash_only',
default => 0,
documentation => q{Enable to skip processing of files and just hash them.},
isa => 'Bool';
has 'load_local_cache_into_memory',
default => 1,
documentation => q{Disable to reduce memory usage when doing a longer run. About 15 times faster when kadr doesn't have to talk to anidb.},
isa => 'Bool';
has 'query_attempts',
default => -1,
documentation => 'Number of times to retry a query after a timeout. Default: Unlimited',
isa => 'Int';
has 'query_timeout',
default => 15.0,
documentation => 'Minimum time to wait for a response to a query. Default: 15.0 seconds',
isa => 'Num';
has 'test',
default => 0,
documentation => 'Test mode, make no changes.',
isa => 'Bool';
has 'time_to_sleep_when_busy',
default => 10*60,
documentation => q{How long (in seconds) to sleep if AniDB informs us it's too busy to talk to us.},
isa => 'Int';
has 'update_anidb_records_for_deleted_files', default => 0, isa => 'Bool';
has 'windows_compatible_filenames',
default => 0,
documentation => 'Default: false. Set to true to make Windows not shit bricks.',
isa => 'Bool';
| Kulag/KADR | lib/App/KADR/Config.pm | Perl | mit | 3,667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.