ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-Knuddels/eg/decode_streams
Revision: 1.2
Committed: Tue Jan 11 21:29:53 2005 UTC (21 years, 8 months ago) by root
Branch: MAIN
Changes since 1.1: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/usr/bin/perl
2    
3     @ARGV == 2 or die "Usage: $0 client-stream-file server-stream-file\n";
4    
5     use Dumpvalue;
6     use Net::Knuddels;
7    
8     sub slurp($) {
9     local $/;
10     open my $fh, "<", $_[0]
11     or die "$_[0]: $!";
12     <$fh>
13     }
14    
15     sub decode {
16     my $r = new Net::Knuddels::Receiver;
17    
18     $r->register (ALL => sub {
19 root 1.2 print "---\n";
20 root 1.1 Dumpvalue->new (compactDump => 1, veryCompact => 1)->dumpValue ([@_]);
21     });
22    
23     $r->feed_data ($_[0]);
24     }
25    
26     print "\n\nCLIENT\n";
27     decode substr +(slurp $ARGV[0]), 1;
28     print "\n\nSERVER\n";
29     decode slurp $ARGV[0];
30    
31