List Info

Thread: RE: :Compress::Base destructor




RE: :Compress::Base destructor
user name
2007-09-11 10:16:29
From: Rafael Garcia-Suarez [mailto:rgarciasuarezgmail.com]
 
> On 11/09/2007, Paul Marquess <paul_marquessyahoo.co.uk> wrote:
> > P5P -- the proposed change is to localise the
global error variables
> like
> > this in the DESTROY method
> >
> >
> > sub DESTROY
> > {
> >     my $self = shift ;
> >     local($., $, $!, $^E, $?); # <= Add
This
> >     $self->close() ;
> > }
> >
> >
> > I'm in two minds about this change. Any opinions?
> 
> I was thinking the same thing. My conclusion was, more
or less, "if
> you want to check the value of $! anyway, you can
always call close()
> directly, so that patch seems safe". 

Yep, that was my thinking as well. The use-case where
someone does this to
trigger object destruction

    undef $object;

is probably not worth bothering about. I'm almost convinced
to add the patch
to my modules, but there is still part of me that doesn't
like masking an
error.

> But Graham, who maintains
> IO:ir, has
not answered yet. (And that is not 5.10-critical)

The patch I got was against IO::Compress::Base &
IO::Uncompress::Base, which
are both in the core.

Paul


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )