Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: specifying file extension in opendir function

by inman (Curate)
on Nov 16, 2006 at 14:19 UTC ( #584467=note: print w/replies, xml ) Need Help??

in reply to specifying file extension in opendir function

Try the following use of a while loop if it fits in with your application logic. It is a neat short cut that may work for your app. The <pattern> construct uses the glob function internally. Details on the patterns that you can use in File::Glob

while (</apps/inst2/metrica/ON-SITE/backup/schema/*.tdef>){ print; }

The while loop gets to process the files that match the pattern.

Replies are listed 'Best First'.
Re^2: specifying file extension in opendir function
by Tanktalus (Canon) on Nov 16, 2006 at 16:18 UTC

    Please, PLEASE ... just use glob.

    /me really wishes perl didn't have the <> construct doing such drastically different things because parsing it right is hard, e.g.

    my $wildcard = File::Spec->catfile(File::Spec->rootdir(), qw(apps inst2 metrica), $some_location, qw(backup schema), '*.tdef' ); while (<$wildcard>) { print; }
    doesn't work. Change the while to:
    for (glob $wildcard) {
    and it's fine.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://584467]
[MidLifeXis]: (5.22 at that time)
[MidLifeXis]: Yeah, I know, really helpful :-)
[Corion]: If all else fails, Spreadsheet::XLSX should be "installable" by manually copying the files, provided that the prerequisites are met
[thezip]: It fails in the "formatted 2-digit numeric" tests
[thezip]: Okay Corion, that's what I wanted to hear. Thanks!
[Corion]: Oh, a test failure... Just force-install it then? --force and potentially --notest to skip the tests alltogether ?
[ambrus]: thezip: is Activestate Perl usable for your scenario instead?
[MidLifeXis]: Yeah, --notest is good, not sure I would do --force.
[thezip]: It fails 2/10 tests in that group. What are the ramifications if I force it? What should I look for for?
[thezip]: I've migrated from ActiveState to Strawberry. No going back...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2017-03-23 17:16 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (290 votes). Check out past polls.