Wishlist thread (fourth edition)

343 views
Skip to first unread message

sri

unread,
Jun 11, 2016, 3:12:28 PM6/11/16
to Mojolicious
Hey everyone, it's that time of the year again! :)

In this thread you can post changes or features you would like to see in Mojolicious, no rules, just say what's on your mind.

P.S.: You're welcome to take a look at previous threads (https://groups.google.com/d/msg/mojolicious/hZu18SdEmbc/pEzv8diuA-gJ) to get an idea for what has already been discussed before.

--
sebastian

darutoko

unread,
Jun 11, 2016, 3:19:19 PM6/11/16
to Mojolicious
JADE-like template engine FTW!!!!

sri

unread,
Jun 11, 2016, 3:39:20 PM6/11/16
to Mojolicious
JADE-like template engine FTW!!!!

Think a lot of the Mojo::Template code could be reused for this, but it would still be a bigger project.

--
sebastian 

Matija Papec

unread,
Jun 13, 2016, 1:43:02 AM6/13/16
to Mojolicious

I'm not sure if some module already covers this, but directly passing messages/events between all worker forks would be nice to gather various information.
Also non-blocking rw file access for obvious reasons if it is possible.

regards

Matija Papec

unread,
Jun 13, 2016, 3:01:26 AM6/13/16
to Mojolicious

Almost forgot; also some nice while idiom for Mojo::IOLoop, for loops which use non-blocking calls.

Henk van Tijen ||

unread,
Jun 13, 2016, 8:07:38 AM6/13/16
to mojol...@googlegroups.com

A plugin that makes it a breeze to add OTP-based two-factor Authentication.
(or even better, user choice OTP or code sent by email)

~henk


sri

unread,
Jun 13, 2016, 10:02:14 AM6/13/16
to Mojolicious
I'm not sure if some module already covers this, but directly passing messages/events between all worker forks would be nice to gather various information.

Mojo::Pg already covers this with pub/sub.

 
Also non-blocking rw file access for obvious reasons if it is possible.

File I/O is always blocking, you'd have to use a thread-pool for this. So it's definitely not something for Mojolicious core, but it shouldn't be too hard to build a CPAN module that connects Mojo::IOLoop with IO::AIO.

--
sebastian 

Matija Papec

unread,
Jun 14, 2016, 1:00:08 AM6/14/16
to mojol...@googlegroups.com
Tnx for the tips.



--
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/JLZlJwkm0Ho/unsubscribe.
To unsubscribe from this group and all its topics, 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.

Pavel K

unread,
Jun 14, 2016, 1:55:41 AM6/14/16
to Mojolicious
What about validation on json params?
my $params = $s->req->json;

like this: 
my $validation = $s->validation;
$validation->output;

:)
суббота, 11 июня 2016 г., 22:12:28 UTC+3 пользователь sri написал:

Luc Didry

unread,
Jun 14, 2016, 5:43:07 AM6/14/16
to mojol...@googlegroups.com, sri
What about an option in Mojolicious::Plugin::Config that would allow to
write the current configuration option in the file?
(we would use pubsub to advertise workers that the configuration has changed)

Or have the possibility to have multiple configuration files? This way,
we could override the default configuration file by writing in the
second file the way we want, without need for the plugin to handle the
write thing.
--
Luc
http://www.fiat-tux.fr/
Internet n'est pas compliqué, Internet est ce que vous en faites.

Alexey Stavrov

unread,
Jun 14, 2016, 6:17:32 AM6/14/16
to Mojolicious
May be a good idea to add ability to set password for encrypted private key in Mojo::IOLoop::Client and appropriate property in Mojo::UserAgent?

воскресенье, 12 июня 2016 г., 0:12:28 UTC+5 пользователь sri написал:

Andrey Khozov

