Why do I get "Can't call method on an undefined value?"
-------------------------------------------------------

Because you're trying to call a method on an undefined value. This
generally means that you did something like

$object = Class->new ();
$object->method ();

and Class->new failed. The message is an alert that you should do some
error checking:

$object = Class->new () or die "Failed to create object.";
$object->method ();

The next question is why it failed. Different packages return errors
differently. If $!, $@, and $^E don't contain anything interesting, read
the module documentation to see if it defines its own error reporting
mechanism (Win32 modules frequently do, and some other modules do also). If
it didn't come with any, read the module.

The situation might not be as clear-cut if you are "chaining" method calls
(i.e. - $object->method->method), but the principal is the same. If you
can't sort it out, the best way to proceed is probably to break apart such
calls, and check for errors at every available opportunity.

[the above is general. In your case, check for errors AFTER EVERY OLE CALL
(both "new"s and both "open"s. See the OLE documentation for how to find
out what error OLE encountered.

Tom Wyant]

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to