in reply to Re (tilly) 1: Inheritance Query
in thread Inheritance Query

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)

Replies are listed 'Best First'.
Re (tilly) 3: Inheritance Query
by tilly (Archbishop) on Jan 31, 2002 at 18:07 UTC
    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.
        Hmmm...perhaps it is because Perl doesn't have a SUPER class handle per se? When you come back to it I think it may be helpful to write some code in Java or C++ that shows what you want to do, and then ask how to accomplish that in Perl.