CalDAV-Simple
view release on metacpan or search on metacpan
{
"abstract" : "a simple interface to calendar services via a subset of CalDAV",
"author" : [
"Neil Bowers <neilb@cpan.org>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.150001",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'a simple interface to calendar services via a subset of CalDAV'
author:
- 'Neil Bowers <neilb@cpan.org>'
build_requires:
Test::More: '0.88'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.150001'
license: perl
meta-spec:
Makefile.PL view on Meta::CPAN
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.032.
use strict;
use warnings;
use 5.006;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "a simple interface to calendar services via a subset of CalDAV",
"AUTHOR" => "Neil Bowers <neilb\@cpan.org>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "CalDAV-Simple",
"EXE_FILES" => [],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.006",
"NAME" => "CalDAV::Simple",
"PREREQ_PM" => {
This archive contains the distribution CalDAV-Simple,
version 0.01:
a simple interface to calendar services via a subset of CalDAV
This software is copyright (c) 2015 by Neil Bowers.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
This README file was generated by Dist::Zilla::Plugin::Readme v5.032.
lib/CalDAV/Simple.pm view on Meta::CPAN
has ua => (
is => 'ro',
default => sub {
require HTTP::Tiny;
require IO::Socket::SSL;
return HTTP::Tiny->new(agent => __PACKAGE__.'/'.$VERSION);
},
);
has calendar => (is => 'ro');
has username => (is => 'ro');
has password => (is => 'ro');
has croak_on_failure => (is => 'ro', default => sub { 1 });
has _url => (is => 'lazy');
sub _build__url
{
my $self = shift;
# This is a hack for doing basic auth
if ($self->calendar =~ m!^(https?://)(.*)$!) {
return $1.$self->username.':'.$self->password.'@'.$2;
}
else {
# This is probably my fault :-)
croak sprintf("unexpected format calendar '%s'\n",
$self->calendar);
}
}
my $request = sub {
my $self = shift;
my $param = shift;
return $self->ua->request($param->{verb}, $param->{url},
{
headers => $param->{headers},
content => $param->{content},
});
};
sub tasks
{
my $self = shift;
my $body = '<?xml version="1.0" encoding="utf-8"?><c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav"><d:prop><d:getetag/><c:calendar-data/></d:prop><c:filter><c:comp-filter name="VCALENDAR"><c:comp-filter name="VTODO"/></c:c...
my $response = $self->$request({
verb => 'REPORT',
url => $self->_url,
content => $body,
headers => {
'Depth' => 1,
'Prefer' => 'return-minimal',
'Content-Type' => 'application/xml; charset=utf-8',
},
});
lib/CalDAV/Simple.pm view on Meta::CPAN
'Content-Type' => 'application/xml; charset=utf-8',
},
});
}
1;
=head1 NAME
CalDAV::Simple - a simple interface to calendar services via a subset of CalDAV
=head1 SYNOPSIS
use CalDAV::Simple;
my $cal = CalDAV::Simple->new(
username => $username,
password => $password,
calendar => $url,
);
my @tasks = $cal->tasks;
foreach my $task (@tasks) {
printf "task '%s' is due '%s'\n", $task->summary, $task->due;
}
=head1 DESCRIPTION
lib/CalDAV/Simple.pm view on Meta::CPAN
This distribution is currently a lash-up: I hacked together something to
solve a problem. It does things the quick dirty way, and the interface
is likely to change from release to release. So far I've only tested it
against L<fruux.com|http://fruux.com>'s CalDAV server: I've no idea if
it will work with other servers yet. Please let me know either way.
=head1 METHODS
=head2 new
This expects three attributes: username, password, and calendar.
The latter is the URL for your calendar.
=head2 tasks
Returns a list of all tasks in the calendar.
Each entry in the list is an instance of L<CalDAV::Simple::Task>.
Look at the document for that module to see what attributes are provided.
=head2 delete_task
Takes a task (instance of L<CalDAV::Simple::Task>) and deletes it
from the calendar.
=head1 LIMITATIONS
This is very much alpha quality and has only been tested against one CalDAV server.
The XML returned by the server is currently handled with regular expressions,
and I haven't read any specs to find out what range of results I can expect.
In short: your mileage may vary :-)
=head1 SEE ALSO
lib/CalDAV/Simple/Task.pm view on Meta::CPAN
}
else {
croak "failed to get 'DUE' field out of VTODO string\n";
}
}
1;
=head1 NAME
CalDAV::Simple::Task - a data class representing one task (VTODO) in a CalCAV calendar
=head1 SYNOPSIS
use CalDAV::Simple::Task;
my $task = CalDAV::Simple::Task->new(vcal_string => $string);
printf "task '%s' is due '%s'\n", $task->summary, $task->due;
=head1 DESCRIPTION
This module is used to hold details of a single task from a CalDAV calendar.
It is alpha quality code. I don't really know much about CalDAV, but I've
been hacking around until I could get what I wanted working.
=head1 METHODS
=head2 summary
The short description / title of the task.
=head2 status
lib/CalDAV/Simple/Task.pm view on Meta::CPAN
When the task was created. This will currently be returned as an ISO 8601 date+time
string, I think. In the future I'll make this return a L<DateTime> instance as well.
=head2 vcal_string
This is the string returned from the CalDAV server for a single task.
It's basically the C<d:response> element:
<d:response>
...
<cal:calendar-data>
BEGIN:VCALENDAR
...
END:VCALENDAR
</cal:calendar-data>
...
</d:response>
Hopefully you won't have to deal with this.
=head2 delete_task
Takes a task (instance of L<CalDAV::Simple::Task>) and deletes it
from the calendar.
=head1 SEE ALSO
L<CalDAV::Simple> - the main module of this distribution, the C<tasks()>
method of which returns instances of C<CalDAV::Simple::Task>.
=head1 REPOSITORY
L<https://github.com/neilbowers/CalDAV-Simple>
( run in 1.277 second using v1.01-cache-2.11-cpan-39bf76dae61 )