Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Mysterious ActiveState Perl Hangs

by caedes (Pilgrim)
on Feb 18, 2002 at 12:52 UTC ( #146140=perlquestion: print w/replies, xml ) Need Help??

caedes has asked for the wisdom of the Perl Monks concerning the following question:

I have a very strange problem with a large cgi program that I'm developing on a windows machine with ActiveState perl. I have a hash loaded with the values of the browser's cookie so that the many modules that make up the cgi program can easily access the user's state. When the user turns off cookies in the browser, this hash still exists, it just contains no keys.

It works just great when the user sends a cookie to the server, but something breaks when no cookies are sent. When I use this hash in a boolean test ( ie. $hash{key}>3 ) the process hangs with no error output. It just sits there doing nothing and taking up no cpu cycles. When I move this program to a linux server with the same version on perl it works just great whether or not the user has cookies on. I'm hopeing this is a bug in the windows port of perl, but I'm not going to hold my breath. Any thoughts would be appreciated.

PS: Sorry that I can't post any code, but it's too large and really wouldn't help much anyway.

Replies are listed 'Best First'.
Re: Mysterious ActiveState Perl Hangs
by simon.proctor (Vicar) on Feb 18, 2002 at 13:32 UTC
    I can't comment on the bug itself but why don't you use the exists() function on your hash key prior to your logic?

    Something like (untested):
    unless(exists $hash{$key}) { # Do stuff return; } if($hash{$key} > 3) { # Other stuff }
Re: Mysterious ActiveState Perl Hangs
by cLive ;-) (Prior) on Feb 18, 2002 at 19:04 UTC
    Time for you to say a few hail marys - or drink a few bluddy marys - I can never remember which...
    use strict; use warnings; use CGI; my $q = new CGI; # when assigning $hash{'key'} = $q->cookie('key') || '0';
    That narrows down the field.

    cLive ;-)


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://146140]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2023-12-06 08:31 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (30 votes). Check out past polls.