in reply to using an image in binary perl TK

I'm not entirely sure I understand the question, but...

Perhaps you could wrap the above block in an if clause that tested for the existence of that file?

if ( -e "./tsl_logo1.gif" ) { ... }

Replies are listed 'Best First'.
Re: Re: using an image in binary perl
by michaelg (Beadle) on Nov 16, 2003 at 15:33 UTC
    NOP,
    I Need to load it anyway , it must become part of my code.
    I mean that when I'll activate the binary It
    won't have to search for any file , all the data it needs
    should be compiled inside it.
    very simillar to .pm files

    THANKS FOR YOUR TIME
    michaelg
      You could use Perl's built in UU-encoding, built into pack/unpack, using the "u*" template, to convert any binary string to a text string of limited line length.

      You can use the following code to load the file and generate the Perl code to set the image string, which you can then include in your script:

      { open IN, "tsl_logo1.gif"; binmode IN; local $/; print "\$image = unpack 'u*', <<'_END_';\n"; print pack "u*", <IN>; print "_END_\n"; }

      Of course, that requires that you can just set an image in a UI from a binary string, instead of loading it from a file. I don't know what module you're using for the UI, so you'll have to check that yourself.

      The proper way of packing along extra files differs depending on how you're creating the binary.

      Please tell us what tools you are using to produce the executable -- perl2exe? PAR?