in reply to Tk causes problems with file paths containing non-Latin-1 chars
This should work on Win32:
use warnings; use strict; use Tk; if ($^O =~ /Win32/){ my $gof_wrapped = \&Tk::getOpenFile; *Tk::getOpenFile = sub{my $file = shift->$gof_wrapped; return Win32::GetANSIPathName($file)}; } my $mw = tkinit; my $path = $mw->getOpenFile(); open (my $fh, '<', $path) or die "can not open file $path : $!"; while (my $line = <$fh>) { print $line; } close $fh; MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk causes problems with file paths containing non-Latin-1 chars
by ron7 (Beadle) on May 04, 2011 at 23:57 UTC |