ff has asked for the wisdom of the Perl Monks concerning the following question:
I have a Tk widget that invokes the following as part of its callback
sub open_excel_file { my ( $path_of_excel, $file_to_open, ) = @_; use File::DosGlob 'glob'; my $prob_found = system glob($path_of_excel), $file_to_open; #my $prob_found = system( (glob qq{"$path_of_excel"}), $file_to_open); return ( $prob_found ? 'red' : 'green' ); }
I let the user configure a string like the following to hold the path to Excel (user runs app on Win32 for user's own benefit.) I store this string in a variable and pass it as a parameter for $path_of_excel, along with an absolute path name of a $file_to_open that I generate with catfile.
C:\\Program\ Files\\Microsoft\ Office\\Office\\Excel.exe
Using either of the 'system glob' calls, a new instance of Excel starts, quickly accessing the file.
When I try the following string, again using either of the 'system glob' calls, it takes a LONG time for Excel to open and access the file. I'd like to let the user configure pathnames like the following since otherwise I expect my users to quiver if I tell them to use backslashes to escape backslashes and spaces. (It's bad enough making them go verify the path to Excel.) But I can't if it takes so long. Any thoughts as to what's going on and how to make the following format start up faster? Thanks.
C:\Program Files\Microsoft Office\Office\Excel.exe
(And yes, once you explain the problem with the single-slash approach, you are welcome to suggest entirely different ways of opening an Excel session for the user to fool around in; the program should wait/sleep while the user does his/her thing with the file in Excel, then be ready to run again when the user Saves/Closes. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32 spaces in path, open Excel w/ 'system' and glob/DosGlob
by jmcnamara (Monsignor) on Oct 23, 2003 at 07:50 UTC | |
by ff (Hermit) on Oct 23, 2003 at 12:35 UTC | |
|
Re: Win32 spaces in path, open Excel w/ 'system' and glob/DosGlob
by nimdokk (Vicar) on Oct 23, 2003 at 10:05 UTC | |
by vek (Prior) on Oct 24, 2003 at 00:11 UTC |