Re: [Mojolicious] Uploading "large" files with Mojolicious::Lite not working as expected

2018-02-06 Thread Sebastian Riedel
> When a file with size under 16MB is uploaded, everything works fine, but
> when a file larger then 16MB is uploaded (which is the default max) I am
> expecting to see "File is too big." message, instead I am getting connection
> reset.

That's not possible, a request has to be fully received to be able to send a
response, and that's often counterproductive, so a connection reset happens.

We've been looking for a better solution for years, but not found one yet.
Browsers make it a tricky problem.

Sebastian Riedel
http://mojolicio.us
http://github.com/kraih
http://twitter.com/kraih

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Mojo::Base get all attributes names

2018-02-06 Thread Dan Book
If you want the introspection you're going to be expanding objects to Moose
anyway so you might want to start there (though if you rarely do the
introspection, using Moo for everything else may be a benefit). As for
Mouse I would not recommend its usage to be combined with any other
modules. https://shadow.cat/blog/matt-s-trout/moo-versus-any-moose/

-Dan

On Tue, Feb 6, 2018 at 10:04 AM, Илья Рассадин  wrote:

> To be fare, Mouse can do it as well. And Moo too (but not with support of
> Moose Meta Object Protocol).
>
> понедельник, 5 февраля 2018 г., 21:13:19 UTC+3 пользователь Charlie Brady
> написал:
>>
>>
>> On Mon, 5 Feb 2018, Dan Book wrote:
>>
>> > Introspection capabilities are a feature of Moose.
>>
>> Moose, however, adds many, many more dependencies than Mojo::Base...
>>
>> >
>> > On Mon, Feb 5, 2018 at 5:14 AM, Konstantin Cherednichenko <
>> > dshadow...@gmail.com> wrote:
>> >
>> > > Hello!
>> > >
>> > > Is there any easy way to get all attributes names?
>> > >
>> > > I tried to get it via ISA but I also got methods names... I just want
>> to
>> > > get "propA" and "propB"...
>> > > Could someone please help me?
>> > >
>> > > My example:
>> > >
>> > > #!/usr/bin/env perl
>> > >
>> > > package A;
>> > > use Mojo::Base -base;
>> > >
>> > > has propA => 123;
>> > > has propB => 'val';
>> > >
>> > > sub get_props_names
>> > > {
>> > > my $self = shift;
>> > >
>> > > my %names = ();
>> > >
>> > > {
>> > > my $base_class = ref($self);
>> > >
>> > > no strict 'refs';
>> > >
>> > > foreach my $class ($base_class, @{"${base_class}::ISA"})
>> > > {
>> > > foreach my $name (keys %{"${class}::"})
>> > > {
>> > > $names{$name} ||= 1;
>> > > }
>> > > }
>> > > };
>> > >
>> > > return [sort keys %names];
>> > > }
>> > >
>> > > package main;
>> > > use Mojo::Base -strict;
>> > > use Data::Dumper;
>> > >
>> > > my $obj = A->new;
>> > >
>> > > say Dumper($obj->get_props_names);
>> > >
>> > > --
>> > > 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 mojolicious...@googlegroups.com.
>> > > To post to this group, send email to mojol...@googlegroups.com.
>> > > 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 mojolicious+unsubscr...@googlegroups.com.
> To post to this group, send email to mojolicious@googlegroups.com.
> 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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Excessive stop/start hypnotoad workers

2018-02-06 Thread Илья Рассадин
Looks like this is behaviour of a gracefull_timeout attribute of 
Mojo::Server::Hypnotoad
>From the docs 
https://metacpan.org/pod/Mojo::Server::Hypnotoad#graceful_timeout

Maximum amount of time in seconds stopping a worker gracefully may take 
before being forced, defaults to the value of "graceful_timeout" in 
Mojo::Server::Prefork 
. Note 
that this value should usually be a little larger than the maximum amount 
of time you expect any one request to take.


So you need to set graceful_timeout, not only inactivity_timeout to achieve 
desired behaviour.

