| 1 | package Froody::API; | ||
| 2 | 15 | ▶ | use base qw(Froody::Base); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 15 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 15 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Froody::API - Base class for API definition | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | package Project::API; | ||
| 14 | use base 'Froody::API'; | ||
| 15 | |||
| 16 | # return all things that this API should register with a repository | ||
| 17 | sub load { @stuff } | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | This is the base class for classes that define Froody::Method objects, | ||
| 22 | Froody::ErrorType objects and all other objects that you register in a | ||
| 23 | repository. | ||
| 24 | |||
| 25 | You really shouldn't have to deal with this unless you're creating your | ||
| 26 | Froody::Methods by hand. In most cases you'll use the Froody::API::XML | ||
| 27 | subclass of this. | ||
| 28 | |||
| 29 | =head1 METHODS | ||
| 30 | |||
| 31 | =over | ||
| 32 | |||
| 33 | =item load() | ||
| 34 | |||
| 35 | Called by C<define>. Subclass must override this method to return a list of | ||
| 36 | objects that we should register with the API some how. Currently we expect | ||
| 37 | this list to contain Froody::Method or Froody::ErrorType subclasses, and then | ||
| 38 | everything else is ignored. | ||
| 39 | |||
| 40 | NOTE: C<load()> should return a new instance of the objects each time the method | ||
| 41 | is called rather than the same one. This is to prevent bad things happening | ||
| 42 | if you have more than one repository and they're using different implementations | ||
| 43 | etc. | ||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | 1 | ▶ | sub load { |
|
Subroutine
load: called CC=1 SCAR=0.0
Pod
documented
| |||
| 48 | 1 | Froody::Error->throw("perl.methodcall.unimplemented", "load must be implemented."); | |
| 49 | } | ||
| 50 | |||
| 51 | =back | ||
| 52 | |||
| 53 | =head1 BUGS | ||
| 54 | |||
| 55 | The current implementation of C<get_methods> and C<get_errortypes> doesn't | ||
| 56 | do anything clever, and therefore calls C<load> twice. We should refactor | ||
| 57 | so this isn't the case. | ||
| 58 | |||
| 59 | Please report any bugs you find via the CPAN RT system. | ||
| 60 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Froody> | ||
| 61 | |||
| 62 | =head1 AUTHOR | ||
| 63 | |||
| 64 | Copyright Fotango 2005. All rights reserved. | ||
| 65 | |||
| 66 | Please see the main L<Froody> documentation for details of who has worked | ||
| 67 | on this project. | ||
| 68 | |||
| 69 | This module is free software; you can redistribute it and/or modify it under | ||
| 70 | the same terms as Perl itself. | ||
| 71 | |||
| 72 | =head1 SEE ALSO | ||
| 73 | |||
| 74 | L<Froody>, L<Froody::Method> | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | 15 | 1; | |