Astro-satpass

 view release on metacpan or  search on metacpan

script/satpass  view on Meta::CPAN

#	@names = _get_spacetrack_attrib_names ();

#	Get the names of all the Spacetrack attributes.

{	# local symbol block.
my @names;

sub _get_spacetrack_attrib_names {
unless (@names) {
    my $st = _get_spacetrack ();
    if ($st->can ('attribute_names')) {
	@names = $st->attribute_names ();
	}
      else {
	eval {$st->get ('##')};
	(my $data = $@) =~ s/.*?Legal attributes are\s+//;
	$data =~ s/\..*//s;
	@names = split ',\s*', $data;
	}
    }
@names;
}
}	# end local symbol block;

#	_get_station ();

#	This subroutine manufactures and returns a station object
#	appropriate to the current parameter settings. It throws an
#	exception if the height, latitude, and longitude are not
#	defined.

sub _get_station {
defined $parm{height} && defined $parm{latitude} &&
    defined $parm{longitude} or die <<eod;
Error - You must set height, latitude, and longitude to use this
        function.
eod
    Astro::Coord::ECI->new (
	    almanac_horizon	=> $parm{_almanac_horizon},
	    horizon		=> $parm{_horizon},
	    refraction		=> $parm{refraction},
	    name		=> $parm{location} || 'Station',
	    id			=> 'station',
	    )
	->geodetic (
	    deg2rad ($parm{latitude}), deg2rad ($parm{longitude}),
	    $parm{height} / 1000);
}

#	$suf = _get_suffix ($prefix, $backoff);

#	Gets the suffix of the caller's name. All that this really does
#	is to get the caller's name and use the length of the prefix
#	argument to determine the number of characters to strip off the
#	front. The optional $backoff argument says how many levels of
#	call to back off; the default is 1, meaning to get the suffix
#	of the caller.

sub _get_suffix {
    my ( $prefix, $backoff ) = @_;
    my $rtn = ( caller( $backoff || 1 ) )[3];
    $rtn =~ s/ .* :: //smx;
    $rtn =~ s/ \A _+ //smx;
    $rtn = substr $rtn, length $prefix;
    $rtn =~ s/ __ .* //smx;
    $rtn;
}

#	$string = _get_time ($name);

#	Accessor for a time attribute. Returns '0' if the attribute is
#	not set, or a string representing the attribute in GMT if it is
#	set.

sub _get_time {
    my ($name) = @_;
    if ($parm{$name}) {
	return gm_strftime '%d-%b-%Y %H:%M:%S UT', $parm{$name};
    } else {
	return 0;
    }
}

#	__PACKAGE__->_iridium_status ($text)

#	Parses the given text and updates the status of all Iridium
#	satellites. If no argument specified, the status is retrieved
#	using Astro::SpaceTrack->iridium_status ().

#	We use the OO calling convention for convenience in dispatch.

sub _iridium_status {
shift;
unless (@_) {
    my $st = _get_spacetrack ();
    my ($rslt, @rest) = $st->iridium_status;
    $rslt->is_success or die $rslt->status_line;
    push @_, @rest;
    }

if ( @_ && ARRAY_REF eq ref $_[0] ) {
    Astro::Coord::ECI::TLE->status (clear => 'iridium');
    foreach (@{$_[0]}) {
	Astro::Coord::ECI::TLE->status (add => $_->[0], iridium =>
	    $_->[4], $_->[1], $_->[3]);
    }
} else {
    confess <<eod;
Program error - Portable status not passed, and unavailable from
        Astro::SpaceTrack->iridium_status.
eod
}

foreach my $tle (@bodies) {
    $tle->rebless ();
    }

}

#	$handle = _memio ($access, \$memory)



( run in 0.914 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )