- -d: date eg: 17/3/2009
- -t : time [ It's should be entered as 24hr clock] eg: 20:00:00
- -r : reminder text [ It should be entered in between a double quotes ] eg: "This is a test"
- -p :priority [ I hav'nt implemented it yet . Kept it for future implementation.] eg : 1
- -b :Remind me before [ By using it we can change the default remind before time of 5mins ie it is used to remind from a specific mins before the time we have scheduled to remind. It is specified in mins] eg: 5
#!/usr/bin/perl
use Time::Local;
my @date;
my @time;
my $d=0,$t=0,$r=0,$p=0,$b=0;
my @deftime=localtime();
$deftime[5]+=1900;
$deftime[4]++;
my $dv="$deftime[3]/$deftime[4]/$deftime[5]",$tv="$deftime[2]:$deftime[1]:$deftime[0]",$rv="",$pv=1,$bv=0;
foreach $argnum (0 .. $#ARGV)
{
if($ARGV[$argnum] eq "-d")
{
$d=1;
$dv=$ARGV[$argnum+1];
}
elsif($ARGV[$argnum] eq "-t")
{
$t=1;
$tv=$ARGV[$argnum+1];
}
elsif($ARGV[$argnum] eq "-r")
{
$r=1;
$rv=$ARGV[$argnum+1];
print "Remind Text:$rv\n";
}
elsif($ARGV[$argnum] eq "-p")
{
$p=1;
$pv=$ARGV[$argnum+1];
print "Priority:$pv\n";
}
elsif($ARGV[$argnum] eq "-b")
{
$b=1;
$bv=$ARGV[$argnum+1];
print "Remind Before:$bv\n";
}
}
@date=split('/',$dv);
print "Date:$dv\n";
@time={0,0,0};
@time=split(':',$tv);
print "Time:$tv";
$date[1]--;
my $time=timelocal($time[2],$time[1],$time[0],$date[0],$date[1],$date[2],);
my $nowtime=timelocal(localtime());
my $difftime=$time-$nowtime;
print "\nTime Of Alarm:".$time."\nTime Now:".$nowtime."\nDifference in Seconds:".$difftime."\n";
open (FH,">>/home/rsrijith/perl/reminder");
print FH "$time:$pv:$bv:$rv\n";
close FH;
This code is part of the Perl Panel Code. The related codes to this are:use Time::Local;
my @date;
my @time;
my $d=0,$t=0,$r=0,$p=0,$b=0;
my @deftime=localtime();
$deftime[5]+=1900;
$deftime[4]++;
my $dv="$deftime[3]/$deftime[4]/$deftime[5]",$tv="$deftime[2]:$deftime[1]:$deftime[0]",$rv="",$pv=1,$bv=0;
foreach $argnum (0 .. $#ARGV)
{
if($ARGV[$argnum] eq "-d")
{
$d=1;
$dv=$ARGV[$argnum+1];
}
elsif($ARGV[$argnum] eq "-t")
{
$t=1;
$tv=$ARGV[$argnum+1];
}
elsif($ARGV[$argnum] eq "-r")
{
$r=1;
$rv=$ARGV[$argnum+1];
print "Remind Text:$rv\n";
}
elsif($ARGV[$argnum] eq "-p")
{
$p=1;
$pv=$ARGV[$argnum+1];
print "Priority:$pv\n";
}
elsif($ARGV[$argnum] eq "-b")
{
$b=1;
$bv=$ARGV[$argnum+1];
print "Remind Before:$bv\n";
}
}
@date=split('/',$dv);
print "Date:$dv\n";
@time={0,0,0};
@time=split(':',$tv);
print "Time:$tv";
$date[1]--;
my $time=timelocal($time[2],$time[1],$time[0],$date[0],$date[1],$date[2],);
my $nowtime=timelocal(localtime());
my $difftime=$time-$nowtime;
print "\nTime Of Alarm:".$time."\nTime Now:".$nowtime."\nDifference in Seconds:".$difftime."\n";
open (FH,">>/home/rsrijith/perl/reminder");
print FH "$time:$pv:$bv:$rv\n";
close FH;
No comments:
Post a Comment