diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-22 20:24:49 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-22 20:24:49 +0000 |
commit | c39ce7aa14f2424c874cc58b5ce5249a05fabe66 (patch) | |
tree | 8893b894f4ac7fc7b2fe4dc116654b3830e88668 /proxy_wizard/Squid.pm | |
parent | 568cc7c168e09ca61e6a6652ad0ab597fa5b6421 (diff) | |
download | drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar.gz drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar.bz2 drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar.xz drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.zip |
perl_checker fixes
Diffstat (limited to 'proxy_wizard/Squid.pm')
-rwxr-xr-x | proxy_wizard/Squid.pm | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/proxy_wizard/Squid.pm b/proxy_wizard/Squid.pm index f17889ca..009ff192 100755 --- a/proxy_wizard/Squid.pm +++ b/proxy_wizard/Squid.pm @@ -91,8 +91,8 @@ $o->{pages} = { memory => { name => N("Proxy Cache Size") . "\n\n" . N("Memory Cache is the amount of RAM dedicated to cache memory operations (note that actual memory usage of the whole squid process is bigger).") . "\n\n" . N("Disk Cache is the amount of disk space that can be used for caching on disk.") . "\n\n" . N("For your information, here is /var/spool/squid space on disk:") . "\n\n" . $df, pre => sub { - $o->{var}{wiz_squid_mem} ||= int ($mem / 4); - $o->{var}{wiz_squid_disk} ||= int ($free_disk/2); + $o->{var}{wiz_squid_mem} ||= int($mem / 4); + $o->{var}{wiz_squid_disk} ||= int($free_disk/2); }, data => [ { label => N("Memory cache (MB):"), val => \$o->{var}{wiz_squid_mem} }, @@ -176,7 +176,7 @@ $o->{pages} = { }; sub new { - my ($class, $conf) = @_; + my ($class) = @_; bless { o => $o, }, $class; @@ -203,7 +203,7 @@ sub testport { sub port { my $ret; - my @lines = grep(/$o->{var}{wiz_squid_port}\/tcp/, cat_("/etc/services")); + my @lines = grep { m!$o->{var}{wiz_squid_port}/tcp! } cat_("/etc/services"); foreach (@lines) { s/\t/ /g; $ret .= "\n$_"; @@ -219,49 +219,49 @@ sub do_it { -f $file and MDK::Common::cp_af($file, $file.".orig"); MDK::Common::cp_af("__WIZ_HOME__/proxy_wizard/scripts/squid.conf.default", $file); substInFile { - s|^\s*\#?\s*cache_dir ufs /var/spool/squid 100 16 256.*|cache_dir ufs $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} 16 256|; - s|^\s*\#?\s*acl\s*mynetwork\s*src.*|acl mynetwork src $o->{var}{wiz_squid_mynetw}|; - s|^\s*\#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|; - s|^\s*\#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|; + s|^\s*#?\s*cache_dir ufs /var/spool/squid 100 16 256.*|cache_dir ufs $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} 16 256|; + s|^\s*#?\s*acl\s*mynetwork\s*src.*|acl mynetwork src $o->{var}{wiz_squid_mynetw}|; + s|^\s*#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|; + s|^\s*#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|; } $file; standalone::explanations("$file: cache_dir = $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} mynetw = $o->{var}{wiz_squid_mynetw} cache_mem = $o->{var}{wiz_squid_mem} http_port = $o->{var}{wiz_squid_port} level = $o->{var}{wiz_squid_level}"); if ($o->{var}{wiz_squid_level} == 1) { substInFile { - s|^\s*\#?\s*(http_access\s*)deny(\s*all.*)|\#$&\n$1allow$2|; + s|^\s*#?\s*(http_access\s*)deny(\s*all.*)|#$&\n$1allow$2|; } $file; } elsif ($o->{var}{wiz_squid_level} == 2) { substInFile { - s|^\s*\#?\s*(http_access\s*)allow(\s*all.*)|\#$&\n$1deny$2|; - s|^\s*\#?\s*(http_access\s*allow\s*)localhost|\#$&\n$1mynetwork|; + s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|; + s|^\s*#?\s*(http_access\s*allow\s*)localhost|#$&\n$1mynetwork|; } $file; } elsif ($o->{var}{wiz_squid_level} == 3) { substInFile { - s|^\s*\#?\s*(http_access\s*)allow(\s*all.*)|\#$&\n$1deny$2|; - s|^\s*\#?\s*(http_access\s*allow\s*)mynetwork|\#$&\n$1localhost|; + s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|; + s|^\s*#?\s*(http_access\s*allow\s*)mynetwork|#$&\n$1localhost|; } $file; } else { # should not happen die "wiz_squid_level error"; } my $t = 0; foreach (cat_($file)) { - if (/^\s*cache_peer.*/) { + if (/^\s*cache_peer/) { $t = $_;; last; } } if ($o->{var}{wiz_squid_menupeer} == 1 && length $t) { substInFile { - s|^\s*!\#\s*(cache_peer.*)|\#$&|; + s|^\s*!#\s*(cache_peer.*)|#$&|; } $file; } elsif ($o->{var}{wiz_squid_menupeer} == 2 && length $o->{var}{wiz_squid_cachepeer}) { - if (lenght $t) { + if (lenght($t)) { substInFile { - s|^\s*\#?\s*(cache_peer.*)|\#$&|; + s|^\s*#?\s*(cache_peer.*)|#$&|; } $file; } append_to_file($file, "cache_peer $o->{var}{wiz_squid_cachepeer} parent $o->{var}{wiz_squid_peerport} 3130"); |