Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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.

Comment on Mysterious ActiveState Perl Hangs
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 ;-) (Parson) 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 ;-)

    --
    seek(JOB,$$LA,0);

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-10-01 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (40 votes), past polls