[Cascavel-pm] PrincipaisContribuidoresCascavelPM
Fernando Oliveira
fernandocorrea em gmail.com
Sexta Maio 25 18:38:34 PDT 2007
dei uma melhorada no meu script... alguém quer me ajudar?
<code>
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;
use IO::Uncompress::Gunzip;
my $m = WWW::Mechanize->new;
my $onde = shift || "rio";
my %hash;
$m->get(" http://mail.pm.org/pipermail/$onde-pm/");
my @links = $m->find_all_links( url_regex => qr#\d{4}-\w+.txt#, );
for (@links) {
print $_->url_abs, $/;
$m->get($_->url_abs);
my $content = $m->content;
my $buffer;
if ($_->url_abs =~ /\.gz$/) {
my $z = new IO::Uncompress::Gunzip \$content;
$z->read($buffer);
}
else {
$buffer = $content;
}
$buffer =~ s#<code>.*?</code>##gsm;
my $from;
for $a ( split m#$/#, $buffer ) {
$from = $1 if $a =~ m#^\s*From: (.+)$#;
if($a =~ /^\s*\(?([\w]+)\)?((:?\+|-){2})\s*(#.*)?$/) {
eval "\$hash{" . lc $1 . "}$2";
print "From: $from$/$a$/$/";
}
}
}
print "$_ => $hash{$_}$/" for keys %hash;
</code>
2007/5/24, Fernando Oliveira <fernandocorrea em gmail.com>:
>
> só faltou declarar %hash...
>
> <code>
> use strict;
> use warnings;
> use WWW::Mechanize;
> my $m = WWW::Mechanize->new;
> my %hash;
> $m->get(" http://mail.pm.org/pipermail/cascavel-pm/");
> my @links = $m->find_all_links( url_regex => qr#\d{4}-\w+.txt(?!\.gz)#, );
> for my $link (@links) {
> for my $a ( split m#$/#, $m->get( $link->url_abs )->content ) {
> eval "\$hash{" . lc $1 . "}$2"
> if $a =~ /^\s*([\w-]+)((:?\+|-){2})\s*(#.*)?$/;
> }
> }
> print "$_ => $hash{$_}$/" for keys %hash;
> </code>
>
> :wq!
>
> 2007/5/24, Alceu Rodrigues de Freitas Junior <glasswalk3r em hotmail.com>:
> >
> > Meus dois centavos:
> >
> > use strict;
> > use warnings;
> > my $m = WWW::Mechanize->new;
> > $m->get(" http://mail.pm.org/pipermail/cascavel-pm/");
> > my @links = $m->find_all_links( url_regex => qr#\d{4}-\w+.txt(?!\.gz)#,
> > );
> > for my $link (@links) {
> > for my $a ( split m#$/#, $m->get( $link->url_abs )->content ) {
> > eval "\$hash{" . lc $1 . "}$2"
> > if $a =~ /^\s*([\w-]+)((:?\+|-){2})\s*(#.*)?$/;
> > }
> > }
> > print "$_ => $hash{$_}$/" for keys %hash;
> >
> > []'s
> > Alceu
> >
> > ------------------------------
> > Date: Thu, 24 May 2007 17:36:16 -0300
> > From: fernandocorrea em gmail.com
> > To: cascavel-pm em pm.org
> > Subject: Re: [Cascavel-pm] PrincipaisContribuidoresCascavelPM
> >
> > Eu resolví brincar um pouco com o negocio do ++
> >
> > alguém quer me ajudar?
> >
> > <code>
> > perl -MWWW::Mechanize -e '$m=WWW::Mechanize->new; $m->get("
> > http://mail.pm.org/pipermail/cascavel-pm/"); @links =
> > $m->find_all_links(url_regex => qr#\d{4}-\w+.txt(?!\.gz)#,);
> > for$link(@links){for$a(split m#$/#, $m->get($link->url_abs)->content){eval
> > "\$hash{" . lc $1 . "}$2" if $a =~ /^\s*([\w-]+)((:?\+|-){2})\s*(#.*)?$/}}
> > print "$_ => $hash{$_}$/" for keys %hash'
> > </code>
> >
> >
> >
> >
> > ------------------------------
> > Get news, entertainment and everything you care about at Live.com . Check
> > it out! <http://www.live.com/getstarted.aspx+>
> >
> > _______________________________________________
> > Cascavel-pm mailing list
> > Cascavel-pm em pm.org
> > http://mail.pm.org/mailman/listinfo/cascavel-pm
> >
>
>
>
> --
> []'s Fernando
--
[]'s Fernando
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20070525/080c5a6b/attachment.html
Mais detalhes sobre a lista de discussão Cascavel-pm