谷歌日曆條目有使用日期和名字,我想事件添加到谷歌日曆下面的子例程的數組:XML錯誤在添加用Perl
use Net::Google::Calendar;
use Date::Manip;
use Date::Calc qw(Add_Delta_Days);
my $username #removed for stackoverflow
my $password #removed for stackoverflow
my $cal = Net::Google::Calendar->new;
my $from = new Date::Manip::Date;
my $to = new Date::Manip::Date;
my @f;
my @t;
my $year;
my $month;
my $day;
$cal->login($username, $password) or $MESSAGERED = "Google Calendar login failed.";
my $entry;
#[0] name
#[1] from
#[2] to
#[3] hid
for my $i (0 .. $#ALL_HOLIDAYS) {
$from->parse($ALL_HOLIDAYS[$i][1]);
$to->parse($ALL_HOLIDAYS[$i][2]);
@f = $from->value();
@t = $to->value();
# a day added in line with our "last day of absence"
($year, $month, $day) = Add_Delta_Days($t[0], $t[1], $t[2], 1);
$entry = Net::Google::Calendar::Entry->new() or die " 518 ++++++++++ ";
$entry->when(DateTime->new(year => $f[0], month => $f[1], day => $f[2]), DateTime->new(year => $year, month => $month, day => $day)) or die " 519 ++++++++++ ";
$entry->title($ALL_HOLIDAYS[$i][0]) or die " 520 ++++++++++ ";
$entry->content("Holiday") or die " 521 ++++++++++ ";
$entry->transparency('transparent') or die " 522++++++++++ ";
$entry->status('confirmed') or die " 523 ++++++++++ ";
if ($cal->add_entry($entry)) {
&mark_entry_as_googd($ALL_HOLIDAYS[$i][3]);
} else {
$MESSAGEORANGE = "Unable to submit entry for ".$ALL_HOLIDAYS[$i][0]
}
}
$MESSAGEGREEN = "Google Calendar populated";
print $MESSAGERED.$MESSAGEGREEN.$MESSAGEORANGE;
事情是,只要我拿這個腳本關閉並在我的控制檯(osx)運行它運行正常,事件被添加到谷歌日曆。 如果Debian的服務器上執行下面的錯誤,我問這個問題的原因,收到:
No namespace matches prefix: xmlns at /usr/local/share/perl/5.10.1/XML/XPath/Node/Element.pm line 261.
CPAN報告同樣的東西在兩臺機器上,這兩個網::谷歌::日曆並且它的依賴關係被安裝。這些die
都沒有工作,它總是那樣的錯誤。我意識到這個模塊是alpha,但仍然,爲什麼差異?
是那是一個領先優勢,將檢查這些東西,但現在我不認爲我有辦法捕捉性反應 – Recct 2012-02-22 10:17:08
的xmllib-的xmllib-perl的手動從發行庫及的xmllib-perl的更新,這似乎已經解決了現在的問題! – Recct 2012-02-23 15:11:03
這很酷也很好知道。 :) – Rich 2012-02-23 21:39:57