in reply to A calendar tool (command-line version)

This ought to give you are start. Managing recuring calendar events and check out this code, written by someone else(unknown). All you need to do is figure out a hash, to link dates(as keys), with those days appointments(1..24 hours). So a hash of hashes might do it.

A GUI calendar with Tk or Gtk2 would be alot easier than commandline. Or by commandline, do you mean "not html or cgi" ?

If you can use Tk or Gtk2 (GUI's), look at Tk::MiniCalendar or Tk::ChooseDate. GUI's are easier, because you can let the user mouse click on a date from a calendar, pop up an text box, and let him enter the appointment and time. Perl/Gtk2 has a 'Calendar' widget too. See Gtk2 Simple Calendar/ Date Selector

If you are stuck with a true "commandline" program, you will need to work out a system, where you take user input, prompt for times and text, and do all sorts of prompting and confirming input.

#!/usr/bin/perl -w use strict; use Date::Calc qw(Calendar); #usage cal monthnum yesr; i.e. cal 8 2002 for AUG2002 #defaults to current month my $month = shift || (localtime(time))[4]+ 1; #numeric for subroutine my $year = shift || (localtime(time))[5] +1900; my @cal = parseCalendar(); my @months = (undef,'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); $month = $months[$month]; #change $month to 3-letter abbreviation print "\n$month$year: ",'Mo Tu We Th Fr Sa Su',"\n"; my $i = 1; foreach my $cal_line (@cal) { print " Week",$i++,": "; foreach my $day (@$cal_line) { $day ||= " "; print "$day "; }print "\n"; }print "\n"; exit; ##################################################################### sub parseCalendar { my $cal = Calendar($year, $month); my @cal = split(/\n/, $cal); splice(@cal, 0, 3); # get rid of the first three lines (don't need em) +; my @rv = map{$_ = substr($_, 1, length);[split /\s{4}|\s{2}/];}@cal; return @rv; }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: A calendar tool (command-line version)
by jethro (Monsignor) on Apr 27, 2008 at 22:25 UTC
    A GUI calendar ist only easier when others already wrote most of the code. ;-)
      As is true with Perl...... it's easier when others write most of the code, from the interpreter itself, to the various modules. It all depends on how familiar you are with the various modules. :-) Honestly, could you even use Perl if you had to write the interpreter yourself? "We see far because we stand on the shoulders of the giants who preceeded us". (paraphrased quote as usual). :-)

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum