--- loncom/cgi/loncgi.pm 2008/11/28 20:39:43 1.9 +++ loncom/cgi/loncgi.pm 2008/11/30 14:47:18 1.10 @@ -1,7 +1,7 @@ # # LON-CAPA helpers for cgi-bin scripts # -# $Id: loncgi.pm,v 1.9 2008/11/28 20:39:43 raeburn Exp $ +# $Id: loncgi.pm,v 1.10 2008/11/30 14:47:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -81,7 +81,8 @@ BEGIN { =item check_cookie_and_load_env() -Inputs: none +Inputs: 1 ( optional). When called from a handler in mod_perl, + pass in the request object. Returns: 1 if the user has a LON-CAPA cookie 0 if not. Loads the users environment into the %env hash if the cookie is correct. @@ -91,7 +92,13 @@ Loads the users environment into the %en ############################################# ############################################# sub check_cookie_and_load_env { - my %cookies=fetch CGI::Cookie; + my ($r) = @_; + my %cookies; + if (ref($r)) { + %cookies = CGI::Cookie->fetch($r); + } else { + %cookies = CGI::Cookie->fetch(); + } if (exists($cookies{'lonID'}) && -e "$lonidsdir/".$cookies{'lonID'}->value.".id") { # cookie found