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

IRC log for #mojo, 2014-08-01

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

All times shown according to UTC.

Time Nick Message
00:07 d4rkie joined #mojo
00:54 Averna joined #mojo
01:45 klapperl joined #mojo
01:53 KCL joined #mojo
02:15 noganex joined #mojo
02:18 woz joined #mojo
02:29 disputin joined #mojo
02:31 sujithm joined #mojo
02:36 fitnerd joined #mojo
02:50 woz joined #mojo
03:08 Kripton joined #mojo
03:30 basic6_ joined #mojo
04:00 woz joined #mojo
04:17 disputin joined #mojo
04:39 oleg joined #mojo
04:47 dotandimet joined #mojo
04:53 woz joined #mojo
05:14 sujithm joined #mojo
05:16 dotandimet joined #mojo
05:30 chankey joined #mojo
05:54 woz joined #mojo
06:00 denis_boyun joined #mojo
06:03 sujithm joined #mojo
06:10 Vandal joined #mojo
06:11 laouji joined #mojo
06:37 dexteruk_ joined #mojo
06:53 dod joined #mojo
06:56 woz joined #mojo
07:08 fhelmber_ joined #mojo
07:34 trone joined #mojo
07:40 basiliscos joined #mojo
07:41 sujithm_ joined #mojo
07:45 edestler joined #mojo
07:56 woz joined #mojo
08:01 marcus_ <3 those crazy russians.
08:02 neyasov joined #mojo
08:39 mire__ joined #mojo
08:43 batman i wonder if it makes sense to require IO::Socket::SSL when my PayPal module only use "https" ...
08:43 rawler joined #mojo
08:43 batman require = have it as a dependency in Makefile.PL
08:45 moritz yes, makes sense
08:45 batman ok
08:47 Mikey_ joined #mojo
08:47 Claudio joined #mojo
09:07 d4rkie joined #mojo
09:19 nicomen how do I make an app work unedr a prefix, including static files? (just wrapping a bridge around the whole thing doesn't allow the static files to work properly, unless I put them in a drawer with the same name as the bridge prefix)
09:24 nicomen the $static->prefix is gone, what should one use instead?
09:29 neyasov joined #mojo
09:32 Adura joined #mojo
09:33 sujithm joined #mojo
09:35 batman nicomen: use the Mount plugin.
09:35 batman or...is the prefix coming from a reverse proxy?
09:36 batman meaning... is your problem that all the generated URLs are invalid?
09:39 nicomen the problem is correct
09:39 nicomen but it is just because I need to the app to be served from a specific path
09:39 batman nicomen: https://metacpan.org/pod/Mojolicious::Plugin::RequestBase
09:40 batman check the source code... it's not much code
09:40 nicomen yes, I can't set any headers to it, I just want to serve from a specific path
09:41 batman i can't understand what you're saying.
09:41 batman "the problem is correct" <-- i thought i understood that, but i guess not.
09:41 batman try to state the real problem instead of masking it with what you think is the solution.
09:47 batman (i hope i didn't come across as a jerk)
09:48 d4rkie joined #mojo
09:49 batman nicomen: what i'm trying to say is that i (often) think i know the solution to my problem, so i ask about the solution instead of telling people what my real problem is
09:49 batman so i end up with a solution to the wrong problem :(
09:58 noganex $t->ua->server->url->userinfo('x:y')->path('/foo')->query->param(bar=>'baz') - i expected to get something like http://x:y@localhost:52863/foo?bar=baz, but got only ?bar=baz
09:59 batman noganex: add ->to_abs at the end
09:59 noganex batman: but the end is Mojo::Parameters
10:00 batman ah. sorry. you can just do ->query(bar=>'baz')->to_abs
10:00 batman or >query({bar=>'baz'}) if you wan to append. (perldoc Mojo::URL)
10:01 noganex ah. awesome. thanks batman :)
10:03 noganex i've got to admit i'm quite smitten with mojo. especially the detailed documentation... :)
10:03 batman yes. it's awesome :)
10:24 nicomen batman: so, what I meant with the problem is correct (sorry stupid wording) was: 11:36 <@batman> meaning... is your problem that all the generated URLs are invalid? <-- YES ;)
10:25 batman ok. then you need to set $c->req->url->base(....);
10:25 nicomen and in this case, I can't set headers in front, but I want the app to work only from /foo instead of / (I can use a bridge for alle routes, but then the url_for() end up wrong)
10:28 batman it's incredible bad design not setting it in front, but you can just force it as well... ex: $c->req->url->base("http://example.com/foo") if $self->req->headers->host eq 'example.com';
10:28 batman look at the plugin for the required hook
10:31 laouji joined #mojo
10:37 nicomen batman: aha, thanks ;)
10:37 nicomen batman: yes I agree with the design part
11:36 laouji joined #mojo
11:37 fhelmber_ joined #mojo
11:37 D4RK-PH0ENiX joined #mojo
11:49 mr-foobar joined #mojo
11:55 sujithm joined #mojo
12:03 laouji joined #mojo
12:11 sujithm joined #mojo
12:19 neilhwatson joined #mojo
12:24 yourname joined #mojo
12:27 Mad_Dud guys, has there been any bug related with render_file? i think that my script is unable to send file to browser if there is non-ascii character in filename.
12:41 oetiker joined #mojo
13:11 sujithm joined #mojo
13:25 Jonis Mad_Dud: unable? in what way?
13:25 Jonis is there any error messages, what happens?
13:26 Kripton joined #mojo
13:40 Mad_Dud Jonis: i get umm. default error page - the picture of raptor and timeout error in browser.
13:40 Mad_Dud Jonis: the logs say "file not found"
13:42 zivester joined #mojo
13:43 bf_ Kind of bugs me that the Lite example in the "Duct tape for the HTML5 web" is incomplete.  Only / and /time are usable "as is".
13:50 arthas joined #mojo
13:53 sri they are all "usable"
13:54 sri just not with browsers, which underlines the capabilities of mojolicious as a framework for non-browser apps
13:54 KCL_ joined #mojo
13:57 * bf_ nods
14:00 bf_ just thinking beginners might understand code that did work in browsers first
14:00 sri i'm open for proposals
14:01 sri but that example needs to a) show as much cool capabilities of mojolicious as possible, and b) look cool
14:01 sri it's a marketing site first, educational second
14:01 sri the tutorial and guides are the educational part
14:03 sri if you include this kind of websocket boilerplate you get into TLDR territory http://mojolicio.us/perldoc/Mojolicious/Lite#WebSockets
14:03 mire__ joined #mojo
14:03 bf_ Since it is on the front page, I saw it as more of "try this to see some cool stuff" but the "try" part is limited.
14:04 bf_ limited in the browser...
14:04 sri really, i don't care about such arguments
14:04 sri make it look cool or get out
14:04 bf_ ok, no worries
14:05 sri "sure it's a huge ass wall of text, but at least it works in the browser" doesn't fly with me ;p
14:05 nicomen reminds of me of my childhood copy-pasting huge amounts of code into a computer, running and hoping it would work ;)
14:06 sri you could try to remove the /time example and put its point into the full websocket example, but then you need to make sure the template gets the point across that it's just embedded perl
14:15 disputin joined #mojo
14:19 * noganex wanted to try websockets for ages, but simply has no use case for them...
14:22 rblackwe joined #mojo
14:23 dvinciguerra joined #mojo
14:28 bf_ https://gist.github.com/bfaist/126a4f1fdb185fcdd6f8
15:16 sujithm joined #mojo
15:32 sh4 joined #mojo
15:37 KCL_ joined #mojo
15:40 sujithm joined #mojo
15:42 basiliscos joined #mojo
15:46 disputin joined #mojo
15:47 _eugen joined #mojo
15:53 denis_boyun joined #mojo
15:56 KCL_ joined #mojo
15:57 asarch joined #mojo
15:58 asarch If in the server it is available the "Verdana" font and in the cliente it is not, is there any way to so you can still using this font in the client?
16:05 Kripton_ joined #mojo
16:16 cooper joined #mojo
16:28 sri oh, looks like Net::SSLeay already has ALPN support
16:28 sri guess patching ALPN support into IO::Socket::SSL would be as easy as duplicating the NPN code
16:29 dexteruk joined #mojo
16:35 edestler joined #mojo
16:36 oleg joined #mojo
16:51 dod joined #mojo
16:59 dexteruk joined #mojo
16:59 neyasov joined #mojo
17:05 irq joined #mojo
17:32 sri oleg++ # IO::Socket::Socks doesn't fail on OS X anymore
17:53 jberger_ asarch: there are mechanisms for sending fonts to the client yes
17:55 Eke- joined #mojo
17:55 jberger_ IIRC this : https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face
18:00 disputin joined #mojo
18:01 mire__ joined #mojo
18:40 disputin joined #mojo
19:21 bobkare joined #mojo
19:36 ua_ joined #mojo
19:39 bobkare joined #mojo
20:30 asarch joined #mojo
20:31 asarch Why: <% ($studen eq "asarch") ? "Welcome!" : "Who are you?" ; %> doesn't work?
20:32 asarch And if you split it, it also doesn't work either
20:33 jnbek try <%= ?
20:35 asarch "Not enough arguments for scalar at template"
20:38 woz joined #mojo
20:38 sri jnbek is absolutely right
20:39 sri perl -Mojo -E 'a({inline => q{<%= ($student eq "sri") ? "true" : "false" %>}, student => "sri"})->start' get /
20:39 asarch Oh, in just one line
20:40 asarch Thank you
20:40 asarch Thank you very much :-)
20:41 jnbek :)
20:41 sri that's literally the first few lines of the documentation
20:42 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Embedded-Perl
20:42 sri use it!
20:46 asarch Can you declare subs inside EP code?
20:46 asarch Just like with normal Perl?
20:46 asarch % sub add {
20:46 asarch % my ($a, b$) = shift;
20:47 asarch % return $a + $b;
20:47 asarch % }?
20:48 jberger_ asarch: yes, but see template blocks also
20:48 jberger_ (though your code wouldn't work, and you should have used a pastebin)
20:49 asarch Thank you
20:50 asarch Sorry if I insist about this but I see some examples where you don't actually use the '$' sign to get the value of a var
20:50 good_news_everyon joined #mojo
20:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/NZ9I6g
20:50 good_news_everyon mojo/master 5328a63 Sebastian Riedel: use $c in templates
20:50 good_news_everyon left #mojo
20:50 asarch Or you don't actually end the sentences with ;
20:51 asarch Those are my two small questions about EP
20:52 asarch But anyway, thank you very much
20:52 sri did you even visit the link i gave you?
20:52 asarch Thank you
20:52 asarch Yes, actually I am using the one from my own application
20:52 sri i believe that was also your like 3rd pastebin warning
20:53 jberger_ Sentences?
20:54 sri literally the 4th sentence after the point i just linked to answers one of those questions...
20:55 sri 2nd paragraph
20:55 * sri bites into his keyboard
20:56 * sri bites jberger
20:57 ichesnokov joined #mojo
20:58 * jberger_ gets his shots
21:04 asarch It's just that, in my first attemp, I tried to do this like with TT: $self->stash(students => $schema->resultset('Student')->all);
21:04 asarch And in the template file: % foeach (@students) {...
21:05 asarch And it did not work as I expect
21:05 jberger_ Can only stash scalars
21:05 asarch Then I discover that with: @students = $schema->...; $self->stash(students => \@students);
21:06 asarch And then in the template: % foreach (@$student) {...
21:06 asarch That was only the part it makes me scratch my head (specially for the "@$student" part)
21:07 jberger_ Do you understand perl references?
21:07 jberger_ (just asking)
21:08 jberger_ This is the best doc page : http://perldoc.perl.org/perlreftut.html
21:10 woz joined #mojo
21:12 punter joined #mojo
21:12 jberger_ The only mojo specific thing to know is that the stash is basically just a hash, from there you should be able to understand the rest simply in terms of perl data structures
21:12 asarch As a much as a Perl designer, no
21:13 asarch Simons Cozens use them to teach pure OOP techniques with Perl
21:13 jberger_ asarch: then you really really need to read and understand the doc i posted
21:13 jberger_ References are fundamental to perl and by extension mojo
21:13 asarch I see
21:15 asarch I just found this technique: http://sprunge.us/eKcK
21:16 jberger_ That is not really a technique
21:17 jberger_ It's just using a data structure
21:17 jberger_ Anyway, I'm off to the beach
21:17 jberger_ O/
21:17 bobkare joined #mojo
21:18 irq_ joined #mojo
21:23 btyler joined #mojo
21:24 asarch This is how I can use it: http://sprunge.us/XNKa
21:28 asarch Beautiful, isn't it? :-)
21:28 asarch Anyway, thank you very much guys
21:28 asarch See you later o/
21:43 dexteruk_ joined #mojo
21:57 dexteruk joined #mojo
22:15 * sri wonders how useful this would be https://gist.github.com/anonymous/fcf9e67565adb5e56484
22:16 sri there is one big problem though, i can't handle Link headers where the url contains commas or semicolons
22:17 sri patch is pretty simple https://gist.github.com/anonymous/cb6a2910ec41624ae2aa
22:18 sri i've looked into how others handle the problem... and python's requests is even less smart https://github.com/kennethreitz/requests/blob/master/requests/utils.py#L561
22:20 woz joined #mojo
22:23 neilhwatson joined #mojo
22:34 disputin joined #mojo
22:36 sri hmm, i guess we'll not do that... someone is going to complain... and i really don't want to argue about simplicity of implementation vs. silly commas and semicolons in urls...
22:37 sri feature would be worth 10 lines to me... but not a whole new tokenizer
22:41 dvinciguerra joined #mojo
22:49 bobkare joined #mojo
22:54 woz joined #mojo
22:57 basiliscos joined #mojo
23:25 bobkare joined #mojo
23:51 sri oh
23:51 sri i just stumbled over a more sane solution :O
23:52 sri Mojo::Util::split_header could have optional support for option-ish header values
23:53 sri which are delimited by special tokens like <> in the case of Link
23:53 sri that's 4 additional lines
23:56 sri https://gist.github.com/a18da9d8bafc6cf11b4e
23:58 sri https://gist.github.com/4530840ec5931a923d32 # and the result now
23:58 woz joined #mojo

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