From: Perl 5 Porters Date: Mon, 15 Jul 1996 02:22:03 +0000 (+0000) Subject: perl 5.003_01: lib/File/Copy.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=48a5c3991750705ae60f8e453b03b10a5bcb0d05;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_01: lib/File/Copy.pm Change handling of $\ to avoid uninitializd variable warning when it was undefined --- diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm index 6846013..aedcd7f 100644 --- a/lib/File/Copy.pm +++ b/lib/File/Copy.pm @@ -31,13 +31,11 @@ sub copy { my $from = shift; my $to = shift; - my $recsep = $\; my $closefrom=0; my $closeto=0; my ($size, $status, $r, $buf); local(*FROM, *TO); - - $\ = ''; + local($\) = ''; if (ref(\$from) eq 'GLOB') { *FROM = $from; @@ -81,7 +79,7 @@ sub copy { goto fail_inner unless(defined($r)); close(TO) || goto fail_open2 if $closeto; close(FROM) || goto fail_open1 if $closefrom; - $\ = $recsep; + # Use this idiom to avoid uninitialized value warning. return 1; # All of these contortions try to preserve error messages... @@ -100,7 +98,6 @@ sub copy { $! = $status unless $!; } fail_open1: - $\ = $recsep; return 0; }