[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] problem specifying path



>  The Perl Cookbook suggests:
>
>===========
>Use open like this:
>
>  $filename =~ s#^(\s)#./$1#;
>  open(HANDLE, "< $filename\0") or die "cannot open $filename: $!\n";
>
>Or simply use sysopen:
>
>  sysopen(HANDLE, $filename, O_RDONLY) or die "cannot open $filename: $!\n";
>
>==========
>
>  Obviously the first method is very UNIX-centric.  Since whitespace can
>never occur at the beginning of a fully-specified filename in UNIX, they
>can assume that any filename with whitespace at the beginning is relative.
>Since you can't make this assumption on a Mac, the first method won't
>work.  I'm not sure if there is some sort of substitution that would work.
>
>  In any case, sysopen is probably the simpler option.  *grin*

I notice that the trick of a trailing \0, e.g.

 "<volume:file_with_trailing_space \0" 

works, but I am unable to test 

 "<\0 volume_with_leading_space: file_with_trailing_space \0"

Does it work?

If they have another volume without leading spaces, I think they could use an alias to the volume with leading spaces, possibly even accessing the alias through the Desktop folder (?) if they put it on the desktop.


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org