|
|
Or, use your gamerDNA username: (more...)
| ||||||
| |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
| | #1 (permalink) |
| Registered User Join Date: Jul 2006
Posts: 357
+3 Internets | PERL question So I spent a few weeks writing a client / server program in PERL to monitor logged in status, program usage, user usage here at the university I work at. I developed it on my windows machine which then decided to crap out so I figured I'd move it to my gentoo box since it has to run on a linux server anyways. The server program doesn't make any windows system calls so the code should have worked fine and it was bug free on my windows machine. But after moving it over a lot of things stopped working. Anyways the current issue is with updating the program stats database. in short what the server does is gather up every program in its monitoring list and determine how many instances are running out on the lab machines then puts the total value as the value for that piece of software in a Hash, or associative array. When it comes time to update the DB it does a foreach loop but the problem is it's not updating the DB. The loop looks like this: Code:
WHERE software="Acrobat" instead of WHERE software="Acrobat.exe" which is the name of that field in the software column. I have run out of ideas on how to get around this. Any suggestions? Sorry if I was confusing. |
| | |
| | #2 (permalink) | |
| Fires of Heaven WoW Officer Join Date: Jul 2006 Location: Irvine, CA
Posts: 157
| Quote:
Edit: you're also missing an end-parentheses in the prepare line. Edit2: Ah, in the editing area, I see you have backslashes in front of those of quotations, so that's not a problem. But it's still missing an end-parentheses. ------------------------------- Anyways, besides those syntax errors that are probably non-issues, have you tried printing out $! after those SQL calls? And have you already made a dump of %prog_numbers to make sure it contains valid data? Another (probably a non-issue) weird thing I see is that you're using '$mtime' as a column name, is that intended? Is the column name not static? Last edited by Araex : 03-24-2008 at 05:56 PM. | |
| | |
| | #3 (permalink) |
| Registered User Join Date: Jul 2006
Posts: 357
+3 Internets | sorry ya the syntax is right in the code just mis wrote it here. I use $mtime since that column varies with each minute of the hour. The %prog_numbers hash has the right information in it. Haven't tried printing out the $! though so I'll try that tomorrow. |
| | |
| | #4 (permalink) |
| a Menace Join Date: Feb 2006
Posts: 614
| I assume you have checked to ensure $ldb is actually connecting to the db. throw this in there and see if it helps: Code:
|
| | |
| | #5 (permalink) |
| Registered User Join Date: Jul 2006
Posts: 357
+3 Internets | Ya its properly connecting. I put in $showfail to check to see if the update failed by doing an If statement like Code:
|
| | |
| | #6 (permalink) |
| a Menace Join Date: Feb 2006
Posts: 614
| Well, if you print out $ldb->errstr, it should give you an immediate reason for the failure. The error text might also be in $!, not sure. If there is no db failure, than the error is most likely in the UPDATE statement. Do SELECT statements work? print out the sql command. Code:
Code:
|
| | |
| | #7 (permalink) |
| Registered User Join Date: Jul 2006
Posts: 357
+3 Internets | Thank you for all the help. I finally found out the source of the problem, the program list that I was using as the master list had hidden windows characters in them since they were created on a Windows text editor that Linux doesn't see. So that extra ^M character at the end of each line was causing all matches and updates to fail since they didn't match the program name in the DB. |
| | |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |