The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Script::Carp - provide some ways 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 -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);

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".

-beep

 use Script::Carp -beep;
 use Script::Carp -beep => "c d e f g";

or

 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'

-clip

 use Script::Carp -clip;

or

 Script::Carp->setup(-clip);

message is copied to clipboard when script died. It requires Clipboard module.

METHOD

setup

see SYNOPSYS and OPTIONS

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:

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.