NAME
API::McBain::Topic::ProvidedMethod - Provided method class
VERSION
version 0.1
DESCRIPTION
Every provided method in a McBain
topic (that uses API::McBain::Topic) is blessed into this class. This happens entirely internally and normally you would not have/need access to these objects; however, you could have access to these objects by simply keeping the return value of your method decleration, like so:
# in a topic
my $method = provide('somefunc')
->param('someparam' => { required => 1 })
->callback(sub { # do something });
# $method will now hold the API::McBain::Topic::ProvidedMethod object
CONSTRUCTOR
new( \%params )
Creates a new provided method object. Only called internally.
OBJECT ATTRIBUTES
All of these attributes (except params
) are read-write. If called with no arguments, the current value of the attribute is returned. If called with an argument, it is set as the new value of the attribute, and the object itself is returned for chaining.
name( [$new_name] )
The name of the method - string (no spaces, don't use the separator in method names).
description( [$new_description] )
The description of the method - free text string.
callback( [$new_callback] )
The callback of the method - an anonymouse subroutine, the actual logic of the method.
returns ( [$new_returns] )
The return type of the method - free text string.
params()
The Brannigan parameter specification for the method, declaring input parameters and their constraints.
OBJECT METHODS
param( $name, \%spec )
Adds a new input parameter specification to the object. $name
is the name of the input parameter and \%spec
is the Brannigan
specification for that parameter. Returns the object itself for chaining.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-API-McBain@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=API-McBain.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc API::McBain::Topic::ProvidedMethod
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
AUTHOR
Ido Perlmuter <ido@ido50.net>
LICENSE AND COPYRIGHT
Copyright (c) 2013, Ido Perlmuter ido@ido50.net
.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either version 5.8.1 or any later version. See perlartistic and perlgpl.
The full text of the license can be found in the LICENSE file included with this module.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.