Orphan Detection

You now have a list of all the files accessible (directly or indirectly) from the top web page. This list is made up of the keys of the %file_seen hash. You need to know the names of all the files on the system to do orphan checking.

This is accomplished with the File::Find module. Actually, the program uses your old friend find2perl to create the code that calls this module and then adapts it to your needs.

The find is kicked off using the statement

160    # Traverse desired filesystems 
161    File::Find::find({wanted => \&wanted}, dirname($ARGV[0]));

The wanted function just puts the files on the list:

76    sub wanted {
77        if (–f "$name") {
78            push(@full_file_list, $name); 
79        } 
80        return (1); 
81    }

Now that you have two lists, one ...

Get Perl for C Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.