CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Code hangs when i execute

 



jithinjames
Novice

May 7, 2009, 12:35 AM

Post #1 of 15 (1304 views)
Code hangs when i execute Can't Post

Hi when i run this code it get hang. I have no idea why can you help me out. Here what it does it it should select the dates from the table $dbname.$temptables in the criteria from last day till previous 5 days.


Code
		$q = qq{select distinct date FROM $dbname.$temptables where date>date_add((select max(date) from $dbname.$temptables), INTERVAL -$min_stats_period DAY)}; 
$mysql->query($q);
if ($mysql->is_error()){print ERRORFILE "[ERROR]:<$q>".$mysql->get_error_message()."\n"};
my $record_iterator = $mysql->create_record_iterator();
while (my $record = $record_iterator->each)
{
$q = qq{delete FROM $dbname.$temptables where date='$record->[0]'
};
$mysql->query($q);
if ($mysql->is_error()){print ERRORFILE "[ERROR]:<$q>".$mysql->get_error_message()."\n"};
}



vikas.deep
User

May 7, 2009, 1:43 AM

Post #2 of 15 (1302 views)
Re: [jithinjames] Code hangs when i execute [In reply to] Can't Post

Dear friend
WIthout going into your code Just tell me about platform. I was having a similar problem and I was working on windows(Vista) every time I ran the script I got the message "Perl command line interpreter has stopped working !! Windows is checking for a solution" then Kevin. R stepped in and rightly diagnosed that I had installed two versions of Perl in one folder I have kept perl 5.8 and in another perl 5.10 even though perl-v always said "This is perl 5.10.0" but perl 5.8 was also present there May be you are having a similar problem.
-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"


jithinjames
Novice

May 7, 2009, 1:48 AM

Post #3 of 15 (1300 views)
Re: [vikas.deep] Code hangs when i execute [In reply to] Can't Post

I am using a windows XP professional machine. I the perl script in other places where i use SQL query i have no issue. it works fine. Even in this code if i replace the query with any other sql query it works fine. but really wonder why this particular query is not working. is there any compatible issue with any words in the query. coz in the query i changed the query as the follows and it worked fine.

Code
select distinct name FROM $dbname.$temptables



vikas.deep
User

May 7, 2009, 3:17 AM

Post #4 of 15 (1298 views)
Re: [jithinjames] Code hangs when i execute [In reply to] Can't Post

Again
without going into details of your code and sql query what is the perl version. I guess it can't be perl 5.8.x It must be some later version may be perl 5.10 if you say perl 5.8 then it is interesting. Also what is computer architecture 32 bits or 64 bits.
-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"


jithinjames
Novice

May 7, 2009, 4:03 AM

Post #5 of 15 (1296 views)
Re: [vikas.deep] Code hangs when i execute [In reply to] Can't Post

I am using ActivePerl 5.10.0 Build 1004

computer architecture is 32 Bits


vikas.deep
User

May 7, 2009, 5:39 AM

Post #6 of 15 (1290 views)
Re: [jithinjames] Code hangs when i execute [In reply to] Can't Post

SEE I ALWAYS SUSPECTED SO!
This is exactly what I was trying i.e run perl 5.10.x on a windows platform that too with a 32 bits architecture To which Kevin R said that "it (active perl 5.10 built for32 bit system ) is a dead horse I advice you to completely uninstal perl 5.10 from your system and use perl 5.8.x" where x should be an even number. You can check that post yourself in this very section(Beginners section)
I was also surprised to the extreme that all my scripts are working but only this one is not working and so on --. Yes there is some compatability problem here We have to accept it if you are finding it difficult to come to accept it Continue with active perl 5.10 on a 32 bit computer till another of your script fails then you will see for yourself and realize it.
-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"


FishMonger
Veteran / Moderator

May 7, 2009, 7:18 AM

Post #7 of 15 (1275 views)
Re: [vikas.deep] Code hangs when i execute [In reply to] Can't Post

I have 5.10 on 20 XP boxes in my department and have not had any problems. I don't know where Kevin got that "it is a dead horse", I'm sure p5p (perl 5 porters) would disagree. They are the ones that develop perl. The main issue is the number of available modules, which is not as extensive as the ones for 5.8.x.


(This post was edited by FishMonger on May 7, 2009, 7:19 AM)


FishMonger
Veteran / Moderator

May 7, 2009, 7:36 AM

Post #8 of 15 (1273 views)
Re: [jithinjames] Code hangs when i execute [In reply to] Can't Post

I'm willing to bet that the problem is related to the bd module you're using. I assume you're using Net::MySQL. I've seen a number of people having this ans similar issues with that module. It would be better to use DBI and DBD::mysql

http://search.cpan.org/~timb/DBI-1.608/DBI.pm
http://search.cpan.org/~capttofu/DBD-mysql-4.011/lib/DBD/mysql.pm


KevinR
Veteran


May 7, 2009, 12:47 PM

Post #9 of 15 (1271 views)
Re: [FishMonger] Code hangs when i execute [In reply to] Can't Post


In Reply To
I have 5.10 on 20 XP boxes in my department and have not had any problems. I don't know where Kevin got that "it is a dead horse", I'm sure p5p (perl 5 porters) would disagree. They are the ones that develop perl. The main issue is the number of available modules, which is not as extensive as the ones for 5.8.x.


I got it from activestate that 32 bit version of perl 5.10 are a dead horse. The perl code itself is fine but you will not find much support or modules for perl 5.10 on 32 bit Windows boxes. Persons using perl 5.10 on 32 bit Windows boxes are sort of on their own.
-------------------------------------------------


vikas.deep
User

