moked has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use WWW::Mechanize; use HTTP::Cookies; use Stream::Reader; $url="https://mymail.company.com"; my $username = "XXXXXXXXXX"; my $password = "xxxxxxxxxx"; my $mechanize = WWW::Mechanize->new(autocheck => 1); CHK_STRT: $mechanize->cookie_jar(HTTP::Cookies->new()); $mechanize->credentials($username,$password); $mechanize->get($url); $mechanize->get("https://mymail.company.com/exchange/User/Inbox/?Cmd=c +ontents&Page=1"); my $page = $mechanize->content(); $mechanize->get("https://mymail.company.com/exchange/User/Inbox/Sub_di +r_1/?Cmd=contents&Page=1"); my $Sub_1>get("https://mymail.company.com/exchange/User/Inbox/Sub_dir_ +2/?Cmd=contents&Page=1"); my $Sub_2 = $mechanize->content(); $mechanize->get("https://mymail.company.com/exchange/User/Inbox/sub_di +r_3/?Cmd=contents&Page=1"); my $Sub_3 = $mechanize->content(); $mechanize->get("https://mymail.company.com/exchange/User/Inbox/sub_di +r_4/?Cmd=contents&Page=1"); my $Sub_4 = $mechanize->content(); open(FH, ">school.txt") or die " Can't open school file\n"; binmode FH, ':utf8'; print FH $page; print FH $Sub_1; print FH $Sub_2; print FH $Sub_3; print FH $Sub_4; close(FH); my @substrings = ( 'icon-msg-unread.gif' ); my $handler; open( $handler,'<','school.txt' ) or die "can't Reopen the file\n"; my $stream = Stream::Reader->new( $handler ); my $result = $stream->readto(\@substrings, {Mode => 'E'}); #This mode +returns false $emails = 1; close $handler; open(WR, ">announce.txt"); if( $result ) { print WR "new\n"; $emails++; } elsif( $stream->{Error} ) { die "Fatal error during reading file!\n"; } else { print WR "old\n"; } close WR; unlink('C:/MC/school.txt'); system 'ftp -s:ftpc ftp.server > Log.log'; unlink 'Log.log'; sleep(60); goto CHK_STRT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: memory consumption
by bangers (Pilgrim) on Jul 07, 2009 at 09:47 UTC | |
by Corion (Patriarch) on Jul 07, 2009 at 09:50 UTC | |
by Joost (Canon) on Jul 07, 2009 at 19:35 UTC | |
|
Re: memory consumption
by JavaFan (Canon) on Jul 07, 2009 at 10:37 UTC | |
by afoken (Chancellor) on Jul 07, 2009 at 16:31 UTC | |
by JavaFan (Canon) on Jul 07, 2009 at 19:35 UTC | |
|
Re: memory consumption
by Your Mother (Archbishop) on Jul 07, 2009 at 16:38 UTC | |
|
Re: memory consumption
by missingthepoint (Friar) on Jul 08, 2009 at 10:06 UTC |