Text::Markup::Cmd(3pm)

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

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

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.

Interface

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

Author
David E. Wheeler <david@justatheory.com>

Copyright and License
Copyright (c) 2012-2025 David E. Wheeler. Some Rights Reserved.

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