Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- use CGI qw(:standard escapeHTML);
January 14, 2005, 7:54 am
rate this thread
Re: use CGI qw(:standard escapeHTML);
> I'm new to Perl, and I think the following line in my code is causing
> problems, use CGI qw(:standard escapeHTML);
What sort of problems?
Please see the posting guidelines for this newsgroup.
> I think this is a perl module. Would someone mind explaining what this
> line of code is doing and what perl module it is using.
You appear to be asking what the Perl command 'use' does.
You can find out by typing:
perldoc -f use
You are right though, it loads modules. In this case it is loading the
CGI module. The CGI module is the most commonly used sensible way to
write a CGI script in Perl. You can find out more about the CGI module thus:
The bit after the module name tells 'use' to call the CGI module's
'import' method with the arguments (':standard','escapeHTML').
In principle it's entitely up to the module author how these arguments
are interpreted but in many modules including CGI this has the effect of
instucting the CGI module to make available to your script a set of
functions that have been called the 'standard' set and also the one
extra function escapeHTML. Noter there's nothing special about the name
'standard' it's just a name. There is also a set called 'default' which
is special because it's what you get it you don't pass any arguments to
the module at all via the use satement.
Note: I'm 99% sure you didn't really want an explaination of what use does.