For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2004 > Problem with use strict;









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with use strict;
Nancy McMullin

2004-05-14, 4:30 pm

Hi there.
Brand new to PERL so please bear with me. (I'm running Win32/Apache)

When I include the line=20
use strict;
in any perl program, I get the following error:
"Internal Server Error
The server encountered an internal error or misconfiguration and was =
unable to complete your request. Please contact the server =
administrator, [no address given] and inform them of the time the error =
occurred, and anything you might have done that may have caused the =
error.
More information about this error may be available in the server error =
log.
-------------------------------------------------------------------------=
-------
Oracle HTTP Server Powered by Apache/1.3.22 Server at ..."

All programs run fine when that is commented out. I have strict.pm in =
the lib directory - but I'm still learning about modules so I don't know =
if it's set up correctly.
Sample code follows:
#!c:/perl/bin/perl=20
use strict;
use DBI;
use lib "c:\perl\lib";
use CGI qw(:standard escapeHTML);
print header(), start_html(),
b("USER ACCESS DATA"),
br,
my $dbh =3D DBI->connect('dbi:Oracle:xxx', 'xxx', 'xxx') || die =
$DBI::errstr;
my $sth =3D $dbh->prepare( q{
SELECT first_name, last_name
FROM dfas_admin.user_access
});
my $rc =3D $sth->execute;
my $NUM_OF_ROWS=3D0;
my @row;
while ( @row =3D $sth->fetchrow_array( ) ) {
$str =3D DBI::neat_list(\@row, 30, " ");
print "$str,";
$NUM_OF_ROWS++;
}
warn "error: $DBI::errstr\n"
if $DBI::err;
print "\nQuery returned $NUM_OF_ROWS rows.\n";
$sth->finish;
end_html();

WilliamGunther@aol.com

2004-05-14, 4:30 pm

In a message dated 5/14/2004 3:05:01 PM Eastern Daylight Time,
NANCY.MCMULLIN@DFAS.MIL writes:
>Hi there.
>Brand new to PERL so please bear with me. (I'm running Win32/Apache)
>
>When I include the line
>use strict;
>in any perl program, I get the following error:
>"Internal Server Error


Problem in on line 18. fix is:
my $str = DBI::neat_list(\@row, 30, " ");


-will
http://www.wgunther.tk
(the above message is double rot13 encoded for security reasons)

Most Useful Perl Modules
-strict
-warnings
-Devel::DProf
-Benchmark
-B::Deparse
-Data::Dumper
-Clone
-Perl::Tidy
-Beautifier
-DBD::SQLite
Bob Showalter

2004-05-14, 4:30 pm

MCMULLIN, NANCY wrote:
> Hi there.
> Brand new to PERL so please bear with me. (I'm running Win32/Apache)


Hi. It's "Perl", not "PERL". You're excused since you're brand new :~)

>
> When I include the line
> use strict;
> in any perl program, I get the following error:
> "Internal Server Error


Typically means your script has an error and won't compile, or your script
died or exited before emitting any output....

> The server encountered an internal error or misconfiguration and was
> unable to complete your request. Please contact the server
> administrator, [no address given] and inform them of the time the
> error occurred, and anything you might have done that may have caused
> the error.


Well, that's not helpful to you, but it's followed by:

> More information about this error may be available in the
> server error log.


Here's where you'll find the real error message. If you don't know where the
Apache error log is, now's the time to find it. Look in there to see
whatever error your script is raising.

HTH
Nancy McMullin

2004-05-14, 4:30 pm


But when I run the same code with use strict commented out - it works =
just fine...

-----Original Message-----
From: Bob Showalter [mailto:Bob_Showalter@taylorwhite.com]
Sent: Friday, May 14, 2004 1:15 PM
To: MCMULLIN, NANCY; beginners@perl.org
Subject: RE: Problem with use strict;


MCMULLIN, NANCY wrote:
> Hi there.
> Brand new to PERL so please bear with me. (I'm running Win32/Apache)


Hi. It's "Perl", not "PERL". You're excused since you're brand new :~)

>=20
> When I include the line
> use strict;
> in any perl program, I get the following error:
> "Internal Server Error


Typically means your script has an error and won't compile, or your =
script
died or exited before emitting any output....

> The server encountered an internal error or misconfiguration and was
> unable to complete your request. Please contact the server
> administrator, [no address given] and inform them of the time the
> error occurred, and anything you might have done that may have caused
> the error.=20


Well, that's not helpful to you, but it's followed by:

> More information about this error may be available in the
> server error log.


Here's where you'll find the real error message. If you don't know where =
the
Apache error log is, now's the time to find it. Look in there to see
whatever error your script is raising.

HTH
Andrew Gaffney

2004-05-14, 4:30 pm

MCMULLIN, NANCY wrote:
> But when I run the same code with use strict commented out - it works just fine...


'use strict' enforces the use of 'my' or 'our' for variable declarations. If a
variable declaration doesn't have that while 'use strict' is in effect, the
program won't compile.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548

Nancy McMullin

2004-05-14, 4:30 pm

Okay - got it. It now works prefacing $str =3D .. with my.

Thanks everyone.

-----Original Message-----
From: Andrew Gaffney [mailto:agaffney@skylineaero.com]
Sent: Friday, May 14, 2004 1:30 PM
To: beginners@perl.org
Subject: Re: Problem with use strict;


MCMULLIN, NANCY wrote:
> But when I run the same code with use strict commented out - it works =

just fine...

'use strict' enforces the use of 'my' or 'our' for variable =
declarations. If a=20
variable declaration doesn't have that while 'use strict' is in effect, =
the=20
program won't compile.

--=20
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548


--=20
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>


Jan Eden

2004-05-20, 6:30 pm

MCMULLIN, NANCY wrote on 14.05.2004:

>But when I run the same code with use strict commented out - it
>works just fine...


A little late maybe, but CGI::Carp might be something for you. Its method f=
atalsToBrowser sends Perl's error messages to your browser window.

HTH,

Jan
--=20
These are my principles and if you don't like them... well, I have others. =
- Groucho Marx
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com