Printing to browser while waiting for Net Telnet to releasecontr ol

2002-07-04 Thread Sundara Rajan

Hi
I have a Perl script that runs as CGI and uses Net::Telnet to connect to a
UNIX machine and execute a set of tasks. The system works except that the
user has to wait for the some time for the browser to show up something (it
waits till the control is returned from the Telnet process) . Part of the
code is as below.
Is there a better of way doing this so that user is not kept in suspense for
the duration of the processing?

Thanks 
Sundar

#
Code


use strict;
use Net::Telnet;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $query = new CGI;
print $query-header;
print $query-start_html(Clean Up Servers.);

my $ServerOS =  $query-param(OSType);
my $ServerName   =  $query-param(ServerName);


my $Username = ;
my $Password = x;


fCleanUpOldInstances($ServerName , $Username,$Password);


print $query-end_html;


sub fCleanUpOldInstances {

my ($Host,$User,$Password) = @_ ;
my $SiebProcFlag = 0;
my $GtwyProcFlag = 0;
my $SourceCmd = source \/export\/home\/siebel\/siebsrvr\/siebenv.csh;
my $GtwySourceCmd = source
\/export\/home\/siebel\/gtwysrvr\/siebenv.csh;

# Create a new object
my $telnet = new Net::Telnet (
timeout=240,Errmode='die',Prompt='/[\$%#] $/');

# Open connections and log in
$telnet-open($Host);
#debug print done\n;
$telnet-login($User, $Password);

# Check if the Siebel processes are running
my @lines = $telnet-cmd(ps -ef | grep sieb);
print The outpuit of ps -ef | grep sieb is @lines\nbr;

foreach (@lines) {
if (m/siebsvc -s siebsrvr/i) {
print Siebel Process - $_br\n  ; 
   $SiebProcFlag = 1; 
}

if (m/siebsvc -s gtwyns/i) {
print bGateway Process - $_br\n  ;
   $GtwyProcFlag = 1; 
}
 
}

   

# Delete directories
$telnet-cmd(unalias rm);

foreach(@DirToDelete) {
DeleteDir($_,$telnet);
}

@lines = $telnet-cmd(ps -ef | grep sieb);
print b@lines\n/bbr;

  


$telnet-close($Host);

   

}

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Sockets tutorial

2002-05-22 Thread Sundara Rajan

If you are used to C , then Advanced Perl Programming by Sriram Srinivasan
from O'Relly's is a good bet. He makes constant reference to C/Java , so it
will help. You can check out this site for a rushy kind of example on how to
use IO-Socket. Another source is the IO-Socket perldoc
http://www.perlfect.com/articles/sockets.shtml
-Original Message-
From: Tim Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 3:17 PM
To: perl-win32-user
Subject: Sockets tutorial


Hi all!
I'm rather new to perl and even newer to sockets(even though i have been
programming a very long time!). i've tryed to write apps in c, but failed
because of the absence of a good tutorial. shurly it isn't that hard to
create a conection to an other IP and send/receive info!
Any help would be very helpful
TIA ;)
Tim

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Doubt in DB_File module

2002-05-13 Thread Sundara Rajan

Ponnam
The file you are trying to create already exists as a text file and so
cannot be created as a DB - which is why it fails. Open the team.txt first
and pass the value into a hash/array/variables first and then push values
into the  db. the db should be called something else. 
se warnings ;
use strict ;
use DB_File ;
use Fcntl ;
our ($dotdir, $HISTORY, %hist_db,$user, $team) ;
# you'll get the values below from a text file into anything here i've
shown a hash
my %hist = (abnsb =asghghas, asggsag= sshghs);
$dotdir = c:\\whatever;
$HISTORY = $dotdir\\team.dbm;
tie %hist_db, 'DB_File', $HISTORY
or die Cannot open $HISTORY: $!\n ;;
foreach $user (keys %hist) {

$hist_db{$user}=$hist{$user};
}
# Dump the complete database
while ( ($user, $team) = each %hist_db ) {
print $user, $team\n ;
}
untie %hist_db ;


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 5:01 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Doubt in DB_File module


Dear friends,
When i  am trying to process the flat database using the DB_File
, it is giving the error like this ,
  Cannot open C:\CC-LIC-USAGE\teams.txt: File exists

How will i get the values from the existing file. Is it possible
or not.
Expecting your valuable suggestions. Please ...


CODE

Contents in the teams.txt file

pons  TEAM1
ram   team2

 use warnings ;
use strict ;
use DB_File ;
use Fcntl ;
our ($dotdir, $HISTORY, %hist_db, $user, $team) ;
$dotdir = C:\\CC-LIC-USAGE;
$HISTORY = $dotdir\\teams.txt;
tie %hist_db, 'DB_File', $HISTORY
or die Cannot open $HISTORY: $!\n ;;
# Dump the complete database
while ( ($user, $team) = each %hist_db ) {
print $user, $team\n ;
}
untie %hist_db ;



