Here's the script minus all the additional 'pp' requirements:
-------------------------------------------------
#!perl -w
use Tk;
use Tk::LabEntry;
use Tk::Widget;
use Tk::Frame;
$mw = MainWindow->new;
$scrollbar = $mw->Scrolled('Listbox');
$scrollbar->insert(0, qw(hi bye));
$scrollbar->pack();
MainLoop;
-----------------------------------------------------------
At least one problem arises from the eval{} block in sub AUTOLOAD from
Tk::Widget.pm.
It reads:
eval {local $SIG{'__DIE__'}; require $name};
if ($@) {
.
.
}
When running the executable, $@ always get set. This is not the case when
running the perl script.
First up, I inserted 'print "\$what = $what\n";' as the second line of sub
AUTOLOAD - so we know what's being loaded each time the function runs.
Then I added 2 print statements at the eval block, so it now reads:
print "\$name = $name\n";
eval {local $SIG{'__DIE__'}; require $name};
if ($@) {
print [EMAIL PROTECTED];
.
.
}
When I run the perl script it works nicely and I get:
$what = Tk::Frame::label
$name = D:/Perl_M/site/lib/auto/Tk/Frame/label.al
$what = Tk::Frame::labelVariable
$name = D:/Perl_M/site/lib/auto/Tk/Frame/labelVariable.al
$what = Tk::Frame::labelPack
$name = D:/Perl_M/site/lib/auto/Tk/Frame/labelPack.al
$what = Tk::Widget::Listbox
$name = D:/Perl_M/site/lib/auto/Tk/Widget/Listbox.al
Can't locate D:/Perl_M/site/lib/auto/Tk/Widget/Listbox.al at D:/Perl_M/site
/lib/Tk/Widget.pm line 297.
$what = Tk::Frame::AddScrollbars
$name = D:/Perl_M/site/lib/auto/Tk/Frame/AddScrollbars.al
$what = Tk::Frame::freeze_on_map
$name = D:/Perl_M/site/lib/auto/Tk/Frame/freeze_on_map.al
$what = Tk::Frame::scrollbars
$name = D:/Perl_M/site/lib/auto/Tk/Frame/scrollbars.al
$what = Tk::Frame::queuePack
$name = D:/Perl_M/site/lib/auto/Tk/Frame/queuePack.al
$what = Tk::Frame::insert
$name = D:/Perl_M/site/lib/auto/Tk/Frame/insert.al
Can't locate D:/Perl_M/site/lib/auto/Tk/Frame/insert.al at D:/Perl_M/site/l
ib/Tk/Widget.pm line 297.
$what = Tk::Frame::packscrollbars
$name = D:/Perl_M/site/lib/auto/Tk/Frame/packscrollbars.al
Note that $@ gets set only twice.
When I run the executable I get:
$what = Tk::Frame::label
$name = /loader/0x520aed4/auto/Tk/Frame/label.al
Can't locate /loader/0x520aed4/auto/Tk/Frame/label.al at /loader/0x520aed4/
Tk/Widget.pm line 297.
$what = Tk::Frame::labelVariable
$name = /loader/0x520aed4/auto/Tk/Frame/labelVariable.al
Can't locate /loader/0x520aed4/auto/Tk/Frame/labelVariable.al at /loader/0x
520aed4/Tk/Widget.pm line 297.
$what = Tk::Frame::labelPack
$name = /loader/0x520aed4/auto/Tk/Frame/labelPack.al
Can't locate /loader/0x520aed4/auto/Tk/Frame/labelPack.al at /loader/0x520a
ed4/Tk/Widget.pm line 297.
$what = Tk::Widget::Listbox
$name = /loader/0x520aed4/auto/Tk/Widget/Listbox.al
Can't locate /loader/0x520aed4/auto/Tk/Widget/Listbox.al at /loader/0x520ae
d4/Tk/Widget.pm line 297.
$what = Tk::Frame::AddScrollbars
$name = /loader/0x520aed4/auto/Tk/Frame/AddScrollbars.al
Can't locate /loader/0x520aed4/auto/Tk/Frame/AddScrollbars.al at /loader/0x
520aed4/Tk/Widget.pm line 297.
Can't locate Tk/AddScrollbars.pm in @INC (@INC contains: CODE(0x52414cc) D:
/Perl_M/lib D:/Perl_M/site/lib .) at /loader/0x520aed4/Tk/Widget.pm line 25
9.
at which point it croaks. Note that $@ is set every time.
As an afterthought, I've just conducted a test that reveals that this is the
*only* problem - at least in regard to this particular script.
In sub AUTOLOAD I ran $name thru the following substitution regex:
$name =~ s/\/loader\/0x520aed4/D:\/Perl_M\/site\/lib/;
That done, then both the perl script and the executable run smoothly,
producing identical output on the console.
Presumably, that executable wouldn't run on another machine unless the
absolute paths to the .al files match ..... but at least it works on this
machine.
As to the remedy .... that's probably best left to someone with a better
understanding of PAR than mine .... but I hope this might help.
Seems that a lot of people (on Win32, anyway) are wanting to produce
executables of Tk scripts, so it would be a good thing if PAR could
accommodate this.
Cheers,
Rob