Code::TidyAll::Role::RunsCommand(3pm)

NAME
Code::TidyAll::Role::RunsCommand - A role for plugins which run external commands

VERSION
version 0.85

SYNOPSIS
    package Whatever;
    use Moo;
    with 'Code::TidyAll::Role::RunsCommand';

DESCRIPTION
This is a a role for plugins which run external commands

ATTRIBUTES

cmd The command to run. This is just the executable and should not include additional arguments.

METHODS

  _run_or_die(@argv)
This method run the plugin's command, combining any values provided to the plugin's "argv" attribute with those passed to the method.

The plugin's "argv" attribute is parsed with the "shellwords" subroutine from Text::ParseWords in order to turn the "argv" string into a list. This ensures that running the command does not spawn an external shell.

The @argv passed to the command comes after the values from "argv" attribute. The assumption is that this will be what passes a file or source string to the external command.

If the command exits with a non-zero status, then this method throws an exception. The error message it throws include the command that was run (with arguments), the exit status, any signal received by the command, and the command's output.

Both "stdout" and "stderr" from the command are combined into a single string returned by the method.

  _is_bad_exit_code($code)
This method returns true if the exit code is bad and false otherwise. By default all non-zero codes are bad, but some programs may be expected to exit non-0 when they encounter validation/tidying issues.

SUPPORT
Bugs may be submitted at <https://github.com/houseabsolute/perl-code-tidyall/issues>.

SOURCE
The source code repository for Code-TidyAll can be found at <https://github.com/houseabsolute/perl-code-tidyall>.

AUTHORS

•   Jonathan Swartz <swartz@pobox.com>

•   Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE
This software is copyright (c) 2011 - 2025 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

The full text of the license can be found in the LICENSE file included with this distribution.