Net::Google::Calendar - programmatic access to Google's Calendar API
my $cal = Net::Google::Calendar->new( url => $url ); $cal->login($u, $p); for ($cal->get_events()) { print $_->title."\n"; print $_->content->body."\n*****\n\n"; } my $entry = Net::Google::Calendar::Entry->new(); $entry->title($title); $entry->content("My content"); $entry->location('London, England'); $entry->transparency('transparent'); $entry->status('confirmed'); $entry->when(DateTime->now, DateTime->now() + DateTime::Duration->new( hours => 6 ) ); my $author = Net::Google::Calendar::Person->new(); $author->name('Foo Bar'); $author->email('foo@bar.com'); $entry->author($author); my $tmp = $cal->add_entry($entry); die "Couldn't add event: $@\n" unless defined $tmp; print "Events=".scalar($cal->get_events())."\n"; $tmp->content('Updated'); $cal->update_entry($tmp) || die "Couldn't update ".$tmp->id.": $@\n"; $cal->delete_entry($tmp) || die "Couldn't delete ".$tmp->id.": $@\n";
Interact with Google's new calendar.
Create a new instance. opts is a hash which must contain your private Google url.
See
http://code.google.com/apis/gdata/calendar.html#find_feed_url
for how to get that.
Login to google.
Return a list of Net::Google::Calendar::Entry objects;
You can pass in a hash of options which map to the Google Data API's generic searching mechanisms plus the specific calendar ones.
http://code.google.com/apis/gdata/protocol.html#query-requests
for more details.
Full-text query string
When creating a query, list search terms separated by spaces, in the form q=term1 term2 term3. (As with all of the query parameter values, the spaces must be URL encoded.) The GData service returns all entries that match all of the search terms (like using AND between terms). Like Google's web search, a GData service searches on complete words (and related words with the same stem), not substrings.
To search for an exact phrase, enclose the phrase in quotation marks:
q => '"exact phrase'
To exclude entries that match a given term, use the form
q => '-term'
The search is case-insensitive.
Example: to search for all entries that contain the exact phrase 'Elizabeth Bennet' and the word 'Darcy' but don't contain the word 'Austen', use the following query:
q => '"Elizabeth Bennet" Darcy -Austen'
Category filter
To search in just one category do
category => 'Fritz'
You can query on multiple categories by listing multiple category parameters. For example
category => [ 'Fritz', 'Laurie' ]
returns entries that match both categories.
To do an OR between terms, use a pipe character (|). For example
category => 'Fritz|Laurie'
returns entries that match either category.
To exclude entries that match a given category, use the form
category => '-categoryname'
You can, of course, mix and match
[ 'Jo', 'Fritz|Laurie', '-Simon' ]
means in category
(Jo AND ( Fritz OR Laurie ) AND (NOT Simon))
Entry author
The service returns entries where the author name and/or email address match your query string.
Bounds on the entry publication date.
Use DateTime objects or the RFC 3339 timestamp format. For example: 2005-08-09T10:57:00-08:00.
The lower bound is inclusive, whereas the upper bound is exclusive.
Respectively, the earliest event start time to match (If not specified, default is 1970-01-01) and the latest event start time to match (If not specified, default is 2031-01-01).
1-based index of the first result to be retrieved
Note that this isn't a general cursoring mechanism. If you first send a query with
start-index => 1, max-results => 10
and then send another query with
start-index => 11, max-results => 10
the service cannot guarantee that the results are equivalent to
start-index => 1 max-results => 20
because insertions and deletions could have taken place in between the two queries.
Maximum number of results to be retrieved.
For any service that has a default max-results value (to limit default feed size), you can specify a very large number if you want to receive the entire feed.
ID of a specific entry to be retrieved.
If you specify an entry ID, you can't specify any other parameters.
Get a list of user's Calendars as Net::Google::Calendar::Entry objects.
Set the current calendar to use.
Create a new entry.
Delete a given entry.
Update a given entry.
This is ALPHA level software.
Don't use it. Ever. Or something.
Abstract this out to Net::Google::Data
The latest version can always be obtained from my Subversion repository.
http://unixbeard.net/svn/simon/Net-Google-Calendar
Simon Wistow <simon@thegestalt.org>
Copyright Simon Wistow, 2006
Distributed under the same terms as Perl itself.
http://code.google.com/apis/gdata/calendar.html
To install Net::Google::Calendar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Google::Calendar
CPAN shell
perl -MCPAN -e shell install Net::Google::Calendar
For more information on module installation, please visit the detailed CPAN module installation guide.