why to use 1)use CGI,2)use Strict ,3)use Carp in script

hi

why we r using
1)use CGI,
2)use Strict,
3)use Carp 
in the begining of script sometimes. What is the use
of it.Is the files CGI.pm,Strict.pm,Carp.pm default
with PERL.

Thnx

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
0
itssupu
11/4/2004 9:31:07 AM
perl.beginners 29388 articles. 4 followers. Follow

2 Replies
2462 Views

Similar Articles

[PageSpeed] 52

On Thu, 2004-11-04 at 09:31, supriya devburman wrote:
> hi

Hi

> why we r using
> 1)use CGI,

We only use CGI when we want to use methods from that module (usually on
web pages); see `perldoc CGI` for more information on what you can do
with it.

> 2)use Strict,

The correct name is strict. This is a pragma. We use it because it's a
good method to use strict (and also warnings).

strict forces some strictures (see `perldoc strict` for more
information) that make your code harder to be broken.

> 3)use Carp 
> in the begining of script sometimes. What is the use
> of it.Is the files CGI.pm,Strict.pm,Carp.pm default
> with PERL.

If you're asking if those modules come with Perl itself, I believe the
answer to be "yes".

> Thnx

I hope that was helpful O:-)

jac

> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com
-- 
Jos� Alves de Castro <cog@cpan.org>
  http://natura.di.uminho.pt/~jac

0
jac
11/4/2004 10:27:34 AM
On Thu, 4 Nov 2004, supriya devburman wrote:

> [W]hy [are we] using
>
> 1)use CGI,
> 2)use Strict,
> 3)use Carp 
>
> in the begining of script sometimes[question mark] What is the use of 
> [them][question mark] [Are] the files CGI.pm, Strict.pm, [and] Carp.pm 
> default with [Perl][question mark]
> 
> [Thanks]

The CGI.pm module is used in most cgi scripts, because rewriting all the 
useful things it does by hand manually for each script would be insane.

The 'strict' and 'warnings' pragmas should be used in all scripts 
because they enforce a higher level of coding discipline that can catch 
a lot of simple, common errors. 

The Carp module provides better report messages than the standard "die" 
or "warn" commands when a module dies. 

For details, see:

  perldoc CGI
  perldoc strict
  perldoc warnings
  perldoc Carp

Or any good introductory book about the language, like _Learning Perl_.


-- 
Chris Devers
1
cdevers
11/4/2004 1:04:38 PM
Reply:

Similar Artilces:

i used to use vbCommenter on 1.1, what i suppost to use in 2.0 ???
Hi...What's the best way to document the project on asp.net 2.0 ?? is there a new version of vbCommenter ??tks not sure if its the same thing (i know nothing about vbcommenter), but one kick ass thing that VB.NET now does is allow you to "comment" a function or subroutine..right click on the declaration line for the routine and choose "Insert comment"....  you'll see it gives you sections for description, paramters, and output..  anything put in those tags will show up in Intellisense when you use that code in other parts of the application"If you make it idiot proof, they&#...

Using Using
I have just completed reading a chapter in my book on performance. The books says to speed up performance on your web site you should use the using statement when opening connections. My question is how do you catch errors if you are using this as apposed to a try catch block.thanksBryan  Why would you use it as an alternative to a try/catch statement. Couldn't you just do something like  public void UsingSomeMethod() { try { SomeMethod(); } catch(SomeException e) { /// do something useful }}public void SomeMethod() { using (Something) { ...

