Script::Carp - provide some ways to leave messages when script died
use this with options.
use Script::Carp -stop; # display error and wait STDIN use Script::Carp -file => "error.txt"; # write message to error.txt use Script::Carp -stop, -file => "error.txt"; # mixed the above use Script::Carp -log => "error_log.txt"; # append message to error_log.txt use Script::Carp -beep => "c d e f g"; # beep use Script::Carp -clip; # message is copied to clipboard
use class method with options
Script::Carp->setup(-stop); Script::Carp->setup(-file => "error.txt"); Script::Carp->setup(-log => "error_log.txt"); Script::Carp->setup(-stop, -file => "error.txt"); Script::Carp->setup(-beep => "c d e f g"); Script::Carp->setup(-clip);
When you write script on MS Windows and run it and then it died, prompt window is immediately clesed and you cannot see any messages.
For such case, this module is usefule.
When You use this module with some options or use setup method with some options, you can check error message, easily.
options can be used with use Script::Carp or class method setup method.
use Script::Carp -stop;
or
Script::Carp->setup(-stop);
When script died, display messages and wait STDIN.
use Script::Carp -file => 'file_name';
Script::Carp->setup(-file => 'file_name');
When script died, messages are written to "file_name".
use Script::Carp -log => 'log_file_name';
Script::Carp->setup(-log => 'log_file_name');
It is like file, but it will not clear file content. When script died, messages are appended to "log_file_name".
use Script::Carp -beep; use Script::Carp -beep => "c d e f g";
Script::Carp->setup(-beep); Script::Carp->setup(-beep => "c d e f g");
beep when script died. It requires Audio::Beep module. If you use Linux, you may need to 'modprobe pcspkr", 'xset -b on'
use Script::Carp -clip;
Script::Carp->setup(-clip);
message is copied to clipboard when script died. It requires Clipboard module.
see SYNOPSYS and OPTIONS
Script::Carp just die in eval block, error messages will be set to $@ as usual.
use Script::Carp -stop; eval { die "Script::Carp is ignored?"; # Yes, Sctip::Carp is ignored. }; die $@ if $@; # Script::Carp work, here.
Ktat, <ktat at cpan.org>
<ktat at cpan.org>
Please report any bugs or feature requests to bug-script-carp at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Script-Carp. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-script-carp at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Script::Carp
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Script-Carp
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Script-Carp
CPAN Ratings
http://cpanratings.perl.org/d/Script-Carp
Search CPAN
http://search.cpan.org/dist/Script-Carp/
Copyright 2009 Ktat, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Script::Carp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Script::Carp
CPAN shell
perl -MCPAN -e shell install Script::Carp
For more information on module installation, please visit the detailed CPAN module installation guide.