|Perl Monk, Perl Meditation|
Passing a data structure via a dynamically-built subroutine callby Tanalis (Curate)
|on Jun 21, 2004 at 09:17 UTC||Need Help??|
Tanalis has asked for the
wisdom of the Perl Monks concerning the following question:
I am currently working on a web-based portal-style application that must be capable of importing a number of services (modules) at run-time.
Each service provides different functionality, for example a hook into an existing system to allow data to be aggregated, or providing some completely new functionality.
The portal system under construction makes use of a fixed interface, implemented and extended by each service to allow the portal to dynamically determine each service's interface at run-time. For example, Service X might implement methods get_legacy_data and update_legacy_data, returning a description of these methods via a call to the required get_service_interface method.
For the majority of method calls, a simple list of parameters is passed, using the following code:
My problem comes where I need to pass a data structure, rather than a flat list of elements, into some service, for example an array of arrays. The method above simply converts each array in the structure into a string, which obviously isn't the intended result.
Can anyone suggest a way of changing the sub above to allow more complex data structures to be passed?
Thanks in advance,