in reply to Re: Calendar / Scheduler in Perl
in thread Calendar / Scheduler in Perl

Apologies for not giving you guys the full details! Okay Here are the details:

This is precisely why I am looking for design ideas / suggestions ... I have the scenario with me; I just dont know how to put everything together. Moreover, we may have to deal with things like people taking the day off, vacations, etc. which will come later as a part of my algorithm.

I'm sure there are others who have had a similar problem and have implemented it in their own ways - I tried a search but got only topics related to 'calendar' and 'date' modules. Modules will come later - right now I am thinking of a good data structure to implement this idea.

I could use a list of lists too... lots of "possibilities" in my head right now.. but I'm really not sure which one works best; That's where I need your suggestions as I believe atleast one of you may have come across such a task in your Perl work...

Thanks Again!!

Replies are listed 'Best First'.
Re^3: Calendar / Scheduler in Perl
by blue_cowdawg (Monsignor) on Apr 25, 2013 at 17:40 UTC

    This should give you a starting point.

    #!/usr/bin/perl -w use strict; my $OldIFS = $/; $/="**"; my ($taskList,$assigns)=<DATA>; chomp($taskList); $/=$OldIFS; my @tasks=split(/[\n]/,$taskList); my $timeline={}; foreach my $task(@tasks){ $timeline->{$task}=[]; } my @resourceList=split(/[\n]+/,$assigns); foreach my $assign(@resourceList){ my($resource,$theTasks)=split(/[\=]/,$assign); next unless $resource; # Deal with empty lines $resource =~ s/\s+$//; $theTasks =~ s/^\s+//; $theTasks =~ s/\s+$//; my @tasks=split(/[\s]+/,$theTasks); foreach my $task(@tasks){ push @{$timeline->{$task}},$resource; } } foreach my $key(sort keys %$timeline){ printf "%s\t%s\n",$key,join(",",@{$timeline->{$key}}); } exit(0); __END__ Task1 Task2 Task3 Task4 Task5 ** Joe Blow = Task1 Sally Brown = Task1 Task2 Jane Doe = Task3 Task5 Sid Down = Task2 Task4 Hoof Hearted = Task1 Task5


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg