NAME
Script::Carp - provide some way to leave messages when script died
SYNOPSIS
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 -log => "error_log.txt"; # append message to error_log.txt
use Script::Carp -stop, -file => "error.txt"; # mixed the above
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");
DESCRIPTION
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
options can be used with use Script::Carp or class method setup method.
-stop
use Script::Carp -stop;
or
Script::Carp->setup(-stop);
When script died, display messages and wait STDIN.
-file => 'file_name'
use Script::Carp -file => 'file_name';
or
Script::Carp->setup(-file => 'file_name');
When script died, messages are written to "file_name".
-log => 'log_file_name'
use Script::Carp -log => 'log_file_name';
or
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".
METHOD
setup
IN eval BLOCK
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.
AUTHOR
Ktat, <ktat at cpan.org>
BUGS
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.
SUPPORT
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
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
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.