| 1 |
package Perinci::CmdLine::Manual::HowTo::Debugging; # just to make podweaver happy |
| 2 |
|
| 3 |
# AUTHORITY |
| 4 |
# DATE |
| 5 |
our $DIST = 'Perinci-CmdLine'; # DIST |
| 6 |
# VERSION |
| 7 |
|
| 8 |
1; |
| 9 |
# ABSTRACT: How-to guides related to debugging |
| 10 |
|
| 11 |
__END__ |
| 12 |
|
| 13 |
=pod |
| 14 |
|
| 15 |
=encoding UTF-8 |
| 16 |
|
| 17 |
=head1 NAME |
| 18 |
|
| 19 |
Perinci::CmdLine::Manual::HowTo::Debugging - How-to guides related to debugging |
| 20 |
|
| 21 |
=head1 VERSION |
| 22 |
|
| 23 |
This document describes version 2.000.2 of Perinci::CmdLine::Manual::HowTo::Debugging (from Perl distribution Perinci-CmdLine), released on 2026-03-30. |
| 24 |
|
| 25 |
=head1 DESCRIPTION |
| 26 |
|
| 27 |
If you encounter issues with Perinci::CmdLine, you can try these things to aid |
| 28 |
with debugging: |
| 29 |
|
| 30 |
B<Increase log level.> Perinci::CmdLine uses L<Log::ger>. If your command-line |
| 31 |
object is instantiated with C<log> attribute set to true, you just need to |
| 32 |
specify C<--verbose>, C<--debug>, or C<--trace> command-line options to see more |
| 33 |
logging statements: |
| 34 |
|
| 35 |
% your-cli --verbose ... |
| 36 |
% your-cli --debug ... |
| 37 |
% your-cli --trace ... |
| 38 |
% your-cli --log-level trace ... ;# ditto |
| 39 |
|
| 40 |
If your command-line object is not instantiated with C<log> attribute set to |
| 41 |
true, you can enable logging with: |
| 42 |
|
| 43 |
% PERL5OPT=-MLog::ger::Screen LOG_LEVEL=info your-cli ... |
| 44 |
% PERL5OPT=-MLog::ger::Screen DEBUG=1 your-cli ... |
| 45 |
% PERL5OPT=-MLog::ger::Screen TRACE=1 your-cli ... |
| 46 |
|
| 47 |
B<Dump parsed arguments, internal data structures.> If seeing log statements |
| 48 |
does not give clue, you can try dumping various data structures. This can be |
| 49 |
done with plugins. For example, to dump parsed command-line arguments after |
| 50 |
validation and then exit, you can use the following command (setting log level |
| 51 |
to trace is helpful to see the program flow and at what points the plugins are |
| 52 |
triggered): |
| 53 |
|
| 54 |
% PERINCI_CMDLINE_PLUGINS=-DumpArgs,-Exit@after_validate_args your-cli --trace ... |
| 55 |
|
| 56 |
B<Logging other components.> See L<Log::ger::For::LWP>, |
| 57 |
L<Log::ger::For::HTTP::Tiny>, L<Log::ger::For::DBI>, L<Log::ger::DBI::Query>. |
| 58 |
|
| 59 |
=head1 HOMEPAGE |
| 60 |
|
| 61 |
Please visit the project's homepage at L<https://metacpan.org/release/Perinci-CmdLine>. |
| 62 |
|
| 63 |
=head1 SOURCE |
| 64 |
|
| 65 |
Source repository is at L<https://github.com/perlancar/perl-Perinci-CmdLine>. |
| 66 |
|
| 67 |
=head1 SEE ALSO |
| 68 |
|
| 69 |
L<Log::ger> |
| 70 |
|
| 71 |
=head1 AUTHOR |
| 72 |
|
| 73 |
perlancar <[email protected]> |
| 74 |
|
| 75 |
=head1 CONTRIBUTING |
| 76 |
|
| 77 |
|
| 78 |
To contribute, you can send patches by email/via RT, or send pull requests on |
| 79 |
GitHub. |
| 80 |
|
| 81 |
Most of the time, you don't need to build the distribution yourself. You can |
| 82 |
simply modify the code, then test via: |
| 83 |
|
| 84 |
% prove -l |
| 85 |
|
| 86 |
If you want to build the distribution (e.g. to try to install it locally on your |
| 87 |
system), you can install L<Dist::Zilla>, |
| 88 |
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
| 89 |
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
| 90 |
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
| 91 |
that are considered a bug and can be reported to me. |
| 92 |
|
| 93 |
=head1 COPYRIGHT AND LICENSE |
| 94 |
|
| 95 |
This software is copyright (c) 2026 by perlancar <[email protected]>. |
| 96 |
|
| 97 |
This is free software; you can redistribute it and/or modify it under |
| 98 |
the same terms as the Perl 5 programming language system itself. |
| 99 |
|
| 100 |
=head1 BUGS |
| 101 |
|
| 102 |
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-CmdLine> |
| 103 |
|
| 104 |
When submitting a bug or request, please include a test-file or a |
| 105 |
patch to an existing test-file that illustrates the bug or desired |
| 106 |
feature. |
| 107 |
|
| 108 |
=cut |