in reply to Re^4: Is it possible to localize the stat/lstat cache?
in thread Is it possible to localize the stat/lstat cache?

This shows that even the small files take up 8 blocks

On a linux ext2/3/4 filesystem, the actual block size is 4096 bytes. But in struct stat (and so in the return value of perl's (l)stat), it reports the block count for an imaginary (legacy) block size of 512 bytes. A block is counted as used even if only one byte is actually used, so linux must report at least 8 "stat blocks" of 512 bytes each for an actual block of 4096 bytes. On a very small ext2/3/4 filesystem, you may see a block size of 1024 bytes, linux will then report only 2 "stat blocks" for a file of one byte.

Do not worry about block sizes and allocated blocks, unless you write filesystem-specific tools, you do not need this information.

Why does Data::Dumper bless this? I understand just enough about "bless" to be completely-miffed by it, much like in its religious context.

bless creates Perl objects (data structures with associated code). File::stat uses objects to allow tests based on the saved results from the stat and lstat build-in functions. Additionally, implementing File::stat as returning objects allows it to overload some standard operations, notably the -X functions.

Data::Dumper does not bless anything. It dumps data in a format that can be evaluated by perl. bless in the output of Data::Dumper tells you that Data::Dumper has encountered an object. As File::stat makes no attempts to hide its inner workings, Data::Dumper reports File::stat objects as blessed array references.

Other objects may appear as blessed hash references (very common), but they may also be blessed scalar references (common with XS code, e.g. DBI), blessed glob references (file handles, mostly with IO::Handle and derived classes), or other blessed references.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)