Astro-satpass

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  Add magnitude functionality to satpass script.

0.062		2014-04-01	T. R. Wyant
  Update canned status for Iridium 29 (24944). Kelso says it's tumbling.

  t/tle_json.t now only dumps versions on an error.

  Require correct Perl version in t/tle_mag.t

  In t/tle_json.t, work around problem that occurs when JSON::XS encodes
    a number in a locale that uses a comma as the decimal point, such as
    'de_DE.UTF-8'. Make a note of this in Astro::Coord::ECI::TLE, since
    there is nothing I can do in my code to actually fix the problem.

  The 'unpack' built-in does not default to $_ as the buffer to unpack
    under Perls before 5.10.

  Have Astro::Coord::ECI::TLE magnitude() method set the station's time.

  Correct logic for building the fold_case() utliity subroutine under
    Perls before 5.16.

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN

 	    rad2deg ($event->{elevation}),
 	    rad2deg ($event->{azimuth}),
 	    $event->{event};
    }
 }

=head1 NOTICE

Users of JSON functionality (if any!) should be aware of a potential
problem in the way L<JSON::XS|JSON::XS> encodes numbers. The problem
basically is that the locale leaks into the encoded JSON, and if the
locale uses commas for decimal points the encoded JSON can not be
decoded. As I understand the discussion on the associated Perl ticket
the problem has always been there, but changes introduced in Perl 5.19.8
made it more likely to manifest.

Unfortunately the nature of the JSON interface is such that I have no
control over the issue, since the workaround needs to be applied at the
point the JSON C<encode()> method is called. See test F<t/tle_json.t>
for the workaround that allows tests to pass in the affected locales.
The relevant L<JSON::XS|JSON::XS> ticket is
L<https://rt.cpan.org/Public/Bug/Display.html?id=93307>. The relevant Perl
ticket is L<https://github.com/perl/perl5/issues/13620>.

The C<pass_threshold> attribute has undergone a slight change in
functionality from version 0.046, in which it was introduced. In the new
functionality, if the C<visible> attribute is true, the satellite must
actually be visible above the threshold to be reported. This is actually
how the attribute would have worked when introduced if I had thought it
through clearly.

script/satpass  view on Meta::CPAN

=head2 Absolute time

Any time string not beginning with '+' or '-' is assumed to be an
absolute time. If L<Date::Manip|Date::Manip> is available, the string is
fed to that for parsing. See the documentation for that module for all
the possibilities. Some of them are:

 today        'today noon'        'next monday'
 tomorrow     'yesterday 10:00'   'nov 10 2:00 pm'

L<Date::Manip|Date::Manip> has at least some support for locales, so
check L<Date::Manip|Date::Manip> before you assume you must enter dates
in English.

If C<Date::Manip> is not available, this script will do the best it can
with an internal parsing routine. This routine accepts ISO-8601 dates,
but not ordinal day specifications (e.g. 2009365 for December 31 2009)
or week specifications (e.g. 2009W0101 for January 4 2009 (if that is in
fact the correct interpretation of the spec)).

The internal routine is rather permissive about punctuation: any

t/tle_json.t  view on Meta::CPAN

}, 'Test the hash generated by TO_JSON() for Vanguard 1.';

# The canonical() is for sanity's sake in case the decode fails in the
# following round-trip test.
my $json = JSON->new()->utf8()->convert_blessed()->canonical();

{   # Local symbol block. Also single-iteration loop.
    my $name = 'Vanguard 1 round-trip via JSON';

    my $data;
    # The following setlocale() stuff is a workaround for JSON::XS bug
    # https://rt.cpan.org/Public/Bug/Display.html?id=93307
    # As of this writing, it only affects Perls 5.19.8 through 5.19.10,
    # and only if JSON::XS is being used. The bug report relates it to
    # commit bc8ec7cc020d0562094a551b280fd3f32bf5eb04. See
    # https://rt.perl.org/Ticket/Display.html?id=121317 which is the
    # related Perl ticket.
    use POSIX qw{ setlocale LC_NUMERIC };
    my $locale = setlocale( LC_NUMERIC );
    eval {
	# The following setlocale() is what makes the code work when
	# JSON::XS is in use. Without it, the call to
	# Astro::Coord::ECI::TLE->parse() below will fail if the
	# LC_NUMERIC environment variable is something like
	# 'de_DE.UTF-8'.
	setlocale( LC_NUMERIC, "C" );
	$data = $json->encode( [ $tle ] );
	1;
    } or do {
	setlocale( LC_NUMERIC, $locale );
	fail "$name failed to encode JSON: $@";
	_json_config();
	last;
    };
    setlocale( LC_NUMERIC, $locale );

    my $attrs = { sun => 'My::Module::Sun' };

    my $tle2;
    eval {
	( $tle2 ) = Astro::Coord::ECI::TLE->parse( $attrs, $data );
	1;
    } or do {
	fail "$name failed to parse JSON: $@";
	_json_config();



( run in 1.338 second using v1.01-cache-2.11-cpan-ceb78f64989 )