Chronic

 view release on metacpan or  search on metacpan

lib/Schedule/Chronic/Tab.pm  view on Meta::CPAN

    #
    # 1. command = "/usr/bin/updatedb"; constraint = Inactivity, 600;
    # 2. command = "/usr/bin/emerge rsync"; \ 
    #       constraint = DiskIO, 600; contraint = Loadavg, 600, 0.05;
    # 3. command = "/usr/bin/emerge rsync"; \ 
    #       constraint = DiskIO, 600; contraint = Loadavg, 600, 0.05; \ 
    #       last_ran = 1082709815;

    my $last_entry = '';  # To keep track of continuations
    my $tasks = 0;
    my $linecursor = 0;

    while ($_ = <TAB>) { 

        $linecursor++;
        next unless /\S/;
        next if /^\s*#/;
        chomp;

        my $entry = $normalize->($_);

        if ($entry =~ m|\\$|) { 

            # This is a continuation, save in $last_entry 
            # so it can be concatenated.

lib/Schedule/Chronic/Tab.pm  view on Meta::CPAN


            push @{$self->{_schedule}}, {%task};
            $tasks++;

        } else { 

            # This entry is b0rken. Show it to the user.
            # We should probably barf here and ask the user
            # to correct the error. FIX.

            $self->debug("Syntax error in line $linecursor of $tab - ignoring.");

        }

    }

    $self->debug("$tasks task(s) loaded.");

    close TAB;

}



( run in 0.241 second using v1.01-cache-2.11-cpan-4d50c553e7e )