devel/p5-Expect-Simple 0.04_1 DragonFly
Wrapper around the Expect module
- System
- DragonFly
- Repository
- DPorts
- Maintainer
- [email protected] (as in FreeBSD)
- License
- GPLv2+
- Categories
- devel, perl5
- Package size
- 14.5 KiB, 31.0 KiB installed
Description
Expect::Simple 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 Expect::Simple 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 /Expect::Simple/). 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 Expect::Simple object is destroyed.
In the other systems
| System | Port | Version |
|---|---|---|
| DragonFly | devel/p5-Expect-Simple | 0.04_1 |
| FreeBSD | devel/p5-Expect-Simple | 0.04_1 |
| OpenBSD | devel/p5-Expect-Simple | 0.04p1 |
| NetBSD | devel/p5-Expect-Simple | 0.04nb17 |
| HardenedBSD | devel/p5-Expect-Simple | 0.04_1 |
| GhostBSD | devel/p5-Expect-Simple | 0.04_1 |
Install
Binary package:
pkg install p5-Expect-Simple
From DPorts:
cd /usr/dports/devel/p5-Expect-Simple && make install clean