![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Files, unpack and text valuesby BBQ (Curate) |
on Jun 25, 2000 at 04:01 UTC ( #19735=perlquestion: print w/replies, xml ) | Need Help?? |
BBQ has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to build a "self sufficient" perl script that will run from generic webservers. The idea is to make installation as easy as humanly possible by placing the file in the cgi directory and chmoding it, period. Since the script uses a few images, I decided to "embed" them into the script itself, and this is where I'm having problems... I have never dealt directly with binary data, so I am not absolutely sure that I know what I'm doing most of the time, please bear that in mind. After doing some reading, it seemed to me that the easiest way to embed these images into the script itself would be to produce text versions of them by using unpack, assigning the text to variables and then printing them back with pack, when requested by a query string (ie: foo.pl?img=bar). If anyone has a better idea, please feel free to speak up. The "trouble" I'm having is when I unpack the image file. According to perlfunc, unpack should return an list, and all I'm getting is a variable. So this is (a snippet) what I've been up to: The examples from perlfunc didn't help much. Anyone have any ideas of what I'm doing wrong? Or maybe, I'm not doing anything wrong per say, but the result isn't quite what I had expected. I was expecting a list of paired hex values, and I got a few BIG hexed strings instead. Thank you again my perl brethren.
Back to
Seekers of Perl Wisdom
|
|