in reply to Inheritance Query

You can find out who called you with caller.

However your design is sounding rather complex to me. Can you explain what your overall design is? (My main concern is that code which is stored with no class attached could wind up modifying arbitrary classes in an uncontrolled and impossible to debug manner.)

Replies are listed 'Best First'.
Re: Re (tilly) 1: Inheritance Query
by Anonymous Monk on Jan 31, 2002 at 17:41 UTC
    hi, I am building an email system that works from an Agenda (good old AI style) set up in MySQL. Each entry has an action associated with it that is triggered on a certain day at a certain time eg. Send out X number of mail to X people and update DB to set reminder time for the next set of mails to go out. The system has to be autonomous and capable of updating itself. This code is run through an try{}catch eval block, errors are logged and the system doesn't fall over ;o|Code within an eval block (that isn't an anonymous subroutine) isn't attached to any class. Even when I use caller it returns nothing. It's really annoying... The whole system is a big Web based corporate doodad and I am programming the infrastructure. This is the only bit we are using Perl for, and I must admit I am something of a newbie to Perl :o)
      Insert a package statement within the evaled code and that will associate it with a class, and make it callable by objects in that class. That knowledge will, of course, need to be combined with some logic about what class each bit of code belongs in, but that is another story.

      When you say that you are a bit of a newbie to Perl, are you familiar with how Perl's OO model works? (eg as described by perlobj and perltoot...) If not, then learning that would be a good step.

        Thanx for your help, I been over the OOP/OOD stuff for perl but it all works in a very similar why to java/C++ both of which I'm very familiar with. I still can't figure out how to retrieve the super class handle from within an eval block, but maybe it's not possible without hacking around inside perl? I think I will try a different approach for now and come back to this when there are no deadlines to be met :o) Thanx again for you help.