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

IRC log for #mojo, 2015-08-10

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

All times shown according to UTC.

Time Nick Message
00:10 PopeFelix joined #mojo
00:18 mattastrophe joined #mojo
00:25 stephen joined #mojo
00:27 cpan_mojo Test-Mojo-Role-TestDeep-0.001 by PREACTION https://metacpan.org/release/PREACTION/Test-Mojo-Role-TestDeep-0.001
00:29 Grinnz damn thats a lot of changes for an initial version :P
00:30 jontaylor joined #mojo
00:32 preaction i got granular mostly for documentation. those were jberger's suggested improvements before a real dist release
00:32 preaction besides, it's already a jacked dist. i didn't up my perl requirement to 5.010 because of mojolicious
00:35 Grinnz heh
00:35 Grinnz also no META.json :P
00:47 howitdo joined #mojo
00:47 jontaylor_ joined #mojo
00:53 preaction if META.yml is good enough for CPAN::Meta, it's good enough for me!
00:53 preaction but really, no idea why dzil isn't doing that...
00:53 preaction stupid thing...
00:57 cpan_mojo Test-Mojo-Role-TestDeep-0.002 by PREACTION https://metacpan.org/release/PREACTION/Test-Mojo-Role-TestDeep-0.002
01:02 cpan_mojo Test-Mojo-Role-TestDeep-0.003 by PREACTION https://metacpan.org/release/PREACTION/Test-Mojo-Role-TestDeep-0.003
01:02 mst preaction: when do we get 0.99999999903 ? :)
01:03 preaction at this rate... 1 version every 5 minutes... 950,000 years
01:04 mst :D
01:04 preaction so... might want to relax, grab some tea ;)
01:23 jontaylor joined #mojo
01:35 Grinnz preaction, @Basic doesnt include MetaJSON because it would break dist.inis that are already using both @Basic and MetaJSON
01:35 Grinnz :/
01:35 preaction huh, awesome
01:35 Grinnz innit
01:36 preaction i missed... 7 versions now. so it's going to be a bit longer to reach my goal
01:39 mattastrophe joined #mojo
02:32 meshl joined #mojo
02:38 noganex_ joined #mojo
02:59 jontaylor joined #mojo
03:35 zivester joined #mojo
03:39 davido__ joined #mojo
04:13 damaya_ joined #mojo
04:21 inokenty-w joined #mojo
04:50 jontaylor joined #mojo
05:59 zach joined #mojo
06:04 jontaylor joined #mojo
06:09 davido__ joined #mojo
06:09 zach what all is the difference between mojolicious and mojolicious::lite?
06:10 Grinnz Lite is a wrapper around Mojolicious that lets you set up the application in a single file, with simple syntax
06:10 Grinnz the functionality is essentially the same
06:11 zach why would you want a single file instead of multiple files
06:11 zach separation of concerns
06:11 Grinnz for light apps :P
06:11 zach I guess
06:11 zach hence the name
06:11 Grinnz for example: https://metacpan.org/source/SRI/Mojolicious-6.14/examples/chat.pl
06:11 zach but, for instance, 'under' is available in regular mojo too?
06:11 Grinnz yes
06:12 zach is there anything in lite not in regular mojo?
06:12 Grinnz everything in Lite is available in full apps, except "group" which isn't necessary there
06:12 zach ok
06:12 davido__ joined #mojo
06:12 zach just a lot of documentation references lite
06:12 zach wanted to make sure everything would transfer over
06:12 Grinnz well, the tutorial was written for lite originally
06:12 Grinnz most other things just reference it for simpler examples if anything
06:13 zach long as the specific stuff mentioned works for both I don't care :P
06:13 Grinnz that's the general idea yea
06:14 zach you ever start on a project and feel like the more you read the less you know?
06:15 preaction yes, that's software development
06:15 zach ok
06:15 zach how about this one
06:16 zach would taking a bootstrap html example and turning it into a mojo template be crazy?
06:16 jontaylor zach: thats what I do when starting a new mojo app
06:16 zach like let's say the mojo app has a db backend and you want to pull values from the db
06:16 jontaylor replace your layout with the bootstrap layout
06:16 zach ok
06:16 jontaylor make sure its a got a yield in the middle inside the container
06:17 jontaylor and you are good to go
06:17 Grinnz zach, what db?
06:17 zach postgres
06:17 sopanshewale joined #mojo
06:17 Grinnz if you aren't using Mojo::Pg i'd suggest it
06:17 zach will do
06:18 Grinnz it comes with a full-app MVC example that might be helpful too
06:18 Grinnz https://metacpan.org/source/SRI/Mojo-Pg-2.07/examples/blog
06:18 jontaylor Grinnz: I’m using mojo::pg at the moment for an app i’m working on, but i’m finding myself writing loads of code that I wouldn’t with an ORM like DBIx::Class
06:19 jontaylor like my own find_by_pk() style methods
06:19 jontaylor Which is not to say thats a bad thing
06:19 Grinnz well, if you want to use DBIx::Class you can, i like the more direct approach
06:19 jontaylor Yeah I like the more direct approach too, and the performance improvement is significant
06:20 jontaylor like DBIx::Class is too many abstractions
06:20 Grinnz as ORMs go it's nice but no ORM is perfect
06:20 jontaylor but mojo::pg feels like its missing one
06:20 jontaylor its close when you have nested helpers providing access to a set of data models though
06:22 cpan_mojo App-screenorama-0.06 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-screenorama-0.06
06:26 batman jontaylor: have you looked at Mad::Mapper? it's beta, but if you let me know what to fix, i will make it better :)
06:26 jontaylor i’ll take a look batman
06:26 trone joined #mojo
06:27 batman thanks
06:36 jontaylor batman: so far I like this, its the missing layer of abstraction
06:36 jontaylor hard to find criticism
06:36 jontaylor actually, one thing is just a naming preference, i’m not a fan of instantiating an object, setting a value on it, and then calling load
06:37 jontaylor unless of course, the load method will later be improved to find a record based on something other than its primary key
06:39 dod joined #mojo
06:40 jontaylor batman: One other thing I tend to use lighter ORMs for as well, is when a larger ORM tends to enforce some conventions upon me
06:41 jontaylor so one improvement I could see I would personally need, is the ability to set the PK as an arrayref, for a composite primary key
06:44 zach jontaylor: what is yield?
06:46 jontaylor zach: In the context of a template layout file, yield will be where the current pages content goes
06:46 jontaylor so you can imagine having a layout file that starts the document, has your <head> in it etc, then starts the body, calls yield, and then finally has the footer
06:46 zach jontaylor: like this http://guides.rubyonrails.org/layouts_and_rendering.html#understanding-yield ?
06:47 jontaylor your content will get placed where it says yield
06:47 jontaylor yep
06:47 zach I know it's rails, but is it the same?
06:47 jontaylor I come from a rails background and yes its the same :)
06:47 zach ok, I've done more rails than mojo too
06:47 zach ...but I like perl and know it better than ruby
06:48 jontaylor You’ll be comfortable with mojo if you know Rails I reckon
06:49 jontaylor other than views being called templates even the directory structure looks similiar
06:49 zach the blog example from the mojo pg brought dejavu
06:50 zach the infamous rails blog starting example in the tutorials
06:51 jontaylor indeed
06:52 batman jontaylor: you can decide what to use as "primary key" when doing load. you can even create your own method which loads based on different keys.
06:52 batman jontaylor: that's what i want to accomplish with Mad::Mapper: Having defaults that suit most cases, and let the sub class (your code) customize for "special cases"
06:52 zach jontaylor: so what do you like better about mojo?
06:53 jontaylor batman: ok that sounds reasonable
06:54 batman https://metacpan.org/pod/Mad::Mapper#pk
06:56 batman jontaylor: also, have a look at https://metacpan.org/pod/Mad::Mapper#fresh -- it's there so the object can remember the related data (has_many) for later to be rendered in a template
06:56 batman (since you can't do async queries inside a template)
07:00 jontaylor batman: in my composite primary key example, it looks like i’d be better off implementing _find_sst and _update_sst in my own model, instead of load and save
07:01 batman jontaylor: yes. that's what i was hoping for... but let me know if you find yourself repeating yourself.
07:01 batman repetition != special case :)
07:02 jontaylor oh yeah, I think this is really good, i’m just trying my hardest to poke holes in it as its not very useful if I just tell you its great :)
07:03 batman jontaylor: i like it!
07:05 batman jontaylor: if you use it and find something, then please make issues on github, so i won't forget about it. https://github.com/jhthorsen/mad-mapper/issues
07:05 jontaylor batman: Right now i’m on the fence, as i’ve got a project thats mid way
07:05 batman sure. no problem.
07:05 jontaylor I think I could refactor this to use it
07:05 jontaylor hmm
07:08 damaya_ joined #mojo
07:08 jontaylor zach: The main problem with Rails is the community that acts a bit too much like sheep
07:10 jontaylor zach: Rails shops are some of the most religious places to work, you’ll notice how every job advert is identical
07:10 jontaylor They all want TDD, Ember/Angular/React, Elastic Search and Mongo, Deployed with Docker or AWS etc
07:11 jontaylor For simple business apps that just want a page of HTML with a table in it...
07:16 jontaylor batman: I keep thinking of more features i’d need in this, but I can’t justify saying anything as I can always implement them in a subclass…
07:16 zach yeah I guess
07:18 jontaylor batman: Do you see in this example, https://github.com/kraih/mojo-pg/blob/master/examples/blog/lib/Blog/Controller/Posts.pm#L45 how the output of $validation->output is used for mass assignment ?
07:18 eseyman joined #mojo
07:21 batman jontaylor: $post = Post->new($validation->output)->save; ?
07:23 batman sorry. if i guess if you know it's in the database, you can do Post->new($validation->output)->in_storage(1)->save
07:23 jontaylor batman: I was just about to say that for the update example heh
07:23 batman :)
07:24 Vandal joined #mojo
07:25 batman jontaylor: maybe save() should be able to take a $hash... like $obj->save(\%attrs);
07:30 jontaylor batman: actually I think its fine the way it is
07:30 jontaylor if you listen to me you’ll end up with DBIx::Class
07:31 arpadszasz joined #mojo
07:32 batman i don't want to end up quite like dbic, but i do want a resultset...
07:33 batman so you can do search()
07:33 batman i'm kind of trying to make a new version of Mandel https://metacpan.org/pod/Mandel
07:42 jontaylor I think there are two problems here, which should be two seperate enhancements over just using Mojo::Pg itself. 1. Getting a blessed reference instead of a hash, but no functionality on the object for saving or updating itself. This is just so you can add your own methods (such as one that might concatenate two fields together), and use method calls instead of hash key lookups (avoids a bug vector with hash key typos). The other problem, 2. Is
07:42 jontaylor a table, doing queries on it, knowing what its fields are etc.
07:43 jontaylor and it would be great if you could just use one or the other, or both
07:50 zach jontaylor: trying to use yield didn't work
07:50 zach jontaylor: spit out errors
07:51 zach tried <%= yield :title %>
07:51 zach in the layout
07:51 zach and in the template % layout 'carousel', title => 'Welcome';
07:52 jontaylor Oops, this is me giving you terrible info zach
07:52 jontaylor it should look like
07:52 jontaylor <%= content %>
07:52 zach or <%= title %> in this case?
07:53 McA joined #mojo
07:53 zach yep
07:53 zach changing it to <%= title %> worked
07:54 zach I think it's time for sleep now
07:54 zach thanks jontaylor
07:54 jontaylor zach: here is an example for later
07:54 jontaylor http://pastebin.com/CjiZrC99
07:54 Repaster Repasted text from jontaylor: http://fpaste.org/253315/19326214/
07:57 zach thanks
08:03 jontaylor Got one of these reasonably beefy servers from OVH for the mojo app i’ve got in development https://www.ovh.com/us/dedicated-servers/enterprise/2014-SP-64.xml
08:03 jontaylor and it generates pages slower than my laptop...
08:17 sopanshewale joined #mojo
08:18 buu Because it's in france?
08:23 jontaylor buu: I mean page generation time, calculated on the server itself
08:26 jontaylor i’m running unixbench on my laptop and the server now to get a bit more insight
08:30 batman jontaylor: thanks for the input
08:40 theo buu: could be in Canada too. And I would be surprised if ping was a factor here.
09:18 jontaylor unixbench indicates that the servers cpu is a smidgen faster, still got too many variables to consider though
09:19 jontaylor OS X vs FreeBSD etc, single 500GB SSD, vs 2x 300GB SSD caching 2x 2TB Sata drives, 16GB vs 64GB ram
09:19 berov joined #mojo
09:27 meshl joined #mojo
09:27 berov joined #mojo
10:00 meshl joined #mojo
11:06 Mikey those OVH HDD's are the slowest ever.
11:06 Mikey like borderline unusably slow.
11:07 eitz joined #mojo
11:34 jberger preaction: your synopsis example is incorrect
11:35 jberger Have to instantiate ::WithRoles
11:59 HtbaaPi joined #mojo
12:02 neilhwatson joined #mojo
12:22 stryx` joined #mojo
12:38 arpadszasz joined #mojo
12:47 ajr_ joined #mojo
12:50 hernan605 joined #mojo
12:52 ZoffixWork joined #mojo
12:56 disputin joined #mojo
13:13 zivester joined #mojo
13:28 chenri1 joined #mojo
13:38 PopeFelix joined #mojo
13:41 gryphon joined #mojo
13:49 cpan_mojo App-proxyforurl-0.03 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-proxyforurl-0.03
14:06 plicease joined #mojo
14:10 genio Can someone scan and sanity check this? https://github.com/genio/www-salesforce-nb
14:13 jberger genio: I'd love to, but I don't have time
14:27 batman genio: Does it work?
14:27 mattastrophe joined #mojo
14:28 batman It looks like it's calling get(), but I can't see that method...
14:28 batman Will have a closer look when I get home.
14:30 genio batman: Yes.  it works.  it isa Mojo::UserAgent so get() is there
14:30 batman Ah! Of course. Thanks :)
14:30 batman I would have ua as an attribute.
14:30 batman Instead of isa
14:31 genio I started out with it being an EventEmitter with a ua attribute, but it seemed like it would make it more cumbersome on the user to just make a call I haven't yet implemented if need be
14:32 Grinnz_ if you use Moo, you can delegate methods to the ua easily
14:36 lluad joined #mojo
14:40 genio So, make it an EventEmitter again with a ua attribute and possibly Moo it up if I want to make certain things like proxy() and get/put/patch/post/delete() easy on the end user?
14:40 ajr_ joined #mojo
14:43 njlg joined #mojo
14:44 Grinnz_ that would be my approach, but i dunno about inheriting from EventEmitter as a Moo object; my solution so far has been to have an eventemitter as an attribute
14:46 jb360 joined #mojo
14:47 mst I see no reason why Moo subclassing EventEmitter wouldn't work
14:49 genio Is subclassing UA a bad thing per-se?  Or is it more of a standard of sorts to have a UA attribute instead?  I'll change it either way, I'm just curious
14:50 disputin joined #mojo
14:50 PryMar56 joined #mojo
14:52 Grinnz_ it's just odd, i guess
14:53 mst I'd delegate to ua
14:53 mst subclassing EE seems ok though
14:53 Grinnz_ mst: i was just worried about the attributes
14:53 mst Moo will detect non-Moo, populate its own attributes, then hand the hashref down to the Mojo constructor
14:54 mst er, no, the other way around
14:54 mst so as long as your attribute names match your init_arg values
14:54 mst Moo will overwrite anything stupid Mojo::Base does
14:54 jberger do remember that Moo setters don't return the instance
14:55 Grinnz_ if you're inheriting from EventEmitter you'll have tap, though
14:55 jberger sure
14:55 jberger I'm just saying it for completeness
14:55 jberger a thing that one might notice
14:58 eitz joined #mojo
15:00 mst right, Moo sticks with the perl standard practice even though I'm not always 100% happy with it
15:01 genio I was keeping with the EventEmitter/UA subclass so that  ->catch(sub{die pop}); is easy-peasy error handling for the caller.  without either of those as a subclass, I need to die and have the caller try/catch a lot, right?
15:01 Grinnz_ why? if you are inheriting from eventemitter you can still throw an error event
15:01 Grinnz_ or even if you have it as an attribute
15:02 inokenty joined #mojo
15:03 genio yes, if I inherit from eventemitter or useragent I can thow an error event.  with it being an attribute, I'm not exactly certain how I'd make that simple for the caller
15:05 Grinnz_ $self->events->emit(error => $foo)
15:05 Grinnz_ and you can delegate emit and catch even
15:07 zackiv31 joined #mojo
15:24 batman genio: why do you need the eventemitter?
15:26 batman i would simply not subclass the ua, since it contains methods and attributes that are close to useless for your class (my humble opinion)
15:27 sri <3 delegation pattern
15:27 Grinnz_ yeah. three things i upgrade to Moo for are delegation, coercion, and triggers
15:28 genio batman: my only need is the ua.  I liked subclassing ua because it made ->proxy() etc. available and simple to the caller.  I think this is due to me not understanding that I could make this easy through delegation.  This is my ignorance more than necessity
15:29 batman genio: i don't use Moo, i just do stuff like sub proxy { shift->_ua->proxy(@_) }
15:29 Grinnz_ which is basically the same, just with more writing per method :P
15:29 batman but i guess in the case of proxy(), i would rather just make the ua public, and let whoever change it from a public api
15:30 batman Grinnz_: yeah... well i just write it once, the do ddp (in vim) and use multicursor to replace proxy. works pretty smoothly for me :)
15:30 * sri meant the pattern, and doesn't care particularly for those fancy helpers
15:30 batman *then
15:31 mst genio: has ua => (is => 'ro', required => 1, handles => [ qw(emit catch ...) ]);
15:31 sri actually pretty rare that i just proxy stuff through without changes
15:31 batman mst: but that would brake the standard behavior in mojo.
15:32 mst batman: what? how?
15:32 batman since it doesn't return $self (btw, i know my snippet doesn't do that either)
15:33 mst I'm sorry?
15:33 mst if it's 'ro', you can't set it, so the differing setter behaviour never comes up
15:33 mst oh, emit() returning $self, I see, sorry
15:33 mst yeah, probably simplest to subclass EventEmitter for that bit then
15:33 batman mst: what would $self->proxy() return ?
15:33 Grinnz_ yea thats the only problem with it, and why i've wanted to make a Mojo::EventEmitter clone as a role
15:34 batman genio: so... back to the design. in my opinion, i would say "proxy" is an attribute on ua, and not on salesforce.
15:34 mst Grinnz_: https://metacpan.org/pod/release/TEAM/Mixin-Event-Dispatch-1.999_002-TRIAL/lib/Mixin/Event/Dispatch/Methods.pod is an interesting move towards that
15:34 batman that's why i wouldn't subclass it.
15:34 Grinnz_ i know, there are already 30 ways to do it, but they aren't Mojo::EventEmitter :P
15:34 mst this one didn't exist two days ago though :)
15:35 mst also, it's prior art for a style of doing so
15:35 mst I would not object to a Role::EventEmitter existing
15:35 mst that'd be pretty cool :)
15:36 genio I'm watching https://www.youtube.com/watch?v=cjoWu4eq1Tw in attempt to make myself less ignorant on the subject before moving forward
15:37 Grinnz_ i think i'm going to end up making that, just because i'm slightly unhappy with every existing API for event dispatch
15:39 mst tm604's isn't bad, but it's a bit wordy
15:39 Grinnz_ it's close yea
15:40 Grinnz_ but right now, i'm reading the tutorial on dzil minting so i can automate away 10 seconds of creating new git repos
15:41 Grinnz_ \o/
15:42 sri Grinnz_: speaking of doing stuff, i think you still owe us a new documentation convention for example results!
15:42 Grinnz_ oh, there was a thing about that wasnt there
15:43 sri Grinnz right now http://media0.giphy.com/media/4pMX5rJ4PYAEM/giphy.gif
15:43 Grinnz_ hehe
15:45 meshl joined #mojo
15:51 jberger genio: this one is good too: http://radar.oreilly.com/2014/01/horizontal-reuse-an-alternative-to-inheritance.html
15:51 jberger I'm very happy with how Test::Mojo::WithRoles is working
15:54 ajr_ joined #mojo
15:59 genio Thanks for all the help and information.  I'll play with changing things later today
16:51 sopanshewale joined #mojo
17:00 howitdo joined #mojo
17:02 berov left #mojo
17:18 dod joined #mojo
17:22 njlg joined #mojo
17:40 upasana joined #mojo
17:42 upasana_ joined #mojo
17:48 berov1 joined #mojo
18:05 sopanshewale joined #mojo
18:07 njlg joined #mojo
18:09 amon joined #mojo
18:22 njlg joined #mojo
18:49 njlg joined #mojo
18:55 njlg joined #mojo
19:02 dod joined #mojo
19:21 buu joined #mojo
19:39 njlg joined #mojo
19:51 dotandimet joined #mojo
19:54 berov1 joined #mojo
20:07 dod joined #mojo
20:12 dod joined #mojo
20:13 ladnaV joined #mojo
20:18 Vandal joined #mojo
20:18 meshl joined #mojo
20:24 chenri1 left #mojo
20:26 asymp joined #mojo
20:52 njlg joined #mojo
20:55 njlg joined #mojo
21:00 stephen joined #mojo
21:01 njlg joined #mojo
21:05 Grinnz_ anyone know if there's a reason Mojo has dynamic_config: 1? the Makefile.PL doesnt look like anything special
21:06 Grinnz_ i guess it's generated by EUMM for some reason?
21:08 njlg joined #mojo
21:15 cpan_mojo Swagger2-0.44 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.44
21:19 gryphon joined #mojo
21:26 njlg joined #mojo
22:09 mattastrophe joined #mojo
22:13 njlg joined #mojo
22:25 njlg joined #mojo
23:12 njlg joined #mojo
23:27 D4RK-PH0ENiX joined #mojo
23:28 PryMar56 joined #mojo
23:37 lluad joined #mojo
23:46 njlg joined #mojo
23:55 njlg joined #mojo

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