The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-12-03

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:11 brunoramos joined #mojo
00:43 preaction ... i just started building Mason's dirhandlers into Yancy... i think i should stop here for now...
00:50 jberger No. No no no no no
00:50 preaction heh, i thought that'd get you
00:50 jberger And if you so much as think the word "autohandler"!
00:50 preaction it's seductive though: I can build a CMS powered entirely by templates!
00:50 preaction but it's Mojolicious under the hood!
00:51 jberger XSLT4LYFE
00:51 preaction ugh... i think i'm coming to my senses...
00:54 preaction hah. the url_with() thing wasn't behaving as i thought, i had a different bug...
01:12 preaction the first release of the simple Mojo admin CMS is out: https://metacpan.org/release/PREACTION/Yancy-0.001 already have two bugs to fix, and want to take some screenshots for the docs
01:18 aborazmeh joined #mojo
02:21 good_news_everyon joined #mojo
02:21 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbYdB
02:21 good_news_everyon mojo/master df686f3 Sebastian Riedel: link to extensions too
02:21 good_news_everyon left #mojo
02:22 sri preaction: you just reminded me that we maybe should highlight the size of the eco system :)
02:23 sri something is wrong with metacpan though, i remember us having at least 666 reverse dependencies
02:24 preaction sri: i was thinking the same thing... a blog post series / talk about the major ecosystem projects
02:25 preaction like, shit, at least two of them are mine... :p
02:25 sri oh, the reverse link on metacpan changed
02:25 preaction ... sorry, didnt mean to swear
02:26 good_news_everyon joined #mojo
02:26 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbYd2
02:26 good_news_everyon mojo/master fd61dbc Sebastian Riedel: include a few hundred more modules
02:26 good_news_everyon left #mojo
02:28 sri 714 btw.
02:31 gizmomathboy joined #mojo
02:35 good_news_everyon joined #mojo
02:35 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbYdS
02:35 good_news_everyon mojo/master 8324c4e Sebastian Riedel: link to MetaCPAN from the README
02:35 good_news_everyon left #mojo
02:43 good_news_everyon joined #mojo
02:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbYdh
02:56 good_news_everyon mojo/master 220c6d2 Sebastian Riedel: include configuration file in example
02:56 good_news_everyon left #mojo
02:57 ilbot2 joined #mojo
02:57 Topic for #mojo is now 🍩 nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
03:00 Grinnz " If you want to control which users have access to data, you should use an HTTP proxy with these features." ewww http auth
03:09 preaction or use the plugin, up to you
03:09 preaction also, http auth has all kinds of backends
03:14 Grinnz all kinds of terrible ones :P
03:15 preaction i mean, it's that or try to impose some kind of account system, which involves also imposing an ORM of some kind. then it starts getting messy :(
03:16 preaction i can get away without the ORM: have the admin configure a "user" collection with some set of fields, i guess... but then we get to authorization and it starts getting messy again...
03:17 Grinnz dunno why it would need an ORM, but yeah auth is messy
03:20 preaction i need to know which fields are the user's identifier and password, and how to hash the password to check it. then i need to know what the user is authorized for. at which point someone will want groups, 2FA, OAuth, password recovery, and ...
03:20 Grinnz sounds like a job for a plugin system so you can make other people write it!
03:21 preaction i think it's better to just forgo all that for now. if you're adding this to your existing Mojolicious app, you likely already have an auth plugin of some kind
03:21 preaction but i don't need a plugin system if mojolicious has a plugin system
03:21 Grinnz yeah, thats much simpler :P
03:22 preaction no matter what you're going to need to write some of your own routes to display the data you have usefully, so there's really no way around adding _something_ to the base Yancy gives you
03:23 preaction so making one of those things "authentication and authorization" isn't so terrible i think
03:25 preaction the standalone mode is more for "you're not using mojolicious" or "you don't want to expose the admin ui on every node in the cluster"
03:27 preaction i could simply add { plugins => { "class" => { ... } } } to the config file, and then any mojolicious plugins would "work" (unless they need complicated config, at which i can't help)
03:28 Grinnz that's a neat idea
03:29 preaction so then some yancy-specific plugins could be written that wrapped any complex mojolicious plugins... could even make it look in Yancy::Plugin:: and Mojolicious::Plugin...
03:29 preaction i'll add it to my list
03:31 preaction i do also want to make a multi-tenant version of the yancy plugin. i think that'll actually be pretty easy. just need a configuration that knows who you are and how to mark rows in the database as belonging to you
04:15 bit_shifter How can I add monkey_patch'd subs to an already-blessed class?  Or how do I achieve similar results, if that's the wrong question?
04:22 preaction bit_shifter: you want to monkey patch a single object's methods?
04:22 bit_shifter yes
04:23 preaction you can't really. Role::Tiny allows composing roles into an object. you could also detect the single instance of an object and do the right thing in the monkey-patched method. but yes, this is weird. why do you need to do this?
04:25 bit_shifter There's an API endpoint that describes all of its methods as the result of an API request.  I'd like to that that information and build them into a perl object as native methods.
04:26 preaction so that doesn't need monkeypatching
04:27 preaction read perldoc perlsub, look for AUTOLOAD, but don't do this. make a single method that does the API call by name
04:27 preaction there is really never any good reason to use AUTOLOAD
04:29 Grinnz you could use Moose to build classes dynamically
04:29 bit_shifter Ha, fair enough.  I've been using the single method like you're describing, but I thought it would be cool to explore the native method route.
04:30 preaction it isn't, it makes the api much, much harder to understand
04:30 Grinnz with the metaclass
04:30 preaction woe betide you when there's a character in the api that can't be represented in a Perl identifier :(
04:31 bit_shifter Hm, haven't really used Moose before.
04:31 preaction that's the same thing as AUTOLOAD but with extra steps
04:31 preaction (in this use-case, at least)
04:32 Grinnz not really, the methods would be real
04:32 preaction but they wouldn't be written down in some class or documented
04:32 preaction so the same drawbacks, but now we've got a dependency and a bunch of metamagic to learn about
04:33 preaction i've argued this one a lot, so i've got lots of practice ;)
04:33 Grinnz still better than using autoload; and either way documenting the available methods is going to be just as difficult if they're coming dynamically from an api
04:34 bit_shifter In my case, I'm relying entirely on someone else's API documentation anyway.  The only difference between the calls would be passing the exact method name in a string to my method vs having the method be attached to the object natively.
04:35 bit_shifter It might not be worth messing with, really.  I thought it was an interesting idea though.
04:35 Grinnz i would agree its better just to pass the name as a string
04:35 preaction if there's a single method, there's a clear line from "$api->call( 'foo' )" through "perldoc API" L</foo> to "documentation for the API methods can be found L<http://example.com>"
04:35 preaction er... L</call>
04:35 Grinnz thats not really any different from "$api->foo documentation can be found at X"
04:36 preaction that can't be _in_ the documentation though, as "foo" is whatever the remote api says it is. you have no control over it, and no way to know what "foo" will be
04:36 Grinnz which is still true if you pass a string
04:37 preaction except that since it's not the name of a method, i don't expect it to be documented
04:37 Grinnz why not?
04:37 preaction if i see $api->foo, i expect "foo" to appear once in the docs, as a heading especially
04:37 Grinnz if the whole module consists only of generated methods, the documentation on that class would be pretty clear
04:37 preaction if it's an argument to "call", i look at "call"'s docs, see what that argument means and then follow the link to the fine documentation
04:38 Grinnz and mostly identical to what the documentation of this 'call' method would be
04:38 preaction but i'd have to read the entire document start to finish to figure that out
04:39 Grinnz eh, i don't get it but not worth continuing this really, bad idea either way
04:39 preaction and that's if i even know the right document to go to :(
04:40 preaction how many times i do "huh, a sub foo eh? lets see what modules have one of those": ack 'sub foo' lib
04:40 preaction "wait... none? wtf is going on here?!"
04:40 Grinnz cant say ive ever done that to *find* a sub
04:40 preaction i wish i had the muscle memory for ctags, i really do...
04:43 bit_shifter Even if it's a bad idea, I appreciate the insight.  Thanks to both of you.
05:26 jamesaxl joined #mojo
06:17 Vandal joined #mojo
06:26 jberger Day 3! https://twitter.com/joelaberger/status/937205798404546561
08:29 trone joined #mojo
09:04 trone_ joined #mojo
09:11 dod joined #mojo
09:19 dod joined #mojo
11:30 itaipu joined #mojo
12:07 Leffe joined #mojo
13:01 brunoramos joined #mojo
13:14 ghenry joined #mojo
14:14 Psiman joined #mojo
14:16 geospeck joined #mojo
14:18 geospeck joined #mojo
14:19 geospeck joined #mojo
14:20 geospeck joined #mojo
14:45 Leffe joined #mojo
14:50 Leffe joined #mojo
14:59 geospeck joined #mojo
15:05 sri why is the perl subreddit full of perl6 advent calendar entries and no for perl5? Oo
15:10 mattp id ask why is the perl subreddit full of perl6 articles
15:17 sri seems to be a spam bot
15:18 sri and the moderators don't care
15:43 ChmEarl joined #mojo
16:09 geospeck joined #mojo
16:09 geospeck joined #mojo
16:25 Leffe joined #mojo
16:42 sri jberger: should i just throw ideas for calendar entries at you?
16:42 sri i'm sure you already have the obvious ones on your list, like session/flash
16:43 sri lesser obvious ones would be simple objects with Mojo::Base has/tap
16:44 sri how to use roles, maybe with a Mojo::UserAgent role as example
16:44 sri Mojo::DOM could be two or three days, split up into extracting and manipulation of HTML/XML
16:46 sri ojo one-liners, like how we like to do benchmarking with n {}
16:47 sri the get command, recent additions like forms and piping data to STDIN have not gotten much attention yet
16:47 sri signatures and how they look in different parts of mojolicious, lite apps, controllers, models, one-liners
16:48 sri re Mojo::DOM, that could actually be many days, there's little topics like how the node tree works that can easily fill a day
16:49 sri promises obviously :p
16:49 sri how to use Mojo::Pg/Mojo::SQLite
16:50 sri helpers and their different contexts, app, controller, template
16:51 sri maybe some fun with collections and bytestreams
16:51 sri <%= b('Joel is a slug')->slugify %>
16:51 sri :)
16:52 sri deploying with systemd (now that we can use .socket files and --listen http://*:3000?fd=3)
16:54 sri i know you already have commands on your list
16:54 sri maybe make one day for basic commands and another for generator commands
16:55 sri routing has a lot of topics, you could explain how this works on one day http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Catch-all-route
16:55 mohawk jberger, what about an advent post about GraphQL?
16:55 sri matching host names with conditions makes for a good topic i think
16:56 sri mohawk: i'm sure jberger would like that as a guest post :)
16:56 mohawk jberger, what say you?
16:57 sri funny thing, i recently noticed that elixir folks are talking a lot about graphql
16:57 mohawk what's elixir?
16:57 purl i heard elixir was a Taiwan-based panel of outcontracting and open-source friendly developers, at http://elixus.org/ and telnet://elixus.org/
16:57 mohawk #ThingsIShouldProbablyKnow
16:57 sri http://elixir-lang.github.io/
16:57 mohawk ta
16:58 sri ruby-ish language on the erlang vm
16:59 sri kinda niche, but they got a lot of high profile ruby people
16:59 mohawk quite neat
17:55 bombuzal joined #mojo
18:18 sri re Mojo::IOLoop->timer_p
18:18 sri i guess we'd need multiple options to make it really useful
18:19 sri my $promise = Mojo::IOLoop->timer_p(30, {reject => 1, reason => 'Timeout!'});
18:21 sri don't like how it would be so different from a normal Mojo::IOLoop->timer
18:27 Leffe joined #mojo
19:00 Leffe joined #mojo
19:05 good_news_everyon joined #mojo
19:05 good_news_everyon [mojo] kraih deleted chmod at 0706a5a: https://git.io/vbOuH
19:05 good_news_everyon left #mojo
19:05 good_news_everyon joined #mojo
19:05 good_news_everyon [mojo] kraih deleted signatures at c6d8a19: https://git.io/vbOu7
19:05 good_news_everyon left #mojo
19:08 Leffe joined #mojo
20:04 Leffe joined #mojo
20:44 devrandomish joined #mojo
20:45 devrandomish yo, does Mojolicious have a built in equivalent to JSON::Path (I want to validate the syntax of a given JSON path value before using it with Mysql 5.7) ?
20:46 preaction yes
20:46 preaction $c->req->json( 'path' )
20:46 devrandomish Uhh.. I mean something like this:  "$.store.book[*].author"
20:47 preaction https://metacpan.org/pod/Mojo::JSON::Pointer
20:47 preaction it doesn't have exactly that, it has JSON Pointer
20:47 devrandomish Hmm, yeah, not the same thing.
20:47 devrandomish But thanks for pointing that out.
20:47 devrandomish I'm targeting this:  https://dev.mysql.com/doc/refman/5.7/en/json-path-syntax.html
20:48 preaction if you want to validate JSON, you could also consider OpenAPI
20:48 devrandomish I'm using json schema already
20:48 preaction oh, you're trying to validate syntax? why not just capture the error from the database? also, why let users provide their own raw query like that?
20:48 devrandomish validation is cool
20:48 devrandomish I want to fail earlier than sending it to the DBB
20:49 devrandomish I want to fail at boot
20:49 preaction at boot?
20:49 preaction mojolicious has nothing built-in for this, i guess is the tl;dr
20:49 devrandomish Yes, as in, when my mojo application starts up, it should evaluate every json path configuration variable
20:50 devrandomish and if it is not valid JSON path syntax, the system should not boot, at all
20:50 devrandomish a bit draconian I know
20:50 preaction no, that's the correct way: invalid config should stop the program
20:50 devrandomish I do the same thing with SQL statements
20:51 devrandomish I don't allow boot if I detect invalid syntax there either
20:51 devrandomish I have a hard time with relying on endless runtime exception handling, but that's just my opinion
20:51 devrandomish thanks again for your help
20:51 preaction that still leaves runtime errors, you still need runtime exception handling
20:51 devrandomish I'll try JSON :: Path for now, hopefully it worksout
20:52 devrandomish Oh, of course I have runtime handling, I'm just saying if I can fail early, the better off I am
20:53 preaction i mean, easiest way to do this would be to fetch a bunch of pages and make sure they work ;)
20:53 devrandomish no different than people doing "selec 1 from dual" to make sure mysql is still running
20:53 devrandomish although a bit inefficent
20:54 devrandomish Anyway, what is cracking me up is how hilariously awesome the perl/mojo community is
20:54 devrandomish this is the first question I've had in the years I've been using this thing
20:54 devrandomish I hit the website, click chat, ask, get an answer
20:54 jberger I hadn't thought to do session, but it is a good idea
20:54 preaction there's better ways to check if mysql is running. there's not really a better way to detect if the sql/json syntax is going to work _on this particular mysql version_ (if that's important)
20:54 jberger (Responding as I read forward)
20:55 jberger same with Base
20:55 devrandomish meanwhile I can ask a question about cloudstack/openstack/opendaylight, and wait literal weeks for anyone to bother to reply ... ok
20:55 devrandomish I'm out.  Peace!
20:55 preaction heh. i asked a question about cobbler weeks ago. still no answer :p
20:55 jberger WTF was that?
20:56 preaction was what?
20:56 purl (not was)
20:56 jberger devrandomish, nm
20:57 jberger As I said responding as I read again
20:57 jberger Roles is certainly on the docket, though I had thought to do it using Test::Mojo
20:58 jberger DOM is always a good topic, I'd be happy to do one on extraction
20:58 jberger If someone wanted to do manipulation I'd appreciate it. I really haven't used it that way
20:59 jberger ojo one liners and commands certainly
20:59 jberger Oh I forgot about piping to the get command
20:59 jberger helpers indeed
21:00 jberger Collections and byte streams would be fun, I could even have fun with my autobox silliness
21:01 sri jberger: maybe one about the relationship between lite and full apps http://mojolicious.org/perldoc/Mojolicious/Lite#GROWING
21:01 jberger I would like a systemd article but again as I haven't used it, if someone wanted to guest write or even outline an article on that it would be good
21:02 jberger mohawk absolutely!
21:02 jberger matching host names with conditions is an interesting notion
21:04 mohawk jberger, you're saying you'll accept a GraphQL blog post? any preference or just a bit of an intro?
21:05 sri intro for sure
21:05 sri jberger: subprocess
21:05 purl rumour has it subprocess is a pretty simple module, that basically ferries the request back to the master, and waits for it's reply in a blcking manner before returning it back to Fuse
21:06 jberger And as I catch up I see that I was entirely mistaken about devrandomish, I saw their last statement out of context. My bad!
21:07 jberger sri my title for tomorrow is "don't fear the full app"
21:07 sri :D
21:07 sri jberger: this one comes up every now and then too, streaming responses and why you can't flush http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Streaming
21:08 sri partial templates and how to pass data between templates
21:09 jberger I can't say I grok the flush argument, though I trust you are right about it
21:09 jberger Oh backpressure?
21:09 sri a flush would block until the buffer has been written to the socket
21:09 jberger Ah
21:10 sri it would have to bypass the event loop
21:10 sri and prevent it from doing anything in the meantime
21:11 sri the correct solution is to pass a drain callback, and wait with writing more until the buffer has been emptied
21:11 jberger I should grab my laptop and make this into a proper list
21:11 sri in the end it will take the same time, but the event loop can do other stuff
21:12 sri custom responses with server generated/hidden behind auth static files comes up every now and then too http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Custom-responses
21:13 jberger batman or preaction: one on openapi?
21:14 sri maybe one on how to use other event loops in a mojo app
21:14 sri maybe to use some async client we don't have yet
21:14 jberger preaction: if you, you could tout the new cpantesters stuff
21:15 jberger sri that's a great idea, but it would take more research than the others
21:16 preaction if we're poking people, hasn't someone done that research?
21:16 jberger If they have, I'm all ears
21:21 good_news_everyon joined #mojo
21:21 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbOry
21:21 good_news_everyon mojo/master 8d8809d Sebastian Riedel: use promises in all cookbook WebSocket examples
21:21 good_news_everyon left #mojo
21:22 CandyAngel -.- Does anyone have any examples of using PODRender with POD file in templates?
21:22 sri jberger: there is this http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#More-event-loops
21:23 sri but yea, finding some AnyEvent module to present does take time i suppose
21:24 sri the basic information for how to use it is in the recipe though
21:26 sri unix domain sockets might be a bit too uninteresting i suppose
21:27 sri oh, but using the eval command to run stuff in your app is a good one
21:27 preaction oh, yes, that
21:27 purl i think yes, that is what a capability _is_, a combination of designation and authority
21:27 preaction ... that is seriously the most annoying bot ever...
21:28 sri ./script/myapp eval -V 'app->pg->db->select("foo")->hashes'
21:28 sri and stuff
21:29 preaction i've written helpers explicitly for use by eval, so i can do cron jobs and such
21:30 sri me too
21:30 sri although i mostly turn them into commands if they get used often enough
21:32 sri jberger: if you go into detail about Mojo::UserAgent maybe cover content generators http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Content-generators
21:32 sri think they are kind of underutilized atm
21:38 sri unrelated... are we happy with websocket_p? http://mojolicious.org/perldoc/Mojo/UserAgent#websocket_p
21:45 Grinnz sri: i onyl see one perl6 advent calendar being posted on /r/perl but i do agree that it would be nice if we could keep it to perl 5 stuff, i just havent figured out a way to broach the topic in an agreeable manner
21:59 mohawk Grinnz, i suspect that would have to wait until the perl6 branding issue is resolved
22:01 mohawk jberger, i think it would be cool to have the GQL one as a follow-on to an OpenAPI one, with the new OpenAPI GQL plugin
22:09 mohawk what do you think?
22:09 purl I think mohawk should try flossing more often!
22:15 good_news_everyon joined #mojo
22:15 good_news_everyon [mojo] kraih tagged v7.58 at b97692b: https://git.io/vbO6A
22:15 good_news_everyon left #mojo
22:16 karjala_ joined #mojo
22:20 dim0 joined #mojo
22:49 preaction jberger: blog post? https://gist.github.com/preaction/1a8a644924ebfc944a66a5dfb0f59095
23:07 sri preaction: maybe less links and more examples?
23:07 preaction so, copy/paste the code?
23:07 sri clicking everything is hard!
23:38 jberger sri https://twitter.com/joelaberger/status/937464804427657222
23:39 sri :D
23:40 sri form still needs work, hope they were at least tasty
23:40 sri they need to be a little hard on the outside and soft on the inside
23:41 sri not quite like doughnuts
23:52 sri looking at the django 2.0 release, i suppose we could do this too https://docs.djangoproject.com/en/2.0/releases/2.0/#simplified-url-routing-syntax
23:53 sri $r->get('/foo/(bar:int)/baz')
23:54 sri or something similar
23:54 purl i guess something similar is true for SAVETMPS.
23:54 sri purl really is particularly annoying today
23:54 purl ...but really is <reply>...
23:55 sri $r->add_pattern(int => qr/[0-9]+/);
23:56 sri $r->add_pattern(whatever => ['just', 'some', 'alternatives']);
23:57 sri $r->get('/foo/(bar:whatever)/baz')
23:57 sri $r->get('/foo/(int:bar)/baz')
23:58 sri not even that hard
23:58 jberger As I say in the later tweet, the form got worse as the cooking got better
23:59 jberger Very tasty

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary