"Dr.Ruud" <rvtol+use...@isolution.nl> writes:

[...] snipped poorly written example

> I think you want to find filenames that exist in multiple paths.

As John K. has noted... my example was misleading. If you were to
prepend a different root directory to each list of filenames in my
example it would be much more like what I'm trying to figure out.

But your guess still stands.  Only doesn't quite get to the scope of the
problem.   Yes, files that exist on multiple paths, but there are also
many matched names that are not actually the same file.

Its actually a little more complex than that... since some of the
matches are the right file but do have slight differences that will
show in the sizes.  Not so many like that... but I have seen a few so
far. 

The matched files that do exist on different paths will eventually be
run through a dispatch table to ..er,, be dispatched.

In my full script... that problem is dealt with in a dispatch table
where one of the choices is to print the sizes of all matches.
Allowing the user to see at a glance which file is likely to be the
real match... and prepares (an external) diff... if there is still any
doubt.

So, many (most) of the matched files need to go through human hands
for final actions.

Some things the user is likely to know at a glance if presented with a
full filename from hash1 and several matches from hash2. Whereas it
would be quite hard (for me) to code an automated solution. Hence the
dispatch table

I'm not familiar enough with Data::Dumper and its output.  All the
brackets and stuff are confusing.  In your examples... not so much.
In fact not at all. (I'm talking about the output here. but in the
code, it is confusing... I'm not sharp enough to just follow it
without serious study)

So I'll need to figure out how to fix data::Dumper output so matches
can be listed and the list run through a dispatch table.

In every case where there is a match, no matter how many, they'll need
to be listed as numbered choices where typing a number will select the one
that is useful, and typing a letter representing a sub function will
dispatch those two files (one from h1, one from h2) as needed.

I haven't worked out how the number gets passed into the function yet
so have tried just listing the files and in some cases user can paste
a filename into a function through a menu..

(But that is a different subject)

I have written such a table. Where all sub functions are a single
letter. 
  `sub A {blah}'
   etc

Currently feeding it by collecting the matches to an end filename from
hash1 of all matching files in hash2 into an array. 

(That array contains the same kind of information as your examples
display.)

Then print a numbered list and the menu (like snippet below) of the
dispatch table (snippet below) and possible functions.

-------        ---------       ---=---       ---------      -------- 

  my %dispt = (
               A => sub { print "File to add (enter name) > ";
                          chomp(my $answer = <STDIN>);
                            if (! -f $answer) {
                              print "<$answer> not found on file system\n";
                              print "No action taken\n";
                            }else {
                              print A($answer) .  "\n"; 
                            };
                          },
               D => sub { print D(@matches) ."\n"; },
             [...]

              Z => sub { print Z(@matches) ."\n"; },
             [...]
-------        ---------       ---=---       ---------      -------- 
     while ($cnt == 1) {
       print "press A to add to `add' list\n",
             "press D for external diff line to copy paste\n", 
       [...]
             "press Z to see file sizes\n",
       [...]
-------        ---------       ---=---       ---------      -------- 

I'm doing that without involving Data::Dumper.

Do you think it would be better done using Data::Dumper?

First I'd have to learn how to use Data::Dumper

Both you and Shawn have shown its great utility.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to