Net-Async-SPORE

 view release on metacpan or  search on metacpan

lib/Net/Async/SPORE/Loader.pm  view on Meta::CPAN

This is the API loader class. It'll read in definitions and create classes in memory.

=cut

use Net::Async::SPORE::Request;
use Net::Async::SPORE::Definition;

use JSON::MaybeXS;
use File::Spec;

sub inject_method(&@);

=head1 METHODS

=cut

=head2 new_from_file

Instantiate a new API object from the given file.

 my $api = Net::Async::SPORE::Loader->new_from_file(

lib/Net/Async/SPORE/Loader.pm  view on Meta::CPAN


Helper function for adding a method to the given
class.

 inject_method($target_class, $method_name, $code);

Will raise an exception if the method is already there.

=cut

sub inject_method(&@) {
	my ($code, $class, $method) = @_;
	no strict 'refs';
	die "Method overlap for $method" if $class->can($method);
	*{join '::', $class, $method} = $code;
}

{
my $next_id = 'AA001';

=head2 _next_api_class



( run in 0.925 second using v1.01-cache-2.11-cpan-49f99fa48dc )