Why are you calling instance methods as class methods?
You create an instance, called $message_obj here:
my $message_obj = Message->new( $name, $subject, $message );
But then you call the name() method as a class method, passing the object instance as a parameter?
my $name2 = Message->name( $message_obj );
That should be
my $name2 = $message_obj->name();
That's not to say that it will fix your problem, as the two are notionally equivalent, but you should be letting Perl take care of passing the instance handle for you. Why have a dog and bark yourself?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
|