in reply to Re: Interactive Input without Expect.pm
in thread Interactive Input without Expect.pm

Ummm.. I hadnt really thought about that. How would I include the module's source into my code? And doesnt Expect require the Tty and Pty modules as well?

-chris

  • Comment on Re: Re: Interactive Input without Expect.pm

Replies are listed 'Best First'.
Re: Re: Re: Interactive Input without Expect.pm
by dragonchild (Archbishop) on May 24, 2004 at 17:46 UTC
    You've never looked at the source code of a CPAN module before? Get thee hence to /usr/local/lib/perl5/site_perl/5.8.0/ and read, man!

    More, usefully, you could do the following:

    1. Download the tarball
    2. Unpack it into the distros directory under your home directory
    3. Browse the source (it's in the lib/ directory)

    Yeah, Expect uses IO::Pty and IO::Tty. IO::Pty uses IO::Tty. It looks like they're all PurePerl and that the non-core dependencies stop there.

    As for putting them into your script ... literally cut'n'paste the entire .pm below your source code. Something like:

    #!/usr/local/bin/perl use strict; $|++; # My code here # Do not put any use statements!! You've already "used" the modules package Expect; # blahblahblah package IO::Tty # blahblahblah 1;

    Note: This will bloat the size of your script to about 10k lines. Hope you're paid by the KB! :-)

    Another option would be to bundle Expect and IO-Tty in with your code as a distribution to be installed. Just install those modules in the same directory as your script(s). *shrugs*

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      Yeah, Expect uses IO::Pty and IO::Tty. IO::Pty uses IO::Tty. It looks like they're all PurePerl and that the non-core dependencies stop there.
      Maybe to a blind man :) http://search.cpan.org/src/RGIERSIG/IO-Tty-1.02/
       ChangeLog               02-Apr-2002 06:29  6.1K  
       MANIFEST                19-Nov-2001 10:09   71   
       Makefile.PL             02-Apr-2002 06:29   11K  
       Pty.pm                  02-Apr-2002 06:29  8.3K  
       README                  13-Mar-2002 06:40  2.3K  
       Tty.pm                  02-Apr-2002 06:29  7.1K  
       Tty.xs                  06-Mar-2002 07:47   21K  
       test.pl                 01-Mar-2002 10:14  6.4K  
       try                     26-Feb-2002 06:42  2.8K  
      

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.