As callout A in Listing 1 shows, the script starts by creating a Win32::Clipboard object ($Clip). If the creation fails, the script terminates. You can use this object for method calls by using code such as
$Clip->Get()
Alternatively, if you don't create a Clipboard object, you can use the full namespace in method calls by using code such as
Win32::Clipboard::Get()
Because there might already be content on the Clipboard, the code at callout A clears any pending change notifications by calling the WaitForChange() method. Notice that a timeout value of 100 milliseconds is passed to this method. A timeout value is included in case no change notification is pending. Otherwise, the script might wait indefinitely and never enter the main loop.
Callout A ends with the beginning of the main loop. This large while() loop uses the WaitForChange() method to wait for Clipboard changes, but this time the method isn't passed a timeout value. Therefore, the script could wait forever. However, a change will most likely be detected. When a change occurs, the main loop processes it. . . .