Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Calendar / Scheduler in Perl

by blue_cowdawg (Monsignor)
on Apr 25, 2013 at 13:03 UTC ( [id://1030663]=note: print w/replies, xml ) Need Help??


in reply to Calendar / Scheduler in Perl

      I'd like to know how I can design this - any help/alternate ideas with the design and structure will be highly appreciated.

If you were my boss or a client (same thing really) presenting me with this requirement I'd call this an incomplete program spec.

  • is this a command line application or a web application
  • are we printing reports or emailing them?
  • what is the user interface for entering data?
  • is there a database involved?
  • if not a database what type of repository?
and from the answer to those questions would probably generate more.


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

Replies are listed 'Best First'.
Re^2: Calendar / Scheduler in Perl
by vishi (Beadle) on Apr 25, 2013 at 16:24 UTC

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

    • This would be a command line application only
    • We are just printing reports on screen
    • The data will be read from plain text files - One will have Person Names and the other will have a List of Tasks
    • There is no database involved as of now, but if things continue to grow (either # of tasks or people), we *may* think of moving everything to a DB
    • All the reports will again be stored as flat files (CSV perhaps)

    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!!

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1030663]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-23 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found