Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Expect::Simple 0.04

    Download button

    No screenshots available
    Downloads: 285  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Diab Jerius | More programs
    GPL / FREE
    July 21st, 2009, 17:19 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Expect::Simple description

    A wrapper around the Expect module

    Expect::Simple is a Perl 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
    characters at the end of each line in the result (on UNIX at least). This is easily fixed:

     ($res = $obj->before) =~ tr/
    //d;
     @lines = split( "
    ", $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.

    SYNOPSIS

     use Expect::Simple;

     my $obj = new Expect::Simple
     { Cmd => [ dmcoords => 'verbose=1', "infile=$infile"],
     Prompt => [ -re => 'dmcoords>:s+' ],
     DisconnectCmd => 'q',
     Verbose => 0,
     Debug => 0,
     Timeout => 100
     };

     $obj->send( $cmd );
     print $obj->before;
     print $obj->after;
     print $obj->match_str, "
    ";
     print $obj->match_idx, "
    ";
     print $obj->error_expect;
     print $obj->error;

     $expect_object = $obj->expect_handle;



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Expect wrapper | Perl wrapper | Perl module | Expect | Perl | wrapper

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM