Astro-SpaceTrack

 view release on metacpan or  search on metacpan

tools/capture  view on Meta::CPAN

#!/usr/bin/env perl

use 5.006002;

use strict;
use warnings;

use Getopt::Long 2.33 qw{
    :config auto_version pass_through require_order
};
use Pod::Usage;

use blib;
use lib 'inc';

use Astro::SpaceTrack::Dumper;
use File::Glob qw{ bsd_glob };
use JSON;
use Mock::LWP::UserAgent ();
use My::Module::Test ();

our $VERSION = '0.182';

my %opt = (
    retrieval_size	=> $Astro::SpaceTrack::RETRIEVAL_SIZE,
);

GetOptions( \%opt,
    qw{ file=s list! retrieval_size|retrieval-size=i verbose! },
    help => sub { pod2usage( { -verbose => 2 } ) },
) or pod2usage( { -verbose => 0 } );

my $st = Astro::SpaceTrack::Dumper->new(
    canned_response_file	=> $opt{file},
    prompt => 'SpaceTrack capture> ',
);

$opt{list}
    and list_captures( $st );

{
    local $Astro::SpaceTrack::RETRIEVAL_SIZE = $opt{retrieval_size};
    $opt{verbose}
	and $st->set( dump_headers => Astro::SpaceTrack->DUMP_RESPONSE() );
    $st->shell( @ARGV );
}

__END__

=head1 TITLE

capture - Capture HTTP::Response objects to feed to a mock LWP::UserAgent.

=head1 SYNOPSIS

 capture
 capture --help
 capture --version

=head1 OPTIONS

The following options are supported directly by this script. Any
unrecognized options will be passed through to C<Astro::SpaceTrack>.

=head2 --directory

This option specifies the directory in which the responses are to be
written. The default is the default for C<Mock::LWP::UserAgent>.

=head2 --help

This option displays the documentation for this script. The script then
exits.

=head2 --list

If this Boolean option is asserted, the captured objects are listed. The
script then exits. The list includes captured data if
L<--verbose|/--verbose> is also asserted.

=head2 --retrieval-size

This option specifies the maximum number of OIDs to retrieve in a single
query. The default is C<200>.

=head2 --verbose

If this option is asserted, file creation will be logged to standard
error.

=head2 --version

This option displays the version of this script. The script then exits.

=head1 DETAILS



( run in 0.489 second using v1.01-cache-2.11-cpan-0b5f733616e )