SwissEph - The Swiss Ephemeris made accessible for Perl


NAME

SwissEph - The Swiss Ephemeris made accessible for Perl


SYNOPSIS

  # If you like, import planet symbols (Sun, Moon, Mercury, ...) with the tag :Planets 
  use SwissEph qw(:Planets);
  my $xx = [];
  my $serr = "";
  my $iret = 0;
  # SwissEph::calc Sun for 2000-1-1 including high precision speed values
  $iret = SwissEph::calc( 2451544.5, Sun, 256, $xx, $serr);
  # Delta T
  print "Delta T(2451544.5) = " . SwissEph::deltat( 2451544.5 ) . "\n";
  # House cusps
  my (@cusps,@ascmc);
  $iret = SwissEph::houses( 2451544.5, 52., 7., 0, \@cusps, \@ascmc);
  
  #  Sidereal time, measured in hours - multiply by 15 to get RAMC
  my $st = SwissEph::sidtime( 2451544.5 );
  my $ramc = 15 * $st;
  print "ST:   $st\nRAMC: $ramc\n";
  # Ephemeris for 5 days for Sun, Moon and Mercury
  my $list;
  $list = SwissEph::get_long_list(2451544.50,5,[Sun,Moon,Mercury]);
  # Calendar conversions (last parameter gregflag is optional)
  print SwissEph::julday(1582,1,1,0.,0)."\n";
  # gregflag default: From 1592/10/15 on, use gregorian flag
  print SwissEph::julday(1582,1,1,0.)."\n";
  print SwissEph::revjul(2451544.5,1)."\n";


DESCRIPTION

SwissEph is a simple Perl wrapper for the Swiss Ephemeris (see http://www.astro.com/swisseph). It is implemented as an XSUB. I built the binaries for a Windows XP platform with an ActivePerl installation Build 815 based on Perl 5.8.7 (see http://www.activestate.com/) and a Microsoft Visual C++ compiler version 6.0 at my hands. The package is purely experimental, and I don't have any experience with implementations on other platforms. It should, however, be possible to generate the XS library on an arbitrary platform.

If you plan to use this module on a non-Windows system, you will have to adapt the header file swedll32.h part of this distribution. I simplified the declarations of the Swiss Ephemeris' functions until it was possible to run MSVC++ ``nmake'' for the makefile of the SwissEph module. It was not possible to use the complete swedll32.h as delivered with the Swiss Ephemeris without getting fatal errors during compilation of the XSUB. When adapting this to other platforms, you may need to change the declspec() macro in swedll32.h, since the prefixes __declspec( dllimport ) and __stdcall are Win32 specific and will have to be replaced by other prefixes on other systems.

Use the Swiss Ephemeris programmers' manual to understand the meaning of the Swiss Ephemeris library functions. I added those functions to the package in which I was personally interested.

Have a look at the file SwissEph.xs to see which functions I have implemented and how they can be called.

Additional to the functions declared in the XS file, the module SwissEph.pm itself contains constants for the common planets (Sun, Moon, Mercury, ..., Pluto) and a function eps(jd_ut) to retrieve the true obliquity of the ecliptic (including nutation) for a given Julian Date.

EXPORT

None by default.

Any function may be imported if wanted (all functions are included in @EXPORT_OK).

The constants for the planets may be imported as a group via the tag :Planets.


SEE ALSO


AUTHOR

Rüdiger Plantiko (http://www.astrotexte.ch)


COPYRIGHT AND LICENSE

Copyright of this Perl wrapper (C) 2008 by Rüdiger Plantiko

This Perl wrapper is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

Copyright of the Swiss Ephemeris itself, however, is to (C) Astrodienst AG 1997

Mind that the Swiss Ephemeris itself is not free for commercial use!

See http://www.astro.com/swisseph for details of license conditions