I lose - can't hack simple code. :-(

jjore on 2007-07-09T01:47:13

I've just spent the last two days struggling with ugly code of my own creation and while I think it is simple, it's managed to elude my grasp. WTF.

I hate getting stumped on stuff that should be really easy but for unknown reasons, isn't. The current problem is in reconstructing a synthetic filename where containing archives form directories in the path to a file. The real path is probably something like /tmp/X012342/bar.txt and it has to be grafted into the appropriate part of the synthetic path which might look like /home/josh/bar.tar.bz2/bar.txt. I've got it working fine for archives that are one level deep - I only screw up when I'm 2+ levels deep.

It's hacking Archive::Extract onto File::Next so Andy's ack can search inside archives off of CPAN.

It's also so I can easily md5 contents of the giant stacks of cds and dvds I'd backed things off to so I can perhaps inventory them and get stuff back off. I would be /so/ screwed if I actually had to retrieve anything from backup. DVD or CD seems to require that I pack my files inside zips or tarballs because of limitations on directory depth or number of directories, etc. It just makes it really inconvenient to extract stuff from later .


So path mapping?

Alias on 2007-07-09T02:58:26

I solved this case once for the local dir/file mapped to a URI case, which is close to your case.

Perhaps URI::ToDisk can provide some inspiration?