----- Original Message ----- From: "Craig A. Berry" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 29 January 2004 01:00 Subject: Re: Using File::Find to find all versions
> > At 4:30 PM -0800 1/27/04, Michael G Schwern wrote: > > > The more serious problem is that the code does not handle file multiversions. > >> How can I get File::Find to see them. > > > >The classic way around this is: "1 while unlink $file;" which deletes each > >version until they're all gone. rmtree() will do the moral equivalent of > >this for you. > > If the only reason you want all the versions is to make sure you > delete them all, then these will do nicely. If you want all the > versions for some other reason, we don't currently provide a way to > get at them. There is latent support for an attribute of the > directory handle returned by our readdir() implementation that allows > you to choose whether or not you want all versions of a file, but > there are currently no hooks for getting at this from Perl. Look for > vmsreaddirversions() and collectversions in [.vms]vms.c in the Perl > sources. I believe these were included in a readdir implementation > that was simply brought wholesale into Perl but the version functions > were never made visible. This thread has set me thinking, and I am reminded of something that VMS handles rather better than Unix. VMS uses the ellipsis [...] to stand for "and any directory path below". This renders redundant, the need for the find utility, or equivalent. I am reminded of my second year undergraduate days. For a project, we had to write a Unix shell. These were the days of Unix V6 running on PDP-11s. I did not do particularly well in this class exercise, but one of the facilities I built in was elliptic globbing. This meant that a command line file spec could contain the equivalent of [...], and my shell would recursively expand this. I got the idea because this was a facility I had got used to on VMS (then version 2.7). For example: rm /home/~me///core The /// reads as "blah blah blah", as does "..." in a VMS directory path spec. Now, many years later, I realise that nobody in the Unix world has thought of doing this, mainly because few of them have been exposed to VMS's elliptic wildcards. I know that the POSIX standard does not include this, but my syntax is consistent with it. Could we provide this facility in Perl for all platforms, thus making File::Find redundant? We could also allow version number syntax ";*" and ";-1" etc. which would be ignored by (most) operating systems that don't support multiversions. I gather that some Unixen have a file multiversioning facility (AIX for instance), but this needs to be specially enabled by the sysadmins, and there are also multiple caveats as most standard Unix utilities and scripts don't expect to see multiple file versions. I've also seen a nightmarish scenario when VMS is serving NFS. to Unix boxes, and clients see a directory containing foo.pl.1, foo.pl.2 and foo.pl for a VMS directory containing 3 versions of foo.pl. There could also be applications relating to version control systems, where the FS has no versioning, but the concept still exists. Anyway, rather than attacking the perl core to shoehorn something in that is esoteric and arcane to most Perl people, I'm thinking of proposing a module: use File::EllipticGlob; This overrides glob in your current namespace, providing a function which does what I am suggesting. Thoughts please. Ivor.
