File: FileSet.pm

package info (click to toggle)
libextutils-builder-perl 0.017-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: perl: 1,351; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 742 bytes parent folder | download
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
38
39
40
41
42
package ExtUtils::Builder::FileSet;
$ExtUtils::Builder::FileSet::VERSION = '0.017';
use strict;
use warnings;

use Carp ();

sub new {
	my ($class, %args) = @_;
	my $self = bless {
		entries    => [],
		dependents => [],
		callback   => $args{callback},
	}, $class;
	return $self;
}

sub entries {
	my $self = shift;
	return @{ $self->{entries} };
}

sub add_dependent {
	my ($self, $dep) = @_;
	push @{ $self->{dependents} }, $dep;
	for my $file (@{ $self->{entries} }) {
		$dep->add_input($file);
	}
	return;
}

sub _pass_on {
	my ($self, $entry) = @_;
	push @{ $self->{entries} }, $entry;
	$self->{callback}->($entry) if $self->{callback};
	for my $dependent (@{ $self->{dependents} }) {
		$dependent->add_input($entry);
	}
	return;
}

1;