| 1 | package Astro::Nova::EquPosn; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use Astro::Nova; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | # basic stuff is in Astro::Nova's XS! | ||||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub members { | ||||||||
|
Subroutine
members: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 12 | 0 | return qw/ra dec/; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub as_ascii { | ||||||||
|
Subroutine
as_ascii: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 16 | 0 | my $self = shift; | |||||||||
| 17 | 0 | my $template = <<'HERE'; | |||||||||
| 18 | Right Ascension: %f | ||||||||||
| 19 | Declination: %f | ||||||||||
| 20 | HERE | ||||||||||
| 21 | 0 | return sprintf($template, $self->get_all()); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | sub get_all { | ||||||||
|
Subroutine
get_all: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 25 | 0 | my $self = shift; | |||||||||
| 26 | 0 | return(map $self->$_(), map "get_$_", $self->members()); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub set_all { | ||||||||
|
Subroutine
set_all: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 30 | 0 | my $self = shift; | |||||||||
| 31 | 0 | foreach my $member (map "set_$_", $self->members) { | |||||||||
| 32 | 0 | ▶ | last if not @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | my $value = shift @_; | |||||||||
| 34 | 0 | ▶ | next if not defined $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | $self->$member($value); | |||||||||
| 36 | } | ||||||||||
| 37 | 0 | return 1; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub from_galactic_B1950 { | ||||||||
|
Subroutine
from_galactic_B1950: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 41 | 0 | my $class = shift; | |||||||||
| 42 | 0 | my $obj = shift->to_equatorial_B1950(); | |||||||||
| 43 | 0 | ▶ | return $obj if not ref $class; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | $class->set_all($obj->get_all()); | |||||||||
| 45 | 0 | return $class; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub from_galactic_J2000 { | ||||||||
|
Subroutine
from_galactic_J2000: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 49 | 0 | my $class = shift; | |||||||||
| 50 | 0 | my $obj = shift->to_equatorial_J2000(); | |||||||||
| 51 | 0 | ▶ | return $obj if not ref $class; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | $class->set_all($obj->get_all()); | |||||||||
| 53 | 0 | return $class; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub to_galactic_B1950 { | ||||||||
|
Subroutine
to_galactic_B1950: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | 0 | return Astro::Nova::get_gal_from_equ(shift); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub to_galactic_J2000 { | ||||||||
|
Subroutine
to_galactic_J2000: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 61 | 0 | return Astro::Nova::get_gal_from_equ2000(shift); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | 3 | 1; | |||||||||
| 66 | __END__ | ||||||||||