Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Re: Frontier::RPC and Digest::MD5

by v_thunder (Scribe)
on Aug 29, 2003 at 20:36 UTC ( #287828=note: print w/replies, xml ) Need Help??

in reply to Re: Frontier::RPC and Digest::MD5
in thread Frontier::RPC and Digest::MD5

Ok, I wrote some simple code to show this, and managed to narrow the problem down a little. Here is the code:

This is the server:

#!/usr/bin/perl -w use strict; use Frontier::Daemon; use Digest::MD5 qw/md5_hex/; Frontier::Daemon->new (LocalPort => 12345, methods =>{md5=>sub {return md5_hex (shift)}}); __END__

And the client:

#!/usr/bin/perl -w use strict; use Frontier::Client; my $rpc = Frontier::Client->new (url =>"http://localhost:12345/RPC2"); print $rpc->call ("md5", "1234"), $/; __END__

For reference:

md5 of "1234": 81dc9bdb52d04dc20036dbd8313ed055
md5 of "": d41d8cd98f00b204e9800998ecf8427e

Now, here's what I found. If I run the server on my desktop (perl 5.8.0), I get the expected result (81dc..). If I run the server on an older system (perl 5.6.1), I get the erroneous one (d41d..), along with the error on the console:

Use of uninitialized value in subroutine entry at ./srv line 8.

I have also found that even in the older system, the following code works:

sub my_md5_hex { my ($str) = @_; my $cmd = "perl -MDigest::MD5 -e " . "'print Digest::MD5::md5_hex (\"$str\"), \$/'"; my $md5 = `$cmd`; chomp ($md5); return $md5; }

It's pretty gross, though.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://287828]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-03-19 07:12 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (234 votes). Check out past polls.