Trying to write a perl script... haven't done it in a while
Posted: Wed Apr 29, 2009 11:34 am
I am trying to write a perl script and I am really rusty. I can't recall what "-d" and "-f" does. For instance, I am looking at an example script that looks like this:
I've seen this in other places as well, for instance in the Zend Framework's mod rewrite rules:
EDIT: Does it mean "directory"? It does, doesn't it? lol I feel stupid now.
Code: Select all
use strict;
use File::Find;
my($Group, $Text) = @ARGV;
my $Spool = "/var/spool/news"; # or wherever your newsspool lives
$| = 1; # so we can see it run
find(\&Kibo, "$Spool/$Group");
sub Kibo
{
-d and print "$_\n";
-f and /^\d+$/ or return;
print "$_\r";
open(ARTICLE, $_) or return;
my @lines = ;
for my $line (@lines)
{
$line =~ /$Text/o and print $line;
}
}
Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]