The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/local/bin/perl
#
#	Retrieve current data from Manned Space Flight web page
#

use strict;
use warnings;

use Astro::SpaceTrack;
use Getopt::Long;

our $VERSION = '0.095';

my %opt;
my $usage = <<eod;

Get manned spaceflight data. An internet connection is needed.
Output goes to standard out.

usage: spaceflight [options]

where the legal options are:
  -all
    gets all data, rather than just the current data;
  -help
    displays this message;
  -name
    retrieves the data as so-called 'NASA 2-line elements', with the
    name of the satellite before each element set.
eod

GetOptions (\%opt, qw{all help name}) or die $usage;

$opt{help} and do {print $usage; exit};

#	Instantiate the object. The arguments get passed to set().

my $st = Astro::SpaceTrack->new (with_name => $opt{name});

#	Retrieve our data. We have to pass '-all' to get all data,
#	or no arguments to get the current data.

my $rslt = $st->spaceflight ($opt{all} ? '-all' : ());

#	We die if we failed to retrieve the data.

$rslt->is_success or die $rslt->status_line;

#	If we're still alive, we print the data we got back.

print $rslt->content;