develooper Front page | perl.perl5.porters | Postings from June 2008

Re: AW: IO::Dir destructor

Thread Previous | Thread Next
From:
Bram
Date:
June 2, 2008 07:39
Subject:
Re: AW: IO::Dir destructor
Message ID:
20080602163813.li47ineog84goook@horde.wizbit.be
> --- perl-current/lib/DirHandle.pm       2006-06-13 21:29:13.000000000 +0200
> +++ DirHandle.pm        2008-06-02 14:46:27.000000000 +0200
> @@ -60,6 +60,7 @@
>      my ($dh) = @_;
>      # Don't warn about already being closed as it may have been closed
>      # correctly, or maybe never opened at all.
> +    local($., $@, $!, $^E, $?);
>      no warnings 'io';
>      closedir($dh);
>  }
>

Why do you localise $. ?


echo -e 'abc\ndef\nghi' | perl -wle 'print $.; while (<>) { local ($.,  
$@); print $. };print $.'

output:
Use of uninitialized value $. in print at -e line 1.

1
2
3
3


And not:
Use of uninitialized value $. in print at -e line 1.

1
2
3
Use of uninitialized value $. in print at -e line 1.



Kind regards,

Bram



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About