Fotango Ltd > Froody-42.034 > examples/time/Time.pm

Download:
Froody-42.034.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

SIMPLE TIME SERVER DEMO ^

This module bundles everything that you might need in order to implement a Froody service.

THE API ^

To start with, we provide an API definition in Time::API. We have to provide an XML description of the publicly facing methods for our service. In this case, our API methods are:

  froody.demo.hostname
  froody.demo.localtime
  froody.demo.uptime

THE IMPLEMENTATION ^

We implement all the methods in the froody.demo namespace, as defined with Time::API

As per the documentation in Froody::Quickstart, you can see that for simple values, we can just return a scalar, which will be magicly placed inside the top level node of our response. More complex structures require returning a HASHREF populated with the secondary elements and attributes of the top level XML node.

^

After we've loaded the implementation, we can start the standalone server. The current implementation of the standalone server will walk @INC to discover all Froody::Implementation subclasses, and register all required implementations.

Once the server has started, you can test the functionality of the server by using the froody script to connect to the server:

  froody -u'http://localhost:4242/' froody.demo.localtime

to get the current time.

syntax highlighting: