rovingeyes has asked for the wisdom of the Perl Monks concerning the following question:
use A; my $a = A->new(); $a->execute(<params>);
Module A has an execute() method, which when invoked, creates the headers etc & sends data to the server using module B. Now this is where it gets interesting for me.
This REST service (apart from other stuff) returns a representation of a custom CSV file object. So, I can say get me a handle to a particular CSV file & it'll return a JSON representation of it. And on this, I can do other operations like data mining (which will be happening on the server). I want to represent this object as say C. So when I say $a->getCSVHandle(), I should be returning to the end user an object type C. That means module A will import module C and in getCSVHandle() method, it instantiates class C (with its relevant instance vars) & retunrs it. So, when I call any methods on this C object, it should do some relevant data munging & in turn use module A's execute method to send the HTTP request, because that is the end goal anyway.
But to use the module A's execute method, I will have to "use" it in module C, which will create a circular dependency as module A already imports C, which I want to avoid. How can I achieve the end result without getting in to this nasty circular dependency?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing a module's method without causing circular dependency
by ikegami (Patriarch) on Apr 27, 2010 at 19:48 UTC | |
by rovingeyes (Sexton) on Apr 27, 2010 at 20:37 UTC | |
by almut (Canon) on Apr 27, 2010 at 20:42 UTC | |
by ikegami (Patriarch) on Apr 27, 2010 at 20:49 UTC | |
|
Re: Accessing a module's method without causing circular dependency
by almut (Canon) on Apr 27, 2010 at 19:34 UTC |