O'Reilly logo

Win32 Perl Programming: The Standard Extensions, Second Edition by Dave Roth

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Destroying COM Objects

After you have finished using a Win32::OLE object, it needs to be destroyed. Destruction is accomplished in two ways: either by letting the object fall out of scope or by forcing it to destroy itself. Falling out of scope is quite easy; when the function, code block, or script terminates, the object is destroyed. Forcing the object to destroy itself requires that you call the object’s DESTROY() method:

$Object–>DESTROY(); 

This method takes no parameters and causes the object to terminate. Generally speaking, this method is used internally by the object itself and not by a Perl script.

It is possible that a script could run for hours but only need to create a COM object for just a few minutes. Assuming that for some reason ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required