Rick Measham schreef:
> > Best solution would perhaps to convert to Julian at the start of those
> > methods, and to convert them back to Gregorian at the end.
> > (DateTime::Calendar::Julian could be useful here ;-)
> 
> Yeah, I figured I might have to do that, although then rather than finding
> the Easter in Julian Year 35000, I need to find it between Julian
> Equivalents of Gregorian Jan  1 35000 and Gregorian Dec 31 35000. Which just
> isn't so easy as calling it with a year. I'll need to call the potential
> (three?) years that overlap the single Gregorian year, and then find the
> Easter that intersects with the Gregorian year.
> 
> Hmmm .. I see some use for DateTime::Set::intersect there...

Only if you have (public) functions that are called with a year. If not,
you can convert to Julian at the start of following(); call easter()
with the Julian year; convert back to Gregorian. The Orthodox Easter is
always in the second quarter of the Julian year (though not always in
Spring), and there's always only one per year.

If eastern_easter is a public function (it is not documented), I suggest
a small piece of POD:

=item * eastern_easter( $year )

This function returns the Eastern Orthodox Easter in year $year.

Note: The calculation of Easter uses the Julian calendar. This method
therefore returns the date of Easter that falls in the Julian year
$year. In the Gregorian calendar, this Easter can lie in a different
year. If this bothers you, don't use dates before 10624 BC or after
33807 AD.

> Speaking of which: Is there any better way to conditionally load a module
> other than:
>  eval("use DateTime::Set");
>  croak("Couldn't load DateTime::Set:".$@) if $@;

Block-eval is better than string-eval. Also I think 'require' is used
more often than 'use' in these kind of constructs, but I don't think
there's a material difference.

> > And some small points:

Before I forget: the file had MS-DOS line endings, and no EOL on the
last line. this confused my vi.

Eugene

Reply via email to