Fellow monks, I am trying to understand how this subroutine works and I just cannot workout the logic. Also, "findfiles" is not part of a module as far as I know and it keeps erroring out when I run the program. It is also not a defined variable, either. Error at bottom.
use strict; use warnings; use diagnostics; use autodie; use File::Copy::Recursive qw( rcopy ); use File::Path qw( mkpath remove_tree ); use File::Glob qw( :globally ); use File::Find; use File::Spec; use Getopt::Long; use Pod::Usage; use POSIX qw(strftime); use File::Spec::Functions; sub DirCompare{ my ( %old_list, %new_list, @diffs); for my $file (findfiles($ARCHIVE) ) { $old_list{$file} = 1; } for my $file (findfiles($SourceDir) ) { $new_list{$file} = 1; } for my $file (sort keys %old_list) { if ( !defined $new_list{$file} ) { push @diffs, "Old file not in new: $file"; } } for my $file (sort keys %new_list) { if ( !defined $old_list{$file} ) { push @diffs, "Old file not in new: $file"; } } if (@diffs) { my $msg = sprintf "WARNING: %s\n", join "\nWARNING: ", @errors; check_ok( $msg ); } return; }

Undefined subroutine &main::findfiles called at deploy.pl line 154 (#1) (F) The subroutine indicated hasn't been defined, or if it was, it has since been undefined. Uncaught exception from user code: Undefined subroutine &main::findfiles called at deploy.pl line 154. at deploy.pl line 154 main::DirCompare() called at deploy.pl line 243

If you have any input as to how I can better form the subroutine, please share your ideas.

In reply to Comparing files in directory by smturner1

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.