russelj9 has asked for the wisdom of the Perl Monks concerning the following question:
Hi all. So I was writing my script and behaves wonderfully. But then I install it and let it do its thing and it gets caught up on an apostrophe. I won't explain the code because I have it below. But basically if I run this code on a file named with an apostrophe it gets hung up every time when I compute the md5 sum.
And yes I've already tried renaming the file but it's produced automatically from iWeb. I went into iWeb and got rid of all apostrophes, but it's still showing up in the filename. I'm running OS X by the way and by the end of my code the file with the apostrophe should end up on a remote server (the server is linux based).
Anyways I think it'd be nice to know how to handle this in perl... So here's the code (minimal example given)-
#!/usr/bin/env perl -w use strict; use warnings; use File::Find; use Digest::MD5::File qw(file_md5_hex); my $local_dir = $ARGV[0]; my %localData; finddepth ( \&wanted, $local_dir); sub wanted { if (-f $_) { my $fileName = $File::Find::name; unless ( $fileName =~ m{.*~\..*|\.DS_Store|\.svn|CVS} ) { $fileName =~ s{$local_dir(.+)}{\.$1}; $localData{$fileName} = file_md5_hex($File::Find::name); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Something to do with text encoding?
by pc88mxer (Vicar) on Feb 13, 2008 at 16:51 UTC | |
by russelj9 (Initiate) on Feb 13, 2008 at 18:43 UTC | |
by russelj9 (Initiate) on Feb 13, 2008 at 17:10 UTC |