Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created July 1, 2012 21:25
Show Gist options
  • Save ynonp/3029693 to your computer and use it in GitHub Desktop.
Save ynonp/3029693 to your computer and use it in GitHub Desktop.
package MultipleFileUploader;
use Moose::Role;
requires 'upload_file';
sub upload_files {
my $self = shift;
my @success;
foreach my $f ( @_ ) {
die "Invalid file: $f" if ! $f->DOES('File');
$self->upload_file ( $f ) && push @success, $f;
}
return @success;
}
package FTPFileUploader;
use Moose;
with 'MultipleFileUploader';
sub upload_file { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment