Mailing List Archive

Perl event creator
Hello,

I'm new here. I've spent a few hours trying to create a new event with perl on my DAViCal 9.9 server here on an Ubuntu server (that works fine).


#!/usr/bin/perl
use HTTP::DAV;

$dav = HTTP::DAV->new;
$dav->credentials( "myuser", "mypwd", 'http://something.dyndns.org/cal/caldav.php/myuser/home/' );
my $resource = $dav->new_resource( -uri => "http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics");
$str = <<stop;
BEGIN:VCALENDAR
PRODID:Data::ICal 0.16
VERSION:2.0
BEGIN:VEVENT
DESCRIPTION:YAPH
DTEND:20100510T145818
DTSTART:20100510T144138
SUMMARY:Perl dav
TRANSP:OPAQUE
UID:90226620-5129-3124-0892-80887406425337
END:VEVENT
END:VCALENDAR
stop

$response = $dav->put(-local=>\$str,-url=>"http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics", -Content-Type=>'text/icalendar',-If-None-Match=>'*');
print $resource->propfind->as_string;

$resource->propfind;
$getlastmodified = $resource->get_property( "getlastmodified" );
print "Last mod : $getlastmodified\n";


The output goes:

Error number 0 (http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics:propstat:XML::DOM::Element=ARRAY(0x95bbbd0)):
Href: http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics
Mesg(code): OK (200)


HTTP/1.1 207 Multistatus
Connection: close
Date: Mon, 10 May 2010 15:37:58 GMT
ETag: "1debb5060884ea4fa58ad121d431ec26"
Server: Apache/2.2.14 (Ubuntu)
Content-Length: 952
Content-Type: text/xml; charset="utf-8"
Client-Date: Mon, 10 May 2010 15:37:58 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy, bind, calendar-auto-schedule
X-DAViCal-Version: DAViCal/0.9.9; DB/1.2.8
X-Powered-By: PHP/5.3.2-1ubuntu4.1

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics</href>
<propstat>
<prop>
<getcontenttype>text/calendar</getcontenttype>
<resourcetype/>
<getcontentlength>226</getcontentlength>
<displayname>Steph</displayname>
<getlastmodified>Mon, 10 May 2010 15:16:45 GMT</getlastmodified>
<creationdate>2010-05-05T07:35:49+02:00</creationdate>
<getetag/>
<getcontentlanguage/>
<supportedlock>
<lockentry>
<lockscope>
<exclusive/>
</lockscope>
<locktype>
<write/>
</locktype>
</lockentry>
</supportedlock>
<owner>
<href>/cal/caldav.php/myuser/</href>
</owner>
<current-user-principal>
<href>/cal/caldav.php/myuser/</href>
</current-user-principal>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
Last mod : Mon, 10 May 2010 15:16:45 GMT


As far as I understand I got 200 OK so the put goes fine but the part I don't understand is that the event is not created in the calendar.
I don't know why I get Error number 0

Maybe I am heading in the wrong direction, i don't know.

I just need to create new events with a perl script.

Does anybody as such a knowledge to share or ideas why my script goes wrong ?



all the best,

St?phane Habett Roux



