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

Re: [MacPerl] Finding file size




Chris Nandor wrote:
> At 20.47 -0400 1999.07.03, Todd Richmond wrote:
> >How do I find the size of a Mac file, including the resource fork,
> >with MacPerl? It appears that the size that stat() returns is the
> >size of the file minus the resource fork -> when you zap the resource
> >fork on a file,  stat() returns the same size as the Finder.
> 
> Unfortunately not in the book, the code for this IS in the book's errata.
> 
>     http://pudge.net/macperl/macperl_errata.txt
> 
> Anyway, here it is:
> 
>     use Mac::Files;
>     my $cat  = FSpGetCatInfo($file);
>     my $size = $cat->ioFlLgLen() + $cat->ioFlRLgLen();

Bart's sector size rounding concern notwithstanding, I see that in 
your errata list that it is referring to the description of the -s test 
on page 270, which probably ought to mention this recipe.  
 
 However, my copy of MPP&E does have this
recipe in a footnote on page 184, albeit without the C<my $fileCat  = 
FSpGetCatInfo($file);> explicitly given though one could infer
it from the example given bottom pg 183 -> top pg 184.
Perhaps the footnote ought to include that object creator?

BTW I just recently noticed the extensive use of the phrase 
"inter-application communication" as opposed to the expansion
of IPC.  I thought that was cute :-)


Peter Prymmer


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