From: Matt S Trout Date: Sat, 16 May 2009 14:36:53 +0000 (+0100) Subject: correct IO::All usage X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd5885d7cf2e1c3eec6147a82848d1c5599c0237;p=engit%2FIron-Munger.git correct IO::All usage --- diff --git a/lib/IronMunger/PlaggerLoader.pm b/lib/IronMunger/PlaggerLoader.pm index 57174c3..08daf15 100644 --- a/lib/IronMunger/PlaggerLoader.pm +++ b/lib/IronMunger/PlaggerLoader.pm @@ -18,7 +18,7 @@ class IronMunger::PlaggerLoader { has dir => (is => 'ro', isa => Dir, required => 1, coerce => 1); method _target_files () { - grep $_->name =~ /\.csv$/, io($self->dir)->get_files; + grep $_->name =~ /\.csv$/, io($self->dir)->all_files; } method _expand_post (HashRef $post_spec) { diff --git a/t/plagger_loader.t b/t/plagger_loader.t index 9aa613f..2b7539a 100644 --- a/t/plagger_loader.t +++ b/t/plagger_loader.t @@ -2,10 +2,22 @@ use strict; use warnings; use Test::More qw(no_plan); + BEGIN { use_ok aliased => 'IronMunger::PlaggerLoader'; } +my @names = ('Jess Robinson', 'Justin DeVuyst'); + +my @files = ('my_Jess_Robinson.csv', 'my_Justin_DeVuyst.csv'); + ok(my $loader = PlaggerLoader->new(dir => 't/csv'), 'build loader'); +my @target = $loader->_target_files; + +cmp_ok(@target, '==', 2, '2 files in CSV directory'); +is_deeply( + [ sort map { ($_->splitpath)[-1] } @target ], \@files, + 'filenames ok' +);