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

IRC log for #mojo, 2014-02-11

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

All times shown according to UTC.

Time Nick Message
00:00 czinczar I suggest this: explain like you talking to an idiot like me, someone who barely knows perl, but wants his own forum and blog...
00:00 jberger Sorry, I couldn't follow your last few posts,  and I assumed
00:00 jberger No offense I hope
00:00 damaya I don't think anyone writes a final draft to begin with. My first draft is brain dump, and would piss off a lot of pedants.
00:00 sri someone should rewrite this one with mojolicious :D http://www.amazon.com/CGI-Programming-Perl-Scott-Guelich/dp/1565924193/
00:00 czinczar I know ina basic way browser contacts server, then URL gets scanned,a nd server responds,  but aside from that Im like a kid with ice cream cone and blank stare
00:00 czinczar I mean I get postgresql is a db
00:01 czinczar I can even isntall it and do basic sql query
00:01 jberger czinczar I have to assume some basic perl knowledge
00:01 czinczar I can lately perlbrew up 5.18.2 perl
00:01 czinczar :)
00:01 jberger Otherwise the book will be too long
00:01 czinczar ok
00:02 jberger I would consider I section on perl compared to JavaScript and python
00:02 jberger Especially as related to variable scope and closures/lambdas
00:02 sri who would have thought python could look this good http://www.pythonb.org/
00:03 damaya jberger, some Perl knowledge should be assumed, I agree. I'd say something like, "If you're completely new to Perl, then you should check out Beginning Perl by Ovid."
00:04 czinczar I saw how the site points to learn perl in 2.5 hour, and modern perl
00:04 jberger Definitely
00:04 jberger damaya ^^
00:05 jberger in a perfect world I would write my own perl book too
00:05 czinczar yeah!!
00:05 czinczar I would read it!
00:05 jberger But modern perl is good
00:05 czinczar my brain exploded at contexts
00:06 czinczar how am I supposed to learn like context when I dont know perl?
00:06 czinczar heh
00:06 czinczar fear
00:06 damaya czinczar, Have you looked at Beginning Perl by Ovid?
00:06 jberger czinczar best document for learning perl is perlreftut
00:07 jberger Context isn't too hard once you get used to it
00:07 czinczar its for $$ and ima cheap buger
00:07 damaya Actually, that brings up an interesting point. What do you think is the most important thing to concretely understand when learning Perl?
00:07 czinczar perreftut? thats free ya?
00:07 czinczar (please dont say regex)
00:07 jberger But it would be a major topic in my book
00:07 jberger References
00:07 purl References is not myisam, only innodb, eh?
00:07 jberger Don't even look at perldsc
00:08 damaya For me, I'd actually say that perlreftut is most fundamental. Understanding how Perl views data structures. How to use references, loop over them, add to them, etc.
00:08 damaya Like, what does @{ $foo->{bar} } mean?
00:08 czinczar http://perldoc.perl.org/perlreftut.html hmmm
00:09 damaya Also, understanding @_ and $_ are really important too. I remember the first time I looked at some code and was like, "OK, so what the hell is this thing chomping?"
00:09 czinczar "data strucutres not algorithms are central to programming"
00:11 sri for intermediate programmers the most important thing to know is the difference between characters and bytes
00:11 sri can't count the number of times that comes up every week
00:12 sri no book really teaches that :S
00:15 czinczar ah ha!!
00:15 s1037989_ I think most important thing is how to abstract code so that you can build a proper module.  I still don't know how to make a good collection of abstracted modules that can just be easily plugged into Mojo or just as easily plugged into anything else.
00:16 czinczar so do you liek think ok my blog user will have name dat-of-post post post title and other data bits, and the put them into files or tables?
00:16 Drossel joined #mojo
00:16 czinczar then url and login somethingmagic
00:16 czinczar then just matter of posting psots in order of post date
00:17 czinczar and sets of say 10 per page right
00:17 czinczar for say a forum
00:18 KindOne joined #mojo
00:20 czinczar seems simple!
00:23 Akron joined #mojo
00:30 jberger See Mandel for instance
00:30 jberger Or dbix class
00:37 czinczar the mighty mongodb, jeesh they are making me learn that here at work
00:37 czinczar mandel is mojo to mongo eh
00:37 czinczar nice
00:38 jberger Mango is mojo to mongo
00:38 jberger Mandel is dbix class to mango
00:40 czinczar woa
00:40 czinczar ok
00:40 * jberger alliterates himself to death
00:40 czinczar lol
00:40 Stefan joined #mojo
00:41 tempire It's official. I'm giving a mojo talk at openwest.
00:41 tempire utah represent.
00:41 tempire I guess.
00:41 czinczar guna bring up a new forum site you made with mojo?
00:42 tempire I can't imagine why anyone would make a forum site.
00:43 czinczar forum part of www.getbig.com is my fav place on the net!
00:45 buu Mmm forums
00:45 buu The world needs more forums
00:52 nicomen sri: I ended up with something I feel it's a bit ugly, but I used it to align the outputted HTML correctly keeping indentation
00:53 nicomen my $prev; $self->parent->contents->map(sub {$inset .= $prev->content if (($self eq $_) && ($prev->node eq "text")); prev = $_; });
00:54 nicomen which is basically (although perhaps not 100% identical to) $inset = $self->text_before(0);
00:55 * sri wonders if the not_found page should also show the request information the exception page shows
00:56 nicomen (should probaly have iterated with a for-loop and last; when the previous text node was found, but speed is not an issue)
00:56 sri they could get merged into one template, only changing the top box between route list and exception context
00:57 czinczar say I want to like use very few html tags, and do very light template like p pre img and a href
00:57 czinczar can I write my own light template and then inject data into it with mojo?
00:57 czinczar or must  use a mojo plugin that does very complex html?
00:58 nicomen czinczar: I don't think a template language decides how many html tags you want to us ;)
00:58 nicomen *use
00:59 czinczar k
00:59 nicomen what is the real concern?
00:59 czinczar I write my own lil documentation sites with p pre a href and img src
00:59 czinczar 4 tags
00:59 czinczar nothting really
00:59 sri http://i.imgur.com/lby8qaK.png # yay or nay?
00:59 nicomen what you want to do is perhaps only make one template file, and re-use that based on what you feed it
01:00 sri nicomen: i take that as a "i don't care about text_before/text_after"
01:00 nicomen sri: what?
01:01 sri you said you found a different solution
01:01 nicomen sri: I'm not sure it's is entirely correct after looking at the implementation
01:02 nicomen I think what would make me happy is example on how to implement them when text_before, text_after are gone
01:02 sri anyway, i was only looking for really good use cases that would justify un-deprecating text_before/text_after
01:02 sri i'm not going to make such examples, since i have no use case
01:03 sri the only use case i did have was in the cookbook recipe that got replaced
01:05 nicomen doesn't it make sense to tell people how to implement something that has been deprecated in favour of a more generic method?
01:06 sri http://i.imgur.com/Z4ovt8Q.png # here's a better example
01:06 sri nicomen: not if nobody cares
01:07 nicomen ok
01:09 sri wonder if the + for nested could be replaced with a unicode character :)
01:11 sri allright, if nobody cares... you know what that means... I'LL DICTATE!
01:11 Adura IRC isn't active all the time for responses, silly.
01:13 czinczar hm
01:13 czinczar wow people at work are really scaring me
01:13 czinczar like I think highschool kids would do better job
01:13 czinczar without joking
01:13 KindTwo joined #mojo
01:18 jberger sri I like it, I'm not sure I need it, but I don't think it hurts and it might help sometime
01:19 alnewkirk joined #mojo
01:20 jberger_ joined #mojo
01:27 gnephiak joined #mojo
01:30 sri so i talked a bit to rsimoes... incompetence is back on the table... the first part was referring to a 3rd party plugin
01:31 sri the rest he "has somewhere and will get back to me about... later"
01:32 mixMonkey joined #mojo
01:33 dvinciguerra joined #mojo
01:34 sri nicomen: that ->all_contents example is the only use case i previously had for text_before/text_after, now i have none and therefore don't care anymore about it http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Web_scraping
01:35 sri jberger: only worry i have is that the page might look overloaded... with blue :)
01:36 mattp joined #mojo
01:37 sri not like it was much less blue before though https://twitter.com/kraih/status/422055841999880192/photo/1
01:40 good_news_everyone joined #mojo
01:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/uiMAXQ
01:40 good_news_everyone mojo/master c9392e1 Sebastian Riedel: merged exception and not found pages
01:40 good_news_everyone left #mojo
01:55 good_news_everyone joined #mojo
01:55 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/uBfhwQ
01:55 good_news_everyone mojo/master e8408b4 Sebastian Riedel: test stash snapshot for not found page
01:55 good_news_everyone left #mojo
01:58 good_news_everyone joined #mojo
01:58 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Bx-rxA
01:58 good_news_everyone mojo/master 0c2ac72 Sebastian Riedel: handle exceptions a little smarter
01:58 good_news_everyone left #mojo
02:15 klapperl joined #mojo
02:18 jack joined #mojo
02:48 good_news_everyone joined #mojo
02:48 good_news_everyone [mojo] kraih tagged v4.79 at 388763d: http://git.io/OTJH-w
02:48 good_news_everyone left #mojo
03:18 KindTwo joined #mojo
03:30 jberger joined #mojo
03:33 jberger Oops forgot to restart cpan_mojo
03:38 cpan_mojo joined #mojo
04:11 tempire oooh
04:11 tempire ancestors
04:11 purl i guess ancestors is http://protong.org/szukalski/images/jpeg/invitation_to_ancestors.jpg or defunct url
04:12 * tempire is really excited about the state of everything surrounding mojolicious right now
04:12 * tempire is honored and happy to be a part of it
04:12 tempire PARTOFALLTHETHINGS
04:13 sri \o\
04:13 sri /o/
04:14 * sri agrees wholeheartedly
04:14 tempire \o_
04:14 tempire _o/
04:15 sri the number of beginners can be a bit overwhelming at times, but it's a nice problem to have
04:15 tempire it's not so bad
04:15 tempire just drop into #perl to reset the perspective
04:17 sri naah, i'm not in the mood to discuss george r r martin ;p
04:18 tempire He certainly looks like a perl developer
04:40 good_news_everyone joined #mojo
04:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/frpZpw
04:40 good_news_everyone mojo/master 269f65a Sebastian Riedel: more links
04:40 good_news_everyone left #mojo
05:07 Stefan joined #mojo
05:18 purl joined #mojo
05:20 Stefan joined #mojo
05:23 sk_sandeep joined #mojo
05:24 sk_sandeep mst: I guess now I'm in right channel. Correct?
05:25 mst sk_sandeep: yes
05:25 mst sk_sandeep: though you fell off freenode in the process
05:25 sk_sandeep hmm, yea
05:25 mst but it's a start!
05:25 sk_sandeep yup
05:26 sk_sandeep let me try again for freenode.
05:28 sk_sandeep joined #mojo
05:56 stl_ joined #mojo
06:10 stl joined #mojo
06:17 tempire so mojo. much web.
06:26 sri wow
06:26 crab it's snowing again. what's the official mojo hot drink?
06:27 mst I'd have hot ribena laced with vodka, but that's probably an acquired taste
06:28 crab sort of like marmite?
06:29 mst *brrr*
06:29 sri kahula hot chocolate anyone? http://damndelicious.net/wp-content/uploads/2013/12/IMG_5812edit.jpg
06:30 mst kahlua you mean?
06:30 mst that'd work :)
06:30 sri indeed
06:33 sri btw. if anyone feels like doing ascii art, i'm looking for a way to make nested routes (currently + prefixed and indented) look better on the not found page and with the routes command
06:33 sri perl -Mojo -E 'get "/lalala"; app->routes->route("/foo")->post("/bar"); a({inline => "test\n123\n% die;\ntset"})->start' routes -v
06:36 sri here's a more difficult one
06:36 sri perl -Mojo -E 'get "/lalala"; my $foo = app->routes->route("/foo"); $foo->post("/bar")->route("/baz"); $foo->route("/yada"); app->start' routes -v
06:39 firnsy_ joined #mojo
06:43 basiliscos joined #mojo
07:23 Vandal joined #mojo
07:31 mattp_ joined #mojo
07:32 marcus sri: yay
07:38 dod joined #mojo
07:44 abra joined #mojo
07:54 rawler joined #mojo
08:01 eugen joined #mojo
08:08 dod joined #mojo
08:16 eseyman joined #mojo
08:26 kwa Gave up reading the backlog after 20 mins. Lots of talkety talk while I was in bed.
08:28 kwa $queue->enqueue has me interested.
08:32 trone joined #mojo
08:34 Kulag joined #mojo
08:40 mudler joined #mojo
08:53 irctc439 joined #mojo
08:54 irctc439 mojolicious site i just built... took me about a week (mostly spent dealing with vendors...).  was really fun.  https://bitk.in/   mojo rocks.
08:57 dabudabu Cool ;o
09:01 nicomen nice, did you blog about it?
09:10 irctc439 good idea... i just did @ documentroot.com
09:31 denisboyun joined #mojo
09:31 d4rkie joined #mojo
09:32 odc joined #mojo
09:41 rem_lex|pivo joined #mojo
09:44 irctc460 joined #mojo
09:44 irctc460 i really should change the favicon for my site
09:49 jack_ joined #mojo
09:49 entro joined #mojo
09:52 nicomen killer comment ;) "To be honest, I spent more time thinking about the color than the back end."
09:53 jb360 joined #mojo
09:53 crab what colour is the back end, then?
09:56 denisboyun joined #mojo
10:00 nicomen sri: second use case but now for text_after:         # Remove links at the end of an article that points to the same article
10:00 nicomen $content->find('a:last-of-type[href*="' . $link . '"]')->each( sub { my $e = shift; $e->remove if $e->text_after !~ m{ [\S] }gmx } );
10:04 firnsy joined #mojo
10:12 dvinciguerra joined #mojo
10:20 Stefan joined #mojo
10:47 basiliscos Hello! I have the following sample program, which uses Data::Dump and Mojo::JSON http://bpaste.net/show/177927/
10:48 basiliscos The jsonization result is different after doing dump http://bpaste.net/show/177928/
10:49 basiliscos I use the latest Mojolicious and Data::Dump. What could happen with my $data, when I do dump? Why Mojo::JSON behaves incorrectly after dumping?
10:50 basiliscos Thanks for any helping
10:51 nicomen can reproduce with 4.78
10:51 basiliscos nicomen: thanks. Is it Mojo or Data::Dump bug?
10:52 nicomen Data::Dump, it's identical with Data::Dumper
10:52 mst I don't think so
10:53 mst hrm
10:54 mst yeah, gotcha
10:54 mst return 0 + $value if $flags & (B::SVp_IOK | B::SVp_NOK) && $value * 0 == 0;
10:54 mst that means it's going to  produce the wrong result for anything that's ever been numified, I reckon
10:54 mst so
10:54 mst basiliscos: try
10:54 mst say "j1", " " . Mojo::JSON->new->encode($data);
10:54 nicomen http://bpaste.net/show/lKjvqdOULbtwkBebslnO/
10:55 mst my $sum; $sum += $_ for @{$data->{input}{params}};
10:55 mst basiliscos: then dump j2
10:55 mst I bet you'll have the same effect
10:56 mst nicomen: irrelevant. try my proposed experiment instead.
10:56 basiliscos mst: Got it!
10:56 basiliscos mst: the same result as with dump($data)
10:56 mst yep
10:57 mst so, basically, if you've -ever- treated something as a number
10:57 mst Mojo::JSON assumes it's a number and serializes it as such
10:57 mst apparently somewhere in its dumping process, Data::Dump does so
10:57 basiliscos So, that's Data::Dump bug or not? Should I open some issue request?
10:58 nicomen https://rt.cpan.org/Public/Bug/Display.html?id=86592
10:59 mst Data::Dump is definitely wrong
10:59 mst I'm not sure I particularly like the Mojo::JSON choice of heuristic ... but there's problems with pretty much any such choice
10:59 nicomen seems JSON::PP and JSON::XS has the same issue
11:00 basiliscos mst, nicomen: thank you very much! I'm going to use Data::Dumper as temporal solution :)
11:00 mst basiliscos: you might like Data::Dumper::Concise
11:01 mst nicomen: sort of
11:01 mst Data::Dump manages to break their heuristic too
11:01 mst but it's a different heuristic
11:03 skullbocks joined #mojo
11:38 denisboyun joined #mojo
11:50 nicomen is there a way to list attributes that an Mojo::Base based object has?
11:51 mst attr/has just create the accessor
11:52 nicomen hm, digging into the code now, and you appear to be right, intriguing
11:53 mst because the constructor just accepts whatever it's passed, there's no need for an attribute list
11:53 nicomen yeah and convert everything to subs
11:55 mst oooh
11:55 * mst has an idea
11:55 purl know is a silly bot
12:17 mst bah
12:17 mst nicomen: I can tell which methods came from an eval
12:17 mst but I can't specifically spot Mojo::Base's evals
12:23 nicomen mst: neat, but don't worry, if at all useful, it should be implemented directly in the has method, update a local list, with the class it originated from
12:24 mst oh, sure, but I was curious
12:49 skullbocks joined #mojo
12:56 Zx3 joined #mojo
13:12 mire_ joined #mojo
13:24 Akron joined #mojo
13:34 basiliscos joined #mojo
13:35 Fatalnix I just had a realy whack weird idea.
13:35 Fatalnix oh, morning mst
13:40 Fatalnix I was thinking of how I absolutely hate GUI programming.. and I wanted to replace some program which is a GUI.. so my idea was- what if I drew some web rendering canvas or something, make it fit in nicely and seamlessly then run mojo and pipe its output to the browser.. draw the UI up in HTML and CSS. I wonder how much of a pain in the butt that would be.
13:42 Fatalnix The mojo connection should be a piece o' cake.
13:50 Akron So you want to create all GUI stuff with simple HTML or do you want to use web GUI stuff like extjs?
13:51 Fatalnix well I personally would use just html and css stuff. I'm not a JS person really...
13:52 Fatalnix especially since now thanks to css3 and html5 a lot of stuff that javascript can do even such as mouse input can be handled
13:52 Fatalnix not that I've played much with those features..
13:54 Fatalnix it would need to be scrollbarless and addressbarless and etc etc but
13:55 Akron Yes. If the GUI stuff is trivial (like forms and stuff) I would always prefer HTML5+CSS+Webend stuff for user interaction. It's a lot easier to change the GUI adapting user input than having to deal with another Window-System.
13:55 Fatalnix not to mention, it gives you a lot more freedom on how you want it to actually look
13:55 Akron (Just based on my limited experiences with GUI stuff)
13:55 Fatalnix you're not limited to say gtk button styles etc
13:55 Akron Yes.
13:56 punter joined #mojo
13:56 Fatalnix and I think mojo would make it extremely easy to build and add on features.
13:58 Fatalnix The only difficulty, is what gui engine to use and how to embed it
13:59 Fatalnix I usually write console applications- its what I prefer.
14:02 sh4 joined #mojo
14:07 meshl joined #mojo
14:36 Akron If you don't want to use js - just use the Mojo-Templating system.
14:37 Fatalnix Yeah that's what I intend to do. I still gotta draw it to a canvas somehow though
14:39 mattp_ joined #mojo
14:46 btyler joined #mojo
14:57 mire_ joined #mojo
14:58 gryphon joined #mojo
15:03 Stefan joined #mojo
15:06 rem_lex| joined #mojo
15:15 Stefan joined #mojo
15:19 GabrielVieira joined #mojo
15:22 GabrielVieira Hi guys, I'm having some problem with plugin I18N and Mojolicious::Lite, I simply can't make it work. Can anyone show me a simple minimal app using Mojolicious::Lite and I18N plugin (not in the same file and with folders, etc)? Thanks.
15:27 radixo joined #mojo
15:31 marty joined #mojo
15:32 Fatalnix T18N sounds like an ancient TI calculator.
15:32 radixo_ joined #mojo
15:32 Fatalnix TI-18 :)
15:46 sri mst: disagree about Mojo::JSON heuristics, how often do you really unintentionally use a string that's meant to be a string as a number?
15:47 sri compared to using numbers accidentally as strings
15:48 sri cases like $num =~ /^\d{4,5}$/ or $num eq 23 or print "foo $num" come to mind
15:48 sri the only real problem with Mojo::JSON heuristics is the stupidity of Data::Dump
15:49 nicomen It's kind of scary that perl changes flags upon comparison of variables though
15:49 nicomen (and if you are making a dumping module, you should really take notice of such things)
15:49 dvinciguerra joined #mojo
15:50 sri it's not just flags, it converts internally and caches both versions
15:51 mst sri: I think I might argue that adding an extra bit of heuristic around NV 0 might be a good idea
15:52 skullbocks joined #mojo
15:57 sri mst: think i disagree again, for the same reason
15:57 mst sri: well, the thing is, NV 0, PV 'bollicks'
15:57 mst sri: has pretty much got to have started off as a string
15:58 sri ok, but how do you accidentally numify?
16:00 mst I've no idea, probably only ever due to a bug
16:00 mst but at the very least you have the information to say "I am about to guess wrong because you are an idiot, go fix that"
16:03 sri and suddenly you're the stinker ruining the flags for everyone else ;p
16:04 mst well, no, you can achieve what I was thinking about without altering the flags
16:10 cfedde How artificial is this: perl -MDevel::Peek=Dump -le '$x = "0 lbs"; $x * 5; print Dump $x'
16:11 gnephiak joined #mojo
16:12 sri cfedde: what's the use case?
16:14 good_news_everyone joined #mojo
16:14 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/LjoAPQ
16:14 good_news_everyone mojo/master 330e659 Sebastian Riedel: added tests for encoding the same data twice with Mojo::JSON
16:14 good_news_everyone left #mojo
16:14 sri just in case someone tries to send a pull request
16:18 good_news_everyone joined #mojo
16:18 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/YTEnwQ
16:18 good_news_everyone mojo/master fa1b2d1 Sebastian Riedel: made Mojo::JSON tests a little harder
16:18 good_news_everyone left #mojo
16:21 good_news_everyone joined #mojo
16:21 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/-vKUQA
16:21 good_news_everyone mojo/master 55c78d7 Sebastian Riedel: even harder Mojo::JSON tests
16:21 good_news_everyone left #mojo
16:21 sri ok :)
16:22 mire_ joined #mojo
16:22 mattastrophe joined #mojo
16:23 nicomen so, what serializer would you suggest to freeze a Mojo::Transaction object?
16:23 bluescreen joined #mojo
16:27 sri look at that, the gittip perl community is getting more active :o https://www.gittip.com/for/perl/
16:29 tianon it must be the sub signatures :)
16:29 tianon where else can you do sub sum ($a, $b = return $a) {...} ? :D
16:32 jberger Fatalnix: see Farabi
16:32 Fatalnix Morning jberger!
16:32 Fatalnix hows Galileo?
16:32 mst sri: riba's been stirring
16:32 jberger o/
16:33 jberger I've been more in tool and documentation building mode lately
16:33 sri mst: a company like booking could do some good there
16:33 mst I'm more interested in the social aspect
16:33 Fatalnix so farabi is an IDE?
16:33 jberger Yea
16:34 jberger It uses a lot of JavaScript though
16:34 jberger Anything as true gui as that will
16:35 Fatalnix It looks like its a good idea. What I want to do is embed a browser into a window though. I want to make a Minecraft launcher for my friends server that does things our way (instead of everyone elses Java way)
16:38 Fatalnix its sort of weird but for production use nobody is going to want to visit a link in their browser.
16:38 asarch joined #mojo
16:39 Fatalnix least not for a launchere.
16:44 cfedde make an icon that does it for them.
16:44 Fatalnix possible.
16:44 purl FOOL!  There is nothing Perl cannot do!  NOTHING!
16:45 * Fatalnix pet purl
16:45 cfedde I find most of our users are pretty entrenched in a particular work flow.
16:45 cfedde Introducing something new would just confuse things.
16:46 Fatalnix yeah, but the thing is, with the embedded idea, itl look exactly the same- just stylish
16:47 Fatalnix I mean, there wouldnt be any unfamiliaritty
16:47 Fatalnix unfamiliarity*
16:50 * tempire votes yay
16:53 cfedde s/particular/peculiar and idosyncratic/
17:10 sri nicomen: your use cases are not very good
17:12 sri i actually would be open to making ->next and ->previous return Mojo::DOM::Node objects too, but that seems like a breaking change
17:12 sri *i'm
17:12 sri umm...
17:13 sri s/*i'm//
17:13 denis_boyun joined #mojo
17:22 sri damn
17:23 sri i have a pretty kick ass feature, but the implementation is ugly
17:24 sri http://pastie.org/8723039 # almost no new code, and you get full ->next_sibling/->previous_sibling navigation through Mojo::DOM and Mojo::DOM::Node objects
17:24 sri problem is how to share code between Mojo::DOM and Mojo::DOM::Node
17:25 sri the method names are also not great
17:25 purl okay, sri.
17:25 * sri kicks purl
17:25 * purl bites sri!
17:25 sri perl -Ilib -Mojo -E 'say x("<a><!-- f -->b<c>d</c>e</a>")->at("c")->previous_sibling->previous_sibling'
17:26 sri that would get you " f "
17:26 sri i could imagine ->next_node/->previous_node to make it more obvious, but that still leaves the code sharing problem
17:29 sri next and next_sibling are similar to jquery and the dom api (.next and .nextSibling)
17:33 sri really the only way to make it public for sharing would be some kind of Mojo::DOM::siblings_of($dom_or_node)
17:36 sri so far the only sharing of private functions/methods we do is a) from base classes and exceptions like Mojolicious::Renderer::_bundled (to cache bundled templates in a central place)
17:45 mattastrophe joined #mojo
17:48 sri *crickets*
17:58 beyondcreed joined #mojo
17:59 frustrating_chat hey sri
18:00 sri http://pastie.org/8723160 # patch with documentation
18:00 sri \o
18:00 frustrating_chat o7
18:01 bjoernfan joined #mojo
18:02 skullbocks joined #mojo
18:07 genio sri: Out of curiosity on that, why _siblings(shift) instead of shift->_siblings()?
18:08 sri because it's not a method anymore
18:08 diegok Hi!... is this a bug on Mojo::DOM or just something not desirable -> http://pastie.org/8723180
18:08 sri same reason i renamed $self to $start
18:09 sri diegok: what else could it do?
18:09 diegok return 1 or 'checked' :-)
18:09 diegok is what I get in js IIRC
18:10 diegok I don't know if this is legal, but I'm sure it works on common browsers.
18:10 sri anyway, no time to discuss that
18:10 sri i don't think it's a bug though
18:11 diegok sri: sure, that's why I just ask before make it work for my case on my side :)
18:12 diegok it looks like browser understand attr as attr='attr' :-/
18:16 genio checked was not allowed in XHTML; it had to be checked="checked".  Is it the same in HTML5?
18:22 sri diegok: patches welcome
18:22 purl i think patches welcome is always true or even for metacpan.org or swahili for "Put up or shut up."
18:23 diegok sri: nice! :-)
18:24 diegok I'm using this crap atm -> http://pastie.org/8723224 (but I'll look into Mojo::DOM if you thing it makes sense!). Thanks!
18:24 sri diegok: but you have to explain why it is a bug and needs to be changed in a backwards compatibility breaking way
18:25 diegok sri: I should convince some core guys with my arguments?... I can't get with more than "this is the way browsers understand it" :-/
18:26 diegok sri: are you partially convinced? :-)
18:26 sri do you mean jquery or dom api?
18:27 diegok sri: I mean, browser rendering the checkbox checked
18:27 sri that sounds very irrelevant
18:28 diegok I'll try js api's. I think jquery works that way, but not sure about native...
18:28 sri we have "exists $dom->attr->{checked}"
18:29 sri $dom->attr->{checked} = undef and $dom->attr->{checked} = 'checked' are completely different things
18:29 sri how would Mojo::DOM::HTML ever know when to generate <input checked> and when <input checked="checked">?
18:30 diegok when generating it should always be checked="checked"
18:30 diegok thats the correct way
18:30 sri ok, now you've convinced me i would actually have to veto the change ;p
18:30 diegok :D
18:32 diegok what I'm doing is trying to read the state a form is loaded... so I need this to be true. But I can make it work with: exists $dom->attr->{checked} && $dom->attr->{checked}
18:33 diegok (and removing my crappy regexp) :)
18:34 diegok sri: if you change your mind, I'm up to try to make this happen at Mojo::DOM level :D
18:34 skullbocks joined #mojo
18:34 sri diegok: try convincing another core dev first
18:35 diegok ok, I'll bug marcus then :p
18:44 good_news_everyone joined #mojo
18:44 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/rSWJng
18:44 good_news_everyone mojo/master abf8c07 Sebastian Riedel: fixed list parsing bug in Mojo::DOM::HTML and added next_sibling and previous_sibling methods to Mojo::DOM and Mojo::DOM::HTML
18:44 good_news_everyone left #mojo
18:45 radixo joined #mojo
18:46 sri this is the only part i'm worried about https://github.com/kraih/mojo/commit/abf8c0738b2ff031b69c1d15bbdcc184ea4a5385#diff-b5c201d500f0ae2fee8fff984bbd27f5R16
18:46 sri but i just can't think of a better solution
18:51 sri hmm...i suppose anything non-trivial added to Mojo::DOM::Node in the future will need to share code with Mojo::DOM
18:51 sri but it's usually so low level that making it public in a 3rd class wouldn't be very useful at all
18:52 sri if this wasn't such a damn useful feature...
18:56 mire_ joined #mojo
18:59 sri nicomen: i would have expected you to comment on next_sibling/previous_sibling ;p
19:01 fhelmber_ joined #mojo
19:02 sri tempire, jberger, marcus, crab: you might want to take a look too
19:12 jberger I see why it worries you, but as long as it's tested it's probably fine
19:34 Stefan joined #mojo
19:35 Stefan joined #mojo
19:37 * sri nods
19:48 sri jberger: btw. you ok with the name too?
19:49 jberger Sure?
19:49 purl But are you sure you're sure?
19:49 sri candidates i have atm. would be next_sibling and next_node
19:49 * jberger snacks purl with a rubber chicken
19:50 sri thing about next_sibling is that it's in line with jquery... .next and .nextSibling
19:50 genio cpan-outdated | cpanm
19:50 purl cpan-outdated | cpanm is nice
19:50 genio crap... ww
19:50 jberger That and from the doc it seems that it might not return a node but a Dom
19:51 jberger genio never hurts to get a reminder
19:51 jberger ;-)
19:51 sri same semantics as jquery, .next returns only elements, while .nextSibling returns all kinds of nodes
19:52 sri downside, ->previous_sibling is a lot to type
19:53 jberger Eh, clarity++
19:53 sri fun fact, jquery has a .prev that's not consistent with the .previousSibling from the dom api
19:55 sri it's interesting to see what dom nodes can do on their own https://developer.mozilla.org/en/docs/Web/API/Node
19:58 trone joined #mojo
20:08 fhelmber_ joined #mojo
20:10 denis_boyun joined #mojo
20:21 denis_boyun joined #mojo
20:21 fhelmber_ joined #mojo
20:21 trone joined #mojo
20:21 skullbocks joined #mojo
20:21 bjoernfan joined #mojo
20:21 beyondcreed joined #mojo
20:21 bluescreen joined #mojo
20:21 dvinciguerra joined #mojo
20:21 marty joined #mojo
20:21 btyler joined #mojo
20:21 basiliscos joined #mojo
20:21 Zx3 joined #mojo
20:21 firnsy joined #mojo
20:21 d4rkie joined #mojo
20:21 mudler joined #mojo
20:21 abra joined #mojo
20:21 stl joined #mojo
20:21 purl joined #mojo
20:21 cpan_mojo joined #mojo
20:21 KindOne joined #mojo
20:21 klapperl joined #mojo
20:21 mattp joined #mojo
20:21 alnewkirk joined #mojo
20:21 dwierenga joined #mojo
20:21 cooper joined #mojo
20:21 frustrating_chat joined #mojo
20:21 tempire joined #mojo
20:21 tardisx joined #mojo
20:21 jwang joined #mojo
20:21 zivester joined #mojo
20:21 jnbek joined #mojo
20:21 Lee joined #mojo
20:21 sjn joined #mojo
20:21 hesperaux joined #mojo
20:21 jzawodn joined #mojo
20:21 bpmedley joined #mojo
20:21 s1037989_ joined #mojo
20:21 cleverfox joined #mojo
20:21 snap_ joined #mojo
20:21 ashleydev joined #mojo
20:21 ioguix_ joined #mojo
20:21 Foxcool joined #mojo
20:21 Adura joined #mojo
20:21 zackiv31 joined #mojo
20:21 drift joined #mojo
20:21 genio joined #mojo
20:21 suy joined #mojo
20:21 howitdo joined #mojo
20:21 tl joined #mojo
20:21 kwa joined #mojo
20:21 stephan48 joined #mojo
20:21 bjakubski joined #mojo
20:21 bzero joined #mojo
20:21 DaniBunny joined #mojo
20:21 mishantil joined #mojo
20:21 sri joined #mojo
20:21 Dandre joined #mojo
20:21 keedi joined #mojo
20:21 nicomen joined #mojo
20:21 icenine joined #mojo
20:21 hesco joined #mojo
20:21 bayashi joined #mojo
20:21 mtj joined #mojo
20:21 Sjors joined #mojo
20:21 elvis joined #mojo
20:21 batman joined #mojo
20:21 Bender joined #mojo
20:21 crab joined #mojo
20:21 mgrimes joined #mojo
20:21 bowtie joined #mojo
20:21 andrefs joined #mojo
20:21 Negor joined #mojo
20:21 buu joined #mojo
20:21 yko joined #mojo
20:21 al joined #mojo
20:21 mfontani joined #mojo
20:21 __mkrull joined #mojo
20:21 inokenty joined #mojo
20:21 memowe joined #mojo
20:21 michael joined #mojo
20:21 sivoais joined #mojo
20:21 Ralesk joined #mojo
20:21 geira joined #mojo
20:21 Kundun joined #mojo
20:21 cosimo joined #mojo
20:21 Farow joined #mojo
20:21 avenj joined #mojo
20:21 cottoo joined #mojo
20:21 da5id joined #mojo
20:21 chansen joined #mojo
20:21 rhaen joined #mojo
20:21 nic joined #mojo
20:21 Kovensky joined #mojo
20:21 espent joined #mojo
20:21 BinGOs joined #mojo
20:21 lucs joined #mojo
20:21 sycobuny joined #mojo
20:21 Gedge joined #mojo
20:21 edeca joined #mojo
20:21 mtths joined #mojo
20:21 bc547 joined #mojo
20:21 robinsmidsrod joined #mojo
20:21 diegok joined #mojo
20:21 augensalat joined #mojo
20:21 HtbaaPi joined #mojo
20:21 rj11 joined #mojo
20:21 lestrrat joined #mojo
20:21 omega joined #mojo
20:21 DaTa joined #mojo
20:21 moritz joined #mojo
20:21 bd joined #mojo
20:21 akiym joined #mojo
20:21 go|dfish joined #mojo
20:21 phips joined #mojo
20:21 Andreas joined #mojo
20:21 gabiruh joined #mojo
20:21 jan joined #mojo
20:21 Jonis joined #mojo
20:21 garu joined #mojo
20:21 xtetsuji joined #mojo
20:21 ascent joined #mojo
20:21 mst joined #mojo
20:21 stokachu joined #mojo
20:21 sawtooth joined #mojo
20:21 bobkare joined #mojo
20:21 caeles joined #mojo
20:25 webart1 joined #mojo
20:29 nicomen sri: I see your points, actually I think the last changes are a step in the right way, but how to tie everything together...
20:30 nicomen sri: hm, I haven't seen any sibling discussions, will check backlog
20:33 nicomen sri: anyway, I think the mix between accessing nodes as CSS (ignoring comments nodes etc.) and having XML style supporting all node types can be confusing
20:35 nicomen sri: what's the thought behind having a Mojo::DOM and a separate Mojo::DOM::Node?
20:38 lukep joined #mojo
20:41 meshl joined #mojo
20:45 good_news_everyone joined #mojo
20:45 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/m2ScDw
20:45 good_news_everyone mojo/master 167c15c Sebastian Riedel: improved Mojo::DOM::HTML performance
20:45 good_news_everyone left #mojo
20:48 mattastrophe joined #mojo
20:51 punter joined #mojo
20:52 sri oh, rust has a community code of conduct, interesting https://github.com/mozilla/rust/wiki/Note-development-policy#wiki-conduct
20:54 sri nicomen: try merging them
20:56 nicomen sri: I'm asking out of curiosity, not criticizing
20:56 sri no really, it's the easiest way to understand
21:03 nicomen ok, I will perhaps look closer next time, but what I really wondered was, your thoughts behind the separation, or actually behind the expansion to be able to get nodetypes and such
21:03 sri it can't work any other way
21:03 nicomen I guess aligning with jquery in any case is good
21:14 denis_boyun joined #mojo
21:16 punter If one wanted to pay to promote a facebook post about Mojolicious/Perl, what could the post say?
21:17 punter promote it to programmers (& Python users)
21:17 genio ?  People pay for posting on FaceBook?
21:17 genio oh... sorry. an advertisement
21:17 punter you can do that
21:17 punter yes
21:17 genio I need more coffee
21:26 nicomen punter: how about what http://mojolicio.us says?
21:26 punter Yes, cool
21:35 jberger_ joined #mojo
21:45 jberger joined #mojo
21:49 mudler joined #mojo
21:53 dvinciguerra joined #mojo
22:01 skullbocks joined #mojo
22:05 sri oh crap... there might actually be a way to merge Mojo::DOM and Mojo::DOM::Node
22:08 s1037989_ Can I have DATA templates in a Mojolicious full app and can I have multiple DATA templates in multiple modules?
22:09 nicomen crap
22:10 nicomen ;)
22:16 GabrielV_ joined #mojo
22:18 russum joined #mojo
22:20 sri wow... it actually adds functionality
22:20 sri such as ->replace(...) working for text nodes
22:21 sri i'll be damned
22:22 sri if i'm not totally crazy it might not even break a single test
22:24 sri there's an optimization that could be done later, which is a different DOM tree structure, but for a first merge it is not necessary
22:24 sri (which would break some tests)
22:37 sri only downside is that certain methods won't do anything for text nodes and friends
22:37 sri but we have that already with root
22:39 nicomen interesting, bordering impressed :-)
22:47 tempire dear goodness
22:47 tempire something just fell on my iphone
22:47 tempire and it's cracked
22:47 tempire DEARGODWHY
22:48 nicomen I think they are made to break easily
22:48 sri gorilla glass is not what it used to be
22:49 nicomen it's kind of like the old days when your harddrive died, and you had no backup, perfect opportunity for a fresh start :-)
22:49 sri it doesn't scratch... but don't look at it funny or it will shatter
22:50 nicomen it's not LCD, just CD...
22:50 sri http://pastie.org/8723951 # partial patch to merge Mojo::DOM::Node into Mojo::DOM (it's less code)
22:50 nicomen the only time I cracked a cell phone screen, was not when I dropped it on the floor in a pub
22:51 nicomen but when my friend stamped on it, for fun
22:51 cfedde TIL CGI expects the web server to do its authentication.
22:52 cfedde TIL CGI is frequently not the best approach.
22:54 nicomen sri: the checking for "tag", is that the nodetype?
22:54 sri yes
22:55 nicomen would it be better to use the standard nodeType names?
22:55 sri those don't have names
22:55 sri they are numbers
22:56 nicomen true, but I have seen names for the constants in C implementations and Javascript implementation
22:56 nicomen true, but I have seen names for the constants in C implementations and Javascript implementations
22:56 sri you are welcome to propose it as a breaking change for later
22:58 nicomen ok ;)
22:59 nicomen this means I can traverse ::DOM objects as they are in the tree, instead of getting a collection and look for ref addresses right?
23:01 mattastrophe joined #mojo
23:08 sri oh crap
23:08 sri i can also make ->append and ->prepend work with text nodes
23:08 Adura Keep making it like jQuery.
23:10 sri this is actually dom functionality, not jquery
23:10 Adura jQuery is great for that.
23:13 nicomen http://vanilla-js.com/
23:14 mire_ joined #mojo
23:16 Adura You can't link something like that on an irc channel about a web framework!
23:16 Adura You are disparaging the idea of a framework!
23:16 nicomen hehe, why not, have you seen its speed?
23:17 Adura You need to go to #asm!
23:18 nicomen hehe, well, it's a good reminder that just because you want function $ () { return document.getElementsBySelector(arguments); } you don't need a 40k script to slow it down ;)
23:18 Adura Not that I imagine there's a #asm on a Perl IRC network.
23:20 nicomen in hindsight, I should have opted for $ ... http://lists.w3.org/Archives/Public/public-webapi/2006Dec/0048.html
23:21 nicomen (was a huge discussion about keeping the name short)
23:26 Stefan joined #mojo
23:34 dvinciguerra joined #mojo
23:58 basiliscos1 joined #mojo
23:59 jberger go sri go!

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