J
jakob.fix
Hi, I am using LWP to mirror the McAfee CommonUpdater ftp site for my
department. There's a cron job that runs twice a day to see if there
are any changes. If so, it mirrors the site.
My problem is that LWP seems to maintain a cache I don't know about.
When requesting a URL and do the Mechanize ->find_all_links() method,
it will not always return the correct, current list of links. (code
snippet further down)
I guess, it's something basic, but the list archive didn't throw up
anything useful.
Thanks for your help,
Jakob.
PS: If there's a more appropriate group/forum/list, thanks for pointing
it out to me.
sub updateLocalRepository {
# remove previously downloaded files
chdir($mcafee_dir);
remove qw( * );
$ua->agent("McAfee AutoUpdate");
$ua->get( "$mcafee_url1" );
$ua->reload(); # an attempt to empty the cache
my @links = $ua->find_all_links(); # doesn't return current links
for my $link ( @links ) {
my $url = $link->url_abs;
my $filename = $url;
if ($filename eq $mcafee_url2 ) {
&fetchRecursively( $link );
}
unless ($filename eq $mcafee_host or $filename =~ "Current") {
&fetchFile( $filename, $url );
}
}
return 0;
}
department. There's a cron job that runs twice a day to see if there
are any changes. If so, it mirrors the site.
My problem is that LWP seems to maintain a cache I don't know about.
When requesting a URL and do the Mechanize ->find_all_links() method,
it will not always return the correct, current list of links. (code
snippet further down)
I guess, it's something basic, but the list archive didn't throw up
anything useful.
Thanks for your help,
Jakob.
PS: If there's a more appropriate group/forum/list, thanks for pointing
it out to me.
sub updateLocalRepository {
# remove previously downloaded files
chdir($mcafee_dir);
remove qw( * );
$ua->agent("McAfee AutoUpdate");
$ua->get( "$mcafee_url1" );
$ua->reload(); # an attempt to empty the cache
my @links = $ua->find_all_links(); # doesn't return current links
for my $link ( @links ) {
my $url = $link->url_abs;
my $filename = $url;
if ($filename eq $mcafee_url2 ) {
&fetchRecursively( $link );
}
unless ($filename eq $mcafee_host or $filename =~ "Current") {
&fetchFile( $filename, $url );
}
}
return 0;
}