Astro-satpass
view release on metacpan or search on metacpan
Astro::Coord::ECI::TLE 0.013:
* Add semimajor(), to calculate and return the semimajor axis of the
orbit.
* Update Iridium status: mark Iridium 28 (OID 24948) failed, and
Iridium 95 (OID 27375) as in service (was spare).
bin/satpass 0.018:
* Under Mac OS X, use Mac::Pasteboard for clipboard operations if
available; supress pbcopy warning when run as cron job.
* Fix 'height' query to track changes in USGS' elevation web service.
t/tle_sgp4r.t:
* Correct the code that extracts the needed TLEs from the downloaded
zip file.
0.017 2007-12-30 T. R. Wyant
providing our own if not.
* Clarify load_module() documentation.
bin/satpass 0.017:
* Use looks_like_number() and max() from Astro::Coord::ECI::Utils.
* Recode _load_module to use Astro::Coord::ECI::Utils::load_module.
* Fix clipboard code to fail gracefully if Scalar::Util::weaken
is unavailable.
t/{moon,sun}.t:
* Skip singleton test if Scalar::Util::refaddr not available.
t/pod_coverage.t:
* Correct also_private setting to make it skip all-uppercase+numeric
(blind fix since mine seems to skip constants anyway, which is
t/tle.t:
* Use max() from Astro::Coord::ECI::Utils.
t/pod_spelling.t 0.010:
* Add stop words 'max' and 'min'.
bin/satpass 0.017:
* Supress '"our" variable $clipboard_unavailable masks earlier
declaration ...' under 5.10.0.
0.016 2007-12-28 T. R. Wyant
Astro::Coord::ECI 0.016:
* Increment version. No other changes.
Astro::Coord::ECI::TLE 0.011:
* Use PI-related constants from Astro::Coord::ECI::Utils.
its replacement by Iridium 97.
Astro::Coord::ECI::TLE::Iridium 0.002:
* Fixed occasional borderline-case spurious flare prediction.
bin/satpass 0.013:
* Added -version command option, to display preamble and exit.
* Wrap probe for clipboard helpers in eval{}. Among other things, this
allows the script to run in taint mode.
* Add -choose option to list().
* Allow extra arguments to status show, to do selective status display.
t/moon.t:
* Fixed cosmetic undefined value error when Scalar::Util does not
implement refaddr().
when we have more than one set of orbital elements.
* Add help for Astro::Coord::ECI::TLE::Set.
* Add and document 'singleton' parameter. Use it in pass() and
position().
* Default end times relative to start times, rather than relative
to the last explicit time.
* Fix interaction between clipboard functionality and test hook.
Thanks to IMACAT for help diagnosing and verifying.
* Add acknowledgments.
0.007 2006-07-06 T. R. Wyant
ECI.pm:
* Optimize, mostly by being smarter about when to clear cached
coordinates.
script/satpass view on Meta::CPAN
{
local $@ = undef;
use constant HAVE_TLE_IRIDIUM => eval {
require Astro::Coord::ECI::TLE::Iridium;
1;
} || 0;
}
my (
$clipboard_unavailable,
$io_string_unavailable,
);
$clipboard_unavailable = $IO::Clipboard::clipboard_unavailable;
########################################################################
#
# Initialization
#
our $VERSION = '0.135';
use constant LINFMT => <<eod;
%s %s %8.4f %9.4f %7.1f %-4s %s
script/satpass view on Meta::CPAN
my $fh = *STDIN;
my @frame;
my %alias = (
'!' => 'system',
'.' => 'source',
bye => 'exit',
quit => 'exit',
);
GetOptions (\%opt, qw{clipboard filter initialization_file=s
version}) or die <<eod;
Predict satellite visibility.
usage: perl @{[basename $0]} [options] [command ...]
where the legal options are
-clipboard
Asserting this option causes all output to stdout to be captured
and placed on the system clipboard. Command-line output redirection
is ignored.
-filter
Asserting this option suppresses extraneous output, making satpass
behave more like a Unix filter.
-initialization_file filename
Initializes satpass from the named file. The default is
$inifil.
-version
Display the version and exit. Overrides -filter if both are
specified.
Option names can be abbreviated, as long as the abbreviation is unique.
$clipboard_unavailable
eod
$inifil || $opt{initialization_file} or warn <<eod;
Warning - Can not find home directory, and no explicit initialization
file specified.
eod
if ($opt{initialization_file}) {
if (-e $opt{initialization_file}) {
$inifil = $opt{initialization_file};
script/satpass view on Meta::CPAN
Warning - File $opt{initialization_file} does not exist.
Initializing with $inifil
eod
}
}
$ENV{SATPASSINI} = $inifil;
my $interrupted = 'Interrupted by user.';
$opt{clipboard} and select (IO::Clipboard->new ());
CODE_REF eq ref $Astro::satpass::Test::Hook and do {
$fh = Astro::satpass::Test->new () or die <<eod;
Error - Failed to instantiate Astro::satpass::Test object.
eod
select ($fh);
no warnings qw{once};
$SIG{__WARN__} = sub {$Astro::satpass::Test::Exception = $_[0]};
use warnings qw{once};
};
script/satpass view on Meta::CPAN
};
# Parse any command options present. Note that GetOptions is
# configured to pass any unrecognized options because otherwise
# our relative time format would confuse it.
%cmdopt = ();
{ # Begin local symbol block.
local @ARGV = @args;
Getopt::Long::Configure (@{$cmdconfig{$verb} ||= ['permute']});
GetOptions (\%cmdopt, qw{clipboard debug time}, @{$cmdlgl{$verb} ||= []});
@args = @ARGV;
}
$cmdopt{_redirection} = $cmdopt{clipboard} ? '-clipboard' : $redout;
# Preserve our current output, and redirect as and if specified.
if ($cmdopt{clipboard}) {
$redout = '';
my $fh = eval {IO::Clipboard->new ()};
$@ and do {warn $@; next;};
select ($fh) or die <<eod;
Error - Failed to redirect output to clipboard.
$!
eod
}
elsif ($redout) {
open (my $fh, $redout) or do {warn <<eod; next};
Error - Failed to open '$redout'
$!
eod
select ($fh) or die <<eod;
Error - Failed to redirect output to $redout.
script/satpass view on Meta::CPAN
use Carp;
use Config;
use Symbol;
my ($clip, $clipout, $memio);
our @ISA;
BEGIN {
$IO::Clipboard::clipboard_unavailable = '';
eval "use Scalar::Util qw{weaken}; 1"
or $IO::Clipboard::clipboard_unavailable = <<eod;
Error - Clipboard unavailable. Unable to load Scalar::Util weaken.
eod
sub _win32 {
eval "use Win32::Clipboard" ?
sub {(my $s = $_[0]) =~ s/\n/\r\n/mg;
Win32::Clipboard->new ()->Set ($s)} : undef
}
sub _xclip {
script/satpass view on Meta::CPAN
my $hdl;
open ($hdl, '|pbcopy') or croak <<eod;
Error - Failed to open handle to pbcopy.
$!
eod
print $hdl $_[0];
};
}
sub _flunk {
$IO::Clipboard::clipboard_unavailable = shift;
}
my $err = "Can not open handle to clipboard.";
$clipout = eval {$^O eq 'MSWin32' ? _win32 || _flunk (<<eod) :
Error - Clipboard unavailable. Can not load Win32::Clipboard.
eod
$^O eq 'cygwin' ? _win32 || _xclip || _flunk (<<eod) :
Error - Clipboard unavailable. Can not load Win32::Clipboard
and xclip has not been installed. For xclip, see
http://freshmeat.net/projects/xclip
eod
$^O eq 'darwin' ? _pb || _flunk (<<eod) :
script/satpass view on Meta::CPAN
$@ or push @ISA, 'IO::String';
$@ ? sub {croak "$err IO::String not available"} :
sub {new IO::String ($_[1])};
};
*_memio = \&$memio;
}
sub new {
return $clip if $clip;
croak $IO::Clipboard::clipboard_unavailable
if $IO::Clipboard::clipboard_unavailable;
my $class = shift;
my $data = '';
my $clip = _memio ('>', \$data);
*$clip->{__PACKAGE__}{data} = \$data;
bless $clip, $class;
my $self = $clip;
weaken ($clip); # So we destroy the held copy when we need to.
$self;
}
script/satpass view on Meta::CPAN
somewhere on the command line. It is also possible to redirect the data
into a spawned command using the pipe character ('|'). Additional pipe
characters may be specified on the same command line if your operating
system supports this. Note that the redirection character B<must> be the
first character of the token; that is, 'pass >file.txt' or 'pass |less',
but not 'pass>file.txt' or 'pass|less'. See the L</SYNOPSIS> for
examples.
In addition, all commands support the following options:
-clipboard places the output of the command on the clipboard. This
will be discussed more below.
-debug is accepted but not supported - that is, the author makes
no claims of what will happen if you assert it, and reserves the
right to change this behavior without warning. It is really a
development aid.
-time causes the elapsed time of the command in seconds to be
displayed. This is another development aid.
Individual commands may have options specific to them. Option names
may be abbreviated, provided the abbreviation is unique among all
options valid for that command. They may appear anywhere in the
command line unless otherwise documented with the specific command
('system' being the only exception at the moment).
If the -clipboard option is asserted, output to standard out will
be placed on the clipboard. This output will not appear on the
clipboard until the command completes.
The clipboard functionality requires the availability of the
Win32::Clipboard module under MSWin32 (standard with ActivePerl), the
Mac::Pasteboard module or the pbcopy command under darwin (and any Mac
OS X I know of comes with pbcopy and pbpaste), or the xclip command
(available from L<http://freshmeat.sourceforge.net/projects/xclip>)
under any other operating system.
The clipboard functionality is implemented as a singleton object,
so that if you redirect output away from the clipboard and then
back to it, both sets of clipboard data are considered to be the
same data stream, and both end up on the clipboard, without the
intervening data.
The command loop also supports rudimentary interpolation of arguments
and other values into commands. The "magic" character is a dollar sign,
which may be followed by the name of what is to be substituted. A
number represents the corresponding macro or source argument (numbered
from 1), and anything else represents the value of the named parameter
(if it exists) or environment variable (if not). The name may be
optionally enclosed in curly brackets.
script/satpass view on Meta::CPAN
Technically, what happens is that if the current output is a tty,
the command is executed using the core system command; otherwise
its output is captured with backticks and printed.
If the command is omitted, the value of environment variable SHELL
is used as the command, with the intent of dropping you into the
given shell. If environment variable SHELL is not defined and you
are running under MSWin32, value 'cmd' is used as the command.
The -clipboard qualifier B<must> come immediately after the verb
'system', and before the name of the command you are actually
issuing if any. This restriction is to prevent legal qualifiers
from being stripped from the command. For example:
satpass> system -c ls
Issues the 'ls' command, and captures the output on the clipboard.
That is to say the satpass script handles the -c. But
satpass> system ls -c
displays the status change time of the file, with output going to
standard out. That is to say the ls command handles the -c.
=item times
satpass> times time
script/satpass view on Meta::CPAN
=head1 INVOCATION
Assuming this script is installed as an executable, you should be able
to run it just by specifying its name. Under VMS, the DCL$PATH logical
name must include the directory into which the script was installed.
The only command qualifiers are
=over
=item -clipboard
which causes all output to go to the clipboard. Use of this qualifier
requires module Win32::Clipboard under MSWin32 (standard with
ActivePerl), the Mac::Pasteboard module or the 'pbcopy' command under
Darwin (the latter standard with Mac OS X), or the xclip command
(available from L<http://freshmeat.sourceforge.net/projects/xclip>)
under any other operating system. This script will warn and abort the
command using this option if the requisites are not available.
=item -filter
which suppresses extraneous output to make satpass behave more like a
script/satpass view on Meta::CPAN
Support is by the author. Please file bug reports at
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Astro-satpass>,
L<https://github.com/trwyant/perl-Astro-Coord-ECI/issues>, or in
electronic mail to the author.
The VMS- and MSWin32-specific code to find the initialization file and
do tilde expansion is untested, since I do not currently have access to
those systems.
As of 0.003, clipboard functionality is provided by this code, not by
the Clipboard module, making clipboard bugs mine also.
=head1 AUTHOR
Thomas R. Wyant, III (F<harryfmudd at comcast dot net>)
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2005-2026 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it
xt/author/satpass.t view on Meta::CPAN
-data set horizon 10
-test redefined macro 'foo' execution
show horizon
-data set horizon 20
-test localization of horizon
-skip $^O ne 'darwin' ? "Not running darwin" : -e '/usr/bin/pbcopy' ? '' : "Can not find /usr/bin/pbcopy"
set horizon 30
show horizon -clipboard
-result $^O eq 'darwin' ? `pbpaste` : ''
-data set horizon 30
-test redirect to clipboard (Mac OS X only)
-skip ''
set horizon 15
-unlink test.tmp
show horizon >test.tmp
-data set horizon 15
-read test.tmp
-test redirect to file
( run in 0.807 second using v1.01-cache-2.11-cpan-2398b32b56e )