| 1 |
package AllSrc; |
| 2 |
use warnings; |
| 3 |
use strict; |
| 4 |
use integer; |
| 5 |
use AllSrcBin; |
| 6 |
our @ISA = ( 'AllSrcBin' ); |
| 7 |
use DebSrc; |
| 8 |
|
| 9 |
sub new { |
| 10 |
my $class = shift; |
| 11 |
my $src = AllSrcBin::new( 'AllSrc', @_ ); |
| 12 |
bless $src, $class; |
| 13 |
return $src; |
| 14 |
} |
| 15 |
|
| 16 |
sub instantiate_one { |
| 17 |
my( $src, $fh ) = @_; |
| 18 |
return DebSrc->new( $fh ); |
| 19 |
} |
| 20 |
|
| 21 |
# Refer each source to its respective binaries. (Notice that the |
| 22 |
# package cannot use AllBin, or there would be a circular package |
| 23 |
# dependency. However, because no AllBin method is called, because the |
| 24 |
# AllBin object is treated here as a simple hash, it does not matter. |
| 25 |
# This may breaks standard OO notions, but it seems to fit here.) |
| 26 |
sub refer_to_bin { |
| 27 |
my( $src, $bin ) = @_; |
| 28 |
$src->{$_}{binaries} = [] for keys %$src; |
| 29 |
for my $pname ( sort grep {length} keys %$bin ) { |
| 30 |
my $source = $bin->{$pname}{Source}; |
| 31 |
push @{ $src->{$source}{binaries} }, $pname; |
| 32 |
} |
| 33 |
return $src; |
| 34 |
} |
| 35 |
|
| 36 |
1; |
| 37 |
|