[Jifty-commit] r670 - in jifty/trunk: bin share/web/templates/__jifty/webservices

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Mar 7 01:36:51 EST 2006


Author: alexmv
Date: Tue Mar  7 01:36:51 2006
New Revision: 670

Added:
   jifty/trunk/bin/service   (contents, props changed)
   jifty/trunk/share/web/templates/__jifty/webservices/
   jifty/trunk/share/web/templates/__jifty/webservices/xml
   jifty/trunk/share/web/templates/__jifty/webservices/yaml
Modified:
   jifty/trunk/   (props changed)

Log:
 r8428 at zoq-fot-pik:  chmrr | 2006-03-06 22:36:40 -0800
  * Trivial webservices hack


Added: jifty/trunk/bin/service
==============================================================================
--- (empty file)
+++ jifty/trunk/bin/service	Tue Mar  7 01:36:51 2006
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use LWP::UserAgent;
+use Getopt::Long;
+
+my($class, $host, $path, $format, $moniker);
+GetOptions("class=s" => \$class,
+           "host=s" => \$host,
+           "path=s" => \$path,
+           "format=s" => \$format,
+           "moniker=s" => \$moniker);
+$format  ||= "yaml";
+$host    ||= "http://localhost:8888";
+$path    ||= "/__jifty/webservices/$format";
+$moniker ||= "moniker";
+
+my %args = @ARGV;
+
+my $ua = LWP::UserAgent->new;
+my $res = $ua->post("$host$path", {
+                           "J:A-$moniker" => $class,
+                           map {("J:A:F-$_-$moniker" => $args{$_})} keys %args
+                          });
+
+if ($res->is_success) {
+    print $res->content;
+} else {
+    die $res->status_line;
+}
+

Added: jifty/trunk/share/web/templates/__jifty/webservices/xml
==============================================================================
--- (empty file)
+++ jifty/trunk/share/web/templates/__jifty/webservices/xml	Tue Mar  7 01:36:51 2006
@@ -0,0 +1,3 @@
+% $r->content_type("text/xml");
+% use XML::Simple;
+<% XML::Simple::XMLout({Jifty->web->response->results}, NoAttr => 1cd .) |n%>

Added: jifty/trunk/share/web/templates/__jifty/webservices/yaml
==============================================================================
--- (empty file)
+++ jifty/trunk/share/web/templates/__jifty/webservices/yaml	Tue Mar  7 01:36:51 2006
@@ -0,0 +1,2 @@
+% $r->content_type("text/x-yaml");
+<% YAML::Dump({Jifty->web->response->results}) |n%>


More information about the Jifty-commit mailing list