Chinaunix

标题: 使用Net::Google::Calendar发送短信提醒的问题 [打印本页]

作者: hailongchang    时间: 2012-04-10 12:27
标题: 使用Net::Google::Calendar发送短信提醒的问题
大家好!

     我在尝试使用Google Calendar的短信提醒功能,使用的是Net::Google::Calendar。不知道版上有用过的朋友没有!

     我目前碰到一个问题, 就是使用文档中介绍的reminder无法设置短信提醒。我先说一下我的操作步骤,首先是建立一个entry, 然后添加到calendar中,成功后使用reminder。 程序执行后,我登陆Google Calendar,在页面上发现事件添加进来了,唯独短信提醒功能没有加进来, 下面是代码片段。 请教用过的朋友能指点一二, 在网络上几乎搜不到使用reminder的example。
  1. my $entry = Net::Google::Calendar::Entry->new();
  2. my $title = "程序检测出网络运行错误";
  3. $entry->title(decode("gbk",$title));
  4. $event_descrip = "网络运行错误,详情请查收电子邮件";
  5. $entry->content(decode("gbk",$event_descrip));
  6. $entry->status('confirmed');
  7. $entry->when(DateTime->now(time_zone=>'local') + DateTime::Duration->new( minutes => 10 ), DateTime->now(time_zone=>'local') + DateTime::Duration->new( minutes => 15 ) );

  8. my $time = DateTime->now(time_zone=>'local') + DateTime::Duration->new( minutes => 1 );
  9. $entry->reminder('sms','minutes',$time);

  10. my $tmp = $calendar->add_entry($entry);
  11. die "$tmp is null." if !defined $tmp;
复制代码

作者: hailongchang    时间: 2012-04-12 15:46
向版上的朋友们做个汇报,这个问题我已经解决了,目前可以正常发短信。

在解决过程中,积累了点经验,鉴于网上有关资料的贫乏,写了一个最简单的发短信的example:

http://www.hailongchang.org/index.php/archives/457
作者: sjdy521    时间: 2012-04-12 16:21
多谢分享,正在考虑要不要用一下~
作者: sjdy521    时间: 2012-04-12 16:32
看了你那文章,才第一次注意到原来cpan上的模块也有星级的划分。。
作者: x9x9    时间: 2012-04-12 16:45
感谢分享。楼主的文字也写的好,赞一个~
作者: 小perl    时间: 2012-04-12 20:53
成功了,楼主,普通人用这不知道可以干什么?
作者: hailongchang    时间: 2012-04-13 09:34
谢谢楼上的朋友们!

To 小perl:  我主要用它来对网络维护人员发短信通知。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2