in reply to Need object to retain open filehandle.

Can't comment on your problem, but a few pieces of advice:

Don't use prototypes. Not on methods and not on non-methods. There may be exceptions to this rule, but you won't stumble across them for a long time.

Your DESTROY method is calling Close using a non-method call. Do

my $self = shift; $self->Close();
instead. Or just get rid of DESTROY altogether: perl will close the file for you when the object goes out of scope; the only reason to manually do it would be to take some action when close() gives an error.

Replies are listed 'Best First'.
Re^2: Need object to retain open filehandle.
by exodist (Monk) on Jul 02, 2007 at 04:50 UTC

    Thanx for most of the advice, but before I thank you for the prototype comment can you please explain it to me? What is wrong with using prototypes?

    In this case the functions are not only useless, but dangerous if they do not receive these 3 parameters. If you have better way to do them please explain?

    Thank you!

    --------------------------------------

    I would rather take 30 minutes to re-invent the wheel then take 30 days to learn how to use someone else's. Before pestering me about my re-invention prepare to defend yourself with a way of learning how to use the wheel in less time than it takes for me to make one, one that I might add is specialized to my specific task!

      A quick search pops up this discussion, which makes some good points. tchrist's article referred to there has moved but is still available here.