Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

General questions
Hello,

1.  I read on many Perl/CGI tutorial/articles that it is best to place
and use CGI files in /cgi-bin/ directory than anywhere else, due to
avoid many problems.  Buy in our website, we have several subdomain
and those are all use the same /cgi-bin/ directory, so now there are a
lot of files populated there.  So now what I have to do to reduce the
management/maintanence problems.


2. I used "use strict", and I get error for the statement
open(IN_FILE1, ">>test_records.txt");

Here the error is
Bareword "IN_FILE1" not allowed while "strict subs" in use ....

But if I remove "use strict", the program works well.  So should I
definately do not use "use strict" if the program want to handle I/O
files?


Thank you all.

Greetings,
R. Kumaran



Report this thread to moderator Post Follow-up to this message
Old Post
GR Kumaran
03-30-05 08:56 PM


Re: General questions
On Wed, 30 Mar 2005 09:57:38 +0200, GR Kumaran wrote:
>
> 2. I used "use strict", and I get error for the statement
> open(IN_FILE1, ">>test_records.txt");
>
> Here the error is
> Bareword "IN_FILE1" not allowed while "strict subs" in use ....
>
> But if I remove "use strict", the program works well.  So should I
> definately do not use "use strict" if the program want to handle I/O
> files?
>

The line you gave is okay even under "use strict;", so the problem
must be in some code before this line. One problem I saw in the past
was that a module that was used overloaded the "open" function. To
check if this is the case, change your line to:
CORE::open(IN_FILE1, ">>test_records.txt");

Oh, and you should definitly "use strict; use warnings;" everywhere,
in every script you write!!!

--
Offer Kaye

Report this thread to moderator Post Follow-up to this message
Old Post
Offer Kaye
03-30-05 08:56 PM


RE: General questions
Hi Kumaran,

Use strict is used to enforce declaration of variables before we use
them.
Here IN_FILE1 is file pointer variable which u are using and which is
not declared before ,
That is the reason it is working fine when u have removed the use strict
construct.

Thanks
Arjun=0D

Deserve before you desire

=0D

=0D



-----Original Message-----
From: grkumaran@sancharnet.in [mailto:grkumaran@sancharnet.in]=0D
Sent: Wednesday, March 30, 2005 1:28 PM
To: M.L. PERL BEG
Subject: General questions


Hello,

1.  I read on many Perl/CGI tutorial/articles that it is best to place
and use CGI files in /cgi-bin/ directory than anywhere else, due to
avoid many problems.  Buy in our website, we have several subdomain and
those are all use the same /cgi-bin/ directory, so now there are a lot
of files populated there.  So now what I have to do to reduce the
management/maintanence problems.


2. I used "use strict", and I get error for the statement open(IN_FILE1,
">>test_records.txt");

Here the error is
Bareword "IN_FILE1" not allowed while "strict subs" in use ....

But if I remove "use strict", the program works well.  So should I
definately do not use "use strict" if the program want to handle I/O
files?


Thank you all.

Greetings,
R. Kumaran



--=0D
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>





Confidentiality Notice=0D

The information contained in this electronic message and any attachments to=
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or=
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or=
Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Report this thread to moderator Post Follow-up to this message
Old Post
Arjun Mallik
03-31-05 08:57 AM


Re: General questions
On Thu, 31 Mar 2005 11:28:04 +0530, arjun.mallik@wipro.com wrote:
>
> Use strict is used to enforce declaration of variables before we use
> them.
> Here IN_FILE1 is file pointer variable which u are using and which is
> not declared before ,
> That is the reason it is working fine when u have removed the use strict
> construct.
>

Not true. Save the following code in a file called "test.pl" and run
it with "perl -w test.pl":
######## begin code
use strict;
open(IN_FILE1,"test.pl");
while(<IN_FILE1> ) {print}
######## end code

As you can see, this code runs without any warnings or errors.
IN_FILE1 is a FILEHANDLE, not a "file pointer variable" (whatever the
heck that is). More to the point, it is not a variable at all, and so
is not affected by "use strict;".

--
Offer Kaye

Report this thread to moderator Post Follow-up to this message
Old Post
Offer Kaye
03-31-05 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:03 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.