473,396 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

The script works in debug mode and doesn't in run mode

Hi,

here is my script:
Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl -d 
  2. use Net::Telnet; 
  3.  
  4. my $res = ""; 
  5.  
  6. my $ip = "10.120.7.95"; 
  7. my $user = "autorun"; 
  8. my $pass = "autorun"; 
  9. my $env = "stam"; 
  10.  
  11. $tnt = Net::Telnet->new 
  12. ( Timeout => 60, 
  13. Prompt => '/.*(>|\$|\#|:)\s*/', 
  14. Errmode=>'die' ) 
  15. or $res = "ERROR: Could not initialize telnet: $!"; 
  16.  
  17. $tnt->open ($ip) or $res .= "ERROR: Could not open connection to $ip: $!"; 
  18.  
  19. $tnt->login($user,$pass) or $res .= "ERROR: Could not login to $ip: $user with $pass $!"; 
  20.  
  21. $tnt->waitfor('/.*(>|\$|\#|:)\s*/'); 
  22.  
  23. if ($res eq "") 
  24. &Cmd("ls >stam"); 
  25. if ($res =~ /Error/i) { print $res; } 
  26.  
  27.  
  28. sub Cmd { 
  29. print ">cmd\n"; 
  30. my $cmd = shift; 
  31. $tnt->buffer_empty; 
  32. print $tnt->cmd("cd autotest"); 
  33. print $tnt->cmd("setenv DISPLAY $ip:0.0"); 
  34. print $tnt->cmd($cmd); 
  35. print "<cmd\n"; 
  36.  
If I run the script in debug mode, it works perfectly if even I give "c" option (it creates stam file), but if I try to run it without -d option, it doesn't create the file (no error messages)

What is wrong? What is so different between running in debug mode?

Thanks in advance
Jul 16 '08 #1
3 3886
numberwhun
3,509 Expert Mod 2GB
Before we go trying to troubleshoot this, take the -d off so it is not in debug mode and add the following lines directly after the shebang line:

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3.  
Once you correct the errors reported by those two pragmas (which will be syntactical and the like), then we can get down to the real errors.

Regards,

Jeff
Jul 16 '08 #2
p1qb0d
2
The same issue with the same module Net::Telnet.

My script has "use strict; use warnings;". There are no errors in the script.

It works under debugger and doesn't work in the flat run (the function getlines returns only one string instead of 25 under debugger).

Perl 5.8.8 under CentOS 5.11, perl-Net-Telnet-3.03-5.

The main excerpt:

Expand|Select|Wrap|Line Numbers
  1. @lines = $t->getlines(All => 0);
May 25 '16 #3
RonB
589 Expert Mod 512MB
Please don't hyjack an 8 year old thread. Start a new one and make sure it includes a short but complete script that demonstrates the problem and includes all errors/warnings it generates.
May 25 '16 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: FLOTServer | last post by:
Here's my problem: I run a gameserver that runs the game "Medal of Honor". On the game server is log file which contains all of the data from the players for that day (kills, deaths, etc...). I...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
3
by: jt | last post by:
For some stupid reason, I can't get this to work in Release mode, but works well in Debug mode. Below is the function: Here is the line: pos=strpos(pszCmdLine,cmdLineStr); // in release mode...
21
by: Phil Powell | last post by:
<script type=\"text/javascript\"> <!-- var browserArray = new Array(\"Microsoft Internet Explorer\", \"Netscape\"); if (browserArray.in_array(navigator.appName, browserArray) &&...
1
by: Ethan Strauss | last post by:
Hi, I have a C#.net Web application which calls a web service (http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl). It has run just fine for months. Recently I started getting...
5
by: Bjorn Sagbakken | last post by:
Hello I have just migrated from VS 2003 to VS 2005, and .NET framework 1.1 to 2.0 I am at the end of debugging and fixing stuff. Now there is one error I just cannot find a solution to: On...
4
by: dbee | last post by:
Right. I've got a really, really annoying/difficult/time consuming problem with my development environment. I'm using django to build a web app with paypal integration. My server is hosted...
2
by: Dave Johansen | last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio 2005 and the Debug mode seems to be running just fine, but the Release mode crashes on the following code: std::ifstream...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.