Astro::Nova::DMS - Perl representation of a libnova ln_dms (degrees, minutes, seconds)


Astro-Nova documentation  | view source Contained in the Astro-Nova distribution.

Index


NAME

Top

Astro::Nova::DMS - Perl representation of a libnova ln_dms (degrees, minutes, seconds)

SYNOPSIS

Top

  use Astro::Nova qw(functions ...);
  my $date = Astro::Nova::DMS->new();
  $date->set_year(...);
  # ...
  print $date->as_ascii(), "\n";
  my @members = $date->get_all();

  my $dms = Astro::Nova::DMS->from_string("4°50'2'' W"); # sgn=-1, degrees=4, minutes=50, seconds=2
  $dms = Astro::Nova::DMS->from_string("-4°50'"); # sgn=-1, degrees=4, minutes=50, seconds=0

DESCRIPTION

Top

This class represents a libnova ln_dms struct. The struct has the following layout:

  ln_dms {
    unsigned short  neg
    unsigned short  degrees
    unsigned short  minutes
    double          seconds
  }

METHODS

Top

new

Constructor returns a new Astro::Nova::DMS. Optionally takes key/value pairs for setting the struct members. Extra arguments are ignored. Uninitialized struct members are set to zero.

get_... / set_...

Get or set any of the class attributes. (See list above)

get_all

Returns all members as a list.

set_all

Sets all members. Takes a list of values which must be in the order shown above. Any missing values are ignored, undefs are skipped.

from_string

Parses a string of the form X°Y'Z'' DIR where X, Y, Z are numbers and DIR may be a direction [EWNS] (W sets sign to negative). Omitted parts are set to zero.

If called as a class methods, returns a new DMS. If called on an existing object, that object is modified.

as_ascii

Returns a human-readable ASCII table of the date information.

members

Returns a list of all members in order.

to_degrees / to_radians / to_hms

Convert to degrees or radians (returns a number).

to_hms Converts to Astro::Nova::HMS (hours).

from_degrees / from_radians / from_dms

When called as a class method, creates a new Astro::Nova::HMS object from the given degrees/radians value or Astro::Nova::DMS object.

When called as an object method, sets the current object's state instead.

SEE ALSO

Top

Astro::Nova

libnova website: http://libnova.sourceforge.net/

AUTHOR

Top

Steffen Mueller, <smueller@cpan.org>

COPYRIGHT AND LICENSE

Top


Astro-Nova documentation  | view source Contained in the Astro-Nova distribution.