Placing the open() call inside the do{} struct will automatically close the
filehandle if possible.
Placing the close() call outside the do{} struct is useless and will make it
fail systematically
Change the error message to state that what fails is a fork(), not a file
Use autodie to properly exit when a print or open call fails.

Signed-off-by: Célestin Matte <>
Signed-off-by: Matthieu Moy <>
 contrib/mw-to-git/git-remote-mediawiki.perl |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl 
index 952ddcc..20ddccb 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -23,6 +23,7 @@ binmode STDOUT, ':encoding(UTF-8)';
 use URI::Escape;
 use Readonly;
+use autodie;
 # Mediawiki filenames can contain forward slashes. This variable decides by 
which pattern they should be replaced
 Readonly my $SLASH_REPLACEMENT => '%2F';
@@ -363,8 +364,6 @@ sub run_git {
                local $/ = undef;
-       close($git);
        return $res;

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to