The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Run perl file in Crontab error. raccsdl Shell Programming and Scripting 2 11-13-2007 07:07 AM
help: error in installing perl module DBD::mysql Yogesh Sawant UNIX and Linux Applications 3 11-05-2007 08:22 AM
error connecting database from perl DILEEP410 Shell Programming and Scripting 4 09-17-2007 09:03 AM
xml parsing error in perl bishweshwar UNIX for Advanced & Expert Users 1 05-30-2007 11:59 PM
Error with perl scripts... Amardeep SUN Solaris 1 06-19-2006 10:07 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-24-2008
Asteroid Asteroid is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 38
PERL Error

hi,

I am trying following TELNET script on SunOS terminal01 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Blade-100.

I am stuck up due to an Error I cannot fix out. please can some one here can help me out. I must be thankful.


code:

Quote:
#
# A Telnet SCRIPT
#
# REMOTE TELNET FETCH UPTIME
#

#!/usr/bin/perl -w
clear();
echo "***************************************\n";
echo "***** A Telnet Script ***** \n";
echo "***************************************\n\n";
echo "TELNET Tunnels in progress, Hold on. \n";

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die');
$telnet->open('100.400.400.600');
$telnet->waitfor('/login: $/i');
$telnet->print('root');
$telnet->waitfor('/Password: $/i');
$telnet->print('xxxxxxxx');
$telnet->waitfor('/# $/i');
$telnet->print('uname -a');
$output = $telnet->waitfor('/# $/i');
print $output;
Error
Quote:
/data/script.pl: use: not found
/data/script.pl: syntax error at line 15: `(' unexpected

output for perl -V

Quote:
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos localhost 5.8 sun4u sparc sunw,ultra-1 '
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-xO3 -xdepend', gccversion=
cppflags=''
ccflags =''
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R /usr/perl5/5.00503/sun4-solaris/CORE'
cccdlflags='-KPIC', lddlflags='-G'


Characteristics of this binary (from libperl):
Built under solaris
Compiled at Dec 22 1999 00:00:57
@INC:
/usr/perl5/5.00503/sun4-solaris
/usr/perl5/5.00503
/usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site_perl/5.005
THX and REgards

Last edited by Asteroid; 04-24-2008 at 03:04 AM..
  #2 (permalink)  
Old 04-24-2008
googling2000 googling2000 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 4
Hi there, I've been using perl for a number of years and haven't come across the use of echo, is it a sub in your script?

Anyway, when I did a
perl -c yourscript.pl
I got a bunch of errors around the echo statements.

As a quick test, if you just do this, in bold below, and try again.

#!/usr/bin/perl -w
clear();
=comment
echo "***************************************\n";
echo "***** A Telnet Script ***** \n";
echo "***************************************\n\n";
echo "TELNET Tunnels in progress, Hold on. \n";
=cut
use Net::Telnet;
  #3 (permalink)  
Old 04-25-2008
Asteroid Asteroid is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 38
THX googling for the idea. Actually I am new at PERL, so did some stupid mistakes.

Anyways It is working now, but now I am facing some more errors. I a hopefull some one hehe can really help me out.

Quote:
Can't locate Net/Telnet.pm in @INC (@INC contains: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at /data/script.pl line 14.
BEGIN failed--compilation aborted at /data/script.pl line 14.
  #4 (permalink)  
Old 04-25-2008
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
Perl cannot find the Net::Telnet module. Where did you install it?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0