Perinci::Sub::Property::exit_on_error - Die on non-success result
version 0.01
Without exit_on_error:
# on successful call f(...); # [200, "OK"] # on non-successful call f(...); # [404, "Not found"]
With exit_on_error => 1:
exit_on_error => 1
# on successful call f(...); # [200, "OK"] # on non-successful call f(...); # print message "Call f() failed with 404 status: Not found" to STDERR and exits 104
To customize what statuses are considered error: exit_on_error => { success_statuses => '^2..$' }.
exit_on_error => { success_statuses => '^2..$' }
This property sets so that function calls exit() when result status is a non-successful one. Successful statuses by default include 2xx and 304 ('^(2..|304)$').
exit()
'^(2..|304)$'
Exit code is currently set to (like in Perinci::CmdLine) and might be customizable in the future.
Perinci
Please visit the project's homepage at https://metacpan.org/release/Perinci-Sub-Property-exit_on_error.
Source repository is at https://github.com/sharyanto/perl-Perinci-Sub-Property-exit_on_error.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Sub-Property-exit_on_error
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Perinci::Sub::Property::exit_on_error, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perinci::Sub::Property::exit_on_error
CPAN shell
perl -MCPAN -e shell install Perinci::Sub::Property::exit_on_error
For more information on module installation, please visit the detailed CPAN module installation guide.