Abbas Naghdi
چهارشنبه 20 دی 1391, 13:49 عصر
سلام بچه ها این کدی که میبینید مربوط به چه زبانیه ... ؟
my $dupe_db = ClamTk::Prefs->get_preference('DupeDB');
for my $dir_list (@dirs) {
# Check for duplicate daily databases
if ( -e "$dir_list/daily.cld" && -e "$dir_list/daily.cvd" ) {
only_one("$dir_list")
if ( ( $dupe_db && $update_method eq 'single' )
or ( $dupe_db && $> == 0 ) );
}
if ( -e "$dir_list/daily.cld" ) {
$DAILY_PATH = $dir_list;
} elsif ( -e "$dir_list/daily.cvd" ) {
$DAILY_PATH = $dir_list;
}
# Check for duplicate main databases
if ( -e "$dir_list/main.cld" && "$dir_list/main.cvd" ) {
unlink("$dir_list/main.cld")
if ( ( $dupe_db && $update_method eq 'single' )
or ( $dupe_db && $> == 0 ) );
}
if ( -e "$dir_list/main.cvd" ) {
$MAIN_PATH = "$dir_list/main.cvd";
} elsif ( -e "$dir_list/main.cld" ) {
$MAIN_PATH = "$dir_list/main.cld";
}
last if ( $DAILY_PATH && $MAIN_PATH );
# the user may have set single - may need to update db
last if ($user_set);
}
return ( $DAILY_PATH, $MAIN_PATH );
}
sub only_one {
my ($location) = shift;
my ( $cld, $cvd ) = ('01 Jan 1900') x 2;
my $sigtool = get_path( undef, 'sigtool' );
if ( open( my $CLD, '-|', "$sigtool -i $location/daily.cld" ) ) {
while (<$CLD>) {
if (/Build time: (\d+\s\w+\s\d{4})/) {
$cld = $1;
last;
}
}
} else {
# shouldn't happen
$cld = '01 01 1970';
}
# warn "in only_one: cld = >$cld<\n";
if ( open( my $CVD, '-|', "$sigtool -i $location/daily.cvd" ) ) {
while (<$CVD>) {
if (/Build time: (\d+\s\w+\s\d{4})/) {
$cvd = $1;
last;
}
}
} else {
# shouldn't happen
$cvd = '01 01 1970';
}
my $dupe_db = ClamTk::Prefs->get_preference('DupeDB');
for my $dir_list (@dirs) {
# Check for duplicate daily databases
if ( -e "$dir_list/daily.cld" && -e "$dir_list/daily.cvd" ) {
only_one("$dir_list")
if ( ( $dupe_db && $update_method eq 'single' )
or ( $dupe_db && $> == 0 ) );
}
if ( -e "$dir_list/daily.cld" ) {
$DAILY_PATH = $dir_list;
} elsif ( -e "$dir_list/daily.cvd" ) {
$DAILY_PATH = $dir_list;
}
# Check for duplicate main databases
if ( -e "$dir_list/main.cld" && "$dir_list/main.cvd" ) {
unlink("$dir_list/main.cld")
if ( ( $dupe_db && $update_method eq 'single' )
or ( $dupe_db && $> == 0 ) );
}
if ( -e "$dir_list/main.cvd" ) {
$MAIN_PATH = "$dir_list/main.cvd";
} elsif ( -e "$dir_list/main.cld" ) {
$MAIN_PATH = "$dir_list/main.cld";
}
last if ( $DAILY_PATH && $MAIN_PATH );
# the user may have set single - may need to update db
last if ($user_set);
}
return ( $DAILY_PATH, $MAIN_PATH );
}
sub only_one {
my ($location) = shift;
my ( $cld, $cvd ) = ('01 Jan 1900') x 2;
my $sigtool = get_path( undef, 'sigtool' );
if ( open( my $CLD, '-|', "$sigtool -i $location/daily.cld" ) ) {
while (<$CLD>) {
if (/Build time: (\d+\s\w+\s\d{4})/) {
$cld = $1;
last;
}
}
} else {
# shouldn't happen
$cld = '01 01 1970';
}
# warn "in only_one: cld = >$cld<\n";
if ( open( my $CVD, '-|', "$sigtool -i $location/daily.cvd" ) ) {
while (<$CVD>) {
if (/Build time: (\d+\s\w+\s\d{4})/) {
$cvd = $1;
last;
}
}
} else {
# shouldn't happen
$cvd = '01 01 1970';
}