logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Text::Markup::Cmd - Tools for external commands

Author

       David E. Wheeler <david@justatheory.com>

Description

       Text::Markup::Cmd provides tools for Text::Markup parsers that depend on external commands, such as
       Text::Markup::Rest and Text::Markup::AsciiDoctor. Will mainly be of interest to those adding a new parser
       with such a dependency.

       InterfaceExportedFunctions"WIN32"

         my $exe = 'nerble' . (WIN32 ? '.exe' : '');

       Constant indicating whether the current runtime environment (OS) is Windows.

       "find_cmd"

         my $cmd = find_cmd(
           ['nerble' . (WIN32 ? '.exe' : ''), 'nerble.rb'],
           '--version',
       );

       Searches the path for one or more named commands. Returns the first command to be found in the path and
       which executes with the specified command line options without error. The caller must specify OS-
       appropriate spellings of the commands.

       "exec_or_die"

         exec_or_die(
             qq{Missing required Python "docutils" module},
             $PYTHON, '-c', 'import docutils',
         );

       Executes a command and its arguments. Dies with the error argument if the command fails.

       "open_pipe"

         my $fh = open_pipe(qw(nerble --as-html input.nerb));

       Executes a command and its arguments and returns a file handle opened to its "STDOUT". Dies if the
       command fails.

Name

       Text::Markup::Cmd - Tools for external commands

Synopsis

         use Text::Markup::Cmd;
         my $fh = open_pipe(qw(perl -V));

See Also