Thanks very much Brain,

as your suggestion, I print out the $tx error, yes, the $tx->success is
indeed false, and the error message is

IO::Socket::SSL 1.94+ required for TLS support

After google it, I find the solution in this page
http://yaskevich.com/mojo-useragent-fails-on-https-connection

just run cpan IO::Socket::SSL ,

Now the code  can works for me.  Thanks for your help.


Thanks,
Peng

On Thu, May 26, 2016 at 10:05 PM, Brian Manning <[email protected]> wrote:

>
>
> On Wednesday, May 25, 2016 at 10:27:14 AM UTC-7, Peng Li wrote:
>>
>> but when I test the example on the website, I test this example
>>
>> http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Large-file-downloads
>>
>> use Mojo::UserAgent;
>> # Fetch the latest Mojolicious tarballmy $ua = 
>> Mojo::UserAgent->new(max_redirects => 5);my $tx = 
>> $ua->get('https://www.github.com/kraih/mojo/tarball/master');
>> $tx->res->content->asset->move_to('mojo.tar.gz');
>>
>>
>> this code doesn't work for me, it indeed generate a new file mojo.tar.gz,
>> but the size is 0B.
>>
>
> This code worked fine for me; the downloaded tarball size is 651k, so no
> problems with the default MOJO_MAX_MESSAGE_SIZE.
>
> Maybe you have permissions and/or network issues on your host that's
> preventing you from writing the file?  The Mojo::UserAgent example [1]
> shows how to query $tx to see if an error was returned from your request; I
> would suggest seeing if an error was returned, and if so, what the error is.
>
> My environment:
>
> OS X Yosemite 10.10.5
> Perl version: 5.22.1
> Mojolicious version: 6.58
>
> Thanks,
>
> Brian
>
> [1] https://metacpan.org/pod/Mojo::UserAgent#SYNOPSIS
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mojolicious" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mojolicious/KE7a6-4kyRg/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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.

Reply via email to