Sisyphus wrote:

> Yes ... I'm not too sure about this. He might be ok in this instance iff
> '$msg->send' returns something that evaluates as true.

That was my assumption, but further research shows that the problem is
that send doesn't really have a proper return if I read the docs and
code right.  The proper way to check for a successful send is with the
method last_send_successful.  So the thought was right if send had a
proper return (which it doesn't seem to have).

> However, if $msg->send were to *not* return a value (or return 0), then
> Howard's code would print "Failed to send: ". Hence, in a general case, it's
> a bad practice (though I think you are right that this is not the problem
> he's facing here).

I don't think so if I catch your drift.  A proper true returning
sub should work fine.

This is more of what I had in mind as a test which proves my point
that a proper true returning call would work :

foreach (-1, 1, 0, undef, 'die') {
        if (eval { foo ($_) } ) {
                print "foo didn't fail on '$_'\n";
        } else {
                print "foo failed on '", defined $_ ? $_ : '<undef>',
                  "': [EMAIL PROTECTED]";
        }
}
sub foo { return shift unless defined $_[0] and $_[0] eq 'die'; die 'I Died'; }


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

Reply via email to