|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: confused with error while using ct_sql
Date: Nov 10 1998 1:07AM
I really don't know what the problem is here.
I suggest the following:
use Data::Dumper;
...
print Dumper(\@rows), "\n";
...
to see what the real structure of the @rows array is...
Michael
John_Erjavec@cargill.com writes:
> All-
>
> I am building an app that is going to ensure that our DSI threads are
> down for as little time as possible. (OK, I am rewriting an app...)
> I am trying to take example code from the docs, and modify it, since
> I am new to writing sybperl apps. The following is the main chunk of
> code that is causing the error:
>
> =================CODE CHUNK======================
> $X = Sybase::CTlib->ct_connect($uid, $pwd, $srv, $app);
>
> @rows = $X->ct_sql("admin who", undef, 1) || die "execute failed!";
> foreach $row_ref (@rows) {
> if (($$row_ref{'Name'} eq "DSI") &&
> ($$row_ref{'Info'} =~ /.+\..+/)) {
> print "Name: ", $$row_ref{'Name'}, "\n";
> print "Info: ", $$row_ref{'Info'}, "\n";
> }
> }
> =================CODE CHUNK======================
>
> It is giving me the following error (under -w and use diagnostics):
>
> =================ERROR===========================
> Argument "DSI EXEC " isn't numeric in helem at ./who_test line 18
> (#1)
>
> (W) The indicated string was fed as an argument to an operator
> that
> expected a numeric value instead. If you're fortunate the
> message
> will identify which operator was so unfortunate.
>
> Bad index while coercing array into hash at ./who_test line 18 (#2)
>
> (F) The index looked up in the hash found as the 0'th element of
> a
> pseudo-hash is not legal. Index values must be at 1 or greater.
> See perlref.
>
> Uncaught exception from user code:
> Bad index while coercing array into hash at ./who_test line
> 18.
> =================ERROR===========================
>
> Now, I'm not sure where the problem is, since I am not doing any
> numeric tests, and I know that the keys 'Name' and 'Info' do exist
> since I checked under perl -d. Anyone have an idea what I am doing
> wrong here? Also, if you have a better way of doing what I am trying
> to do, I would appreciate it. Right now, I am spawning an isql
> process, feeding it the SQL, and parsing the output. The parsing is
> done with regular expressions, and they can get pretty nasty for some
> people. I am specifically checking to see if any of the DSI threads
> are down or suspended, and then I will take the appropriate action,
> depending. (The code above does not check for 'Down' or 'Suspended',
> but this is just a first pass to make sure that this part is working,
> which it is not. :( )
>
> Anyway, any help is appreciated.
>
> -JEV
> John Erjavec V
> Sybase DBA
> Cargill, Inc.
> john_erjavec@cargill.com
>
>
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
|