When to use ( and when to use ((?
I'm just not getting it. When do you use ( in a statement, when do you need to use ((, and is the space after either or both mandatory? For example, I coded this statement: if (( $_ eq $bad_guys_ip )) { more_stuff_here }; Why the two (( in an if? And why does it seem to not work when I miss the space after the ((? Thanx! Mark me as... /Corn-fused|Dense/ > I'm just not getting it. >=20 > When do you use ( in a statement, when do you need to use ((, and is > the space after either or both mandatory? >=20 > For example, I coded this sta...

Why using use strict;
Hi all, I know why I should use "use strict;" but what happen if I use "use strict;" then if the code is OK, I delete this line? Shouldn't it work the same without this line if the code has no problems? Thanks. Teddy, orasnita@home.ro why would you want to do that Octavian? "use strict" is a sanity safety net. What your saying is like "I know why I should use safety belt whilst driving my car but what if I took it off?" - of course you can do it but beware of the consequences. joel -----Original Message----- From: ...

How to use the arguments to use() in the package being used
Howdy,=20 The subject says it all believe it or not :) What I'm trying to figure out is how to pass an argument=20 (pragma I believe is the proper term) to use() and do=20 sonethign in the package based on it. I've looked at CGI.pm source but can't seem to track it down.=20 (Similar idea as to CGIs -oldstyle_urls -newstyel_urls) http://search.cpan.org/~lds/CGI.pm-3.04/CGI.pm#PRAGMAS What I'd like to do is something like this: # for old time's sake we'll just use our favorite module use Foo::Monkey qw(:Foo :Bar -doamazingthings); #then in Foo::Monkey...

superreview requested: [Bug 227986] EmbedPrompter should use GtkComboBox on gtk+ 2.4 : [Attachment 137160] patch to use GtkComboBox on gtk+ 2.3.1 and above
Christian Persch <chpe@gnome.org> has asked Christopher Blizzard <blizzard@mozilla.org> for superreview: Bug 227986: EmbedPrompter should use GtkComboBox on gtk+ 2.4 http://bugzilla.mozilla.org/show_bug.cgi?id=227986 Attachment 137160: patch to use GtkComboBox on gtk+ 2.3.1 and above http://bugzilla.mozilla.org/attachment.cgi?id=137160&action=edit ...

superreview granted: [Bug 227986] EmbedPrompter should use GtkComboBox on gtk+ 2.4 : [Attachment 137160] patch to use GtkComboBox on gtk+ 2.3.1 and above
Christopher Blizzard <blizzard@mozilla.org> has granted Christian Persch <chpe@gnome.org>'s request for superreview: Bug 227986: EmbedPrompter should use GtkComboBox on gtk+ 2.4 http://bugzilla.mozilla.org/show_bug.cgi?id=227986 Attachment 137160: patch to use GtkComboBox on gtk+ 2.3.1 and above http://bugzilla.mozilla.org/attachment.cgi?id=137160&action=edit ...

Create module using .NET ver 2.0 and use with DNN 2.1.2
Hi all, i would like to start to test the .NET 2.0 version of the framework ad i would like to know is there some problem if i write a module with the 2.0 version of .NET and use with DNN 2.1.2. Thanks Stefano...

cannot use other packages when using CGI
Hi all, I am using CGI package in my script. When i try to use other packages like LWP::UserAgent inside the same script, it is not working in the web environment. But when i run the script from the command prompt it is working fine. Anyone please do solve my problem. Thanks +ACY- Regards, wilson. ...

use Strict and using module
Hello, Purpose: I am trying to understand the reason for the following error. Error: "Bareword "NetCDF::READ" not allowed while "strict subs" in use..." Actions already taken: 1. Searched Google --> Perl Bareword not allowed while "strict subs" Most of the hits I have looked at deal with just an OPEN Perl command in a subroutine. I am trying to understand why the module call NetCDF::READ results in similar behavior. Not understanding the parallel between the OPEN explanations and how to apply it to NetCDF::READ. 2. Searched http:...

PROBLEM WITH THE USES OF USE STRICT
Hello Team, Can someone please tell me why the below code does not work correctly? Here is the problem: Once I run the program and type in a couple of wrong answers and then type in the correct answer I still get the wrong response (e.g "No that is wrong! Try again.") But if I type in the correct answer first I get the correct response. I also should add that if I don't use "use strict" and rename my variable without "my". The code then works as it should. regards, Jaimee #!/usr/bin/perl -w use strict; print (&q...

FreeAndNil to use or not to use
After reading these debates about FreeAndNil I separated the people into two categories: The first one says: "You should have a perfect design which prohibits errors from happening. So, if you have a perfect design then FreeAndNil is not necessary so you should not use it. If we see FreeAndNil in your code then it means that your design is not perfect." The second one says: "Yes, we agree that we should have a perfect design which prohibits errors from happening and we do our best in order to create a perfect design. However our practice says that it is better ...

To use signatures or not to use?
--001a11c3871a8a8fe2051b7b8b18 Content-Type: text/plain; charset=UTF-8 Dear all, Perl now has subroutine signatures. However, they are marked as experimental feature. As I really like it, I'm always tempted to use it. On the other hand, I don't want to wast efforts to something I have to roll back. So, does anyone know the tendency if signatures are going to stay? I'm not looking for the standard "do if you want to do it because TIMTOWTDI" answer, it will not help me. I'm looking for rumors, or eventually an assessment from the people who did the fe...

DSRepair
Any good information on when to use Dsrepair which settings to use ? Is this something that should be run on a monthly /weekly basis and which of the million settings should be turned on:o) Use DSREPAIR to fix a broken database - that is what it is intended to be used for. It is not intended to be used as a "regular maintenance" tool. Using it in this way can in fact hide more serious issues by removing symptoms that indicate a more serious problem. Use it as a last resort for trying to identify problems with the database. Run health checks weekly or monthly (...

Web resources about - why to use 1)use CGI,2)use Strict ,3)use Carp in script - perl.beginners

Tsingy de Namoroka Strict Nature Reserve - Wikipedia, the free encyclopedia
16°28′S 45°20′E  /  16.467°S 45.333°E  / -16.467; 45.333 Coordinates : 16°28′S 45°20′E  /  16.467°S 45.333°E  / -16.467; 45.333 Located ...

☑ How to FIX STRICT NAT - PLAYSTATION 4 (PS4) - PART 1 ☑ - YouTube
Some players get Strict NAT or Type 3 NAT when they connect to gaming networks such as the PSN. This NAT Type causeS problems connecting to other ...

49% Favor Strict Legal Interpretation of the Constitution
... guide the nation? That legal debate continues to this day. But nearly half (49%) of Likely U.S. Voters believe the Constitution should be strictly ...

'Law is too strict' to be a thief, court told
Man accused of burglary is cleared after arguing UAE laws are too strict for him to dare such an act.

Convicted rapist has spent more than nine years under strict supervision order after serving jail sentence ...
Convicted rapist has spent nearly more than nine years under strict order after serving jail sentence.

'Isolated, insular, inflexible': ABS told it is too strict in public service review
The Australian Bureau of Statistics must "ease off on the independence" to safeguard its future.

HTTP Strict Transport Security becomes Internet standard - Internet Engineering Task Force, online safety ...
A Web security policy mechanism that promises to make HTTPS-enabled websites more resilient to various types of attacks has been approved and ...

Strict new hygiene rules for childcare will wrap kids in a bubble, says AMA
KIDS will be banned from blowing out candles on communal birthday cakes, under strict new hygiene rules for childcare.

Using your Klout: online store's strict door policy
When Jasu launches on Monday with Australian labels including Ellery, Josh Goot and Romance Was Born, shoppers will need a Klout score of over ...

Strict new rules for high-rise apartments on table
New high-rise apartments in Melbourne would be subject to strict new building rules under guidelines being considered by Victoria&#8217;s state ...

Resources last updated: 1/1/2016 7:16:03 PM