Trying to pull a list of C++ files from a fixed project directory. The system command shows a list of files verifying that the directory is correct. Find::File::Rule returns an empty list. I've tried many versions of the command block and I'm out of ideas at this point. This has to be a duh moment. What have I missed?
File::Find::Rule is up to date on my install.
I will add a grep section later to pull #include statements out of the files.
Thanks!
#! /usr/bin/perl
use strict;
use warnings;
use File::Find::Rule;
use Data::Dumper;
my $dir = ('~/Hamradio/Keithsdr/KEITHSDR-main/SDR_RA8875/');
system "ls $dir"; # This works and verifies the search
# path - $dir
my @files = File::Find::Rule->file()
->name('*.cpp')
->in($dir);
print Dumper $dir; # Good directory string
# $VAR1 = '~/Hamradio/Keithsdr/
# KEITHSDR-main/SDR_RA8875/';
print Dumper(\@files); # Empty list $VAR1 = []
James
There's never enough time to do it right, but always enough time to do it over...
-
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.
|