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

Re: [MacPerl] -s File Test Operator



Chris Nandor <pudge@pobox.com> writes:
>At 03.21 -0400 1998.07.21, Jeff at MacTech wrote:
>>I discovered for myself, and now see in the book errata, that -s returns
>>the size of the data fork and not the entire file. Is this a bug or a
>>feature? It seems that the expected behavior is to return the size of the
>>whole file.
>
>I'd just call it a "behavior".  At worst, I suppose you could call it a
>misfeature or poor decision, because it was probably intentional.

It was an intentional decision, and I stand by it. A Perl script operating on
platform conforming text files should be compatible, and most Mac text files
have nonempty resource forks. It is not acceptable to break text processing
scripts by introducing random noise into -s.

>Matthias, is there any reason not to change this to do data+resource forks?

Visualize some grumpy answer ending in "cold, dead fingers" :-)

Paul Schinder writes:
>On the other hand, it would be nice if the resource fork size were a
>little easier to get.

Agreed.

>Maybe one of the - operators that don't have any
>meaning under MacOS can be pressed into service (-r?).

Rather not, at least not without p5p's consent, which I doubt this would get.

Chris writes:
>What about a module/pragma that overloaded -s?

Sounds a bit tricky to implement, but otherwise, why not?

Yet another suggestion by Chris:
>Maybe even a simple set of functions.
>
>  use Mac::Files qw(:size);
>  $file = 'Shuck Manual';
>  $data_fork_size = data_size($file);
>  $res_fork_size  = res_size($file);
>  $total_size     = total_size($file);

Is this a huge improvement over PBGetCatInfo? How about defining some
convenience member functions of CatInfo instead?

Matthias

-- 
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
  "Johannes Scotus Eriugena, the greatest European philosopher of the 9th
   century, said that if reason and authority conflict, reason should be
   given preference. And if that doesn't sound reasonable to you, you'll
   just have to accept it..."


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch