Well, thanks to Mike Campbell, I've figured it out. Rather, he figured
it out, and his solution worked for me, too...
The solution is to use Archive::Zip to open up the PAR'd executable
(basically, itself), and extract the stored bitmap.
So, I PAR like this:
pp --add logo.bmp -o myApp.exe myApp.pl
Then, I extract the bitmap like this:
## Begin Code
use Archive::Zip qw( :ERROR_CODES );
my $zipFile = "myApp.exe";
my $zip = Archive::Zip->new();
die("Cannot read from zip file: $zipFile") unless $zip->read($zipFile)
== AZ_OK;
my $bitmap="$ENV{\"PAR_TEMP\"}/logo.bmp";
printf($bitmap);
die("Extracting logo from $zipFile failed\n") unless
$zip->extractMember('logo.bmp', $bitmap) == AZ_OK;
## End code
Note that, this extracts the bitmap to the same temp directory that PAR
uses for the executable... PAR_TEMP. Very handy.
So, then, in my wxPerl code, I simply refer to $bitmap to grab my image:
Wx::Bitmap->new($bitmap, wxBITMAP_TYPE_ANY)
Thanks again, Mike!
Perhaps this should go into the FAQ?
Clay.
> -----Original Message-----
> From: Clay Harmony
> Sent: Friday, January 30, 2004 11:37 AM
> To: [EMAIL PROTECTED]
> Subject: Retrieving an image from within a PAR
>
>
>
> I'm creating a self-contained PAR executable, and the program
> displays a logo, loaded from a bitmap.
>
> The program uses wxPerl, and I load the image like this:
> Wx::Bitmap->new("logo-big.bmp", wxBITMAP_TYPE_ANY)
>
> That, of course, grabs the bitmap from the directory where
> the program was run.
>
> What I'd like to be able to do is embed that bmp within the
> par executable itself. In that case, how would I make the
> call to load it?
>
> Thanks,
> Clay.
>