Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

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

Huck:

That did the trick! I would never have stumbled onto that. Hopefully I will remember that next time. Now onto the grep section.

Thank you very much!

Update: I have no excuse. If I would have consulted my copy of the Perl Cookbook I would have found a recipe in chapter 7 that addressed this issue. File list created and files searched for #includes. Done...

#! /usr/bin/perl # Keithsdr.pl - Script to search for the libraries used by the # C++ source files of the KeithSDR project. # Output to assist with creating documentation. # # James M. Lynes Jr. - KE4MIQ # Created: April 3, 2021 # Last Modified: 4/03/2021 - First working version # use strict; use warnings; use File::Find::Rule; use Data::Dumper; my $input; my $output; open ($output, ">", "keithsdrdoc"); my $dir = ($ENV{HOME}.'/Hamradio/Keithsdr/KEITHSDR-main/SDR_RA8875/'); # # Create a list of C++ files from the SDR_RA8875 directory # my @files = File::Find::Rule->file() ->name('*.cpp', '*.ino') ->maxdepth(1) ->start($dir) ->in($dir); # # Sort the file list # my @sorted = sort @files; @files = @sorted; # # Search each C++ file for library files(#include) # foreach my $file (@files) { print "$file\n"; print $output "$file\n"; open ($input, "<", $file) or die; while (<$input>) { chomp(); if (/#include/) { print "$_\n"; print $output "$_\n"; } } print "\n"; print $output "\n"; } close($input); close($output);

James

There's never enough time to do it right, but always enough time to do it over...


In reply to Re^2: File::Find::Rule Help Needed by jmlynesjr
in thread File::Find::Rule Help Needed by jmlynesjr

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 romping around the Monastery: (5)
As of 2024-03-28 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found