Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

All versions of VMS files

by Njall (Acolyte)
on May 11, 2005 at 15:54 UTC ( #456048=perlquestion: print w/replies, xml ) Need Help??
Njall has asked for the wisdom of the Perl Monks concerning the following question:


Heretofore I have used readdir() almost exclusively to walk directories. And until I started using Perl 5.6.1. on VMS recently that was delightfully more than adequate. However, I am applying Perl to a data analysis problem on one of our (it ain't open) VMS systems. And I need to see all of the files in a directory not just the highest versions of the files.

Alas readdir() can't handle that request. However, globbing, as in

while (<*.*;*>) { my $file = $_; print "$file \n"; # or whatever. }
does pick up all versions.

Question: Aside from this technique using globing, can someone recommend a better way of getting a list of all versions of files under VMS?

- Njall

Replies are listed 'Best First'.
Re: All versions of VMS files
by grinder (Bishop) on May 11, 2005 at 17:57 UTC
    a better way of getting a list of all versions of files under VMS

    Gosh, it's been a while since I did VMS. I think VMS::FindFile will help you out. It understands VMS wildcards, and will do what your looking for. E.g., it will recurse (only) if it has to.

    I don't know if this way is better, but it is different. It may be faster though.

    - another intruder with the mooring in the heart of the Perl

Re: All versions of VMS files
by Elian (Parson) on May 11, 2005 at 21:25 UTC
    Nope, that's it. Pretty much standard VMS conventions -- unless you explicitly ask for something other than the highest version, that's what you get. If you want something else, then you have to ask for it.

    There's XS required no matter what you do, though generally it's hidden. (The code to do a lot of the VMS specific stuff is XS, buried in vms/vms.c) You should be fine with what builds by default with perl on VMS, though.

Re: All versions of VMS files
by Tanktalus (Canon) on May 11, 2005 at 16:44 UTC

    Taking a quick-ish scan of the File::Glob module, I'd say, no. It seems that File::Glob uses XS code to do the actual reading of the filesystem, which likely means that the author couldn't find a pure-perl way to do this either (although it may mean they found a way, but it was too slow).

    Taking a slightly longer view at the 5.8.6 source tree, I think I have evidence that it's something really special here, but it's really beyond me to state conclusively that this is the case without much more time to invest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://456048]
Approved by gellyfish
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-09-25 08:52 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (278 votes). Check out past polls.