( comet | 2006. 07. 30., v – 21:54 )

A javítás javítása.


#!/usr/bin/perl
use strict;
use warnings;
$|=1;
my $count = 0;
my $pid = $$;

my $allowed = '10.0.0';
my $cachedir = '/WebPages';

while (<>) {
  chomp $_;
  if ($_ =~ /^(.*\.(jpe?g|gif|png)) ([^ ]+)/i) {
    if (index($3,$allowed) == ($[-1)) {
      my $url = $1;
      my $ext = $2;
      system("/usr/bin/wget", "-q", "-O","$cachedir/$pid-$count.$ext", "$url");
      system("/usr/bin/mogrify", '-flip', '-blur', '2x2', "$cachedir/$pid-$count.$ext");
      chmod 0644, "$cachedir/$pid-$count.$ext";
      $_ = "http://127.0.0.1/images/$pid-$count.$ext";
    }
  }
  print "$_\n";
  ++$count;
}