#!/usr/bin/perl -w #) { chomp; my $time = str2time($_); if (defined $time) { my $part = time2str("/notebook/%Y/%m%d/1201.rem", $time); my $file = $home . $part; my $dir = dirname($file); -d $dir || die "$dir: not a directory: $!\n"; if (-f $file) { warn "$file exists, skipping\n"; } else { open(my $fh, "> $file") or die "$file: $!\n"; print $fh "$reminder\n"; close($fh); } } else { warn "$_: bad date\n"; } } exit(0); #--------------------------------------------------------------------- # Print a usage message from the comments and exit. sub usage { my ($emsg) = @_; use Pod::Usage qw(pod2usage); warn "$emsg\n" if defined $emsg; pod2usage(-verbose => 99, -sections => "NAME|SYNOPSIS|OPTIONS"); } sub manpage { use Pod::Man(); my $parser = Pod::Man->new(); open(STDOUT, "| groff -T ascii -man | gcat -s | less") || die "groff\n"; $parser->parse_from_file($0); close STDOUT || die "$myname: can't close stdout: $!\n"; $? = 1 if $? == 255; # from die exit($?); } #--------------------------------------------------------------------- # Print the UUID, current version, or source location. sub myuuid { my $UUID = sprintf("%s", q$UUID: a00b8cd0-9de4-3a5f-b3e8-c3c09a103412 $ =~ /UUID: (.*) /); print "$UUID\n"; exit(0); } sub version { my $VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/); my $DATE = sprintf("%s", q$Date: 2008/05/09 00:02:20 $ =~ /Date: (.*) /); print "$myname $VERSION $DATE\n"; exit(0); } sub where { my $SOURCE = sprintf("%s", /Source: (.*) /); print "$SOURCE\n"; exit(0); } #--------------------------------------------------------------------- __END__ =head1 NAME due2rem - make Oasis timecard reminders from a list of dates =head1 SYNOPSIS due2rem [-hmuvw] [dates] =head1 OPTIONS =over 4 =item B<-h> Print a brief help message and exit. =item B<-m> Print the manual page and exit. =item B<-u> Print the script UUID and exit. =item B<-v> Print the version and exit. =item B<-w> Print the source location and exit. =back =head1 DESCRIPTION B will read a list of dates in mm/dd/yy format and generate Oasis timecard reminder files. Hopefully, I'll only have to do this once a year. A reminder for 18 Jan 2008 goes in the file $HOME/notebook/2008/0118/1201.rem, and looks like this: REM MSG Finish your timesheet =head1 AUTHOR Karl Vogel Sumaria Systems, Inc. =cut