Modestas Vainius wrote:
> +sub load_log {
> + my ($package, $db)=...@_;
> + my $ext=pkgext($package);
> +
> + my @log;
> + open(LOG, "<", "debian/${ext}debhelper.log") || return;
> + while (<LOG>) {
> + chomp;
> + push @log, $_;
> + $db->{$package}{$_}=1 if (defined $db);
> + }
> + close LOG;
> + return @log;
> +}
>
> sub write_log {
> my $cmd=shift;
> @@ -121,6 +136,15 @@ sub inhibit_log {
> $write_log=0;
> }
>
> +sub is_in_log {
> + my $package=shift;
> + my %db;
> + my $cmd=basename($0);
> +
> + load_log($package, \%db);
> + return exists $db{$package}{$cmd};
> +}
Looking at this closer, it seems unnecessarily overcomplicated to pass
$db to load_log and build the complex hash structure. With the function
just returning a list, all that's needed is:
grep { $_ eq basename($0) } load_log($package);
Probably no need for the is_in_log function when it's that simple.
--
see shy jo
signature.asc
Description: Digital signature

