P5-expect-simple

Jul 20, 2023

Wrapper around the Expect module

ExpectSimple is a wrapper around the Expect module which should suffice for simple applications. It hides most of the Expect machinery; the Expect object is available for tweaking if need be.

Generally, one starts by creating an ExpectSimple object using new. This will start up the target program, and will wait until one of the specified prompts is output by the target. At that point the caller should send commands to the program; the results are available via the before, after, match_str, and match_idx methods. Since Expect simulates a terminal, there will be extra \r characters at the end of each line in the result on UNIX at least. This is easily fixed

$res = $obj->before =~ tr/\r//d;
@lines = split "\n", $res ;

This is not done automatically.

Exceptions will be thrown on error match with /ExpectSimple/. Errors from Expect are available via the error_expect method. More human readable errors are available via the error method.

The connection is automatically broken by sending the specified disconnect command to the target when the ExpectSimple object is destroyed.



Checkout these related ports:
  • Zziplib - Library to provide transparent read access to zipped files
  • Zydis - Fast and lightweight x86/x86-64 disassembler library
  • Zycore-c - Support library with platform independent types, macros, etc for Zydis
  • Zthread - Platform-independent object-oriented C++ threading library
  • Zookeeper - Coordination Service for Distributed Applications
  • Zls - Zig LSP implementation + Zig Language Server
  • Zfp - High throughput library for compressed floating-point arrays
  • Zeal - Offline documentation browser
  • Zapcc - C++ caching compiler based on clang
  • Zanata-platform - Web-based translation platform
  • Zanata-cli - Zanata Java command line client
  • Z88dk - Complete Z80/Z180 development kit
  • Z80ex - ZiLOG Z80 CPU emulator library
  • Z80asm - Assembler for the Z80 microprocessor
  • Z80-asm - Z80 assembly code assembler and disassembler