Catalyst::Plugin::XMLRPC::DispatchType::XMLRPC - XMLRPC DispatchType


Catalyst-Plugin-XMLRPC documentation Contained in the Catalyst-Plugin-XMLRPC distribution.

Index


Code Index:

NAME

Top

Catalyst::Plugin::XMLRPC::DispatchType::XMLRPC - XMLRPC DispatchType

SYNOPSIS

Top

See Catalyst::Plugin::XMLRPC.

DESCRIPTION

Top

METHODS

Top

$self->list($c)

Debug output for XMLRPC dispatch points

$self->match($c)

Do nothing

$self->register( $c, $action )

Call register_path for every path attribute in the given $action.

AUTHOR

Top

Sebastian Riedel, sri@cpan.org

COPYRIGHT

Top


Catalyst-Plugin-XMLRPC documentation Contained in the Catalyst-Plugin-XMLRPC distribution.
package Catalyst::Plugin::XMLRPC::DispatchType::XMLRPC;

use strict;
use base qw/Catalyst::DispatchType/;
use Text::SimpleTable;

sub list {
    my ( $self, $c ) = @_;
    my $methods = Text::SimpleTable->new( [ 35, 'Method' ], [ 36, 'Private' ] );
    for my $method ( sort keys %{ $self->{methods} } ) {
        my $action = $self->{methods}->{$method};
        $methods->row( "$method", "/$action" );
    }
    $c->log->debug( "Loaded XMLRPC Methods:\n" . $methods->draw )
      if ( keys %{ $self->{methods} } );
}

sub match { return 0 }

sub register {
    my ( $self, $c, $action ) = @_;

    my @register = @{ $action->attributes->{XMLRPC} || [] };

    for my $method (@register) {
        $method ||= "$action";
        $method =~ s#/#.#g;
        $self->{methods}{$method} = $action;
    }

    return 1 if @register;
    return 0;
}

1;