_______________________________________________
rscds-general mailing list
rscds-general at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rscds-general
Perl event creator [ In reply to ]
On Mon, 2010-05-10 at 17:49 +0200, St?phane Roux wrote:
> Hello,
>
> I'm new here. I've spent a few hours trying to create a new event with
> perl on my DAViCal 9.9 server here on an Ubuntu server (that works
> fine).
>
>
> #!/usr/bin/perl
> use HTTP::DAV;
>
> $dav = HTTP::DAV->new;
> $dav->credentials( "myuser", "mypwd", 'http://something.dyndns.org/cal/caldav.php/myuser/home/' );
> my $resource = $dav->new_resource( -uri => "http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics");
> $str = <<stop;
> BEGIN:VCALENDAR
> PRODID:Data::ICal 0.16
> VERSION:2.0
> BEGIN:VEVENT
> DESCRIPTION:YAPH
> DTEND:20100510T145818
> DTSTART:20100510T144138
> SUMMARY:Perl dav
> TRANSP:OPAQUE
> UID:90226620-5129-3124-0892-80887406425337
> END:VEVENT
> END:VCALENDAR
> stop
>
> $response = $dav->put(-local=>\$str,-url=>"http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics", -Content-Type=>'text/icalendar',-If-None-Match=>'*');
> print $resource->propfind->as_string;
>
> $resource->propfind;
> $getlastmodified = $resource->get_property( "getlastmodified" );
> print "Last mod : $getlastmodified\n";
>
>
> The output goes:
>
> Error number 0 (http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics:propstat:XML::DOM::Element=ARRAY(0x95bbbd0)):
> Href: http://something.dyndns.org/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics
> Mesg(code): OK (200)

200 is odd. You should get a '201 Created' if it's a new event.

Check you have all the mandatory properties for a VEVENT though. You're
missing DTSTAMP at least, and possibly something else (that's the only
one I can remember though).


>
> HTTP/1.1 207 Multistatus
> Connection: close
> Date: Mon, 10 May 2010 15:37:58 GMT
> ETag: "1debb5060884ea4fa58ad121d431ec26"
> Server: Apache/2.2.14 (Ubuntu)
> Content-Length: 952
> Content-Type: text/xml; charset="utf-8"
> Client-Date: Mon, 10 May 2010 15:37:58 GMT
> Client-Peer: 127.0.0.1:80
> Client-Response-Num: 1
> DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy, bind, calendar-auto-schedule
> X-DAViCal-Version: DAViCal/0.9.9; DB/1.2.8
> X-Powered-By: PHP/5.3.2-1ubuntu4.1
>
> <?xml version="1.0" encoding="utf-8" ?>
> <multistatus xmlns="DAV:">
> <response>
> <href>/cal/caldav.php/myuser/home/90226620-5129-3124-0892-80887406425337.ics</href>
> <propstat>
> <prop>
> <getcontenttype>text/calendar</getcontenttype>
> <resourcetype/>
> <getcontentlength>226</getcontentlength>
> <displayname>Steph</displayname>
> <getlastmodified>Mon, 10 May 2010 15:16:45 GMT</getlastmodified>
> <creationdate>2010-05-05T07:35:49+02:00</creationdate>
> <getetag/>
> <getcontentlanguage/>
> <supportedlock>
> <lockentry>
> <lockscope>
> <exclusive/>
> </lockscope>
> <locktype>
> <write/>
> </locktype>
> </lockentry>
> </supportedlock>
> <owner>
> <href>/cal/caldav.php/myuser/</href>
> </owner>
> <current-user-principal>
> <href>/cal/caldav.php/myuser/</href>
> </current-user-principal>
> </prop>
> <status>HTTP/1.1 200 OK</status>
> </propstat>
> </response>
> </multistatus>
> Last mod : Mon, 10 May 2010 15:16:45 GMT
>
>
> As far as I understand I got 200 OK so the put goes fine but the part I don't understand is that the event is not created in the calendar.
> I don't know why I get Error number 0
>
> Maybe I am heading in the wrong direction, i don't know.
>
> I just need to create new events with a perl script.
>
> Does anybody as such a knowledge to share or ideas why my script goes wrong ?

I do interact with DAViCal from perl for my regression testing, but I
actually do that by creating a fancy command-line for curl and doing it
with that.

You can see that script in testing/dav_test in the source repository.

Cheers,
Andrew.

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Flexibility is overrated. Constraints are liberating.
------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.morphoss.com/pipermail/davical-users/attachments/20100511/8e14b722/attachment.pgp>
-------------- next part --------------

-------------- next part --------------
_______________________________________________
rscds-general mailing list
rscds-general at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rscds-general