line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flash::FLAP::Util::RemotingService; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Flash::FLAP::Util::RemotingService |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 DESCRIPTION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Wrapper for user-registered classes. This wrapper can respond |
11
|
|
|
|
|
|
|
to the DecribeService service calls, going through the user |
12
|
|
|
|
|
|
|
class and collecting its method descriptions. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 CHANGES |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 Sun Jul 20 19:35:40 EDT 2003 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=item Substituted "use vars qw($AUTOLOAD)" for "our $AUTOLOAD" to be backwards-compatible to Perl < 5.6 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 Sun Apr 6 14:24:00 2003 |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=item Created after AMF-PHP, though their dynamic inheritance is changed to wrapping. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
200
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
0
|
0
|
|
my ($proto, $name, $object) = @_; |
31
|
0
|
|
|
|
|
|
my $self = {}; |
32
|
0
|
|
|
|
|
|
bless $self, $proto; |
33
|
0
|
|
|
|
|
|
$self->serviceName($name); |
34
|
0
|
|
|
|
|
|
$self->content($object); |
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub content |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
41
|
0
|
0
|
|
|
|
|
if (@_) {$self->{content} = shift;} |
|
0
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $self->{content}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub serviceName |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
48
|
0
|
0
|
|
|
|
|
if (@_) {$self->{serviceName} = shift;} |
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $self->{serviceName}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub methodTable |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
55
|
0
|
|
|
|
|
|
my $methodTable = $self->content->methodTable(); |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $newEntry = { |
58
|
|
|
|
|
|
|
"access" => "remote", |
59
|
|
|
|
|
|
|
"description" => "This is the main method that returns the descriptors for the service class." |
60
|
|
|
|
|
|
|
}; |
61
|
0
|
|
|
|
|
|
$methodTable->{"__describeService"} = $newEntry; |
62
|
0
|
|
|
|
|
|
return $methodTable; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
|
5
|
use vars qw($AUTOLOAD); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
319
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub AUTOLOAD |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
|
|
my ($self, @args) = @_; |
70
|
|
|
|
|
|
|
#our $AUTOLOAD; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#Strip the class path and only leave the method name; |
73
|
0
|
|
|
|
|
|
my @path = split /:/, $AUTOLOAD; |
74
|
0
|
|
|
|
|
|
my $method = $path[-1]; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
return if $method eq "DESTROY"; |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
if ($self->content->can($method)) |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
|
|
|
return $self->content->$method(@args); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
print STDERR "\nUnknown method $method called:\n"; |
85
|
0
|
|
|
|
|
|
die; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub __describeService |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
92
|
0
|
|
|
|
|
|
my $description = {}; |
93
|
0
|
|
|
|
|
|
$description->{"version"} = "1.0"; |
94
|
0
|
|
|
|
|
|
$description->{"address"} = $self->serviceName(); |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my @functions; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
foreach my $key (keys %{$self->methodTable}) |
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
{ |
100
|
0
|
|
|
|
|
|
my $method = $self->methodTable->{$key}; |
101
|
0
|
0
|
0
|
|
|
|
if ($method->{"access"} eq "remote" && $key ne "__describeService") |
102
|
|
|
|
|
|
|
{ |
103
|
0
|
|
|
|
|
|
push @functions, { |
104
|
|
|
|
|
|
|
"description" => $method->{"description"}, |
105
|
|
|
|
|
|
|
"name" => $key, |
106
|
|
|
|
|
|
|
"version" => "1.0", |
107
|
|
|
|
|
|
|
"returns" => "testing", |
108
|
|
|
|
|
|
|
#"arguments" => {} |
109
|
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
$description->{"functions"} = \@functions; |
114
|
0
|
|
|
|
|
|
return $description; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|