Astro-SIMBAD
view release on metacpan or search on metacpan
Query/Query.pm view on Meta::CPAN
# Name:
# Astro::SIMBAD::Query
# Purposes:
# Perl wrapper for the SIMBAD database
# Language:
# Perl module
# Description:
# This module wraps the SIMBAD online database.
# Authors:
# Alasdair Allan (aa@astro.ex.ac.uk)
# Revision:
# $Id: Query.pm,v 1.14 2005/06/08 01:38:17 aa Exp $
# Copyright:
# Copyright (C) 2001 University of Exeter. All Rights Reserved.
#-
# ---------------------------------------------------------------------------
=head1 NAME
Astro::SIMBAD::Query - Object definining an prospective SIMBAD query.
=head1 SYNOPSIS
$query = new Astro::SIMBAD::Query( Target => $object,
RA => $ra,
Dec => $dec,
Error => $radius,
Units => $radius_units,
Frame => $coord_frame,
Epoch => $coord_epoch,
Equinox => $coord_equinox,
Proxy => $proxy,
Timeout => $timeout,
URL => $alternative_url );
my $results = $query->querydb();
$other = new Astro::SIMBAD::Query( Target => $object );
=head1 DESCRIPTION
Stores information about an prospective SIMBAD query and allows the query to
be made, returning an Astro::SIMBAD::Result object. Minimum information needed
for a sucessful query is an R.A. and Dec. or an object Target speccification,
other variables will be defaulted.
The Query object supports two types of queries: "list" (summary)
and "object" (detailed). The list query usually returns multiple results;
the object query is expected to obtain only one result, but returns extra
data about that target. An object query is performed if the target name
is specified and the Error radius is 0; otherwise, a list query is done.
The object will by default pick up the proxy information from the HTTP_PROXY
and NO_PROXY environment variables, see the LWP::UserAgent documentation for
details.
=cut
# L O A D M O D U L E S --------------------------------------------------
use strict;
use vars qw/ $VERSION /;
use LWP::UserAgent;
use Net::Domain qw(hostname hostdomain);
use Carp;
use HTML::TreeBuilder;
use HTML::Entities;
use Astro::SIMBAD::Result;
use Astro::SIMBAD::Result::Object;
'$Revision: 1.14 $ ' =~ /.*:\s(.*)\s\$/ && ($VERSION = $1);
sub trim {
my $s = shift;
$s =~ s/(^\s+)|(\s+$)//g;
return $s;
}
# C O N S T R U C T O R ----------------------------------------------------
=head1 REVISION
$Id: Query.pm,v 1.14 2005/06/08 01:38:17 aa Exp $
=head1 METHODS
=head2 Constructor
=over 4
=item B<new>
Create a new instance from a hash of options
$query = new Astro::SIMBAD::Query( Target => $object,
RA => $ra,
Dec => $dec,
Error => $radius,
Units => $radius_units,
Frame => $coord_frame,
Epoch => $coord_epoch,
Equinox => $coord_equinox,
Proxy => $proxy,
Timeout => $timeout,
URL => $alternative_url );
returns a reference to an SIMBAD query object.
=cut
sub new {
( run in 1.696 second using v1.01-cache-2.11-cpan-483215c6ad5 )