[cgiapp] Re: utf8 form processing

Michael Peters mpeters at plusthree.com
Tue Oct 21 09:48:58 EDT 2008


Mike Tonks wrote:

> Yes I tries the -utf8 switch for the CGI module, and while it didn't
> break the code in any way, it simply didn't seem to do anything.

How were you doing this? Since CGI::Application loads CGI.pm by itself if your loading comes after 
that it won't override what was already done. Since you were using "require" it's quite possible 
that your -utf8 flagged was ignored since CGI.pm had already been loaded by C::A

> I did wonder if it could be the use of require instead of use, but I
> don't really understand the difference and / or how this affects C::A.

Not to be too mean, but this is a pretty fundamental thing to understand.
use == compile time
require == run time

This means that when you say "use CGI" it happens as soon as perl *parses* that statement. When you 
say "require CGI" it happens as soon as perl *executes* that statement. If you're using CGI on every 
request then there's no reason to do it via "require". In fact unless you're conditionally loading a 
module there's no reason (unless you're doing something sufficiently magical) to use "require" it.

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list