* ファイルアップロード [#dea80ad8]
$c->req->upload('csv_file')でオブジェクト取得、$upload->fhでIO::Fileオブジェクトを取得。
$c->req->upload('csv_file')でCatalyst::Request::Uploadオブジェクト取得、$upload->fhでIO::Fileオブジェクトを取得。
sub import_csv : Local {
my ( $self, $c ) = @_;
my $upload;
unless ($upload = $c->req->upload('csv_file') ) {
$c->detach('index');
}
my $csv = Text::CSV->new( { binary => 1 } );
my $idx = 0;
my $fh = $upload->fh;
while ( my $col = $csv->getline($fh) ) {
my ( $login_id, $passwd ) = ( $col->[0], $col->[1] );
}
}
http://search.cpan.org/perldoc?Catalyst::Request::Upload