Re: Trapping Carp::croak

2006-09-14 Thread $Bill Luebkert
Bullock, Howard A. wrote: > No, I did not try that. That method (last_send_successful) is not shown > in my local MIME::Lite docs, but I did find it mentioned on CPAN. The > CPAN docs state: After sending, the method last_send_successful() can > be used to determine if the send was successful or

Re: Trapping Carp::croak

2006-09-14 Thread $Bill Luebkert
Bullock, Howard A. wrote: >>Can't locate object method "last_send_successful" via package >>"MIME::Lite" at ReplWatcherCroakTest.pl line 169. > > > I see that I have version 3.01 from the ActiveState repository and that > the version on CPAN is now 3.01_05. I do not plan on upgrading until a > n

RE: Trapping Carp::croak

2006-09-14 Thread Bullock, Howard A.
>Can't locate object method "last_send_successful" via package >"MIME::Lite" at ReplWatcherCroakTest.pl line 169. I see that I have version 3.01 from the ActiveState repository and that the version on CPAN is now 3.01_05. I do not plan on upgrading until a newer version is available via ppm from t

RE: Trapping Carp::croak

2006-09-14 Thread Bullock, Howard A.
>Did you try the below as a success test ? : >if ($msg->last_send_successful) { > print "message successful\n"; >} else { > print "message not successful\n"; >} No, I did not try that. That method (last_send_successful) is not shown in my local MIME::Lite docs, but I did find it menti

Re: Trapping Carp::croak

2006-09-14 Thread $Bill Luebkert
Bullock, Howard A. wrote: > I have stripped my PerlSvc program to a minimal MIME::Lite email > program. Using a firewall I blocked access to the mailhost and tested > the "eval" code as both of you suggested and then using an "if" block to > check [EMAIL PROTECTED] > > The "croak" was indeed trap

RE: Trapping Carp::croak

2006-09-14 Thread Bullock, Howard A.
I have stripped my PerlSvc program to a minimal MIME::Lite email program. Using a firewall I blocked access to the mailhost and tested the "eval" code as both of you suggested and then using an "if" block to check [EMAIL PROTECTED] The "croak" was indeed trapped using the syntax: eval {$msg-

Re: Trapping Carp::croak

2006-09-13 Thread $Bill Luebkert
Sisyphus wrote: > For me that prints: > > foo didn't fail on '-1' > foo didn't fail on '1' > foo failed on '0': > foo failed on '': > foo failed on 'die': I Died at try.pl line 10. Me too. > That's exactly what I expected it to produce ... so I guess we must be in > agreement :-) Good - it pr

Re: Trapping Carp::croak

2006-09-13 Thread Sisyphus
- Original Message - From: "$Bill Luebkert" <[EMAIL PROTECTED]> . . > > 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

Re: Trapping Carp::croak

2006-09-12 Thread $Bill Luebkert
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 righ

Re: Trapping Carp::croak

2006-09-12 Thread Sisyphus
- Original Message - From: "$Bill Luebkert" <[EMAIL PROTECTED]> To: "perl-win32-users" Sent: Tuesday, September 12, 2006 5:18 PM Subject: Re: Trapping Carp::croak > Sisyphus wrote: > > > Yes, I think you used eval() improperly. You probably want

Re: Trapping Carp::croak

2006-09-12 Thread $Bill Luebkert
Sisyphus wrote: > Yes, I think you used eval() improperly. You probably wanted: > > eval {$msg->send}; > if (!$@) { > print "message sent\n"; > } > else { > print "Failed to send: [EMAIL PROTECTED]"; > } Further qualifying, I think his is the equivalent of doing : my $ret; eval {

Re: Trapping Carp::croak

2006-09-12 Thread $Bill Luebkert
Sisyphus wrote: > Yes, I think you used eval() improperly. You probably wanted: > > eval {$msg->send}; > if (!$@) { > print "message sent\n"; > } > else { > print "Failed to send: [EMAIL PROTECTED]"; > } While I would agree that your (and my) method work properly, I believe there's

Re: Trapping Carp::croak

2006-09-11 Thread Sisyphus
- Original Message - From: "Bullock, Howard A." . . > I tried to trap this issue in my code using "eval", but was > unsuccessful. > > if (eval {$msg->send}) { > print "message sent\n"; > } > else { > print "Failed to send: [EMAIL PROTECTED]"; > } > > Did I use the eval improperl

RE: Trapping Carp::croak

2006-09-11 Thread Bullock, Howard A.
> [Bill Wrote:] > I added 'use MIME::Lite;' (and dropped the Net::SMTP), used code I knew > to work with it and reversed your eval if testing $@ rather than the > return code from send (although that last item may work either way). > > [Bullock, Howard A.] > I used MIME::Lite as stated in the

Re: Trapping Carp::croak

2006-09-11 Thread $Bill Luebkert
Bullock, Howard A. wrote: > [Bill Wrote:] > I added 'use MIME::Lite;' (and dropped the Net::SMTP), used code I knew > to work with it and reversed your eval if testing $@ rather than the > return code from send (although that last item may work either way). > > [Bullock, Howard A.] > I used MIME

RE: Trapping Carp::croak

2006-09-11 Thread Bullock, Howard A.
[Bill Wrote:] I added 'use MIME::Lite;' (and dropped the Net::SMTP), used code I knew to work with it and reversed your eval if testing $@ rather than the return code from send (although that last item may work either way). [Bullock, Howard A.] I used MIME::Lite as stated in the original post. T

Re: Trapping Carp::croak

2006-09-11 Thread $Bill Luebkert
Bullock, Howard A. wrote: > [Bullock, Howard A.] > What is different about your code other than not placing the "eval" in > an "if" block? Is the missing semi-colon in the eval block the issue? I added 'use MIME::Lite;' (and dropped the Net::SMTP), used code I knew to work with it and reversed

RE: Trapping Carp::croak

2006-09-11 Thread Bullock, Howard A.
> I tried to trap this issue in my code using "eval", but was > unsuccessful. > > if (eval {$msg->send}) { > print "message sent\n"; > } > else { > print "Failed to send: [EMAIL PROTECTED]"; > } > > Did I use the eval improperly or is there a better to prevent the > stopping of my proces

Re: Trapping Carp::croak

2006-09-11 Thread $Bill Luebkert
Bullock, Howard A. wrote: > I use MIME::Lite for sending email from my programs. If the mail server > can not be contacted the following MIME::Lite code causes a fatal error > aborting my process. > > ### Create SMTP client: > require Net::SMTP; > my $smtp = MIME::Lite::SMTP->new(@args) > or C