| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# --8<--8<--8<--8<-- |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Copyright (C) 2007 Smithsonian Astrophysical Observatory |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This file is part of Astro::NED::Query |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# Astro::NED::Query is free software: you can redistribute it and/or modify |
|
8
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
|
9
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or (at |
|
10
|
|
|
|
|
|
|
# your option) any later version. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
13
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
|
|
|
|
# GNU General Public License for more details. |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
18
|
|
|
|
|
|
|
# along with this program. If not, see . |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# -->8-->8-->8-->8-- |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Astro::NED::Query::Objects; |
|
23
|
|
|
|
|
|
|
|
|
24
|
5
|
|
|
5
|
|
88
|
use 5.006; |
|
|
5
|
|
|
|
|
17
|
|
|
|
5
|
|
|
|
|
218
|
|
|
25
|
5
|
|
|
5
|
|
28
|
use strict; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
167
|
|
|
26
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
254
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
|
29
|
|
|
|
|
|
|
|
|
30
|
5
|
|
|
5
|
|
5659
|
use autouse Carp => qw/ croak /; |
|
|
5
|
|
|
|
|
4852
|
|
|
|
5
|
|
|
|
|
30
|
|
|
31
|
5
|
|
|
5
|
|
598
|
use base qw/ Astro::NED::Query /; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
9254
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
5
|
|
|
5
|
|
4373
|
use Astro::NED::Response::Objects; |
|
|
5
|
|
|
|
|
20
|
|
|
|
5
|
|
|
|
|
2390
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _query |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
3
|
|
|
3
|
|
7
|
my ( $self ) = @_; |
|
38
|
|
|
|
|
|
|
|
|
39
|
3
|
|
|
|
|
16
|
$self->Format( 'table' ); |
|
40
|
3
|
|
|
|
|
76
|
$self->ListLimit( 1 ); |
|
41
|
3
|
|
|
|
|
27
|
$self->ImageStamp( 'NO' ); |
|
42
|
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
10
|
return; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _parse_query |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
3
|
|
|
3
|
|
10
|
my $self = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# got something |
|
51
|
3
|
50
|
|
|
|
75
|
if ( $_[0] =~ /\d+ objects found/i ) |
|
|
|
0
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
{ |
|
53
|
3
|
|
|
|
|
39
|
my $res = Astro::NED::Response::Objects->new; |
|
54
|
3
|
|
|
|
|
21
|
$res->parseHTML( $_[0] ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
21
|
return $res; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# got nothing! |
|
60
|
|
|
|
|
|
|
elsif( $_[0] =~ /No object found/i ) |
|
61
|
|
|
|
|
|
|
{ |
|
62
|
0
|
|
|
|
|
|
my $res = Astro::NED::Response::Objects->new; |
|
63
|
0
|
|
|
|
|
|
return $res; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
else |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
0
|
|
|
|
|
|
my $pfx = ref($self) . '->query: '; |
|
69
|
0
|
|
|
|
|
|
my @stuff; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# push @stuff, "error in query:"; |
|
72
|
|
|
|
|
|
|
# my @keyw = $self->form; |
|
73
|
|
|
|
|
|
|
# my ( $key, $value ); |
|
74
|
|
|
|
|
|
|
# push @stuff, "$key = $value" |
|
75
|
|
|
|
|
|
|
# while ($key, $value) = splice(@keyw, 0, 2 ); |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
require HTML::Parser; |
|
78
|
|
|
|
|
|
|
my $p = HTML::Parser->new( text_h => |
|
79
|
0
|
|
|
|
|
|
[ sub { push @stuff, |
|
80
|
0
|
|
|
0
|
|
|
grep { ! /NED\ Home |
|
81
|
|
|
|
|
|
|
|Search\ Results |
|
82
|
|
|
|
|
|
|
|(^NASA.*BASE$) |
|
83
|
|
|
|
|
|
|
|(^$)/x } |
|
84
|
0
|
|
|
|
|
|
split( /\n+/, shift ) }, 'dtext' ] ); |
|
85
|
0
|
|
|
|
|
|
$p->unbroken_text(1); |
|
86
|
0
|
|
|
|
|
|
$p->parse( $_[0] ); |
|
87
|
0
|
|
|
|
|
|
$p->eof; |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
croak( $pfx, join( "\n$pfx", @stuff ), "\n" ); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
|
96
|
|
|
|
|
|
|
__END__ |