On 2/4/03 9:41 am, Dave Rolsky at [EMAIL PROTECTED] spake thus:
> How about show me an API ;)

Actually that's about the only bit left to do! LOL! I wanted to make sure I
could get the functionality to work first.

Here's my quick thoughts:

$church_calendar = DateTime::Event::Church(
    calendars=>{
        'Catholic/Australia/Melbourne'
                             => 1, # Melbourne holidays get top ranking
        'Catholic/Australia' => 2, # Australian are included where they
                                   # where they don't clash with the Diocese
        'Catholic/Vatican'   => 3, # Vatican holidays* are only returned
                                   # where they don't clash with the
                                   # Archdiocese
        'Catholic/Australia/Melbourne/NorthGreensborough'
                             =>-1, # Parish Holidays don't block anything!
    },
    options=>{
        epiphany        => 'jan6',  # Epiphany can be Jan6 or Sun
        corpus_christi  => 'thu',   # Corpus Christi can be Thu or Sun
        # Lots of other options available .. assume defaults
    },
);

$next_epiphany = $church_calendar->following($dt, day=>'Epiphany');
   # Returns: DateTime object

$next_solemnity = $church_calendar->following($dt, rank=>'Solemnity');
   # Returns: DateTime object

$next_local_solemnity = $church_calendar->following(
    $dt,
    rank=>'Solemnity'
    calendars=>[
        'Catholic/Australia/Melbourne/NorthGreensborough'
    ]
);
   # Returns: DateTime object

$next_anything = $church_calendar->following($dt, day=>'any');
   # same as $next_anything = $church_calendar->following($dt);
   # Returns: DateTime object

$today = $church_calendar->is($dt, day=>'any');
   # Returns: String containing the day name or empty string if its
   # not anything (which never happens in this calendar!)
   # If today is multiple days, this returns a concatenated string whereas:

@today = $church_calendar->is($dt, day=>'any');
   # Returns an array of day names for $dt

$today = $church_calendar->is_loh($dt, day=>'any');
# Returns: arrayref of hashes:
# { day => 'Dayname',
#   rank => 'Solemnity/Movable Feast/...',
#   date => $dt,
#   color => 'Red/White/...',
#   season => 'Lent/Ordinary Time/Advent/...',
# }
# So: $today->[0]->{color} gets the color for the the first** day returned

NOTE ON CALENDAR RANKS:
Most information would be in 'Catholic/Vatican', 'Catholic/Australian' would
only include items specific to Australia such as the Feast of Blessed Mary
MacKillop.
'Catholic/Australia/Melbourne' would probably not be necessary here in
Melbourne, but I imagine there's Dioceses in the world that include their
own dates, but still celebrate the Archdiocese dates.

I've also added a new rank 'non-blocking' for days which can fall on the
same day as others (such as your priest's birthday in
'Catholic/Australia/Melbourne/NorthGreensborough'!)

OTHER NOTES:
*  'holidays' means 'holy days'
** order here is currently thought to be arbitrary, although will
   probably be returned at in alphabetical order of day names in
   order of rank

--------------------------------------------------------
             There are 10 kinds of people:
   those that understand binary, and those that don't.
--------------------------------------------------------
   The day Microsoft makes something that doesn't suck
     is the day they start selling vacuum cleaners
--------------------------------------------------------


Reply via email to