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

IRC log for #mojo, 2015-05-04

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

All times shown according to UTC.

Time Nick Message
00:31 mattastrophe joined #mojo
01:08 asarch joined #mojo
01:15 klapperl joined #mojo
02:18 noganex_ joined #mojo
02:24 absolut_todd joined #mojo
03:00 absolut_todd joined #mojo
03:24 kaare joined #mojo
03:50 basic6_ joined #mojo
04:31 lluad joined #mojo
05:16 berov joined #mojo
05:31 odin22 joined #mojo
06:06 dod1 joined #mojo
06:08 bramirez joined #mojo
06:11 dod1 joined #mojo
06:22 McA joined #mojo
06:29 melo joined #mojo
06:38 polettix joined #mojo
06:56 nf joined #mojo
07:09 eseyman joined #mojo
07:10 ribasushi joined #mojo
07:13 melo joined #mojo
07:25 trone joined #mojo
07:51 bramirez joined #mojo
08:03 Vandal joined #mojo
08:07 odc joined #mojo
08:37 fhelmber_ joined #mojo
10:36 depesz left #mojo
10:48 Kripton joined #mojo
11:01 mattastrophe joined #mojo
11:07 bramirez joined #mojo
11:54 asarch joined #mojo
11:59 AirDisa joined #mojo
12:08 neilhwatson joined #mojo
12:17 bramirez joined #mojo
12:37 ajr_ joined #mojo
13:18 gryphon joined #mojo
13:35 Vertig0 joined #mojo
13:52 PotatoGim^Home joined #mojo
14:34 sh4 joined #mojo
14:40 hasan joined #mojo
14:42 ajr_ joined #mojo
14:53 mattastrophe joined #mojo
14:53 hasan can I use this plugin without the Swagger2 distribution it comes with? https://metacpan.org/pod/Mojolicious::Plugin::Swagger2
14:54 hasan I ask because after setting up everything like described in the docs I get the following error message: Mojo::Reactor::Poll: I/O watcher failed: Can't locate object method "helpers" via package "API" at extlib/lib/perl5/Mojolicious.pm line 197.
14:56 hasan I did everything like described in the POD. except x-mojo-controller: MyApp::Controller::Api changed to x-mojo-controller: API and my file is named API.pm.
14:57 hasan ok I just figured out I was missing the "use base 'Mojolicious::Controller'". now it works.
14:58 nicomen your controller needs to inherit from.. hehe. yes
14:58 punter joined #mojo
14:59 hasan nicomen: heh just thought "wait a minute it routes to a controller. doesn't the controller need to inherit from Mojolicious::Controller?" :D
15:00 nicomen ;)
15:01 nicomen I needed to read the docs first, thought perhaps it needed to be a subclass of an App
15:11 fhelmber_ joined #mojo
15:15 misty_g3ar joined #mojo
15:19 jojo joined #mojo
15:19 Vertig0 joined #mojo
15:52 mishanti1 A colleague dropped this in our hipchat-room: http://mojoupgrade.com/ Not exactly related to upgrading mojo, but could have fooled me.
15:53 Grinnz_ thats uhh... the other kind of mojo
15:53 jberger mishanti1: that's like our twitter gal too
15:53 Grinnz_ a bit more interesting than https://github.com/kraih/mojo/wiki/Upgrading
15:54 mishanti1 MUCH more interesting. :)
15:54 mishanti1 Now waddaya say? Should we all discover each others fantasies?
15:55 mishanti1 (not a serious proposition btw)
15:56 * lluad . o O ( If we ever need somewhere to enumerate mojolicious plugins, mojoupgrade.org seems to be available )
15:56 * lluad . o O ( There's no way that could possibly go wrong )
15:57 mishanti1 Haha
16:04 jberger on a (slightly) different topic
16:04 jberger https://github.com/jberger/Mojolicious-Plugin-RevealJS
16:05 jberger where it makes my mojolicious introduction talk simply this: https://github.com/jberger/MojoliciousIntroduction/tree/mojo-reveal
16:06 ZoffixWork joined #mojo
16:10 jberger and especially, the slides are defined as this: https://github.com/jberger/MojoliciousIntroduction/blob/mojo-reveal/templates/index.html.ep
16:12 hasan what tools do you guys use to document your APIs? I'm looking for a UI like swagger-ui
16:18 bwf joined #mojo
16:20 batman hasan: i made the Swagger2 module, so... :)
16:20 batman https://metacpan.org/pod/Swagger2::Editor
16:27 mattastrophe joined #mojo
16:28 ZoffixWork joined #mojo
16:38 hasan batman: I am playing around with Mojolicious::Plugin::Swagger2 but can't figure out how to do it right. I always get "no validation rules defined" when hitting my resources
16:38 hasan I will test Swagger2::Editor. thanks
16:39 batman hasan: just do "mojo swagger2 edit path/to/your-spec.json"
16:41 hasan why json? I should be able to edit a YAML?
16:41 batman yeah, sure
16:41 batman if you have YAML installed (optional)
16:41 batman hasan: check out which tools you have, by just running "mojo swagger2"
16:42 hasan edit, pod, perldoc and validate
16:43 hasan perl -I extlib/lib/perl5/ extlib/bin/mojo swagger2 edit api.yaml
16:43 hasan Can't exec "morbo": No such file or directory at extlib/lib/perl5/Mojolicious/Command/swagger2.pm line 81.
16:43 hasan is there a way to tell swagger2 to look at extlib/bin for commands?
16:43 hasan I tried PERL5LIB env but without success.
16:44 batman you need to set PATH.
16:44 hasan ok
16:45 hasan it works. cool. now I can start documenting my API. thank you very much
16:45 Vertig0 joined #mojo
16:47 batman hasan: you're welcome :)
16:47 batman it's quite nice that you can make perldoc of it as well.
16:47 batman it might be very obvious, but you can do swagger spec => pod => pdf => email to boss ;)
16:48 hasan =)
16:48 hasan one last thing. what is the error message "no validation rules defined" in my routes Mojolicious::Plugin::Swagger2 set up for me?
16:49 hasan hitting http://mydomain.tld/foo/bar gives me that message. where do I put my validation in? is it supposed to be the "parameters: " definition?=
16:50 batman hasan: seems like your yaml structure is all wrong.
16:50 batman try validating it
16:50 batman or make pod. if that gives you and error, then your structure is wrong
16:51 batman hasan: have a look at https://github.com/jhthorsen/swagger2/blob/master/t/data/petstore.yaml for example spec
16:54 hasan ok and where does mojo swagger2 edit api.yaml saves my changes? a look into the file doesn't reflect my changes. but I can see morbo always loads the same file (with the new made changes)
16:54 batman it doesn't.
16:54 batman you have to copy/paste from the browser :/
16:55 batman but it does save in the browser. unless you use internet explorer
16:55 hasan ok I guess my browser is caching the content even when I refresh with CTRL F5
16:55 batman so, if your battery dies (or something) the work is not lost
16:55 hasan oh it does save in browser? how do you do that?
16:55 batman it's because of localstorage. (f5)
16:55 hasan I see.
16:57 batman jberger: i don't think you should vote if you know 0 about udp :(
16:58 jberger batman: probably not
16:58 jberger how about I just say that if it's purely a pass-through config thing then I don't think it should be ruled out for core usefulness
16:58 batman Mojo::IOLoop::Client should _not_ be used for UDP imo.
16:59 Grinnz_ jberger: i would say the same about disabling ipv6, if i cared enough about that issue anymore
16:59 batman jberger: but it's not.
16:59 batman udp is connectionless. so connect doesn't make any sense.
17:00 batman you make a socket and then you send. you never connect to anything.
17:01 batman so... i will try to restrain myself from commenting until someone makes a killer argument.
17:01 batman until then: my vote stands.
17:02 jberger I just softened my stance
17:02 jberger notice that I said "lean" before too
17:02 jberger which I have struck out
17:03 batman jberger: cool
17:03 ajr_ joined #mojo
17:04 batman jberger: http://en.wikipedia.org/wiki/User_Datagram_Protocol
17:04 jberger hahaha, <s> on github's thumb doesn't get struck out
17:04 jberger so it looked like I had strengthened my stance!
17:04 jberger corrected
17:04 Grinnz_ lol
17:07 batman jberger: you make a socket https://metacpan.org/source/HARRYL/Mojo-TFTPd-0.04/lib/Mojo/TFTPd.pm#L214 and then you send: https://metacpan.org/source/HARRYL/Mojo-TFTPd-0.04/lib/Mojo/TFTPd/Connection.pm#L183
17:08 batman nevermind that... it's too much code to make an illustration
17:08 batman i actually spent some time finding that module... i coudn't remember that harry was co-auth on that one as well :-)
17:08 jberger yeah, I'm unlikely to learn it right now anyway
17:08 jberger $working atm
17:47 berov joined #mojo
17:49 hasan batman: does "required: false" work with swagger2 as a valid definition?
17:49 hasan I have a definition - name: limit with required: false, but I still get: expected integer - got null for "limit".
17:50 hasan it seems the only way to get rid of it is by getting rid of the parameters definition for a specific type completely.
17:51 hasan see https://github.com/swagger-api/swagger-codegen/blob/master/samples/yaml/pet.yml for the definitions for "/pets".
17:53 hasan of course mine has the "x-mojo-controller" in it.
18:23 ToApolytoXaos joined #mojo
18:29 dod joined #mojo
19:00 hasan I was reading the spec 1.2 version. now I know why the above issue. version 2.0 makes it clear.
19:04 amon joined #mojo
19:18 fhelmber_ joined #mojo
19:29 disputin joined #mojo
19:32 mattastrophe joined #mojo
20:18 romel joined #mojo
20:29 mattastrophe joined #mojo
22:20 memowe joined #mojo
22:37 memowe joined #mojo
22:44 sanya_com_ua joined #mojo
22:50 frudas joined #mojo
22:51 frudas Hello mojo team
22:51 frudas i have a little issue or problem not sure with mojo
22:52 frudas i use somthing like this : $self->flash( message => "EL USUARIO $user_with_gpio ESTA USANDO EL PERCUTOR $gpio");             $self->render('login');
22:52 frudas and in the the template i have this code:
22:52 frudas % if (my $message = flash 'message') {       <br><p><%= $message %></p>     % }
22:53 frudas the problem is that the message is showed when the page is loaded again
22:54 frudas not at first
22:54 frudas any clue? thankx
22:58 frudas :-)
23:01 memowe joined #mojo
23:02 firnsy frudas: it appears you are 'flash'ing it with every page load, which means it will appear with every page load
23:04 frudas how i can do? i want the message in next load
23:04 frudas not in the second
23:05 frudas :D
23:05 lluad joined #mojo
23:07 frudas i dont want to use ajax >.>
23:07 firnsy frudas: flash is what you're after but i think your flow might be wrong
23:08 frudas mmmm
23:08 firnsy i would normally flash a message and then redirect to the page that is to display that message
23:08 frudas is what i did
23:08 frudas think so
23:09 firnsy eg filling out log form, send post request, post handler flashes error message and redirects back to the form page (get request)
23:09 frudas $self->flash( message => blablablalbalb
23:09 frudas $self->render('login')
23:09 firnsy if you can provide a small example demonstrating your problem that will be most beneficial to all parties
23:10 frudas jeejjej
23:10 frudas ok
23:10 memowe joined #mojo
23:15 frudas ok
23:15 frudas this is the code
23:15 frudas http://paste.ofcode.org/Kfsc3aWB4QR5Fv3Dc7b9VU
23:15 frudas :D
23:18 frudas sorry i doble paste the code this is the one
23:18 frudas http://paste.ofcode.org/36fnTWnJqebf242FNWfdcJV
23:19 firnsy ok you shouldn't be trying to render a page from a post handler, those renders should really be a $self->redirect() to a get handler that serves the login templage
23:19 firnsy *template
23:22 frudas why is bad practice? or  just the $self->flash( message work in that way?
23:22 frudas why, is bad practice? or just the $self->flash( message work in that way?
23:25 firnsy good question, your logic is definitely not "standard" practice but i unfortunately i can point you to a reference off hand
23:27 firnsy s/can/can't/
23:28 frudas :)
23:30 lluad If you render from a post you end up with a URL that's not bookmarkable or copyable, and if you reload in the browser, or close the tab and reopen it, it'll prompt to do the POST again which the user doesn't want, probably, but can't get the page to reload without it.
23:30 lluad Redirection to a GET of a results page avoids all that.
23:32 frederico joined #mojo
23:32 frudas thankx
23:33 frudas all of you

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