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

IRC log for #mojo, 2017-01-12

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

All times shown according to UTC.

Time Nick Message
00:36 asarch joined #mojo
02:48 stryx` joined #mojo
03:02 froggie joined #mojo
03:04 froggie I have a question regarding Mojolicious. I am confused as to the reason for $app->startup;. What does this do and is it always necessary? In my lib/TestApp directory, I have TestApp.pm which has sub startup { ... } and the comment says, "This method will run once at server start". Is $app->startup; needed inside this sub?
03:08 jberger froggie your question is a bit confusing
03:08 jberger You never need to call the startup method on your own
03:09 jberger You do however need to call app->start at the end of a lite app (only)
03:12 froggie Oh, I see. So it's only for a lite app.
03:12 froggie OK. That's great. I'm not using a Lite app.
03:13 froggie Thank you for that answer. Now my next question is probably going to be more confusing still. But we'll see.
03:15 Grinnz app->start is different from app->startup
03:16 Grinnz the startup method is called by Mojolicious itself so you should never be calling it
03:16 froggie OK Great. Thank you.
03:16 Grinnz ->start runs the event loop, which usually runs the startup method shortly afterward
03:16 Grinnz but that's the only relation
03:18 Grinnz er rather i should say in a lite app, there is no "startup" method, instead you put that code before app->start
03:18 froggie My next question is as follows. This has always confused me, so if you can answer this, it will *really* help me. Inside of sub startup {...} I have got a route to a routine inside of TestApp/Controller/SomeFile.pm In order to actually render, I then need to call $self->render and return to the subroutine. If I don't return, I don't get a render ...
03:19 froggie ... is that correct? If so, how do I handle errors? Or, better still, how do I handle renders without returning?
03:19 Grinnz returning from actions doesn't matter. usually, you return in order to avoid running the rest of the action once you've rendered
03:19 Grinnz so it's like a "break out of the action" step
03:20 Grinnz perl subroutines return once there's no more code to run regardless
03:20 froggie However, if I don't return, what do I do? I cannot call die. That is for sure.
03:20 Grinnz aand the return value of action methods is ignored
03:20 Grinnz (unless it's an under)
03:21 Grinnz you don't need to do anything, unless you want to prevent the rest of the action from occurring, in which case you should return
03:21 preaction what are you trying to achieve? what do you mean by "not returning"?
03:21 froggie The problem I am having is that I am six layers deep into a subroutine, and I want to say something --- let's say display a user input error message on the screen. I don't want to have to return out of all of those layers.
03:21 Grinnz subroutines always return, unless there is an exception or some sort of stack mangling
03:22 Grinnz ah, well that's a different problem
03:23 Grinnz the simplest way i've found is to throw an exception object (such as one based on Throwable) and then catch exceptions at the top level, check for my custom exception class, and if so render and stop the action
03:24 froggie I've actually been calling die and putting the whole mess in their, headers, footers, and all. And it works great, too, but it prints to STDERR. Which I don't want.
03:25 Grinnz yes, so that's what the catch part is for
03:25 Grinnz use Try::Tiny
03:25 Grinnz or if you're on 5.14+, Syntax::Keyword::Try
03:26 froggie Yes, I think it's 5.20 or so.
03:26 Grinnz that lets you use the exception just to "escape" all the levels until the point where you catch it
03:26 Grinnz after which you can check for it with something like: if (blessed $@ and $@->isa('My::Exception::Class')) { ... }
03:27 Grinnz (blessed from Scalar::Util)
03:27 Grinnz you can even have the exception class store that data you need to render, or you can have it as a simple indication that rendering has already happened
03:29 Grinnz the reason why you wnt to use Syntax::Keyword::Try if it's possible is because that lets you put the 'return' directly in the catch block
03:30 froggie So I just checked it out and basically you are saying that try will get me up to the top, and catch will catch any exceptions. And what happens to what I return? Who reads that or where is that accessible? (Sorry for the stupid question.)
03:31 Grinnz the return value is ignored
03:31 froggie So in mojo it's ignored, but could be used in some other application, basically. So I can just return period without anything returned.
03:31 Grinnz so just either render and then throw the exception, or throw the exception and have the catch block render, either way you want to return to end the action after that
03:31 Grinnz sure
03:32 Grinnz the only time the return value is significant is if it's an 'under' action, where the return value indicates whether it should continue to the next action
03:32 froggie OK. I'm going to give that a shot and see what happens. I'm impressed by your speed always in answering. THANK YOU!
03:33 Grinnz i should maybe write up a blog post about this or something... maybe when i dont have 90 other things to do :)
03:33 froggie I mean if that works, my life will be "greatly enhanced" .... "-)
03:36 froggie One more question. If I run **everything** through try/catch, is that going to pose some issue or slow things down? Should I try and return if it's easy, to the top layer, or can I just pass everything through try/catch? If so, it seems like the simpler approach.
03:37 Grinnz it won't slow things down no. but make sure you rethrow errors which don't match your exception class (die $@)
03:37 Grinnz so that they affect mojo as normal
03:38 Grinnz how much you want to use exception objects for is up to you. I mainly just do validation errors and thats it
03:38 Grinnz it's up to how much the code will make sense
03:39 froggie I think you confused me when you said, "rethrow errors" ... are you saying that if I used try/catch it will necessarily use a different template or treat it differently than if I just return at the top level?
03:39 froggie I know die will do that, but I'm not calling die w/ try and catch.
03:41 pink_mist now you're not making any sense .... die is what creates an exception for try/catch to catch in the first place
03:41 froggie ooooooooooh. glad I asked.
03:41 pink_mist if the exception in question isn't one you should handle, you need to throw it again
03:41 Grinnz die throws an exception, which traverses up the call stack until it's caught by something. if it isn't caught by anything it aborts the program
03:41 Grinnz Mojo normally catches exceptions if you don't
03:41 Grinnz (and puts them in the error log)
03:42 Grinnz by rethrowing them, you're sending them to that exception handler that normally handles them
03:42 Grinnz if you don't rethrow them, you've ignored that exception and code continues
03:43 Grinnz when you use an exception object based on Throwable, the ->throw method calls die for you
03:44 Grinnz so it's basically just a way to put context in an exception in an organized way
03:46 Grinnz in your top level action, you have a try/catch block; in the try, you call the code that may throw an exception object. in the catch, you check if the exception is your exception object; if so, you handle that then return from the action. if not, you rethrow the exception
03:46 Grinnz either way, the catch will end up aborting the action, just in different ways
03:47 Grinnz if no exception was thrown catch won't be run, so the action will continue
03:47 Grinnz there, that's enough material to copy paste into a blog probably :P
03:48 jberger Hahaha
03:49 froggie Interesting.
03:49 froggie And I'm reading every word.
03:49 jberger froggie most of this is common to perl and isn't mojo specific
03:50 jberger The mojo bit is that mojo already has an exception catch which renders a 500 page if the application doesn't handle an exception
03:51 jberger Personally i don't use exceptions to escape up multiple levels in the call stack
03:51 jberger I just return at multiple levels
03:51 jberger But yes that can be tedious
03:52 Grinnz there is also Return::MultiLevel and such but that is a lot scarier than exceptions
03:52 * jberger runs and hides
03:54 froggie The thing is, as much as I hate to use exceptions to handle this, there are cases where the code is just so embedded, and I've got more than 1200 packages .... so you see .... gotta do something.
03:54 Grinnz it is a nice way to keep your error handling restricted to only the main action and the place where the error actually happens
03:54 Grinnz rather than everywhere in between
03:55 Grinnz which is the main benefit of using exceptions in general, not just for this
03:55 froggie Grinnz : it's always called by die right?
03:55 Grinnz called?
03:56 Grinnz exceptions are always thrown by die somewhere, if that's what you mean; but the die might be hidden somewhere
03:56 froggie right. of course.
03:56 Grinnz for example, 5/0 throws an exception
03:56 froggie right.
03:56 froggie so you're saying to set a global flag when I want to call my special routine inside of catch.
03:57 Grinnz no
03:57 Grinnz that's what testing for the exception class is for
03:57 Grinnz if (blessed $@ and $@->isa('My::Custom::Exception')) { then you know it's an exception of that class, and can handle it appropriately
03:58 Grinnz you can define as many exception classes as you need, based on Throwable
03:58 Grinnz to handle them differently
03:59 Grinnz (the Throwable synopsis shows Moose, but unless you're using Moose already then you can just use Moo instead)
04:00 Grinnz the beauty of that is you can then define your own Moo/Moose attributes in that exception class, and store data in the exception itself when you create it
04:05 froggie Will Syntax::Keyword::Try create the exception classes, or should I use something like Exception::Class?\
04:05 Grinnz no, you create them yourself, thats what i was mentioning Throwable for
04:06 Grinnz Throwable::Error is more like Exception::Class, it's just a class based on Throwable that has a message attribute and a stack trace
04:06 Grinnz you can make a subclass of Throwable::Error, or you can make a class that consumes Throwable directly
04:07 Grinnz Exception::Class is nice too as you can declare them inline, but I like the flexibility of Moo objects
04:07 froggie What is the lightest and easiest one to use?
04:08 Grinnz Exception::Class
04:08 purl i think Exception::Class is slow
04:08 Grinnz lol
04:08 Grinnz purl: forget Exception::Class
04:08 purl Grinnz: I forgot exception::class
04:13 disputin joined #mojo
04:13 Grinnz The only thing with Exception::Class is you'll have to define your exception classes somwehre common to all the modules that want to use them
04:14 Grinnz whereas with Throwable based classes, you have them in separate modules so you can use them wherever they're needed directly
04:29 froggie Hey guys thank you so much.
04:30 froggie I'm now looking into all this and we'll see what happens. I'll use Moo + Throwable + either Tiny::Try or Syntax::Keyword::Try.
04:30 pink_mist it's Try::Tiny, not Tiny::Try
04:30 froggie Any further suggestions or examples would be welcome, but you're done your part and I just need to do a bit of studying on this. Thanks.
04:31 froggie Oh ... Try::Tiny, and not Tiny:Try. Thanks.
04:37 lluad joined #mojo
05:04 dboehmer joined #mojo
05:15 bc547 joined #mojo
05:55 inokenty-w joined #mojo
05:59 froggie joined #mojo
06:02 froggie I was chatting a bit before about exceptional handling in mojo, which I'm very new to (in general). So I'm now using Moo, Throwable, and Syntax::Keyword::Try in Mojo. It's working. But there is one issue. I'm not sure how to access the parameter "attr" in the following example, in the exception handling routine: Something::Throwable->throw({ attr => $value })
06:02 froggie * sorry, that should read "exception handling" and not "exceptional handling."
06:02 Grinnz $@->attr
06:02 Grinnz you have to define that attribute in your Throwable class
06:02 froggie Oh. That easy.
06:02 Grinnz such as 'url' in the Throwable synopsis
06:06 lluad joined #mojo
06:11 froggie Here is how I'm calling that ... It's still not returning the expected result: http://mibpaste.com/Sp9F14
06:12 Grinnz you can't interpolate a method call directly
06:13 Grinnz you could do my $url = $@->url; then interpolate $url, or you could use the silly method: "@{[@$->url]}"
06:13 Grinnz whoops, typod $@
06:17 froggie That is awesome. You saved the day. THANK YOU! (I probably have to go to bed now Zzzzzzz.)
07:06 Vandal joined #mojo
07:06 dod joined #mojo
07:13 dod joined #mojo
07:31 jabberwok joined #mojo
07:46 janl joined #mojo
07:55 AndrewIsh joined #mojo
08:16 howitdo joined #mojo
08:36 tyldis_ joined #mojo
08:40 trone joined #mojo
08:53 tyldis joined #mojo
08:58 sri we can't just break stuff folks... you have to give us good reasons! https://github.com/kraih/mojo/issues/1033#issuecomment-272039906
09:00 kes joined #mojo
09:01 batman sri: when will 7.18 be available? anything i can do to help?
09:03 sri already released
09:09 sri and we now have windows CI testing https://ci.appveyor.com/project/kraih/mojo
09:10 sri for cygwin and activeperl until haarg gets around to fixing strawberry support
09:12 HtbaaPi joined #mojo
09:16 batman wow! how did i miss out :(
09:38 bc547 joined #mojo
09:42 tyldis Bug in Mojo::URL, I believe (see final comment): https://github.com/Nordaaker/convos/issues/315
09:53 kwa jberger: Thinking about adding a dummy Test::Mojo::Role::Rollback for use with Test::Mojo::WithRoles so there's a single $t->rollback point to reset state in certain cases. It doesn't work as nicely as I'd like, but would appreciate input if you get time -- https://gist.github.com/kwakwaversal/2dbaec33edbc590599bd7c62b39ced00
10:03 rshadow joined #mojo
10:11 rshadow joined #mojo
10:11 ksmadsen tyldis: slashes should be pct-encoded in userinfo according to RFC3986 appendix A
10:16 tyldis ksmadsen: You are correct and that works. So no error on Mojo::URL's part. Thanks
10:17 batman kwa: that's a lot of code... i don't see the reason for it
10:20 rshadow joined #mojo
10:40 kwa batman: A lot of code? It's a full test to show what I'm trying to do.
10:40 kwa Which bit do you think isn't necessary? As I said, I'm open to input.
10:44 kwa batman, jberger: What I am "trying" to achieve is to remove a lot of the test boiler plate at $work. Every test is intended to be run independently, which means there's a requirement to create a dummy organisation and user for each test, which changes state. I thought it might be nice to have a rollback/teardown role that can be used across multiple test roles which need to revert some kind of state. Might be a
10:44 kwa stupid idea... :)
10:49 sri i don't get this... you just patch stuff in mojolicious and don't even try to get it merged :S https://github.com/kraih/mojo/issues/1033#issuecomment-272131680
10:54 sri dboehmer: well, i'm assuming you two are happy with the current solution and the topic is resolved
11:02 dboehmer sri: are you joking? I didn't feel like coping with your lawyer requirements yet but I am still confident Mojo::URL doesn't behave as it should. One can design an API in different ways but given the short descriptions in POD the exception for fragment is inaccaptable. I will reply in this GH issue as soon as I find time to compile an attorney's speech for you to understand the problem.
11:08 sri dboehmer: there is no need to be rude... from now on please go through other members of the core team first
11:17 tchaves joined #mojo
11:20 castaway lo.. where would I find docs on the $c object and its methods? ->param etc ... ?
11:22 dboehmer castaway: https://metacpan.org/pod/Mojolicious::Controller#param
11:22 rshadow joined #mojo
11:23 tyldis joined #mojo
11:23 castaway ta
11:29 rshadow joined #mojo
12:00 asarch joined #mojo
12:15 kes castaway: http://corky.net/dotan/programming/mojolicious-request-parameters-example.html
12:15 kes here interesting resource too
12:26 gregf_ joined #mojo
12:47 jberger kwa the safest way to do something like that is to have throw away databases
12:47 prajith joined #mojo
12:47 jberger the Mojo::Pg docs show how that can be done
12:48 rshadow joined #mojo
12:49 jberger Your way will probably work too, that's start a transaction and then roll it back at the end of the test
12:50 lluad joined #mojo
12:50 jberger But it does mean effectively one test at a time
12:55 jberger dboehmer "lawyer requirements"?
12:55 jberger dboehmer: url handling is pretty central to the web, I'm sure you'll agree
12:56 jberger I'm sure many of our users have code deployed that depends on every behavior in Mojo::URL
12:56 dboehmer dboehmer: this was meant metaphorically and not linked to actual legal issues.
12:56 dboehmer jberger:
12:57 jberger So while you know that the Mojolicious project is willing to make breaking changes there has to be a solid reason
12:58 jberger We are aware of 2 of the alexa top 100 sites using mojo, for example
12:58 jberger If we break their code and they ask why, we'd like to say "because this spec here said so" not "because dboehmer just wouldn't stop yelling"
12:59 jberger I don't think that's too much to ask
12:59 dboehmer jberger: thank you for taking time to explain that in detail. can we discuss that in query?
13:02 jberger I'm getting ready for work
13:02 jberger I'd rather not
13:03 jberger Unless you think the code of conduct has been violated, in which case anyone is always welcome to message me privately of course
13:04 dboehmer sorry, is ok
13:15 kwa jberger: To be honest, it is being used with Test::PostgreSQL. But the resetting state thing was more conceptual. I was wondering if there was a better way to do it, rather than having to explicitly include ::Role::Rollback when calling Test::Mojo::WithRoles. I would prefer each role that *needs* to rollback(), use "with 'Test::Mojo::Role::Rollback';" to inherit the method, then modify it. I can't get it to work
13:15 kwa , but not sure if that's down to my lack of knowledge of Role::Tiny, or that it's just not possible.
13:16 kwa s/modify it/class modify it/
13:28 zivester joined #mojo
13:45 batman kwa: have you looked at DBIx::TempDB ?
13:48 kwa batman: Cheers. Test::PostgreSQL works quite nicely tbh. It's more a single method for returning state I'm after. For example, a Test::Mojo::Role::* might create a temporary file. A 'rollback' method on the role could be called to remove it at the end of the test.
13:49 kwa s/returning/resetting/
13:50 kwa Oo you wrote DBIx::TempDB. :)
13:52 batman kwa: DBIx::TempDB require an already running instance of pg. This is by design, because i'm pretty sure that speeds up the test run
13:55 kwa batman: Yeah, it will do. Here prove isn't called directly, more a script wrapper around it which creates a new Test::PostgreSQL and then runs App::ForkProve->run(@ARGV).
14:19 Pyritic joined #mojo
14:20 gizmomathboy joined #mojo
14:50 Pyritic joined #mojo
15:14 kes joined #mojo
15:28 sri jberger: did you ever get around to debugging Mojo::Pg::with_temp_schema? https://github.com/kraih/mojo-pg/commit/dd474cd7ba85584d08a94ef185137dd69814e926
15:35 mcsnolte joined #mojo
15:36 zivester joined #mojo
15:40 jberger sri: I hadn't gone back to it, you made it pretty clear that the idea was dead
15:41 sri jberger: yea, i've calmed down now :)
15:41 jberger I'd be happy to look/discuss
15:42 disputin joined #mojo
15:42 jberger in fact, I didn't know what caused you to nuke it in the first place
15:42 sri i'll consider it again if it works flawlessly
15:42 sri stuff exploded
15:42 jberger I've been playing with something in my own code
15:42 jberger let me post it to a private gist and show you
15:43 sri show me all your trade secrets
15:44 jberger all my trade secrets are belong to me :-P
16:02 PryMar56 joined #mojo
16:03 karjala Can a TCP server made with the Mojo framework upgrade its connection to TLS *after* some data has been exchanged through the connection?
16:03 karjala or does the connection need to be TLS from the beginning?
16:07 vicash karjala: the best way is to do TLS from beginning but if you really want to do it your way, then have one route that does non-TLS and then redirect to another route that is supported only on TLS. you might have to use a before_hook to make sure the scheme is https and use a reverse proxy to force TLS on certain routes
16:07 karjala vicash: I'm not talking about web servers here, so I think routes do not apply to me, do they?
16:08 karjala vicash: I'm talking about making an XMPP server (a Jabber server), where upgrading to TLS later is required by the protocol.
16:08 vicash sorry, no idea then.
16:09 vicash why not use ejabberd ?
16:09 karjala I might (I might use Prosody)
16:09 karjala But I want something tightly integrated with my perl website
16:11 asarch The "Foo" restaurant wants to go on-line, and for that they will need a web application. So far, I can track the dishes they prepare, the list of its costumer, the dishes available for the menu of the day and their order
16:11 asarch However, how could you track the list of the dishes for an order?
16:11 asarch This is the PostgreSQL code so far: http://pastebin.com/3ZirY93q
16:12 asarch How can you create a reference to a table which is actually a 1 to n relation of other two tables?
16:14 vicash karjala: AnyEvent::XMPP ?
16:14 purl hmmm... AnyEvent::XMPP is a weird combination of good and bad
16:14 karjala I think that's a client-side, not server-side library
16:15 karjala I was hoping to use Mojo framework instead of AnyEvent
16:23 sri karjala: client side it is supported, server side not
16:23 sri we need that for https proxy servers in Mojo:UserAgent
16:24 karjala I don't remember whether the XMPP protocol requires it client-side or server-side
16:24 sri if its like smtp, then prolly both
16:24 karjala yes
16:25 sri actually, i think you might even be able to reuse the client code :)
16:26 sri accept a socket with Mojo::IOLoop->server and then pass that socket into Mojo::IOLoop->client with tls upgrade instructions
16:26 sri haha
16:27 sri that could actually work
16:28 karjala I'd rather use a supported method, to be more future-proof
16:28 sri Mojo::IOLoop->client accepts a handle argument for that purpose
16:28 karjala So if you plan on implementing it server-side, I'd rather wait
16:28 sri i mean, it's supported on the client side
16:28 karjala ok
16:29 karjala But you plan on doing it someday, right?
16:29 karjala the server-side i mean
16:30 sri maybe, no plans
16:32 sri like i said, the handshake code is so similar in the client and server, i'd just expose the Mojo::IOLoop::Client code with a more generic name
16:32 sri i mean, both sides just call IO::Socket::SSL->start_SSL with a few options
16:33 sri and check $IO::Socket::SSL::SSL_ERROR until there is no more reading/writing going on
16:33 sri it's the same, and super trivial
16:33 sri just look for yourself in Mojo::IOLoop::Client and Mojo::IOLoop::Server
16:34 sri heck, i'd prolly not even add it as a feature... but a simplification of the code
16:35 sri if you could extract the handshake code from both, and put it somewhere neutral, so both can share it, i'd prolly accept the patch
16:36 sri with a little creativity you might even end up with less code than before
16:36 karjala I'm not good with patches, because I write messy code, sorry.
16:36 dikim joined #mojo
16:36 karjala I don't know where to place each piece of code, can't think of module names, etc
16:36 sri who knows, maybe others want the feature too
16:37 sri you can link to this in the irc logs if you find someone who can do it ;)
16:37 karjala hm
16:43 disputin joined #mojo
16:44 sri call it Mojo::IOLoop::TLS
16:45 sri have a method to start the handshake process $tls->handshake($socket, {some => 'options'})
16:45 sri and emit an event when done
16:45 sri there, designed your api ;p
16:46 sri don't overthink it, base it on the other two modules, unify the upgrade functionality so both can use it, and done
16:47 sri would take me prolly two days with good tests
16:56 good_news_everyon joined #mojo
16:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vMz7K
16:56 good_news_everyon mojo/master cb5a52e Sebastian Riedel: mention the argument passed to default value callbacks
16:56 good_news_everyon left #mojo
17:06 Pyritic joined #mojo
17:12 ferreira joined #mojo
17:31 ferreira joined #mojo
18:09 rshadow joined #mojo
18:09 sri oh, looks like appveyor gets included in the github ui https://github.com/kraih/mojo/commits/master
18:10 sri click on the red cross
18:10 jberger woah
18:11 jberger so microsoft must have paid something for that
18:12 sri i don't think microsoft owns appveyor
18:15 sri someone needs to open a pull request :)
18:16 blonewolfs joined #mojo
18:16 jberger even if they don't own it, don't you think they'd want better github integration for windows testing?
18:16 good_news_everyon joined #mojo
18:16 good_news_everyon [mojo] kraih deleted mojo_file at 0afb80b: https://git.io/vMgew
18:16 good_news_everyon left #mojo
18:17 * genio still wishes AppVeyor would work with strawberry
18:17 good_news_everyon joined #mojo
18:17 good_news_everyon [mojo] kraih deleted mojo_file_strings at fa2188d: https://git.io/vMgeo
18:17 good_news_everyon left #mojo
18:18 sri haarg said on twitter that he wants to fix that
18:18 genio we need a plenv for windows.  pshenv
18:19 genio It seemed from what I glanced at that they would use strawberry if the chocolatey package manager had working strawberry installs and they seem eager to get a maintainer for those
18:24 haarg it should be pretty easy to disable the checksum requirement
18:25 genio now Netflix has just quit trying... iBoy?
18:31 rshadow joined #mojo
18:31 lluad How could a superhero origin story based on "hit on the head with a cellphone" go wrong?
18:37 dod joined #mojo
18:42 kes interesting. Is it possible to put DBIx::Class::Result::User into MyApp::Plugin::Users (Mojolicious::Plugin)
18:42 kes ?
18:54 jberger kes: sure, plugins are very free-form
18:57 kes Is anywhere examples for this case: Mojolicious::Plugin which supply access to DBIx::Class resultset
18:58 preaction wouldn't that just be a quick helper: $app->helper( user => sub { shift->app->schema->resultset( 'User' ) } );
18:59 preaction assuming app has schema => sub { My::Schema->connect( ... ) };
19:05 Janos joined #mojo
19:11 sri genio: naah, they just want to buy everything they can i guess
19:11 sri i mean, the oa was total garbage too
19:16 preaction glad someone else thought that about OA :p
19:38 kes preaction: How DBIx will know to look for 'User' shchema at Mojolicous::Plugin::User::Schema
19:38 preaction why would it look there? why is there a schema just for a single table?
19:39 preaction schemas aren't mojolicious plugins, they're DBIx::Class::Schema objects
19:39 kes because of this is plugin which supply helpers and model
19:39 preaction and schemas load resultsets. so you need a My::Schema::ResultSet::User class
19:39 preaction right, why?
19:39 purl right, why is it /thingy/v1 and not /v1/thingy
19:39 preaction shut up, purl
19:39 * purl goes on and on about how much shutting up she's doing
19:40 preaction hate that bot so much...
19:40 * sri hugs purl
19:40 * purl nibbles sri's elbow
19:40 preaction kes: you could certainly move the $app->helper() thing I did into a plugin's register() sub, but why do you need that indirection?
19:51 kes preaction: To create standalone distribution which will be reused by different apps
19:53 preaction presently, i only make my schema into another dist. my mojolicious apps create the helpers they need as they need. as i said, you could use the register() method of a plugin in the same way as i demonstrated using the startup method of the app, even going so far as to replace the schema attribute with a schema helper
19:55 cpan_mojo Mojolicious-Plugin-AssetPack-1.37 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-1.37
20:56 karjala Question: Shouldn't this program display something on the screen when I close a connection? I only get a message whenever I connect to the server, not when I disconnect or when I send data to it: http://pastebin.com/2aTLkjd0
20:57 karjala What am I doing wrong?
20:59 stryx` joined #mojo
20:59 sri you never add the stream object to the event loop
21:00 karjala Oh. I'll do it another way this time.
21:02 karjala $stream->start did it, thanks
21:12 pcronin joined #mojo
21:15 pcronin Hi, I’m working on debugging a Mojolicious template using plackup. An error occurs within the template, and it’s rendered into the lovely Mojolicious error page that contains the error, some surrounding lines of code, the header info and stash, as well as routing info. What I’d like to see is a stack trace for the error. Is that possible?
21:16 jberger I thought there was a stack trace in there?
21:18 pcronin Using Chrome’s devtools to see the rendered HTML, I see <div id=“trace” class=“box space”></div> — perhaps it’s supposed to be in there?
21:18 good_news_everyon joined #mojo
21:18 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vMgBW
21:18 good_news_everyon mojo/master 7388440 Sebastian Riedel: arguments can also be a hashref
21:18 good_news_everyon left #mojo
21:23 good_news_everyon joined #mojo
21:23 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vMgB7
21:23 good_news_everyon mojo/master 4e2cc18 Sebastian Riedel: we are not interpolating here
21:23 good_news_everyon left #mojo
21:34 pcronin So, I’ve found and fixed my error, which that I didn’t send a helper enough arguments. However, I can see myself being in this position again. Perhaps next time I’ll know a bit more about Mojolicious and why it wasn’t able to display the stack trace. If I find anything, I’ll report back.
21:40 cpan_mojo Mojolicious-Plugin-Util-Callback-0.05 by AKRON https://metacpan.org/release/AKRON/Mojolicious-Plugin-Util-Callback-0.05
22:39 good_news_everyon joined #mojo
22:39 good_news_everyon [mojo] kraih created ioloop_tls (+1 new commit): https://git.io/vMgrT
22:39 good_news_everyon mojo/ioloop_tls 47ef225 Sebastian Riedel: add Mojo::IOLoop::TLS class
22:39 good_news_everyon left #mojo
22:39 sri karjala: if you or anyone else want to finish it, that's the first half of Mojo::IOLoop::TLS
22:40 sri just need to add the Mojo::IOLoop::Client part and that's it
22:40 karjala Thanks! I might just do that!
22:42 sri just need to fiddle a bit with the SSL_* args to fit both cases, and use a $args->{tls_server} or so flag to differentiate
22:42 sri and based on that $handle->accept_SSL or $handle->connect_SSL
22:44 sri our test coverage is also pretty reasonable if you run with TEST_TLS=1
22:48 karjala so, to upgrade a connection to TLS after I have communicated through it without encryption, what do I write?
22:49 sri write the client code and you learned how to do it :)
22:55 good_news_everyon joined #mojo
22:55 good_news_everyon [mojo] kraih pushed 1 new commit to ioloop_tls: https://git.io/vMgKT
22:55 good_news_everyon mojo/ioloop_tls 61c04d8 Sebastian Riedel: use a server argument
22:55 good_news_everyon left #mojo
22:55 sri ok, that removes all hard design decisions i think
22:55 sri now it just needs the SSL_* arg fiddling merged from Mojo::IOLoop::Client
22:55 sri but i'm tired... so Zzzz
22:58 sri for the record, AppVeyor shows up on pull requests!!! https://github.com/kraih/mojo/pull/1035
22:58 sri \o/
22:59 Grinnz nice
23:27 zivester joined #mojo
23:28 bpmedley joined #mojo

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