Astro-Catalog
view release on metacpan or search on metacpan
lib/Astro/Catalog/Transport/WebService.pm view on Meta::CPAN
returns a reference to an query object. Must only called from
sub-classed constructors.
RA and Dec are also allowed but are deprecated (since with only
RA/Dec the coordinates must always be supplied as J2000 space-separated
sexagesimal format).
=cut
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
# bless the query hash into the class
my $block = bless {
OPTIONS => {},
COORDS => undef,
URN => undef,
ENDPOINT => undef,
SERVICE => undef,
QUERY => undef,
BUFFER => undef,
}, $class;
# Configure the object [even if there are no args]
$block->configure(@_);
return $block;
}
=item B<querydb>
Unlike C<Astro::Transport::REST> a default C<querydb()> method is not
provided by this base class, each sub-class must provide its own
implemetation.
=cut
sub querydb {
croak "querydb() must be provided by the subclass\n";
}
=item B<proxy>
Return (or set) the current proxy for the catalog request.
$usno->proxy('http://wwwcache.ex.ac.uk:8080/');
$proxy_url = $usno->proxy();
=cut
sub proxy {
my $self = shift;
# SOAP::Lite respects the HTTP_proxy environment variable
if (@_) {
my $proxy_url = shift;
$ENV{HTTP_proxy} = $proxy_url;
$ENV{HTTP_PROXY} = $proxy_url;
}
# return the current proxy
return $ENV{HTTP_proxy};
}
=item B<urn>
Return the current remote urn for the query
$host = $q->urn();
Can also be used to set the urn.
=cut
sub urn {
my $self = shift;
# SETTING URL
if (@_) {
# set the url option
my $urn = shift;
$self->{URN} = $urn;
}
return $self->{URN};
}
=item B<endpoint>
Return the current endpoint for the query
$host = $q->endpoint();
$q->endpoint('http://www.blah.org:8080');
Can also be used to set the endpoint. If the endpoint is a wsdl file
the SOAP::Lite object will automagically be configured to use the
correct URN, e.g.
$q->endpoint('http://cdsws.u-strasbg.fr/axis/Sesame.jws?wsdl');
=cut
sub endpoint {
my $self = shift;
# SETTING ENDPOINT
if (@_) {
# set the url option
my $endpoint = shift;
if ($endpoint =~ /wsdl$/) {
$self->{SERVICE} = 1;
}
$self->{ENDPOINT} = $endpoint;
}
if (defined $self->{ENDPOINT}) {
( run in 0.352 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )