Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: regarding File::Find

by Hofmator (Curate)
on Nov 17, 2006 at 09:46 UTC ( #584688=note: print w/replies, xml ) Need Help??


in reply to Re^2: regarding File::Find
in thread regarding File::Find

I think the solution chromatic had in mind goes something like this (untested)
#!/usr/bin/perl use strict; use File::Find; use DBI; my $sql = q(insert into file_stat values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)) +; my $dbh = DBI->connect('dbi:ODBC:test','test','test123',{AutoCommit => + 1,RaiseError => 1}) or die "error!!\n"; my $sth = $dbh->prepare($sql); sub wanted { return unless /\.pl$/i; my @stats = stat $File::Find::name; $sth->execute(@stats, $File::Find::name); } # find files find (\&wanted,".");

Update: fixed stupid mistake in code (return instead of next).

-- Hofmator

Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://584688]
help
Chatterbox?
choroba was busy with the Pull Request Challenge
marto must set time aside for cpan things, life is just too crazy at the moment

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-01-23 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (192 votes). Check out past polls.