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

IRC log for #mojo, 2016-12-14

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

All times shown according to UTC.

Time Nick Message
00:03 sri hehe, people on twitter hate when i complain about something, always costs me 5-10 followers
00:08 preaction eh. likely spam followers :p
00:10 howitdo joined #mojo
00:13 sri naah, it's a thing on twitter, you need to put a positive spin on everything you write ;p
00:13 preaction i got that more on facebook than i do twitter. we might have different networks of people though ;)
00:30 dvinciguerra joined #mojo
01:00 jontaylor joined #mojo
01:00 aborazmeh joined #mojo
03:08 noganex joined #mojo
04:00 ivi joined #mojo
04:41 aborazmeh joined #mojo
05:04 dboehmer joined #mojo
06:16 dod joined #mojo
06:28 inokenty-w joined #mojo
06:49 Vandal15263 joined #mojo
06:54 disputin joined #mojo
07:26 polettix joined #mojo
07:32 dod joined #mojo
07:34 howitdo joined #mojo
07:39 dod joined #mojo
07:39 mbudde joined #mojo
08:00 kes joined #mojo
08:02 Dandre joined #mojo
08:03 AndrewIsh joined #mojo
08:03 Dandre left #mojo
08:08 Dandre joined #mojo
08:28 trone joined #mojo
09:31 dotan_convos joined #mojo
10:14 romkaspb joined #mojo
10:15 romkaspb Hey guys
10:15 romkaspb Hi everybody
10:15 purl Hi, Dr. Nick!
10:15 romkaspb I got a question mates
10:15 romkaspb I would try to explane
10:16 howitdo joined #mojo
10:18 romkaspb I got a plugin which got code smth like this: http://pastebin.com/L6g4q5Lk
10:19 romkaspb Helper "is_mobile" checks UserAgent header by regexp: http://pastebin.com/uKnNYCdL
10:20 romkaspb If I run in on Apache, everything works good
10:20 romkaspb But if i run it on morbo or hypnotoad I got error:
10:20 romkaspb Can't call method "req" on an undefined value
10:20 romkaspb It means, than $self->tx is undefined
10:21 romkaspb How this even been possible?
10:23 osfabibisi joined #mojo
10:38 sri i'd assume something you're not showing us is wrong
10:39 sri btw. you can just remove ")->to(cb" and have it work the same
10:44 romkaspb dont understand
10:44 romkaspb remove... which line?
10:45 romkaspb ok, understood ))
10:46 romkaspb but error still exists
10:47 romkaspb how it's possible that tx (Mojolicious::HTTP::Transaction) is undefined?
10:48 romkaspb sec, ill try to paste log
10:53 jontaylor joined #mojo
10:55 romkaspb is_mobile helper - http://pastebin.com/8VdLa0nq
10:57 romkaspb http://pastebin.com/U0DJ1m3F - morbo log
11:01 romkaspb looks like it runs as hook "before_build_tx", but it's lie...
11:03 romkaspb some fun! it sometimes works after second request.
11:03 romkaspb i mean, first load - 500 , refresh page - works fine
11:27 osfabibisi joined #mojo
12:46 asarch joined #mojo
13:15 polettix joined #mojo
13:20 gizmomathboy joined #mojo
14:00 mib_8dfhme joined #mojo
14:00 mib_8dfhme struggling to select a table with a specific header-text with Mojo::DOM
14:00 mib_8dfhme is there an article showcasing these kind of selections?
14:01 gryphon joined #mojo
14:02 genio What selector are you using? What's the HTML look like?
14:04 mib_8dfhme currently nothing - I am failing to find the proper docs
14:05 genio oh, you said you were struggling. I assumed that meant you'd already tried something.  Mojo::DOM uses CSS selectors. so, if you can find it with CSS, you can find it with Mojo::DOM.
14:05 genio https://metacpan.org/pod/Mojo::DOM
14:05 purl https://metacpan.org/pod/Mojo::DOM is particularly nice
14:05 * genio pets purl
14:05 * purl bites!
14:08 mib_8dfhme sorry phone
14:09 mib_8dfhme the html would be like <table><th><td>a predefined string</td></th><tr>...</tr></table>
14:10 mib_8dfhme I want to select the entire <table> sub-tree
14:10 mib_8dfhme all the matching is concerned with attributes/tags
14:10 mib_8dfhme thus I am stuck
14:15 ramortegui joined #mojo
14:17 kes joined #mojo
14:18 ramortegui joined #mojo
14:20 sri you can't match text content with css selectors
14:20 sri there is simply no selector for that in the specs
14:21 sri jquery hard to make up its own https://api.jquery.com/contains-selector/
14:22 mib_8dfhme ok... so... this means I can't do what I want with mojolicious then, need to break out something like HTM::TagParser ?
14:22 genio not that you can't get what you want, you just can't get it directly.
14:23 genio get the table's tds following a th. Check each td for the text you are looking for
14:23 mib_8dfhme I see, ok
14:24 ramortegui joined #mojo
14:25 genio The Collection you get back from the 'th > td' selector will give you easy ways to go through them: https://metacpan.org/pod/Mojo::Collection
14:26 mib_8dfhme once I enumerated all interesting <th>'s how do I ask for "give me the first (closest to you) <table> parent" ?
14:26 mib_8dfhme do I just keep looping over ->parent and matching or there's a smarter way?
14:26 vicash mib_8dfhme: use the "id" field/attribute for the table and you can use Mojo::DOM selectors to find stuff
14:27 mib_8dfhme vicash: I do not have any of that ( 'id' or any other predictable attributes on table elements )
14:27 sri http://mojolicious.org/perldoc/Mojo/DOM#ancestors
14:28 mib_8dfhme sri: so... ancestors ('table')->first or ->last in my case?
14:28 sri yes
14:29 mib_8dfhme this was a question - it is not clear from the documentation what order is the ancestry in
14:30 mib_8dfhme looks like I want last...
14:31 sri suppose collection returning methods could mention order... like ", sorted from closest to furthest" and the like
14:31 mib_8dfhme $dom->find('th')->grep( sub { $_[0]->text eq $expected_header })->first->ancestors('table')->last  this is what I came up with to find the first table with a specific header string
14:31 mib_8dfhme is this sane?
14:31 sri (if anyone feels like sending a patch)
14:33 sri of course you'd have to check if it's closest to furthest, or furthest to closest ;p
14:33 ramortegui joined #mojo
14:34 mib_8dfhme any word on whether this chain of selections is sufficiently ok?
14:46 ramortegui joined #mojo
15:08 kaare joined #mojo
15:16 sri sure
15:17 jberger TIL about ancestors, I guess I'd never used that one
15:18 jberger I would have done $dom->find('table')->first(sub{ $_->find('th')->first(sub{ $_->text eq $header }) })
15:19 sri i like that one more too
15:31 ramortegui left #mojo
15:42 mib_8dfhme jberger: noted, thanks
15:43 exp-innit with regard to authentication bridges, all pages on my site require authentication (obviously implicitly not including /login) .. is there a recommended routing strategy for this?
15:43 exp-innit would i be able to (for example) do a bridge on '/' to include any later defined routes as requiring authentication?
15:44 bwf joined #mojo
15:44 zivester joined #mojo
16:00 mib_8dfhme jberger: is your example guaranteed to never throw with "can't call method on undef"
16:01 mib_8dfhme or find('th')->first still might?
16:10 disputin joined #mojo
16:19 jberger mib_8dfhme: no you probably need to harden that code
16:21 jberger exp-innit: routes match in order, so define the '/login' route first, then the under, then all protected routes under it
16:21 exp-innit jberger: ah excellent, cheers
16:28 q_gone joined #mojo
16:28 PryMar56 joined #mojo
16:44 sri what a messy rfc https://tools.ietf.org/html/rfc7764
16:45 sri but i guess at least text/markdown is now a thing
16:59 sri which is actually defined here ;p https://tools.ietf.org/html/rfc7763
17:02 sri wonder if there are good reasons for having text/markdown in Mojolicious::Types
17:05 stryx` joined #mojo
17:07 orev joined #mojo
17:11 howitdo joined #mojo
17:16 howitdo joined #mojo
17:17 sh14 joined #mojo
17:21 jberger I thought you couldn't use the name markdown without daring fireball's approval
17:21 jberger I mean, personally, I'm all for it
17:22 jberger I'm just surprised the standards body is just giving that the finger
17:29 marcus markdown is bsd licensed?
17:29 sri don't think he has a trademark on the word
17:30 sri license is irrelevant
17:30 jberger and yeah, that rfc is almost less than helpful
17:30 jberger it mentions text/markdown as the mime type and then spends the rest of the time talking about variants without mentioning how those ought to be distinguished in the mime type
17:31 marcus Tried to find any official comments from him on it, but all I could find is  https://twitter.com/gruber/status/398972553412489217 ;)
17:32 jberger I seem to recall it had to do with the naming of the commonmark project
17:36 jberger https://blog.codinghorror.com/standard-markdown-is-now-common-markdown/
17:38 jberger "after a long and thoughtful email from John Gruber – which is greatly appreciated – he indicated that no form of the word "Markdown" is acceptable to him in this case. We are now using the name CommonMark."
17:55 vicash jberger: i think the fight was the fact that codinghorror was calling it "Standard" Markdown...
17:56 preaction no, because Github doesn't call it "Github Markdown", it calls it "Github-Flavored Markdown", and he addresses that
17:57 preaction but also, they attempted to discuss things with jgruber before releasing their thing and afaik got no response
17:57 preaction he was probably still distraught over the deaths of his brothers, Hans Gruber and Simon Gruber
17:58 vicash LOL
18:05 pink_mist lol
18:30 dod joined #mojo
18:32 dod joined #mojo
18:44 tuna joined #mojo
19:07 polettix joined #mojo
19:20 dod joined #mojo
19:58 tyldis joined #mojo
20:28 PryMar56 joined #mojo
20:49 dod joined #mojo
20:51 disputin joined #mojo
20:53 tyldis joined #mojo
22:29 polettix joined #mojo
23:04 noganex_ joined #mojo
23:09 howitdo joined #mojo
23:17 stryx` joined #mojo
23:19 Kundun joined #mojo

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