in reply to faulty expression prob
I'm not squemish about compound statements, and I like to avoid unnecessary code, but this makes me wince:
return $pkg->{'DIST'} = ( $rh = $pkg->{'RPM_HDR'} and $dist = $rh->tag('DISTRIBUTION') ) ? $dist : $undef;
It should work, but since you need two temporary vars which have to be declared (you do use strict don't you;), then this seems much cleaner:
$pkg->{'DIST'} = undef; my $rh = $pkg->{'RPM_HDR'} or return; my $dist = $rh->tag('DISTRIBUTION') or return; return $pkg->{'DIST'} = $dist;
Probably minutely more efficient to boot.
|
|---|