in reply to (in cleanup) Can't call method "close" on an undefined value at somePerlModule.pm line number.

1. step

your error message tells you that $class->{handle} is undefined. OK.

2. step

you seek where $class->{handle} was initialized. OK.

3. step

after realizing that $class->{handle} never appears again in your code, you start blaming the guy who gave you this strange task. Oh no... ;-)

Cheers Rolf

PS: Je suis Charlie!

  • Comment on Re: (in cleanup) Can't call method "close" on an undefined value at somePerlModule.pm line number.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: (in cleanup) Can't call method "close" on an undefined value at somePerlModule.pm line number.
by thanos1983 (Parson) on Jan 30, 2015 at 12:50 UTC

    Hello Rolf,

    Thank you for your time and effort reading and replying to my question. Since this is my first time programming in OO way can answer me if we need to use Destructors?

    According to the documentation:

    If you want to do something when the object is destroyed, you can defi +ne a DESTROY method in your class. This method will always be called +by Perl at the appropriate time, unless the method is empty.

    Cheers Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

        Hello Rolf,

        Again thank your input but I do not see why my question is so wrong. First of all the error is not answered online somewhere so maybe someone else apart from me might have the same error and get some guidance from this answer.

        Second of all as I said I do not know, I have not done this again. This is my first time, I am not expert I have no one to ask, I am experimenting by my self and trying to learn from my mistakes.

        It takes some time to beginners to learn before they become experts. I was hoping that someone could help me understand when to use Destructors and when not to.

        Again as I said this is my first script in OO programming.

        Seeking for Perl wisdom...on the process of learning...not there...yet!