ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-Knuddels/eg/decode_streams
Revision: 1.5
Committed: Wed Jan 12 19:26:51 2005 UTC (19 years, 5 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +2 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
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::Protocol;
17
18 $r->register (ALL => sub {
19 print "---\n";
20 Dumpvalue->new (compactDump => 1, veryCompact => 1, quoteHighBit => 1, tick => '"')->dumpValue ([@_]);
21 });
22
23 $r->feed_data ($_[0]);
24 $r->destroy;
25 }
26
27 print "\n\nCLIENT\n";
28 decode substr +(slurp $ARGV[0]), 1;
29 print "\n\nSERVER\n";
30 decode slurp $ARGV[1];
31
32