monsieur_champs has asked for the wisdom of the Perl Monks concerning the following question:
Fellows
I was playing with pack() together with Compress::Zlib some time ago, so I could gen some compressed eval()-uable perl code for a programming toy.
While I think about the problem, I figured out that I need to represent the databytes generated from Compress::Zlib as a hexadecimal sequence of digits. I figured how to do this, but can't get the results back. Reading the manual, I wasn't able to determine what I'm doing The Wrong Way(tm). Below follows my code:
use Compress::Zlib; $code = q#print "Here I will put some nice code to be uncompressed and + eval()ed latter";#; $code = unpack 'H*', Compress::Zlib::memGzip( $code ); print pack 'H*', Compress::Zlib::memGunzip( $code ); # Here I get something very strange...
I'm almost sure that I'm doing something very stupid, but I can't see this now. Can anybody please point me a easy way to code this?
As a side-question, I would like to know your opinion about this: is this technique a good way to reduce the communications bandwidth needed to send Large Programs(tm) trought a highly used, low bandwidth serial communications channel between two machines? What you would do in my place?
Please note that this is just a sketch of an initial approach, not a complete solution for the problem.
UPDATE: No, this is not homework! It's just a toy for my low cost service serial point-to-point home-made network laboratory.
"In few words, translating PerlMonks documentation and best articles to other languages is like building a bridge to join other Perl communities into PerlMonks family. This makes the family bigger, the knowledge greather, the parties better and the life easier." -- monsieur_champs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reversible pack()?
by belg4mit (Prior) on Feb 10, 2004 at 21:25 UTC | |
|
Re: reversible pack()?
by tachyon (Chancellor) on Feb 10, 2004 at 22:01 UTC | |
by jonadab (Parson) on Feb 10, 2004 at 22:31 UTC | |
by monsieur_champs (Curate) on Feb 11, 2004 at 12:39 UTC | |
by tachyon (Chancellor) on Feb 11, 2004 at 13:49 UTC | |
|
Re: reversible pack()?
by bmann (Priest) on Feb 10, 2004 at 21:58 UTC | |
|
Re: reversible pack()?
by elwarren (Priest) on Feb 11, 2004 at 07:02 UTC |