#!/bin/perl
use Inline Python;
$s = new Sun();
print "SUN: $s\n";
$m = new Moon();
__END__
__Python__
from ephem import Sun as Sun;
from ephem import Moon as Moon;
The code above yields:
SUN: <Sun "Sun" at 0x9ef6f14>
Can't bless non-reference value at /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/Inline/Python.pm line 317.
What's wrong? I've tried this with many other objects (eg:
from ephem import Observer as Observer;
and then
$o= new Observer();
in the body of my code) and it works fine for everything I've tried EXCEPT Moon.
EDIT (probably useless information):
In https://github.com/brandon-rhodes/pyephem/tree/master/libastro-3.7.5 :
The routines for calculating Sun, Mercury, Venus, Mars (the ones that work fine) are done in vsop87.c, function vsop87()
The routines for calculating Jupiter, Saturn, etc (the ones that don't work) are done in chap95.c, function chap95()
vsop87() "returns" an array of 6 doubles, which appear to be some sort of spherical coordinates.
chap95() "returns" an array of 6 doubles, which appear to be Cartesian coordinates, ie, rectangular and NOT spherical.
planpos() in plans.c calls one of the two functions above, depending on which planet you choose. What's odd is that planpos() treats the function results the same (sort of), even though they return very different things.
After planpos(), all planets are treated the same. planpos() is called by plans() (also in plans.c), which is in turn called by obj_planet() in circum.c which is then called by obj_cir() also in circum.c
obj_planet() and obj_cir() define the planet. Since planets are treated the same after planpos(), there should be no difference between them.