Astro-SIMBAD-Client

 view release on metacpan or  search on metacpan

inc/My/Module/Test.pm  view on Meta::CPAN


=head2 test

This subroutine performs the actual test. It takes two arguments: the
expected value, and the name of the test. The value made available by
C<call()>, C<count()>, C<deref()>, C<deref_curr()>, or C<find()> is
compared to the expected value, and the test succeeds or fails based on
the result of the comparison.

If the expected value is a C<Regexp> object, the comparison is done with
the C<Test::More> C<like()> subroutine. If it looks like a number, the
comparison is done with C<cmp_ok> for numeric equality. Otherwise, the
comparison is done with C<is>.

=head1 SUPPORT

Support is by the author. Please file bug reports at
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Astro-SIMBAD-Client>,
L<https://github.com/trwyant/perl-Astro-SIMBAD-Client/issues>, or in
electronic mail to the author.

lib/Astro/SIMBAD/Client.pm  view on Meta::CPAN


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


This method sets the value of the given L<attributes|/Attributes>. More
than one name/value pair may be specified. If called as a static method,
it sets the default value of the attribute.

=cut

{	# Begin local symbol block.

    my $ckpn = sub {
	(looks_like_number ($_[2]) && $_[2] >= 0)
	    or croak "Attribute '$_[1]' must be a non-negative number";
	+$_[2];
    };

    my %mutator = (
	format => \&_set_hash,
	parser => \&_set_hash,
	scheme	=> \&_set_scheme,
	url_args => \&_set_hash,
    );

lib/Astro/SIMBAD/Client.pm  view on Meta::CPAN


=item format

This attribute holds the default format for a given query()
output type. It is specified as a reference to a hash. See
L<http://simbad.u-strasbg.fr/guide/sim-fscript.htx> for how to specify
formats for each output type. Output type 'script' is used to specify a
format for the script() method.

The format can be specified either literally, or as a subroutine name or
code reference. A string is assumed to be a subroutine name if it looks
like one (i.e. matches (\w+::)*\w+), and if the given subroutine is
actually defined. If no namespace is specified, all namespaces in the
call tree are checked. If a code reference or subroutine name is
specified, that code is executed, and the result becomes the format.

The following formats are defined in this module:

 FORMAT_TXT_SIMPLE_BASIC -
   a simple-to-parse text format providing basic information;
 FORMAT_TXT_YAML_BASIC -



( run in 0.312 second using v1.01-cache-2.11-cpan-607d282f910 )