Hi all,

I'm now working on DateTime::Event::SolarTerm which will calculate the
major and solar terms of the year. I'm currently using the DateTime::Set
interface to do this:

  my $base_time   = DateTime->new(...);
  my $major_terms = DateTime::Event::SolarTerm->major_term();

  my $next = $major_terms->next($base_time);
  # and previous(), and interator(), etc.

However, I'd like more than just the time and date of the next term to
be available for the user -- namely, I'd like things like

  - name of the term
  - the solar longitude
  - major/minor term

Now, given that the DateTime::Set interface expected next() and
previous() to return DateTime objects, what's the recommended approach
to providing more information than just the date/time?

I can think of a couple of ways to do this. One is to return some sort
of subclass of DateTime. The other is to provide a function that
converts a DateTime object into some sort of SolarTerm object.

The first approach seems bit of an overkill. The second suffers a
significant perfomance penalty, because you would have to re-compute the
solar longitude at the time  to get at the information for that term.

Is there any good way to do this?

--d




Reply via email to