in reply to Win32::OLE freezing Tk

Most likely, the delay is when shutting down Powerpoint as $ppt goes out of scope.

You can test this theory by explicitly clearing out $ppt yourself:

$presentation->SaveAs("SAVED_" . $filename); $presentation->Close; undef $ppt; # Clean up Powerpoint $mw->messageBox (-title => "message", -message=>"DONE!", -icon=> 'info +');

There is very little way around this, but if you plan to convert more than a single presentation in one go, it might make sense to declare $ppt as a global variable and keep it around:

our $ppt; sub save_PPT { # ... $ppt ||= Win32::OLE->GetActiveObject('PowerPoint.Application'); # ... and also later: $ppt ||= Win32::OLE->new( 'PowerPoint.Application', sub { $_[0]->Quit } ) or return 'error'; # ---

Replies are listed 'Best First'.
Re^2: Win32::OLE freezing Tk
by Takamoto (Monk) on Dec 23, 2019 at 15:49 UTC

    Thank you, Corion. undef $ppt; seems to do the trick. I am not sure how this can let PowerPoint shut down without keeping the GUI occupied, but it works.

      If you are concerned about performance can't you just copy the file without opening the file in PowerPoint and using the 'save as' option?

        As I stated in my post, this was just an example. I perform transformations before saving the target file.

      Perhaps this (edit: undef $ppt;) just kills PP as opposed to shutdown/close?