E
eatmoreoats
The general question
In general how do I pass into an object's method a variable set of
values ?
The actual scenario
There is an object that I am using that has a method, called graph(),
which can take multiple files to chart out :
...
$rrd->graph(
image => $image_file_name,
draw => {
file => "file1.rrd",
legend => "First Source"
},
draw => {
file => "file2.rrd",
legend => "Second Source"
}
);
...
The result of this, by using draw twice, is that both file1.rrd and
file2.rrd are charted by graph().
I want to build up a list of files dynamically and pass that list into
the graph method but am struggling to do this .
IE what goes in [>>> here <<<]
$rrd->graph(
image => $image_file_name,
[ >>>>> multiple draw's , one each for each of the multiple user
defined files to chart <<<<<]
);
I want the user to define the list of files to be charted and pass them
to chart() method. I'm no expert in OO perl clearly. I've tried a
number of different ways of doing this such as passing arrays of hashes
by reference, or not, etc etc but to no avail and usually ending up
with a 'Reference found where even-sized list expected' error.
Does this make any sense ?
Any help or pointers would be fantastic.
For more info : see RRDTool::OO document
http://search.cpan.org/~mschilli/RRDTool-OO-0.13/lib/RRDTool/OO.pm
Thanks very much
- Dom
In general how do I pass into an object's method a variable set of
values ?
The actual scenario
There is an object that I am using that has a method, called graph(),
which can take multiple files to chart out :
...
$rrd->graph(
image => $image_file_name,
draw => {
file => "file1.rrd",
legend => "First Source"
},
draw => {
file => "file2.rrd",
legend => "Second Source"
}
);
...
The result of this, by using draw twice, is that both file1.rrd and
file2.rrd are charted by graph().
I want to build up a list of files dynamically and pass that list into
the graph method but am struggling to do this .
IE what goes in [>>> here <<<]
$rrd->graph(
image => $image_file_name,
[ >>>>> multiple draw's , one each for each of the multiple user
defined files to chart <<<<<]
);
I want the user to define the list of files to be charted and pass them
to chart() method. I'm no expert in OO perl clearly. I've tried a
number of different ways of doing this such as passing arrays of hashes
by reference, or not, etc etc but to no avail and usually ending up
with a 'Reference found where even-sized list expected' error.
Does this make any sense ?
Any help or pointers would be fantastic.
For more info : see RRDTool::OO document
http://search.cpan.org/~mschilli/RRDTool-OO-0.13/lib/RRDTool/OO.pm
Thanks very much
- Dom