Template::Plugin::WebService - plugin to allow webservice calls from Template and Template::Alloy
[% USE web_service = WebService %] [% form = { 'outserial' => 'xml' } %] [% stuff = web_service.webservice_call(url, form) %] # url is the url to hit [% stuff = web_service.webservice_call('/path/to/api', form) %] # form is a hash ref that gets appended to the url # url can be relative, where the domain defaults to $self->default_host (127.0.0.1) [% stuff = web_service.webservice_call('http://domain.com/path/to/api', form) %]
Template::Plugin::WebService helps handle HTTP from a template.
- handles web requests from your template - passes along a passed in form - passes along any cookies - specify serialization via form or just in the url's query_string - handles many serializations (JSON, Storable, XML::Simple, YAML) - defaults to JSON
content_cleanup - gets sent a Template::Plugin::WebService object and a reference to the response content
default_host - gets prepended to your url if your url doesn't start with http://. Defaults to 127.0.0.1
outserial_key - server sends out a key which defines serialization. Defaults to outserial.
Copyright 2008, Earl J. Cahill. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Address bug reports and comments to: cahille@yahoo.com
When sending bug reports, please provide the version of Template::Plugin::WebService, the version of Perl, and the name and version of the operating system you are using.
Earl Cahill, cahille@yahoo.com
Copyright (C) 2008 by Earl Cahill
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install Template::Plugin::WebService, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::WebService
CPAN shell
perl -MCPAN -e shell install Template::Plugin::WebService
For more information on module installation, please visit the detailed CPAN module installation guide.