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

IRC log for #mojo, 2013-11-13

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

All times shown according to UTC.

Time Nick Message
00:27 thomason joined #mojo
00:57 asarch joined #mojo
01:04 laouji joined #mojo
01:34 KindOne joined #mojo
01:41 d4rkie joined #mojo
02:01 d4rkie joined #mojo
02:11 basic6_ joined #mojo
02:44 duncanthrax joined #mojo
03:28 two_tired joined #mojo
04:05 russum left #mojo
04:06 Drossel joined #mojo
04:18 preflex_ joined #mojo
04:28 morzechowski joined #mojo
04:29 morzechowski hey, I'm new to Mojo. I'm rewriting a simple RUBY rest service to perl (dont ask why)
04:29 morzechowski I need to use ssl post and basic auth like here http://pastie.org/private/ouwxn2qwoanzjckpyxssvq
04:30 Kulag joined #mojo
04:30 morzechowski I tried to look into useragent doc, without success
04:31 morzechowski please help :)
04:47 laouji joined #mojo
05:05 johnny5_ joined #mojo
05:12 KindTwo joined #mojo
05:18 laouji joined #mojo
05:18 johnny5_ joined #mojo
05:20 beyondcreed joined #mojo
05:37 mire joined #mojo
05:41 johnny5_ joined #mojo
05:45 d4rkie joined #mojo
05:49 laouji joined #mojo
06:06 dotandimet joined #mojo
06:45 laouji joined #mojo
06:46 Britzel_ joined #mojo
06:49 highflying joined #mojo
06:58 cfedde joined #mojo
07:00 laouji joined #mojo
07:28 marcus heh
07:36 iSlug joined #mojo
07:49 dotandimet joined #mojo
07:56 dod joined #mojo
07:58 laouji_ joined #mojo
08:06 yannickberthoud joined #mojo
08:15 trone joined #mojo
08:29 dod joined #mojo
08:43 Adura joined #mojo
08:50 dpetrov_ joined #mojo
08:50 arthas joined #mojo
08:54 basiliscos joined #mojo
08:55 themage joined #mojo
08:59 alnewkirk joined #mojo
09:07 dod joined #mojo
09:18 fhelmber_ joined #mojo
09:45 dod joined #mojo
09:59 nicolaas joined #mojo
10:15 powerman joined #mojo
10:31 maxhq joined #mojo
10:35 denis_boyun joined #mojo
11:09 dod joined #mojo
11:15 dotandimet joined #mojo
11:27 batman joined #mojo
11:42 punter joined #mojo
11:47 d4rkie joined #mojo
11:55 iSlug joined #mojo
12:15 denis_boyun joined #mojo
12:16 hrupp joined #mojo
12:16 rem_lex| joined #mojo
12:29 iSlug joined #mojo
13:03 tholen joined #mojo
13:06 McS joined #mojo
13:07 McS Moin alltogether
13:11 burb joined #mojo
13:18 dod joined #mojo
13:19 burb guys, i put my mojo-app in apache as a simple cgi script on the begining, with ScriptAlias /somepath. how i can make my templates now to work as i started with /css/foo.css and now i need /somepath/css/foo.css?
13:20 burb is there some $app->home_url_path what i can define and use later?
13:23 McS leave
13:23 McS left #mojo
13:25 burb ok, i found a thread on google, use url_for or dedicated static file helper, thanks
13:26 D4RK-PH0ENiX joined #mojo
13:30 dod joined #mojo
13:45 r0b3rt joined #mojo
13:54 russum joined #mojo
13:55 sri oh shit
13:56 sri looks like the nsa did it... http/2 will likely be https only
14:06 powerman sri: hi. please take a look at http://www.9paste.net/none/822-859-1357
14:06 powerman what you think about adding such a helper $delay->cb?
14:07 powerman I think it's good idea because:
14:07 denis_boyun joined #mojo
14:08 powerman 1) less typing than ->begin, my $end, $end->()
14:08 powerman 2) no way to forget to call $end->() !
14:08 powerman 3) return values using usual 'return' instead of sending them into $end->()
14:10 powerman if you like it I'll try to prepare pull request on github, with tests of course - in a day or two, when I'll have spare time
14:10 sri i don't like it
14:12 ver joined #mojo
14:14 sri but adding anything to delays would be an uphill battle, i've fought hard to remove stuff and make them simpler over the last few months
14:17 powerman I'm completely agree about removing and simplifying, but sometimes it's worth to add more code to library to make user's code simpler and more robust.
14:18 sri it would have to be *a lot* better for me to like an idea
14:20 powerman I've similar thing to $delay->begin (related to acquiring/releasing resources) in my module, and I've even blessed returned coderef just to be able to detect (using DESTROY) when user forget to call $end->() - because such bug are very ease to make and very hard to detect later.
14:21 powerman proposed ->cb() make sure $end->() call will be executed, thus we'll have less bugs in user code
14:22 sri so far we've had no complaints whatsoever about that
14:23 powerman yeah, maybe I'm overengineering here
14:25 powerman or maybe you'll never get any complaints about this because a) some bugs never be found, and b) there is no sense to report bug in user's code to you… if user understand what's going on, of course
14:30 powerman btw, looks like mixing ->begin and ->steps using same $delay don't work now… and this isn't documented
14:35 groundnuty hey
14:35 groundnuty I'm new to Mojo. I'm rewriting a simple RUBY rest service to perl (dont ask why)
14:35 groundnuty I need to use ssl post and basic auth like here http://pastie.org/private/ouwxn2qwoanzjckpyxssvq
14:35 groundnuty I tried to look into useragent doc, without success
14:35 groundnuty any suggesiont would help
14:38 sri then you didn't look very hard
14:38 Adurah joined #mojo
14:39 groundnuty sri: ok, so its in useragent yes?
14:39 henq joined #mojo
14:39 henq left #mojo
14:39 moritz if you want to write a client, yes
14:40 groundnuty moritz: yes I need to querry a rest service by using ssl, basuc auth and post
14:40 groundnuty moritz: all examples as far as any authentication is concedned were based on GET
14:41 moritz groundnuty: it works just the same for non-GET requests
14:41 moritz also, not true
14:41 moritz # TLS certificate authentication and JSON POST
14:41 moritz right in the synopsis
14:43 groundnuty you are trying to tell me that if I just change get to post in
14:43 groundnuty $ua->get('https://sri:s3cret@example.com/search.json?q=perl') ->res->json('/results/0/title');
14:43 groundnuty it will just work?
14:44 groundnuty kinda expected/looked for other syntax for post
14:44 moritz well, usually when you post you also add some payload data
14:45 sri i'm afraid you have to forget everything you know about shitty documentation from ruby, and start with the assumption that everything you need to know is documented in perl
14:45 moritz but yess, putting username and password in the URL works the same for all request types
14:45 groundnuty sri: I'm not a ruby dev
14:45 asarch joined #mojo
14:45 groundnuty moritz: thx, I will try to make it work :)
14:46 bluescreen joined #mojo
14:47 sri then you should know better
14:47 sri http://mojolicio.us/perldoc
14:47 purl http://mojolicio.us/perldoc is probably lovely
14:47 thomason Is there a handy way to find out a sibling route from within a controller? So if I'm inside of /foo/list, I'd want to easily find /foo/view?
14:47 * sri pats purl
14:47 * purl stabs
14:47 thomason If I can get the current route, I could go $current_route->parent->find('view'), but, AFAIK I can only get the current route's name, not the object iself.
14:48 thomason Is there another approach I could take?
15:03 btyler joined #mojo
15:07 sh4 joined #mojo
15:19 kthakoreGimli joined #mojo
15:19 kthakoreGimli Hello
15:20 kthakoreGimli How do I handle route extentions? When I do get  'images/20/20/Marketing.png' => '/images/:w/:h/:image', $self->param('image') doesn't include the '.png' I only get Marketing
15:28 andrefs joined #mojo
15:39 thomason hey, actually, I've got another question about naming routes - do names -have- to be global, or is it acceptable to re-use them?
15:39 thomason I'm specifically thinking of having routes like /foo/view, /bar/view, /baz/view, and giving all of them the name 'view' so they can be found by their respective parents. Couldn't be accessed globally, of course, but I'd be okay with that.
15:39 thomason But I don't know if recycling the names would goof something up
15:44 fhelmbe__ joined #mojo
15:44 gryphon joined #mojo
15:47 priodev Hiya! I think I found and fixed a bug on EventEmitter, would you guys have a look? https://github.com/kraih/mojo/pull/563
15:48 priodev the failing test result: https://travis-ci.org/carloslima/mojo/builds/13918616  and the passing one: https://travis-ci.org/carloslima/mojo/builds/13918184
15:48 r0b3rt kthakoreGimli http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Relaxed_placeholders
15:51 mire joined #mojo
15:55 good_news_everyone joined #mojo
15:55 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/pGt6MA
15:55 good_news_everyone mojo/master 9325424 Sebastian Riedel: more links and correct precedence
15:55 good_news_everyone left #mojo
15:56 sri priodev: i don't think it's worth it, those perl versions are mostly legacy
15:57 sri i tend towards calling this a WONTFIX
15:58 priodev :-(
15:58 priodev I'm stuck on Squeeze
15:58 sri no excuse for not using your own brewed perl
15:59 priodev I use it, but the place where I need the fix is out of my control at this moment.
16:00 priodev sri, anyway, I understand your point, but was hoping it could get in.
16:04 sri oh, and now that my head is in the game, what you're doing is wrong
16:04 sri eval {...; 1} is the correct pattern, you are supposed to expect a clobbered $@
16:06 priodev sri, if you say, I'm inclined to believe you're correct, but I don't understand :-) Can you explain? On the use-case I have it shouldn't clobber (and it doesnt except for the 2 perls versions I mentioned)
16:07 priodev I believe you're talking about another scenario that is not in my head
16:07 sri your test case says "eval { deadly() };", that's shitty code
16:08 sri correct would be "... unless eval { deadly(); 1 };"
16:09 priodev that's the minimalist example. What I have is ` try { $apiclient->some_call } catch { ... }
16:09 priodev but on catch, I get an empty $_
16:13 sri i'm not the right person to discuss that with
16:13 sri https://metacpan.org/pod/Try::Tiny#Localizing-silently-masks-errors
16:15 kthakoreGimli r0b3rt: thanks!
16:16 kthakoreGimli hi sri!
16:16 kthakoreGimli sri: loving Mango so far!
16:16 sri \o/
16:19 thomason Is there a way to hop from a route object to the url it would generate? I've only found url_for in controller, but that only takes a route name, not the object itself (right?)
16:19 priodev sri, I think that is not the case (the error is returned, as you can see, it is used correctly on the emit)
16:19 thomason Naturally, this relates back to my earlier question about reusing names on subroutes, so I can't just call ->name on the route object as I pass it into url_for...
16:19 sri priodev: my point was, talk to the person who wrote that :)
16:20 priodev sri, I'm off for dinner, will be back later. I'd be more than happy to make any adjustment if that would help the patch go in.
16:20 priodev sri, that's a perl issue.. and it's fixed on perl 5.14+
16:20 sri i don't see any patch go in
16:20 sri we have idioms to work around it
16:33 good_news_everyone joined #mojo
16:33 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/_F-fLg
16:33 good_news_everyone mojo/master f8b4ce6 Sebastian Riedel: use eval idiom consistently
16:33 good_news_everyone left #mojo
16:34 sri except for this patch ;p
16:36 Oleg joined #mojo
16:39 Oleg Can anybody tell me why mojo hasn't non-blocking  dns resolver?
16:40 Oleg i think useragent can't be really non-blocking wthout non-blocking dns resolver
16:43 Oleg is it in principle do not include such feature in the core or we simply haven't good implementation?
16:44 Oleg as i see to implement such feature in separate module now i need to monkey patch Mojo::IOLoop::Client::_connect
16:45 Oleg not very beatiful
16:49 modred Which manual to read to deploy multiple apps to one apache server?
16:54 Oleg under mod_proxy?
16:59 denisboyun joined #mojo
17:03 beyondcreed joined #mojo
17:05 sri Oleg: we once had a non-blocking resolver, it sucked
17:06 sri best we can have in perl atm is about as good as the one from AnyEvent, which is simply not good enough
17:07 Oleg sri: in which way it sucked? :)
17:07 sri it's pure dns, which is often not desirable
17:08 sri no operating system specific extensions
17:08 sri a proper implementation requires real threads
17:09 sri so you can use the blocking getaddrinfo
17:09 Oleg and how about Net::DNS resolver? Is it also bad?
17:09 sri they all suck
17:10 sri imo the best we can hope for is a proper UV binding, which exposes the resolver too
17:10 sri s/UV/libuv/
17:11 Oleg Ok, and what you will recommend if I want to implement it now as separate distribution? Monkey patching for Mojo::IOLoop::Client::_connect?
17:12 sri i don't recommend anything, if you hack the internals you have to be prepared that things will break at any time
17:13 thomason Is there any sanctioned method to my questions about finding sibling routes? I'm really kinda stuck without it atm.
17:13 Oleg may be we need ability to extend such thing as resolving, to do not hack internals?
17:13 sri i'm open for ideas
17:14 Oleg ok, I'll think about it :)
17:14 sri looking into the future, it might make most sense to have such a hook on the Mojo::Reactor layer
17:14 sri and make it match the libuv api, considering that's the closest to proper Perl has
17:15 sri node.js too has tried pure dns and failed miserably, now libuv uses a thread pool that calls getaddrinfo
17:16 iSlug joined #mojo
17:18 punter joined #mojo
17:24 marcos yay, pure dns.
17:28 dod joined #mojo
17:29 kthakoreGimli hello. I am trying to do chunked resonse is there an event I can write the chunk to the client? Right now with a recurring timer it is waiting till finish to respond
17:33 kthakoreGimli I am currently doing: http://pastebin.com/raw.php?i=gCRqaQR0
17:45 priodev sri, I explained a bit more as well as giving an updated test case on https://github.com/kraih/mojo/pull/563 . Would you care to review?
17:47 sri priodev: think i've said everything that needs to be said
17:50 priodev sri, you said I wrote crappy code and that I could easily work around the issue, I wrote a test case showing that it is not true. I'm sure you would treat it differently if it was not a perl 5.10/12 only issue. Anyway, that's ok, though luck. Thanks for taking the time to discuss :-)
17:56 sri ah, you mean it's cleared by evals in DESTROY
17:56 sri should have said so
17:59 sri a) your patch is all wrong then, we would have to switch to a different idiom for *all* eval calls and b) i think it might still be a WONTFIX, due to it only being a problem with 5.10/12
18:01 dsteinbrunner would that mean the issue would be documented?
18:03 sri "Q: Why do errors i expect in $@ soemtimes vanish? A: This is a Perl bug and has been fixed in 5.14."?
18:04 dsteinbrunner something like that… priodev might have more to say about that ;-P
18:08 sri priodev: anyway, if you want an idiom change, then convincing another core dev would be a good first step
18:08 priodev sri, I think I mentioned the destroy part but maybe it was only mentioned in my head. I'm fine with a won't fix, it's nobody else's fault that I'm running an old perl :-) Would a documentation patch be considered? I can try to write something tomorrow with fresh eyes (too late here for me already)
18:09 priodev sri, that depends on how far you're willing to go for 5.12-- support. I guess I shouldn't hold my breath :)
18:11 sri the question is less about support and more about correctness now
18:11 mfontani joined #mojo
18:11 sri what is the correct eval idiom for the time being?
18:14 priodev as far as my understanding goes, what is used now is correct for 5.14+, but I could easily be missing some details
18:20 Britzel joined #mojo
18:21 good_news_everyone joined #mojo
18:21 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/tRJM5g
18:21 good_news_everyone mojo/master 37b3b00 Sebastian Riedel: small optimizations
18:21 good_news_everyone left #mojo
18:21 sri marcus, tempire, crab, jberger: which eval idiom should we use?
18:22 thomason I don't mean to keep butting in and trying to hijack conversation, but I'm really kinda frustrated trying to make this work. Is there a way to find a sibling route? (i.e., I'm in /foo/list and want to find /foo/view somehow). Is there a better place to ask? I thought the IRC channel was the best spot.
18:24 sri you could try the mailing list too
18:25 sri or if you want me to answer, help others first ;)
18:25 thomason hehe. I would if I could. :-)
18:27 priodev thomason, I would guess stackoverflow could give you fast answers :-)
18:28 priodev bed time for me, I'll check again tomorrow. I'm glad to help if there is anything I can do (another patch or documentation) :)
18:28 thomason I'm gonna give the mailing list a shot first. Closer target area before broadcasting out widely. But yeah, they're worth a shot too. ;-)
18:28 sri perhaps an FAQ like "What are the disadvantages of using Mojolicious with an older version of Perl?" might be appropriate
18:29 thomason "Disadvantage #1: You have an older version of Perl."
18:29 sri thomason: in the hopes that you will from now on try to help others i'll give you a hint http://mojolicio.us/perldoc/Mojolicious/Controller#match
18:29 dsteinbrunner I like that
18:30 dsteinbrunner the section on older perls that is
18:32 dsteinbrunner fi 5.10 is the defined requirement people expect that full consistent support will extended to it unless otherwise documented
18:33 sri thinking of a nice way to say "we fully support the latest two stable releases, and keep tests passing up to a certain legacy version"
18:35 sri since as we all know, only the two latest stable releases of Perl are maintained
18:35 sri perhaps a link to the policy would be nice
18:35 dsteinbrunner debian stable is currently at 5.14
18:35 sri and they have to maintain it themselves
18:36 r0b3rt CentOS 6 at v5.10.1
18:36 sri centos is a joke
18:36 dsteinbrunner they recently released a service that provides 5.16 though
18:36 dsteinbrunner http://developerblog.redhat.com/2013/09/12/rhscl1-ga/
18:37 dsteinbrunner https://en.wikipedia.org/wiki/CentOS#Add-ons_releases
18:37 dsteinbrunner just found that myself today
18:37 sri has centos actually backported the hash security fix?
18:38 thomason wunderbar. ->match looks useful. I'll poke around with that for a bit, tyvm.
18:38 dsteinbrunner and RHEL7 is supposed to be out this year
18:38 sri http://blog.booking.com/hardening-perls-hash-function.html
18:59 burb joined #mojo
19:01 lamcheg joined #mojo
19:05 sri http://pastie.org/8478218 # this is what i have
19:06 bluescreen joined #mojo
19:07 arteman joined #mojo
19:07 arteman hi there
19:07 purl que tal, arteman.
19:08 dsteinbrunner do you want this to be general or do you want to also starting listing specific issues as they come up, like this eval issue
19:08 arteman could someone help me with the question regarding inline templates?
19:08 dsteinbrunner that way it is easy to point back to and gives a dev more ammunition to request newer perl versions from admins, managers, etc
19:09 sri dsteinbrunner: not sure i want to list everything
19:09 sri but i guess a list might be useful here
19:09 dsteinbrunner no answer in 1 minute… give up
19:09 arteman joined #mojo
19:10 dsteinbrunner arteman: what is the question
19:10 purl the question is, like, still how I'd parse that
19:10 thomason It seems like bad marketing to me to put a list of issues people may encounter due to older perl versions. That could easily be misconstrued as problems in mojo itself, as opposed to problems due to the perl version it's running under.
19:10 sri dsteinbrunner: how would you explain it with one sentence?
19:11 sri "These are problems you may encounter when using legacy versions of Perl: ..."
19:12 thomason No, no, I get that. And I also see the utility in rattling off known issues with older perls to save people some hassle, I can just see it easily being misread and hence would be leery of it. It'd be easy to skip that first sentence, after all.
19:12 Mike-PerlRecruiter_ joined #mojo
19:12 thomason you also don't necessarily want a document that just rattles off bugs that've already been fixed in the interpreter.
19:13 arteman dsteinbrunner: is there a way to replace default ep templates or somehow modify them?
19:13 dsteinbrunner well again, many would say that there requirement for mojo is 5.10.x
19:14 * sri rephrases the FAQ
19:14 dsteinbrunner so effort should be made to have consistent support for it
19:14 arteman basically I want to prevent my output from being flooded by wide character in syswrite error, because it is trying to display some unicode in ep template
19:15 good_news_everyone joined #mojo
19:15 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/bdOAvA
19:15 good_news_everyone mojo/master 56f8ff1 Sebastian Riedel: explain which versions of Perl are supported
19:15 good_news_everyone left #mojo
19:17 dsteinbrunner arteman: you can use a plugin to change template systems: https://metacpan.org/release/PLICEASE/Mojolicious-Plugin-TtRenderer-1.50
19:17 dsteinbrunner like that one if you want TT
19:17 thomason "Mojo will work for the last two stable release series of Perl (currently 5.18.x and 5.16.x). It may work on older versions back to 5.10.1, but may not fully work properly. If you discover something that doesn't work on an older Perl, we may be able to fix it. Or we may not."
19:17 sri dsteinbrunner: that at least explains why support is not consistent
19:18 mfontani joined #mojo
19:19 mtj joined #mojo
19:23 sri https://github.com/kraih/mojo/pull/564 # is this worthy of supporting?
19:26 sri i like the detailed description
19:27 dsteinbrunner arteman: the issue you cite seems like it is a bug something like that so maybe you should ask more about that issue
19:27 dsteinbrunner of course maybe it is a good idea to see if it is still an issue if you use a different template system
19:27 dsteinbrunner sri: yes, seems well thought out
19:28 sri but there's also things he screwed up... like adding HTTPS=1 support without explanation
19:28 sri or test
19:29 ZadYree joined #mojo
19:29 dsteinbrunner well just because you have an issue, know the problem and can explain it does not mean you can patch it well
19:31 dsteinbrunner however it is fix it seems like it should be fixed
19:32 dsteinbrunner or rather, supported
19:33 tokuhirom joined #mojo
19:33 arteman dsteinbrunner: well, I'm just using utf8 characters and if app crushes it tries to render something like exception.development.html.ep, but placing a wide-character there causing a pain to syswrite, which, I suppose, is used in aforementioned template. I'm unable to catch an exception because of the flood of records "Write failed: Wide character in syswrite at /usr/lib/perl/5.10/IO/Handle.pm...
19:33 arteman ...line 207." And I assumed that customising those deefault templates will help me. Is that plugin working with exception* templates too?
19:33 mtj joined #mojo
19:35 dsteinbrunner I see… you don't want to replace the template system, just builtin templates
19:40 thomason match almost gives me what I want. I can use it to find the parent route, which I can then use to get at siblings. But I'm still having trouble generating a final URL from a route with a placeholder (e.g. '/foo/view/:id')
19:41 thomason I see two possible approaches - I can name all routes according to a common convention. So I have 'foo', then 'foo-edit', 'foo-list', 'foo-view', etc. I can find the parent's name, use it to construct the name of the child route, and then call url_for on that.
19:42 thomason Or, I can name children according to a standard set of names ('edit', 'list', 'view'), and use the parent route to ->find them. But then I end up with a route object as opposed to a unique name, and I don't think I can construct the URL directly from that. Or can I?
19:42 thomason I also end up with non-unique route names, and I don't know if that'll cause other problems for me down the line.
19:43 tokuhirom joined #mojo
19:43 thomason Personally? I prefer the second option because it spares me from external construction of specially formatted names as lookup keys. But it may be the best approach. Any thoughts? Is there a better way to do it I'mn ot seeing?
19:44 dsteinbrunner arteman: do you have a condensed sample that would show the issue you are having
19:44 dsteinbrunner seem like if this is something that is fixable it would be better to fix it than override the template
19:45 dsteinbrunner unless your goal is to override it that is, but that is not my impression
19:47 charsbar___ joined #mojo
19:47 arteman of course by goal is to fix the problem, but I couldn't catch it in morbo log because of great flood
19:48 arteman could I somehow forward morbo output into the file?
19:48 dsteinbrunner maybe… you could use a pastebin service
19:48 arteman I've tried morbo ./script/app >out but failed
19:49 dsteinbrunner but even better would be a mojo app the would reproduce the issue if run by someone else
19:49 dsteinbrunner if possible
19:50 highflying joined #mojo
19:50 arteman the problem is not to reproduce, the problem is how to prevent from being flood, but let me think on how to give an example
19:51 dsteinbrunner if someone it able to reproduce the flood they could hopefully help with the flood
19:52 dsteinbrunner think of the word flood too much and it stops making sense ;-P
19:52 sri stop flooding!
19:53 dsteinbrunner arteman: your issue should be fixed, sri just made it so
19:54 r0b3rt Mojolicious::Plugin::Sandbags
19:54 arteman lol
19:54 sri morbo doesn't respect my authority :(
20:13 basiliscos joined #mojo
20:22 marty DOOOOOM!
20:37 iSlug joined #mojo
20:38 thomason Am I missing something here? I'm trying to add an alternation to a placeholder, so I've got this: $r->get('/:id', id => [qw(3 4 5)])->to(...);
20:38 thomason But it doesn't work. If I drop the alternation, all IDs work. If I have it in there, nothing does. not even 3, 4, or 5. What am I goofing up?
20:40 sri where did you see that documented?
20:41 thomason http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#More_restrictive_placeholders
20:41 sri that doesn't use ->get
20:43 thomason Ahh. I can rewire to use ->route('/:id', id => [qw(3 4 5)])->via('get')->to(...) and that does work.
20:43 thomason But, that creates the follow up question...why doesn't just calling ->get() work? I thought it was equivalent to calling ->route, but restricted to only get requests.
20:43 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#More_convenient_routes
20:45 bluescreen_ joined #mojo
20:47 thomason But all that says is that ->get is a convenience wrapper over what was previously written. To me, that reads like it's a shortcut for ->route(...)->via('get'), but it isn't.
20:47 thomason Also, the example explicitly shows 'any' accepting a restriction on the format, and a few tests right now indicate that that doesn't actually seem to work. :-(
20:50 sri it 100% works
20:55 basiliscos joined #mojo
20:56 thomason I stand corrected, that was a bug in my test code.
20:56 thomason But why make a distinction between adding restrictions on routes generated with ->get vs ones with ->any?
20:58 thomason Wait, no it does not work. This route: $r->any('/:id'); will match any ID successfully. This route: $r->any('/:id', id => [qw(3 4 5)]) won't match anything.
20:58 thomason I have to create it with $r->route('/:id', id => [qw(3 4 5)])->via('get')
21:00 thomason I'd lobby that ->get, ->post, ->any should accept restrictions as well, but if they don't then at a minimum the docs should be clarified that alternations can only be given to the ->route constructor.
21:02 sri that's impossible
21:03 sri it's puzzling to me how you're missing why
21:03 sri thomason: did you read the lite tutorial?
21:04 thomason what specifically is impossible? that the restricted any call is failing or calling ->get with a restriction is impossible?
21:05 sri i better leave now, or i might start yelling :)
21:06 thomason c'mon, I'm not trying to be obtuse. I can see in my test cases that when I tack on a restriction to the ->any call, it no longer works. Despite the docs. I can simplify and package it up and send it out if desired.
21:06 thomason For the get constructor, couldn't it hypothetically be implemented like this: http://pastebin.com/pFz5qyH1
21:07 thomason If it's just a shortcut wrapper. If it's not, then I'm trying to understand what the differences are between the two constructor methods.
21:07 thomason (bbiab...gotta run out for a few)
21:15 keedi joined #mojo
21:16 lukep joined #mojo
21:24 highflying Anyone have some good pointers for decent authentication on a RESTful API written with Mojo?
21:25 marcos thomason: it doesn't/can't work that way because $r->get() is what ::Lite's "get '/foo' => …" syntax uses internally.
21:26 marcos thomason: i remember making the same mistake long ago (writing ->get('/:foo', foo => …)), but if you look at what Lite needs, you'll see it can't do that.
21:27 kanishka joined #mojo
21:28 marcos thomason: just use ->route()->via('get') if you're using restrictive placeholders.
21:30 kanishka hey
21:30 kanishka any perl based search engine ?
21:31 marcos yes, that's what i am. how can i help you?
21:35 kanishka I am looking for an alternative of ElasticSearch
21:36 punter joined #mojo
21:44 dsteinbrunner kanishka: what is the issue with ElasticSearch?
21:45 dsteinbrunner do you just want something to create indexes from a data store?
21:46 kanishka we need a custom build, indexer , just a small set of datasample around 10k titles
21:46 kanishka elasticsearch i have to learn it again
21:46 kanishka we didn't have much of support
21:49 dsteinbrunner so something that interfaces with Lucene or Swish-e or the like
21:50 sri mongodb also has full text search
21:50 dsteinbrunner yeah, if your looking for a datastore also
21:53 kanishka sri : currently we are on MongoDB, speed of search is be increased, looking for in-memory based search engine
22:02 marty full text in mongo is pretty nice.
22:03 marty sri: btw, your full text search example works like a charm.  And now that I understand how bson_doc works I'm getting into lots of trouble.  :p
22:04 sri :)
22:13 thomason I still say there's a doc bug and that routes created via ->any don't accept alternations. Here's my test app: http://www.japanesewartuba.com/alt_fail.tgz  You can just launch it and go to the root page, and it'll list sample routes to go to, and detail which ones fail and which succeed.
22:27 preflex joined #mojo
22:41 thomason I think what trips me up so much about these shortcut routes is that the docs imply that they're syntactic sugar, and I don't think that's the case. They're really just the exposure of the Mojo::Lite methods for purposes of cross-compatability. I'd suggest either updating the docs to reflect that and dissuade devs from using them for full mojo work, or show an explicit conversion of what can and cannot be done th
22:41 thomason rough them.
22:42 marty thomason:  I glanced at your example and I think you may be confusing lite syntax with full app syntax.
22:43 thomason Nope. Check the docs here: http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#More_convenient_routes
22:43 thomason That is explicitly listed as valid syntax.
22:45 marty yep.  I glanced to fast.  ignore me.
22:45 thomason Frick. Nevermind. I am in error.
22:46 thomason It is valid syntax to add alternations on the any routes (as well as on a get route, FWIW), but the alternations must be passed in an arrayref, NOT as key/value pairs as they are when passed into the ->route() constructor.

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