unread,
Jun 14, 2016, 6:40:07 AM6/14/16
to Mojolicious
1. JSON validation would be nice.
2. Some helpers for streaming JSON to simplify render large JSON without creating whole object in memory. (now this possible (ex. http://pastie.org/10875893), but it is not convenient)
3. "resolv" event in Mojo::IOLoop::Client, after resolving domains.
4. Make easy log rotation in prefork servers. For example passthrough some signals (like USR1) from manager to each worker, that the workers can reopen log files. Or may be add new event "reopen" to Mojo::Log.

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



--
Andrey Khozov

sri

unread,
Jun 14, 2016, 6:41:15 AM6/14/16
to Mojolicious
What about validation on json params?

This has come up a few times before, but the problem is that we don't know how to get the validator to validate nested data structures.

--
sebastian 

sri

unread,
Jun 14, 2016, 6:42:02 AM6/14/16
to Mojolicious, kra...@gmail.com, l...@didry.org
Or have the possibility to have multiple configuration files? This way,
we could override the default configuration file by writing in the
second file the way we want, without need for the plugin to handle the
write thing.

This should already be possible.

--
sebastian 

sri

unread,
Jun 14, 2016, 6:43:13 AM6/14/16
to Mojolicious
May be a good idea to add ability to set password for encrypted private key in Mojo::IOLoop::Client and appropriate property in Mojo::UserAgent?

Yes, this is a good idea, and i think there's a good chance that a patch for this would be accepted. It would just have to be consistent between Mojo::UserAgent and Mojo::Server::Daemon.

--
sebastian 

sri

unread,
Jun 14, 2016, 6:48:08 AM6/14/16
to Mojolicious
1. JSON validation would be nice.

Yes, this has come up before, but we don't know how to get the validator to validate nested data structures.
 
2. Some helpers for streaming JSON to simplify render large JSON without creating whole object in memory. (now this possible (ex. http://pastie.org/10875893), but it is not convenient)

I don't think it is possible to make this easier in Mojo::JSON without also making a lot of sacrifices.
 
3. "resolv" event in Mojo::IOLoop::Client, after resolving domains.

Are there use cases for this? Especially considering that Net::DNS::Native is optional?
 
4. Make easy log rotation in prefork servers. For example passthrough some signals (like USR1) from manager to each worker, that the workers can reopen log files. Or may be add new event "reopen" to Mojo::Log.

This has come up before too, and we were close to adding the feature, but then nobody sent a pull request...

--
sebastian 

Andrey Khozov

unread,
Jun 14, 2016, 7:06:28 AM6/14/16
to Mojolicious
 
3. "resolv" event in Mojo::IOLoop::Client, after resolving domains.

Are there use cases for this? Especially considering that Net::DNS::Native is optional?
 
​Use cases is a detailed timing stats​ for requests in Mojo::UserAgent (https://github.com/kraih/mojo/issues/939). So far, I don't see a problem with blocking resolver and new event.

--
Andrey Khozov

Dominique Dumont

unread,
Jun 14, 2016, 7:15:31 AM6/14/16
to mojol...@googlegroups.com, sri
On Tuesday 14 June 2016 03:41:15 sri wrote:
> This has come up a few times before, but the problem is that we don't know
> how to get the validator to validate nested data structures.

How about JSON::Schema or Config::Model to handle the validation ?

All the best

--
https://github.com/dod38fr/ -o- http://search.cpan.org/~ddumont/
http://ddumont.wordpress.com/ -o- irc: dod at irc.debian.org

sri

unread,
Jun 14, 2016, 7:23:42 AM6/14/16
to Mojolicious, kra...@gmail.com
How about JSON::Schema or Config::Model to handle the validation ?

Then it can just as well be a 3rd party plugin.

--
sebastian 

Tobias Oetiker

unread,
Jun 14, 2016, 7:57:18 AM6/14/16
to Mojolicious
Today sri wrote:

>
> >
> > 1. JSON validation would be nice.
> >
>
> Yes, this has come up before, but we don't know how to get the validator to
> validate nested data structures.

I use this in many of my projects ...

http://search.cpan.org/dist/Data-Processor/

cheers
tobi

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch to...@oetiker.ch +41 62 775 9902

sri

unread,
Jun 14, 2016, 8:15:47 AM6/14/16
to Mojolicious
> > 1. JSON validation would be nice.
> >
>
> Yes, this has come up before, but we don't know how to get the validator to
> validate nested data structures.

I use this in  many of my projects ...

http://search.cpan.org/dist/Data-Processor/ 

Guess i should have been more specific. We are not looking for a 3rd party module to use, that might just as well be used in a 3rd party Mojolicious plugin.
If JSON validation became a Mojolicious core feature, it would have to be integrated into Mojolicious::Validator, which currently only knows how to validate a flat hash containing strings or arrays of strings, but not nested data structures.

--
sebastian

Tobias Oetiker

unread,
Jun 14, 2016, 8:32:44 AM6/14/16
to Mojolicious
ah, I was not suggesting to use this module directly, but it
contains a nice method for defining validators that work with any
data structure you like ... you would certainly want to implement
this in a completely different and much more clever way anyway :)

Luc Didry

unread,
Jun 14, 2016, 6:36:35 PM6/14/16
to mojol...@googlegroups.com, sri
samedi 11 juin 2016, 12:12:28 CEST sri wrote:
Not pure Mojolicious wish, but could it be possible to have Minion
reloading itself if files changed in development mode? Just like morbo.

sri

unread,
Jun 14, 2016, 8:14:13 PM6/14/16
to Mojolicious, kra...@gmail.com, l...@didry.org
Not pure Mojolicious wish, but could it be possible to have Minion
reloading itself if files changed in development mode? Just like morbo.

Wishes for spin-off projects are fine too. Making Minion development more fun is something i wanted to do for a long time, but sadly won't be able to until i find new sponsors.
Pull requests would be welcome too, although i'm not sure yet what the best way to implement this might be.

--
sebastian 

sri

unread,
Jun 14, 2016, 8:18:38 PM6/14/16
to Mojolicious, kra...@gmail.com, l...@didry.org
Making Minion development more fun is something i wanted to do for a long time, but sadly won't be able to until i find new sponsors.

There's actually a huge backlog already.


--
sebastian

Luc Didry

unread,
Jun 15, 2016, 11:44:15 AM6/15/16
to sri, Mojolicious
mardi 14 juin 2016, 03:42:01 CEST sri wrote:
> This should already be possible.
>

Cool!

How? By adding a second call to the Config plugin?

Luc Didry

unread,
Jun 15, 2016, 3:18:45 PM6/15/16
to mojol...@googlegroups.com, sri
samedi 11 juin 2016, 12:12:28 CEST sri wrote:
> Hey everyone, it's that time of the year again!
>
> In this thread you can post changes or features you would like to see in
> Mojolicious, no rules, just say what's on your mind.
>
> P.S.: You're welcome to take a look at previous threads
> (https://groups.google.com/d/msg/mojolicious/hZu18SdEmbc/pEzv8diuA-gJ) to
> get an idea for what has already been discussed before.

Would it be possible to tweak the headers for static files?

Adding Expires and Cache-Control headers could be really useful.

sri

unread,
Jun 15, 2016, 3:41:32 PM6/15/16
to Mojolicious, kra...@gmail.com, l...@didry.org
Would it be possible to tweak the headers for static files?

Adding Expires and Cache-Control headers could be really useful.

Sure, if there's a well thought out proposal.

--
sebastian 

Luc Didry

unread,
Jun 15, 2016, 4:18:14 PM6/15/16
to sri, Mojolicious
Well, I was thinking about something like that:

$static->headers->{Expires} = 'Fri, 08 Jul 2016 19:54:46 GMT';

Or

my $headers = Mojo::Headers->new();
$headers->add('Expires' => 'Fri, 08 Jul 2016 19:54:46 GMT');
$static->headers($headers);

I had a look at the code of Mojolicious::Static, it does not seem too
hard to do, I could even try to submit a patch if the idea is OK :-)

Luc Didry

unread,
Jun 15, 2016, 5:02:21 PM6/15/16
to mojol...@googlegroups.com, sri
mercredi 15 juin 2016, 22:18:11 CEST Luc Didry wrote:
> Well, I was thinking about something like that:
>
> $static->headers->{Expires} = 'Fri, 08 Jul 2016 19:54:46 GMT';
>
> Or
>
> my $headers = Mojo::Headers->new();
> $headers->add('Expires' => 'Fri, 08 Jul 2016 19:54:46 GMT');
> $static->headers($headers);
>
> I had a look at the code of Mojolicious::Static, it does not seem too
> hard to do, I could even try to submit a patch if the idea is OK

And… done[1]. You can see the patch at
https://github.com/ldidry/mojo/commit/0a2dfb096d4f4b3096f27ae10ee7eb5832b2ad99

Tell me if it's ok to you and I'll submit a pull request :-)

[1] I used the first solution, with the hash.

sri

unread,
Jun 15, 2016, 5:38:23 PM6/15/16
to Mojolicious, kra...@gmail.com, l...@didry.org
And… done[1]. You can see the patch at
https://github.com/ldidry/mojo/commit/0a2dfb096d4f4b3096f27ae10ee7eb5832b2ad99

Tell me if it's ok to you and I'll submit a pull request :-)

Oh, i was expecting something a little more elaborate, with different defaults for development and production mode, optimized for all the browsers that are currently being used. This doesn't really add anything the after_static hook can't do already.

--
sebastian 

Luc Didry

unread,
Jun 15, 2016, 6:01:52 PM6/15/16
to sri, Mojolicious
mercredi 15 juin 2016, 14:38:23 CEST sri wrote:
> Oh, i was expecting something a little more elaborate, with different
> defaults for development and production mode, optimized for all the
> browsers that are currently being used. This doesn't really add anything
> the after_static hook can't do already.

I see what you say with "different defaults for development and production mode"[1],
but I don't with "optimized for all the browsers".

Do you have an example?

[1] like:
$static->headers->production({'Expires' => 'Fri, 08 Jul 2016 19:54:46 GMT'})
$static->headers->development({})
Is that what you think of? I'm not really sure, since it can be done
with after_static hook too

Joel Berger

unread,
Jun 16, 2016, 11:11:25 AM6/16/16
to Mojolicious, kra...@gmail.com, l...@didry.org
I imagine  you would want some easy way to set a cache duration, probably even a default cache duration, and have that then be translated into a time automatically on render/reply. The development specific behavior would likely then be to disable caching during development (when in development mode) so that you see the results of modifications quickly.

Luc Didry

unread,
Jun 16, 2016, 1:56:25 PM6/16/16
to Joel Berger, Mojolicious, kra...@gmail.com
jeudi 16 juin 2016, 08:11:24 CEST Joel Berger wrote:
> I imagine you would want some easy way to set a cache duration, probably
> even a default cache duration, and have that then be translated into a time
> automatically on render/reply. The development specific behavior would
> likely then be to disable caching during development (when in development
> mode) so that you see the results of modifications quickly.

Shouldn't be difficult.

Should this discussion continue in a separate thread or even in an issue on Github?

sri

unread,
Jun 16, 2016, 2:52:41 PM6/16/16
to Mojolicious, joel.a...@gmail.com, kra...@gmail.com, l...@didry.org
Should this discussion continue in a separate thread or even in an issue on Github?

Separate thread sounds good, i'm also getting the feeling that there's a lot to experiment with in 3rd party CPAN plugins here, before we start thinking about adding new core features.

--
sebastian 

Alexey Stavrov

unread,
Jun 17, 2016, 4:57:12 PM6/17/16
to Mojolicious
Add ability to get client certificate chain (may be via `$c->tx->req->cert`) to validate it (for example, to verify that the certificate was issued by my CA, or any others that I trust)


воскресенье, 12 июня 2016 г., 0:12:28 UTC+5 пользователь sri написал:
Hey everyone, it's that time of the year again! :)

In this thread you can post changes or features you would like to see in Mojolicious, no rules, just say what's on your mind.

P.S.: You're welcome to take a look at previous threads (https://groups.google.com/d/msg/mojolicious/hZu18SdEmbc/pEzv8diuA-gJ) to get an idea for what has already been discussed before.

--
sebastian

Andrey Khozov

unread,
Jun 21, 2016, 7:06:29 AM6/21/16
to Mojolicious
Save and load methods in Mojo::UserAgent::CookieJar would be nice, like in LWP::UserAgent/HTTP::Cookies.

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



--
Andrey Khozov

sri

unread,
Jun 21, 2016, 7:43:24 PM6/21/16
to Mojolicious
We have started preparations for the Mojolicious 7.0 release, so now would be the perfect time to propose breaking changes!

--
sebastian

Pavel K

unread,
Jun 22, 2016, 12:35:27 AM6/22/16
to Mojolicious
What do you think about default router like "otherwise" in angularjs?

Alexey Stavrov

unread,
Jun 22, 2016, 6:23:55 AM6/22/16
to Mojolicious
Mojolicious have ability to set certificate and verify clients when CA is set and verify clients when no CA by setting it to \undef which looks strange and not documented.
But no ability to authenticate (get email from CN param for example) users by their certificates, because it is not possible to access any information about the client's certificate in controller (may be i don't know something?).
So, will be good if programmer could get info about client's certificate and obtain information on the validity of the certificate from controller.

Sorry for bad english.

среда, 22 июня 2016 г., 4:43:24 UTC+5 пользователь sri написал:

sri

unread,
Jun 22, 2016, 8:31:29 AM6/22/16
to Mojolicious
What do you think about default router like "otherwise" in  angularjs?

Already possible.

--
sebastian 

sri

unread,
Jun 22, 2016, 8:32:04 AM6/22/16
to Mojolicious
But no ability to authenticate (get email from CN param for example) users by their certificates, because it is not possible to access any information about the client's certificate in controller (may be i don't know something?).
So, will be good if programmer could get info about client's certificate and obtain information on the validity of the certificate from controller.

