CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Help With Counter Script

 



steveJ
Deleted

Mar 3, 2000, 8:12 PM

Post #1 of 7 (1115 views)
Help With Counter Script Can't Post

Hi, I've downloaded several counter scripts and when I try to implement them I get the following message:

< HTTP/1.1 200 OK Date: Sat, 04 Mar 2000 04:41:20 GMT Server: Microsoft-IIS/4.0 Content-type: text/plain 82 people have visited this page since

It keeps track and prints the number, but for some reason it prints all that extraneous stuff at the beginning.

I'm not a perl programmer at all and I'm stumped.

The code looks something like this:

if($valid_domain =~ /$ENV{'HTTP_HOST'}/)
{
open (COUNT, "<$data_file");
flock(COUNT, 2);
read (COUNT, $iCounter,10);
flock(COUNT, 8);
close (COUNT);

$iCounter++;

open (COUNT, ">$data_file");
flock(COUNT, 2);
print COUNT "$iCounter";
flock(COUNT, 8);
close (COUNT);

print "Content-type: text/html\n\n";
print "$iCounter";
}
else
{
#print "Content-type: text/html \n\n";
print "<b>ERROR ($ENV{'HTTP_HOST'} not valid)</b>";
}

If I # out the print "Content-type then nothing at all is printed out.

Does anyone have any clues? Thanks!!!


brian.hayes
User

Mar 3, 2000, 8:41 PM

Post #2 of 7 (1115 views)
Re: Help With Counter Script [In reply to] Can't Post

flock is not currently supported under win32.

what is happening is that the script is starting and then failing. providing you with the extra information about server errors. The latest beta version is to have support for flock, well it is still beta so it may still not work corectly but I would try it.

Brian Hayes


steveJ
Deleted

Mar 4, 2000, 5:15 AM

Post #3 of 7 (1115 views)
Re: Help With Counter Script [In reply to] Can't Post

Hi Brian,

Thanks for your response. Rather than try getting perl upgraded I remed everything out except for just the following

print "Content-type: text/html\n\n";
print "This is a test";

It still comes up with the same error, but it will also print out the information I want, so I suspect the problem to be with the way perl interfaces with the initial output from the webserver. Any other clues?

Thanks



brian.hayes
User

Mar 4, 2000, 5:46 AM

Post #4 of 7 (1115 views)
Re: Help With Counter Script [In reply to] Can't Post

How is the assostiation to the perl extentions set up in IIS? And service pack that is installed on the server/workstation?

Brian Hayes


brian.hayes
User

Mar 4, 2000, 5:50 AM

Post #5 of 7 (1115 views)
Re: Help With Counter Script [In reply to] Can't Post

Sorry,

if you are using .pl as the extention for perl, then you will need to set the application extention as:

.pl c:\perl\bin\perl.exe %s %s

This can be found under
->home directory->configuration
in the properties of the web server using the managment console.


steveJ
Deleted

Mar 4, 2000, 5:09 PM

Post #6 of 7 (1115 views)
Re: Help With Counter Script [In reply to] Can't Post

Hi Brian,

I had perl mapped to perlis, so I setup a .cgi extention with the perl params you provided, switched the naming around on my script and web page and now it works great!!

Thanks for the assistance.



brian.hayes
User

Mar 5, 2000, 5:59 AM

Post #7 of 7 (1115 views)
Re: Help With Counter Script [In reply to] Can't Post

No problem. Glad to help.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives