Hi Eko,

On Sat, 17 Mar 2012 11:19:27 +0700
Eko Budiharto <eko.budiha...@gmail.com> wrote:

> dear list,
> I have a perl script that I would like to run from any browsers. I tried 
> it on firefox and internet explorer, but both gave me, the same error 
> message, "Content-type: text/html
> 
> 'C:\HRMS\cgi-bin\cetakKuponMakanHarian.pl' script produced no output"
> 

It is possible the script crashed in the middle. Is there anything in the logs?

> I am using IIS under windows 7 32 bit, I set already the security into 
> allow to everyone to read and execute.

I don't have any significant experience with IIS, but I'll try
to help.

> 
> Please tell me what I miss. Thanks.
> 
> here is the upper part of the script:
> 
> use strict;

You should also add "use warnings;"

> use DBI;
> use Time::Format;
> use MySQL::DateFormat;
> 
> my ( $KODE_UNIT, $KODE_BAGIAN, $NIK, $TANGGAL, $JUMLAH, $KD_S_NASI, 
> $JENIS, $USER_ID, $TGL_CREA, $TGL_UPD, $CK1, $SHIFT ) = '';

1. Please don't pre-declare all the variables. Declare them when they are used.

2. Why are you using all-uppercase letters for the identifiers? Are they
constants? Else, please use lowercase letters for them.

3. Why are you initialising an entire list of variables from a single scalar?
That will only initialize the first item of the list.

> 
> my $query4 = qq { select * from fo_lain where TANGGAL = curdate(); };
> my $sth = $Mdbh->prepare($query4) or die "Couldn't prepare statement: " 
> . $Mdbh->errstr;;

$Mdbh does not appear anywhere in your script. Did you omit it?

> $sth->execute();
> 
> print "Content-type: text/html\n\n";
> print "<HTML><head>";
> print "<meta http-equiv=\"Content-Language\" content=\"en-us\">\n";
> print "<meta http-equiv=\"Content-Type\" content=\"text/html; 
> charset=windows-1252\">\n";
> 
> print "</head><BODY bgcolor='#F0F8FF'>\n";

You should use better quoting here. Doing \" excessively is an anti-pattern.
Maybe use a here-document.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
UNIX Fortune Cookies - http://www.shlomifish.org/humour/fortunes/

An apple a day keeps the doctor away.
Two apples a day will keep two doctors away. 
    — one of Shlomi Fish’s relatives

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to