Rodrigo de Oliveira Gonzalez > Calendar-Slots-0.15 > Calendar::Slots::Slot

Download:
Calendar-Slots-0.15.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.15   Source  

NAME ^

Calendar::Slots::Slot - the time-slot object

VERSION ^

version 0.15

SYNOPSIS ^

        use Calendar::Slots::Slot;
        my $slot = new Calendar::Slots::Slot( date=>'2009-10-22', start=>'20:30', end=>'22:30', name=>'birthday' ); 
        print
                $slot->contains( date=>'2009-10-22', time=>'21:00' )
                ? 'I'm busy'
                : 'I'm free then';

DESCRIPTION ^

This is the basic class defining a calendar slot.

ATTRIBUTES ^

    has name    => ( is => 'rw', isa => 'Str' );
    has data    => ( is => 'rw', isa => 'Any' );
    has when    => ( is => 'rw', isa => 'Int', required=>1, );
    has start   => ( is => 'rw', isa => 'Int' );
    has end     => ( is => 'rw', isa => 'Int' );
    has type    => ( is => 'rw', isa => 'Str', required=>1 );

METHODS ^

contains( { date=>'YYYY-MM-DD' | weekday=>1..7 }, time=>'HH:MM' )

Returns true or false if the parameters match this time slot.

numeric

Returns a numeric rendition of the date and time parts, good for sorting.

weekday

Returns a weekday (1 to 7, Monday to Sunday). Works on both date or weekday slots.

reschedule( add=>Int )

Adds or subtract days to a slot.

same_day

Compare two slots and return true if the day is the same.

same_weekday( $slot )

Compare two slots and return true if the weekday is the same.

same_type

Compare two slots and return true if types match.

ymd_hash

Returns a hash suitable to feed to DateTime:

        DateTime->new( $slot->ymd_hash );

AUTHOR ^

Rodrigo de Oliveira rodrigolive@gmail.com

LICENSE ^

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: