I'm writing an excel xlsx spreadsheet with Raku and inline::Perl5.
When I write a line like
$file-location-ws.write($row, 2, $csv);
Raku crashes with the cryptic error message
Operation "eq": no method found, left argument in overloaded package Perl6::Object, right argument has no overloaded magic at /usr/local/share/perl/5.26.0/Excel/Writer/XLSX/Worksheet.pm line 2020.
in method invoke-parent at /home/con/.perl6/sources/130449F27E85303EEC9A19017246A5ED249F99E4 (Inline::Perl5) line 674 in sub many-args at /usr/lib/perl6/site/sources/D38010D24322CE1B1E6FFD8A463F23ED864152E9 (Inline::Perl5::ClassHOW) line 195 in block at 8.make_xlsx.p6 line 100
but if I replace $csv with a literal string of the filename 'Pumbaa Validation Plate 1 samplesheet.csv'
thus
$file-location-ws.write($row, 2, 'Pumbaa Validation Plate 1 samplesheet.csv');
it works just fine. Obviously, this isn't a solution, since $csv
will change.
Why is this error happening? How can I fix it?
The problem here is that the write
function expects a variable/container of type Str
but is getting an IO::Path
.
This is easily solved by assigning the variable to be written as a Str
type.
The issue was that the error message gave no hint whatsoever of this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With