[ SYSTEM ]: Linux srv.persadacompanies.com 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
[ SERVER ]: Apache | PHP: 8.4.20
[ USER ]: persadamedika | IP: 45.64.1.108
GEFORCE FILE MANAGER
/
usr
/
share
/
doc
/
perl-Expect
/
tutorial
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📄 1.A.Intro
2,428 B
SET
[ EDIT ]
|
[ DEL ]
📄 2.A.ftp
3,085 B
SET
[ EDIT ]
|
[ DEL ]
📄 2.B.rlogin
4,043 B
SET
[ EDIT ]
|
[ DEL ]
📄 3.A.debugging
1,973 B
SET
[ EDIT ]
|
[ DEL ]
📄 4.A.top
928 B
SET
[ EDIT ]
|
[ DEL ]
📄 5.A.top
1,139 B
SET
[ EDIT ]
|
[ DEL ]
📄 5.B.top
2,450 B
SET
[ EDIT ]
|
[ DEL ]
📄 6.A.smtp-verify
3,260 B
SET
[ EDIT ]
|
[ DEL ]
📄 6.B.modem-init
1,833 B
SET
[ EDIT ]
|
[ DEL ]
📄 README
644 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: 3.A.debugging
#!/usr/bin/perl # This example demonstrates how to use the debugging features in #expect. They're reasonably straghtforward. # # There are 3 basic ways you can debug a script: # # 1. Log_Stdout # # By setting $Expect::Log_Stdout you control whether or not processes #will echo to the screen or not. Having it turned on can be helpful so you #can watch what a process is doing. Alternately, for a process that is already #running you can do $process->log_stdout(1); which will turn on process #output for the process from that instant on. $process->log_stdout(0) will #turn it off. # By default $Expect::Log_Stdout == 1. Initialized handles (discussed #later) may also echo to STDOUT, but they don't do so by default. You have #to manually tell them to echo. You wouldn't want your log file jabbering at #you would you? Anyway, that will make sense later. # # 2. Exp_Internal # # Setting $Exp_Internal=1 (or $process->exp_internal(1)) will output #pattern matching information for expect() calls to STDERR. You can trap #this by doing "perl expect_script.pl 2>debug.out" if you are using any of #the bourne-ish shells. For people who use csh, don't. "exec bash" will take #care of that straightaway. This is handy so program output and debugging output #don't go to the same place. # # 3. Debug # # Setting $Expect::Debug = debug level(or $process->debug(debug level)) #will show other stuff, such as pids, output during interaction, and other #miscellaneous output not covered by the above two items. In combination with #Exp_Internal you can capture a lot of good information about what your script #is doing. Debugging info also goes to STDERR. # # # This example will show (lots) of debugging info. use Expect; $Expect::Log_Stdout=1; $Expect::Debug=3; $Expect::Exp_Internal=1; # lpc is a bsd printer control program. It's included in every Unix I # deal with. $lpc = Expect->spawn("lpc"); $lpc->expect(30,"lpc> ") && print $lpc "stat\r"; $lpc->hard_close();