DynGig-Range-Time

 view release on metacpan or  search on metacpan

lib/DynGig/Range/Time/Day.pm  view on Meta::CPAN

=head1 NAME

DynGig::Range::Time::Day -
Extends DynGig::Range::Time::Parse and DynGig::Range::Time::Object.

=cut
package DynGig::Range::Time::Day;

use base DynGig::Range::Time::Parse;
use base DynGig::Range::Time::Object;

use warnings;
use strict;

use overload '*=' => \&filter;

my %_ENV = ( cycle => 7 );

=head1 METHODS

See base class for additional methods.

=head2 setenv( cycle => $int )

Sets private environment variable I<cycle>. Returns object/class.

=cut
sub setenv
{
    my ( $this, %param ) = @_;

    map { $_ENV{$_} = $param{$_} if defined $param{$_} } keys %_ENV;
    return $this;
}

=head2 size()

Return the number of days in the object.

=cut
sub size
{
    my ( $this ) = @_;
    return @$this - 1;
}

=head2 filter( object )

Overloads B<*=>. Returns the object after I<semantic> intersection
with another object. To be implemented by derived class.

=cut
sub filter
{
    my ( $this, $that ) = @_;
    $this->intersect( $that );
}

=head1 INTERNALS

See base class for additional details.

=head2 OBJECT

ARRAY of I<cycle> DynGig::Range::Integer objects, each represents a corresponding day.

=cut
sub _object
{
    my ( $this ) = @_;
    $this->_init( $_ENV{cycle} );
}

=head2 LITERAL

A rudimentary range form. e.g.

 '10:25'     ## 1 minute
 '14:35:00'  ## 1 second
 '6'         ## 1 day
 '2 ~ 7'     ## 5 days

 '10:25 ~ 14:35'
 '10:25:38 ~ 14:35:00'
 '2 @ 10:25 ~ 7 @ 14:35'

=cut
sub _parse_



( run in 0.506 second using v1.01-cache-2.11-cpan-39bf76dae61 )