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;
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.
Given a Froody::Method object, require and return the module that the method will be dispatched to.
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
Serialize the current context into
$response. By default this does nothing, you can override this and add a cookie to the response object.
invoke before the actual method call.
Builds a Froody::Response::Terse object according to the method's response specification and the data returned from the method.
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.