Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello monks,

I supersearched some of the old File::Find related nodes and didn't find anything that really helped me understand my problem. I also skimmed over the docs a couple of times. I have a form that contains a muliple select called dirs, 7 checkboxes, and a text box. The form will invoke a script that will seach every file in every directory in dirs for occurences of certain strings. So for instance if my multiple select 'dirs' contains foo and bar, and use strict and use warnings are checked, then each File::Find::name is grep'ed for "use warnings" and "use strict". The results are returned to a hash of arrays. Example: %results(myscript.pl =>[warnings, strict]);.

I am trying to find out the best way to accomplish this algorithmically and how to use &wanted.
Here is the code I have so far...
############################################################ # This script displays all scripts containing certain params ############################################################ # Author: Monica Lewinski # Date: 09/32/2031 ############################################################ use strict; use CGI; use File::Find; require "VLO_NTlib.pl"; my $cgi = CGI->new; my $dirs = [ $cgi->param('dirs') ]; if ($dirs->[0] eq "ALL") { @$dirs = qw("Admin", "Backuprequests", "Magic", "Network", "NewSer +ver", "PatchManagement", "Security", "Serverlist", "ServerRetire"); } find(\&wanted, @$dirs); exit (0); ############################################################ sub wanted ############################################################ { my @wanted; my $i=0; if ($cgi->param('c_strict')){ $wanted[$i] = "use strict\;"; ++$i; } if ($cgi->param('c_warnings)){ $wanted[$i] = "use warnings\;"; ++$i; } if ($cgi->param('c_vlontlib')){ $wanted[$i] = "require \"VLO_NTlib.pl\"\;"; ++$i; } if ($cgi->param('c_cgi')){ $wanted[$i] = "use CGI"; ++$i; } if ($cgi->param('c_dbi')){ $wanted[$i] = "use DBI"; ++$i; } if ($cgi->param('c_tabs')){ $wanted[$i] = "PAGE1CLEAN"; ++$i; } if ($cgi->param('c_heredocs')){ $wanted[$i] = "END_OF_PRINT"; ++$i; } if ($cgi->param('contains')){ $wanted[$i] = $cgi->param('contains'); ++$i } }
Any suggestions to clarify my mess would be appreciated,
hok_si_la

In reply to Questions on File::Find by hok_si_la

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found