I'm new to Perl, and I need to improve the performance of an application someone else wrote.
Following the top answer to this question, I'm trying to use DProf.
When I call the program with -d:DProf
, I get the following error:
Options must be name=>value pairs (odd number supplied) at <file and line>
The relevant line contains simply
my $xml = XMLin($FileName, KeyAttr => { server => 'name' }, ForceArray => ['Package','Sensor']);
I have found that function's documentation here, and the call seems correct. More confidently, the error does not happen without the profiler. I can reliably reproduce the error and its absence simply by adding and removing the -d:DProf
profiler option in between the paths of the Perl executable and the main application file.
I'm sure that the offending line is the one I presented, because I later added debugging prints around it. When the error happens, the print before this line shows up before the error message, and the print after this line does not affect the output.
Why does this happen, and how can I profile this application?
I'm using Perl 5.10.0.