Also already possible.

--
sebastian 

Brian Manning

unread,
Jun 22, 2016, 10:30:40 AM6/22/16
to Mojolicious
Aliases for has/attr attribute names?

Maybe something like:

  $obj->attr('message', alias => [ qw(m msg) ]);

Jan Henning Thorsen

unread,
Jun 24, 2016, 2:59:12 AM6/24/16
to Mojolicious
When it comes to JSON validation, I would like to mention...

https://metacpan.org/pod/JSON::Validator - Much more up to date than JSON::Schema
https://metacpan.org/release/Swagger2 - Framework for building REST APIs
https://metacpan.org/pod/Mojolicious::Plugin::OpenAPI - Going to be successor of M::P::Swagger2

Please join #swagger on irc.perl.org for questions or feedback.


On Tuesday, June 14, 2016 at 7:55:41 AM UTC+2, Pavel K wrote:
What about validation on json params?
my $params = $s->req->json;

like this: 
my $validation = $s->validation;
$validation->output;

:)
суббота, 11 июня 2016 г., 22:12:28 UTC+3 пользователь sri написал:

jamadam

unread,
Jul 5, 2016, 10:42:53 AM7/5/16
to Mojolicious
Hi.

Since couple commits ago application tests with Test::Mojo got little bit more complex.

