AMF-Perl
view release on metacpan or search on metacpan
lib/AMF/Perl/Util/RemotingService.pm view on Meta::CPAN
my $self = shift;
if (@_) {$self->{serviceName} = shift;}
return $self->{serviceName};
}
sub methodTable
{
my ($self) = @_;
my $methodTable = $self->content->methodTable();
my $newEntry = {
"access" => "remote",
"description" => "This is the main method that returns the descriptors for the service class."
};
$methodTable->{"__describeService"} = $newEntry;
return $methodTable;
}
use vars qw($AUTOLOAD);
sub AUTOLOAD
{
my ($self, @args) = @_;
#our $AUTOLOAD;
#Strip the class path and only leave the method name;
my @path = split /:/, $AUTOLOAD;
my $method = $path[-1];
return if $method eq "DESTROY";
if ($self->content->can($method))
{
return $self->content->$method(@args);
}
else
{
print STDERR "\nUnknown method $method called:\n";
die;
}
}
sub __describeService
{
my ($self) = @_;
my $description = {};
$description->{"version"} = "1.0";
$description->{"address"} = $self->serviceName();
my @functions;
foreach my $key (keys %{$self->methodTable})
{
my $method = $self->methodTable->{$key};
if ($method->{"access"} eq "remote" && $key ne "__describeService")
{
push @functions, {
"description" => $method->{"description"},
"name" => $key,
"version" => "1.0",
"returns" => "testing",
#"arguments" => {}
};
}
}
$description->{"functions"} = \@functions;
return $description;
}
1;
( run in 0.796 second using v1.01-cache-2.11-cpan-39bf76dae61 )