Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > find command

Reply
Thread Tools

find command

 
 
julia
Guest
Posts: n/a
 
      03-08-2005
This command doesn't seem to be correct.

find \&lsRuleFiles, "$rulesPath";

Does someone can give me examples of the right syntax to use find command ?
 
Reply With Quote
 
 
 
 
Fabian Pilkowski
Guest
Posts: n/a
 
      03-08-2005
* julia wrote:
>
> This command doesn't seem to be correct.
>
> find \&lsRuleFiles, "$rulesPath";


To me, this seems to be a simple call to File::Find's find-method. And
if that agrees to your code (search for the string "use File::Find") I
cannot see any problem with the one line above (except the needless
quotes about $rulesPath).

>
> Does someone can give me examples of the right syntax to use find
> command ?


Have you already read the docs, e.g. at

http://search.cpan.org/~nwclark/perl...b/File/Find.pm

? Perhaps you'll consider to show us some more lines of your code, and
explain what your code shall do.

regards,
fabian
 
Reply With Quote
 
 
 
 
jl_post@hotmail.com
Guest
Posts: n/a
 
      03-08-2005
julia wrote:
>
> This command doesn't seem to be correct.
>
> find \&lsRuleFiles, "$rulesPath";
>
> Does someone can give me examples of the right
> syntax to use find command ?



That looks correct to me -- providing you're using the find()
function from the File::Find module. I'll even include that exact line
in a small Perl script to demontrate that it is correct.

All this Perl script does is print out the names of all files and
directories found inside '.' (the current directory):


#!/usr/bin/perl
use strict;
use warnings;

use File::Find;

sub lsRuleFiles
{
print "Found $File::Find::name\n";
}

my $rulesPath = '.'; # the current directory

find \&lsRuleFiles, "$rulesPath";

__END__


So the line of code you provided works perfectly as is. If you
still have a problem, you'll have to provide us with a small program
that we can run to reproduce your exact problem. Once we can reproduce
your problem and see the exact error message(s) that you see, then we
can figure out what needs correcting.

I hope this helps, Julia.

-- Jean-Luc Romano

 
Reply With Quote
 
Henry Law
Guest
Posts: n/a
 
      03-08-2005
On 8 Mar 2005 13:32:22 -0800, http://www.velocityreviews.com/forums/(E-Mail Removed) (julia) wrote:

>This command doesn't seem to be correct.
>
> find \&lsRuleFiles, "$rulesPath";
>
>Does someone can give me examples of the right syntax to use find command ?


perldoc file::find

NAME
File::Find - Traverse a directory tree.

SYNOPSIS
use File::Find;
find(\&wanted, @directories_to_search);
sub wanted { ... }

If that's not enough then you'll have to follow the posting
guidelines: create a small complete program that shows your problem
and post it, saying what behaviour you expected and what actually
happened.
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      03-08-2005
julia <(E-Mail Removed)> wrote:

> This command doesn't seem to be correct.

^^^^^^^^^^^^


What did you observe that led you to belive that?

You should provide one or more symptoms if you hope for a diagnosis.


> find \&lsRuleFiles, "$rulesPath";
>
> Does someone can give me examples of the right syntax to use find command ?



The above _is_ the right syntax to use the find command
(apart from the useless use of quotes, don't do that)


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 3 02-14-2011 05:28 AM
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 0 02-10-2011 05:18 PM
Find.find does not find orphaned links? Wybo Dekker Ruby 1 11-15-2005 02:50 PM
RUN/execute a Command-Line command from an ASP page. Lucas Cowald ASP .Net 4 10-23-2003 11:09 AM
copying value of DDL in a Datagrid "pre-edit command" to value in "post edit command" San Diego Guy ASP .Net 0 08-07-2003 08:59 PM



Advertisments