| 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::Response::Object; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 6 |  |  | 6 |  | 107 | use 5.006; | 
|  | 6 |  |  |  |  | 20 |  | 
|  | 6 |  |  |  |  | 246 |  | 
| 25 | 6 |  |  | 6 |  | 106 | use strict; | 
|  | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 172 |  | 
| 26 | 6 |  |  | 6 |  | 31 | use warnings; | 
|  | 6 |  |  |  |  | 10 |  | 
|  | 6 |  |  |  |  | 536 |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | our $VERSION = '0.30'; | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 6 |  |  | 6 |  | 32 | use base qw/ Class::Accessor::Fast /; | 
|  | 6 |  |  |  |  | 15 |  | 
|  | 6 |  |  |  |  | 5934 |  | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 6 |  |  | 6 |  | 21647 | use Astro::NED::Response::Fields; | 
|  | 6 |  |  |  |  | 16 |  | 
|  | 6 |  |  |  |  | 1933 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | # Preloaded methods go here. | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | __PACKAGE__->mk_ro_accessors( 'InfoLink', | 
| 37 |  |  |  |  |  |  | Astro::NED::Response::Fields::names() ); | 
| 38 |  |  |  |  |  |  | sub dumpstr | 
| 39 |  |  |  |  |  |  | { | 
| 40 | 1 |  |  | 1 | 1 | 1 | my ( $self, $pfx )  = @_; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 21 | 100 |  |  |  | 184 | return $pfx . join( "\n$pfx", | 
| 43 | 1 |  |  |  |  | 5 | map { "$_: " . ( defined $self->get($_) ? $self->get($_) : 'undef' ) } | 
| 44 |  |  |  |  |  |  | Astro::NED::Response::Fields::names() | 
| 45 |  |  |  |  |  |  | ) | 
| 46 |  |  |  |  |  |  | . "\n"; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub dump | 
| 50 |  |  |  |  |  |  | { | 
| 51 | 0 |  |  | 0 | 1 |  | my ( $self, $fh, $pfx )  = @_; | 
| 52 |  |  |  |  |  |  |  | 
| 53 | 0 | 0 |  |  |  |  | $fh = \*STDOUT unless defined $fh; | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 0 |  |  |  |  |  | print {$fh} $self->dumpstr( $pfx ); | 
|  | 0 |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 0 |  |  |  |  |  | return; | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | sub fields | 
| 61 |  |  |  |  |  |  | { | 
| 62 | 0 |  |  | 0 | 1 |  | my ( $self ) = @_; | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | # object method | 
| 65 | 0 | 0 |  |  |  |  | if ( ref $self ) | 
| 66 |  |  |  |  |  |  | { | 
| 67 | 0 |  |  |  |  |  | return grep { defined $self->get($_) } | 
|  | 0 |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | Astro::NED::Response::Fields::names(); | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | # class method | 
| 72 |  |  |  |  |  |  | else | 
| 73 |  |  |  |  |  |  | { | 
| 74 | 0 |  |  |  |  |  | return Astro::NED::Response::Fields::names(); | 
| 75 |  |  |  |  |  |  | } | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | sub data | 
| 79 |  |  |  |  |  |  | { | 
| 80 | 0 |  |  | 0 | 1 |  | my ( $self ) = @_; | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 0 |  |  |  |  |  | return %{$self}; | 
|  | 0 |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | } | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | 1; | 
| 88 |  |  |  |  |  |  | __END__ |