Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Carp; fresh water fish -- a delicious new recipie

by taint (Chaplain)
on Nov 21, 2013 at 06:40 UTC ( #1063681=perlmeditation: print w/ replies, xml ) Need Help??

Greetings, Monks.

I just stumbled upon a fun, new recipie for carp

It's a module (CGI::Carp::DebugScreen). Seems to add some potentially very useful additions -- almost a kind of Carp Blog. Enough of the nonsense. This looked like it might useful, so I thought I'd share my findings with you all.
From it's page on CPAN:

CGI::Carp qw/fatalsToBrowser/ is very useful for debugging. But the error screen it provides is a bit too plain; something you don't want to see, and you don't want your boss and colleagues and users to see. You might know CGI::Carp has a wonderful set_message() function but, you don't want to repeat yourself, right?
Hence this module.
This module calls CGI::Carp qw/fatalsToBrowser/ and set_message() function internally. If something dies or croaks, this confesses stack traces, included modules (optional), environmental variables (optional, too) in a more decent way.
When you finish debugging, set debug option to false (via some environmental variable, for example). Then, more limited, less informative error screen appears with dies or croaks. If something goes wrong and your users might see the screen, they only know something has happened. They'll never know where your modules are and they'll never see the awkward 500 Internal Server Error -- hopefully.
You can, and are suggested to, customize both debug and error screens, and some style settings, in harmony with your application.

So what do you think? Let me know.

--Chris

#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;

Comment on Carp; fresh water fish -- a delicious new recipie
Re: Carp; fresh water fish -- a delicious new recipie
by Anonymous Monk on Nov 21, 2013 at 08:41 UTC

    So what do you think? Let me know.

    Very odd module to investigate for someone who said: use CGI and die;

      Occasionally at $WORK pragmatism dictates that we are forced to use something which we despise. The something might be a module, a language, an application, an O/S or whatever. Finding some additional tool or technique which renders use of the something slightly more bearable can be a help.

      Quite right!

      A couple of things;
      I recognize that while I, don't care for it (CGI). I also recognize that many, if not most others do like to use it.
      My reasons for not choosing CGI, as a rule, are that it abstracts so many simple things, that are nearly, if not just as easy to do without it. Saving a bit of overhead in the process. Abstraction, IMHO, also has a nasty side effect. In that if you don't do something for long enough, you'll forget how it's done -- Use it, or loose it, as it were. Of course this simply isn't practical in some/many cases. But if one remains mindful of it. I think a healthy balance is maintained.

      My reason(s) for acknowledging the CGI::Carp::DebugScreen Module, is that, as noted earlier, I know that others are inclined to use it (CGI), and felt this might be for them. Where I'm concerned, I felt this had some interesting, potentially valuable use cases for emitting useful information that would otherwise require me to cobble up routines/subs to acquire. Given that this already came with prepackaged templates. I thought it a plus. I was also able to justify it's usage, in spite of my general feelings for CGI, because it was so small, and wouldn't be something I'd be using on a daily basis -- at least not where production is concerned (released code) -- see; not shipped with.

      Thanks for calling me on this. :)
      Best wishes.

      --Chris

      #!/usr/bin/perl -Tw
      use Perl::Always or die;
      my $perl_version = (5.12.5);
      print $perl_version;
Re: Carp; fresh water fish -- a delicious new recipie
by Anonymous Monk on Nov 21, 2013 at 08:58 UTC
    So what do you think? Let me know.

    I think this is another pointless post by you.

    No pros. No cons. No questions nor answers. No discernible reason for posting.

      I feel the same way about barbs posted anonymously.
      "I think this is another pointless post by you. No pros. No cons. No questions nor answers. No discernible reason for posting."

      Your inclination to astute observations, is beyond my control. Nor is it my responsibility.

      #!/usr/bin/perl -Tw
      use Perl::Always or die;
      my $perl_version = (5.12.5);
      print $perl_version;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1063681]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2014-09-30 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (368 votes), past polls