-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsevcal.pl
55 lines (41 loc) · 937 Bytes
/
parsevcal.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl
# parse VCAL/ICS data file
# $Id: parsevcal.pl 53 2008-09-10 13:07:17Z rdk $
use Getopt::Long;
use iCal::Parser;
my $result;
my $verbose = 0;
my $help = 0;
my $datafile = "";
# -------------------------------------------------------------
sub usage()
{
print "usage: parsevcal.pl --help --verbose --datafile datafile\n";
exit -1;
}
# -------------------------------------------------------------
# main program
$result = GetOptions(
"help" => \$help,
"verbose" => \$verbose,
"datafile=s" => \$datafile
);
if ($help == 1) {
usage();
}
if ($datafile eq "") {
usage();
}
if ($verbose) {
print "Filename is '$datafile' \n";
}
my $parser;
if ($verbose) {
$parser=iCal::Parser->new(debug=>1);
}
else {
$parser=iCal::Parser->new();
}
my $hash=$parser->parse($datafile);
print "Parsed vcal data file\n";