The write_col() method takes an array_ref as the third argument.$worksheetout->write_col( 0, 0, @$indata ); # Should be: $worksheetout->write_col( 0, 0, $indata );
Update: In relation to your question "what is the best way to track down issues when the error comes from the module itself?".
In your particular case you were a little unlucky. WriteExcel checks that the required parameter is an array_ref and croaks an error from the point of view of the calling program. Something like this:
Unfortunately, once you had (accidentally) flattened the first level of the array ref the next element was also an array ref and the check was validated so the module didn't report the error back at the right place.Not an array ref in call to write_col() at /tmp/pm876841.pl line 4 +1
The way that I tracked this down was the way I always do it. With the perl debugger running under Emacs. I commented out the includes that I didn't have and replaced your DB call with a function returning a simple array ref.
Once the program compiled I ran through it in the debugger until I hit the write_col() line where the error was thrown.
P.S.: you probably have the same error here.
$worksheetout->write_col( 1, 0, @$sqldata );
--
John.
In reply to Re: Spreadsheet::WriteExcel error
by jmcnamara
in thread Spreadsheet::WriteExcel error
by ag4ve
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |