{"thread":{"id":"27605","subject":"[PATCH] ciabot: Add a revamped Perl version.","startedAt":"2011-06-11T22:35:57Z","lastAt":"2011-06-12T01:30:17Z","messageCount":2,"participants":["JD Horelick","David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"169883","messageId":"BANLkTin+U2x-Lk_qKrGD4hbxnRWySgHFLA@mail.gmail.com","threadId":"27605","inReplyTo":null,"subject":"[PATCH] ciabot: Add a revamped Perl version.","fromName":"JD Horelick","fromEmail":"jdhore1@gmail.com","sentAt":"2011-06-11T22:35:57Z","receivedAt":"2011-06-11T22:35:57Z","isPatch":true,"sender":{"key":"jdhore1@gmail.com","avatar":null},"body":"Attached (and pasted below, but I believe Gmail messes up the\nwhitespace) is a patch for a new ciabot script that is the revamped\nversion of the old Perl script.\n\n---\n\n>From f80c041dcd7db6abfa0354c89adcb8b811b27e89 Mon Sep 17 00:00:00 2001\nFrom: JD Horelick <jdhore1@gmail.com>\nDate: Sat, 11 Jun 2011 18:16:16 -0400\nSubject: [PATCH] ciabot: Add a revamped Perl version.\n\nThis revamped Perl version offers more features and uses the recommended\ninterface to the CIA.vc Service (XML-RPC, with email as a backup option).\n\nSome of the additional features include the ability to send a module\nfield to CIA and the ability to set script all relevant script options\nwith git config.\n\nSigned-off-by: JD Horelick <jdhore1@gmail.com>\n---\n contrib/ciabot/README    |   13 +-\n contrib/ciabot/ciabot.pl |  321 ++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 329 insertions(+), 5 deletions(-)\n create mode 100755 contrib/ciabot/ciabot.pl\n\ndiff --git a/contrib/ciabot/README b/contrib/ciabot/README\nindex 3b916ac..5683fa2 100644\n--- a/contrib/ciabot/README\n+++ b/contrib/ciabot/README\n@@ -1,12 +1,15 @@\n These are hook scripts for the CIA notification service at <http://cia.vc/>\n\n-They are maintained by Eric S. Raymond <esr@thyrsus.com>.  There is an\n-upstream resource page for them at <http://www.catb.org/esr/ciabot/>,\n+The Perl version is maintained by JD Horelick <jdhore1@gmail.com>.\n+\n+The Python and shell versions are maintained by Eric S. Raymond\n<esr@thyrsus.com>.\n+There is an upstream resource page for them at\n<http://www.catb.org/esr/ciabot/>,\n but they are unlikely to change rapidly.\n\n-You probably want the Python version; it's faster, more capable, and\n-better documented.  The shell version is maintained only as a fallback\n-for use on hosting sites that don't permit Python hook scripts.\n+You probably want the Perl version; it's faster, more capable, uses the\n+recommended CIA interface and is better documented.  The shell version\n+is maintained only as a fallback for use on hosting sites that don't\n+permit Perl hook scripts.\n\n You will find installation instructions for each script in its comment\n header.\ndiff --git a/contrib/ciabot/ciabot.pl b/contrib/ciabot/ciabot.pl\nnew file mode 100755\nindex 0000000..56c37ca\n--- /dev/null\n+++ b/contrib/ciabot/ciabot.pl\n@@ -0,0 +1,321 @@\n+#!/usr/bin/perl -w\n+#\n+# ciabot -- Mail a git log message to a given address, for the purposes of CIA\n+#\n+# Loosely based on cvslog by Russ Allbery <rra@stanford.edu>\n+# Copyright 1998  Board of Trustees, Leland Stanford Jr. University\n+#\n+# Copyright 2001, 2003, 2004, 2005  Petr Baudis <pasky@ucw.cz>\n+# Copyright 2011 JD Horelick <jdhore1@gmail.com>\n+#\n+# This program is free software; you can redistribute it and/or modify it under\n+# the terms of the GNU General Public License version 2, as published by the\n+# Free Software Foundation.\n+#\n+# The master location of this file is in the Cogito repository\n+# (see http://www.kernel.org/git/).\n+#\n+# This program is designed to run as the .git/hooks/post-commit hook. It takes\n+# the commit information, massages it and mails it to the address given below.\n+#\n+# The calling convention of the post-commit hook is:\n+#\n+#\t.git/hooks/post-commit $commit_sha1 $branch_name\n+#\n+# If it does not work, try to disable $xml_rpc in the configuration section\n+# below. Also, remember to make the hook file executable.\n+#\n+#\n+# Note that you can (and it might be actually more desirable) also use this\n+# script as the GIT update hook:\n+#\n+#\trefname=${1#refs/heads/}\n+#\t[ \"$refname\" = \"master\" ] && refname=\n+#\toldhead=$2\n+#\tnewhead=$3\n+#\tfor merged in $(git rev-list $newhead ^$oldhead | tac); do\n+#\t\t/path/to/ciabot.pl $merged $refname\n+#\tdone\n+#\n+# This is useful when you use a remote repository that you only push to. The\n+# update hook will be triggered each time you push into that repository, and\n+# the pushed commits will be reported through CIA.\n+\n+use strict;\n+use Carp;\n+use vars qw ($project $module $repo $baseurl $from_email $dest_email\n$noisy $rpc_uri $sendmail\n+\t\t$xml_rpc $ignore_regexp $alt_local_message_target);\n+\n+\n+\n+\n+### Configuration\n+\n+# Project name (as known to CIA).\n+chomp($project = `git config --get cia.project`);\n+\n+# Module name (if applicable)\n+chomp($module = `git config --get cia.module`);\n+\n+# Repository name in the web interface\n+chomp($repo = `git config --get cia.repo`);\n+\n+# Base URL for a GitWeb or cgit instance\n+# You must comment all the baseurl lines out if you do not have a web interface\n+# or do not want the web interface URL for the commit displayed\n+# Gitweb\n+#$baseurl = \"http://git.example.com/cgi-bin/gitweb.cgi?p=$repo;a=commit;h=\";\n+# cgit\n+$baseurl = \"http://git.example.com/$repo/commit/?id=\";\n+\n+# The from address in generated mails.\n+$from_email = 'cia@example.com';\n+\n+# Mail all reports to this address.\n+$dest_email = 'cia@cia.vc';\n+\n+# If using XML-RPC, connect to this URI.\n+$rpc_uri = 'http://cia.vc/RPC2';\n+\n+# Path to your USCD sendmail compatible binary (your mailer daemon created this\n+# program somewhere).\n+$sendmail = '/usr/sbin/sendmail';\n+\n+# If set, the script will send CIA the full commit message. If unset, only the\n+# first line of the commit message will be sent.\n+$noisy = 1;\n+\n+# This script can communicate with CIA either by mail or by an XML-RPC\n+# interface. The XML-RPC interface is faster and more efficient, however you\n+# need to have RPC::XML perl module installed, and some large CVS hosting sites\n+# (like Savannah or Sourceforge) might not allow outgoing HTTP connections\n+# while they allow outgoing mail. Also, this script will hang and eventually\n+# not deliver the event at all if CIA server happens to be down, which is\n+# unfortunately not an uncommon condition.\n+$xml_rpc = 1;\n+\n+# This variable should contain a regexp, against which each file will be\n+# checked, and if the regexp is matched, the file is ignored. This can be\n+# useful if you do not want auto-updated files, such as e.g. ChangeLog, to\n+# appear via CIA.\n+#\n+# The following example will make the script ignore all changes in two specific\n+# files in two different modules, and everything concerning module 'admin':\n+#\n+# $ignore_regexp = \"^(gentoo/Manifest|elinks/src/bfu/inphist.c|admin/)\";\n+$ignore_regexp = \"\";\n+\n+# It can be useful to also grab the generated XML message by some other\n+# programs and e.g. autogenerate some content based on it. Here you can specify\n+# a file to which it will be appended.\n+$alt_local_message_target = \"\";\n+\n+\n+\n+\n+### The code itself\n+\n+use vars qw ($commit $tree @parent $author $committer);\n+use vars qw ($user $branch $rev @files $logmsg $message $shorturl);\n+my $line;\n+\n+if ($project eq \"\") {\n+\tcroak \"Project variable is required. Please set one with git config\n--add cia.project\";\n+}\n+\n+if ($repo eq \"\") {\n+\tundef $baseurl;\n+}\n+\n+# Let's be extra-safe here\n+if ($module eq \"\") {\n+\tundef $module;\n+}\n+\n+\n+### Input data loading\n+\n+\n+# The commit stuff\n+$commit = $ARGV[0];\n+$branch = $ARGV[1];\n+\n+open COMMIT, \"git cat-file commit $commit|\" or die \"git cat-file\ncommit $commit: $!\";\n+my $state = 0;\n+$logmsg = '';\n+while (defined ($line = <COMMIT>)) {\n+  if ($state == 1) {\n+    $logmsg .= $line;\n+    $noisy or $state++;\n+    next;\n+  } elsif ($state > 1) {\n+    next;\n+  }\n+\n+  chomp $line;\n+  unless ($line) {\n+    $state = 1;\n+    next;\n+  }\n+\n+  my ($key, $value) = split(/ /, $line, 2);\n+  if ($key eq 'tree') {\n+    $tree = $value;\n+  } elsif ($key eq 'parent') {\n+    push(@parent, $value);\n+  } elsif ($key eq 'author') {\n+    $author = $value;\n+  } elsif ($key eq 'committer') {\n+    $committer = $value;\n+  }\n+}\n+close COMMIT;\n+\n+\n+open DIFF, \"git diff-tree -r $parent[0] $tree|\" or die \"git diff-tree\n$parent[0] $tree: $!\";\n+while (defined ($line = <DIFF>)) {\n+  chomp $line;\n+  my @f;\n+  (undef, @f) = split(/\\t/, $line, 2);\n+  push (@files, @f);\n+}\n+close DIFF;\n+\n+\n+# Figure out who is doing the update.\n+# XXX: Too trivial this way?\n+($user) = $author =~ /<(.*?)@/;\n+\n+\n+$rev = substr($commit, 0, 12);\n+\n+\n+\n+\n+### Remove to-be-ignored files\n+\n+@files = grep { $_ !~ m/$ignore_regexp/; } @files\n+  if ($ignore_regexp);\n+exit unless @files;\n+\n+\n+\n+### Compose the mail message\n+\n+\n+my ($VERSION) = '2.0';\n+my $ts = time;\n+\n+$message = <<EM\n+<message>\n+   <generator>\n+       <name>CIA Perl client for Git</name>\n+       <version>$VERSION</version>\n+   </generator>\n+   <source>\n+       <project>$project</project>\n+\n+EM\n+;\n+$message .= \"       <module>$module</module>\" if ($module);\n+$message .= \"       <branch>$branch</branch>\" if ($branch);\n+$message .= <<EM\n+   </source>\n+   <timestamp>\n+       $ts\n+   </timestamp>\n+   <body>\n+       <commit>\n+           <author>$user</author>\n+           <revision>$rev</revision>\n+           <files>\n+EM\n+;\n+\n+foreach (@files) {\n+  s/&/&amp;/g;\n+  s/</&lt;/g;\n+  s/>/&gt;/g;\n+  $message .= \"  <file>$_</file>\\n\";\n+}\n+\n+$logmsg =~ s/&/&amp;/g;\n+$logmsg =~ s/</&lt;/g;\n+$logmsg =~ s/>/&gt;/g;\n+\n+if (defined $baseurl) {\n+\t$shorturl = $baseurl . $rev;\n+\t$logmsg = $logmsg . $shorturl;\n+}\n+\n+$message .= <<EM\n+           </files>\n+\t<log>$logmsg</log>\n+       </commit>\n+   </body>\n+</message>\n+EM\n+;\n+\n+\n+\n+### Write the message to an alt-target\n+\n+if ($alt_local_message_target and open (ALT, \">>$alt_local_message_target\")) {\n+  print ALT $message;\n+  close ALT;\n+}\n+\n+\n+\n+### Send out the XML-RPC message\n+\n+\n+if ($xml_rpc) {\n+  # We gotta be careful from now on. We silence all the warnings because\n+  # RPC::XML code is crappy and works with undefs etc.\n+  $^W = 0;\n+  $RPC::XML::ERROR if (0); # silence perl's compile-time warning\n+\n+  require RPC::XML;\n+  require RPC::XML::Client;\n+\n+  my $rpc_client = new RPC::XML::Client $rpc_uri;\n+  my $rpc_request = RPC::XML::request->new('hub.deliver', $message);\n+  my $rpc_response = $rpc_client->send_request($rpc_request);\n+\n+  unless (ref $rpc_response) {\n+    carp \"XML-RPC Error: $RPC::XML::ERROR. No CIA notification will\nbe displayed for what was pushed.\\n\";\n+  }\n+  exit;\n+}\n+\n+\n+\n+### Send out the mail\n+\n+\n+# Open our mail program\n+\n+open (MAIL, \"| $sendmail -t -oi -oem\") or die \"Cannot execute\n$sendmail : \" . ($?>>8);\n+\n+\n+# The mail header\n+\n+print MAIL <<EOM;\n+From: $from_email\n+To: $dest_email\n+Content-type: text/xml\n+Subject: DeliverXML\n+\n+EOM\n+\n+print MAIL $message;\n+\n+\n+# Close the mail\n+\n+close MAIL;\n+die \"$0: sendmail exit status \" . ($? >> 8) . \"\\n\" unless ($? == 0);\n+\n+# vi: set sw=2:\n-- \n1.7.5.1\n\n\nFrom f80c041dcd7db6abfa0354c89adcb8b811b27e89 Mon Sep 17 00:00:00 2001\nFrom: JD Horelick <jdhore1@gmail.com>\nDate: Sat, 11 Jun 2011 18:16:16 -0400\nSubject: [PATCH] ciabot: Add a revamped Perl version.\n\nThis revamped Perl version offers more features and uses the recommended\ninterface to the CIA.vc Service (XML-RPC, with email as a backup option).\n\nSome of the additional features include the ability to send a module\nfield to CIA and the ability to set script all relevant script options\nwith git config.\n\nSigned-off-by: JD Horelick <jdhore1@gmail.com>\n---\n contrib/ciabot/README    |   13 +-\n contrib/ciabot/ciabot.pl |  321 ++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 329 insertions(+), 5 deletions(-)\n create mode 100755 contrib/ciabot/ciabot.pl\n\ndiff --git a/contrib/ciabot/README b/contrib/ciabot/README\nindex 3b916ac..5683fa2 100644\n--- a/contrib/ciabot/README\n+++ b/contrib/ciabot/README\n@@ -1,12 +1,15 @@\n These are hook scripts for the CIA notification service at <http://cia.vc/>\n \n-They are maintained by Eric S. Raymond <esr@thyrsus.com>.  There is an\n-upstream resource page for them at <http://www.catb.org/esr/ciabot/>,\n+The Perl version is maintained by JD Horelick <jdhore1@gmail.com>.\n+\n+The Python and shell versions are maintained by Eric S. Raymond <esr@thyrsus.com>.\n+There is an upstream resource page for them at <http://www.catb.org/esr/ciabot/>,\n but they are unlikely to change rapidly.\n \n-You probably want the Python version; it's faster, more capable, and\n-better documented.  The shell version is maintained only as a fallback\n-for use on hosting sites that don't permit Python hook scripts.\n+You probably want the Perl version; it's faster, more capable, uses the\n+recommended CIA interface and is better documented.  The shell version\n+is maintained only as a fallback for use on hosting sites that don't\n+permit Perl hook scripts.\n \n You will find installation instructions for each script in its comment\n header.\ndiff --git a/contrib/ciabot/ciabot.pl b/contrib/ciabot/ciabot.pl\nnew file mode 100755\nindex 0000000..56c37ca\n--- /dev/null\n+++ b/contrib/ciabot/ciabot.pl\n@@ -0,0 +1,321 @@\n+#!/usr/bin/perl -w\n+#\n+# ciabot -- Mail a git log message to a given address, for the purposes of CIA\n+#\n+# Loosely based on cvslog by Russ Allbery <rra@stanford.edu>\n+# Copyright 1998  Board of Trustees, Leland Stanford Jr. University\n+#\n+# Copyright 2001, 2003, 2004, 2005  Petr Baudis <pasky@ucw.cz>\n+# Copyright 2011 JD Horelick <jdhore1@gmail.com>\n+#\n+# This program is free software; you can redistribute it and/or modify it under\n+# the terms of the GNU General Public License version 2, as published by the\n+# Free Software Foundation.\n+#\n+# The master location of this file is in the Cogito repository\n+# (see http://www.kernel.org/git/).\n+#\n+# This program is designed to run as the .git/hooks/post-commit hook. It takes\n+# the commit information, massages it and mails it to the address given below.\n+#\n+# The calling convention of the post-commit hook is:\n+#\n+#\t.git/hooks/post-commit $commit_sha1 $branch_name\n+#\n+# If it does not work, try to disable $xml_rpc in the configuration section\n+# below. Also, remember to make the hook file executable.\n+#\n+#\n+# Note that you can (and it might be actually more desirable) also use this\n+# script as the GIT update hook:\n+#\n+#\trefname=${1#refs/heads/}\n+#\t[ \"$refname\" = \"master\" ] && refname=\n+#\toldhead=$2\n+#\tnewhead=$3\n+#\tfor merged in $(git rev-list $newhead ^$oldhead | tac); do\n+#\t\t/path/to/ciabot.pl $merged $refname\n+#\tdone\n+#\n+# This is useful when you use a remote repository that you only push to. The\n+# update hook will be triggered each time you push into that repository, and\n+# the pushed commits will be reported through CIA.\n+\n+use strict;\n+use Carp;\n+use vars qw ($project $module $repo $baseurl $from_email $dest_email $noisy $rpc_uri $sendmail\n+\t\t$xml_rpc $ignore_regexp $alt_local_message_target);\n+\n+\n+\n+\n+### Configuration\n+\n+# Project name (as known to CIA).\n+chomp($project = `git config --get cia.project`);\n+\n+# Module name (if applicable)\n+chomp($module = `git config --get cia.module`);\n+\n+# Repository name in the web interface\n+chomp($repo = `git config --get cia.repo`);\n+\n+# Base URL for a GitWeb or cgit instance\n+# You must comment all the baseurl lines out if you do not have a web interface\n+# or do not want the web interface URL for the commit displayed\n+# Gitweb\n+#$baseurl = \"http://git.example.com/cgi-bin/gitweb.cgi?p=$repo;a=commit;h=\";\n+# cgit\n+$baseurl = \"http://git.example.com/$repo/commit/?id=\";\n+\n+# The from address in generated mails.\n+$from_email = 'cia@example.com';\n+\n+# Mail all reports to this address.\n+$dest_email = 'cia@cia.vc';\n+\n+# If using XML-RPC, connect to this URI.\n+$rpc_uri = 'http://cia.vc/RPC2';\n+\n+# Path to your USCD sendmail compatible binary (your mailer daemon created this\n+# program somewhere).\n+$sendmail = '/usr/sbin/sendmail';\n+\n+# If set, the script will send CIA the full commit message. If unset, only the\n+# first line of the commit message will be sent.\n+$noisy = 1;\n+\n+# This script can communicate with CIA either by mail or by an XML-RPC\n+# interface. The XML-RPC interface is faster and more efficient, however you\n+# need to have RPC::XML perl module installed, and some large CVS hosting sites\n+# (like Savannah or Sourceforge) might not allow outgoing HTTP connections\n+# while they allow outgoing mail. Also, this script will hang and eventually\n+# not deliver the event at all if CIA server happens to be down, which is\n+# unfortunately not an uncommon condition.\n+$xml_rpc = 1;\n+\n+# This variable should contain a regexp, against which each file will be\n+# checked, and if the regexp is matched, the file is ignored. This can be\n+# useful if you do not want auto-updated files, such as e.g. ChangeLog, to\n+# appear via CIA.\n+#\n+# The following example will make the script ignore all changes in two specific\n+# files in two different modules, and everything concerning module 'admin':\n+#\n+# $ignore_regexp = \"^(gentoo/Manifest|elinks/src/bfu/inphist.c|admin/)\";\n+$ignore_regexp = \"\";\n+\n+# It can be useful to also grab the generated XML message by some other\n+# programs and e.g. autogenerate some content based on it. Here you can specify\n+# a file to which it will be appended.\n+$alt_local_message_target = \"\";\n+\n+\n+\n+\n+### The code itself\n+\n+use vars qw ($commit $tree @parent $author $committer);\n+use vars qw ($user $branch $rev @files $logmsg $message $shorturl);\n+my $line;\n+\n+if ($project eq \"\") {\n+\tcroak \"Project variable is required. Please set one with git config --add cia.project\";\n+}\n+\n+if ($repo eq \"\") {\n+\tundef $baseurl;\n+}\n+\n+# Let's be extra-safe here\n+if ($module eq \"\") {\n+\tundef $module;\n+}\n+\n+\n+### Input data loading\n+\n+\n+# The commit stuff\n+$commit = $ARGV[0];\n+$branch = $ARGV[1];\n+\n+open COMMIT, \"git cat-file commit $commit|\" or die \"git cat-file commit $commit: $!\";\n+my $state = 0;\n+$logmsg = '';\n+while (defined ($line = <COMMIT>)) {\n+  if ($state == 1) {\n+    $logmsg .= $line;\n+    $noisy or $state++;\n+    next;\n+  } elsif ($state > 1) {\n+    next;\n+  }\n+\n+  chomp $line;\n+  unless ($line) {\n+    $state = 1;\n+    next;\n+  }\n+\n+  my ($key, $value) = split(/ /, $line, 2);\n+  if ($key eq 'tree') {\n+    $tree = $value;\n+  } elsif ($key eq 'parent') {\n+    push(@parent, $value);\n+  } elsif ($key eq 'author') {\n+    $author = $value;\n+  } elsif ($key eq 'committer') {\n+    $committer = $value;\n+  }\n+}\n+close COMMIT;\n+\n+\n+open DIFF, \"git diff-tree -r $parent[0] $tree|\" or die \"git diff-tree $parent[0] $tree: $!\";\n+while (defined ($line = <DIFF>)) {\n+  chomp $line;\n+  my @f;\n+  (undef, @f) = split(/\\t/, $line, 2);\n+  push (@files, @f);\n+}\n+close DIFF;\n+\n+\n+# Figure out who is doing the update.\n+# XXX: Too trivial this way?\n+($user) = $author =~ /<(.*?)@/;\n+\n+\n+$rev = substr($commit, 0, 12);\n+\n+\n+\n+\n+### Remove to-be-ignored files\n+\n+@files = grep { $_ !~ m/$ignore_regexp/; } @files\n+  if ($ignore_regexp);\n+exit unless @files;\n+\n+\n+\n+### Compose the mail message\n+\n+\n+my ($VERSION) = '2.0';\n+my $ts = time;\n+\n+$message = <<EM\n+<message>\n+   <generator>\n+       <name>CIA Perl client for Git</name>\n+       <version>$VERSION</version>\n+   </generator>\n+   <source>\n+       <project>$project</project>\n+\n+EM\n+;\n+$message .= \"       <module>$module</module>\" if ($module);\n+$message .= \"       <branch>$branch</branch>\" if ($branch);\n+$message .= <<EM\n+   </source>\n+   <timestamp>\n+       $ts\n+   </timestamp>\n+   <body>\n+       <commit>\n+           <author>$user</author>\n+           <revision>$rev</revision>\n+           <files>\n+EM\n+;\n+\n+foreach (@files) {\n+  s/&/&amp;/g;\n+  s/</&lt;/g;\n+  s/>/&gt;/g;\n+  $message .= \"  <file>$_</file>\\n\";\n+}\n+\n+$logmsg =~ s/&/&amp;/g;\n+$logmsg =~ s/</&lt;/g;\n+$logmsg =~ s/>/&gt;/g;\n+\n+if (defined $baseurl) {\n+\t$shorturl = $baseurl . $rev;\n+\t$logmsg = $logmsg . $shorturl;\n+}\n+\n+$message .= <<EM\n+           </files>\n+\t<log>$logmsg</log>\n+       </commit>\n+   </body>\n+</message>\n+EM\n+;\n+\n+\n+\n+### Write the message to an alt-target\n+\n+if ($alt_local_message_target and open (ALT, \">>$alt_local_message_target\")) {\n+  print ALT $message;\n+  close ALT;\n+}\n+\n+\n+\n+### Send out the XML-RPC message\n+\n+\n+if ($xml_rpc) {\n+  # We gotta be careful from now on. We silence all the warnings because\n+  # RPC::XML code is crappy and works with undefs etc.\n+  $^W = 0;\n+  $RPC::XML::ERROR if (0); # silence perl's compile-time warning\n+\n+  require RPC::XML;\n+  require RPC::XML::Client;\n+\n+  my $rpc_client = new RPC::XML::Client $rpc_uri;\n+  my $rpc_request = RPC::XML::request->new('hub.deliver', $message);\n+  my $rpc_response = $rpc_client->send_request($rpc_request);\n+\n+  unless (ref $rpc_response) {\n+    carp \"XML-RPC Error: $RPC::XML::ERROR. No CIA notification will be displayed for what was pushed.\\n\";\n+  }\n+  exit;\n+}\n+\n+\n+\n+### Send out the mail\n+\n+\n+# Open our mail program\n+\n+open (MAIL, \"| $sendmail -t -oi -oem\") or die \"Cannot execute $sendmail : \" . ($?>>8);\n+\n+\n+# The mail header\n+\n+print MAIL <<EOM;\n+From: $from_email\n+To: $dest_email\n+Content-type: text/xml\n+Subject: DeliverXML\n+\n+EOM\n+\n+print MAIL $message;\n+\n+\n+# Close the mail\n+\n+close MAIL;\n+die \"$0: sendmail exit status \" . ($? >> 8) . \"\\n\" unless ($? == 0);\n+\n+# vi: set sw=2:\n-- \n1.7.5.1\n\n"},{"id":"169885","messageId":"4BBBDDED-A41F-469B-9F0C-617A3855B41F@gmail.com","threadId":"27605","inReplyTo":"BANLkTin+U2x-Lk_qKrGD4hbxnRWySgHFLA@mail.gmail.com","subject":"Re: [PATCH] ciabot: Add a revamped Perl version.","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-06-12T01:30:17Z","receivedAt":"2011-06-12T01:30:17Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Jun 11, 2011, at 3:35 PM, JD Horelick <jdhore1@gmail.com> wrote:\n\n> Attached (and pasted below, but I believe Gmail messes up the\n> whitespace) is a patch for a new ciabot script that is the revamped\n> version of the old Perl script.\n\nYou can use \"git send-email\" with gmail to avoid these issues.  See the manpage for the details; it includes a gmail example.\n\n> [snip]\n> +#\n> +# The master location of this file is in the Cogito repository\n> +# (see http://www.kernel.org/git/).\n> +#\n\ns/Cogito/git/\n\nCheers,\nDavid"}]}