File: AllSrc.pm

package info (click to toggle)
debram 1.0.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,796 kB
  • ctags: 437
  • sloc: perl: 2,953; ansic: 1,901; makefile: 169; sh: 14
file content (37 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package AllSrc;
use warnings;
use strict;
use integer;
use AllSrcBin;
our @ISA = ( 'AllSrcBin' );
use DebSrc;

sub new {
  my $class = shift;
  my $src   = AllSrcBin::new( 'AllSrc', @_ );
  bless $src, $class;
  return $src;
}

sub instantiate_one {
  my( $src, $fh ) = @_;
  return DebSrc->new( $fh );
}

# Refer each source to its respective binaries.  (Notice that the
# package cannot use AllBin, or there would be a circular package
# dependency.  However, because no AllBin method is called, because the
# AllBin object is treated here as a simple hash, it does not matter.
# This may breaks standard OO notions, but it seems to fit here.)
sub refer_to_bin {
  my( $src, $bin )     = @_;
  $src->{$_}{binaries} = [] for keys %$src;
  for my $pname ( sort grep {length} keys %$bin ) {
    my $source = $bin->{$pname}{Source};
    push @{ $src->{$source}{binaries} }, $pname;
  }
  return $src;
}

1;