hi bruce,

warn throws a warning message on STDERR. see

perldoc -f warn

       warn LIST
               Produces a message on STDERR just like "die", but doesn't exit 
or throw an excep-
               tion.

               If LIST is empty and $@ already contains a value (typically from 
a previous eval)
               that value is used after appending "\t...caught" to $...@.  This 
is useful for stay-
               ing almost, but not entirely similar to "die".

               If $@ is empty then the string "Warning: Something's wrong" is 
used.

               No message is printed if there is a $SIG{__WARN__} handler 
installed.  It is the
               handler's responsibility to deal with the message as it sees fit 
(like, for
               instance, converting it into a "die").  Most handlers must 
therefore make arrange-
               ments to actually display the warnings that they are not 
prepared to deal with, by
               calling "warn" again in the handler.  Note that this is quite 
safe and will not
               produce an endless loop, since "__WARN__" hooks are not called 
from inside one. 
                   ....

cu, gabi



-----Original Message-----
From: childpsych.colum...@gmail.com [mailto:childpsych.colum...@gmail.com] On 
Behalf Of Ming Qian
Sent: Monday, November 02, 2009 9:39 PM
To: Shawn H Corey
Cc: beginners@perl.org
Subject: Re: the google keywords for debug...

Thank you Shawn!
The CGI::Carp seems works.
And,
I added such code:
open(MYTMP, ">> /mytmp.log");
print MYTMP "test.....\n";
close(MYTMP);
It seems works.

But,
I am still confused the project's warn message.

If I add a simple warn code in the same place,
such as:
warn "simple warn message\n";
I can not find this message in the project private logs.
Also,
I can not find this message in the Apache server logs.
Where does this warn message go? The original author set some debug
information level? Or any other redirect ??

Thanks a lot,
Bruce.





On Mon, Nov 2, 2009 at 11:30 AM, Shawn H Corey <shawnhco...@gmail.com>wrote:

> Ming Qian wrote:
> > Sorry. This is the complete email.
> >
> > Dear All,
> >
> > I am a beginner.
> > Recently, I receive a project in perl.
> > In some *.pm files,
> >
> > use Carp;
> > .........................
> >
> > sub A  {
> > .............
> > warn "a warn message";
> > ..............
> > }
> >
> > I am sure that sub A was executed.
> > But I can not find the warn message in log.
> > The project is database website. perl + mason + html.
> >
> > Via the httpd.conf, I know the log location.
> > So I think there maybe a switch or a debug level ?
> >
>
> When writing a CGI, you should use CGI::Carp
>
>  use CGI::Carp qw( fatalsToBrowser warningsToBrowser );
>
> This will send all die() and warn() messages to the browser.
>
>
> --
> Just my 0.00000002 million dollars worth,
>  Shawn
>
> Programming is as much about organization and communication
> as it is about coding.
>
> I like Perl; it's the only language where you can bless your
> thingy.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to