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

IRC log for #mojo, 2017-11-20

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

All times shown according to UTC.

Time Nick Message
00:31 webart joined #mojo
00:38 * webart reads pod for OpenAPI plugin from jmthorsen and Irresistible APIs book simultaneously ...
00:39 itaipu joined #mojo
00:39 webart holy mackerel mojolicious is good :-)
00:45 aborazmeh joined #mojo
01:48 jberger Hmmmm if his middle initial is m maybe that's why we've never been able to realize that he's also batman!
01:48 jberger webart glad you like it
02:23 mohawk that's kind of the point of a secret identity?
02:24 mohawk although usually efforts exceed telling people a different middle initial
02:45 webart jberger: designed well ... OpenAPI swagger etc. just plugs right in
02:53 webart jberger: the two together are almost make it possible to create a webapp generator that can be fed human readable grammatical sentences (sort of like the TDD cucumber stuff)  bash$~/ mojo please "create app with method get using /login and /show"
02:53 mohawk more readable than JSON
02:53 mohawk finally, the 5GL is here
02:53 webart not sure that would be useful but sheesh ... it's awesome :)
02:53 mohawk the openapi plugin is definitely made of win
02:55 ilbot2 joined #mojo
02:55 Topic for #mojo is now 🍩 nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
03:07 noganex_ joined #mojo
03:58 batman mohawk, webart: glad you like it :) let me know if there’s any issues with the latest versions...
04:23 sogo joined #mojo
04:49 mohawk batman, thanks! looking great so far. you may have seen me mention i've been making an openapi -> graphql converter, i may need a little help in getting that tested :-)
05:04 dboehmer joined #mojo
05:07 batman mohawk: maybe we can discuss this further in #swagger ?
05:08 mohawk i did not know of such a thing
05:08 mohawk i'll join now!
05:08 batman Cool :)
05:09 jamesaxl joined #mojo
05:58 inokenty-w joined #mojo
06:10 itaipu joined #mojo
06:34 Vandal joined #mojo
07:05 dod joined #mojo
07:10 dod joined #mojo
07:16 geospeck joined #mojo
08:12 AndrewIsh joined #mojo
08:51 trone joined #mojo
09:55 caeles joined #mojo
10:41 gregf_ joined #mojo
11:10 geospeck joined #mojo
11:13 CHYC Has anyone here tried to make something like Minion::Command::minion::worker, but within it some pg->pubsubs->listens within the same loop? Is it online so I can, ahem, draw inspiration?
11:16 CHYC I currently have a package using base Minion::Command::minion::worker, and its last line of run is $self->SUPER::run(@args) and it works, but it looks kinda ugly, especially the munging of getopt.
11:17 sri i want to move most of the code from the worker command into an easier to reuse module
11:18 sri (and hopefully easier to test)
11:18 CHYC That would certainly help my usecase.
11:19 sri right now i don't think you should use the command as a module at all
11:20 sri it is going to break
11:20 sri we make no guarantees about commands behaving the same between releases
11:20 sri they have only minimal test coverage
11:20 sri all you can do is copy all the code into your module
11:22 sri moving the code is part of my plans for making minion easier to use outside of web apps
11:22 sri but that's still in the early stages
11:24 CHYC Sure, I have a working solution now (copy-paste) and if it can be cleaned up in the future, then so much the better :)
11:30 exp-innit has any work been done on integrating mojo::dom with any js engine or anything equivalent? similar to www::mechanize or what-have-you?
11:30 exp-innit hmm maybe not www::mech but there was some module that did do it :/
11:30 pink_mist there's Mojo::Phantom, and under development is Mojo::Chrome
11:31 exp-innit ty, some of my integration tests will include clicking on javascript buttons and the like
11:31 sri Mojo::DOM will . never do JS
11:31 sri it's pointless, to do it right you need a headless browser
11:32 sri so Mojo::Chrome and friends are the way to go
11:32 exp-innit sri: yeah that makes sense, i don't know the precise distinction between the modules
11:33 exp-innit i just know i need to test a mojo app with some JS :)
11:33 pink_mist https://github.com/jberger/Mojo-Chrome for the current development of Mojo::Chrome
11:33 exp-innit ty pink_mist
11:33 exp-innit is there a reason i should use the Chrome version above Phantom?
11:37 pink_mist phantom upstream is abandoned
11:39 exp-innit oh that's a shame, i wasn't aware of that
11:40 sri re minion worker command, i've added an issue https://github.com/kraih/minion/issues/59
11:40 sri if anyone feels like working on it
11:40 sri but it would need reasonable test coverage
11:46 batman exp-innit: is it for tests? how about https://metacpan.org/pod/Test::Mojo::Role::Selenium ?
11:47 exp-innit batman: might be sufficient, none of our jenkins runs anything close to X so hopefully it wouldn't be required
11:47 exp-innit but i'm very ambivalent
11:47 batman exp-innit: the plan @work is to allow the tests to run on http://browserstack.com/ (it supports selenium)
11:48 exp-innit batman: we (I) don't believe in cloud services such as this
11:49 exp-innit this is running on Jenkins, currently on a Xenial install
11:49 exp-innit but i'll be customising that next week so anything short of requiring an X session will be fine
11:50 batman exp-innit: currently we have a docker instance running chrome, but i want to run the tests on an older ie or firefox, since i already use chrome for developing.
11:50 batman i have no idea how to spin up all of those different browsers myself...
11:51 sri added an example for how i think a framework independent worker should be started https://github.com/kraih/minion/issues/59
11:51 exp-innit batman: browser independence + that sort of thing isn't a huge concern for us
11:51 geospeck joined #mojo
11:51 exp-innit batman: just basic tests, if button X is pressed, does action Y occur
11:52 batman ah! good for you :)
11:52 tchaves joined #mojo
11:52 exp-innit aye, especially as i'm a backend dev and CSS is the last thing i planned to write :)
11:53 batman hehe
12:08 kes joined #mojo
12:34 aborazmeh joined #mojo
13:31 webart1 joined #mojo
13:33 jabberwok With Minion, if a job will go through something like a state-machine of several possibly-branching-or-repeating steps, would it be better to use a new job with each new state, or would $job->task('new_state')->retry be OK? I'm really looking for $job->requeue('new_state') methinks.
13:38 sri always make new jobs if you can
13:50 ChmEarl joined #mojo
13:58 sjn joined #mojo
13:59 jabberwok very good.
14:23 geospeck joined #mojo
14:23 gizmomathboy joined #mojo
14:30 anon_ joined #mojo
14:35 gryphon joined #mojo
14:51 jberger pink_mist thanks for answering for me, pesky sleep got in the way :-P
14:52 jberger now that meta::hack is over and once I write up my reflection blog post on that, I hope to release Mojo::Chrome to cpan, even in its early state
14:53 jberger better error handling can come later and isn't too important for use in test scripts, which is its first purpose in my mind
15:01 itaipu joined #mojo
15:10 geospeck joined #mojo
15:13 geospeck joined #mojo
15:14 sri jberger: use promises
15:15 genioweb joined #mojo
15:40 exp-innit joined #mojo
15:41 exp-innit i'm having some issues with flash messages, the client is passed back a cookie from a POST, but when refreshing their currnet page, the flash helper in the template doesn't return a message :/
15:41 exp-innit is there more of a complete example than the one in the docs?
15:41 exp-innit as it's only a few scant lines
15:42 sri the new minion admin ui uses flash messages
15:42 exp-innit ok, and is there any easy way to debug it?
15:42 sri https://github.com/kraih/minion/blob/master/lib/Mojolicious/Plugin/Minion/Admin.pm#L93
15:43 sri odds are you're just misunderstanding flash messages
15:43 sri if you don't use them with redirects you're using them wrong
15:44 exp-innit then the docs should say so? it just says "often"
15:44 exp-innit currently i am doing user posts -> controller modifies, returns flash + status 200, browser reloads
15:44 exp-innit which seems like it should work, as the post response contains a set-cookie header
15:44 exp-innit but i am no expert on web cookies, i'll keep digging
15:48 rick_soc1 joined #mojo
15:49 rick_soc1 good morning
15:49 purl For you maybe.
15:50 maschine exp-innit: flash only works for one request basically - as soon as you reload the page it goes away.  you would want to use stash otherwise - it's not really related to cookies at all.
15:50 jberger sri: how do promises help?
15:50 jberger the problem is that I don't understand how chrome reports the errors
15:50 sri jberger: unrelated, i just looked at the docs and saw delayes everywhere :)
15:51 jberger ah
15:51 exp-innit maschine: flash is implemented using the session cookie AFAIK
15:51 jberger well it was written before those existed :-P
15:51 jberger there are some pretty complex delays internally too
15:51 sh14 joined #mojo
15:58 exp-innit sri: fyi it turns out my issue was simply that I was using the js Fetch API which does not (by default) set cookies
15:58 exp-innit that and a 200 -> location.reload(); is perfectly sufficient
15:58 jberger ah, yes, I've hit that one myself
15:59 exp-innit fetch is... poor imo
15:59 exp-innit all front-end tooling is though
16:03 jberger it frustrates me to no end that there is no ajax library that treats 400/500 as proper responses
16:03 jberger I'd really like a more api-focused library
16:06 exp-innit remind me what template helper or similar prevents the auto escaping/quoting of HTML chars
16:06 exp-innit if you wouldn't mind please ☺
16:06 exp-innit ah i forgot, equals
16:06 pink_mist equals?
16:06 purl i heard equals was hard
16:07 exp-innit pink_mist: <%== vs <%=
16:07 pink_mist anyway, Mojo::Bytestream
16:07 pink_mist ah
16:07 exp-innit i do love Mojo, just never get a chance to work in it, so I end up forgetting half of this
16:07 pink_mist sorry, Mojo::ByteStream
16:07 pink_mist big S, not small
16:08 exp-innit yeah casing rules for perl modules are a little tricky :D
16:10 CandyAngel And mis-casing bites you when using Windows, which would match "Mojo::Bytestream" and load it, then you'd get redefine errors :|
16:10 CandyAngel Did that recently with User(a)gent
16:11 exp-innit CandyAngel: well we all know filesystems aren't case sensitive, after all s == S just like ss == ß (lol no)
16:17 exp-innit another dumb question, i'm trying to render a template from a controller, but i'd quite like to take advantage of all the controller logic to find the template name, for example, not specifying ".html.ep" on the end
16:17 exp-innit sorry, i should say, render a template into a scalar from a controller
16:17 exp-innit rather than just using $self->render()
16:18 exp-innit or $c->render() :)
16:18 pink_mist render_to_string?
16:18 purl render_to_string is specifically documented to return a bytestream object
16:19 pink_mist https://metacpan.org/pod/Mojolicious::Controller#render_to_string
16:19 exp-innit hmm ok, maybe that's what i was missing, cheers pink_mist
16:20 exp-innit hmm, it seems to be trying to render the controller name it's in, that's not the worst though
16:23 exp-innit yeah that does the job nicely, cheers pink_mist
16:46 mib_paflr1 joined #mojo
16:47 mib_paflr1 hi guys, i am developping a server and when i call my $res = $ua->get('/addCategory?cat=' . $_); from the client i have this error : Mojo::Reactor::Poll: I/O watcher failed: Can't call method "build_tx" on an undefined value. Could uplease tell me what's the problem?
16:50 mohawk mib_paflr1, you need to pass a full URL not just a URI
16:54 zivester joined #mojo
16:54 mohawk sri, think maybe that ought to throw exception earlier?
16:55 mohawk mib_paflr1, also: why on a server are you doing client-ish stuff?
16:55 mohawk are you actually trying to forward the request to a different route? if so there is a better way
16:56 Grinnz if this is a test file, then you should be using Test::Mojo
16:57 mib_paflr1 Can use Mojo::UserAgent; be used anywhere (in an other script) than the server itself?
16:57 Grinnz Mojo::UserAgent has nothing to do with the server, use it wherever you need a user agent
16:57 mohawk mib_paflr1, i think that's the wrong question. what are you trying to achieve?
16:58 disputin joined #mojo
16:58 Grinnz Test::Mojo gives you a user agent that also loads the application server in the same process, so a get like you described would work
16:58 Grinnz if you are trying to make requests to a running server, you need to include a host/port for the get
16:58 mib_paflr1 thx, and what about a I/O exception? The server seems not defined...
16:59 Grinnz ... because you didnt do any of the things i just said to do
16:59 sri mohawk: what is the problem?
16:59 purl the problem is you
16:59 mib_paflr1 ok ok i am going to look at it
17:00 mohawk sri, $ua->get('/addCategory?cat=' . $_) gives "Can't call method "build_tx" on an undefined value"
17:00 mohawk sri, my thought was that the invalid arg should be spotted earlier
17:01 Grinnz maybe theres a way a clearer error message can be shown in that case
17:01 mohawk purl, it's funny because it's true
17:01 purl mohawk: sorry...
17:02 disputin1 joined #mojo
17:02 Grinnz i dont actually see how you'd get that particular error message, so maybe we need to see more code
17:06 sh14|2 joined #mojo
17:08 sri mohawk: please explain what the actual problem is
17:09 sri mohawk: give more context
17:09 mohawk sri, my thought was based on what mib_paflr1 was saying happened. Grinnz is now saying that could not cause the thing he reported, so please cancel for now ;-)
17:09 sri mohawk: don't summon me before you know the problem :S
17:10 mohawk i thought i did
17:10 mohawk i shall do as you say going forward ;-)
17:20 marty joined #mojo
17:21 marty joined #mojo
17:22 jberger mib_paflr1 I'd like to second the question from the others, what is it you are trying to do? If testing use Test::Mojo if trying to call back into the application from itself, that's a risky thing in some cases. It can be done when necessary but it must be done carefully and there is almost always a better way to do it
17:26 mib_paflr1 it works! And to add to a file without erasing all the content?
17:27 mib_paflr1 does an alternative to splurt exist?
17:28 Grinnz https://metacpan.org/pod/Path::Tiny#append,-append_raw,-append_utf8
17:29 Grinnz maybe append could be added to Mojo::File
17:31 Grinnz but Path::Tiny is great too
17:32 mib_paflr1 yes it seems or print $handler $data
17:34 Grinnz if you open a handle sure
17:34 Grinnz https://metacpan.org/pod/Mojo::File#open is a good way to do that with error checking
17:36 mib_paflr1 with < > and >> ?
17:36 Grinnz >> for appending, yes
17:37 Grinnz > will truncate the file for writing
17:37 Grinnz see http://perldoc.perl.org/functions/open.html
17:38 mib_paflr1 yeap i know already
17:40 mib_paflr1 and +< ?
17:40 purl somebody said +< was close enough to "read/write"
17:43 Grinnz that's described in the open function docs as well
17:45 mib_paflr1 note that >> doesnt work with Mojo::File
17:45 Grinnz sure it does
17:47 slimer joined #mojo
17:47 dod joined #mojo
17:47 Grinnz https://perlbot.pl/p/hh5syh
18:27 bwf joined #mojo
19:25 * rick_soc1 yawns
19:29 fred joined #mojo
19:36 fred hi, do you know how to pass severa array in argument to a subroutine located in a module in perl?
19:41 perlpilot fred: that's an odd question for #mojo.
19:41 mishantil joined #mojo
19:46 mishanti1 joined #mojo
19:58 Grinnz fred: #perl-help would be better for this question. but to pass several arrays (while keeping them separate) to a subroutine, you usually pass references to them, which the subroutine would then use as references or dereference as appropriate
20:06 trone joined #mojo
20:16 disputin joined #mojo
20:31 cascardo joined #mojo
20:57 karjala_ joined #mojo
21:15 D joined #mojo
21:24 D Playing around with Vue and Mojolicious has been great for simple apps where I can role my own vue components, but I'm now stumbling a bit trying to use fancier components (such as bootstrap vue) because of the one file component/webpack step.  Separating the client (develop .vue files, pack it up and ship over) and server code seems one path
21:25 D does anyone have experience and tips for the best path?
21:26 jberger so I cheat a bit at $work
21:27 jberger I develop all my view components as mojo "templates"
21:27 jberger and I have a one-time-includes helper I call "depends"
21:27 jberger and I use that to dynamically include components
21:28 jberger that said, Mojolicious::Plugin::AssetPack has a vue builder
21:28 jberger which is probably a more sane than mine without going all the way to a front-end build chain
21:30 D so for something like boostrap-vue, you'd just use in inline template or render from within the mojolicious template?
21:31 D they have all these wonderful .vue file examples! https://bootstrap-vue.js.org/docs/components/table/
21:31 D but they need to be translated, by something/step, to be useful
21:36 Grinnz https://perlbot.pl/p/4v9mgp yeah the redis backend is going to need a *lot* more cleverness to be of any use
21:38 Grinnz main difficulty is job dependencies, and the combination of checking for the first job by priority and id with excluding jobs that haven't reached their delay timer yet
21:38 Grinnz relational databases are way better at making those things just work
21:40 geospeck joined #mojo
21:43 batman D, jberger: assetpack also has https://metacpan.org/pod/Mojolicious::Plugin::AssetPack::Pipe::RollupJs
21:44 batman haven't used it myself, but i wrote some tests at least, hehe
21:44 batman https://github.com/jhthorsen/mojolicious-plugin-assetpack/blob/master/t/rollup.t
21:46 D Thanks!  I will play with the options
21:47 batman there's so many things node does better than perl. i'm just too lazy to start rollup/webpack/whatever myself
21:50 preaction PAR?
21:50 purl i guess PAR is the answer to 'why are these URI modules loaded but not explicitly used'
21:50 Grinnz purl: forget PAR
21:50 purl Grinnz: I forgot par
21:51 batman PAR?
21:53 preaction i was guessing that you wanted webpack for Perl, but that might indeed be Fatpacker, not PAR
21:54 preaction but now i think you meant you wanted to use webpack with javascript, and that... well. i sympathize. it's a pain to set up
21:56 batman no, it's not. just use assetpack :)
22:08 fred hi, is it possible to create a file in mojo::file?
22:11 Grinnz sure, Mojo::File just represents a file path, it doesn't have to exist when you construct the object
22:11 Grinnz it will be created if you call ->spurt or open it for writing or similar
22:27 jamesaxl joined #mojo
22:35 karjala_ joined #mojo
23:00 disputin joined #mojo
23:03 itaipu joined #mojo
23:13 disputin joined #mojo
23:29 Grinnz got stats from 0.389/s to 569.696/s by adding a sorted set :P
23:30 CandyAngel Wow, nice :)
23:45 mohawk not bad ;-)
23:50 tchaves joined #mojo

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