Home » excel » perl – Program generated by Cava packager crashed when it uses the module Excel::Writer::XLSX::Chart

perl – Program generated by Cava packager crashed when it uses the module Excel::Writer::XLSX::Chart

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am using Cava packager tool to pack my perl program, the perl program mainly include some code about writing data to excel using Excel::Writer::XLSX module. But the executable program generated by Cava packager crash when it is running, I analyze the situation and find that the problem caused by the following code:
my $chart = $book->add_chart( type => 'line', embedded => 1); When this sentense is removed, program does not crash and can generate excel report normally. And the stangest thing is that before it is packed to executable, I manualy run the program with same code by command line, it does not crash. So I’d like to know if this is bug in Cava packager or others and how to solve this problem? Thanks.

How to&Answers:

I find the solution that you must add the module to Cava Packager like below:
enter image description here

Answer:

This issue is actually called out in the docs:

Perl packaging programs can’t find chart modules.

When using Excel::Writer::XLSX charts with Perl packagers such as PAR or Cava you should explicitly include the chart that you are trying to create in your use statements. This isn’t a bug as such but it might help someone from banging their head off a wall:

...
use Excel::Writer::XLSX;
use Excel::Writer::XLSX::Chart::Column;
...