Here is some code to get to the same error message.
Run the code to the point it pauses, then try to open the perl.xlsx file using Excel.
It uses an undocumented internal method, so hopefully is not what is actually being done. I tried a few variants of deferred close etc. but without success as all files were zero sized until the close method is called (or objects destroyed). Perhaps there is a point where Excel::Writer::XLSX reaches a memory or size threshold and writes the data to file, and this is being hit by the OP.
# adapted from the Excel::Writer::XLSX synopsis
use 5.010;
use warnings;
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( 'perl.xlsx' );
# Add a worksheet
$worksheet = $workbook->add_worksheet();
# some data
for my $row (0..5) {
for my $col (0..2) {
$worksheet->write( $row, $col, $row );
}
}
# internal method used in ->close()
$workbook->_store_workbook();
$workbook->close();
{
# defer garbage collection to test file
local $| = 1;
say 'Pausing, press any key to continue';
my $pause = <>;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|