After looking at the Win32::GUI source, I found that the object constructor does tie the hash object before blessing it. You notice this when you dump the contents of a window object:
$ perl -MWin32::GUI -MData::Dump=dump -e "dump Win32::GUI::Window->new
+();"
bless({
# tied Win32::GUI::Window
-accel => 0,
-handle => 460108,
-name => "#3698ef4",
-type => 0,
}, "Win32::GUI::Window")
Apparently, according to the source, it is needed to "get/set properties in a more fashionable way", whatever that means :)
Even some of Win32::GUI's own methods only return handles, rather than objects. For example, the Win32::GUI::DC methods CreateDC(), and GetDC(), as well as methods that return some kind of resource, such as a menu, icon, image list, etc.
I would say that, in most instances, you can get away with creating your own objects, but if your code doesn't run how it should, they could be the source of the problem. |