On 4 Jul 2004 at 17:04, Dean Arnold wrote:
> (WinXP, AS 5.8.3, PAR 0.85, Tk 804.027)
>
> I'm trying to load some GIF images into Tk Buttons in an app I pp'd.
> I build with the -a <directory> option.
>
> Here's the line that burps:
> $window->Photo(-file => "icon.gif")
>
> I've tried several different
> paths to the image files in my app:
>
> "/TFG/icons"
> "TFG/icons"
> "TFG/icons/icon.gif"
> "TFG/icons/icon.gif"
> "/icon.gif"
> "icon.gif"
>
> here's the pp commands I've tried:
>
> pp -a TFG\icons -o myout.exe myscript.pl
> pp -a TFG/icons -o myout.exe myscript.pl
> pp -a TFG/icons/icon.gif -o myout.exe myscript.pl
> pp -a TFG\icons.icon.gif -o myout.exe myscript.pl
>
> I've run with -v 3, and it shows its adding the files from
> the directory...but the app can't find anything at runtime.
>
All of those do add the file to the PAR, but:
$window->Photo(-file => "icon.gif");
doesn't know automagically to look in the PAR. It's trying to open a normal (external
to the PAR) file. You need to get the file from the PAR with:
my $image = PAR::read_file('TFG/icon.gif'); # or whatever path you use in -a
$window->Photo(-data => $image);
> Better still heres a simple example:
>
> #usr/local/bin/perl
> open(INF, "pptest.txt") || die $!;
>
> print
> while (<INF>);
>
>
> and pptest.txt is a simple text file in the local directory, here's
> my pp command
>
> C:\Perl\pp>pp -v 3 -o ..\pptest.exe -a pptest.txt pptest.pl >pp.log
>
> C:\Perl\pp>cd ..
>
> C:\Perl>pptest
> No such file or directory at script/pptest.pl line 1.
>
> When I run, it can't find the file. So what file path should I use in
> my open() statement ?
>
Same problem. pptest.txt is inside the PAR, but that doesn't make an ordinary open()
do
something different. Use the PAR::read_file() instead.
Alan Stewart