Astro-SIMBAD-Client
view release on metacpan or search on metacpan
"Config" : "0",
"Getopt::Std" : "0",
"lib" : "0",
"strict" : "0",
"warnings" : "0"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"HTTP::Request::Common" : "0",
"LWP::Protocol" : "0",
"LWP::UserAgent" : "0",
"Scalar::Util" : "1.01",
"URI::Escape" : "0",
"constant" : "0",
"perl" : "5.008",
"strict" : "0",
"warnings" : "0"
}
}
- xt
provides:
Astro::SIMBAD::Client:
file: lib/Astro/SIMBAD/Client.pm
version: '0.047'
Astro::SIMBAD::Client::WSQueryInterfaceService:
file: lib/Astro/SIMBAD/Client/WSQueryInterfaceService.pm
version: '0.047'
requires:
Carp: '0'
HTTP::Request::Common: '0'
LWP::Protocol: '0'
LWP::UserAgent: '0'
Scalar::Util: '1.01'
URI::Escape: '0'
constant: '0'
perl: '5.008'
strict: '0'
warnings: '0'
resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Astro-SIMBAD-Client
inc/My/Module/Meta.pm view on Meta::CPAN
return ( provides => $provides );
}
sub requires {
my ( undef, @extra ) = @_; # Invocant not used.
## if ( ! $self->distribution() ) {
## }
return +{
'Carp' => 0,
'HTTP::Request::Common' => 0,
'LWP::Protocol' => 0, # Comes with LWP, but ...
'LWP::UserAgent' => 0,
## 'SOAP::Lite' => 0,
'Scalar::Util' => 1.01, # Not in Perl 5.6
'URI::Escape' => 0,
# 'XML::DoubleEncodedEntities' => 1.0,
constant => 0,
strict => 0,
warnings => 0,
@extra,
lib/Astro/SIMBAD/Client.pm view on Meta::CPAN
# Otherwise it would be 5.006 because of 'our'.
use 5.008;
use strict;
use warnings;
use Carp;
use LWP::UserAgent;
use LWP::Protocol;
use HTTP::Request::Common qw{POST};
use Scalar::Util 1.01 qw{looks_like_number};
use URI::Escape ();
# use XML::DoubleEncodedEntities;
# use Astro::SIMBAD::Client::WSQueryInterfaceService;
use constant HAVE_DOUBLE_ENCODED => do {
local $@ = undef;
eval { ## no critic (RequireCheckingReturnValueOfEval)
require XML::DoubleEncodedEntities;
1;
lib/Astro/SIMBAD/Client.pm view on Meta::CPAN
########################################################################
#
# Utility routines
#
# __build_url
#
# Builds a URL based on the currently-set scheme and server, and
# the fragment provided as an argument. If the fragment is an
# HTTP::Request object it is simply returned.
sub __build_url {
my ( $self, $fragment ) = @_;
defined $fragment
or $fragment = '';
eval { $fragment->isa( 'HTTP::Request' ) }
and return $fragment;
$fragment =~ s< \A / ><>smx; # Defensive programming
return sprintf '%s://%s/%s', $self->get( 'scheme' ),
$self->get( 'server' ), $fragment;
}
# _callers_caller();
#
# Returns the name of the subroutine that called the caller.
# Results undefined if not called from a subroutine nested at
lib/Astro/SIMBAD/Client.pm view on Meta::CPAN
# attributes, and the given fragment, and retrieve the data from
# that URL. The \%args argument is optional.
#
# The return is an HTTP::Response object. If the response is
# indicates that the request is unsuccessful we croak with the URL
# (if that can be retrieved) and the status line.
#
# The details depend on the arguments and the state of the
# invocant as follows:
#
# If $url is an HTTP::Request object, it is executed and the
# response returned. Otherwise
#
# If \%args is present and not empty, and the 'post' attribute is
# true, an HTTP post() request is done to the URL, sending the
# data. Otherwise
#
# If there are arguments they are appended to the URL, and an HTTP
# get() is done to the URL.
sub _retrieve {
my ($self, $fragment, $args) = @_;
my $url = $self->__build_url( $fragment );
$args ||= {};
my $debug = $self->get ('debug');
my $ua = _get_user_agent ();
$self->_delay ();
my $resp;
if (eval {$url->isa('HTTP::Request')}) {
$debug
and print 'Debug ', _callers_caller(), 'executing ',
$url->as_string, "\n";
$resp = $ua->request ($url);
} elsif ($self->get ('post') && %$args) {
if ($debug) {
print 'Debug ', _callers_caller(), " posting to $url\n";
foreach my $key (sort keys %$args) {
print " $key => $args->{$key}\n";
}
( run in 0.727 second using v1.01-cache-2.11-cpan-de7293f3b23 )