But does someone have a proposal how to capture the STDERR output of the
batch script, too?
Up to now, I only could capture the STDOUT output via
@Result=`command line`
and I would like to capture both, ideally in the same array to get the
correct order...
Kind regards
Ekbert Mertens
> > Hi List,
> >
> > I have a script which is running another batch script on a
> NT machine.
> > During the perl script execution, I am not seeing the
> output of the dos
> > batch script on the screen. Some how its getting lost. Any
> Idea as how can
> I
> > change my script to display the dos script output as well??
> >
> > The requirement is to get the details such as hostname and
> NT user login
> by
> > the ip and update a database. Is there any perl modules
> available to that.
> I
> > always have the IP and would like to know what's the
> hostname and the NT
> > user logged in to that host.
> >
> > The script is as below
> >
> > #!/usr/local/ActivePerl-5.6/bin/perl
> > use Sybase::CTlib;
> >
> >
> > $dbh = Sybase::CTlib->ct_connect('user','pwd','server');
> > if($dbh eq undef)
> > {
> > print "Connection Failed to Server\n";
> > }
> > else
> > {
> > print "Connection OK to Server\n";
> > $sql = "select ipaddr from db..Logins where loggedindatetime >=
> > dateadd(hour,-1,getdate())";
> > $data = $dbh->ct_sql("$sql");
> > foreach $r (@$data)
> > {
> > foreach $c (@$r)
> > {
> > print "$c \t";
> > `c:/tmp/test.cmd /i $c`;
> > }
> > print "\n";
> > }
> > }
>
> Try capturing the results of the command. Add this line after the use
> statement:
>
> my @Results = ();
>
> The change your:
>
> `c:/tmp/test.cmd /i $c`;
>
> To:
>
> @Results = `c:/tmp/test.cmd /i $c`;
>
> Then you can access and parse the results contained in the array.
>
> Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters
> USA Central Time Zone
> 636-922-9158 ext. 8652 fax 636-447-4471
>
> [EMAIL PROTECTED]
> www.nisc.cc
>
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs