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

IRC log for #mojo, 2014-07-14

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

All times shown according to UTC.

Time Nick Message
00:09 D4RK-PH0ENiX joined #mojo
00:18 Averna joined #mojo
00:53 laouji joined #mojo
01:00 void Let's say I use Mojolicious for my page. I have to perform in the background on PAGE A some mechanize stuff. I have a object called mech->.
01:00 void How can I take it to page B without losing it?
01:00 void Objects of mechanize can't be saved to DB or file.
01:01 void There is just one solution, save the cookies/session to file, right?
01:03 void Or is there a way not to lose mech-> and take it to page B?
01:05 preaction void: you might want to not use mechanize and use Mojo::UserAgent (for the nonblocking part). you could save that object into a hash or something to make sure you get the same one for that user (keeping track of the user via some kind of session ID)
01:07 void So bascially I could save it into a session and make use of it on the next page?
01:10 preaction no, you can't save it using session(), because session() is serialized into a cookie. you can save it into a hash or something and put the hash's key in the session()
01:10 preaction (maybe Mojo::UA serializes in session(), but i don't know, probably not)
01:11 void I see saving it into a session is probably anyway a bad idea
01:19 sri hmmmm... looks like it's not the recursion that's so slow... but parsing deeply nested tags
01:26 gatitskiy joined #mojo
01:29 jberger syntax error
01:29 purl YOU CAN'T JUST MAKE SHIT UP AND EXPECT THE COMPUTER TO MAGICALLY KNOW WHAT YOU MEAN, RETARDO.
01:29 jberger hehehe
01:36 sri nooooo...and i know why the div example was so slow
01:36 sri it's much better with a <foo> tag instead of <div>
01:36 sri because <div> has the magical property of closing <p> blocks
01:37 sri so the parser needs to look all the way up the stack for every new <div> to make sure there's no <p> somewhere
01:37 sri *facepalm*
01:39 klapperl_ joined #mojo
02:08 Ptolemarch joined #mojo
02:24 good_news_everyon joined #mojo
02:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/bPpxdQ
02:24 good_news_everyon mojo/master d24ddfc Sebastian Riedel: improved all_text performance in Mojo::DOM
02:24 good_news_everyon left #mojo
02:27 jberger your comment and your code don't match
02:27 jberger p or pre?
02:28 laouji joined #mojo
02:28 sri where?
02:28 jberger you are special casing the pre tag in the code
02:29 jberger but your irc chat said p
02:29 sri different topic
02:29 jberger oh ok
02:29 laouji joined #mojo
02:29 sri i was profiling the parser before, now text extraction with ->all_text
02:30 sri we don't trim text in <pre> tags
02:31 sri and before we would walk up the tree to check for <pre> tags for every new nested tag
02:31 sri when we only have to do that once in the beginning and watch for new <pre> tags on the way down
02:32 jberger ah, cool
02:32 sri the parser thing from before is just how html5 is supposed to work, don't think it can be optimized much
02:33 jberger right
02:33 jberger can't win em all
02:33 jberger (and you already got a soccer victory today, congrats)
02:43 dabudabu You could pre-process the HTML and add </p>s where they would otherwise be implicit
02:44 dabudabu Though maybe that's what you're effectively doing
02:44 jberger dabudabu: that sounds good at first, but you really have to parse the html to know
02:45 jberger you can't just do a quick regex pass
02:53 jberger remember: http://stackoverflow.com/a/1732454/468327
02:53 sri hmmmm
02:53 sri actually there is an optimization
02:54 sri i can keep a list of tags we've actually seen http://pastie.org/9387289
02:55 sri and only walk up the tree if we've seen that tag before
02:55 sri i can
02:55 sri oops
02:55 sri i can't easily remove tags again... since they may appear multiple times... but if there are no <p> tags it will be fast again
02:56 sri time perl -Mojo -E 'my $dom = x(("<div>" x 10000) . "test" . "</div>" x 10000); say $dom; say $dom->all_text;'
02:57 sri for that one-liner time goes from 21s to 1s :)
02:58 sri of course it's an extreme case
03:01 sri lets try some real world examples
03:02 jberger p tags are pretty common
03:02 jberger that kind of optimization is good if it were for rare tags
03:03 jberger "Chuck Norris can parse HTML with regex"
03:04 jberger "That's just silly, Chuck Norris doesn't parse HTML. When he shows up, it parses itself."
03:05 sri no more chuck norris jokes please... guy is a right wing nut
03:09 sri oh my... just tried to parse the html5 spec... and things don't look so well :o
03:09 sri i never heard the fan in my macbook before :O
03:11 sri it's a 7.7mb file these days
03:14 sri how odd
03:14 sri now i run it again and it's all fast
03:14 gatitskiy joined #mojo
03:15 sri aaaah
03:16 sri i passed a Mojo::ByteStream object in... which sent the regex into an endless loop... fun
03:17 sri parsing a 7.7mb html5 spec file takes about 7s otherwise :)
03:17 jberger hehe
03:18 jberger doesn't a bytestream stringify?
03:18 sri optimization doesn't make a difference btw.
03:22 sri odd, i can't replicate it in a test
03:24 sri looks like there's also a size requirement for it to fail
03:26 JohnDRockefeller joined #mojo
03:27 sri very very odd, it's not size alone either
03:27 dima joined #mojo
03:31 KCL_ joined #mojo
03:40 void joined #mojo
03:42 void Is there a plugin for the Mojolicious::UserAgent to set fields on a page, follow links pretty much what mechanize does.
03:43 camelo you mean to fill form fields and submit?
03:43 void Yeah submit is possible, but something like $mech->field('Street', '1234'); which is available on mechanize
03:43 void or follow_link
03:43 camelo Mojo::UserAgent can do all that
03:44 void Could you give me an example how you would set a field? like $mech->field?
03:44 void Or where I can find help documents
03:44 void i want to remove mechanize and use only mojo, because the code is more clean then
03:44 sri Mojo::UserAgent has all the primitives to build a mechanize API around it, but does not include one
03:45 camelo void when you do an HTTP post with some paremeters, you're just sending the form fields
03:46 camelo https://metacpan.org/pod/Mojo::UserAgent#post
03:47 camelo http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Web_scraping
03:47 camelo I think this has all you might need...
03:48 void Yeah, thank you, it will just need some trying
03:50 void Are there more examples available which I can study / or plugins?
03:54 basic6_ joined #mojo
04:05 dvinciguerra joined #mojo
04:05 sujithm joined #mojo
04:06 camelo void: in this case I'm just submiting a search request to duck duck go for 'Mojolicious':
04:06 camelo perl -Mojo -E "say g('http://duckduckgo.com/html' => {'DNT' => 1} =>  form => { 'q' => 'mojolicious'})->dom->all_text"
04:06 camelo it's very simple
04:09 camelo that was a get
04:09 camelo perl -Mojo -E "say p('http://duckduckgo.com/html' => {'DNT' => 1} =>  form => { 'q' => 'mojolicious'})->dom->all_text"
04:09 camelo this was a post
04:09 camelo they both work
04:09 camelo but that was not the correct way to do a get...
04:10 camelo well it was
04:10 camelo actually it was
04:10 camelo I neet to sleep
04:10 camelo or drink coffe
04:10 void Thank you camelo, I will study it
04:11 void But one question, tho. How would you select a dropdown menu?
04:11 void I can't really find much
04:11 camelo dropdown menus are still just input
04:12 preaction the value is either the value="" attribute of the <option>, or if that is missing, the actual text in the <option> tag
04:12 camelo ^that
04:18 void I think with some time, I will get it easy done there is no need to mix mechanize and mojo useragent then
04:22 camelo Mojo::UserAgente is really very simple
04:22 camelo I know that mechanize is cool
04:23 camelo but I rather Mojo::UserAgent beacause of all the nice things of the Mojo toolkit
04:24 camelo also most sites and applications I want to use have some sort of API
04:25 void Yes, unfortuantely some do not have apis ;(
04:25 camelo so Mojo::UserAgent and Mojo is pretty much all I need in this field
04:25 camelo sometime it happens
04:25 camelo :(
04:26 camelo but remember this all html, js and http
04:26 camelo and unless you have to execute some js, Mojo::UserAgent will can do the job
04:28 void yep
04:29 void camelo: if i just want to click a link (no post), you'd read out the link between <a></a> and call get()?
04:30 camelo you mean that you only want to follow a link?
04:30 camelo yes
04:30 camelo get is the way to do it
04:31 camelo you get the url
04:31 camelo from the anchor attributes
04:31 camelo and follow it
04:31 camelo be aware that it might not be a complete url
04:31 void yes, that would be exactly the same like in mechanize follow_link()
04:32 void yes, that too
04:33 camelo so you might need to concatenate the domain name, and maybe some part of the path
04:33 void perl -Mojo -E "say p('http://duckduckgo.com/html' => {'DNT' => 1} =>  form => { 'q' => 'mojolicious'})->dom->all_text"
04:34 void in your example the field has the name 'q'
04:34 camelo yes
04:34 void What would you do if the field has no name, and there 3 of them on the page?
04:34 camelo the name of the input form field is 'q'
04:34 void In mechanize you can set the form by number 1, 2, 3 then you do not need to specify a name.
04:35 camelo first thing I would curse the guy who did that site
04:35 camelo input form fields should allways have name
04:36 preaction if they have an id, the browser should use that
04:36 camelo I've never tried that
04:36 camelo so I don't know how to reply you
04:36 camelo however
04:36 camelo I would blindly trye something like this
04:37 camelo form => [ undef, value, undef'] if I wanted to fill the second form field
04:37 camelo but probably it won't work
04:39 void is 'q' limited to name="" only or might it be a class="q" as well?
04:40 preaction it must be name=""
04:40 preaction name is a required attribute. i don't know how the form works without it
04:40 void my site I work with
04:40 void has
04:40 camelo me neither I'm just trying it
04:40 camelo setting up a lite app to try
04:40 camelo lol
04:41 void <input name="method" value="weiter" class="button confirm" type="submit">
04:41 void I got 3 fields with name="method"
04:41 void on the same page
04:41 void However value and class is unqiue.
04:42 void and 3x submit as well
04:42 sri that contradicts your earlier statements
04:43 preaction so they have a name, it's just not unique. that's fine. you can specify multiple values using an arrayref
04:44 preaction i'm skimming the html5 spec, and it doesn't say anything about my earlier "it should use id" comment, so it seems to be name and only name
04:44 sri perl -Mojo -E 'a({inline => q{<%= form_for "/" => begin %><input type="text"><%= submit_button %><% end %>}})->start' daemon
04:44 sri without name does absolutely nothing
04:45 preaction name is just optional because you might have a control you don't want to show up in the post data
04:50 denis_boyun joined #mojo
05:01 denis_boyun joined #mojo
05:01 sujithm joined #mojo
05:03 gatitskiy joined #mojo
05:16 dima joined #mojo
05:17 dima A question for yall: I've a very simple Mojolicious application that reads in data POSTed to it as application/x-www-form-urlencoded. I want to get the POST body into a perl string so that the rest of my non-mojo perl code can do stuff with it, but I can't figure out how to do that. I'm attempting to get this with my $data=$controller->req->body_params->to_string, which sorta works, but this doesn't return a plain string. It returns an
05:17 dima odd beast for which ref($data)=''. Basic things like len($data) fail. Advice?
05:24 crab umm. does length($data) work?
05:24 crab because, y'know, len() isn't a thing.
05:25 dima crab: errr.. you're right. what am I talking about? Hold on (and thank you)
05:32 dima crab: OK. It was clearly way too late at night when I was doing this yesterday. It IS a plain string just as I want
05:33 dima crab: Thank you!
05:33 dima Another related question, if I may. I can POST arbitrary binary payloads (and I see binary with tcpdump). The to_string method doesn't give me a binary string, but a url-encoded one. Is there a simple way to get the binary data?
05:39 laouji joined #mojo
05:40 laouji joined #mojo
05:46 laouji joined #mojo
05:55 dima To answer my own question, I can get the raw binary data with $controller->req->body_params->{string}, but then I'm snooping into the implementation details. Is there a better way?
06:04 denis_boyun joined #mojo
06:30 crab what you want is a bit weird.
06:31 crab why do you want unencoded data? even if you're interfacing with existing code, surely that code isn't expecting unencoded data from its POST requests?
06:33 dima crab: I'm not really a web dev, so perhaps this is weird. I have two non-web applications running on different computers that are using an HTTP API to send data to each other. The POST is intended to be a plain medium for getting data across, so any modification of the input is undesirable
06:40 crab then either application/x-www-form-urlencoded is inappropriate or you should be retrieving and decoding the data before passing it on
06:40 sri *facepalm*
06:40 sri of course there's a smarter optimization for Mojo::DOM::HTML
06:41 sri http://pastie.org/9387627 # just count the start tags
06:41 sujithm joined #mojo
06:41 dima crab: OK. I'll read up on this. Thanks!
06:42 Eke- joined #mojo
06:48 sri hmmmm
06:48 sri what are some examples for really complicated big html documents on the web?
06:51 gatitskiy joined #mojo
06:51 sri this is basically my current benchmark ;p
06:51 sri perl -Ilib -Mojo -MTime::HiRes=time -E 'my $res = g($ARGV[0]); say my $start = time; $res->dom ;say time - $start' http://www.whatwg.org/specs/web-apps/current-work/
06:52 sri full html5 spec parsed in 7.1s, make it faster!
06:54 sri sadly so far it looks like the optimization is not worth it for anything else than artifical 10k nested div benchmarks
06:55 sri sooo, i'd be very much interested in websites out there using tons of divs ;)
06:56 sugar joined #mojo
07:19 mishantil joined #mojo
07:33 sujithm_ joined #mojo
07:46 rawler joined #mojo
07:58 sujithm joined #mojo
08:07 edestler joined #mojo
08:13 Vandal joined #mojo
08:15 basiliscos joined #mojo
08:24 marcus heh
08:24 marcus sri: www.vg.no :)
08:26 marcus seems to be parsing that one pretty damn fast tho
08:29 sujithm_ joined #mojo
08:35 marcus Not sure how to feel about the new github app icon.
08:38 irq joined #mojo
08:39 gatitskiy joined #mojo
08:45 crab where is it?
08:45 purl it's it!
08:48 sujithm joined #mojo
08:48 marcus crab: https://www.evernote.com/shard/s22/sh/59653671-005f-426f-b894-6a434b89879a/233220b077dda63063733fc3db045f40/deep/0/Nordaaker----mojo-on-magnet.png
08:48 marcus crab: How are you anyhow? Hot in India now?
08:50 crab marcus: i'm ok. it's not hot here, but it's miserably horribly hot in the plains
08:50 crab here it's pleasant and has just started raining lightly... and it will no doubt rain more heavily in the coming weeks
08:51 marcus Sounds good. I've just returned from a week of rain in Germany. Kind of hoping for some sun now.
08:52 marcus Also, wife and offspring is driving up to Lillehammer today, so I'm all alone! :)
09:04 sujithm_ joined #mojo
09:09 dotan joined #mojo
09:09 batman marcus: too bad! i'm going to sørlandet today :(
09:10 marcus batman: yeah, that’s too bad indeed.
09:11 batman i would report in sick, but i already made some plans...
09:11 batman would be a bit strange to "report in sick" from vacation though, hehe
09:13 batman https://gist.github.com/jhthorsen/d7c024c408e8452a3640 # any reason why unix sockets shouldn't play well with Mojo::Reactor?
09:13 batman i'm seeing "Incoming connection..." but no "read" event
09:17 fhelmber_ joined #mojo
09:17 fhelmber_ joined #mojo
09:40 Ptolemarch joined #mojo
09:55 dpetrov_ joined #mojo
10:05 fhelmber_ joined #mojo
10:10 sugar_ joined #mojo
10:14 edestler_ joined #mojo
10:22 sugar joined #mojo
10:27 gatitskiy joined #mojo
10:30 neyasov joined #mojo
10:31 Insane does anybody know why http://search.cpan.org/ is down for last couple days?
10:31 batman Insane: use metacpan.org
10:58 dvinciguerra joined #mojo
11:00 Insane can i have something like cache storage with mojo? i have a web service written with mojolicious, and this service does not have any db or storage - it works oly with external APIs and renders data to browser, now i'm thinking about store some data that would be accessed from every request
11:00 Insane i want to put a hash somewhere and read this hash for every client request
11:04 d4rkie joined #mojo
11:05 sujithm joined #mojo
11:30 meshl joined #mojo
11:34 moritz Insane: use memcached or redis or some such
11:34 moritz Insane: or even a file cache
11:34 moritz Insane: perldoc CHI # :-)
11:36 Insane for the last ~30 mins i was thinking about use Mojo::Cache to store hash and somehow Mojo::IOLoop to update cache every N hours
12:16 gatitskiy joined #mojo
12:25 Averna joined #mojo
12:28 gatitskiy joined #mojo
12:30 D4RK-PH0ENiX joined #mojo
12:36 neilhwatson joined #mojo
12:40 mr-foobar joined #mojo
12:57 D4RK-PH0ENiX joined #mojo
13:05 sujithm joined #mojo
13:12 Kripton joined #mojo
14:00 dvinciguerra joined #mojo
14:17 Kripton joined #mojo
14:17 ryozi joined #mojo
14:47 sh4 joined #mojo
15:18 meshl joined #mojo
15:30 KCL joined #mojo
15:32 sujithm joined #mojo
15:46 disputin joined #mojo
16:05 gatitskiy joined #mojo
16:11 mattastrophe joined #mojo
16:13 _eugen joined #mojo
16:25 irq joined #mojo
16:44 Cracker joined #mojo
16:46 xtetsuji joined #mojo
16:48 neyasov joined #mojo
16:48 disputin joined #mojo
16:52 denis_boyun joined #mojo
16:54 sri marcus: doesn't look like that page benefits from the Mojo::DOM::HTML optimization :S
17:13 Mikey so im writing my multiprocess worker.. and it seems i get this intermittently when cleaning up my jobs..
17:13 Mikey Can't use an undefined value as a HASH reference at /usr/local/academica/sys/perl/perl_5.18.2/lib/site_perl/5.18.2/Mango/Database.pm line 63.
17:13 Mikey it looks like it can't find its document?  the query came back empty or something..
17:14 Mikey that it happens intermittently makes me think there's some race aspect to it.  i've hacked on this for 3 days without asking, because i've been trying to learn.  just wondering if i could get any insights into what i'm doing wrong.
17:28 r0b3rt joined #mojo
17:36 * tempire will keep marcus company
17:46 Martin90 joined #mojo
17:51 Martin90 where is this notation "@@ with_layout.html.ep" eplained ?
17:51 Martin90 explained*
17:53 kyshtynbai joined #mojo
17:53 gatitskiy joined #mojo
17:56 irq_ joined #mojo
17:57 _eugen joined #mojo
17:57 lb what do you need explained?
17:57 sri hmmmm... can anyone actually explain the /o regex modifier to me?
17:58 sri i mean how it actually works... not what the documentation says
17:58 lb sri: it fucks up your code so you have fun debug adventures after a couple of years
17:58 sri that's hat the documentation says ;p
17:58 Martin90 "@@ with_layout.html.ep -> what it means ? Where it is expalined ?
17:59 lb it means "here starts file"
17:59 sri thing is... after adding two /o modifiers i can parse the html5 spec in 5.5s instead of 7.2s
17:59 Martin90 I don't get it
17:59 lb Martin90: it's used extensively in Mojolicious::Guides::Rendering, maybe it makes more sense in context
17:59 Martin90 first of all where os "with_layout.html.ep" file located ?
18:00 lb Martin90: on the next line, until the next @@
18:00 Martin90 nowhere ?
18:00 purl hmmm... nowhere is the method for calculating significant wave height using an FFT on pressure data. or Dodge City, KS
18:00 lb Martin90: so @@ is a way to have a file that's not a file
18:00 Martin90 heh, ok
18:01 Martin90 but it wasn't desribed in doc ;/
18:01 lb i think it was sort of assumed people got it because it's pretty much the same thing as __DATA__ itself
18:02 lb but i see your point
18:02 Martin90 ;)
18:03 Martin90 <%= title %> => this include title variable into html right ?
18:03 lb ok, now you really have to go read Mojolicious::Guides::Rendering,
18:04 sri Martin90: you're the first person to ever ask about it
18:04 lb but no, the title variable is called $title
18:04 lb title without the $ is the title helper
18:05 Eke- joined #mojo
18:05 Martin90 I have no expirence with frmaeworks sorry
18:06 Ptolemarch joined #mojo
18:15 good_news_everyon joined #mojo
18:15 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/t2rt_w
18:15 good_news_everyon mojo/master 6ccc467 Sebastian Riedel: improved Mojo::DOM::CSS, Mojo::DOM::HTML and Mojo::JSON performance with regular expression optimizations
18:15 good_news_everyon left #mojo
18:16 sri looks like we'll try it... the gain is just too good
18:17 sri html5 spec from 7.2s to 5.5s and 100 github api json files from 4.8s to 3.7s
18:17 sri i always assumed perl could optimize this itself... because the scalar never changes... but it looks like it can't
18:18 Martin90 have you compared majo templates system with old ones like HTML::Template ?
18:18 Martin90 in terms of exec speed
18:19 sri Mojo::Template is much much faster than most template engines
18:19 sri you'd need something like xslate to beat it
18:20 sri not that it matters much... since template engines are pretty much never a bottleneck
18:21 denis_boyun joined #mojo
18:21 sri btw... the json document i've been benchmarking with was this example from the github api https://api.github.com/search/repositories?q=tetris+language:assembly&amp;sort=stars&amp;order=desc
18:22 sri parsing that 100 times
18:23 * neilhwatson thought /o was obsolete.
18:24 sri lb: if you have any non-anecdotal reasons for why i shouldn't do it, please speak up!
18:24 sri neilhwatson: me too... but the difference is very measurable in this case
18:24 lb sri: if all the variables interpolated NEVER NEVER change, there's no reason not to
18:24 lb but /o is always global
18:25 sri never never ever
18:26 lb something like kill -HUP reload config, obviously
18:26 lb (will not work correctly)
18:26 lb basically, the regex will only interpolate literally ONCE :)
18:27 lb (this is hard to understand for people and me for some reason)
18:27 sri i use $*_RE scalars basically as regex constants
18:28 lb sub { my $foo = shift; my $r = qr/$foo/o; # now you're stuck with what $foo was first time you called sub
18:28 sri i assume your reloading story is about changing scalars that are interpolated
18:28 lb yes
18:28 sri right, that's exactly what i want
18:29 lb then it's fine - but it's very hard to make sure that will always be the case for what you're doing. it's a tough little bit of syntax/optimization to refactor around
18:30 lb i had a case where i did it in some setup-code - another programmer made it so the setup-code was called twice in same cases
18:30 sri i'd really like to know why it makes a difference at all
18:31 sri the scalar never changes, so i'd think perl knows not to recompile it
18:31 JohnDRockefeller joined #mojo
18:31 lb the regex can optimize for full string instead of special casing var-length interpolation? makes sense to me
18:32 lb perl pretty much doesn't give a shit about the state of your scalars
18:33 Cracker can we recompile perl and add more functionality
18:33 lb Cracker: that way lies madness
18:33 lb or p5p
18:33 lb but i repeat myself
18:33 Cracker i want to add ring0 access
18:33 Cracker in perl
18:34 Mikey why not just run http://www.templeos.org/
18:34 sri that escalated quickly
18:34 Adura I'd rather use losethos.
18:35 Cracker i need to add access to Zw* Functions from Perl in Kernel
18:35 Cracker under Windows
18:36 gatitskiy joined #mojo
18:36 lb you don't want to recompile perl for that - just write a module with a bit of C
18:36 Cracker But it must be inside the Core, modules are used by beginners.
18:36 lb what
18:37 neilhwatson o_O
18:37 sri Oo
18:37 lb when people say shit like that I immediately stop helping
18:37 sri you're obviously being trolled
18:37 lb i don't care
18:38 lb i stopped
18:38 Cracker i am sorry
18:38 * lb shakes marcus
18:38 Cracker i was a troll
18:39 Cracker but now iam normal
18:39 mishantil Cracker: I doubt it. This is irc.
18:39 Mikey Cracker is a deep person.  Complex nuance.
18:39 lb i ated all the pork chops
18:41 sri http://bitsocialmedia.com/wp-content/uploads/2013/07/Internet-Troll.jpg
18:42 lb internet trolls live under the switches
18:42 lb i guess you have to be really old to get that one
18:44 * sri feels really old now, thank you! :(
18:44 Martin90 I wonder have you banchmarked mojo with oridnary CGI.pm ?
18:44 sri Martin90: wat?
18:44 purl Watt?  Watt?  I can't hear you, there's this buzzing noise where my brain should be.
18:45 Martin90 have you compated CGI.pm exec time with mojo in same output ?
18:45 lb who the fuck cares
18:45 purl not me
18:46 Martin90 The person who wants to switch ;)
18:46 lb from CGI? there's a billion reasons to do that
18:46 lb speed is the least of your concerns
18:46 * sri 's head explodes
18:46 lb now look what you did
18:46 Cracker i want to aplogize for my troll lb
18:47 stephan48 CGI.pm will outperform Mojolicious in all cases except when you pay sri money to forge the benchmarks the right way
18:47 punter joined #mojo
18:47 sri looks like we have a troll infestation now :o
18:47 Mikey Cracker: shouldn't you be hacking the perl core right now?
18:48 lb i just put a nethack in perl's regex engine!
18:49 Mikey non beginners will love that, lb
18:49 gatitskiy joined #mojo
18:52 Cracker Right now I disassemble the freebsd-kernel, to add irc support without recompling.
18:52 * sri can't wait for the guardians of the galaxy movie
18:52 Mikey Martin90: you should switch.  not just for performance reasons, but if you'd like to, go ahead and compare the speed of CGI and Mojo.  Most of us aren't interested in that, which is why we don't have those numbers handy.
18:52 sri https://www.youtube.com/watch?v=m86nMHfvl7s # this song seems to fit into the channel today :)
18:53 Mikey haha
18:53 camelo joined #mojo
18:53 camelo Hi
18:53 Mikey hola camelo
18:53 Martin90 Mikey: I know my question may sounds weird but I have already impemntation with CGI.pm
18:54 lb 20 year old legacy code
18:54 Mikey Martin90: it doesn't sound weird.  most of us have some legacy CGI code.
18:55 kyshtynbai Guys, how do I make an instance of Mojo::Upload in Mojolicious Lite? $self->param('name_of_input_field'); doest work with and error:
18:55 lb i've put a bunch of small mojolite apps into cgi-bin, it's so much nicer to code, and the speed difference is immeasurable
18:55 kyshtynbai Can't locate object method "filename" via package _here_is_name_of_fileL
18:56 lb if you value EASY/NICE TO CODE over RAW SPEED what the hell are you using perl for anyway
18:56 lb er
18:56 lb other way around
18:56 purl other way around is not better
18:56 * lb sips some wine
19:01 Cracker lb: i go eat a bbq know
19:01 Cracker one meat stick will be eaten for you
19:03 disputin joined #mojo
19:04 Cracker i'll make some potatos with the name l and b
19:09 basic6 joined #mojo
19:11 sri interesting, after these Mojo::DOM::HTML optimizations weaken() calls actually show up as a bottleneck :O
19:12 lb you've hit rock bottom, congrats
19:13 Martin90 % layout 'default'; -> is a perl code line but what is these "layout" ?
19:14 lb i am not helping you anymore
19:14 lb 20:03 < lb> ok, now you really have to go read Mojolicious::Guides::Rendering,
19:14 lb and you haven't
19:14 purl Nosir.  Not a scrap.  I was deliberately wasting your time.
19:14 Martin90 lb i did read it
19:15 lb how did you miss the big section on Layouts then?
19:16 stephan48 purl: botsnack
19:16 purl thanks stephan48 :)
19:18 Mikey re my previous q: i was touching mango from inside my signal handler and it was screwing everything up.  life's much simpler now without interrupted system calls.
19:18 Martin90 % layout 'mylayout'; it basicly takes mylayout.html file and put it into content helper right ?
19:19 lb the other way around, but yes
19:21 Martin90 I don't want to question majo syntax but after an hour in it I feel syntax is complicated and a little messy
19:21 Mikey Martin90: it's just "different".  don't let the challenge keep you from enlightenment.
19:22 Martin90 http://pastebin.com/4RbayK9D
19:22 Martin90 line 3 -> what is this hello world! ?
19:22 Martin90 no semicolon at the end no function no nothing
19:22 Mikey those are templates, Martin90 :)
19:22 Mikey it's just text in there
19:23 neilhwatson Martin90: go through the tutorial and build your own small lite app. After I did that things started to make sense.
19:23 Mikey definitely do this.  everyone keeps telling you to RTFM which i understand isn't friendly, but once you have, it'll be easier for us to bridge the gap for you
19:23 Martin90 neilhwatson, you may be right ;)
19:24 Mikey AHH i have an awesome MP handler written and i am so happy with myself
19:24 Martin90 MP ?
19:24 purl rumour has it MP is Monty Python or ModPerl or multi-precision
19:24 Mikey multi-process
19:25 Mikey for minion, not for mojo.
19:25 Martin90 ahh ok
19:27 sri sometimes you are allowed to read ahead a little when going through the tutorial... this rendering guide section is specifically linked from the tutorial http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Embedded_Perl
19:29 Martin90 another confustion:
19:29 Martin90 % Perl code line, treated as "<% line =%>"
19:29 Martin90 <% line =%>, where it was desribed ?
19:29 Martin90 there was <%= line %> but no <% line =%>
19:30 sri a few sentences down -.-
19:31 lb no, i think that's a typo?
19:31 sri no
19:33 lb ah, it's documented in Mojo::Template, not Mojolicious::Guides::Rendering
19:33 Martin90 That's my point
19:33 lb not even sure that it's actually documented in Mojo::Template ;)
19:33 sri false
19:33 lb please
19:34 Martin90 so, is it typo ?
19:35 sri if nobody listens to me anyway... i'll just stop :S
19:35 lb sri: come on
19:35 lb <% =%> is poorly documented
19:36 lb "Whitespace characters around tags can be trimmed with a special tag ending."
19:36 lb i think that's it
19:36 sri well it's my fault... i really shouldn't be doing too much support... only gets me frustrated really fast
19:38 * sri gets back to profiling
19:38 lb "You can also add an additional equal sign to the end of a tag to have it automatically remove all surrounding whitespace, this allows you to freely indent your code without ruining the result."
19:39 lb it'd be friendlier to newcomers if it was clearer on the difference between <%= %>, <% =%> and <%= =%>
19:39 lb i'm sure i'll get a well volunteered, and i'll see if i get a moment tomorrow
19:39 Martin90 that's why I get frustrated really fast starting out with mojo....
19:40 Martin90 but I give i ta try
19:40 neilhwatson I just learned someting new ( <%= %>, <% =%> and <%= =%> ).
19:40 Martin90 thanks to me ;)
19:41 lb hmm, seems easy enough to fix
19:42 sri code docs were never meant for beginners, at this point i was hoping we would have a book for that
19:42 sri *core docs
19:42 neilhwatson a book, a book!
19:42 Martin90 beginers on what ?
19:44 Martin90 <% ,i think you could have picked something faster to type for these tags ;)
19:45 Martin90 but this is not as important as relatively hard to read doc
19:45 abhishekisnot I am not sure if it will be benificial to someone, but I just release a REST helper module - https://metacpan.org/pod/release/ABHIISNOT/Mojolicious-Plugin-REST-0.002/lib/Mojolicious/Plugin/REST.pm
19:46 abhishekisnot any suggestions over code/tests/docs welcome
19:47 good_news_everyon joined #mojo
19:47 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/zrgvOg
19:47 good_news_everyon mojo/master 710e8c7 Sebastian Riedel: simplify whitespace handling in Mojo::JSON
19:47 good_news_everyon left #mojo
20:14 Cracker you made martin90 quit
20:14 lb but you're still here :(
20:16 Jonis martin90 needs to spend some time reading the documentation
20:17 Cracker isn't that chanel a replacement for the documentation?
20:19 lb paying money is a replacement for the documentation
20:19 lb otherwise fuck you
20:26 Cracker Lars Balker do you like ruby?
20:27 neyasov joined #mojo
20:27 lb not really
20:28 lb i'm offending an irc channel, not the audience of a keynote speak, so fuck you for comparing me to dhh
20:28 lb ;)
20:28 sri watch your tone
20:31 lb Cracker was totally comparing me to dhh, http://www.robbyonrails.com/articles/2006/04/13/canada-on-rails-day-1-part-1
20:36 Cracker Lars Balker where do you live? State?
20:38 lb i'm not exactly anonymous unlike some people, and that info is widely available
20:38 neilhwatson joined #mojo
20:39 Cracker you wanna do some bbq soon
20:39 lb nope
20:40 Cracker oky
21:19 * sri wants bbq
21:19 sri like... right now :o
21:25 lb we can grill stuff at mojoconf
21:28 neyasov_ joined #mojo
21:33 berov joined #mojo
21:38 sri mmmmmmmmm... stuff
21:40 sujithm joined #mojo
21:41 batman abhishekisnot: /api/v1/users/:userid <-- why do you have plural "users" there?
21:41 batman same here: POST /api/v1/users
21:44 batman abhishekisnot: s/gurantees/guarantees/
21:48 kyshtynbai Guys, how to make move_to method save files with their own name and extension, not with mojo.tmp?
21:50 kyshtynbai newer mind.
21:50 batman kyshtynbai: how? i have thought about it as well...
21:50 batman maybe i should add it to wishlist :)
21:51 kyshtynbai move_to("path/$path_in_vat/more_path/$filename");
21:52 batman ok.
21:52 batman sri: what do you think? could Mojo::Upload->move_to() understand that the destination was a directory and append the Mojo::Upload->filename automatically?
21:53 sri -1
21:53 purl -1
21:53 * sri pats purl
21:53 * purl purrs
21:54 batman right...
21:54 * batman need to go drive a car
21:55 * avenj needs to go fly a boat
21:59 good_news_everyon joined #mojo
21:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/-JYEbA
21:59 good_news_everyon mojo/master 5eec227 Sebastian Riedel: use more consisten explanation for whitespace trimming
21:59 good_news_everyon left #mojo
22:00 good_news_everyon joined #mojo
22:00 good_news_everyon [mojo] kraih tagged v5.14 at b0a5627: http://git.io/mX810A
22:00 good_news_everyon left #mojo
22:02 good_news_everyon joined #mojo
22:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vCFEOw
22:02 good_news_everyon mojo/master 7176ed7 Sebastian Riedel: bump version
22:02 good_news_everyon left #mojo
22:02 [0xAF] joined #mojo
22:04 sri batman: filenames need to be validated... they can contain all kinds of garbage
22:04 sri we will never ever use it automatically, it's an attack vector
22:05 punter joined #mojo
22:07 sri oh noes, mojolicious is dropping on the leaderboard https://metacpan.org/favorite/leaderboard
22:08 Adura perl... kind of cheating.
22:10 * [0xAF] gave +1 support ;)
22:17 disputin joined #mojo
22:22 mattastrophe joined #mojo
22:27 sri \o/
22:29 sujithm joined #mojo
22:29 WildPIkachu_ joined #mojo
22:49 riche joined #mojo
22:51 D4RK-PH0ENiX joined #mojo
22:52 riche batman are you around?
22:53 batman riche: yes
22:53 riche cool.  have you established any implementation pattern around AssetPack for externalizing the asset list to load?
22:53 batman sri: right! what about adding safe_filename() ? :)
22:55 batman riche: https://metacpan.org/source/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.16/lib/Mojolicious/Plugin/AssetPack.pm#L38 ?
22:57 batman riche: sorry for linking to the source, but there wasn't any good way to point to it directly in the doc :/
22:57 riche hm, I am thinking more about externalizing to file and loading the file contents to asset pack on app start ... or in pm so morbo will catch it or use hypnotoad hot deploy
22:57 riche I just didnt want to write all those links directly in the app startup code
22:58 batman i don't get it. i thought that was exactly what assetpack did for you.
22:59 batman riche: i will be right back
23:00 riche I guess making them 'magic strings' inline with the code isnt doing it for me ... perhaps just a personal style issue
23:00 riche that's cool I will just do it as is for now ... will think more later ... but it's really cool I finally have time to use it all this time after mojoconf
23:01 sri batman: how do you make a filename safe?
23:08 D4RK-PH0ENiX joined #mojo
23:09 disputin joined #mojo
23:24 meshl joined #mojo
23:27 riche batman: it's cool and working great, just emitting an uninitialized value at join ln 316 when file added as asset is empty
23:46 riche hmm strange the jquery shipped min is almost 6kb less than the AssetPack minified one
23:46 riche seems like the comments are being minified differently
23:54 riche batman: I just added it as an enhancement req, unlikely it's realistic
23:56 jberger_ joined #mojo
23:57 batman joined #mojo
23:59 batman sri: good question :/

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