ファイルアップロード$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] ); } } |
|