Author image Graham Bell
and 3 contributors


Astro::Catalog::Transport::REST - A base class for REST query modules


  use base qw/ Astro::Catalog::Transport::REST /;


This class forms a base class for all the REST based query classes provided in the Astro::Catalog distribution (eg Astro::Catalog::Query::GSC).




Create a new instance from a hash of options

  $q = new Astro::Catalog::Transport::REST( Coords    => new Astro::Coords(),
                                            Radius    => $radius,
                                            Bright    => $magbright,
                                            Faint     => $magfaint,
                                            Sort      => $sort_type,
                                            Number    => $number_out );

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).


The LWP user agent mediating the web transaction.

  $ua = $q->useragent();

Created automatically the first time it is requested.


Returns an Astro::Catalog object resulting from the specific query.

   $catalog = $q->querydb();

Return (or set) the current proxy for the catalog request.

   $usno->proxy( '' );
   $proxy_url = $usno->proxy();

Return (or set) the current timeout in seconds for the request.

   $usno->timeout( 30 );
   $proxy_timeout = $usno->timeout();

Default is 30 seconds.


The URL formed to build up a query. Made up of a root host name (that can be set using the url method) and a fixed suffix that specifies the path to the service (CGI or otherwise). This query URL does not include the arguments to the CGI script (but will include the question mark if appropriate).

  $query_url = $q->query();
  $q->query_url( '');

Care must be taken when setting this value.

The argument is not validated. There may also need to be a new method that returns the full URL including arguments.

If no value has been supplied, a default will be returned.


Return the current remote host for the query (the full URL can be returned using the query_url method).

   $host = $q->url();

Can also be used to set the root host for the URL (ie the machine name but no path component)

   $q->url( "" );

if not defined the default URL is used (specified in the sub class). This method should really be called remote_host.

Returns the default host name specified by the particular subclass if a value has not been defined.


Returns the user agent tag sent by the module to the server.

   $agent_tag = $q->agent();

The user agent tag can not be set by this method.