| 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::CoordExtinct; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 1 |  |  | 1 |  | 48743 | use 5.006; | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 41 |  | 
| 25 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 43 |  | 
| 26 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 32 |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 1 |  |  | 1 |  | 844 | use Astro::NED::Response::CoordExtinct; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 10 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | our $VERSION = '0.30'; | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 1 |  |  | 1 |  | 62 | use base qw/ Astro::NED::Query::Objects Class::Accessor::Class /; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 914 |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | __PACKAGE__->mk_class_accessors( qw( Field ) ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | __PACKAGE__->Field( { qw{ | 
| 38 |  |  |  |  |  |  | InCoordSys      in_csys | 
| 39 |  |  |  |  |  |  | InEquinox       in_equinox | 
| 40 |  |  |  |  |  |  | Longitude       lon | 
| 41 |  |  |  |  |  |  | Latitude        lat | 
| 42 |  |  |  |  |  |  | RA              lon | 
| 43 |  |  |  |  |  |  | Dec             lat | 
| 44 |  |  |  |  |  |  | PA              pa | 
| 45 |  |  |  |  |  |  | OutCoordSys     out_csys | 
| 46 |  |  |  |  |  |  | OutEquinox      out_equinox | 
| 47 |  |  |  |  |  |  | }} ); | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | __PACKAGE__->mk_accessors( keys %{__PACKAGE__->Field}, | 
| 50 |  |  |  |  |  |  | ); | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub _init | 
| 53 |  |  |  |  |  |  | { | 
| 54 | 1 |  |  | 1 |  | 3 | my ( $self ) = @_; | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 1 |  |  |  |  | 12 | $self->{_ua}->follow_link( text_regex => qr/coordinate transformation/i ); | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 1 |  |  |  |  | 357743 | return; | 
| 59 |  |  |  |  |  |  | } | 
| 60 |  |  |  |  |  |  |  | 
| 61 | 1 |  |  | 1 |  | 2 | sub _query {} | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | sub _parse_query | 
| 64 |  |  |  |  |  |  | { | 
| 65 | 1 |  |  | 1 |  | 5 | my $self = shift; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | # got something | 
| 68 | 1 | 50 |  |  |  | 15 | if ( $_[0] =~ /NED Coordinate & Extinction Calculator Results/i ) | 
| 69 |  |  |  |  |  |  | { | 
| 70 | 1 |  |  |  |  | 25 | my $res = Astro::NED::Response::CoordExtinct->new; | 
| 71 | 1 |  |  |  |  | 23 | $res->parseHTML( $_[0] ); | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 1 |  |  |  |  | 10 | return $res; | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | else | 
| 77 |  |  |  |  |  |  | { | 
| 78 | 0 |  |  |  |  |  | my $pfx = ref($self) . '->query: '; | 
| 79 | 0 |  |  |  |  |  | my @stuff; | 
| 80 |  |  |  |  |  |  |  | 
| 81 | 0 |  |  |  |  |  | require HTML::Parser; | 
| 82 |  |  |  |  |  |  | my $p = HTML::Parser->new( text_h => | 
| 83 | 0 |  |  |  |  |  | [ sub { push @stuff, | 
| 84 | 0 |  |  | 0 |  |  | grep { ! /|(^\s*Search\ Results) | 
| 85 |  |  |  |  |  |  | |(^\s*NASA.*) | 
| 86 |  |  |  |  |  |  | |(^\s*Back to NED Home) | 
| 87 |  |  |  |  |  |  | |(^$)/x } | 
| 88 | 0 |  |  |  |  |  | split( /\n+/, shift ) }, 'dtext' ] ); | 
| 89 | 0 |  |  |  |  |  | $p->unbroken_text(1); | 
| 90 | 0 |  |  |  |  |  | $p->parse( $_[0] ); | 
| 91 | 0 |  |  |  |  |  | $p->eof; | 
| 92 |  |  |  |  |  |  |  | 
| 93 | 0 |  |  |  |  |  | croak( $pfx, join( "\n$pfx", @stuff ), "\n" ); | 
| 94 |  |  |  |  |  |  | } | 
| 95 |  |  |  |  |  |  | } | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | 1; | 
| 99 |  |  |  |  |  |  | __END__ |