in reply to Re: goto and AUTOLOADed methods
in thread goto and AUTOLOADed methods
Another use I had was an object proxy. Basically you connect to an object server, get an ID from that server, it gets wrapped in an object on the client side which looks like
the HomeServer object sends the method, the id and the args back to another server which calls the method on the correct object, passing in the args and then passes the result back across the network.package ProxyObject; sub AUTOLOAD { my $self = shift; $method = $AUTOLOAD; $method =~ s/.*:://; return $self->{HomeServer}->call_method($method, $self->{ID}, \@_); }
In use it looked like
my $server = Server->connect( host => auth.domain.com user => $user, pass => $pass ); my $root = $server->getRoot; # this is a proxied object my $users = $root->getUsers; # another proxied object my $fergal = $users->getUser("fergal"); $fergal->setPasswd("wibble"); $fergal->setShell("/bin/zoidberg"); $fergal->commit;
Your Perl code neither knows nor cares that some of the objects it's playing with doesn't actually exist on this machine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re3: goto and AUTOLOADed methods
by dragonchild (Archbishop) on Aug 01, 2003 at 17:21 UTC | |
by fergal (Chaplain) on Aug 04, 2003 at 11:10 UTC |