Image-DS9
view release on metacpan or search on metacpan
lib/Image/DS9.pm view on Meta::CPAN
package Image::DS9;
# ABSTRACT: interface to the DS9 image display and analysis program
use v5.10;
use strict;
use warnings;
use Module::Runtime 'use_module';
our $VERSION = 'v1.0.1';
use IPC::XPA;
use Safe::Isa;
use Image::DS9::Command;
use Image::DS9::Util 'parse_version';
use Time::HiRes qw[ sleep ];
use Ref::Util 'is_ref', 'is_arrayref';
use List::Util 'any', 'first';
use Log::Any '$log', prefix => ( __PACKAGE__ . q{: } );
use Image::DS9::Constants::V1 -terminate_ds9, 'TERMINATE_DS9';
use constant SERVER => 'ds9';
use namespace::clean;
use constant HAVE_PDL => eval { ## no critic(ErrorHandling::RequireCheckingReturnValueOfEval)
use_module( 'PDL::Core' );
use_module( 'PDL::Types' );
1;
};
#####################################################################
sub _flatten_hash {
my ( $hash ) = @_;
return q{} unless keys %$hash;
join( q{,}, map { "$_=" . $hash->{$_} } keys %$hash );
}
sub _croak {
require Carp;
my $fmt = shift;
@_ = sprintf( $fmt, @_ );
goto \&Carp::croak;
}
sub _pp {
require Data::Dump;
goto \&Data::Dump::pp;
}
#####################################################################
# create new XPA object
{
my %def_obj_attrs = (
Server => SERVER,
StartTimeOut => 2,
QueryTimeOut => 2,
WaitTimeInterval => 0.1,
min_servers => 1,
res_wanthash => 1,
terminate_on_destroy => TERMINATE_DS9_NO,
daemonize => 0,
auto_start => 0,
verbose => 0,
ds9 => 'ds9',
origin => undef,
);
my %def_xpa_attrs = ( max_servers => 1 );
my %def_cmd_attrs = (
ResErrCroak => 0,
( run in 0.884 second using v1.01-cache-2.11-cpan-39bf76dae61 )