The following worked for me. I am not reading the file contents. I am
passing the uploaded path to another script later on.
my $path = $miffile->asset->path; # This is correct for
Mojo::Asset::File
my $tfile = File::Temp->new;
if (! $miffile->asset->is_file) { # It's really a Mojo::Asset::Memory
$miffile->move_to($tfile->filename); # Convert to file.
$c->app->log->info("New File : ".$tfile->filename);
$path = $tfile->filename; # This is the path I want now.
}
my $size = $miffile->size;
my $name = $miffile->filename;
# Execute the external command :
run3 ['myLint', $path ], \$in, \$out, \$err;
I will try to clean it up as you suggest. Thanks for the help and most
importantly for Mojolicious.
Nicky
On Saturday, February 3, 2018 at 1:58:20 PM UTC-7, sri wrote:
>
> I thought I tried that. Do I need to create the temp file first?
>>
>
> No, something like this should work perfectly fine.
>
> use Mojo::File 'tempfile';
> ...
> $miffile->move_to(my $temp = tempfile);
> say $tempfile->slurp;
> ...
>
> --
> sebastian
>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.