Author image Tom Wyant
and 1 contributors


simbadc - Access the SIMBAD 4 astronomical database.


 $ simbadc
 simbadc> # Queries should default to returning text data.
 simbadc> set type txt
 simbadc> # Get the standard data on Arcturus, capturing
 simbadc> # the output in
 simbadc> queryObjectById Arcturus >
 simbadc> # Queries should default to returning VO data.
 simbadc> set type vo
 simbadc> # Do a url query, capturing its results.
 simbadc> url_query id Ident 3c273 >
 simbadc> # Execute a script file, capturing its results.
 simbadc> script_file m31.simbad4 >
 simbadc> # We are done.
 simbadc> exit

The intent here is to be able to collect data from the SIMBAD database on an ad-hoc basis. Most commands map directly to Astro::SIMBAD::Client methods.


This script uses Term::ReadLine for user interaction, though it can also be used as a traditional Unix filter. Command parsing is fairly simple. Text::ParseWords is used to split the line into tokens, with the first token being the command/method name.

If a token begins with '>' or '>>', the rest of the token represents the name of a file to which the output of that command is redirected. The '>' overwrites an existing file, while '>>' appends to it. There can be no space between the '>' or '>>' and the file name.

A token beginning with '<<' introduces a 'here document', which appears on subsequent lines of input. The rest of the token represents the text which marks the end of the 'here document'. If the script is being run interactively, the end text will also be used as the prompt. For example:

 simbadc> set format <<eod
 eod>name: %idlist(NAME|1)\n
 eod>ra: %coord(d;A)\n
 eod>dec: %coord(d;D)\n

specifies a format to be used for a 'txt' mode query. Note that

 simbadc> set format txt=<<eod

is not equivalent; the '<<eod' must be a token all by itself.

If a token begins with '<', the rest of the token is taken as a file name, and the contents of the file are substituted for the token. Note that this does not give a mechanism for feeding commands from a file, since the contents of the input file are not parsed. It does, however, give a less painful way to test tweaks of complex formats.

The following commands are implemented by this script, in addition to (or in lieu of) the commands documented in Astro::SIMBAD::Client:

default (attribute_name ...)

This command resets the values of the named attributes to their static values.


This command terminates the script. It is simply a wrapper for CORE::exit. End-of-file also works.


This command displays the documentation for this script. If you use

 simbadc> help client

You get Astro::SIMBAD::Client.

show (attribute ...)

This command is a slightly more command-friendly wrapper for the get() method. If given no arguments, all are displayed. The output is formatted as 'set' commands.


This is not really a command, but when prefixed to a method name causes that method to be called as a static method. For example,

 simbadc> static set type vo

Causes the default query type to be 'vo'.

Any command not named above is assumed to be an Astro::SIMBAD::Client method, and called. Whatever the method returns is displayed, unless the return is an Astro::SIMBAD::Client object.

See Astro::SIMBAD::Client for the details.


Thomas R. Wyant, III (wyant at cpan dot org)


Copyright (C) 2005-2019 Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.