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

IRC log for #mojo, 2015-11-12

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

All times shown according to UTC.

Time Nick Message
00:05 stephen joined #mojo
01:00 jontaylor joined #mojo
01:11 sri jberger: https://github.com/kraih/minion/commit/476c86f8e6a7e75b5365f574ac1dcee18b7b3d86
01:12 jberger \o/
01:19 jberger sri: thanks
01:27 sri jberger: one worry i have is that it might weaken the attempts feature
01:27 sri since every retry consumes an attempt
01:28 cpan_mojo Mojo-Webqq-1.6.1 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-1.6.1
01:29 jberger I think you would likely only use one or the other
01:29 jberger in fact I'm considering explicitly overriding setting attempts
01:50 jberger I just had a mild panic attack thinking that minion was causing my laptop to get warm
01:50 jberger turned out it was a run away Chrome tab
01:50 sri it's always chrome
01:51 preaction except when it's firefox
01:52 * jberger shakes angry fist
01:56 cpan_mojo Statocles-0.058 by PREACTION https://metacpan.org/release/PREACTION/Statocles-0.058
01:57 * sri wonders if $job->retry({attempts => ...}) make sense
01:57 sri +s
02:06 jberger it would give you an avenue to make changes without using up attempts
02:06 voldemortensen joined #mojo
02:07 sri it still affects the generated delay
02:07 sri which is always (retries ** 4) + 15
02:07 jberger :s
02:42 voldemortensen joined #mojo
02:46 kaare joined #mojo
02:54 voldemortensen joined #mojo
02:57 cpan_mojo Minion-4.01 by SRI https://metacpan.org/release/SRI/Minion-4.01
02:58 good_news_everyon joined #mojo
02:58 good_news_everyon [mojo] kraih tagged v6.30 at 2ec27ec: http://git.io/v8Fw2
02:58 good_news_everyon left #mojo
02:59 good_news_everyon joined #mojo
02:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8FwS
02:59 good_news_everyon mojo/master d6ac6e2 Sebastian Riedel: bump version
02:59 good_news_everyon left #mojo
03:05 jberger \o/ just got a set of three jobs to run wherein two run in parallel and the third waits for both of them
03:07 jberger sri: why did the attempts attribute get removed at 4.0?
03:08 sri not used anymore
04:05 sri this sounds interesting http://rhaas.blogspot.de/2015/11/parallel-sequential-scan-is-committed.html
04:13 genio jberger: did you get a chance to look at the blog attempt gist?
04:15 jberger genio: oh, no i totally forgot
04:15 jberger do you have that link again?
04:16 jberger sri: they're taking 9.6 code, that's gotta mean 9.5 soon ... right :s
04:19 genio jberger: https://gist.github.com/genio/50e7ac4216fa90af88bf
04:21 jberger genio: some rapid fire:
04:21 jberger $cb = ref($cb) eq 'CODE'? $cb : undef; doesn;'t really do much
04:22 jberger die $tx->error{message} unless $tx->success; is missing an arrow after error
04:22 jberger (oh, both places)
04:22 genio just ensuring we don't attempt to call a non-coderef for a callback function.  oops.  how'd I miss the arrow?
04:23 Grinnz genio, probably better to let it error out than silently become blocking
04:24 jberger genio: you could also promote the mojo get command next to curl
04:24 jberger this is especially useful if you want to then demo your mock app
04:24 Grinnz though the latter happens anyway with the idiom $cb = ref $_[-1] eq 'CODE' ? pop : undef
04:27 genio jberger: I was kind of hoping you'd take over and write the blog post :)  I was just wanting to give you a starting point.  I don't even have a blog setup
04:28 jberger genio: why does your webservice runner make get requests but your mock app only makes a delete route
04:28 jberger oh
04:28 jberger right, now I remember you saying that :-P
04:28 genio bah.  copypasta error
04:28 genio fixed
04:29 genio refreshing will get most of the things mentioned fixed minus the mention of Mojo get.  I haven't added that yet
04:31 ichi joined #mojo
04:31 jberger genio: oh and you are from florida, I just spent quite a lovely weekend there
04:31 jberger mostly on Marathon Key
04:31 genio It's really nice down there.  You get to enjoy some beach time?
04:31 jberger a little Key West and of course the intermediary drive
04:32 jberger yeah, Marathon Key has a wonderful non-touristy beach and there are a couple nice ones on neighboring keys' state parks too
04:32 jberger Bahia Honda
04:33 genio It's finally starting to cool off a bit in FL, so no more beach unfortunately.
04:33 jberger I've been able to drive the convertible plenty late this year, so I'm not complaining
04:35 inokenty-w joined #mojo
05:15 melo joined #mojo
06:04 val joined #mojo
06:25 polettix joined #mojo
06:50 dod joined #mojo
07:05 ichi joined #mojo
07:15 McA joined #mojo
07:56 osfabibisi joined #mojo
08:05 kes joined #mojo
08:11 carneirao joined #mojo
08:11 Vandal joined #mojo
08:12 polettix joined #mojo
08:15 eseyman joined #mojo
08:33 melo1 joined #mojo
08:49 trone joined #mojo
09:20 vanHoesel joined #mojo
09:21 cpan_mojo Mango-1.23 by ODC https://metacpan.org/release/ODC/Mango-1.23
09:23 Mattjes joined #mojo
09:57 berov joined #mojo
10:03 punter joined #mojo
10:07 vanHoesel joined #mojo
10:13 polettix joined #mojo
10:16 vanHoesel joined #mojo
10:24 dboehmer joined #mojo
10:38 CandyAngel Hm... is it possible to have a Mojo lite app which, when started, just generates a html file?
10:39 CandyAngel So it doesn't run as a server, but makes a static site..
10:39 odc CandyAngel, sure, just be sure to never call app->start
10:41 vanHoesel joined #mojo
10:41 CandyAngel The reason why is I can't run a Mojo server at work (without getting into trouble), but I'd like to make something that could easily be changed to be run as a server later
10:43 CandyAngel ANd, obviously, be able to leverage Mojo-ness, to achieve opportunistic synergy with adaptive company focus directives
10:44 CandyAngel I know I won't be able to get user input.. unless I can do some Javascript magic maybe
10:44 CandyAngel But that is acceptable
10:44 aborazmeh joined #mojo
10:45 stephan48 you might have a look at Contenticious
10:45 stephan48 memowe did employ a static renderer there
10:45 stephan48 while also allowing the app to be run as a server
10:45 CandyAngel Oh coolies
10:45 CandyAngel Thank you :)
10:46 stephan48 i think he recently had it fixed for Mojolicious 6
10:47 stephan48 remainds me that i still need to "pullrequest" my modifications to it
10:47 CandyAngel .. .there's a "your mom" joke in the these docs
10:47 CandyAngel Time for some (mock) outrage!
10:47 CandyAngel :P
11:00 CandyAngel Hm
11:00 CandyAngel I could just set it up and do like
11:00 CandyAngel ./site.pl get / > static.html
11:00 CandyAngel I think that would work for what I want right now
11:07 melo joined #mojo
11:10 Zoffix joined #mojo
11:12 vanHoesel joined #mojo
11:15 jontaylor joined #mojo
11:26 jontaylor on every platform I use chrome just eats CPU
11:26 jontaylor i wish they just added a button to selectively unpause background tabs
11:27 jontaylor and default them all to being halted
11:33 Mattjes Hello!
11:33 Mattjes Is to recognize the possibility of there with Mojo how much p-tags after a specific CSS-tag yet come (if I do not know in advance the number)?
11:34 nic I'd guess you can use ->find and then see the size of the collection
11:34 Mattjes <strong>bla</strong>
11:34 Mattjes yes
11:34 Mattjes here i can use "find('strong')
11:35 Mattjes but after "strong" there come alot of p-tags
11:35 Mattjes and u dont know how much this is
11:36 Mattjes <strong>bla</strong><p>test1</p><p>test2</p><p>test3</p><p>test4</p><p>open end - i dont know tthe end</p>
11:37 vanHoesel joined #mojo
11:37 nic Mattjes: What is the question?  You want to count them?
11:37 nicomen joined #mojo
11:38 Mattjes i will find ALL p-tags (with text inside) after a stecific css-tag but i dont know how much p-tags this is (this is variable)
11:38 Mattjes i cane be 6 p-tags or 12 p-tags
11:38 Mattjes i dont know this before
11:38 pink_mist so you've said. what's the problem?
11:39 punter joined #mojo
11:40 Mattjes <div id"parent"> <strong>bla</strong> <p>Test1</p> <p>Test2</p> <p>Test3</p> <p>Test4</p> and so on i dont know how much p-tags will come here </div>
11:40 Mattjes the problem is - before strong there are p-tags to
11:41 Mattjes i will find ONLY - p-tags after strong
11:41 nic that's do-able
11:41 Mattjes so i cant use parent p
11:41 nic Mattjes: Do you need to handle any crazy p-tags inside p-tags?  if not, it's easy
11:43 Mattjes i extract contn from other websites - but any websites are made from "hobby-webmasters" wit terrible html-code
11:43 Mattjes content
11:43 Mattjes an "hobby-webmaster" use a lot of p-tags
11:44 Mattjes and its different from underside to underside
11:44 mattastrophe joined #mojo
11:45 nic The start tag, can it contain p-tags, or be within p-tags?
11:46 Mattjes it can - starttag is a strong-tag inside a p-tag find('strong')->parent
11:46 Mattjes after start-p-tag i must find all other (not before)
11:47 Mattjes <div id"parent"> <p>Ignore1</p> <p>Ignore2</p> <p>Ignore3</p> <p><strong>bla</strong></p> <p>Test1</p> <p>Test2</p> <p>Test3</p> <p>Test4</p> and so on i dont know how much p-tags will come here </div>
11:47 Mattjes here i must find all "test-p-tags" AFTER
11:48 Mattjes after p-strong
11:49 Mattjes it is perhaps better to use a foreach loop for this to find p-tags after p-strong?
11:50 nic Are they all siblings?
11:50 Mattjes yes
11:50 nic http://mojolicio.us/perldoc/Mojo::DOM#next
11:50 Mattjes yes - mojo:dom is use but siblings BEFORE p-strong i dont need
11:50 Mattjes only after
11:51 Mattjes from parent i can find all indide p-tags
11:51 Mattjes this is easy
11:51 nic For a moment I thought you needed to find all subsequent elements, even non-siblings, which I don't know how to do
11:51 Mattjes but i need only p-tags AFTER p-strong
11:51 nic yes, I pointed you at 'next'
11:53 nic that may have set a new record for the lengthiest asking of a simple question
11:56 Mattjes nic: i dont know how much "next" i must use
11:56 pink_mist you use it until it returns undef.
11:56 Mattjes find('p strong')->next->next->next->next->[n] ....
11:57 Mattjes a foreach loop?
11:57 pink_mist I'd suggest a while loop
11:57 nic while would make most sense to me
11:57 Mattjes ok - this is a word ;-)
11:57 Mattjes sorry for my question - but i am a beginner ;-)
11:57 nic np
11:58 Mattjes Thank you for help - i will test it with while-loop
11:58 Mattjes ;-)
11:58 pink_mist while (defined( my $next = ...->next() )) {...
11:58 Mattjes cool - i test it
11:58 Mattjes thank you
12:01 pink_mist while (defined( my $next = ...->next() )) { next unless $next->tag eq 'p'; ...
12:12 ichi joined #mojo
12:16 Mattjes pink_mist: it works - thank you ;-)
12:17 Mattjes [shoulder tap]
12:24 vanHoesel joined #mojo
12:32 kaare joined #mojo
12:40 neilhwatson joined #mojo
12:44 nic wow, github compare produces really nice printouts
12:50 stephen joined #mojo
12:56 kes nic: can you say a word about: https://github.com/kraih/mojo/compare/master...KES777:improved_template_inheritance_draft?expand=1
12:56 kes ?
12:56 nic 'biject' is my favourite word today.  You can never have too much of it
12:56 kes This patch allows to pass arguments to 'content' blocks
12:57 kes and fixes problems with inheritance
12:57 kes *template inheritance
12:58 kes this problems: http://paste.scsys.co.uk/501295
12:58 gregf joined #mojo
12:58 kes s/this/these/
12:58 ajr_ joined #mojo
13:00 polettix joined #mojo
13:00 jontaylor_ joined #mojo
13:00 jberger kes: should those rows be template blocks instead?
13:00 upasana joined #mojo
13:01 bc547_ joined #mojo
13:01 melo1 joined #mojo
13:02 upasana- joined #mojo
13:02 bjakubski_ joined #mojo
13:02 chansen joined #mojo
13:02 sri Mattjes: http://mojolicio.us/perldoc/Mojo/DOM#following
13:03 saki joined #mojo
13:03 mspo joined #mojo
13:04 Zx3 joined #mojo
13:04 neilhwatson joined #mojo
13:04 Mattjes joined #mojo
13:04 tianon joined #mojo
13:04 Kundun joined #mojo
13:04 abracadaniel joined #mojo
13:04 ichi joined #mojo
13:04 avenj joined #mojo
13:05 lupi joined #mojo
13:05 worklapperl joined #mojo
13:05 omega joined #mojo
13:05 firnsy joined #mojo
13:05 salparadise joined #mojo
13:05 renormalist joined #mojo
13:06 mrEriksson joined #mojo
13:06 tempire joined #mojo
13:06 rakshasa joined #mojo
13:06 sri joined #mojo
13:06 cstamas joined #mojo
13:06 ashleydev joined #mojo
13:07 sivoais joined #mojo
13:07 dysfun joined #mojo
13:07 gabiruh joined #mojo
13:07 geheimnis` joined #mojo
13:08 espen joined #mojo
13:08 stuart joined #mojo
13:08 CHYC joined #mojo
13:08 dustinm joined #mojo
13:08 crab joined #mojo
13:08 carneirao joined #mojo
13:08 KindOne joined #mojo
13:09 jnbek joined #mojo
13:09 kmx joined #mojo
13:09 dboehmer joined #mojo
13:10 kivilahtio joined #mojo
13:10 da5id joined #mojo
13:10 caeles joined #mojo
13:10 phillipadsmith joined #mojo
13:11 theo joined #mojo
13:11 btyler joined #mojo
13:11 mattp joined #mojo
13:11 coolo joined #mojo
13:12 bobkare joined #mojo
13:12 SmokeMachine joined #mojo
13:12 buu joined #mojo
13:12 jantore joined #mojo
13:13 dave joined #mojo
13:13 fitnerd joined #mojo
13:13 stigo joined #mojo
13:13 mikegrb_ joined #mojo
13:13 csson joined #mojo
13:13 y1mmm joined #mojo
13:13 dod joined #mojo
13:14 mishanti1 joined #mojo
13:14 meredith joined #mojo
13:15 Repaster joined #mojo
13:16 kes joined #mojo
13:16 stokachu joined #mojo
13:17 rwp joined #mojo
13:17 Trelane joined #mojo
13:17 sawtooth joined #mojo
13:17 michael joined #mojo
13:18 Eke joined #mojo
13:18 cosimo joined #mojo
13:18 mudler joined #mojo
13:19 dabudabu joined #mojo
13:19 Mattjes Why this dont work?
13:19 Mattjes if (defined $dom->find('p')->first(qr/Uber mich:/)->parent->next->next)
13:19 HtbaaPi joined #mojo
13:19 Mattjes Can't call method "next" on an undefined value at line 364.
13:19 kwa joined #mojo
13:20 Lucas1 joined #mojo
13:20 Mattjes with "defined" yet will I check whether or not there is next?
13:21 doby joined #mojo
13:21 Mattjes why still the error message?
13:21 Gedge joined #mojo
13:21 Foxcool joined #mojo
13:22 ZoffixW joined #mojo
13:22 salva joined #mojo
13:22 ZoffixW Which test file in the mojo dist tests DefaultHelpers?
13:23 preaction joined #mojo
13:23 mtj joined #mojo
13:23 hahainternet joined #mojo
13:23 Quai joined #mojo
13:23 Jonis joined #mojo
13:23 Ralesk joined #mojo
13:23 shadowpaste joined #mojo
13:23 allison joined #mojo
13:23 tinita joined #mojo
13:23 nic joined #mojo
13:23 ladnaV joined #mojo
13:23 d4rkie joined #mojo
13:23 Lee joined #mojo
13:23 robinsmidsrod joined #mojo
13:23 CandyAngel joined #mojo
13:23 al joined #mojo
13:24 lsm joined #mojo
13:24 augensalat joined #mojo
13:24 hahainte1net joined #mojo
13:24 charsbar joined #mojo
13:24 nicomen joined #mojo
13:24 Phil21 joined #mojo
13:24 mgrimes joined #mojo
13:24 pink_mist joined #mojo
13:24 ashimema joined #mojo
13:24 nic kes: See what I mean??  Bad syntax breaks the interwebs
13:25 vytas joined #mojo
13:25 osfameron joined #mojo
13:25 cpan_mojo joined #mojo
13:25 bayashi joined #mojo
13:25 val joined #mojo
13:25 Jonis_ joined #mojo
13:25 Dandre joined #mojo
13:25 moritz joined #mojo
13:26 kes nic: do not understand you ((
13:26 bjoernfan joined #mojo
13:26 kes and what you mean
13:26 Bender joined #mojo
13:27 nic just joking; you didn't really break irc
13:27 bd joined #mojo
13:28 murre joined #mojo
13:29 kes all tests works fine ;-)
13:30 kes I plan to extend those. There are some untested cases yet in the box mojo
13:33 go|dfish joined #mojo
13:34 ichi joined #mojo
13:34 ssm joined #mojo
13:36 Mattjes how can i check if a value is not undefined? if(defined $dom->find('p')->next->next) dont work
13:36 Mattjes here i get "Can't call method "next" on an undefined value"
13:36 Mattjes the script aborts here
13:37 ZoffixW Mattjes, that's because the first ->next returns an undef
13:37 Mattjes no - first next is defined
13:37 ZoffixW -_-
13:37 ZoffixW very well then
13:39 Mattjes but - if first or last "next" nit defined - with "defined" I want to check yes
13:39 Mattjes the if statement should not be executed then
13:39 Mattjes but the script aborts
13:40 Mattjes then completly
13:40 eitz joined #mojo
13:40 ZoffixW Yes, because you're attempting to call method ->next on an undefined value returned by the first ->next
13:41 Mattjes hmmm ... yes .. but then the if-statment should not be executed then - i will not aborts the script then
13:42 ZoffixW Mattjes, what makes you think the if statement won't be executed?
13:42 Mattjes in PHP i use for this "isset"
13:42 ZoffixW Mattjes, you do see you have ->next->next ?
13:42 Mattjes if ( ->next->next ) { my $bla =  ->next->next }
13:43 Mattjes if (defined  ->next->next ) { my $bla = ->next->next }
13:43 Mattjes but the script aborts
13:43 ZoffixW Mattjes, well, what do you think happens here:  if ( ->next->[HERE]next )
13:43 * ZoffixW would write it as if( $dom->find('p')->[2] ) ) {...}
13:43 Mattjes hmmm
13:44 ZoffixW Or even if( my $blah = $dom->find('p')->[2] ) ) {...}
13:44 Mattjes ok - i test it
13:44 marcus joined #mojo
13:44 * ZoffixW really misses jQuery's :eq() selector in Mojo
13:44 gryphon joined #mojo
13:44 sri or just do what i said
13:45 Mattjes but i dont understand why i cant  catch the error?
13:45 sri $dom->at('strong')->following('p')
13:45 * sri shrugs
13:45 ZoffixW Mattjes, you can... you're just not catching it
13:45 Mattjes i use Mojo 5.27 - is "following" there available?
13:46 jberger Mattjes: perldoc Mojo::DOM
13:46 Mattjes ZoffixW "defined" ist not a error-catch?
13:46 sri no, it is not
13:46 ZoffixW Mattjes, no, it just checks for definedness
13:46 Mattjes if defined
13:46 Mattjes hmmmm
13:46 Mattjes I thought
13:46 ZoffixW sri, but it's not as convenient as, say, ->at('#records tbody tr:eq(3) td:eq(4)') :)
13:47 jberger Mattjes: see Safe::Isa $_call_if_object
13:47 sri ZoffixW: ->at('#records tbody  tr:eq(3) td:eq(4)')
13:48 sri oops
13:48 Mattjes one moment - ich will check it
13:48 ZoffixW Not sure if the helper really fits in with other helpers there. I was planning to release some sort of ::ExtraHelpers plugin, but so far could not think of any other helpers to add except this one: https://github.com/kraih/mojo/pull/872
13:48 sri ZoffixW: ->at('#records tbody tr')->slice(3, 4)
13:49 ZoffixW sri, that's not the same. "Fifth <td> inside fourth <tr> inside <tbody> inside #records"
13:49 sri actually, whatever, i don't care enough, this is about ancient versions of Mojo::DOM anyway
13:55 sri marcus/tempire: you're both not in #mojo-core
14:04 Akron joined #mojo
14:06 voldemortensen joined #mojo
14:14 Mattjes jberger: when i use  Safe::Isa $_call_if_object i get the same error and script aborts
14:39 jb360 joined #mojo
14:49 dboehmer how to extent $c->render() to support additional arguments?
14:50 bpmedley joined #mojo
14:51 nic dboehmer: Do you mean 'add things to the stash'?
14:52 dboehmer i can use render(json => {}) and I want to implement render(realm=>"foo") which sets the www-authenticate header to "Basic realm=foo"
14:53 dboehmer is that done by adding a handler to the renderer?
14:53 dboehmer i am not yet sure if a "handler" is the right thing
14:53 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Adding-a-handler-to-generate-binary-data
14:53 nic ->header
14:54 dboehmer nic, you mean $c->header, don't you?
15:08 voldemortensen joined #mojo
15:11 dboehmer sri, as I understand the example binary handler is for generating the output (=HTTP body)
15:12 dboehmer I meant to extend render() to support more options like status=>200
15:12 dboehmer I still want to use the JSON renderer but also set a HTTP header in a convenient way
15:12 dboehmer is it possible to extend renderer in this way?
15:13 nic dboehmer: Best read the guides; it's all in there
15:13 dboehmer reading the example I think the before_render hook could do that. it's just my 1st mojo app and I am not yet familiar with which extension mechanism is suitable
15:15 dboehmer nic, it's not that I had not read tons of documentation. I just didn't try out everything yet and can't chose the right tool yet
15:19 punter joined #mojo
15:21 sri adding magical stash values is rather advanced, common solution would be to use helpers
15:22 sri there's even a header example right there http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Adding-helpers
15:23 * sri still likes the look of $c->cache_control->five_minutes
15:23 sh4 joined #mojo
15:25 glauber joined #mojo
15:27 sri Zoffix: i vaguely remember this being discussed before https://github.com/kraih/mojo/pull/872
15:43 dod joined #mojo
15:52 ZoffixW joined #mojo
15:53 ZoffixW sri, yeah, in August, and that's when I invented items_in. But the discussion was about making some hack to loop through given items. The proposed items_in helper only does deref: http://irclog.perlgeek.de/mojo/2015-08-23#i_11102732
15:53 ZoffixW And now I've used it so many times, that I considered releasing a plugin that would provide it. And I figured I run it by the core members to see if it might end up in core instead.
15:54 ZoffixW (or maybe jberger invented it.. now I don't remember :P)
16:05 jberger ZoffixW: I did a version, it's in my gists called "loop helper"
16:06 jontaylor joined #mojo
16:34 sri ZoffixW: i think a lot more discussion is necessary to get the behavior right
16:35 sri like, you handle the stash value not existing gracefully, but not if it's something else than an array
16:36 sri actually, optional stash value is an anti pattern
16:36 sri since it requires two separate versions of a template
16:36 ZoffixW Oh
16:37 ZoffixW Wait, what do you mean two separate versions?
16:38 sri ->render('foo', bar => 'baz') and ->render('foo')
16:38 sri that requires different versions of the template foo.html.ep
16:38 sri it will be compiled differently
16:39 sri since one contains a variable $bar and the other doesn't
16:40 * ZoffixW has a ton of templates with optional stash values
16:40 ZoffixW :(
16:40 ZoffixW Good thing I didn't find out about this several years from now lol
16:40 sri MOJO_TEMPLATE_DEBUG=1 perl -Mojo -E 'my $c = app->build_controller; $c->render_to_string(inline => ""); $c->render_to_string(inline => "", foo => 1)'
16:40 sri compare the two
16:41 sri i mean, it works fine, but you waste cpu and memory
16:42 sri every version takes up a slot in the template cache, which contains the last 100 by default
16:44 sri if anyone knows a better way to do stash variables in the template, patches would be very welcome!
16:46 Mattjes joined #mojo
16:48 Mattjes with what function can i make first letter in every word in a string capital? ucfirst make only first letter (in first word) big.
16:48 Mattjes "I am a string" -> "I Am A String" ??
16:49 ZoffixW Mattjes, naive approach would be to s/\b(.)/\u$1/g
16:49 Mattjes ZoffixW: Thanky you - i test it
16:49 kes join ' ', map { uc } split ' ', $str;
16:50 Grinnz_ ucfirst, but yeah
16:51 Mattjes ZoffixW: its works perfect - thank you!
16:51 Mattjes kes: Thank you too!
16:52 ZoffixW Mattjes, kes's version is clearer than mine. Use that.
16:53 Mattjes ok
16:53 Mattjes ZoffixW: What is \b in your regex?
16:53 Mattjes i dont find \b in my help-tutorial
16:53 Grinnz_ \b is a word boundary, but splitting on space is better because \b will match around punctuation
16:53 ZoffixW Mattjes, word boundary
16:54 Mattjes ahhh - thank you
16:54 Grinnz_ perldoc perlretut
16:57 ZoffixW Mattjes, CSS also have text-transform: capitalize;
17:03 kes What I may to improve at https://github.com/kraih/mojo/compare/master...KES777:improved_template_inheritance_draft_?expand=1 to be accepted into core?
17:04 sri kes: documentation
17:04 sri you can't even have a discussion without that
17:04 kes ok
17:18 dod joined #mojo
17:21 ZoffixW joined #mojo
17:22 ZoffixW Curious, how come all-upper-case actions not allowed? (https://metacpan.org/source/SRI/Mojolicious-6.30/lib/Mojolicious/Routes.pm#L53)
17:22 ZoffixW Or is it just a catch all for BEGIN/END/DESTROY stuff?
17:22 sri TO_JSON, AUTOLOAD...
17:23 ZoffixW kk :)
17:23 * ZoffixW was trying to do NIY fwiw
17:23 sri DOES
17:23 sri and all those i don't remember ;p
17:23 ZoffixW :D
17:24 sri although, i think it matters less now that :controller and :action placeholders are discouraged
17:25 sri it's allright to get started, but in a real app i wouldn't want to see those
17:27 ZoffixW I renamed it to a much clearer "not_implemented_yet" :)
17:28 sri :)
17:31 cpan_mojo Statocles-0.059 by PREACTION https://metacpan.org/release/PREACTION/Statocles-0.059
17:41 sri btw. handling </p> and </br> correctly in Mojo::DOM::HTML costs 3 lines of code
17:46 sri just thought of a way https://gist.github.com/anonymous/330407baac1b705ce865
17:51 sri since we all know that "<b>test</b></p>" is supposed to be equivalent to "<b>test</b><p></p>"
17:57 ichi joined #mojo
18:38 polettix joined #mojo
18:40 CandyAngel Hm, can I use Mojo::Commands in my own apps or is it pretty Mojolicious specific?
18:40 Grinnz_ https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Adding-commands-to-Mojolicious
18:41 CandyAngel yeah, but all the Mojo ones will be available :P
18:42 Grinnz_ you can change $self->commands->namespaces to only refer to your command namespace, but you will lose "myapp daemon" and such
18:42 CandyAngel Oh
18:42 CandyAngel That's fine, I'm just making a CLI app
18:48 CandyAngel Honestly, since I started using Mojolicious, maybe 90% of the non-Mojo scripts I've written since then utilises some part of it :P
18:48 CandyAngel Mostly Useragent and Collection :P
18:49 trone joined #mojo
18:55 CandyAngel ... I love Mojolicious so much. Works just how I wanted it to!
18:55 sri :)
18:55 CandyAngel Even when I'm not using it "properly"
18:56 CandyAngel There have been modules that were meant to be used independently, that worked less independently than these!
18:56 McA2 joined #mojo
18:57 CandyAngel Oh.. okay, so it doesn't work flawlessly, but that's probably because my command is an inline package
18:57 CandyAngel (the description and usage texts don't work)
18:59 CandyAngel Inline.. err.. or inner (not sure the correct term)
19:00 sri inline packages work too
19:00 CandyAngel It works in terms of "the command runs"
19:00 CandyAngel But the help text shows the default
19:00 CandyAngel Rather than was "has description => 'not displayed'" has
19:01 sri no, i mean we have special support for inline command packages
19:01 CandyAngel Ohhh
19:03 sri https://github.com/kraih/mojo/blob/master/t/mojolicious/commands.t#L18
19:04 sri i remember adding this function not too long ago specifically for that https://github.com/kraih/mojo/blob/master/lib/Mojo/Loader.pm#L37-L41
19:04 CandyAngel yeah, it detects the command and lists it in the help
19:04 CandyAngel And it runs it fine
19:05 CandyAngel It just says
19:05 CandyAngel Commands:
19:05 CandyAngel registered  No description
19:05 sri -.-
19:06 CandyAngel Is that a "-.- you're an idiot" or a "-.- you've just found a bug" :/
19:06 sri the former
19:06 CandyAngel Okie :P
19:06 sri ;p
19:07 CandyAngel Sorry, I just expected setting a description to set a description :P
19:07 sri it does
19:09 CandyAngel In the wrong namespace or something? Because I am setting it and it doesn't show up
19:10 good_news_everyon joined #mojo
19:10 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8hsE
19:10 good_news_everyon mojo/master 595add3 Sebastian Riedel: test the description too
19:10 good_news_everyon left #mojo
19:10 sri ^
19:11 till joined #mojo
19:15 CandyAngel Okay, I found out why it wasn't working for me
19:16 CandyAngel The command package has to come before main
19:21 CandyAngel I guess that has something to do with monkey_patch?
19:21 CandyAngel Or rather, how it works
19:25 punter joined #mojo
19:27 CandyAngel Anyway, it works completely fine now, thank you
19:39 bwf joined #mojo
19:43 polettix joined #mojo
19:48 D4RK-PH0ENiX joined #mojo
20:06 CandyAngel Hmmm
20:07 CandyAngel Is it better to do ./app.pl registered --some-action-to-do-with-registered
20:07 CandyAngel Or ./app.pl action --registered
20:07 CandyAngel The latter would make more sense.. right?
20:09 pink_mist hard to say without knowing what type of application this is and what kind of action you're envisaging
20:10 pink_mist and what specifically you mean 'registered' to be doing
20:10 CandyAngel Well I have a bunch of elements which can be in a few groups (registered, pending, deleted, linked) and I want to do various actions on those groups (list, delete, unregister, register)
20:11 pink_mist then I'd say the latter makes more sense
20:11 CandyAngel So I want to be able to do an action on either a specific element (giving its id) or all elements in that type
20:11 pink_mist right
20:11 stephan48 the latter and maybe some abstration
20:13 Grinnz_ you could even make the groups specified the same way as IDs, they don't need to be options
20:14 stephan48 yea
20:14 CandyAngel So like.. it just detects those "special cases"?
20:14 pink_mist well presumably ids are numbers?
20:14 Grinnz_ see "yum history undo ##" "yum history undo last"
20:14 Grinnz_ it recognizes last as a keyword, otherwise it uses it as an ID
20:14 CandyAngel No, they are unique strings
20:14 pink_mist ah
20:15 CandyAngel Collision with a group name is unlikely, but possible
20:15 pink_mist then keep with the --foo
20:15 pink_mist would be my vote
20:15 Grinnz_ or you could make a special syntax for groups
20:15 stephan48 ./app.pl list registered [id/filter] - registered would be the first argument and id filter a possible second argument
20:15 pink_mist --group registered
20:15 Grinnz_ @groupname (like yum) or group groupname
20:15 CandyAngel Ooo
20:15 Grinnz_ just up to whatever you think will feel right
20:16 CandyAngel I like the @group thing
20:16 stephan48 that might be even cleaner
20:16 preaction @ is a special character in some shells though
20:17 pink_mist which shells? 0_o
20:17 * pink_mist assumes zsh or something like that
20:17 Grinnz_ i know fish shell complains occasionally if i don't escape it
20:17 * Grinnz_ shrugs
20:17 preaction i use zsh, but i can't reproduce it at the moment
20:17 pink_mist oh, fish? :/ not a fan
20:18 * pink_mist prefers meat
20:18 * Grinnz_ never understood how fish isn't considered meat... but that's getting a bit off topic
20:19 pink_mist I find it odd too, but I know that's the way it is, so I adjust
20:19 CandyAngel I could just ~group
20:19 CandyAngel could use*
20:19 Grinnz_ ~ gets expanded to $HOME :P
20:19 pink_mist that's ... also special, yeah :P
20:19 preaction is there ever going to be something other than groups?
20:20 preaction is "action -g <group>" that bad?
20:20 CandyAngel No, that'd be fine
20:20 Grinnz_ it's workable either way, just as long as the documentation is good :P
20:21 preaction --group is just the long form. always allow both, but generally -g is what goes in the synopsis
20:21 pink_mist since $ is taken, how about €group :P
20:21 Grinnz_ lol
20:21 preaction (in Getopt::Long parlance, this would be 'group|g=s' (= for "required argument" s for "argument is a string")
20:22 CandyAngel Well there is like umm
20:22 CandyAngel --group, --case, --person
20:23 pink_mist £group
20:23 CandyAngel So having it like that would be best
20:23 CandyAngel I think
20:23 preaction yeah, if you're doing all those things, having standard options will be best
20:23 CandyAngel Or just ummm
20:23 CandyAngel action type id
20:23 CandyAngel So: list group registered
20:23 preaction what if i want to combine options?
20:24 CandyAngel like: list group registered case AA0001?
20:24 preaction you don't have to allow it to begin with, but it helps to plan for these things
20:24 kes sri: Docs are done (https://github.com/kraih/mojo/compare/master...KES777:improved_template_inheritance?expand=1)
20:24 Grinnz_ whether you allow that or not would help determine which way makes more sense
20:24 CandyAngel Hmm..
20:25 CandyAngel it could be useful in some cases (like registering a case and a person at the same time)
20:25 CandyAngel But it wouldn't be like.. really bad  to limit it to one thing only
20:25 preaction whether you might ever want to allow it in the future, really. your first version doesn't have to be perfect and do everything, but i hate breaking user-facing interfaces
20:26 CandyAngel list, for example, wouldn't make much sense (because listing a case is giving completely different info to when you list a person)
20:34 buu So
20:34 buu Anyone doing anything clever with mojo + client side routing js frameworks?
20:37 PryMar56 joined #mojo
20:38 buu I'm strongly considering introspecting my mojo app in order to generate client side routing tables
20:38 kyshtynbai joined #mojo
20:38 buu But I suspect this might be a terrible idea.
20:38 ichi joined #mojo
20:40 batman buu: i'm doing that for my api, but then my api spec has the routing information and not mojo
20:44 preaction generally my app states don't match up very well to my backend api, so i've not yet tried to coordinate them
20:48 CandyAngel For now, I'll make the type options mutually exclusive I think
20:48 buu preaction: Do you serve html from your backend?
20:48 CandyAngel I can allow it later if it seems to be useful
20:48 preaction buu: not really, they're single-page apps
20:55 buu hrm
20:55 buu preaction: I am worried about supporting non highend-js clients by only serving javascript
20:55 buu I'd like to serve every page as html or js
20:56 preaction like, how low-end are we talking here, because JS is supported on most clients now
20:56 buu Like.. googlebot
20:56 preaction generally i go with one or the other
20:57 preaction i mean, is it a content-heavy site? if so, single-page app doesn't seem to be a good idea to me
21:00 buu hrm
21:11 CandyAngel <3
21:11 CandyAngel Mojomagic
21:13 buu I suppose that means I should actually design my ui first
21:13 CandyAngel Noooo.. gah, I locked up Leo again
21:14 CandyAngel It really doesn't like me using qr{} -.-
21:15 Grinnz_ buu: pssh, designing UI is for designers
21:26 CandyAngel I really like this interface, it's very "neat". Thanks for the input :)
21:38 cpan_mojo App-remarkpl-0.03 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-remarkpl-0.03
21:48 batman jberger: i'm competing with MojoSlides :) ^^
21:50 batman i wanted to bundle the whole thing in one file, but Mojolicious didn't like having https://metacpan.org/source/JHTHORSEN/App-remarkpl-0.03/lib/App/remarkpl/public/remark.min.js in the __DATA__ section
21:50 batman not sure why... mojo was complaining about wide characters :/
21:51 good_news_everyon joined #mojo
21:51 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8j4l
21:51 good_news_everyon mojo/master 96e8ace Sebastian Riedel: XML declarations are not actually processing instructions
21:51 good_news_everyon left #mojo
21:53 good_news_everyon joined #mojo
21:53 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8jBD
21:53 good_news_everyon mojo/master 5307d52 Sebastian Riedel: fix the same typo again
21:53 good_news_everyon left #mojo
22:11 till this line makes mojo stuck forever with 100% cpu; can someone reproduce this? MOJO_USERAGENT_DEBUG=1 perl -Mojo -E 'g($_) for qw(http://www.prenomenbois.com/ http://enteryourwebsite.../)'
22:14 preaction nope, works for me. though i did not use http://enteryourwebsite.../ as a url
22:15 preaction and the prenomenbois.com did not work
22:15 Zoffix joined #mojo
22:15 Zoffix till, confirmed
22:16 preaction okay, now it worked
22:16 Zoffix I'm on 32-bit system
22:16 till ok, thanks zoffix. is it a bug?
22:18 polettix joined #mojo
22:19 Zoffix till, possibly.
22:20 preaction might want to narrow down the reproduction. what does your `mojo version` say? does it work when sites aren't using gzip?
22:20 Zoffix Seems to freeze up (a) after a visiting http://www.prenomenbois.com/ (but not, say, http://www.zoffix.com/) ... and (b) after second request has invalid domain name
22:20 preaction does it fail only on specific sites? which?
22:21 preaction my invalid domain test times out eventually
22:21 till Perl (v5.23.1, darwin), Mojolicious (6.30, Clinking Beer Mugs)
22:22 preaction is MOJO_USERAGENT_DEBUG required for the freeze? your terminal might not be liking the result
22:22 till nope, freezes also without debug
22:23 Zoffix Time for Fallout 4 \o/
22:23 preaction woo!
22:23 till whats special about "prenomenbois.com"? with every other site it works
22:28 voldemortensen left #mojo
22:41 till I removed Accept-Encoding header and sent a HEAD request instead of GET; still freezes with 100% cpu http://pastebin.com/zmhVVhT0
22:41 Repaster Repasted text from till: http://fpaste.org/289899/14473680/
22:46 preaction till: that's not a real url, so whatever happens is not going to be "good"
22:48 till but why the freeze? I would except an error message like "Problem loading URL..."
22:53 till lol, this stucks, too   MOJO_USERAGENT_DEBUG=1 perl -Mojo -E 'g($_) for qw(http://www.microsoft.com/ http://enteryourwebsite.../)'
22:55 till and this, for example, works: MOJO_USERAGENT_DEBUG=1 perl -Mojo -E 'g($_) for qw(http://www.test.com/ http://enteryourwebsite.../)'
23:08 good_news_everyon joined #mojo
23:08 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8jpA
23:08 good_news_everyon mojo/master d0d09f9 Sebastian Riedel: fix a few small selector bugs in Mojo::DOM::CSS
23:08 good_news_everyon left #mojo
23:31 cpan_mojo App-remarkpl-0.04 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-remarkpl-0.04
23:31 good_news_everyon joined #mojo
23:31 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v4ekH
23:31 good_news_everyon mojo/master 72d0bc1 Sebastian Riedel: fix typo in comments
23:31 good_news_everyon left #mojo
23:37 disputin joined #mojo

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