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

IRC log for #mojo, 2014-02-06

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

All times shown according to UTC.

Time Nick Message
00:19 jack joined #mojo
00:20 mattastrophe joined #mojo
01:05 laouji joined #mojo
01:07 dvinciguerra joined #mojo
01:09 marty joined #mojo
01:10 malikai so if i replace slurp with the following, it works on stock cent6
01:10 malikai http://pastebin.com/9VspATUb
01:11 d4rkie joined #mojo
01:11 malikai without it, slurp always croaks with: Can't locate object method "sysread" via package "FileHandle" at /usr/local/share/perl5/Mojo/Util.pm line 255, <DATA> line 522.
01:12 malikai obviously replacing slurp like that is wrong, but what's missing from cent6? (sysread appears actually available)
01:24 ka2u joined #mojo
01:35 d^_^b joined #mojo
01:41 good_news_everyone joined #mojo
01:41 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/2wHZsw
01:41 good_news_everyone mojo/master fc5d656 Sebastian Riedel: simplify README examples
01:41 good_news_everyone left #mojo
01:42 sri the respond_to example was a bit heavy
01:42 sri think this gets the point better across
01:44 good_news_everyone joined #mojo
01:44 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UEp5vg
01:44 good_news_everyone mojo/master ea9b69c Sebastian Riedel: clean up README example some more
01:44 good_news_everyone left #mojo
01:48 jberger joined #mojo
01:55 jberger sri, the nonblocking stuff "just works" on android (it must if it's using daemon right?)! Thats awesome!
01:55 mattastrophe joined #mojo
01:55 sri don't know details, just assumed the tests passed ;p
01:56 sri hugmeir just said catalyst and dancer didn't work
01:57 jberger ha!
01:58 jberger btw, I'm catching up on the log, and I think the to_html etc looks nice
01:59 sri better read on :)
02:00 jberger nice, ->content :-)
02:01 sri idiom question... "...unless length $buffer;" or "...if $buffer eq '';"?
02:02 jberger length I would say
02:02 sri haha, i just switched to eq
02:03 jberger doesn't matter I suppose, unless length feels more linguistic
02:03 sri it kinda feels dirty
02:03 jberger pshaw
02:05 sri i want to know if the buffer is empty, why would i let perl count the characters?
02:06 jberger oh, I guess that is a good optimization for large buffers
02:07 jberger sri is correct as usual :-D
02:07 sri i don't actually know how length is implemented, but yes, i assume if the buffer is in fact huge it might matter
02:07 sri perl could be keeping the length cached in the AV struct
02:07 sri um PV
02:09 sri looks like it might be perl -MDevel::Peek -E 'my $foo = "lala"; Dump $foo; length; $foo; Dump $foo'
02:13 sri http://blogs.perl.org/users/hoelzro/2013/09/perl-5-internals---part-two.html
02:14 sri so length is in fact a very cheap operation, possibly cheaper than eq :o
02:14 sri idiom readjustment time!
02:17 alnewkirk joined #mojo
02:18 sri jberger: you were right ;p
02:19 jberger \o/
02:21 klapperl_ joined #mojo
02:23 jberger malikai, if you add 'use FileHandle' does that help things?
02:25 jberger and probably 'use IO::Handle' too
02:26 sri jberger: Mojo::Base does that, don't bother, it's surely centos madness
02:26 jberger ok then
02:27 jberger # No imports because we get subclassed, a lot!
02:28 jberger :-D
02:28 gnephiak joined #mojo
02:29 sri :)
02:29 good_news_everyone joined #mojo
02:29 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Uo-u8g
02:29 good_news_everyone mojo/master 2e32224 Sebastian Riedel: idiom switch
02:29 good_news_everyone left #mojo
02:53 zM joined #mojo
02:54 zM joined #mojo
03:14 * sri just remembered one thing he really hated working on in catalyst... table formatting of the debug output ;p
03:15 sri figured it should be really easy to make a generic table formatter for our terminal command list...
03:15 sri I WAS SOOO WRONG
03:15 sri even without borders it's a nightmare to wrap cells
03:17 sri something like "my $str = Mojo::Util::table [30, 50], [['foo', 'bar'], ['Just a foo command.', 'Just a bar command.']]"
03:18 sri fixed width, and when a value gets too long the cell grows pushing everything below one line down
03:19 sri Mojolicious::Commands and Mojo::Command::routes could use it for starters
03:19 sri *+licious
03:22 sri implementation shouldn't be more than 15 lines to be worth it ;p
03:23 sri if anyone wants to try
03:24 * jberger recommends formats
03:24 * jberger ducks
03:25 malikai jberger, add it in my code or in Util.pm?
03:26 jberger malikai, sri is right, it probably won't do anything
03:26 malikai ah
03:26 jberger I would have said to add it to Util.pm
03:26 malikai also, i agree.. it's centos/rhel madness for sure
03:27 * jberger has a very nice blue hat
03:27 malikai why they insist on ruining all things good is beyond me.. further, why .corp insists on running it gives me headaches
03:29 * malikai wishes he could just say "shut up and run ubuntu".. but it's hard to say that when they're paying me
03:31 jberger running an LTS version of Ubuntu has to be much more sane than using Centos for anything
03:32 malikai RHELL
03:32 malikai in a previous life, i must have done something awful to deserve this
03:33 * jberger spins malikai's karma wheel
03:34 jberger then again, I am forced to develop on windows :s
03:34 jberger how funny is it that I use windows at work and linux at home, isn't it supposed to be the opposite of that?
03:35 malikai you too must have upset the gods
03:36 * jberger makes peace offerings to Torvalds and Gates
03:37 malikai i think it's best to avoid the ballmer
03:41 jberger sri: liking cpan_mojo?
03:51 malikai heh.. i'm tempted to rip out the stock perl in centos.. but i'm certain that will break everything
03:52 malikai i see quagmire in the future
03:53 jberger malikai, is perlbrew an option for you?
03:53 jberger <3 perlbrew
03:53 jberger I never use the stock Perl ever for anything
03:53 malikai actually, yes..
03:53 malikai heh.. that might be way, way better
03:54 jberger \o/
03:54 jberger WHY NOT ZOIDBERG!!!!
03:54 purl (V) (;,,;) (V)
03:56 malikai excellent idea jberger.. you may have just saved me an early stroke
03:57 jberger hooray!
03:57 sri jberger: i do
03:57 * jberger proscribes blood thinners
03:58 jberger malikai, I also love the perlbrew/cpanm integration
03:58 jberger dead-simple
03:58 jberger and actually it has local::lib so well integrated you never actually see it
03:59 malikai ditto that.. one of the things i've been uncomfortable with is the amount of system perl messing-with i've had to do.. i.e. cpan modules
03:59 malikai not so much for mojo until this slurp thing.. but more so for my other dependencies
04:01 alnewkirk dependencies are not something to be avoided, but rather that which should be embraced
04:02 sri jberger: just to have the last laugh i'm going to commit something that uses formats!
04:02 jberger NOOOOOO
04:02 jberger alnewkirk, that's not the issue, the issue is installing and changing cpan modules in the system perl
04:03 malikai ...(and breaking broken redhat stuff that depends on being broken to not break)...
04:03 jberger HA
04:04 alnewkirk jberger: oh
04:05 sri hmm, wonder if avoiding the wrapping problem by truncating the cell value and appending ... would be acceptable
04:05 jberger using perlbrew/cpanm/local::lib you are free to install/upgrade whatever you want, your only risk is needing to switch out a new perl for the one you just torched
04:15 malikai much better than asking IT ops to build me a new VM
04:15 malikai ...because i killed RHELL
04:16 laouji joined #mojo
04:23 ka2u joined #mojo
04:32 sri http://pastie.org/8703515 # the most minimalistic naive table hack i can come up with ;p
04:34 sri truncating might be fine... if it can self adjust a bit, shrink the first column and grow the second if possible
04:34 sri and so on
04:35 jberger my eyes!
04:37 sri man up!
04:45 laouji joined #mojo
04:48 sri hmm, self adjusting is a bit more code
04:48 sri 17 lines :/
04:49 * jberger demands a 'format' version
04:52 sri http://pastie.org/8703562 # self adjusting
04:52 sri i'm open for ideas on how to golf it down
04:53 jberger you know that nothing containing "Think of it as a poor man's nroff(1)." could be a good idea :-P
05:21 jnbek^dt joined #mojo
05:23 sri http://pastie.org/8703627 # hmm... it doesn't get rid of that much code :/
05:23 sri but that would be a preliminary patch
05:25 jnbek^dt joined #mojo
05:31 jnbek^dt joined #mojo
05:31 zivester joined #mojo
05:36 sri oh, maybe it's worth it after all :o
05:38 sri cost is down to 4 additional lines of code
05:38 jberger sri: would it work better if it were row oriented rather than column?
05:38 sri would it?
05:39 jberger [[10, 20], ['item', 'long item'], ['foo', 'bar baz']]
05:39 sri be my guest, golf it down! :)
05:40 tianon we need something cool like http://play.golang.org/ for perl :)
05:40 sri http://pastie.org/8703666 # now with less lines of code
05:41 sri ./script/mojo command list is a good test case
05:41 bpmedley tianon: http://perltuts.com/tutorials/quick-start/hello-world
05:42 tianon bpmedley: oh, legit! thanks :D
05:42 tianon there's even a vim version <3
05:44 sri jberger: but i get the feeling the whole shrinking part would be much harder
05:45 sri usability from the outside would go up though i guess
05:51 jberger here is your original paste row-oriented: http://pastie.org/8703680
05:51 * jberger is trying to grok the shrinking
05:52 sri heh, that's the simple part ;p
05:54 jberger ENOMOREBRAIN
05:55 jberger I just spent the evening boiling down the mojolicious "components" to this: https://github.com/jberger/MojoBook/blob/master/basics/components/components.tex
05:56 jberger https://drive.google.com/file/d/0B-gBN2ue1FmVaDFjbWhvbWxONWs/edit?usp=sharing
05:56 jberger ^^ easier to read
05:58 laouji joined #mojo
06:04 sri i'm close, lines of code might be the same
06:11 laouji joined #mojo
06:19 sri and it's one line less now
06:19 sri price is now 3 lines of code :)
06:20 sri and down to 1 line ;p
06:20 laouji joined #mojo
06:26 dabudabu jberger: Nice!
06:37 d4rkie joined #mojo
06:42 laouji joined #mojo
06:52 laouji joined #mojo
06:55 sri and it's free :)
06:58 trone joined #mojo
07:01 laouji_ joined #mojo
07:09 salparadise joined #mojo
07:17 laouji joined #mojo
07:18 good_news_everyone joined #mojo
07:18 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/uPRqxQ
07:18 good_news_everyone mojo/master a729dfc Sebastian Riedel: added table function to Mojo::Util
07:18 good_news_everyone left #mojo
07:18 sri same line count as before, and some stuff got quite a bit cleaner
07:18 sri and i believe the table function can still be golfed down a bit
07:19 sri one thing i wanted though was no whitespace padding at the end of the line... for use in logging and stuff
07:21 sri tests should cover pretty much all we need, so go ahead and golf it down!
07:26 arthas joined #mojo
07:26 laouji joined #mojo
07:43 abra joined #mojo
07:46 good_news_everyone joined #mojo
07:46 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Hk3-ng
07:46 good_news_everyone mojo/master 4b316ec Sebastian Riedel: added a few table examples
07:46 good_news_everyone left #mojo
07:49 cpan_mojo MojoX-Renderer-JSON-XS 0.03 by Da Shan Yang Geng - http://metacpan.org/release/YOWCOW/MojoX-Renderer-JSON-XS-0.03
07:54 hesperaux joined #mojo
07:56 dod joined #mojo
08:02 rawler joined #mojo
08:03 eseyman joined #mojo
08:04 Vandal joined #mojo
08:04 gnephiak joined #mojo
08:12 dod joined #mojo
08:14 eugen joined #mojo
08:24 Tiger joined #mojo
08:25 mire__ joined #mojo
08:30 odc joined #mojo
08:38 bzero joined #mojo
08:51 basiliscos joined #mojo
08:59 trone joined #mojo
09:06 bjakubski joined #mojo
09:10 * sri cracks the whip
09:10 sri start golfing!
09:16 maxhq joined #mojo
09:20 rawler joined #mojo
09:27 punter joined #mojo
09:51 buu FORE
09:51 stephan48 joined #mojo
10:12 dpetrov_ joined #mojo
10:21 gnephiak joined #mojo
10:32 stephan48 joined #mojo
10:46 radixo joined #mojo
10:56 buu Silly question but why does my $dom1 = Mojo::DOM->new->xml(1)->parse("<foo><a>1</a><b>2</b><c>3</c></foo>"); print scalar @{$dom1->children}; output "1" ?
10:57 buu Oh, implicit parent item
10:57 buu I see
11:08 KindOne joined #mojo
11:14 ka2u joined #mojo
11:26 punter joined #mojo
11:34 hrupp joined #mojo
11:50 fhelmber_ joined #mojo
11:51 kwa joined #mojo
12:13 d4rkie joined #mojo
12:29 d4rkie joined #mojo
12:40 odc is it possible to use Mojo::DOM to encode a hash to xml?
12:45 crab how would you encode a hash to xml
12:46 odc hm, like i do with XML::Simple?
12:49 nicomen ah
12:49 nicomen not in a simple way I'd think, but it's possible
12:49 nicomen you mean perl structure => XML
12:50 nicomen also there are a number of issues in that process
12:50 odc aw
12:50 nicomen I actually ended up preferring TreePP for perl -> xml conversion
12:50 odc i saw Mojo::DOM uses arrays to represent the tree
12:51 nicomen maybe if you are able to mimic the internal format and use it, but I haven't seen any public methods for that
12:51 odc right
12:51 odc thx
12:52 nicomen could always fire a feature request I guess?
12:57 batman that sounds like a bad idea.
12:58 batman use a template and generate the xml. it's super simple. you can even use taghelpers if you don't care about speed and hate <tags>
12:58 batman bad idea = adding that as a feature request
12:59 batman XML::Simple is broken because it does not care about order
13:04 odc i tried to cheat by trying $dom->tree([ $hashref ])
13:05 odc bad idea
13:05 purl bad idea is probably or opping #linux on dalnet or http://www.priceless420.com/Pr120403aircooled.jpg or http://www.molestedcars.com/trucks/028.jpg or "watch this" or "check this out" or Durian smoothie! or bogus ant-breeding scheme or looking at any site with 'loliserv.org' in the hostname at work
13:06 nic coo, ant-breeding scheme
13:06 * nic digs out his creditcard
13:21 crab hmm, i haven't seen an ant in ages
13:44 rihegher joined #mojo
13:48 hummeleBop joined #mojo
13:51 ryozi joined #mojo
13:52 malikai durian smoothie
13:52 malikai lulz
13:54 nic "if one column doesn't require its full quota, the next one inherits it."
13:54 mattastrophe joined #mojo
13:54 nic Does that mean that if you specify [20, 20], but the data for first col only needs 10 then the second col can use 30?
13:56 cpan_mojo Mojolicious-Plugin-Qaptcha 0.09 by HRUPP - http://metacpan.org/release/HRUPP/Mojolicious-Plugin-Qaptcha-0.09
13:58 nic The ants were terrorising the worms in my wormery, so I stole all the ant eggs and fed them to the blackbirds
13:58 nic (true story)
14:09 bluescreen joined #mojo
14:09 * malikai has a hard time imagineing how ants terrorise worms
14:10 dhg joined #mojo
14:13 suy_ joined #mojo
14:22 russum joined #mojo
14:23 webart joined #mojo
14:25 ka2u joined #mojo
14:29 jberger joined #mojo
14:30 * jberger had no idea what to make of #585
14:31 mire__ joined #mojo
14:35 sh4 joined #mojo
14:45 Foxcool joined #mojo
14:48 btyler joined #mojo
14:51 mattastrophe joined #mojo
14:51 russum left #mojo
14:54 radixo joined #mojo
15:07 gryphon joined #mojo
15:17 meshl joined #mojo
15:29 radixo_ joined #mojo
15:33 rihegher left #mojo
15:50 sri nic: yes, that's exactly what it means
15:51 good_news_everyone joined #mojo
15:51 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Pe1NjA
15:51 good_news_everyone mojo/master d8d53d9 Sebastian Riedel: better example for timers outside of actions
15:51 good_news_everyone left #mojo
15:55 ka2u joined #mojo
15:57 sri jberger: i think that addresses #585
15:57 Fatalnix joined #mojo
15:58 Fatalnix Someone the other day was telling me about some sort of adaptive framework or something they use with Mojolicious that I guess uses JSON and Javascript or something? Anyone have any idea what that is?
15:58 Fatalnix I forgot the name of what he called it
15:59 sri so nobody golfed Mojo::Util::table down? :/
15:59 Fatalnix What's a table? is that some sort of HTML virus?
15:59 Fatalnix :)
16:01 good_news_everyone joined #mojo
16:01 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ngVa8A
16:01 good_news_everyone mojo/master 786d34e Sebastian Riedel: added indented table test
16:01 good_news_everyone left #mojo
16:01 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/Util.pm#L299
16:02 sri i want that a bit shorter
16:04 sri https://github.com/kraih/mojo/blob/master/t/mojo/util.t#L421
16:04 sri the tests should cover all use cases
16:10 sri i'm also open for name change suggestions
16:18 nic Fatalnix: By "adaptive" do you mean responsive?  There's a Mojolicious+Bootstrap+JQuery demo/package out there
16:20 Fatalnix I don't remember, someone was mentioning some JSON + Javascript thing he was using to draw the layout from Mojolicious.. I guess that'd be responsive since its still posistioned client side.. However I don't remember what the name of the JS framework he was using was.
16:20 mil Angular.js maybe?
16:20 Fatalnix we're brainstorming stuff we can do to get ourselves out of the typical responsive nightmare.
16:20 Fatalnix at work
16:20 Fatalnix yes thats is
16:20 Fatalnix it*
16:21 Fatalnix how is that?
16:45 irq joined #mojo
16:47 batman I like drawing my web page on server side
16:48 Fatalnix How do you go about that, do you have a particular method you favor?
16:48 batman I mostly replace chunks of HTML instead of putting JSON inside markup on client side
16:48 Fatalnix I see
16:49 mire__ joined #mojo
16:49 batman Me and marcus use pjax in convos.
16:49 batman My bus soon stops. *bbl*
16:49 Fatalnix jberger used a really, really interesting method with his CMS
16:50 Fatalnix I really liked it
16:50 Fatalnix He used websockets to do practically everything as far as I remember being told
16:50 Fatalnix cya.
16:51 jberger :-)
16:55 sri maybe Mojo::Util::tablify :)
16:57 tl joined #mojo
16:59 malikai so i have a problem
16:59 malikai https://github.com/hayajo/Mojolicious-Plugin-Process does something i want
17:00 malikai but but this hasn't happened
17:00 malikai https://github.com/stefb69/Mojolicious-Plugin-Process/commit/d1afee60d77dbeeb8c4e1e3173bf1567002d89c3
17:03 malikai decisions.. decisions
17:04 btyler malikai: there's also https://github.com/jhthorsen/mojo-ioloop-readwritefork and I think perhaps one that jberger++ was working on
17:05 btyler https://github.com/jberger/Mojo-IOLoop-ForkCall not quite the same, but similar realm
17:09 trone hi there. is possibile to send a redirect to the client before the controller finish its action?
17:10 trone sub controller { make_fast_things(); client_redirect(); continue_to_make_slow_things(); return 1; }
17:14 sri http://img.gawkerassets.com/img/19c35oidyf35igif/original.gif
17:15 sri http://www.nntp.perl.org/group/perl.perl5.porters/2014/02/msg212527.html
17:15 tianon :D I love that they're "Purple" :D
17:16 nic malikai: I vaguely remember batman mentioning something similar, but I think his impl required an additional event [only got a fuzzy memory on that]
17:19 nic 5.8 was quite a milestone, and so was 5.10; I wonder if 5.20 will be as big or bigger
17:23 sri subroutine signatures, IO::Socket::IP and postderef... i think it's right up there
17:28 radixo joined #mojo
17:31 tempire WHOA
17:33 tempire Though I like the animated gif just as much as purple signatures
17:33 nic :)
17:33 sri figured that would smoke you out :)
17:34 sri http://img.pandawhale.com/45822-steve-jobs-mind-blown-gif-1XU8.gif
17:36 btyler holy crap! I've been following p5p but it still sounded like things could go either way last I checked
17:36 beyondcreed joined #mojo
17:40 davido__ purple signatures.... Wow, cool.  Why are they called "purple"?
17:50 marty good thing Ron was not elected.  He might have de-funded the NSA and the world would be a much more dangerous place.  :P
17:51 sri nobody can defund the NSA, they know too much
17:52 howitdo joined #mojo
17:52 eddy85br joined #mojo
17:55 btyler davido__: apparently zefram didn't have any other appropriate adjective for them: http://www.nntp.perl.org/group/perl.perl5.porters/2014/02/msg212261.html
17:57 batman nic: what..?
17:57 batman "additional event" ..?
18:01 davido__ Looks like good news.
18:01 davido__ ...and an opportunity to also more easily pull work into the compiletime phase.
18:10 sri hmmmmm... starting to wonder if Mojo::Util::table should allow overflow
18:10 sri it's not so nice when your "routes -v" table cuts off the regular expressions
18:12 davido__ set negative sizes to allow overflow?
18:12 sri makes everything a hell of a lot more complicated
18:13 davido__ including use
18:15 sri if i allow overflow i might just as well get rid of the width inheritance logic
18:16 sri which means get rid of widths entirely
18:18 davido__ then what's left is just another way of creating multidimensional array.
18:19 davido__ s/creating/rendering
18:19 punter joined #mojo
18:19 sri it's what we did before
18:20 sri this is not a universal tool, it's something we actually need in core
18:20 davido__ I see.
18:21 sri when you run "mojo" and see the command list, it is rendered with that
18:21 sri same for "mojo routes"
18:22 davido__ Is the give and take logic useful?
18:22 sri give and take?
18:23 davido__ I mean if one column doesn't require its
18:23 davido__ full quota, the next one inherits the rest.
18:23 sri very
18:23 sri *if* you restrict the table width
18:24 sri without liits i would just calculate the ideal width and go with it
18:24 sri *limits
18:24 davido__ yes.  So how does overflowing fit with that?
18:25 sri dunno what you mean
18:25 davido__ If there's a max table width, and the total need exceeds the max width
18:25 davido__ overflow would allow the max table width to be exceeded?
18:26 nic I'm thinking overflow might be better; if the user needs it truncated they can pipe it into "cut -nb1-80" or similar
18:26 * nic &
18:26 mattastrophe joined #mojo
18:29 irq joined #mojo
18:29 dod joined #mojo
18:42 sri yea, i tend towards overflow too
18:42 sri after all, those command line tools need to provide information in the first plance and only look good in the second
18:43 eddy85br joined #mojo
18:47 eddy85br joined #mojo
18:50 rem_lex| joined #mojo
18:55 rem_lex joined #mojo
18:56 dhg joined #mojo
18:57 good_news_everyone joined #mojo
18:57 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/u4tb7g
18:57 good_news_everyone mojo/master 18c7e41 Sebastian Riedel: renamed table function to tablify and changed it to allow overflow
18:57 good_news_everyone left #mojo
18:59 sri wrapping cells would be ideal, but also horribly complicated and likely overkill
18:59 sri brings back funny memories from when i wrote Text::SimpleTable because all table generators sucked :)
18:59 sri https://metacpan.org/pod/Text::SimpleTable # do not look at the code!
19:03 trone joined #mojo
19:04 sri think catalyst still uses it
19:11 suy joined #mojo
19:20 denis_boyun joined #mojo
19:25 sri and it has been merged into blead \o/ https://github.com/Perl/perl5/commit/82e2e6345a8bf1a0d5f0118676afa10ac6ebce0a#diff-9e7cc5aeaa35c709063fd1031d94555bR306
19:44 moritz huh, the indetion of the code examples there looks weird to me
19:45 moritz ah, tabs
19:49 mire__ joined #mojo
19:49 drift joined #mojo
20:17 tianon sooo perl ♥: sub foo ($thing, $id = $auto_id++) {
20:17 sri \o/
20:17 sri big question will be how far we go supporting it
20:18 sri using it in mojolicious as long as it's experimental is of course not an option, but we could activate it in Mojo::Base
20:19 sri maybe activate it and leave the experimental warnings on, so we don't interfere with the experimental process
20:21 sri i have to admit i'm a little disappointed tablify didn't get that much shorter... https://github.com/kraih/mojo/blob/master/lib/Mojo/Util.pm#L299
20:21 sri but at least it's less code than without tablify
20:23 genio Sub signatures would be very nice!
20:23 sri speaking of experimental features... i can't wait to be able to use s///r, not a day goes by where i don't notice a block of code that would cut in half
20:24 genio What does the /r flag do?
20:26 sri http://perldoc.perl.org/perlop.html#s%2fPATTERN%2fREPLACEMENT%2fmsixpodualgcer
20:27 sri as in my @new = map { s/\n//gr } @old;
20:27 genio oh, nice.
20:27 genio and chained substitutions as well
20:28 sri ye
20:28 good_news_everyone joined #mojo
20:28 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/_7pkFg
20:28 good_news_everyone mojo/master 0282f3d Sebastian Riedel: better tablify test
20:28 good_news_everyone left #mojo
20:32 genio joined #mojo
20:33 bowtie_ joined #mojo
20:39 good_news_everyone joined #mojo
20:39 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/xOcqag
20:39 good_news_everyone mojo/master 042364c Sebastian Riedel: better description for tablify
20:39 good_news_everyone left #mojo
20:40 lukep joined #mojo
20:43 davido__ Is 5.20 when the timer expires so you get to use s///r?
20:51 nic yep, 05:20 UTC
20:53 tianon http://rssdateformats.tumblr.com/
20:53 tianon "Sat, 11 00:00:01 GMT" "At least they specified the time zone."
21:06 mattastrophe joined #mojo
21:13 denis_boyun joined #mojo
21:13 damaya joined #mojo
21:14 damaya Hi all
21:14 damaya I am writing a plugin for Mojolicious, and I am wondering if there might be a guide on how to do this?
21:18 sri jberger: you were very right about making tablify row based, that will come in handy :)
21:18 sri perl -Mojo -E 'my $dom = g("mojolicio.us")->dom; print Mojo::Util::tablify $dom->find("*")->type->uniq->map(sub { [$_, $dom->find($_)->size] })'
21:19 sri for those not yet on github master ;p http://pastie.org/8706178
21:22 punter joined #mojo
21:35 jmmills joined #mojo
21:40 jmmills joined #mojo
21:41 jmmills joined #mojo
21:44 maxhq joined #mojo
21:47 tempire damaya: Reading the source of the built-in plugins will do the job
21:47 tempire http://mojolicio.us/perldoc/Mojolicious/Plugins
21:47 hesco where would one pose Perl::Critic usage questions?
21:59 hesco I'm curious to know if any Perl::Critic policies exist which would over look 'Code before strictures are enabled' for mojo, moose and other modules which get the stricture with a use Mojolicious; ?
22:24 drift joined #mojo
22:25 batman hesco: mojo does not enforce stricture. only strict
22:30 gryphon joined #mojo
22:34 s1037989 joined #mojo
22:35 damaya I think the thing I am trying to understand, that I don't see in any other plugins, is how to handle multiple params... So, the plugin is called like this: $self->plugin('DataTables'); and then you can create a datatable in a route using $self->initialize_datatable( table => 'datatable-example', columns => '[ 'col1', 'col2'] etc).
22:36 damaya I am trying to figure out, in initialize_datatable do I just grab params as I would typically (i.e., my $app = shift; my %params = @_;), or is there a mojo way to do it?
22:36 no_respect joined #mojo
22:41 sri s1037989: prototypes change how the perl compiler works, while signatures perform checks at runtime
22:41 damaya Hrm, well it works doing the params with %params = @_;, so I think I will just stick with that for now.
22:41 damaya If there is a Mojo way of doing it, I will figure that out later.
22:42 sri s1037989: when you have a prototype of sub foo ($$) {} you can't do foo(@bar)
22:43 sri compiler bails
22:43 sri signatures on the other hand accept that just fine and only bail if the number of elements in @bar doesn't match
22:43 no_respect hows the mojo folks?
22:43 marty joined #mojo
22:45 sri signatures are basically a shortcut for sub { my ($foo, $bar) = @_; } with arity checks that are not very costly
22:46 s1037989 sri: Is it safe to assume that you'll be leveraging sub sigs in Mojo at some point in the future?  In doing so, would the primary benefit be to you, the core developer of Mojo, in making it easier/better for you to code/maintain Mojo or to us little people, the users of Mojo, so that we are able to more easily and better develop apps with the Mojo framework?  Or both?
22:47 sri for now they are experimental, so we won't be using them in the core framework at all
22:47 sri *but* in the future we will 100% do so... if for no other reason than "it looks really fucking great" :)
22:47 s1037989 Ok, so sub sigs will allow us to have cleaner, more concise code?
22:47 no_respect all glory to the hypnotoad@
22:47 no_respect lol
22:47 sri get '/foo' => sub ($self) { ... }
22:48 sri no more boilerplate
22:48 s1037989 Yeah, ok, I get that now!  I watch all your commits and love watching the evolution of the code as you tweak different bits here and there to be just that much more concise!
22:48 sri it's how perl was always meant to be ;)
22:49 s1037989 Awesome!  I think I get it!  Thanks for sharing about them!
22:49 sri i would use more modern perl features if it wasn't for those meddling users ;)
22:50 sri just earlier i mentioned how much i want to use s///r
22:50 sri postderef in 5.20 is another one i think i might like a lot
22:50 s1037989 And what is it that makes doing so a bad idea?
22:51 sri users, they don't like it when the required perl version is too high
22:51 sri just look up the drama when we switched from 5.8 to 5.10
22:51 sri Y U NO LIKE US CENTOS USERS
22:52 s1037989 Ahh!  And that's what you meant by meddling users!
22:52 * sri nods
22:52 s1037989 Haha!  Right!  Get with the perlbrew program!  :D
22:52 sri yea, or jamadams great backport
22:53 sri https://github.com/jamadam/mojo-legacy # this will come in very handy next time we bump the version requirement
22:53 s1037989 Gosh, so by that logic, with subs only experimental in 5.20, how long will we have to wait before requiring 5.20 is feasible??
22:53 sri i think sub signatures are a special case for us
22:53 sri when they go stable we radically bump the requirement to 5.22
22:55 s1037989 !!  :D  That's exciting!  That will be your key to making the bump and at the same time getting to leverage so many other features.  Fantastic!!
22:55 sri there will be drama, but it's a feature that changes the perl experience completely, and worth it imo
22:55 sri gonna put a post-it on my display to make sure i mention the 5.22 bump at mojoconf :)
22:56 s1037989 I think it's half of what makes Mojo so enjoyable to work with!  Keeping it modern.  Keeping code so clean and concise.
22:56 s1037989 mojoconf???  When and where??
22:56 sri may 2014 in oslo
22:57 nic using signatures will eliminate one of the few things I don't like about perl
22:57 s1037989 Is it a single hour long session inside something else or is it a full day Mojo event?
22:57 nic not being able to use $arrayref as an array is another
22:57 btyler and postfix deref will hit the other one for me
22:57 sri 3 day event actually :)
22:58 s1037989 All about mojo??  Link?
22:58 sri one day training, one day talks, one day hackathon
22:58 sri link will be available soon
22:58 sri batman is working on it as we speak
22:58 s1037989 I assume it's open to all?  Cost?
22:59 nic This stuff is priceless :)
22:59 sri all i know so far is that all core devs will be there and i'm supposed to talk about something ;p
22:59 eddy85br left #mojo
22:59 sri oslo perl mongers are organizing
22:59 s1037989 Haha! Nice!  Wish I could be there!
23:02 no_respect perlbrew rokz
23:02 no_respect got hypnotoad hello world up
23:02 no_respect ah the road ahead! so vast!
23:03 tempire sri: will you be self-installing a voice-modulation kit in order to speak?
23:03 tempire or will it be text-only.
23:04 tempire marcus: Will there be multiple tracks, or one speaker at a time?
23:04 sri tempire: my LEDs will be blinking UTF-8
23:05 tempire beep boop beep
23:05 sri \o/
23:05 tempire oh, that reminds me. openwest.
23:05 tempire I suppose I'll submit a talk for non-blocking web services.
23:06 good_news_everyone joined #mojo
23:06 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/2E9dCg
23:06 good_news_everyone mojo/master 8381b87 Sebastian Riedel: small optimizations
23:06 good_news_everyone left #mojo
23:06 tempire do you have any idea what you'll be talking about, sri?
23:06 sri the dev process and new features in mojolicious 5 i think
23:07 sri explaining little hacks for the different features, should be fun
23:07 s1037989 Would it be appropriate to discuss API design?  I really struggle with that.  I find that it holds me back in my Mojo apps more than anything else.  I'm trying to do things the right way as much as possible and write reusable code and what not, but my API designs always suck!
23:08 sri anything mojolicious is on topic here
23:08 tempire or anything with glitter
23:08 sri or unicorns
23:08 purl hmmm... unicorns is http://xrl.us/2dn5
23:08 tempire metaphorical or otherwise
23:09 s1037989 API designs are like playing chess... you gotta be able to think multiple moves ahead.  I don't play chess well and I don't design APIs well!  :(
23:10 tempire If you keep everything in separate, single concerns, it's not so bad.
23:10 tempire put the main functionality it separate modules, and point to those modules with helpers.
23:10 tempire now you're an expert.
23:10 tempire go forth
23:10 s1037989 :D
23:10 no_respect to what extent are data structures, not algorithms, central to programming?  does mojo still rely on welld esigned sql db tables for data structures?
23:11 tempire data structures are everything.
23:11 good_news_everyone joined #mojo
23:11 good_news_everyone [mojo] kraih tagged v4.77 at 0028078: http://git.io/Sp28DQ
23:11 good_news_everyone left #mojo
23:11 tempire but mojolicious is storage-engine agnostic.
23:11 no_respect I get that epoll non blocing stuff alows nice multiprocessing
23:11 no_respect but mojo is then diferent how? cuz it implements websockets?
23:11 tempire it's non-blocking.
23:12 tempire that's the big sell.
23:12 tempire it's also pretty
23:12 no_respect so web forms and other stuff are all non blocking not just staic web files like cherokee or nginx
23:12 sri so we really have a function called "tablify" now
23:12 no_respect non block stem to stern
23:12 sri i was half joking... but you wanted it that way!
23:12 tempire http://tempi.re/a-mojolicious-non-blocking-web-service-why-
23:14 sri also always relevant :) http://mojolicio.us/perldoc/Mojolicious/Guides/FAQ#Will_my_code_magically_become_non-blocking_with_Mojolicious
23:16 no_respect It’s a magic realm, filled with mystery and wonder. But there will be no more mystery. Today, as you enter, you will understand, as clear as day, and never write a blocking web service again.
23:17 s1037989 Isn't that a great story about non-blocking code??  :)
23:17 s1037989 If I had kids, I'd read it to them at night.
23:18 tempire oh snap
23:19 sri now that you mention it... this programming book for kids campaign blew my mind https://www.kickstarter.com/projects/lindaliukas/hello-ruby
23:19 cpan_mojo Mojolicious 4.77 by Sebastian Riedel - http://metacpan.org/release/SRI/Mojolicious-4.77
23:20 tempire whoa
23:20 tempire that's awesome
23:24 davido__ tempire: Anything I can do to help?
23:24 s1037989 tempire: just fyi, I was dead serious.  It's a really fun way to read about non-blocking code!
23:25 good_news_everyone joined #mojo
23:25 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/k1fAug
23:25 good_news_everyone mojo/master 14981d1 Sebastian Riedel: clarify that it is concurrent client connections
23:25 good_news_everyone left #mojo
23:26 sri s1037989: i would totally buy a book written in that style too :)
23:31 jberger " Signatures are
23:31 jberger unlikely to be nested more than two levels deep in real code." Hehe
23:32 tempire I started a book in that style, but then I realized, after thinking about the haskell book, that it's a lot of wasted time.
23:32 btyler LYAHFGG?
23:32 tempire yes
23:32 tempire I really liked the http://cdn.shopify.com/s/files/1/0110/8792/files/preview.pdf?356
23:33 tempire straight to the point
23:35 davido__ I saw that too, jberger.  I think they'll find that in practice abuse of signatures will catch on pretty fast.
23:37 no_respect this haskell book? http://learnyouahaskell.com/chapters
23:39 tempire yes
23:42 s1037989 Irrespective of style, I wish I could have me a fine O'Reilly Mojo book sitting next to the rest of my collection of O'Reilly Perl books!  There was even a Mason book!!!  And I have it.  But I didn't stick with Mason for long.  Pretty quickly moved on to CGI::App and then once and for all Mojo!!  :D
23:45 marcus tempire: We plan a main track about mojo and a side track about related technologies.
23:45 no_respect poet I heard is making mason fun
23:46 no_respect so there is some talk of a mojo book?
23:46 no_respect :)
23:47 sri multiple books have been started, hope at least one of them gets finished ;)
23:48 no_respect :)
23:48 no_respect apply for government grant 10mil
23:48 no_respect get that money doing something useful
23:48 no_respect ;)
23:49 no_respect roughly how many users could be served at same time by box with 24 2.3ghz cpu, 512G ram, 36T raid 10 on 71 1t 140mb/s disks?
23:50 no_respect s/71/72
23:51 dvinciguerra joined #mojo
23:51 sri ram will be the limiting factor i believe
23:52 sri my last c20k test used 632mb https://gist.github.com/kraih/5551292
23:52 sri and that's not optimized, should someone really hit the limits there are tricks to cut it down further
23:54 sri with that kind of box you might even hit kernel flaws/limits, no idea how to tune linux for a million concurrent connections :)
23:54 Akron joined #mojo
23:57 no_respect Id probyl use freebsd and zfs, after numa problem on mongodb burnt me this week
23:58 no_respect 20k conectoins, 632m wow, i guess then question is how many ACTIVe? I know epoll is almost free for non sctive sessions......and i sort fo get how that helps vs cretign new stuff each request..
23:58 no_respect our sad .net is liek 10 conn second on 16g ram vm with 8 cpu
23:59 no_respect although I think .net not used as microsoft would reccomend
23:59 no_respect heh
23:59 sri i don't know too many websocket applications that keep the connection active a lot
23:59 no_respect but its sad
23:59 sri most just idle 99%
23:59 no_respect well how many like active new hits a second not jsut people idle?
23:59 no_respect I think apachebench or something would show that? or no

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