<h1>
    Mojolicious
</h1>


$ua->get_ok(...)->text_is('h1', 'Mojolicious');

#          got: '
#     Mojolicious
# '
#     expected: 'Mojolicious'

Isn't it a good idea to provide a test method which performs trim and compare at once?
It also makes upgrading to v7.0 easier.

$ua->get_ok(...)->text_resemble('h1', 'Mojolicious');

package Test::Mojo

sub text_resemble {
 
my ($self, $selector, $value, $desc) = @_;
  $desc
||= encode 'UTF-8', qq{exact match for selector "$selector"};
 
return $self->_test('is', trim($self->_text($selector)), $value, $desc);
}

Thank you.

sri

unread,
Jul 5, 2016, 11:05:34 AM7/5/16
to Mojolicious
Isn't it a good idea to provide a test method which performs trim and compare at once?
It also makes upgrading to v7.0 easier.

You might want to take a look at the IRC discussion that happened around the same time. It's not that we don't want to suport text rendering, it's that we have been unable to figure out the correct rules. The topic is *a lot* more complicated than it seems.

--
sebastian 

Keita Sugama

unread,
Jul 5, 2016, 11:25:17 AM7/5/16
to mojol...@googlegroups.com
Hmm, ok. <pre> is complicated :)
> --
> 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
> <mailto:mojolicious...@googlegroups.com>.
> To post to this group, send email to mojol...@googlegroups.com
> <mailto:mojol...@googlegroups.com>.

