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


in reply to pp macOS external file

I'm not a Tk guy at all, and I'm not mad on this work around, but you can detect if something is running via PAR/pp, and append the dynamic path it extracts includes to, here's a short example:

use strict; use warnings; my $pardir; if (exists $ENV{PAR_PROGNAME}){ # running via PAR/pp $pardir = $ENV{PAR_TEMP}; } use Tk; use Tk::PNG; my $png = 'myicon.png'; if ( $pardir ){ $png = $pardir . '/inc/' . $png; } my $mw = Tk::MainWindow->new(); my $icon = $mw->Photo(-file=> $png); my $btn = $mw->Button( -image => $icon, ); $btn->pack(); $mw->MainLoop();

Packaged with:

pp -x -a "myicon.png" -o test tk.pl

This works for me, perl v5.22, up to date pp. There's probably a better way to do this.