You should create an object because you might import more modules in your
application that export the param() function/method.
In that case the program won't know which of those param() functions to use.
I guess this is just one reason, but I am sure there are more.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

----- Original Message -----
From: "Greenhalgh David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 27, 2003 8:45 AM
Subject: Why should I create an object?


Bare in mind that I am still a beginner at coding. Why is it "good
practice" to create an object when using CGI, rather than just diving
in?

For example:

use CGI ':standard';
my $q=new CGI;
my $input=$q->param('input');

and

use CGI ':standard';
my $input=param('input');

both put the contents of 'input' into $input and the last one has less
lines and less opportunity for typos, but the first is better practice
than the second. Gently, please; why?

Dave


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to