From: Vsevolod (S. I. <si...@cs...> - 2004-01-05 22:53:01
|
Chris, At the risk of being a pain, I'll repost my two previous questions about links_to: I have a current project which is stalled because of them. This refers to the solution that you suggested when I do this: SPOPS class: SPOPS_Books Your class: MyBooks isa SPOPS_Books SPOPS class: SPOPS_Publisher Your class: MyPublisher isa SPOPS_Publisher Then declare in your publisher configuration: links_to => { MyBooks => 'link_table' } 1. My classes have a superclass. Let's call it MyObject. So I inherit MyBooks from SPOPS_Books and MyObject. I have to double-dispatch the new() method, but I can live with it. However, I use strict field checking and field autodiscovery. When I begin to store attributes in MyObject via the regular Perl getter/setter methods which use $self as a hashref, I start to get SPOPS errors about accessing fields that are not present. Obviously, I can turn strict fields checking off, but I'd like to retain that. The alternative is to somehow keep autodiscovery, but add in the config hash of SPOPS_Books additional fields which correspond to "instance variables" of MyObject. I am not sure how to do it, but even if I could, it's messy because I'll have to repeat it in every SPOPS_* class. This can be made a little less messy if I do not inherit from MyObject, but store a reference to it, but this one reference still has to be mentioned in SPOPS config. 2. I am trying to use objects that refer to each other, and I use links_to in both configuration. (I call them Job and Task, but they are similar in their relationship to Publisher and Book). I attach the four class files and the script that tries to use them. I inherit Job from SPOPS_Job and Task from SPOPS_Task. The SPOPS configuration refers to Common.pm, which would be different in your case. There are four possible configurations: SPOPS_Job links to SPOPS_Task, SPOPS_Task links to SPOPS_Job SPOPS_Job links to Task, SPOPS_Task links to SPOPS_Job SPOPS_Job links to SPOPS_Task, SPOPS_Task links to Job SPOPS_Job links to Task, SPOPS_Task links to Job The first three work, but the last one, which is of greater interest, does not. Could you please look at this and tell me if I am doing anything wrong? The error message is: Cannot run behavior in [links_to] [SPOPS_Job]: Failed to retrieve configuration from Compilation failed in require at Job.pm line 5. The tables that the config files refer to are created thusly: CREATE TABLE `Job` (`job_id` int(11)); CREATE TABLE `Task` (`task_id` int(11)); CREATE TABLE `JobToTask` (`id` int(11), `job_id` int(11), `task_id` int(11)); Thanks, Simon -- Simon (Vsevolod ILyushchenko) si...@cs... http://www.simonf.com America's business leaders simply don't want to think about complex technology issues - they want to think about golf. Microsoft promises them that. Andrew Grygus, www.aaxnet.com |