| Froody::Invoker::Implementation |
Froody::Implementation - define what should be run for a Froody::Method
# run the code from the froody method my $implementation_obj = $froody_method->implementation(); my $response = $implementation_obj->invoke($froody_method, \%params); $response->render; =head1 DESCRIPTION
You probably don't care about this class unless you want to change the way that your Perl code is called for a given method (e.g. you want to dynamically create methods or do something clever with sessions.)
Froody::Implementation and its subclasses are responsible for implementing the Perl code that is run when a Froody::Method is called. Essentially a Froody::Method only really knows what it's called and that the instance of another class - its implementation - knows how to run the code.
In reality, all a Froody::Implementation really has to do is implement an
invoke method, that when passed a Froody::Method and a hashref containing
named parameters can 'execute' that method and return a Froody::Response:
my $response = $implementation_obj->invoke($froody_method, $hash_params);
This module provides a default implementation that calculates a Perl method name by transforming the Froody::Method name. Before it runs that method it pokes around with the arguments passed in based on the Froody::Method's arguments. When that Perl method returns, it transforms the hashref that code returned into a proper Froody::Response based on the response defined for the Froody::Method that is being processed. Essentially, it wraps the Perl code that you have to write in such a way you don't even have to think about what's going on from Froody's point of view.
A get/set accessor that gets/sets what repository this invoker is associated with. This is a weak reference.
returns the function to be called to invoke a method. Simply returns the result of 'can' in the default implementation.
module($method)
Given a the Froody::Method manpage object, require and return the module that the method will be dispatched to.
create_context($params)
Returns the context of the current invocation. By default this return the
class, so it's not instantiating. Override this to provide session
management in store_context.
store_context($response)
Serialize the current context into $response. By default this does
nothing, you can override this and add a cookie to the response object.
Called by invoke before the actual method call.
Builds a the Froody::Response::Terse manpage object according to the method's response specification and the data returned from the method.
the Froody::Repository manpage, the Froody::API manpage and for other implementations the Froody::Implementation::OneClass manpage and the Froody::Implementation::Remote manpage
Copyright Fotango 2005. All rights reserved.
Please see the main Froody documentation for details of who has worked on this project.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Froody::Invoker::Implementation |