diff options
Diffstat (limited to 'scripts/Dpkg/Dist/Files.pm')
-rw-r--r-- | scripts/Dpkg/Dist/Files.pm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/Dpkg/Dist/Files.pm b/scripts/Dpkg/Dist/Files.pm index c5d5fb0e1..2c4ab53ce 100644 --- a/scripts/Dpkg/Dist/Files.pm +++ b/scripts/Dpkg/Dist/Files.pm @@ -20,6 +20,8 @@ use warnings; our $VERSION = '0.01'; +use IO::Dir; + use Dpkg::Gettext; use Dpkg::ErrorHandling; @@ -101,6 +103,19 @@ sub parse { return $count; } +sub load_dir { + my ($self, $dir) = @_; + + my $count = 0; + my $dh = IO::Dir->new($dir) or syserr(g_('cannot open directory %s'), $dir); + + while (defined(my $file = $dh->read)) { + $count += $self->load("$dir/$file"); + } + + return $count; +} + sub get_files { my $self = shift; |