Calendar::Slots::Slot - the time-slot object
version 0.12
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';
This is the basic class defining a calendar slot.
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 );
Returns true or false if the parameters match this time slot.
Returns a numeric rendition of the date and time parts, good for sorting.
Returns a weekday (1 to 7, Monday to Sunday). Works on both date or weekday slots.
Adds or subtract days to a slot.
Compare two slots and return true if the day is the same.
Compare two slots and return true if the weekday is the same.
Compare two slots and return true if types match.
Returns a hash suitable to feed to DateTime:
DateTime->new( $slot->ymd_hash );
Rodrigo de Oliveira rodrigolive@gmail.com
rodrigolive@gmail.com
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
To install Calendar::Slots, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Calendar::Slots
CPAN shell
perl -MCPAN -e shell install Calendar::Slots
For more information on module installation, please visit the detailed CPAN module installation guide.