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

IRC log for #mojo, 2014-02-13

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

All times shown according to UTC.

Time Nick Message
00:22 jack joined #mojo
00:23 zackiv31 joined #mojo
00:28 mattastrophe joined #mojo
00:30 jberger joined #mojo
00:33 tianon joined #mojo
00:50 skullbocks joined #mojo
01:01 laouji joined #mojo
01:07 Stefan joined #mojo
01:16 laouji joined #mojo
01:19 laouji joined #mojo
01:27 ka2u joined #mojo
01:29 d4rkie joined #mojo
02:07 good_news_everyone joined #mojo
02:07 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/qzgHvg
02:07 good_news_everyone mojo/master d1f31b8 Sebastian Riedel: changed Mojo::DOM objects to be scalar-based instead of array
02:07 good_news_everyone left #mojo
02:11 sri not even sure it's worth mentioning what type of object Mojo::DOM is
02:12 sri now that we have overloaded operators documented in their own section
02:15 klapperl joined #mojo
02:23 Stefan joined #mojo
02:32 mattastrophe joined #mojo
03:23 Stefan joined #mojo
03:37 mattastrophe joined #mojo
03:41 gnephiak joined #mojo
03:51 btyler joined #mojo
04:13 laouji joined #mojo
04:26 sk_sandeep joined #mojo
04:29 laouji joined #mojo
04:29 good_news_everyone joined #mojo
04:29 good_news_everyone [mojo] kraih tagged v4.80 at 34e7978: http://git.io/hCil7Q
04:29 good_news_everyone left #mojo
04:30 sri enjoy the new Mojo::DOM \o/
04:31 cpan_mojo Mojolicious 4.80 by Sebastian Riedel - http://metacpan.org/release/SRI/Mojolicious-4.80
05:14 ka2u joined #mojo
05:17 czinczar joined #mojo
05:17 czinczar perlbrew kinda pissing me off on freebsd 10
05:17 czinczar guna try reinstalling with cpanp
05:18 czinczar hows the webs folks?
05:53 rem_lex|pivo joined #mojo
05:55 laouji joined #mojo
05:58 Insane I still can't get my API ua code working... damn
06:00 Vandal joined #mojo
06:08 Insane all, who want to do some brainstorm against utf8, mojo::lite and mojo::ua? ;)
06:17 sk joined #mojo
06:44 jberger joined #mojo
07:03 ioguix joined #mojo
07:43 abra_ joined #mojo
07:52 gnephiak Hi, I have a question about Mango,
07:52 gnephiak Should my collection be a state in helper?
08:01 batman gnephiak: not sure if this answer your question, but you need to keep $mango alive. like $app->{mango} = Mango->new(...);
08:01 batman if not, it will be garbage collected and everything is screwed up
08:03 batman i would probably do something like $app->helper(mango => sub { @_ == 2 ? $app->mango->db->collection($_[1]) : $app->mango });
08:03 batman and then also has mango => sub { Mango->new(...) };
08:04 batman gnephiak: but i would also check out Mandel (not really what you asked for though...)
08:04 gnephiak batman: Hmm, just a simple question
08:04 gnephiak helper mango  => sub { state $mango = Mango->new($ENV{PASTEDB}) };
08:04 gnephiak helper pastes => sub { shift->mango->db->collection('pastes') };
08:04 gnephiak from Joel Berger's blog
08:05 gnephiak why isn't pastes is a state too?
08:05 batman good question.
08:05 purl Yeah, it is. I'm stumped.
08:05 batman not sure if i can answer that
08:05 batman but i would not use state at all, but that's just my opinion.
08:06 batman not a fan of the state ;-)
08:06 eseyman joined #mojo
08:06 kwa What's wrong with it?
08:06 kwa (In your opinion :))
08:06 gnephiak batman: ok, I'll try your sample code
08:07 batman remember to set $mango->default_db(...) to make my example work
08:07 batman you could also do $app->mango->db('yourdb')->collection($_[1])
08:08 gnephiak won't this be garbage collect?
08:09 gnephiak or does helper actually save mango reference?
08:12 eugen_ joined #mojo
08:13 batman no. that's why you need the attribute in you application:
08:13 batman has mango => sub { Mango->new(...) };
08:15 gnephiak uh..as a newbie to MVC, what does helper here actually does?
08:15 entro joined #mojo
08:16 gnephiak do*
08:18 kwa batman: How come you don't like state? I've seen sri and jberger use it in their examples, but I've never used it. Seems pretty useful though. :)
08:19 batman kwa: gut feeling really :/
08:19 batman i'm not mature enough to use state. i always use them in the wrong places :(
08:19 kwa As in it might be dropped at some point? Ah.
08:20 batman no, i just don't get when it's right to use it.
08:20 kwa I should add it to me new year resolution. "Find more places to use state."
08:20 batman haha
08:22 sjn joined #mojo
08:22 rawler joined #mojo
08:25 kwa batman: It seems the best way to think of it is: { my $count; sub add_one { ++$count; } }. Except you don't need to encapsulate it in a block. sub add_one { state $count; ++$count }. *scratches head*
08:26 batman yeah, that's the only place i actually use state
08:26 kwa As it doesn't reinitialise, it's also a good place to use it instead of your @_ == 2?
08:27 kwa Oh wait, you're doing something different there.
08:28 geira joined #mojo
08:28 kwa I'm going to put it in a few places, see what happens. :P
08:28 batman haha
08:29 denis_boyun joined #mojo
08:32 maxhq joined #mojo
08:42 odc joined #mojo
08:43 kwakwa joined #mojo
08:44 basiliscos joined #mojo
08:46 kwa joined #mojo
08:48 trone joined #mojo
08:55 Stefan joined #mojo
08:59 Tiger joined #mojo
09:08 stl joined #mojo
09:15 stl joined #mojo
09:16 ver joined #mojo
09:22 mattastrophe joined #mojo
09:31 laouji joined #mojo
09:34 fhelmber_ joined #mojo
09:47 Dandre hello,
09:47 Dandre how can I retreive test result (pass/fail) when using Test::Mojo?
09:47 Dandre I'd like to do something like:
09:47 Dandre $t->json_has('/bla') || diag explain $t->tx->res->json;
09:48 dvinciguerra joined #mojo
09:51 Dandre oups sorry, its success
10:35 Bravo13 joined #mojo
10:38 Negor|2 joined #mojo
11:04 stl joined #mojo
11:34 skullbocks joined #mojo
11:35 d4rkie_ joined #mojo
11:39 denis_boyun joined #mojo
11:45 laouji joined #mojo
11:58 memowe O HAI! \o/
12:05 skullbocks joined #mojo
12:26 GabrielVieira joined #mojo
12:32 eseyman joined #mojo
12:48 mattastrophe joined #mojo
12:53 jberger Dandre see the 'or' method
12:54 jberger gnephiak:  the collection could probably be state, but unlike the main db connection it doesn't need to be
12:55 denis_boyun joined #mojo
12:56 jberger And yes you can keep it in a 'has' attribute, but lite does not have them
12:56 jberger That helper/state trick is essentially 'has' for lite
13:00 Dandre ok thanks
13:03 gnephiak jberger: thanks!
13:05 gnephiak jberger: so if I am going to use full MVC pattern, I shouldn't use helper/state?
13:05 gnephiak The Growing Guide uses helper/state
13:07 jberger Once you are in full remember that helpers are more widely accessible than controller attributes
13:07 jberger Other than that, use what you like better
13:17 GabrielV_ joined #mojo
13:19 Gabriel__ joined #mojo
13:21 jberger_ joined #mojo
13:28 GabrielVieira joined #mojo
13:48 GabrielVieira joined #mojo
13:55 Stefan joined #mojo
14:01 mire_ joined #mojo
14:08 webart joined #mojo
14:18 dvinciguerra joined #mojo
14:20 arthas joined #mojo
14:22 nicomen can I via a route declaration tell the controller which accept-type that was asked for? ie. pretend a given url ends with .html for instance?
14:23 GabrielV_ joined #mojo
14:28 nicomen ah format, RTFM FTW
14:30 sh4 joined #mojo
14:32 GabrielVieira joined #mojo
14:40 GabrielV_ joined #mojo
14:45 ka2u joined #mojo
14:49 bluescreen joined #mojo
14:52 GabrielVieira joined #mojo
14:53 btyler joined #mojo
15:07 mire_ joined #mojo
15:08 nicomen my $api = $routes->bridge('/api', format => [qw(json rss)]); <-- this still lets through stuff that wants HTML, what am I doing wrong?
15:14 asarch joined #mojo
15:14 batman i think you need to give { format => [] } or [ format => [] ] can't remember :(
15:15 batman no, sorry. ignore me.
15:16 GabrielV_ joined #mojo
15:16 batman nicomen: have you tried $api = $routes->bridge('/api')->to(format => [...]); ?
15:17 genio joined #mojo
15:23 nicomen batman: hm, no, I'll try, but I thought the to() might interfere with later to's ;)
15:23 radixo joined #mojo
15:23 radixo helo guys..
15:23 radixo somobody here uses siege?
15:24 nicomen I do lol
15:24 nicomen (not that strange, since I introduced you to it)
15:24 batman nicomen: it won't. code lower down your file will be run in future......... :P
15:24 radixo nicomen: lol
15:25 trone joined #mojo
15:25 nicomen batman: I think the to needs a parameter in front of the to, ?
15:25 radixo nicomen: I am facing problems with it.. I can't change the Content-type even using -T
15:25 radixo nicomen: it always send Content-type: application/x-troff
15:25 nicomen Content-Type? for a POST or what?
15:25 batman nicomen: parameter?
15:25 purl it has been said that parameter is not a filename but rather a file handle name, a
15:25 radixo nicomen: for POST
15:26 nicomen batman: to($path, format => ...)
15:26 nicomen radixo: ah, never used it with POST I'm afraid
15:26 batman nicomen: no.
15:27 nicomen batman: ok, when trying it I still get output when asking for foo.html
15:28 nicomen and it's not hitting another route according to the debug output
15:28 nicomen radixo: did you try the -H parameter?
15:30 radixo nicomen: yes.. it duplicates the Content-type :(
15:43 good_news_everyone joined #mojo
15:43 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/PdNh1w
15:43 good_news_everyone mojo/master 2db1e77 Sebastian Riedel: fixed typo in documentation (closes #589)
15:43 good_news_everyone left #mojo
15:52 meshl joined #mojo
15:55 zackiv31 joined #mojo
15:59 rawler joined #mojo
16:04 rawler joined #mojo
16:11 GabrielVieira joined #mojo
16:28 hummeleBop joined #mojo
16:31 btyler joined #mojo
16:39 gryphon joined #mojo
16:48 mattastrophe joined #mojo
16:51 ka2u joined #mojo
17:01 drift joined #mojo
17:01 denis_boyun joined #mojo
17:02 sri it's official http://blog.kraih.com/post/76535091594/mojoconf-2014
17:03 s1037989__ Planning my trip now!!
17:03 radixo joined #mojo
17:04 sri \o/
17:09 eseyman joined #mojo
17:18 denis_boyun__ joined #mojo
17:18 bpmedley Awesome, just awesome.. :)
17:18 GabrielV_ joined #mojo
17:27 inokenty joined #mojo
17:28 denis_boyun joined #mojo
17:31 denis_boyun_ joined #mojo
17:35 rem_lex joined #mojo
17:42 sjn sri: maybe update the Mojolicious package with some mojoconf info? :)
17:44 sri package Mojolicious; sub import { warn "Come to Mojoconf 2014 in Oslo! (http://mojoconf.org)\n" }
17:44 sri yea, lets not do that ;p
17:44 Akron joined #mojo
17:45 genio heh
17:45 Akron Yeah! I will prepare pins with my favorite unicode symbols for v5.0 - driving print shops crazy!
17:46 sri we could all wear top hats
17:46 Akron :)
17:47 tempire I have a red top hat
17:48 tempire We need to decide the 5.0 codename
17:49 moritz will it be released during mojoconf?
17:49 radixo joined #mojo
17:52 sri maybe
17:52 sjn Will it run on perl6? :)
17:53 sjn (muahaha)
17:53 sri maybe not
17:53 sjn aw, with all that new fancy concurrency stuff going on? :-\
17:53 beyondcreed joined #mojo
17:53 sjn oh well. :)
17:54 sri enough fancy new stuff we can do with perl 5.20
17:54 sri should subroutine signatures become introspectable... we could automatically generate arguments on demand!
17:55 sri get '/:foo/bar/:baz' => sub ($self, $foo, $baz, %params) {...};
17:55 sri get '/:foo/bar/:baz' => sub ($self, $foo) {...};
17:55 * sjn needs only to call some of his family in order to have arguments generated automatically
17:56 sri grab the names from the signature and generate the right arguments
17:56 * sjn wouldn't mind that instead :)
17:59 sri fun thing is, we have the hooks to even do this in a plugin
18:12 sri btw. now that Mojo::DOM is scalar based, we could overload @{} with $dom->contents :)
18:13 sri turn Mojo::DOM->new('<!-- test --><b>123</b>')->contents->first into Mojo::DOM->new('<!-- test --><b>123</b>')->[0]
18:13 sri (spoiler: the result is "<!-- test -->")
18:20 Akron overloading ftw! I think, yesterday you broke XML::Loy with your changes ... ;)
18:20 mire_ joined #mojo
18:30 davido_ FYI: Salt Lake Perl Mongers Feb meeting was "RESTful Web App with AngularJS and Mojolicious": http://saltlake.pm.org/past.html links to the slides and video.
18:34 jzawodn davido_: thanks for passing that along!
18:34 davido_ I think it definitely casts Mojolicious::Lite in a positive light that the speaker, who admittedly hasn't used Perl in years....
18:34 davido_ and who hadn't used Mojolicious::Lite before, was able to get up to speed quickly enough on it to adapt his "python-oriented" presentation to Perl easily.
18:35 davido_ (He intends to give a presentation in the Python track at Open West, but switched the back-end to Perl/M::L to take the opportunity to test his presentation in front of our Perl Mongers group first)
18:36 jzawodn interesting
18:36 jzawodn I also submitted to Open West.  I've been hearing good things about that conference and want to go.
18:46 tempire Watching Daniel's presentation.
18:46 tempire Only one question.
18:46 tempire What's Moholicious?
18:46 tempire ;)
18:47 meshl joined #mojo
18:47 sri Akron: haha, figured if there was a chance something would break it had to be your code!
18:48 sri no broken tests though, so it's your fault for not sending a pull request ;p
18:48 sri (with tests)
18:49 davido_ Yeah, I didn't want to correct him on video. :)
18:49 sri davido_: neat
18:50 davido_ He's certainly not utilizing the full potential of M::L, but that's ok. :)
18:50 tempire It's clear that he's more focused on angular.
18:51 tempire But as a PM organizer, a speaker is a speaker.
18:51 davido_ Yes.  I think that's ok too... we Perl people need to expose ourselves to synergistic technologies.
18:51 tempire So you would accept a haskell talk, were I to have one?
18:52 tempire I guess that's not synergistic.
18:52 * tempire takes his monad and goes home
18:52 davido_ I would... particularly if it exposed me to something that improved me as a programmer, and expecially if some of the concepts make me a better Perl programmer.
18:53 * jzawodn always reads "monad" as "gonad" for some reason
18:55 davido_ His talk goes through eight code iterations, and toward the end begins using more Mojolicious.
18:55 tempire Huh.
18:56 tempire No one has released a mojolicious gzip plugin.
18:56 Stefan joined #mojo
18:56 sri programming language X from the perspective of a perl programmer is something i would totally watch
18:57 davido_ Yeah, I've always felt that exploring other technologies can only improve how I use and apply Perl.
18:57 sri or even web development in language X from the perspective of a perl programmer
18:58 davido_ That would be interesting.
19:05 Akron joined #mojo
19:05 batman http://d24w6bsrhbeh9d.cloudfront.net/photo/arpZEq6_700b_v1.jpg :)
19:06 radixo nicomen: I forced in the code and compiled siege again
19:10 bpmedley http://blag.nullteilerfrei.de/2013/05/17/building-perl-stand-alone-applications-with-a-gui-using-mojolicious-and-par-packer/ <-- Have ya'll seen this one?
19:16 davido_ http://perlmonks.org/?node_id=1074871 deserves a Mojolicious answer.
19:18 ka2u joined #mojo
19:29 Akron sri: Didn't test the new Mojo::DOM version with XML::Loy yet - so we'll see. It's not bad to return to the code once in a while so I'm not so bad it may be broken now.
19:30 Akron (second bad -> mad)
19:31 sri yea, it might not break, but new features won't work might cause stuff to crash
19:31 sri i already see things that are wrong
19:31 sri "push(@$tree, [ comment => $comment ]) if $comment;"
19:32 sri comment/text/pi... nodes now have a reference to the parent as third element
19:33 sri s/work cause/work and cause/
19:34 Akron You said that directly messing with the tree is dangerous, so I can't blame you on that one. ;) Using the new methods will improve the code a lot I guess.
19:34 sri Akron: i actually think XML::Loy could now be done without dom tree hacking at all
19:34 Akron Yes, I agree.
19:34 Akron Nice weekend project.
19:35 * sri would be surprised if there's anything left that actually requires dom tree hacking
19:36 Akron Time for deprecating ->tree?
19:36 Akron That's also very good for a potential Mojo::DOM::XS.
19:37 sri nope, we have more classes with exposed ASTs
19:37 sri template, route pattern...
19:38 sri CSS and HTML also expose it
19:38 sri CSS even consumes a dom tree
19:39 tempire huh
19:39 tempire http://rperl.org/
19:39 sri if we decide to remove them it should be all of them, in a major release
19:39 sri tempire: you're a month behind!
19:39 Akron Oh - right, CSS needs it. Would slow down everything to not use the tree directly perhaps.
19:39 GabrielVieira joined #mojo
19:40 sri rperl was a topic when the crowdfunding thing started
19:40 tempire So what you're saying is that someone has already come up with a new, new, new new perl compiler.
19:41 sri rperl is actually kinda interesting when you ignore the crazy stuff on the website
19:41 sri it's an extension for perlcc
19:42 sri so, all perl code works with it, but it can make certain things a few times faster
19:44 sri Akron: the warning should be good enough for now i think http://mojolicio.us/perldoc/Mojo/DOM#tree
19:45 GabrielV_ joined #mojo
19:46 Akron Well - as Mojo::DOM is used in the wild, I wouldn't expose it at all in case it's not necessary.
19:46 Akron in the wild -> enduser API
19:46 sri well, not exposing it makes the CSS api a bit awkward
19:47 Akron I see.
19:48 sri might also be useful for deep cloning
19:49 dvinciguerra joined #mojo
19:50 Akron Instead of serialization and redeserialiation? Maybe.
19:51 davido_ rperl, as I understand it, leverages Inline::CPP so that code that can be compiled is compiled on first run, and cached for future runs.  The principle seems more sound than the project, though.
19:51 inokenty joined #mojo
19:52 sri Akron: and of course, maybe you feel like implementing an alternative search interface some day... xpath maybe? ;p
19:52 sri who knows what kind of awesome simplified css people will come up in the next few years
19:53 Akron Naaa ...
19:53 sri yea... those use cases are way out there...
19:54 sri still... i like it consistent
19:54 sri i've actually thought about AST preprocessors for Mojo::Template
19:54 GabrielVieira joined #mojo
19:55 sri something that looks like http://slim-lang.com and compiles to Mojo::Template AST, to reuse everything else it has
19:55 Akron I started an XML::Loy plugin for Mojo::Template generation!
19:56 Akron But, you now - I didn't make my life easier. ;)
19:57 mire_ joined #mojo
19:57 Akron Maybe one day I need a good integration of XML::Loy with an XML database - BaseX is pretty nice. That would be an idea of reusing the api and having a consistent API neglecting the data store.
19:58 Akron As CSS selectors -> XPath is pretty easy, the adaptation wouldn't be too hard.
19:58 GabrielV_ joined #mojo
19:58 Akron As long as I never ever have to write XQuery again.
19:59 sri :)
19:59 sri the Mojo::Template core is actually not much unlike judofyrs temple (the foundation of slim) https://github.com/judofyr/temple
20:05 GabrielVieira joined #mojo
20:14 GabrielV_ joined #mojo
20:16 cfedde Lets think of the most complex way we can do a thing. then give it to an international commitee.  It's even better if we don't requrie a working implementation before standardizing.
20:22 meshl joined #mojo
20:22 mattastrophe joined #mojo
20:23 GabrielVieira joined #mojo
20:25 skullbocks joined #mojo
20:29 rem_lex joined #mojo
20:32 GabrielV_ joined #mojo
20:33 ka2u joined #mojo
20:35 GabrielVieira joined #mojo
20:39 lukep joined #mojo
20:42 s1037989__ Since mojoconf is official now :) any idea of what the cost to attend will be?
20:46 Stefan joined #mojo
20:50 sri https://github.com/kraih/mojo/issues/590 # someone else please deal with this guy, i can't do it anymore
20:50 GabrielV_ joined #mojo
20:51 sri same guy who wrote that review
20:54 skullbocks joined #mojo
20:55 punter joined #mojo
20:55 GabrielVieira joined #mojo
20:58 Stefan joined #mojo
21:00 bpmedley https://gist.github.com/brianmed/8983255 <-- How is this for running a command without blocking?
21:02 sri actually, forget about rsimoes, i'm banning him permanently from the project since a talk we had yesterday confirmed that his intentions were malicious
21:03 skullbocks joined #mojo
21:09 sri bpmedley: does it work in hypnotoad?
21:09 bpmedley I tested with "daemon".  Should I test with hypnotoad?
21:10 sri prefork then
21:11 bpmedley prefork appears to work just like daemon
21:12 sri interesting
21:12 bpmedley Should it not?  ;)
21:13 skullbocks joined #mojo
21:13 sri that stuff rarely just works ;p
21:13 bpmedley I spent a bit of time debugging it.  Is there anyway i can improve it before posting an answer to perlmonks?
21:14 sri dunno if you're aware of this https://github.com/jhthorsen/mojo-ioloop-readwritefork
21:15 bpmedley Nice.  The perlmonk question wanted to use Proc::Background.
21:16 batman joined #mojo
21:16 elvis joined #mojo
21:16 bpmedley I'm not sure how well readwritefork will work in Windows.
21:16 sri your code works on windows?
21:17 bpmedley Proc::Background should.  Let me adjust for windows, if I can.
21:18 sri using a tempfile is kinda ugly, dunno if you have a choice on windows
21:20 Stefan joined #mojo
21:24 skullbocks joined #mojo
21:49 skullbocks joined #mojo
21:58 dvinciguerra joined #mojo
22:18 mattastrophe joined #mojo
22:35 bpmedley https://gist.github.com/brianmed/8983255 <-- This seems to work in Windows and OS X
22:44 mattastrophe joined #mojo
23:18 skullbocks joined #mojo
23:31 mattastrophe joined #mojo
23:34 * sri is still unsure if Mojo::DOM should overload @{}
23:36 TitanOfOld sri: Is there any chance it could break existing workflows?
23:36 sri no
23:37 TitanOfOld Or scripts/programs, rather.
23:37 sri no
23:37 sri it's 100% safe, just a question of style
23:41 TitanOfOld With all the methods available in Mojo::DOM, saying $mojo_dom->[0] wouldn't be very descriptive as opposed to $mojo_dom->contents->[0]. I'd find it hard to understand without the clue bat. But I'm just a novice Perl programmer.
23:42 sri http://pastie.org/8731448 # the full patch
23:43 sri just like autoload, it's not meant to be used all the time, just for quick oneliners and the like
23:43 sri perl -Mojo -E 'say x("foo<b>bar</b>")->[0]'
23:43 sri stuff like that
23:44 sri as opposed to
23:45 sri perl -Mojo -E 'say x("foo<b>bar</b>")->contents->first'
23:45 TitanOfOld Hmm, could be handy.
23:45 sri in perl 5.20 there's also postderef :)
23:46 sri perl -Mojo -E 'say for x("foo<b>bar</b>")->@*'
23:46 TitanOfOld sri: The potentials are endless!
23:46 sri perl -Mojo -E 'say for x("foo<b>bar</b>baz")->@[0, 2]'
23:56 Stefan joined #mojo
23:58 sri perl -Mojo -E 'say x("foo<b><i>bar<i></b>baz")->[1][0]
23:58 sri of course that's where things get complicated
23:59 tempire lovei t
23:59 tempire love it, even
23:59 sri perl -Mojo -E 'say x("foo<b><i>bar<i></b>baz")->contents->[1]->contents->first

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