Astro-SpaceTrack
view release on metacpan or search on metacpan
"warnings" : "0"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"Config" : "0",
"Exporter" : "0",
"Getopt::Long" : "2.39",
"HTTP::Date" : "0",
"HTTP::Request" : "0",
"HTTP::Response" : "0",
"HTTP::Status" : "6.03",
"IO::File" : "0",
"IO::Uncompress::Unzip" : "0",
"JSON" : "0",
"LWP::Protocol::https" : "0",
"LWP::UserAgent" : "0",
"List::Util" : "0",
"Mozilla::CA" : "20141217",
"POSIX" : "0",
provides:
Astro::SpaceTrack:
file: lib/Astro/SpaceTrack.pm
version: '0.171'
requires:
Carp: '0'
Config: '0'
Exporter: '0'
Getopt::Long: '2.39'
HTTP::Date: '0'
HTTP::Request: '0'
HTTP::Response: '0'
HTTP::Status: '6.03'
IO::File: '0'
IO::Uncompress::Unzip: '0'
JSON: '0'
LWP::Protocol::https: '0'
LWP::UserAgent: '0'
List::Util: '0'
Mozilla::CA: '20141217'
POSIX: '0'
inc/Mock/LWP/UserAgent.pm view on Meta::CPAN
package Mock::LWP::UserAgent;
use 5.006002;
use strict;
use warnings;
use Carp;
use Errno qw{ ENOENT };
use File::Spec;
use HTTP::Request;
use HTTP::Response;
use LWP::UserAgent;
use JSON;
our $VERSION = '0.171';
our $CANNED_RESPONSE_FILE;
use constant REF_HASH => ref {};
inc/Mock/LWP/UserAgent.pm view on Meta::CPAN
}
return $old;
};
*LWP::UserAgent::env_proxy = sub {
return;
};
*LWP::UserAgent::get = sub {
my ( $self, $url ) = @_;
return $self->request( HTTP::Request->new( GET => $url ) );
};
*LWP::UserAgent::head = sub {
my ( $self, $url ) = @_;
return $self->request( HTTP::Request->new( HEAD => $url ) );
};
*LWP::UserAgent::post = sub {
my ( $self, $url ) = @_;
return $self->request( HTTP::Request->new( POST => $url ) );
};
*LWP::UserAgent::put = sub {
my ( $self, $url ) = @_;
return $self->request( HTTP::Request->new( PUT => $url ) );
};
*LWP::UserAgent::request = sub {
my ( $self, $rqst ) = @_;
my $method = $rqst->method();
my $url = $rqst->url();
my $data = $self->{ +__PACKAGE__ }{data}{$url}{$method}
or return _fail( $rqst, 404, "$method $url not found" );
my $resp = HTTP::Response->new( @{ $data } );
inc/Mock/LWP/UserAgent.pm view on Meta::CPAN
my $resp = $ua->put( $url );
This method returns the response for a PUT request on the given URL.
The heavy lifting is done by L<request()|/request>.
=head3 request
my $resp = $ua->request( $rqst );
This method returns the response for the given
L<HTTP::Request|HTTP::Request> object from the data loaded by
L<__load_data()|/__load_data>. If the given URL and method are not
found, the response is a 404 error.
=head1 ATTRIBUTES
This class has no public attributes.
=head1 SUBROUTINES
This class also has a couple old-school subroutines to manage its data.
inc/My/Module/Meta.pm view on Meta::CPAN
sub requires {
my ( undef, @extra ) = @_; # Invocant unused
return {
'Carp' => 0,
'Config' => 0,
'Exporter' => 0,
'Getopt::Long' => 2.39, # For getoptionsfromarray
'HTTP::Date' => 0,
'HTTP::Request' => 0,
'HTTP::Response' => 0,
'HTTP::Status' => 6.03, # For the teapot status
'IO::File' => 0,
'IO::Uncompress::Unzip' => 0, # For McCants
'JSON' => 0, # For Space Track v2
'List::Util' => 0, # For Space Track v2 FILE tracking
'LWP::UserAgent' => 0,
'LWP::Protocol::https' => 0, # Space track needs as of 11-Apr-2011
'Mozilla::CA' => 20141217,
# There is no direct dependency
lib/Astro/SpaceTrack.pm view on Meta::CPAN
};
our %EXPORT_TAGS = (
ref => [ grep { m/ _REF \z /smx } @EXPORT_OK ],
status => [ grep { m/ \A BODY_STATUS_IS_ /smx } @EXPORT_OK ],
);
use Carp ();
use Getopt::Long 2.39;
use HTTP::Date ();
use HTTP::Request;
use HTTP::Response;
use HTTP::Status qw{
HTTP_PAYMENT_REQUIRED
HTTP_BAD_REQUEST
HTTP_NOT_FOUND
HTTP_I_AM_A_TEAPOT
HTTP_INTERNAL_SERVER_ERROR
HTTP_NOT_ACCEPTABLE
HTTP_NOT_MODIFIED
HTTP_OK
lib/Astro/SpaceTrack.pm view on Meta::CPAN
if ( my $resp = $self->_dump_request(
args => { map { $_ => CODE_REF eq ref $arg{$_} ? 'sub { ... }' : $arg{$_} } keys %arg },
method => 'GET',
url => $url,
version => 2,
) ) {
return $resp;
}
my $agent = $self->_get_agent();
my $rqst = HTTP::Request->new( GET => $url );
my $file_time;
if ( defined $arg{file} ) {
if ( my @stat = stat $arg{file} ) {
$file_time = HTTP::Date::time2str( $stat[9] );
$rqst->header( if_modified_since => $file_time );
}
}
my $resp;
$resp = $self->_dump_request(
( run in 0.739 second using v1.01-cache-2.11-cpan-de7293f3b23 )