Christopher Causer

unread,
Jul 10, 2016, 5:08:43 PM7/10/16
to Mojolicious
Yes, I know this would be possible outside of core as a separate module, but I thought I'd ask :)

If there were a Mojo::Template equivalent of tpage and (particularly) ttree, I'd be very, very happy.

http://template-toolkit.org/docs/tools/tpage.html
http://template-toolkit.org/docs/tools/ttree.html

k...@jobindex.dk

unread,
Jul 11, 2016, 4:49:03 AM7/11/16
to Mojolicious
Hi,

A functionality we would like to see, is the ability to always apply a filter when a specific validator check is called.

As a simple example, if you have a generic "integer" check, it makes sense (as a usability feature) to always trim the input before verifying that it only contains numbers.

You can sort of do this now, by modifying the output in the validation object from within the check function. But if you also want to support more than one value for the same parameter, you basically need to validate all the values in each call to the check function.

The alternative, always having to write:

$v->required('param', 'trim')->integer();

has turned out to be error prone for us ;-)

/Klaus

Dotan Dimet

unread,
Jul 11, 2016, 12:01:46 PM7/11/16
to mojol...@googlegroups.com
Make more stuff extensible.
Mojolicious has plugins and commands, but there are a few other tools in the toolkit that could do with
more flexible extensibility, specifically the User Agent and Test::Mojo.
Extending these requires subclassing or wrapping, which prevents different extensions from interoperating easily - Joel's Test::Mojo::WithRoles wraps Test::Mojo for easier extending, but extending the Mojo tools with easy interoperability should really be possible without everyone standardizing on a third-party solution.
I can think of other classes it would be fun to extend with roles - for example, adding a links() method to Mojo::Message::Response or other shortcuts to repetitive DOM-grovelling.

- Dotan

Regarding the User Agent,

On 11/06/16 22:12, sri wrote:
Hey everyone, it's that time of the year again! :)

In this thread you can post changes or features you would like to see in Mojolicious, no rules, just say what's on your mind.

P.S.: You're welcome to take a look at previous threads (https://groups.google.com/d/msg/mojolicious/hZu18SdEmbc/pEzv8diuA-gJ) to get an idea for what has already been discussed before.

--
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 mojolicious...@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Matija Papec

unread,
Aug 5, 2016, 5:05:44 PM8/5/16
to Mojolicious

Support for SSL_fingerprint and SSL_verify_callback options would be really nice for:
Reply all
Reply to author
Forward
0 new messages