BTW, according to the doc for CGI::Utils->new(), the constructor works in mod_perl provided that the Apache request object is passed as argument, or can be retrieved via Apache->request or Apache2::RequestUtil->request.
So, I updated my script to verify that Apache2::RequestUtil->request does indeed return a valid request. When I print the returned instance, it says: Apache2::RequestRec=SCALAR(0x485052c) which indicates that it is indeed a scalar that is blessed into the RequestRec class. ________________________________________ From: Desilets, Alain Sent: Thursday, December 01, 2011 5:16 PM To: modperl@perl.apache.org Subject: CGI::Utils->getSelfRefUrlWithQuery() not working inside mod_perl? Trying to migrate a complex script from a standard CGI context to a mod_perl context, and am having a hell of a time. The latest problem is that I have a call to GCI::Utils->getSelfRefUrlWithQuery() which causes a crash. In an attempt to isolate the problem, I wrote this short script which does nothing more than call that method: -------------- #!perl -w use strict; print "Content-type: text/plain\r\n\r\n"; use CGI::Utils; my $self_url = ''; print "Before calling get_self_ref_url_with_query()\n"; #no strict; my $cgi_utils = CGI::Utils->new(); $self_url = $cgi_utils->getSelfRefUrlWithQuery(); #$self_url = $cgi_utils->get_self_ref_url_with_query(); #$self_url = CGI::Utils->getSelfRefUrlWithQuery(); #$self_url = CGI::Utils->getSelfRefUrlWithQuery(); #use strict; --------------- When I run it, I get the following error: [Thu Dec 01 17:04:21 2011] [error] Can't use string ("HTML::Mason::Commands::m") as a SCALAR ref while "strict refs" in use at C:/Perl/site/lib/CGI/Utils.pm line 203.\n If I comment out the call to getSelfRefUrlWithQuery(), then the script runs fine. I have tried calling that method in four different ways (as CGI::Utils-> or $cgi_utils->, with the underscore or hungarian notation variants), with or without 'no strict'. All of those combinations fail. I tried running this script as a ModPerl::Registry or a ModPerl::PerlRun mode, and neither ones work. Is getSelfUrlWithQuery() a method that can't be used in a mod_perl context? If so, how can I get the URL fo the current script call? Thx Alain Désilets