Return-Path: Delivered-To: apmail-incubator-thrift-commits-archive@minotaur.apache.org Received: (qmail 74661 invoked from network); 29 Apr 2009 04:26:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Apr 2009 04:26:19 -0000 Received: (qmail 18586 invoked by uid 500); 29 Apr 2009 04:26:19 -0000 Delivered-To: apmail-incubator-thrift-commits-archive@incubator.apache.org Received: (qmail 18555 invoked by uid 500); 29 Apr 2009 04:26:19 -0000 Mailing-List: contact thrift-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: thrift-dev@incubator.apache.org Delivered-To: mailing list thrift-commits@incubator.apache.org Received: (qmail 18546 invoked by uid 99); 29 Apr 2009 04:26:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 04:26:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 04:26:09 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id AD7D91149F for ; Wed, 29 Apr 2009 04:25:47 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: thrift-commits@incubator.apache.org Date: Wed, 29 Apr 2009 04:25:47 -0000 Message-ID: <20090429042547.29998.33390@eos.apache.org> Subject: [Thrift Wiki] Update of "ThriftUsagePerl" by JonSchutz X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Thrift Wiki" for change notification. The following page has been changed by JonSchutz: http://wiki.apache.org/thrift/ThriftUsagePerl New page: An example using Thrift and Scribe (see [http://notes.jschutz.net/109/perl/perl-client-for-facebooks-scribe-logging-software here for more details about building the perl scribe client]). The example program reads one line at a time from stdin and sends to a scribe instance running locally on port 1465. {{{ #! /usr/bin/perl use Scribe::Thrift::scribe; use Thrift::Socket; use Thrift::FramedTransport; use Thrift::BinaryProtocol; use strict; use warnings; my $host = 'localhost'; my $port = 1465; my $cat = $ARGV[0] || 'test'; my $socket = Thrift::Socket->new($host, $port); my $transport = Thrift::FramedTransport->new($socket); my $proto = Thrift::BinaryProtocol->new($transport); my $client = Scribe::Thrift::scribeClient->new($proto, $proto); my $le = Scribe::Thrift::LogEntry->new({ category => $cat }); $transport->open(); while (my $line = <>) { $le->message($line); my $result = $client->Log([ $le ]); if ($result == Scribe::Thrift::ResultCode::TRY_LATER) { print STDERR "TRY_LATER\n"; } elsif ($result != Scribe::Thrift::ResultCode::OK) { print STDERR "Unknown result code: $result\n"; } } $transport->close(); }}}