вторник, 6 февраля 2018 г., 8:52:54 UTC+3 пользователь Mikhail написал:
>
> $ mojo version
>> CORE
>>   Perl(v5.26.1, linux)
>>   Mojolicious (7.61, Doughnut)
>>
>> OPTIONAL
>>   EV 4.0+ (4.22)
>>   IO::Socket::Socks 0.64+ (n/a)
>>   IO::Socket::SSL 1.94+   (2.052)
>>   Net::DNS::Native 0.15+  (n/a)
>>   Role::Tiny 2.01+(2.06)
>>
>>
> Hi!
>
> I have a trouble with Mojolicious project serves by hypnotoad. My problem 
> occur on requesting heavy SQL data.
>
> I had increase $c->inactivity_timeout(600) in some controller action.
>
> At the log I see that the workers go down on that actions/requests:
>
> Fr 2 Feb 09:52:31 [d] Mojolicious:131 POST "/some/report/data"
>> Fr 2 Feb 09:52:31 [d] Mojolicious::Routes:162 Routing to controller 
>> "Controll::Some::Report" and action "data"
>> Fr 2 Feb 09:53:03 [i] Mojo::Server::Prefork:128 Stopping worker 1526 
>> gracefully (120 seconds)
>> Fr 2 Feb 09:53:03 [i] Mojo::Server::Prefork:162 Worker 726 started
>> Fr 2 Feb 09:53:10 [d] Mojolicious::Controller:211 200 OK (38.658608s, 
>> 0.026/s)
>> Fr 2 Feb 09:53:10 [i] Mojo::Server::Prefork:173 Worker 1526 stopped
>>
>>
>
> On each request workers go down and new one start. Browser get data 
> successfully.
>  
>
> Another requests to other fast time actions has normal behavior - without 
> stopping workers.
>
>
> This is not very big problem but little bit miss proper.
>
>
>
>
>

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Mojo::Base get all attributes names

2018-02-06 Thread Илья Рассадин
To be fare, Mouse can do it as well. And Moo too (but not with support of 
Moose Meta Object Protocol).

понедельник, 5 февраля 2018 г., 21:13:19 UTC+3 пользователь Charlie Brady 
написал:
>
>
> On Mon, 5 Feb 2018, Dan Book wrote: 
>
> > Introspection capabilities are a feature of Moose. 
>
> Moose, however, adds many, many more dependencies than Mojo::Base... 
>
> > 
> > On Mon, Feb 5, 2018 at 5:14 AM, Konstantin Cherednichenko < 
> > dshadow...@gmail.com > wrote: 
> > 
> > > Hello! 
> > > 
> > > Is there any easy way to get all attributes names? 
> > > 
> > > I tried to get it via ISA but I also got methods names... I just want 
> to 
> > > get "propA" and "propB"... 
> > > Could someone please help me? 
> > > 
> > > My example: 
> > > 
> > > #!/usr/bin/env perl 
> > > 
> > > package A; 
> > > use Mojo::Base -base; 
> > > 
> > > has propA => 123; 
> > > has propB => 'val'; 
> > > 
> > > sub get_props_names 
> > > { 
> > > my $self = shift; 
> > > 
> > > my %names = (); 
> > > 
> > > { 
> > > my $base_class = ref($self); 
> > > 
> > > no strict 'refs'; 
> > > 
> > > foreach my $class ($base_class, @{"${base_class}::ISA"}) 
> > > { 
> > > foreach my $name (keys %{"${class}::"}) 
> > > { 
> > > $names{$name} ||= 1; 
> > > } 
> > > } 
> > > }; 
> > > 
> > > return [sort keys %names]; 
> > > } 
> > > 
> > > package main; 
> > > use Mojo::Base -strict; 
> > > use Data::Dumper; 
> > > 
> > > my $obj = A->new; 
> > > 
> > > say Dumper($obj->get_props_names); 
> > > 
> > > -- 
> > > 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 mojolicious...@googlegroups.com . 
> > > To post to this group, send email to mojol...@googlegroups.com 
> . 
> > > 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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Validation

2018-02-06 Thread Mikhail


Stefan Adams:
>
> How can I set up a validation to require one parameter of a group? For 
> example, I need to require City and State, or Zip. 
>

Seems

my $validation = $c->validation;
> $validation->required('City')->in('Pyongyang');
> $validation->required('State')->in('North Korea');
> $validation->required('Zip')->in('007007');
> my $bool = ( $validation->is_valid('City') && 
> $validation->is_valid('State') )
> || $validation->is_valid('Zip');
>

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.