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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.