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

IRC log for #mojo, 2017-09-08

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

All times shown according to UTC.

Time Nick Message
00:15 mib_2xu41c joined #mojo
01:02 arcanez picnic
01:12 jcast89 joined #mojo
01:14 jcast89 hey folks, i have two identical functions in Mojolicious::Lite that map to a GET and PUT requests at the route /applications/:id but i'm getting a 404 with the PUT request. does anyone have any idea what could be the issue?
01:16 preaction are you sure whatever is sending a put request? some browsers don't like using put for <form>, for example
01:25 jcast89 yea i'm using curl :(
01:25 jcast89 root@docker-host /work/SteelConnect/environment-templates/docker/topologies (master) $ curl -X GET localhost/api/applications/12345 id is: 12345 root@docker-host /work/SteelConnect/environment-templates/docker/topologies (master) $ curl -X PUT localhost/api/applications/12345 <!DOCTYPE html> <html>   <head><title>Page not found</title></head>   <style>
01:26 jcast89 the 404 error page from mojo says this: "None of these routes could generate a response for your PUT request for /api/applications/12345, maybe you need to add a new one?"
01:32 jcast89 the two mojo::lite functions are:
01:32 jcast89 get '/applications/:id' => sub {
01:32 jcast89 put '/applications/:id' => sub {
01:56 chandwki joined #mojo
02:17 noganex joined #mojo
03:09 inokenty-w joined #mojo
04:04 dboehmer_ joined #mojo
04:36 kaare joined #mojo
04:46 disputin joined #mojo
05:07 gordonfish jcast89: Looks like you're attempting to fetch /api/applications/... but your routes are for /applications/... so that wont match, unless your app's root is in /api
05:08 gordonfish oh, he left...
05:10 mohawk i'll bet that was it
05:10 mohawk good spot
05:59 stryx` joined #mojo
06:46 AndrewIsh joined #mojo
07:19 Vandal joined #mojo
07:21 bianca joined #mojo
07:21 trone joined #mojo
08:05 dod joined #mojo
08:38 petru joined #mojo
09:02 kubrat joined #mojo
09:15 rshadow joined #mojo
09:26 irqq joined #mojo
10:15 PopeFelix joined #mojo
10:15 mattp_ joined #mojo
12:19 esh joined #mojo
12:23 stryx` joined #mojo
12:44 ChmEarl joined #mojo
12:56 orev joined #mojo
13:09 zivester joined #mojo
13:11 Ptolemarch joined #mojo
13:14 itaipu joined #mojo
13:17 gizmomathboy joined #mojo
13:20 marty joined #mojo
13:33 tcohen joined #mojo
13:34 gryphon joined #mojo
13:34 n16gel joined #mojo
13:48 maschine joined #mojo
13:48 marty joined #mojo
14:53 tchaves joined #mojo
15:01 itaipu_ joined #mojo
15:09 itaipu joined #mojo
15:22 itaipu_ joined #mojo
15:28 jberger its a lite app so there could have been an under above that
15:38 disputin joined #mojo
15:45 bianca joined #mojo
15:50 karjala_ joined #mojo
16:07 kaare_ joined #mojo
17:05 stryx` joined #mojo
17:12 disputin joined #mojo
17:18 dod joined #mojo
17:26 * sri fricking hates codemirror
17:27 sri with big files it just starts using 100% cpu and hangs forever
17:27 sri !@#$%^&
17:32 sh14 joined #mojo
17:33 sri foursixnine: btw. did i mention that i finally found the perfect mechanical keyboard for me?
17:34 * genio stabs clicky-clacky keyboards to death in an open work environment. SOOO LOUD
17:36 Grinnz yeah, still using a squishy keyboard at work unfortunately :P
17:37 sri i got a Corsair Vengeance K65, and changed the keycaps for the ones from a K70 (which are super smooth and look awesome)
17:37 sri has mx red switches, so not very loud
17:39 sri for gaming i also got a set of rubberized wasd keycaps :)
17:41 sri oh, i guess you can't buy that keyboard anymore :o
17:42 sri i better not drop this one i guess
17:43 sri gaming keyboards really have the shittiest keycaps, so much harder to get keycaps than boards
17:44 sri anyway, if you're into smooth keycaps with a professional font, this set is really good http://www.corsair.com/en-us/corsair-gaming-classic-k70-full-104-keys-set
17:47 brunoramos joined #mojo
18:05 petru joined #mojo
18:17 rickbol_ joined #mojo
18:26 mishanti1 Currently diving far deeper into CGI than I have ever desired. You know, mojo is _pretty_ sweet compared to this.
18:27 gordonfish genio: You'd love my old Key pro FK-9000. Soooo clicky :)
18:31 genio They're the most annoying things on the face of the planet.
18:31 gordonfish "<@sri> oh, i guess you can't buy that keyboard anymore :o" ; There is ebay and such: http://www.ebay.com/itm/Corsair-Vengeance-K65-Compact-Mechanical-Gaming-Keyboard-Cherry-MX-Red-Switche-/381679128901
18:31 gordonfish (oh, newegg selling as an ebay store... interesting)
18:31 genio silence is golden wrt keyboards
18:32 gordonfish genio: Hard to argue with that
18:33 gordonfish Corsair Vengeance K65 looks nice... but wheres the numpad..?
18:33 gordonfish Oh, the K70 has one
18:34 gordonfish Heres a K70 http://www.ebay.com/itm/Corsair-Vengeance-K70-Mechanical-Keyboard-Cherry-MX-Red-Switches-/263173518485
18:34 Grinnz mishanti1: out of morbid curiosity: CGI the protocol, or CGI.pm?
18:35 mishanti1 Grinnz: CGI.pm :-/
18:35 Grinnz i am truly sorry for your lots
18:35 gordonfish I really don't understand why there are so many numpad-less desktop keyboards out there
18:35 Grinnz I can't function without a numpad
18:35 gordonfish I mean just because Apple does something it doesn't mean the whole industry has to follow ffs
18:35 mishanti1 Grinnz: Thanks.. After this cleanup it'll be ported to Mojo. Just got to clear out cruft.
18:35 Grinnz that is why I could only get certain varieties of the CM Storm keyboards
18:36 Grinnz as they have many varieties that leave out either the numpad or the home/end/arrow/etc keys
18:36 sh14 joined #mojo
18:36 Grinnz (the latter is called tenkeyless)
18:36 maschine mishanti1: at least it's not cgi-lib.pl!!
18:37 arcanez if I want to render YAML, I've got to do it myself, not free?
18:37 mishanti1 I finally did find out why certain errors never propagated. Far into this system there was some monkey-patching of things, one of which had `eval { ... }; if($@){};` in it.
18:37 gordonfish maschine: Uggggh
18:37 preaction arcanez: there's not a yaml => content helper built-in that i know of, no
18:37 arcanez I wish I could just use json, but noooo.. someone wants yaml
18:38 maschine it's all I used for years..  why it took me so long to do "modern perl" because you couldn't even 'use strict;'
18:38 Grinnz you could write one as a helper pretty easily
18:38 arcanez he says, as a seasoned mojo developer :)
18:38 arcanez my helpers right now are just Mojo::Pg or Mojo::mysql
18:39 arcanez but yeah, shouldn't be too hard
18:39 arcanez what's the YAML module of choice nowadays? YAML::XS or just YAML
18:39 preaction they could use my "yfrom yaml" command, so it'd be "curl http://example.com/api | yfrom yaml" tada!
18:39 preaction YAML.pm is finally a frontend for multiple YAML modules, so you don't have to choose
18:39 arcanez preaction: I think datadog is going to consume this
18:39 Grinnz YAML::XS is preferred, though
18:40 preaction and datadog can't do json?
18:40 preaction i find that impossible to believe
18:40 arcanez don't ask hard questions
18:40 preaction fair enough
18:41 Grinnz $app->helper(render_yaml => sub { my ($c, $data) = @_; $c->res->headers->content_type('application/x-yaml'); $c->render(data => Dump $data); });
18:41 Grinnz not sure if that's the correct content type for yaml, but
18:41 preaction then i'd use YAML.pm making sure YAML::XS was installed
18:42 kaare_ joined #mojo
18:42 Grinnz you could also do $app->types->type(yaml => 'application/x-yaml') in startup, and tehn do $c->render(data => Dump($data), format => 'yaml');
18:43 Grinnz i think?
18:43 Grinnz but its still helpful to have a helper do that so you dont need to import YAML::XS or whatever module everywhere
18:44 Grinnz preaction: YAML.pm hasn't been switched to do that yet AFAIK
18:44 preaction i think there's a way to make $c->render( yaml => $data ); work even
18:45 Grinnz you can do that with a hook probably
18:46 Grinnz before_render
18:46 preaction ah, yeah, i'm not seeing that in the changelog. ingy and perlpunk must still be working on that
18:47 tinita preaction: yeah, it's still todo
18:47 tinita my priority one is getting the YAML::PP parser and constructor working
18:47 tinita because without that it doen't make much sense to change YAML.pm
18:48 preaction of course
18:48 tinita good that I got the TPF grant, so I kinda have to work on it ;-)
18:49 preaction arcanez, Grinnz, this could make $c->render( yaml => $data ); work: $app->renderer->add_handler(yaml => ... ); and an example renderer: https://metacpan.org/source/JHTHORSEN/Mojolicious-Plugin-OpenAPI-1.21/lib/Mojolicious/Plugin/OpenAPI.pm#L207-236
18:49 arcanez with my luck, I'll go through all these hoops and they'll come back wanting JSON
18:49 preaction tinita: i've considered applying for grants just for that purpose (not money, just motivation) ;)
18:49 arcanez nananana batman
18:50 tinita preaction: hehe
18:54 stryx` joined #mojo
18:54 kaare joined #mojo
19:04 arcanez so $app->renderer->add_handler(openapi => \&_render); adds the render handler allowing for ->render(openapi => 'foo') .. and ->stash('openapi') is equal to 'foo' right? (in _render)
19:06 preaction arcanez: that's my understanding, yes
19:06 arcanez considerably easier than I would have thought
19:07 Grinnz i dont think that will actually default to using your handler
19:07 preaction i think jberger also wrote a plugin (ReplyTable?) that auto-transforms between formats
19:08 preaction oh. not yaml though
19:08 * jberger notices backlog, reads
19:08 preaction probably would not be terrible/difficult to add...
19:09 arcanez I need to revisit my rendering of 'pretty' JSON too
19:09 Grinnz personally adding the yaml type and a helper to set format => 'yaml' sounds a lot easier than writing a whole handler
19:10 CandyAngel That moment when you accidently update Mojolicious and everything[1] stop working
19:10 CandyAngel [1] one script that you use a lot
19:11 arcanez reading the breaking changes :)
19:11 arcanez sri is pretty good about making all that stuff is documented welll
19:11 Grinnz https://github.com/kraih/mojo/wiki/Upgrading
19:11 CandyAngel Key word being "accidently" :P
19:11 arcanez roll back to a previous docker container?
19:12 jberger tinita++
19:12 CandyAngel No, I just need to stop being so lazy and make a new perlbrew lib for the new version of the script :P
19:12 jberger yeah, the motivation on my Alien::Base grant was MUCH more important than the money
19:12 CandyAngel I installed Minion, and now Mojo::Home doesn't have rel_dir :)
19:13 jberger preaction: correct, ReplyTable is for rectangular data only (at least so far)
19:13 tinita jberger: what was that for? =)
19:13 jberger arrays of arrayrefs
19:13 jberger YAML work
19:13 CandyAngel (which was a change made ages ago)
19:14 jberger tinita: YAML work
19:14 tinita jberger: ah, thanks
19:15 jberger it would be cool to make an automagic datastructure rendering module kinda like ReplyTable
19:15 jberger what would it do, JSON, YAML ... anything else?
19:15 jberger I suppose it could generate XML ... ish?
19:15 arcanez gross
19:16 jberger going to XML is in some ways less abiguous
19:16 tinita JSONY
19:16 jberger much less so than the other direction
19:16 jberger tinita: does anyone actually use JSONY other than mst (and from the sound of that comment you and ingy perhaps)?
19:16 CandyAngel There we go, I changed rel_dir to child and added to_string at the end and it works again \o/
19:16 tinita jberger: that's a good question ;-)
19:16 jberger I'm not opposed, adding optional deps to a module like that is easy
19:17 Grinnz jberger: thats not true at all; if trying to help people generate teh XML they want is any indication
19:17 arcanez oh dear, ingy got into JSON now
19:17 arcanez with his YAMLs
19:17 jberger there are a few optional deps in ReplyTable, like for Excel
19:17 Grinnz modules like to make assumptions about whether you're adding sub-nodes or attributes based on how many elements exist, etc
19:17 Grinnz and it can get real screwy
19:17 jberger oh right attributes vs nodes
19:18 jberger going the other way the question is single element array or node
19:18 jberger yay, ok so XML is out
19:19 Grinnz you could always do that weird jsonx thing :P
19:19 arcanez ugh, JSONY says to look at t/load.t which doesn't exist
19:19 Grinnz "JSONx is an IBM standard format to represent JSON as XML."
19:20 * genio prepares to slap someone
19:22 tinita arcanez: and it's still referring to jsony.org which doesn't look like a website about jsony
19:23 arcanez JSONY looks more confusing than anything
19:25 tinita yeah, the lack of commas is really weird
19:25 arcanez definitely ingy work :)
19:25 tinita i actually don't use it, just wanted to throw it in the discussion for fun ;-)
19:26 * tinita runs away
19:26 arcanez you have to find the right drugs mst and ingy are on to grok it
19:26 tinita i don't like coffee
19:37 jberger https://www.ibm.com/support/knowledgecenter/SS9H2Y_7.6.0/com.ibm.dp.doc/json_jsonxconversionexample.html
19:37 jberger ^^ yeah, no
19:38 arcanez ...what is the point of that?
19:39 jberger ... to make IBM more money somehow, I'd assume
19:39 arcanez : is valid in a tag?
19:39 arcanez I guess it adds some structure but I'm not sure why they invoked JSON
19:45 Grinnz yes, xml lkes to use : in tags
19:46 preaction : is the namespace separator
19:50 dod joined #mojo
19:53 * arcanez tries to steer clear of XML
20:06 itaipu joined #mojo
20:13 perlpilot joined #mojo
20:17 arcanez application/x-yaml or text/x-yaml
20:18 arcanez application/x-yaml gets me UTF-8 for 'free'
20:18 Grinnz i would normally use the application/ version since it's technically encoded data, not text
20:18 Grinnz but yaml gets treated as text more than json does
20:19 arcanez looks like they proposed text/vnd.yaml
20:19 Grinnz ew
20:20 arcanez is vnd short for ..vendor? or something else
20:20 Grinnz i guess?
20:20 Grinnz i think microsoft types use that
20:20 Grinnz application/vnd.ms-excel
20:20 Grinnz and then there's application/vnd.openxmlformats-officedocument.wordprocessingml.document
20:20 arcanez that's part of the 'vendor' tree
20:29 gryphon joined #mojo
20:32 gryphon joined #mojo
21:02 itaipu joined #mojo
21:16 jberger oh gods I remember that mess
21:17 jberger https://github.com/jberger/Mojolicious-Plugin-ReplyTable/blob/master/lib/Mojolicious/Plugin/ReplyTable.pm#L95-L99
21:18 Grinnz luckily i only have to output the xls and xlsx formats, not recognize all possible mime types for them
21:18 jberger oh if only
21:32 karjala_ joined #mojo
21:37 arcanez ->render(yaml => ..., handler => 'yaml') works if I register a handler for 'yaml'.. not sure how I can get it to Just Work if I specify a 'yaml' key to ->render()
21:38 Grinnz you'd need a hook to check for the stash entry
21:38 Grinnz hence why i said i dont think it would just work by default :P
21:38 jberger that is an example in that same documentation
21:38 jberger arcanez: ^^
21:39 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Adding-a-handler-to-generate-binary-data
21:39 cfedde joined #mojo
21:40 arcanez ah, missing the before_render hook
21:40 arcanez $c->stash->{..} and $c->stash('..') are equivalent?
21:40 jberger yes
21:40 arcanez probably best to use the ->stash('..') just in case the key changes for unknown reasons
21:40 jberger other than you can call exists on ->{}
21:41 jberger ?
21:41 bjakubski joined #mojo
21:41 Grinnz the key changing would break both of those equally
21:42 arcanez I meant if the implementation of ->stash() changed to not be equal to ->stash->{..}
21:42 arcanez but the exists is a good reason to use the hash access
21:43 Grinnz that implementation is highly unlikely to change
21:43 arcanez in this case, yes :)
21:44 arcanez cool, that works.. and minimal amounts of code
21:49 arcanez app->types->type(yaml => ['text/x-yaml', 'application/x-yaml']); should automatically set the mime type for my yaml rendering to those, right?
21:50 Grinnz if you set the format to yaml
21:50 Grinnz which you could do in the before_render hook
21:51 arcanez yup, thanks
21:51 arcanez and the browser can actually render text/x-yaml
21:51 arcanez application/x-yaml it wants to download
21:51 Grinnz thats normal with application/, normally i use the dev tools to look at them
21:52 marty joined #mojo
21:53 arcanez wonder if I'll ever outgrow using lite
21:53 Grinnz i tend to look at it as just interchangable options, than outgrowing
21:53 Grinnz i didnt really start with lite, but i use it for web projects when theres no need for a bunch of files
21:54 arcanez I need to break some stuff out into a config file
21:56 arcanez I think I can go this route with pretty_json too
22:06 arcanez thanks Grinnz & jberger
22:06 jberger didn't I make a json_pretty in my gists after the last conversation about it
22:06 jberger ?
22:06 jberger arcanez: funny, I almost never use lite anymore
22:07 jberger and even when I do, I mostly use the full-style router, ie my $r = app->routes; and ignore the routing keywords
22:07 arcanez jberger: I think you did, but I might not have been in a place to accept and understand what it was doing..
22:08 jberger https://gist.github.com/jberger/687fff38763e70b6712975f6aea8779c
22:09 arcanez yeah, you wrote a full fledged plugin, I added it inline. I also set the format to 'json' for pretty json
22:09 arcanez I might like 'json_pretty' better as a key though
22:09 jberger and as with most of my gists, if someone wants to wrap it up into a nice CPAN module, be my guests
22:10 jberger s/s$//
22:10 arcanez put your magic to the test
22:10 jberger hahaha
22:10 jberger the one exception is URLQueue
22:10 arcanez one would have to write tests and pod (in theory)
22:10 jberger I want whoever would wrap that into a module to talk to me about it
22:11 jberger did anyone ship this? https://gist.github.com/jberger/1badbc7b8b6eb0daea4aa5d63743a6c8
22:12 Grinnz just the inotify one afaik
22:12 jberger doesn't look like it
22:13 jberger arcanez it isn't as much about doc and test (though those would be necessary) as the continued maintenance, which I'm noticing that I'm about at my limit of continued maintenance limit
22:13 Grinnz that problem is easily solved by making things that nobody uses ;)
22:14 Grinnz it's when something takes off and gets "users" that you get work
22:14 gryphon_ joined #mojo
22:15 arcanez just find someone that submits nice patches and secretly give them comaint
22:16 Grinnz thats what resulted in http://cpanmeta.grinnz.com/author-perms#~ether
22:16 [1]mohawk joined #mojo
22:17 jberger I need to get things off my plate before I can take on more
22:17 jberger if someone (capable) wants this ... oh gods take it! https://metacpan.org/pod/Module::Build::CleanInstall
22:17 jberger I scared preaction right out of the channel!
22:17 jberger (probably deservedly)
22:17 noganex_ joined #mojo
22:18 marty joined #mojo
22:19 arcanez wow, she's 4x me
22:19 Peppard joined #mojo
22:19 preaction joined #mojo
22:19 rickbol joined #mojo
22:20 robx joined #mojo
22:21 arcanez and jberger fell off?
22:21 Grinnz that netsplit was definitely caused by linking to that module
22:21 Grinnz i'm currently picking up the pieces of my face it melted off
22:22 Grinnz (though it is slightly cleaner than the hack that e.g. Devel::GlobalDestruction needs to use because of its XS split)
22:22 haarg joined #mojo
22:22 arcanez I tend to shy away from the toolchain
22:23 genio joined #mojo
22:23 Grinnz it's a good plan
22:23 dboehmer joined #mojo
22:23 alilles joined #mojo
22:23 tianon joined #mojo
22:24 charsbar joined #mojo
22:24 gabiruh joined #mojo
22:25 pink_mist joined #mojo
22:26 mtj joined #mojo
22:26 perlpilot joined #mojo
22:26 spicyjack joined #mojo
22:26 stryx` joined #mojo
22:26 chandwki joined #mojo
22:26 sivoais joined #mojo
22:26 hesco joined #mojo
22:26 castaway joined #mojo
22:26 Armen joined #mojo
22:26 michael_ joined #mojo
22:26 dustinm joined #mojo
22:26 coolo joined #mojo
22:26 mgrimes joined #mojo
22:26 hernan604 joined #mojo
22:26 suede joined #mojo
22:26 jberger joined #mojo
22:26 Jonis_ joined #mojo
22:26 mrEriksson joined #mojo
22:26 arcanez too many dragons.
22:27 arcanez and not good enough coder
22:27 simcop2387 joined #mojo
22:27 gordonfish joined #mojo
22:27 jantore joined #mojo
22:27 caeles joined #mojo
22:27 salva joined #mojo
22:27 cosimo joined #mojo
22:27 n16gel joined #mojo
22:27 pheleas_frog joined #mojo
22:27 bobkare joined #mojo
22:27 mudler joined #mojo
22:27 trippeh joined #mojo
22:27 ssm joined #mojo
22:27 tempire joined #mojo
22:27 saki joined #mojo
22:37 maschine joined #mojo
22:39 nicomen joined #mojo
22:48 go|dfish joined #mojo

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