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 03:07 AM
help: error in installing perl module DBD::mysql Yogesh Sawant UNIX and Linux Applications 3 11-05-2007 04:22 AM
error connecting database from perl DILEEP410 Shell Programming and Scripting 4 09-17-2007 05:03 AM
xml parsing error in perl bishweshwar UNIX for Advanced & Expert Users 1 05-30-2007 07:59 PM
Error with perl scripts... Amardeep SUN Solaris 1 06-19-2006 06:07 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-23-2008
Registered User
 

Join Date: Apr 2007
Posts: 23
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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-23-2008 at 11:04 PM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-24-2008
Registered User
 

Join Date: Apr 2008
Posts: 4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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;
Reply With Quote
  #3 (permalink)  
Old 04-24-2008
Registered User
 

Join Date: Apr 2007
Posts: 23
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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.
Reply With Quote
  #4 (permalink)  
Old 04-24-2008
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,387
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Perl cannot find the Net::Telnet module. Where did you install it?
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
"inappropriate ioctl for device" 421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash exec bash for loop command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix export command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix interview questions unix simulator unix.com vi select all vi substitute vi+substitute+end+of+line+character while loop within while loop shell script


All times are GMT -7. The time now is 04:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101