Archive-BagIt

 view release on metacpan or  search on metacpan

lib/Archive/BagIt.pm  view on Meta::CPAN

    my $local_entry = shift;
    my $dir = shift;
    if ($local_entry !~ m/^[a-zA-Z0-9._-]+$/) {
        my $local_entry_utf8 = decode("UTF-8", $local_entry);
        if ((!$self->has_force_utf8)) {
            my $hexdump = "0x" . unpack('H*', $local_entry);
            $local_entry =~m/[^a-zA-Z0-9._-]/; # to find PREMATCH, needed nextline
            my $prematch_position = $`;
            carp "possible non portable pathname detected in $dir,\n",
                "got path (hexdump)='$hexdump'(hex),\n",
                "decoded path='$local_entry_utf8'\n",
                "              "." "x length($prematch_position)."^"."------- first non portable char\n";
        }
        $local_entry = $local_entry_utf8;
    }
    return $local_entry;
}



sub __file_find { # own implementation, because File::Find has problems with UTF8 encoded Paths under MSWin32



( run in 0.247 second using v1.01-cache-2.11-cpan-26ccb49234f )