[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How can I marshall File::Stat, and do file tests?

Sam Roberts

11/2/2003 3:09:00 AM

Basically, I'm building a Hash of paths to their File::Stat, and
Marshal.dumping it. Later I'll load it, and
compare the current filesystem state to the state I saved.

Simple, right?

But, I can't marshall File::Stat, it's not allowed/supported.

Irritating, but no problem, I'll build a Struct with all the values from
the File::Stat that I want to save, and put that in the Hash instead,
right?

Well, that doesn't work so well, either. Now when I load that, I have
no way to construct a File::Stat out of my own data (it lacks a "new"),
and I lose all of File::Stats handy methods to see what kind of file it
is, and its permissions, etc.

Any suggestions? Can I define my own _load() and _dump() for File::Stat?
Is that the right way? Am I not allowed to marshall File::Stat because
its contents are system specific?

Thanks for any pointers on how to deal with this,
Sam


1 Answer

Sam Roberts

11/2/2003 8:20:00 PM

0

Seems to be a long-standing oddity, discussed in ruby-talk #74175 and
#74162, but I still can't find a resolution to it.

Still searching...

Sam

Quoteing sroberts@uniserve.com, on Sun, Nov 02, 2003 at 12:08:34PM +0900:
> Basically, I'm building a Hash of paths to their File::Stat, and
> Marshal.dumping it. Later I'll load it, and
> compare the current filesystem state to the state I saved.
>
> Simple, right?
>
> But, I can't marshall File::Stat, it's not allowed/supported.
>
> Irritating, but no problem, I'll build a Struct with all the values from
> the File::Stat that I want to save, and put that in the Hash instead,
> right?
>
> Well, that doesn't work so well, either. Now when I load that, I have
> no way to construct a File::Stat out of my own data (it lacks a "new"),
> and I lose all of File::Stats handy methods to see what kind of file it
> is, and its permissions, etc.
>
> Any suggestions? Can I define my own _load() and _dump() for File::Stat?
> Is that the right way? Am I not allowed to marshall File::Stat because
> its contents are system specific?
>
> Thanks for any pointers on how to deal with this,
> Sam
>
>