http://www.perlmonks.org?node_id=1213254


in reply to Re^4: pp macOS external file
in thread pp macOS external file

"So, the path for this icon should already be correct (and from the Terminal it works okay"

Not when you run it. What follows is a sort of high level explanation of how this works. An executable generated by pp is essentially a self extracting/executing zip file. You can use the normal unzip command to extract it. The first time it executes it gets extracted to a temporary area. For your problem I had:

marto@Shemp:~/perlmonks/pp$ ls myicon.png tk.pl

When packed (as above) and executed this gets extracted to a temporary area, in this case: /tmp/par-6d6172746f/cache-b3da3d80145db3849552916091b87f92bea49883

In the work around above this is accessible via $ENV{PAR_TEMP}. Within this directory you'll find the various bits & bobs, modules, libraries and so on that are required to run your code without needing perl (and all of those other things) installed.

Within this is a directory inc:

drwxr-xr-x 4 marto marto 4096 Apr 20 13:02 . drwx------ 3 marto marto 4096 Apr 20 13:02 .. drwxr-xr-x 16 marto marto 4096 Apr 20 13:02 lib -rw-r--r-- 1 marto marto 7189 Apr 20 13:02 MANIFEST -rw-r--r-- 1 marto marto 212 Apr 20 13:02 META.yml -rw-rw-r-- 1 marto marto 13052 Apr 20 13:02 myicon.png drwxr-xr-x 2 marto marto 4096 Apr 20 13:02 script

here we see myicon.png. the actual script is in the sub directory 'script'. Another method I've seen people use is to embed the images within their code, and use the Tk::Photo -data option (rather than -file).