Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Win32::OLE freezing Tk

by Corion (Pope)
on Dec 23, 2019 at 15:37 UTC ( #11110554=note: print w/replies, xml ) Need Help??

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 (Scribe) 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?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11110554]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-06-07 06:11 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (42 votes). Check out past polls.