Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This might not be the place to ask this but here goes anyway:

I have the following code snippet:

my $gif = $image_label->Label( -image => $message->Photo(-file => Tk->findINC('Xcamel.gif') +), -borderwidth => 2, -relief => 'sunken', )->pack(-side => 'top');
The image is diplayed fine in the raw perl script but when I turn it into an executable the image is dropped

Has anyone evr run into this before, or know of a solution?
Thanks

Replies are listed 'Best First'.
Re: capturing graphics with perl2exe
by bart (Canon) on Oct 01, 2003 at 21:06 UTC
    I know nothing of Tk but you seem to have gotten much advice so far, so I'll make an attempt...

    The name findINC is intriguing to me. I'm guessing that this locates a file, in this case an image file, in @INC. I can't find much info in the official docs, except for a mention in the Tk FAQ.

    Now, if that is so, that probably means one of two things, maybe both:

    1. Your @INC doesn't contain the path to your local files, where your bitmap file is. You can edit @INC at runtime.
    2. If you want to provide the picture embedded inside the executable, you probably will have to include it in the executable yourself. Now, I don't know about perl2exe — I do have my doubts about it; but PAR now has a provision to support it — see change #7354. In many ways, PAR is conceptually comparable to perl2exe.
    Good luck.
Re: capturing graphics with perl2exe
by jplindstrom (Monsignor) on Oct 01, 2003 at 18:22 UTC
    Very, very long shot, but could it be that the current working directory isn't what you think it is when running as a binary?

    use Cwd; print cwd();

    /J