A
Aaron Haspel
Greetings perl hackers:
Not being a perl programmer myself, I'm trying to get a simple perl
script to work for url rewriting and I'm having a bit of trouble. My
script looks like this:
#!/usr/bin/perl
$|=1; # Turn off buffering
while ( <STDIN> )
{
local $postid = $_;
++postid;
print "/?p=$postid\n";
}
Simple enough. Just takes old urls, converts them to numbers, adds 1,
and returns a string. Runs fine from the command line. But when I try
to use it in a RewriteRule in apache, it behaves strangely. The first
time it executes, it returns null. The next time it executes, it
returns what one would have expected from the first run, the third time
from the second, and so forth. So, for example, if I run it three times
I get the following:
arg: /archives/00000590.html return: null
arg: /archives/00000577.html return: /?p=591
arg: /archives/00000490.html return: /?p=578
I thought about posting this to apache, but the script is executing
when it's supposed to, just weirdly, so I thought it was more of a perl
problem. Any help is most appreciated.
Regards,
Aaron Haspel
Not being a perl programmer myself, I'm trying to get a simple perl
script to work for url rewriting and I'm having a bit of trouble. My
script looks like this:
#!/usr/bin/perl
$|=1; # Turn off buffering
while ( <STDIN> )
{
local $postid = $_;
++postid;
print "/?p=$postid\n";
}
Simple enough. Just takes old urls, converts them to numbers, adds 1,
and returns a string. Runs fine from the command line. But when I try
to use it in a RewriteRule in apache, it behaves strangely. The first
time it executes, it returns null. The next time it executes, it
returns what one would have expected from the first run, the third time
from the second, and so forth. So, for example, if I run it three times
I get the following:
arg: /archives/00000590.html return: null
arg: /archives/00000577.html return: /?p=591
arg: /archives/00000490.html return: /?p=578
I thought about posting this to apache, but the script is executing
when it's supposed to, just weirdly, so I thought it was more of a perl
problem. Any help is most appreciated.
Regards,
Aaron Haspel