Expecting  your wishes,
Pons.

Ponnambalam. M.A.
Philips Medical Systems,
Philips Innovation Campus,
#1,Murphy Road, Ulsoor.
Bangalore - 560008. INDIA
Phone : +91- 080 - 557 9000 Extn: 1013
E-mail: [EMAIL PROTECTED]


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Re: Preferred PERL Editor

2002-05-13 Thread Sundara Rajan

The site URL is/was right but it seems to have got hacked or something ...i
know this seems odder but try http://www.lost-sunglasses.de/ I just tried
it and it seems to work

-Original Message-
From: Abner, Daniel [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 11:58 PM
To: 'Mark Bergeron'; [EMAIL PROTECTED]
Subject: RE: Re: Preferred PERL Editor


Mark -

The link you sent for open-perl-ide is not a perl site at all.  It redirects
you to a ridiculous site that has pop up window after pop up window.  The
content didn't appear to have anything to do with programming at all...

Did you miss type the url?

Dan.


-Original Message-
From: Mark Bergeron [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: Re: Preferred PERL Editor


I haven't ever used TextPad. But, I have used and are using; Crimson Edit
(syntax highlighting, block and bracket matching and you can tie Perl right
into it. it's free), NoteTab Light (fast, nicely customizable, not a lot of
advanced features for the free one but hey! free). Then there is Open Perl
IDE http://open-perl-ide.sorceforge.net. Win32 only I believe. Write code,
debug code, etc... (also free). Between these I can get just about anything
done. I've also used MultiEdit but that's gonna cost you 100 bucks or so.
Not bad though.

My 2 cents,
Mark Bergeron

-Original Message-
From: Lee Goddard[EMAIL PROTECTED]
To: John Deighan[EMAIL PROTECTED],
[EMAIL PROTECTED]
Date: Fri May 10 01:48:24 PDT 2002
Subject: Re: Preferred PERL Editor

At 13:01 09/05/2002 -0500, John Deighan wrote:
I would vote for TextPad. However, I have a different twist on this 
question. Is there an editor, with similar features as TextPad and 
UltraEdit, that runs both on Windows and on Linux? That would be most 
useful to me. I guess XEmacs may be one, but I've never used it.

Textpad have been promising such a version for over a year now :-(

Lee Goddard
perl -e while(1){print rand0.5 ? chr 47 : chr 92}

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
GO.com Mail
Get Your Free, Private E-mail at http://mail.go.com


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Clearcase::SyncTree - Error - Please help me

2002-05-04 Thread Sundara Rajan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 04, 2002 12:17 PM
To: Sisyphus
Cc: [EMAIL PROTECTED]
Subject: Re: Clearcase::SyncTree - Error - Please help me


Dear Sisyphus,
Thanks for ur reply.
I have already installed the module
Clearcase::Argv   .
Please let me know, shall i have to install any other
modules like Argv .
Moreover , both Clearcase::Argv and Argv are the different
modules  ?
   Please ...

Expecting  your wishes,
Pons.

Ponnambalam. M.A.
Philips Medical Systems,
Philips Innovation Campus,
#1,Murphy Road, Ulsoor.
Bangalore - 560008. INDIA
Phone : +91- 080 - 557 9000 Extn: 1013
E-mail: [EMAIL PROTECTED]



 

  Sisyphus

  kalinabears@hdc To:  Ponnam
Balam/BTC/MS/PHILIPS@EMEA2 
  .com.au  [EMAIL PROTECTED]

   cc:
[EMAIL PROTECTED]   
  05/05/02 04:44   Subject:   Re:
Clearcase::SyncTree  - Error  - Please help me  
  PM

   Classification:

 

 






- Original Message -
From: [EMAIL PROTECTED]


 C:\perl
 use Clearcase::Argv;
 Can't locate Argv.pm in @INC (@INC contains: c:/Perl/lib c:/Perl/site/lib
.) at c:
 /Perl/site/lib/Clearcase/Argv.pm line 5.

This would indicate to me that line 5 of Clearcase/Argv.pm contains:
use Argv;

And that Argv.pm cannot be found in any of the directories specified in
@INC.

You also need to install the module Argv.pm - which is also available from
AS as a ppm.
(There are 2 packages - Clearcase::Argv *and* Argv. And you need *both* of
them.)

Cheers,
Rob





___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



there's a clearcase-argv and a argv module (like rob says above), the
clearcase-argv being a sub class of argv . you could run a search on cpan
for both  if you want to run a check 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: 2 Beginner questions, please help

2002-04-13 Thread Sundara Rajan

-Original Message-
From: Pankaj Agarwal [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 10:21 PM
To: [EMAIL PROTECTED]
Subject: 2 Beginner questions, please help


Hi All,
 
 I am just starting on it and kind of overwhelmed
 with
 the amazing capabilities of perl, how ever for now I
 
 have 2 questions :
 
 Q1) while(){
$data=$data . $_;
print $data;
print loop\n
 }
 
 and calling it like this c:\perl simple.pl data.txt
 it should print all the lines of data.txt once but
 it
 doesn't but it print all the lines 2-3 times before
 next ?
 
 Q2)i want to write a foreach sort of loop such that
 for each pattern matched, it should return me the
 exact data matched for ex. :
 
 $data contains :
 abc xyz
 def ghj
 vbn xy
 
 and pattern is /xy/
 
 then loop shud be such that at each repetition 
 some local variable should be set to each matched
 word
 like in this case in first pass $local should be set
 to xyz then in next pass xy
 
 Thanks for ur time.

__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Pankaj
I suppose you must have got enough replies on this one.
for Q1 - I suppose that you are opening you data.txt file with open/sysopen
etc and then the piece of code follows.I'm not sure what you are attempting
here , is it something like
 $file = $ARGV[0] (get the data.txt name);
open (DATA, $file);
while (DATA){
print $_\n;
}
close(DATA);

will print all line of data.txt for you.

For Q2 _ I don't believe I understood completely what you are trying to do
so this could be OT but

$file = $ARGV[0] (get the data.txt name);
open (DATA, $file);
while (DATA){
print $_\n;
if (/xy/){
# do something
}
}
close(DATA);

is this it?

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Telnet on Win32

2002-04-10 Thread Sundara Rajan

The code seems fine. The issue must be with your prompt. It may help and see
if the regex /[\$%#] $/, covers your prompt or not. For example my prompt
on Solaris is 5.8 MachineName{UserName}/ so your script works

-Original Message-
From: Lillianne Dykstra [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 9:38 PM
To: '[EMAIL PROTECTED]'
Subject: Telnet on Win32


Hi All!

I am having problems executing a simple telnet session on Windows 2000.  It
appears that it does not like my prompt.  It times-out and then objects to
line 15 of the code (the login line).  Can you advise why this is not
working?

$login=ldykstra;
$pass=password;
$host=200.1.2.20;

use Net::Telnet;
$telnet = new Net::Telnet
(
 Timeout = 10,
 Prompt = '/[\$%#] $/'
 );
$telnet-open($host);

$telnet-login($login,$pass);
@listing= $telnet-cmd(ls);
print @listing;
print \n;
$telnet-close;

Lillianne Dykstra
Information Technology Manager
North Coast Medical
18305 Sutter Blvd. Morgan Hill, CA 95037
408-776-5000 x157
1-800-821-9319
[EMAIL PROTECTED]


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Telnet on Win32

2002-04-10 Thread Sundara Rajan

I use a good bit of Net::Telnet on a variety of UNIX servers - the only
issue I've had is when the prompts were different. And yes, it's a good idea
to turn on the log for input and output.

-Original Message-
From: Moulder, Glen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 9:45 PM
To: Lillianne Dykstra
Cc: perl-win32-users
Subject: RE: Telnet on Win32



Hi,

I've been doing a lot of work on my LAN lately, trying to establish
connections between my PC and the server and conduct operations on the
server.  I beat my head on Net::Telnet (in an environment similar to yours)
for over a week and finally gave up, opting for Net::FTP instead which is
much friendlier.  Seems that it's not the prompt that Telnet doesn't like,
it's all the weird line separators in the output (look at the dump of
output_log to see what I mean).  Caveat:  I'm having a problem with running
commands through Net::FTP-quot() also, so beware (see my post just prior to
yours).

Glen


 -Original Message-
 From: Lillianne Dykstra [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, April 10, 2002 4:38 PM
 To: '[EMAIL PROTECTED]'
 Subject: Telnet on Win32
 
 
 Hi All!
 
 I am having problems executing a simple telnet session on 
 Windows 2000.  It appears that it does not like my prompt.  
 It times-out and then objects to line 15 of the code (the 
 login line).  Can you advise why this is not working?
 
 $login=ldykstra;
 $pass=password;
 $host=200.1.2.20;
 
 use Net::Telnet;
 $telnet = new Net::Telnet
 (
  Timeout = 10,
  Prompt = '/[\$%#] $/'
  );
 $telnet-open($host);
 
 $telnet-login($login,$pass);
 @listing= $telnet-cmd(ls);
 print @listing;
 print \n;
 $telnet-close;
 
 Lillianne Dykstra
 Information Technology Manager
 North Coast Medical
 18305 Sutter Blvd. Morgan Hill, CA 95037
 408-776-5000 x157
 1-800-821-9319
 [EMAIL PROTECTED]
 
 
 ___
 Perl-Win32-Users mailing list 
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs