Well I'm not sure. I may be explaining this badly. I'll go thru all the details in case it helps.

The path I pass when I'm executing the script is escaped, which I assume is correct.

Once that path is read by Getopt, I print it and, voila, no escapes, just nice-to-read spaces.

This path gets a filename appended as if it were a regular string, and is used to when I make a file (via another module). This file is created & written just fine. This made me assume all was well, and that Perl or the modules covered all the issues with spaces. I now realize this may have been naive.

Then I attempted to use Tidy, sans HTML::Tidy, through Shell. The HTML::Tidy lib won't work on my system. So, I have been futzing with tidy and I'v e discovered that tidy and simple commands like cd fail, most likely because of the spaces in my paths.

For example, here's the path I pass to the script (no quotes):
    /Users/mike/Airline\ Sheets/Original\ Schedules/UnitedJune.html

Here's the path as found via File::Basename/fileparse:
    /Users/mike/Projects/Omni/Airline Sheets/Original Schedules/        

My script uses modules that create files based on this path, and it seems okay. If however I try to use the path with say, the Shell mod, it fails. This is what cd returns:

        /Users/mike/Projects/Omni/Airline: No such file or directory
.
I need to use the Shell because I need to run tidy, locally.

I fear that you're using the Shell module for more than it was
intended to do, perhaps because you don't know about system().


That may very well be the case!
One easy solution may be to give a list of arguments to system(). The
first is the name of the program you're trying to run, the rest of the
list are the command-line arguments to give it. You don't need to
escape anything, because the strings are passed as-is.

 # use the system's chmod command on a list of filenames
 system "chmod", "u+w", @filenames;

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to