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

Re: [MacPerl] recursive dir script



pfolk@uni.uiuc.edu (Peter Folk) writes:
>Matthias had written:
>>This looks like a serious problem, and one that isn't easy to fix. Basically,
>>a reliance on NUL-terminated C strings is deeply ingrained in Perl, and it's
>>almost impossible to excise. I cannot promise a remedy before I get a
>>direct File manager interface ready.
>
>I thought that one of perls strengths was that it had no troubles loading a
>whole executable into a variable, and then doing whatever you wanted with
>it: unlike the shell (and even C, to some extent) it had no problems dealing
>with binary data.

Yes, your point is absolutely correct and my formulation was very bad (never
trust anything I write on Mondays and Fridays). Perl itself has no problems
at all dealing with binary data (as evidenced by the fact that the constructed
path names were full of NULs). However, as soon as this data gets passed to
a POSIXish routine (open, stat, opendir) as a path name, there is no way to
specify the true length of the data. To aggravate the situation, some people
deliberately append extra NUL characters to names to protect them from open,
as shown in the Camel book in the last paragraph of the open manual.

Matthias

-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html
   "There once was an Age of Reason, but we've progressed beyond it."
                                   -- Ayn Rand, _Atlas Shrugged_