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

IRC log for #mojo, 2018-01-23

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

All times shown according to UTC.

Time Nick Message
01:15 itaipu joined #mojo
01:16 ghenry joined #mojo
01:21 hesco1 thinking it would be nice to have `mojo generate` handle additional targets, like controller, perhaps.  Maybe others.
01:22 mohawk i have ideas about sectional things i'd like to "mojo generate"
01:23 aborazmeh joined #mojo
01:26 mohawk eg a .travis.yml
01:36 schelcj joined #mojo
01:44 hesco1 I like it.
01:52 gizmomathboy joined #mojo
02:18 [1]mohawk joined #mojo
03:05 dikim joined #mojo
05:04 dboehmer_ joined #mojo
05:49 aborazmeh joined #mojo
05:51 inokenty-w joined #mojo
05:56 maschine_ joined #mojo
06:05 geospeck joined #mojo
06:27 klapperl joined #mojo
07:14 seccubus joined #mojo
07:26 McA joined #mojo
07:44 AndrewIsh joined #mojo
08:12 Vandal joined #mojo
08:19 trone joined #mojo
08:35 karjala_ joined #mojo
08:39 karjala_ Does anyone know if & when Intel & AMD plan to sell CPUs without Meltdown and/or Spectre issues?
08:58 trone we will wait for years to see different cpu architectures, imho.
09:05 Edward joined #mojo
09:07 seccubus joined #mojo
09:08 seccubus Because I could not found a decent RPM for Mojolicious for Centos 7 I've included one in the package repo for my project Seccubus. https://packagecloud.io/seccubus/latest and https://packagecloud.io/seccubus/releases.
09:19 eseyman seccubus: coming soom
09:19 eseyman s/soom/soon/
09:29 sri for opensuse there's always fresh mojo packages available :p
09:34 reetp joined #mojo
09:38 kes joined #mojo
10:15 dod joined #mojo
10:21 itaipu joined #mojo
10:23 dod joined #mojo
10:42 [0xAF] joined #mojo
10:48 dod joined #mojo
11:14 petru joined #mojo
11:53 S joined #mojo
12:22 itaipu joined #mojo
12:22 dod joined #mojo
12:22 dustinm joined #mojo
12:23 markong joined #mojo
12:25 diegok joined #mojo
12:37 ashimema joined #mojo
13:07 petru joined #mojo
13:18 dikim_ joined #mojo
13:30 tchaves joined #mojo
13:47 trone joined #mojo
13:58 aborazmeh joined #mojo
14:08 itaipu joined #mojo
14:20 gizmomathboy joined #mojo
14:25 geospeck joined #mojo
14:41 dod joined #mojo
14:49 Pyritic joined #mojo
14:49 dod1 joined #mojo
15:37 geospeck joined #mojo
15:44 sh14 joined #mojo
15:51 gizmomathboy joined #mojo
16:07 gryphon joined #mojo
16:08 sri we really need an SQL::Abstract fork to improve Mojo::Pg
16:09 sri with ribasushi back in charge of DBIx::Class, and his plans to only move code from SQL::Abstract to DBIx::Class and not the other way around it seems like a deadend for us
16:15 sri hmm, since mst still owns SQL::Abstract i guess there will be a more hostile relationship between the modules anyway, so it might just be a deadend in general
16:15 sri so we better plan ahead
16:16 mohawk sri, have you made an RFC with what you need from SQL::Abstract?
16:17 ribasushi what I said is more nuanced than that, specifically this: https://github.com/Perl5/DBIx-Class/commit/07fadea8d16#diff-b1e08875e88f9cfd4c48251700469d84R34
16:17 sri ribasushi: i can read between the lines :p
16:18 sri and i've pondered making my own SQL generator for some time
16:18 ribasushi sri: well... I don't actually hold the level of hostility you are trying to imply, but anyway, that's moot
16:18 sri it's my next hackweek project if i don't find some time earlier i guess
16:18 Lee joined #mojo
16:18 ribasushi but in general ( as I told sri ): if I were "in charge" of SQLA, I'd consider adding RDBMS-specific stuff a mistake anyway ( and would be disappointed if mst&co go this way )
16:19 ribasushi a Pg-specific subclass of SQLA: that'd be awesome indeed
16:19 ribasushi sri: also once again: SQL::Abstract::More *might* be more your cup of tea
16:19 sri for that SQLA would have to be extensible first
16:20 sri and after talking to mst i'm not holding my breath
16:20 ribasushi oh... what kind of extensibility is missing in your eye?
16:20 ribasushi ( I have to detach, will read scrollback later & (
16:20 sri ribasushi: ::More is ugly
16:25 sri ribasushi: like, how would you inject a group by before the order by?
16:26 sri the order by argument is kinda stupid, it should have been an options hash with an order_by field
16:26 sri that's the first part, have an options hash on all the generator methods
16:29 sri you're prolly thinking of hooks for more creative where constructs
16:31 sri i imagine the "correct" way to do it would be with an intermediate representation of the query, some sort of AST that can be pre-processed from hooks
16:31 sri (thinking of how i'll start with the new one)
16:34 jabberwok I prefer S::A::More although I mostly wish it had support for ON CONFLICT clauses
16:35 jberger sri: I was just thinking about the "intermediate representation" thing
16:35 sri looking at the code... ORDER BY support was done soo poorly
16:35 jberger I was digging through the SQLA code and was actually kinda surprised that it didn't have it
16:35 sri it's just tacked on
16:36 sri well, an AST will likely cost quite a bit of performance
16:36 jberger you might want to encourage caching of the resulting query
16:36 jberger not unlike Mojo::Template
16:37 jberger not easy to do though perhaps
16:37 jabberwok AST?    (alvin simon theodore... nope)
16:37 jberger abstract syntax tree
16:37 mohawk AST=abstract syntax tree
16:37 mohawk aka parse-tree
16:37 jabberwok thanks mohawk
16:37 mohawk welcome ;-)
16:38 jberger as sri said, think of it as an intermediate reprsentation of what the user wants
16:38 jberger then that could be passed to some per-db driver that generates the query from it
16:38 sri even if you're just gluing together SQL, there are better ways, order by just needs to be redone in SQL::Abstract
16:39 mohawk having read ribasushi's commit, which mentions performance, i see opportunities to cache generated SQL based on inputs
16:39 mohawk would need to use placeholders, natch
16:52 hesco1 Might it be possible to use a Mojolicious::Plugin::* in a Moose::Role?  And if so, how would that be accomplished?
17:01 ribasushi sri: yes, the order/group/having handling is a mess, I kinda forgot about that
17:01 ribasushi it can't easily be fixes because *all* the workarounds are different - DBIC has its own, SQLAM/DBIx::DataModel has its own, darkpan code has their own
17:02 ribasushi the AST-path is what the Data::Query thing was about, there is a branch you should try playing with
17:02 ribasushi but as jberger pointed out - it isn't exactly fast ( and was too strict for my taste at the time I looked, but that's fixable )
17:03 ribasushi https://github.com/dbsrgits/sql-abstract/tree/dq <--- specifically this
17:04 ribasushi jberger: and yes, there is no AST, as the entire thing is one-pass
17:04 jberger which is why limit is so hard given the differences in syntax for that statement between dbs
17:05 ribasushi as low-level SQL generation is sort-of an auxiliary concern, it hasn't been... exactly prioritized
17:07 sh14 joined #mojo
17:08 ribasushi in fact things like this were more expedient to solve deadlocks in "how do I get the yak-stack shaved": https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/lib/DBIx/Class/Storage/DBIHacks.pm#L983-990
17:08 ribasushi which does equivalency-transforms on where/having conditions like so: https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/t/sqlmaker/dbihacks_internals.t#L118-126
17:09 ribasushi but yeah, it's not exactly friendly for *deep* level transforms
17:09 * ribasushi has to run again, hope all of this is of some use &
17:12 sri jberger: mysql, sqlite and postgres support limit x offset y
17:13 sri which is why i thought it would fit into sql::abstract
17:17 disputin joined #mojo
17:27 dod joined #mojo
17:29 Kundun joined #mojo
17:29 ChmEarl joined #mojo
17:31 Grinnz i would assume that when SQL::Abstract was made, limit/offset support wasn't as common
17:33 sri Grinnz: doesn't explain why the maintainers are still very much opposed to supporting it
17:33 Grinnz sure, i think it should be added too
17:34 sri could be added with an options hash, in turn making the whole thing easier to extend
17:35 sri but ribasushi, mst and ilmari are all opposed
17:37 exp-innit wait, you mean supporting natively right?
17:38 exp-innit cause I have software running with the pagination option
17:38 exp-innit and it seems to use LIMIT + OFFSET
17:38 exp-innit ah, i read up and see riba's reply
17:38 sri trying to get SQL::Abstract improved is like getting an mlehmann module improved
17:38 Grinnz as in, being able to specify a specific limit and offset in base SQL::Abstract
17:39 ghenry joined #mojo
17:39 exp-innit yeah I was just a little confused reading the last 30 mins or so, it's clear above, my apologies
17:45 ghenry jberger: Howdy. Just watched your Mojo/Vue/Pg 20min talk from last year. What version of Pg server did that use?
17:46 jberger ghenry: I answered your post on github ... did you see it?
17:46 jberger I think I was using 9.4 or 9.5
17:46 jberger but NOTIFY has existed at least since 9.0 say the docs, I didn't check farther back
17:46 ribasushi sri: we are probably "opposed" for different reasons
17:46 ghenry Oh, damn. In my trash. Many thanks! Will be back when I do our wss backend. Cheers.
17:47 ribasushi I detailed mine earlier, but it really is moot as I am not involved with that module ( though yes, I've written a very large portion of its current state )
17:47 sri ribasushi: adding to the "fun" :p
17:47 ribasushi again - I strongly recommend using it as a base and building anything you want on top ( including the hash-based option pass )
17:48 ribasushi I am really puzzled why you don't see it as a win for all involved
17:48 sri anyway, to get the ball roling i'll start bundling an SQL::Abstract subclass with Mojo::Pg
17:48 ribasushi your plan would require any downstream that already uses a hash for something else to retool their stack, or to never upgrade: and for what? so that 3 databases get special treatment? seems weird...
17:49 jberger ghenry: no prob
17:49 sri ribasushi: group by is harder...
17:50 ribasushi sri: this is how DBIC deals with it in its subclass: https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/lib/DBIx/Class/SQLMaker.pm#L323-335
17:50 ribasushi i.e. how it supports a hash, and distinguishes it from a legit order_by
17:57 sh14|2 joined #mojo
17:59 jnap most of you probably already know this, but I find for larger data sets that using limit, offset for paging can be really slow.
18:00 Grinnz compared to what?
18:01 jnap matching by id or date or other stuff.
18:01 Grinnz ah, well thats not always an option
18:03 nicomen make hot tables
18:03 sri ribasushi: yea, guess i'll have to do the same
18:05 sri sucks to overload private methods though
18:11 ribasushi I don't see _foo as necessarily a "private method"
18:11 ribasushi more "this is not something that makes sense to call directly"
18:11 ribasushi see also https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/Ordered.pm#METHODS-FOR-EXTENDING-ORDERED
18:11 ribasushi I agree that it sucks that perl doesn't have a convention for "callable methods / overridable methods / can't-touch-this methods" but we are where we are
18:12 ribasushi in any case - in the instance of SQLA ( a ~20 year old module ) relying on nothing going away is prudent
18:12 jberger documented underscore methods as the way to do things would alleviate any fears I would personally have about overloading
18:13 jberger thanks for that link ribasushi
18:13 ribasushi jberger: well that's an example of "how I'd do it", SQLA doesn't document things this way currently
18:13 jberger oh, shoot, I missed that that was on DBIC stuff
18:14 ribasushi yes, sorry :/
18:14 jberger I'm switching between too many thing
18:14 jberger s
18:15 ribasushi jberger: on the flip side: I doubt a similarly-documenting patch would be rejected if anyone here is to submit one
18:15 ribasushi &
18:41 jamesaxl joined #mojo
18:59 Seth joined #mojo
19:56 itaipu joined #mojo
20:13 gordonfish joined #mojo
20:24 mishanti1 I find myself needing to persists all cookies held by a Mojo::UserAgent between runs (use same cookies on subsequent runs that is). Best way to serialize by Mojo::Cookie::Response->to_string, persist and then load with ->parse?
20:24 mishanti1 Or is there some other recommended way?
20:26 hesco1 Earlier, I had asked:  Might it be possible to use a Mojolicious::Plugin::* in a Moose::Role?  And if so, how would that be accomplished?
20:26 hesco1 At this point, I have some code to show what I am trying to do here:
20:26 hesco1 https://gist.github.com/hesco/403d3a74747c6fa0767c78171f8b387a
20:27 hesco1 I am able to attach a DBIx::Class $schema object to my $mojo_app, using a role, because the $schema object is a full fledged object.
20:29 hesco1 But with the Plugin, I'm not quite sure how to add this to the mix.
20:35 sri mishanti1: didn't CandyAngel make a cpan module for that?
20:35 sri role i think
20:36 Grinnz https://metacpan.org/pod/Mojo::UserAgent::CookieJar::Role::Persistent
20:36 Grinnz hesco1: a plugin has to be registered in an app's startup method. so you need to hook into that one way or another
20:36 CandyAngel There are even rumours that it works
20:37 Grinnz hesco1: you could use a method modifier to run something after startup
20:37 Grinnz use Moose::Role; after startup => sub { shift->plugin('SomePlugin') };
20:37 Grinnz whoops, app is not the invocant
20:38 Grinnz oh, yeah it is nevermind, this is the app :)
20:40 hesco1 yes, after startup sounds promising.  And that could still be included in a Role?  and it would still attach its methods to the $app?  Testing that to see how far I get.  Thanks for the lead.
20:40 Grinnz yes
20:40 Grinnz https://metacpan.org/pod/Moose::Manual::Roles#USING-METHOD-MODIFIERS
20:40 Grinnz you should also have your role require 'startup' of course
20:44 mishanti1 sri , Grinnz : Hadn't seen that before. Roles++! Thank you both.
20:46 pink_mist why not thank CandyAngel
20:46 mishanti1 Uhm. Yeah. Guess that was kind of rude. :) CandyAngel, thanks! Module seems exacly like what I needed now.
20:48 CandyAngel ^_^ Glad to hear it
21:08 hesco1 If a plugin must be registered during the $mojo->startup method, will handling it in an after or around moose method-modifier get the job done?
21:08 hesco1 So far this is not cooperating, but still futzing with it.
21:11 jberger hesco1: is there some reason not to just do it normally?
21:12 jberger as a regular plugin
21:12 jberger I guess I don't understand what you are trying to accomplish
21:14 jberger even so I would think that the "after startup" would work
21:21 karjala_ joined #mojo
21:26 hesco1 jberger: and by normally you mean simply including it inside the ->startup() method?
21:26 jberger right
21:27 jberger rather than being a role, is being a plugin sufficient?
21:27 hesco1 just hoping to create a reusable role, is all, and declutter the base class as best I can.
21:27 hesco1 ok, will try it the old-school way, I guess.
21:28 jberger oh and I've just seen why calling plugin in an after startup won't work
21:28 jberger because a plugin must inherit from Mojolicious::Plugin
21:31 Grinnz why would that matter?
21:31 Grinnz this is independent from the plugin's implementation
21:38 jberger is the role also the plugin?
21:38 jberger I'm confused again
21:40 finger joined #mojo
21:40 Grinnz no, the role is just attaching the plugin
21:41 finger Hi. Can anybody please confirm that use Mojo::Loader; Mojo::Loader::load_class('Mojo::Reactor::EV'); kills apache under mod_perl2
21:42 Grinnz hesco1: this works for me https://perl.bot/p/jksj7b
21:43 Grinnz finger: that's weird... but also weird to be running mojo in mod_perl2?
21:44 finger my Mojo is @7.58
21:44 Grinnz or are you deploying it via plack?
21:45 finger Grinnz: not it's actually running mod_perl2 but some deep dependency uses Mojo::UserAgent
21:45 Grinnz oh ok
21:45 finger and so I get to that Mojo::Reactor::EV
21:45 preaction joined #mojo
21:46 finger so you just need to add use Mojo::UserAgent and apache dies
21:46 Grinnz you can set MOJO_REACTOR=Mojo::Reactor::Poll to avoid trying to load EV
21:46 finger but if I set PerlSetEnv MOJO_REACTOR Mojo::Reactor::Poll it seems to work
21:46 Grinnz in the environment
21:46 Grinnz yeah
21:47 Grinnz if that works, then it's a problem loading EV
21:47 finger but that would still qualify it as a bug ;)
21:47 Grinnz which is scary... so i would just avoid it
21:47 Grinnz (for that use case)
21:47 finger well EV works ( I think )
21:48 Grinnz Mojo::Reactor::EV doesn't do anything different from Mojo::Reactor::Poll as far as what it loads
21:48 Grinnz other than EV
21:49 finger for me it does.. :)  it does not work :p
21:49 Grinnz what i'm saying is it looks like a problem with EV, that can't really be solved on the mojo side
21:49 finger I know that it does not have it's own magic but I would still need to find the coulprit
21:50 finger well Mojo can test if it's running under mod_perl and use poller instead
21:51 Grinnz it's possible, i guess... i'm not sure how to test for mod_perl myself
21:51 Grinnz but that test would go along with the test for pseudofork: https://metacpan.org/source/Mojo::Reactor#L13
21:52 Grinnz this is the first report i've heard of such a problem but honestly it's not surprising, i don't think it's common to load mojo in a mod_perl process :P
21:52 pink_mist I used to do that back when I first started
21:52 pink_mist didn't have EV installed though
21:52 pink_mist and that was many years ago now
21:59 finger Grinnz: my $default = 'Mojo::Reactor::' . (($Config{d_pseudofork} || $ENV{MOD_PERL}) ? 'Poll' : 'EV');
21:59 finger mod_perl always sets the MOD_PERL env var
22:00 finger also $ENV{MOD_PERL_API_VERSION}
22:05 finger if anyone wants to test:  Apache/2.4.29 (Ubuntu) mod_apreq2-20090110/2.8.0 mod_perl/2.0.11-dev Perl/v5.22.4
22:23 trone joined #mojo
22:35 jberger finger do you have the exception that is thrown?
22:37 finger nope
22:37 finger apache just dies
22:39 Pyritic joined #mojo
22:42 jberger anyway, I'm sure it could be worked on, but EV is known to be weird in many environments, so I'd second the opinion of just setting MOJO_REACTOR and being done with it
22:43 finger also it seems to work on Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.26 with Suhosin-Patch mod_apreq2-20090110/2.8.0 mod_perl/2.0.5 Perl/v5.14.2
22:43 finger aka it does not kill apache
23:05 itaipu joined #mojo
23:08 dod joined #mojo
23:30 trone joined #mojo
23:42 Pyritic joined #mojo

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