in reply to read an integer from a file

What's your problem ? "Page not being redirected" ? if so, Then it's because you're printing an invalid header.

Your header should look something like:

print "Status: 301\n"; print "Location: $_\n\n";
You may want to use CGI module, it will help to do things faster.

Replies are listed 'Best First'.
Re^2: read an integer from a file
by long (Novice) on Jun 16, 2010 at 07:38 UTC
    What you means by invalid header? actually this script is make for squid. i want to do an URL redirection with squid. the redirection will based on the condition of the network. if the newtork is down,squid will redirect the URL to a fix URL(as in the code). Could you advised me on how to make it works.
      Well I'm not sure about squid, but you should break this into two parts:
      1. check you are getting the behaviour you expect WITHOUT squid,
      2. integrate with squid.
      You might not get as much help with part 2 from Perlmonks as you would like, but you will get more help with part 1 if you're clear about what's going wrong.

      Since you asked again in the chatterbox about "problem reading a file", I advise you again to look at IO::All. If you're lucky, you can install it just by typing "cpan IO::All". If it turns out to be a bit more complicated, it's definitely worth at least one whole week of effort to get cpan working properly. If you can't install modules from cpan, you are missing out on most of the power of Perl, and you may even find people here getting frustrated with you. The particulars of installing cpan modules vary from site to site, so if you have problems, it's a good idea to talk to other people using Perl at your location.



      - Boldra
        Hi Bodra, i have split my task into 2 situation as you suggest. for case 1: without squid: i have test the script and it works. i make it print the result to the terminal after reading process. case 2: i integrate it with squid, it works when i disable the code for reading the file. but when i enable the code to read the file, it doesn't work. this script almost hit the target to do the URL redirection but there is something wrong at reading the file process. i'm new to perl. Hope u can help me in this. thanks