in reply to RPC::XML error

I couldn't get RPC::XML::Client to work right, so I used Frontier::Daemon instead:
#!/usr/bin/perl use strict; use warnings; use Frontier::Daemon; my $d = Frontier::Daemon->new( methods => { sum => \&sum }, LocalAddr => '127.0.0.1', LocalPort => 1080, ); sub sum { my @args = (9, 9); print "The numbers to be added are: @args\n"; return $args[0] + $args[1], "\n"; }

Update: I used WebService::Advogato by jaldhar to make a simple sum, product, and square client:

#!/usr/bin/perl #sum, product, square use strict; use warnings; use Data::Dumper::Concise; use WebService::Advogato; my $client = new WebService::Advogato(); my $int_x = '91'; my $int_y = '23'; warn Dumper($client->sumprod($int_x, $int_y)); warn Dumper($client->square($int_x));

Replies are listed 'Best First'.
Re^2: RPC::XML error
by ikegami (Patriarch) on Mar 25, 2010 at 07:02 UTC

    Why would a deamon (server) be a replacement for a client?

    Is the last line garbage (never executed), or is that code the same as

    #!/usr/bin/perl use strict; use warnings; sub sum { my @args = (9, 9); print "The numbers to be added are: @args\n"; return $args[0] + $args[1], "\n"; } print "The sum is: ", sum(), "\n";
      ikegami, The last line do gets executed since you are calling the sub routine only there.

        I thought you wanted to use RPC? If that's the only place where the sub is called, then you're not using RPC.

        I thought you wanted to use RPC? If that's the only place where the sub is called, then you're not using RPC.

Re^2: RPC::XML error
by Aishu (Initiate) on Mar 25, 2010 at 06:54 UTC
    hi Khen1950fx, Thanks for your reply. It worked fine....!!!! great job.. ~Aishu