in reply to Excel::Writer::XLSX in perl/tk
When you open a file in Perl, it gets created if it didn't already exist. I don't know what Tk has to do with this, but I assume you're displaying the spreadsheet there, somehow. If you don't want it saved just yet, do something like the following:
use Excel::Writer::XLSX; #Create a filehandle that just points to a scalar for now. my $excel_data = ""; open( XLS_TMP_FH, \$excel_data ); #Call the workbook constructor my $workbook = Excel::Writer::XLSX->new( \*XLS_TMP_FH ); #... #Chose if you want to save it if( i_want_to_save_it() ) { open( XLS_FILE, ">", "myfile.xlsx" ) or die( "Cannot open file: $! +" ); print XLS_FILE join( "", <XLS_TMP_FH> ); close XLS_FILE; } close XLS_TMP_FH;
I don't know if that will actually work(see signature :-), but it's worth a shot.
my $workbook =
|
|---|