aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src/Net-ICal-Libical/test/component.pl
blob: 2fdaf41d6508195a619845051876b2dc2d44f5e0 (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/perl

use lib "../blib/lib";
use lib "../blib/arch";
use lib "../";

use Time::Local;

use Net::ICal::Libical;

use POSIX; 


  my $comp_str=<<EOM;
BEGIN:VCALENDAR
METHOD
 :PUBLISH
PRODID
 :-//ACME/DesktopCalendar//EN
VERSION
 :2.0
BEGIN:VEVENT
ORGANIZER
 :mailto:a\@example.com
ATTENDEE
 ;RSVP=TRUE
 ;ROLE=REQ-PARTICIPANT
 ;CUTYPE=GROUP
 :MAILTO:employee-A\@host.com
DTSTART
 :19970701T200000Z
DURATION
 :P3DT4H50M36S
DTSTAMP
 :19970611T190000Z
SUMMARY
 :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES
UID
 :0981234-1234234-23\@example.com
END:VEVENT
END:VCALENDAR         
EOM
  
my $c;

$c = new Net::ICal::Libical::Component($comp_str);

my @props = $c->properties();

my $p;
foreach $p (@props) {
  print $p->name()." ".$p->value()."\n";
  
}

$inner = ($c->components())[0];

print "\n";

print " -------- Attendee \n";

$p = ($inner->properties('ATTENDEE'))[0];

print $p->as_ical_string(),"\n";

print $p->get_parameter('ROLE'),"\n";

die if $p->get_parameter('ROLE') ne 'REQ-PARTICIPANT';

$p->set_parameter('ROLE','INDIVIDUAL');

print $p->as_ical_string(),"\n";

print " -------- DTSTART \n";

$p = ($inner->properties('DTSTART'))[0];

print $p->as_ical_string()."\n";
print $p->as_ical_string()."\n";

print "hour: ". $p->hour()." \n";

$p->hour($p->hour() - 10);

print $p->hour(),"\n";

$p->timezone('America/Los_Angeles');

print $p->as_ical_string()."\n";


print "----------- DURATION \n";

$p = ($inner->properties('DURATION'))[0];

print $p->as_ical_string()."\n";

print $p->seconds(),"\n";

$p->seconds(3630);

print $p->as_ical_string()."\n";
print $p->seconds(),"\n";