May 7, 2009, 10:15 PM

Post #10 of 15 (1267 views)
Re: [FishMonger] Code hangs when i execute [In reply to] Can't Post

Sir,
If you say you are "ready to bet---", I backtrack simply because I am not in a position to put forth anything new. Whatever I have said is based on my experience so far and my friends in this or other (public) forums are expected to accept or reject whatever i or any body else says in good faith. Actually I faced something similar just 15-20 days back. May be what you are saying might be true or may be not I am not competent enough to say. After my problem I tell you what i did was that I shifted myself to a Linux (Fedora) machine. I am still using perl 5.8 but yes I do want to use perl 5.10 with a "switch" and "say" and other new features. In case the script that I was not able to run earlier on(Windows Vista,Activeperl5.10,32 bits architecture) works this time. At least for my purpose I would get a satisfactory answer whatever anybody(p5p developers or anybody) says.I am a learner---
I dont think that Perlguru is a betting ground and I do not want to lose my friends or money over here.Smile
-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"


KevinR
Veteran


May 7, 2009, 10:51 PM

Post #11 of 15 (1264 views)
Re: [FishMonger] Code hangs when i execute [In reply to] Can't Post


In Reply To
I have 5.10 on 20 XP boxes in my department and have not had any problems. I don't know where Kevin got that "it is a dead horse", I'm sure p5p (perl 5 porters) would disagree. They are the ones that develop perl. The main issue is the number of available modules, which is not as extensive as the ones for 5.8.x.


I should have said activeperl 5.10 (32 bit) is essentially a dead horse, not perl 5.10 in general. You will find no 32 bit repositories for activeperl 5.10, so degrading to activeperl 5.8 on a 32 bit Windows box is probably a good idea.


Edit:

Likewise I don't think there are any 64 bit repositories for older version of perl (before 5.10).
-------------------------------------------------


(This post was edited by KevinR on May 7, 2009, 11:06 PM)


KevinR
Veteran


May 7, 2009, 11:03 PM

Post #12 of 15 (1263 views)
Re: [vikas.deep] Code hangs when i execute [In reply to] Can't Post


In Reply To
Sir,
If you say you are "ready to bet---", I backtrack simply because I am not in a position to put forth anything new. Whatever I have said is based on my experience so far and my friends in this or other (public) forums are expected to accept or reject whatever i or any body else says in good faith. Actually I faced something similar just 15-20 days back. May be what you are saying might be true or may be not I am not competent enough to say. After my problem I tell you what i did was that I shifted myself to a Linux (Fedora) machine. I am still using perl 5.8 but yes I do want to use perl 5.10 with a "switch" and "say" and other new features. In case the script that I was not able to run earlier on(Windows Vista,Activeperl5.10,32 bits architecture) works this time. At least for my purpose I would get a satisfactory answer whatever anybody(p5p developers or anybody) says.I am a learner---
I dont think that Perlguru is a betting ground and I do not want to lose my friends or money over here.Smile


I am sure FishMonger is speaking figuratively, not literally, about the betting. But it is good to take what you read on forums with a grain of salt unless you know the person you are communicating with has a good history of providing accurate information.

While I always try and provide accurate information I am also sometimes relying on a third party that I trust, and if he is wrong for some reason I might also repeat the same bad information, although I generally do try and confirm information myself, I can't always.

I got the info about activerperl 5.10 32 bit being a dead horse from the activestate forums from one of the activestate personel (this was a while back).

I also read that some people were using Win32 modules on Win64 boxes with no problem although for obvious reasons that can't be an official recommendation.
-------------------------------------------------


FishMonger
Veteran / Moderator

May 8, 2009, 4:03 AM

Post #13 of 15 (1251 views)
Re: [KevinR] Code hangs when i execute [In reply to] Can't Post


In Reply To
I should have said activeperl 5.10 (32 bit) is essentially a dead horse, not perl 5.10 in general. You will find no 32 bit repositories for activeperl 5.10, so degrading to activeperl 5.8 on a 32 bit Windows box is probably a good idea.


How about these 5.10.xx 32 bit repositories.

http://ppm4.activestate.com/MSWin32-x86/5.10/1002/
http://cpan.uwinnipeg.ca/PPMPackages/10xx/
http://trouchelle.com/ppm10/
http://www.bribes.org/perl/ppm/
http://www.wxperl.co.uk/repository/


FishMonger
Veteran / Moderator

May 8, 2009, 6:39 AM

Post #14 of 15 (1246 views)
Re: [FishMonger] Code hangs when i execute [In reply to] Can't Post

I forgot one of the 5.10 repositories.
http://www.wxperl.co.uk/repository/ansi

Each of those reps I gave are listed on ActiveState's site.
http://ppm4.activestate.com/


KevinR
Veteran


May 8, 2009, 9:42 PM

Post #15 of 15 (1235 views)
Re: [FishMonger] Code hangs when i execute [In reply to] Can't Post


In Reply To

In Reply To
I should have said activeperl 5.10 (32 bit) is essentially a dead horse, not perl 5.10 in general. You will find no 32 bit repositories for activeperl 5.10, so degrading to activeperl 5.8 on a 32 bit Windows box is probably a good idea.


How about these 5.10.xx 32 bit repositories.

http://ppm4.activestate.com/MSWin32-x86/5.10/1002/
http://cpan.uwinnipeg.ca/PPMPackages/10xx/
http://trouchelle.com/ppm10/
http://www.bribes.org/perl/ppm/
http://www.wxperl.co.uk/repository/


Cool! Like I said I got that info a while back so its good to see there are a number of 5.10 32 bit PPM repositories now.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives