here the excential part of my program : the "initaldir"-option of getSaveFile/getOpenFile works fine under winnt4 but doesn't work on my linux box
#!/usr/bin/perl -w
use Tk;
use strict;
use warnings;
use English;
my $initialdir;
if ($OSNAME =~ /win/i){
$initialdir = 'C:\temp';
}
if ($OSNAME =~ /linux|unix|bsd/i){
$initialdir = '/tmp';
}
my $main = new MainWindow;
my $menubar = $main->Frame(-relief=>"raised",
-borderwidth=>2);
my $filebutton =
$menubar->Menubutton(
-text=>"File",
-underline => 0
);
my $filemenu = $filebutton->Menu();
$filebutton->configure(
-menu=>$filemenu
);
$filemenu->command(
-command => \&open_choice,
-label => "Open...",
-underline => 0
);
$filemenu->command(
-command => \&save_choice,
-label => "Save...",
-underline => 0
);
$filemenu->separator;
$filemenu->command(
-label => "Exit",
-command => \&exit_choice,
-underline => 1
);
my $helpbutton =
$menubar->Menubutton(
-text=>"Help",
-underline => 0
);
$filebutton->pack(
-side=>"left"
);
$helpbutton->pack(
-side=>"right"
);
$menubar->pack(
-side=>"top",
-fill=>"x"
);
MainLoop;
sub open_choice {
my $filename = $main->getOpenFile(
-defaultextension => "cnf",
-filetypes => [
['Configuration Files','.cnf'],
['All Files','*']
],
-initialdir=> $initialdir,
);
return unless $filename;
print "Open file $filename\n";
}
sub save_choice {
my $filename = $main->getSaveFile(
-defaultextension => "cnf",
-filetypes => [
['Configuration Files','.cnf'],
['All Files','*']
],
-initialdir => $initialdir,
);
return unless $filename;
}
the output of perl -V is:
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuratio
+n:
Platform:
osname=linux, osvers=2.4.16-6mdksmp, archname=i386-linux
uname='linux bi.mandrakesoft.com 2.4.16-6mdksmp #1 smp sat dec 8 0
+4:02:48 cet 2001 i686 unknown '
config_args='-des -Darchname=i386-linux -Dd_dosuid -Ud_csh -Dusesh
+rplib -Doptimize=-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -mar
+ch=i586 -ffast-math -fno-strength-reduce -Dprefix=/usr -Di_ndbm -Di_g
+dbm -Di_shadow -Di_syslog -Uuselargefiles -Dman1dir=/usr/share/man/ma
+n1 -Dman3dir=/usr/lib/perl5/man/man3'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultipl
+icity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i
+586 -ffast-math -fno-strength-reduce',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 20000731 (Mandrake Linux 8.2 2.96-0
+.75mdk)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1
+2
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
+ lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.4.so, so=so, useshrplib=true, libperl=libperl.s
+o
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynami
+c -Wl,-rpath,/usr/lib/perl5/5.6.1/i386-linux/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Feb 21 2002 01:00:32
@INC:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl
|