Term::CmdLine

Command-line interface module using Term::ReadLine with built-in commands, history management, variable interpolation, and command completion.

Installation

To install this module, run the following commands:

perl Makefile.PL
make
make test
make install

Dependencies

This module requires these other modules and libraries:

Usage

use Term::CmdLine;

my %cmds = (
  list => {
    help        => 'list [options]',
    description => 'List items',
  },
  execute => {
    help        => 'execute <cmd>',
    description => 'Execute a command',
  },
);

my $cmdline = Term::CmdLine->new('myapp', undef, %cmds);

while (my ($cmd, $result) = $cmdline->get) {
  last if $cmd eq 'exit';
  # Process your commands here
}

Features

Author

Andrew DeFaria Andrew@DeFaria.com

License

This module is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Copyright (C) 2011-2026 Andrew DeFaria