[Cascavel-pm] Procurar texto em arquivo.
Alceu Rodrigues de Freitas Junior
glasswalk3r em hotmail.com
Sexta Junho 15 08:42:19 PDT 2007
> From: luismottacampos em yahoo.co.uk> Date: Fri, 15 Jun 2007 17:20:26 +0200> Esta merda estah cheia de problemas, a comecar pela falta de > documentacao.Que boca suja! :-D> Alguém pode por favor rodar o perlcritic nisto e mandar o > resultado para a lista?> Eu acho que a gente pode sugerir MUITAS melhorias.Vai meus dois centavos. Fiquei com preguiça de fazer mais que isso:<code>#!/usr/bin/perluse warnings;use strict;use CGI qw ( :standard );use constant ARQUIVO => '/etc/squid/arquivos/liberados/dl_geral';use constant SERVIDOR => 'http://meuservidor.no-ip.info/arquivos/siteinexist.htm';open( LIBERADOS, $arquivo );my @linhas = <LIBERADOS>;close(LIBERADOS);my $site = param("site");my $www = param("www");open( LIBERADOS, '<', ARQUIVO );my $linhas = "@linhas";if ( $site eq /^[.]$/ ) { print redirect(SERVIDOR); close(LIBERADOS); exit;}open( LIBERADOS, "$arquivo" );if ( $linhas =~ /^(?:.)(.{2})+.$site/ ) { print redirect (SERVIDOR); close(LIBERADOS); exit;}open( LIBERADOS, "$arquivo" );if ( $linhas =~ m/^(\d{3}))+(?:.)+$site/ ) { print redirect (SERVIDOR); close(LIBERADOS); exit;}else { open( LIBERADOS, '+>>', ARQUIVO ); print LIBERADOS "\n$www$site"; close(LIBERADOS); # argh! sem verificação se executou ou não isso! # esse script rodar com setuid? system("squid -k reconfigure"); print redirect (SERVIDOR);}</code>temp.pl|10 col 1| Two-argument "open" used. See page 207 of PBP (Severity: 5)temp.pl|10 col 1| Bareword file handle opened. See pages 202,204 of PBP (Severity: 5)temp.pl|17 col 1| Bareword file handle opened. See pages 202,204 of PBP (Severity: 5)temp.pl|27 col 1| Two-argument "open" used. See page 207 of PBP (Severity: 5)temp.pl|27 col 1| Bareword file handle opened. See pages 202,204 of PBP (Severity: 5)temp.pl|36 col 1| Two-argument "open" used. See page 207 of PBP (Severity: 5)temp.pl|36 col 1| Bareword file handle opened. See pages 202,204 of PBP (Severity: 5)temp.pl|44 col 5| Bareword file handle opened. See pages 202,204 of PBP (Severity: 5)[]'sAlceu
_________________________________________________________________
With Windows Live Hotmail, you can personalize your inbox with your favorite color.
www.windowslive-hotmail.com/learnmore/personalize.html?locale=en-us&ocid=TXT_TAGLM_HMWL_reten_addcolor_0607
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20070615/26b67adf/attachment.html
Mais detalhes sobre a lista de discussão Cascavel-pm