Camelia, the Perl 6 bug

IRC log for #mojo, 2013-08-05

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

All times shown according to UTC.

Time Nick Message
00:21 amirite joined #mojo
00:27 denis_boyun joined #mojo
00:31 amirite joined #mojo
00:36 Moataz-E hello guys
00:37 Moataz-E i am trying to deploy my mojo app into the web
00:37 Moataz-E so far i am using an Amazon EC2 server, i successfully installed all dependencies and morbo is working perfectly
00:38 Moataz-E now, i installed apache into the  /usr/local/apache2 folder and reading through the https.conf file
00:39 Moataz-E also, i am using .tk's DNS service and i already added an A record containing my hostname and public IP
00:39 amirite_ joined #mojo
00:51 * jberger yawns
00:52 bpmedley Moataz-E: Which deployment model are you using?
00:53 Moataz-E bpmedley: hypnotoad
00:53 jberger I have never gotten a .tk address to work correctly
00:53 Moataz-E jberger: i am just demoing it, later on i will move to a real .com
00:53 bpmedley Moataz-E: Why did you mention apache?
00:54 jberger haha, just to prove that statement correct, I tried one of my few attempts and it actually worked :D
00:54 jberger http://jberger.tk # points to my github page
00:54 Moataz-E bpmedley: shouldn't i use apache along with hypnotoad?
00:54 bpmedley Moataz-E: I don't for my site.  It's faster; however, I use a dedicated IP for my site.
00:54 amirite joined #mojo
00:55 jberger Moataz-E, you can use apache for reverse proxy
00:55 Moataz-E so i just simply run hypnotoad and make it listen on a specific port and that is it, it will behave the same as morbo?
00:55 jberger but I have found (as others have) that nginx works with a lot less headache
00:56 bpmedley Moataz-E: You can do that yes.  There are lots of options.
00:57 bpmedley $self->config(hypnotoad => {listen => [ "http://64.91.255.102:80" ], workers => 5, user => "root", group => "root", accepts => 100})   <-- Something like that
00:57 Moataz-E hmmm, so what is the use of reverse proxy then :S
00:57 jberger I don't run my app as root
00:57 jberger but then I can't get port 80
00:57 Moataz-E i have it as app->config not $self->config
00:58 jberger Moataz-E, that's Lite vs non-Lite
00:58 Moataz-E ohhh ok
00:58 bpmedley Moataz-E: I believe with reverse proxy you can have more than one site sitting on an IP.
00:58 Moataz-E bpmedley: for my case, i only have one site
00:58 jberger yes, I have several apps all running on the same IP
00:58 bpmedley Yeah, I may want to stop using user root.. I had some permission issues.
00:59 Moataz-E do i have to allow inbound http requests from amazon's ec2?
00:59 bpmedley I believe hypnotoad by itself wlil be faster.  What OS are you using?  Linux?  If so, what distro?
00:59 Moataz-E for the specific port i am using for hypnotoad
01:00 bpmedley Moataz-E: No matter what deployment model you use, you will need port 80 open at the firewall level.
01:00 Moataz-E i am using red hat's image provided by amazon
01:00 jberger eeeh
01:01 jberger does it come with real Perl, or borkend Perlish thingyy
01:01 jberger ?
01:01 Moataz-E it comes with perl v 5.10
01:01 Moataz-E i had to install perlbrew
01:02 jberger yeah, do that ^^
01:02 bpmedley Moataz-E: sudo -u root sh -c "cd /opt/closebargains.com/docroot/close_bargains && /opt/perl /opt/perl-5.16.3/bin/hypnotoad script/close_bargains"  <-- This is overkill and you can modify for your needs.  I had that in /etc/rc.local.
01:02 jberger but thats even another reason for reverse proxy, my Perlbrew is not at system level
01:03 jberger so root doesn't use it
01:03 Moataz-E bpmedley: i'm sorry but what is that for?
01:04 bpmedley Moataz-E: You need to somehow start hypnotoad at system boot.
01:05 Moataz-E bpmedley: ohhh i see, that will be my next step. For now i am still trying t make hypnotoad work :S
01:08 Moataz-E alright so i have my a record setup on dot.tk
01:08 bpmedley Moataz-E: Would you consider starting hypnotoad on port 80 and see if that works?
01:08 Moataz-E and in my mojo:lite file, i set it to listen to port 3199
01:09 Moataz-E bpmedley: by that you mean i should set it to listen to port 80 from inside my app file right?
01:09 bpmedley Please
01:09 Moataz-E alright i get : Starting hot deployment for Hypnotoad server 20289.
01:10 bpmedley What's the site address?
01:10 Moataz-E eurostarrental.tk
01:10 Moataz-E still nothing
01:11 bpmedley Moataz-E: curl: (6) Couldn't resolve host 'eurostarrental.tk'
01:11 Moataz-E public ip is: 54.213.46.153
01:11 ka2u joined #mojo
01:12 bpmedley Trying 54.213.46.153...
01:12 bpmedley telnet: connect to address 54.213.46.153: No route to host
01:12 bpmedley Odd
01:12 Moataz-E using hostname i get: ip-172-31-34-36.localdomain
01:13 Moataz-E only when i remove localdomain does dot.tk dns accept it
01:14 bpmedley Should I be able to ping 54.213.46.153?
01:14 Moataz-E i have tcp ports 22, 80 and 3199 open for inbound connections
01:15 Moataz-E note i have apache2 closed, does this affect it?
01:15 bpmedley You need a process attached to port 80.  Did you configure hypnotoad for port 80?
01:16 Moataz-E yup i have this at the start of my file after the module loads: app->config(hypnotoad => {listen => ['http://*:80']});
01:17 Moataz-E i am also using Mojolicious::Plugin::Config;
01:17 bpmedley Ok.  What does netstatn -an | grep LISTEN show?
01:19 Moataz-E no such package in red hat
01:19 bpmedley Sorry, netstatn -> netstat
01:20 Moataz-E here is the output: http://pastebin.com/0sqewXfC
01:21 Moataz-E looks like 80 isn't one of them
01:21 bpmedley What's in your hypnotoad config file?
01:21 Moataz-E 80 A:S
01:22 Moataz-E is there a way to stop all previous hypnotoad instances?
01:22 bpmedley hypnotoad -s, I believe
01:23 Moataz-E after stopping it, post 3199 is no longer LISTEN
01:23 bpmedley So, somewhere hypnotoad is getting 3199 for a port instead of 80.
01:24 Moataz-E from previous command maybe
01:24 bpmedley Dunno - or a config file.
01:24 Moataz-E i no longer receive hypnotoad confirmation when i run it on my app file
01:24 bpmedley ps -ef | grep hypnotoad
01:24 Moataz-E maybe port 80 is only for root
01:25 Moataz-E i have one instance runnign
01:26 bpmedley Yes, you will need to run hypnotoad as root to attache to port 80.  You can drop priveldges with 'user => "bpm", group => "bpm"' in your config.
01:26 bpmedley You, of course, would use the correct user and not "bpm".
01:28 Moataz-E do i need the group key?
01:28 bpmedley Dunno.
01:30 Moataz-E alright now i have : app->config(hypnotoad => {listen => ['http://*:80'], user => 'ec2-user', group => 'ec2-user'});
01:31 bpmedley You'll need to start hypnotad with sudo or somesuch.
01:31 Moataz-E with sudo it says no such command hypnotoad
01:32 bpmedley What is the full path to your perl binary?
01:33 bpmedley sudo /opt/perl /opt/perl-5.16.3/bin/hypnotoad script/close_bargains      <-- That's how I start mine
01:34 Moataz-E Can't locate Mojo/Server/Hypnotoad.pm in @INC (@INC contains: /home/ec2-user/perl5/perlbrew​/perls/perl-5.18.0/bin/../lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/ec2-user/perl5/perlbrew/p​erls/perl-5.18.0/bin/hypnotoad line 31.
01:35 Moataz-E do i need to use a specific module
01:35 Moataz-E Mojo::Server::Hypntoad?
01:35 bpmedley Try: "sudo su -" and then run hypnotoad as root user
01:36 bpmedley You may need to setup perlbrew for root.  I'm not sure how all that works.  I know it uses some ENV VARS and whatnot.
01:38 Moataz-E still getting same error even with sudo su -
01:38 bpmedley What command are you running?
01:38 Moataz-E /home/ec2-user/perl5/perlbrew/p​erls/perl-5.18.0/bin/hypnotoad /home/ec2-user/Eurostar/Eurostar.pl
01:39 Moataz-E this is run as root
01:40 bpmedley You may need to edit /home/ec2-user/perl5/perlbrew/p​erls/perl-5.18.0/bin/hypnotoad  and change the #! to the appropriate perl.  Not 100% sure.
01:40 bpmedley See how you have system perl paths in @INC instead of perlbrew perl paths?
01:41 bpmedley I had to change my bin/hypnotoad to point to /opt/perl
01:41 bpmedley Does that make sense?
01:41 Moataz-E ohhh i see, yeh i understand
01:42 Moataz-E so i need to make sure that lthe lib64 being used is from the perlbrew's perl version
01:42 bpmedley I think so
01:43 Moataz-E along with the other directories of course.
01:43 Moataz-E no problem, it is running late now
01:43 Moataz-E i will continue with this tomorrow
01:43 bpmedley Awright
01:43 Moataz-E thank you very much bpmedley , you are a god amongst men. Thank you!
01:43 bpmedley :)
01:44 Moataz-E good night from Dubai :D
01:45 shmuel joined #mojo
02:01 d4rkie joined #mojo
02:02 d4rkie joined #mojo
02:05 edenc left #mojo
02:49 amirite_ joined #mojo
02:49 Rish joined #mojo
02:54 amirite joined #mojo
03:12 mrphilov joined #mojo
03:32 basic6 joined #mojo
03:43 preflex_ joined #mojo
04:21 dhg joined #mojo
04:25 dqw joined #mojo
05:22 allan joined #mojo
05:35 jnbek joined #mojo
05:46 rem_lex|pivo joined #mojo
05:48 Britzel_ joined #mojo
06:54 basiliscos joined #mojo
07:08 Tiger joined #mojo
07:14 denisboyun joined #mojo
07:14 trone joined #mojo
07:17 Vandal joined #mojo
07:27 dpetrov_ joined #mojo
07:45 amirite joined #mojo
07:48 sh4 joined #mojo
07:50 Dandre joined #mojo
07:50 amirite_ joined #mojo
08:32 dhg joined #mojo
08:40 ghandi|work joined #mojo
08:41 arthas joined #mojo
08:49 ghandi|work I've got an seldomely used webapp (one visit per week) which has the problem, that the Database-Server "gone away". I'm already aware of the Wiki-Entry (https://github.com/kraih/mojo/wiki/​Hypnotoad-prefork-web-server#databa​se-connection-problem-in-preforking). Is the only solution to this problem the DBIx::Connector because of the seldome requests?
08:52 maxhq joined #mojo
08:54 amirite joined #mojo
08:56 mire_ joined #mojo
08:59 jzawodn joined #mojo
09:01 ladnaV joined #mojo
09:09 fhelmber_ joined #mojo
09:13 trone joined #mojo
09:16 dhg joined #mojo
09:17 basiliscos joined #mojo
09:36 denisboyun joined #mojo
09:41 asarch joined #mojo
09:45 bowtie_ joined #mojo
09:47 crab ghandi: why not connect to the database when you get the request?
10:06 sh4 joined #mojo
10:44 pjvolders joined #mojo
10:45 pjvolders Hi guys! Can i run hypnotoad in development mode?
10:56 trone joined #mojo
11:00 marcus pjvolders: morbo is for development.
11:13 jast joined #mojo
11:17 denisboyun joined #mojo
11:19 * sri yawns
11:37 ghandi|work @crab: there is no real reason not to do this in this scenario. I was just curious, because the wiki states that using "app->attr(name => sub { DBI->connect.... });"  solves the problem. Which doesn't seem to be true when your preforked workers live long because of only rare requests to the server.
11:38 jontaylor joined #mojo
11:40 jontaylor I'm using Mojolicious-Plugin-Authentication for one of my apps, which has worked well until my authentication process has become more complex, basically i have _many_ reasons why a users authentication attempt might have failed
11:40 jontaylor however the sub ref I supply for validate_user wants me to return 1 or 0
11:41 jontaylor but I need some way of getting the reason for failure out of it, however all the options I can think of are bad
11:41 jontaylor like I could use exceptions to get the authentication failure reason, but it doesn't feel right as many of these cases aren't exceptional
11:42 jontaylor ideally i'd want to return some kind of an authentication failure object out
11:42 jontaylor I'm thinking as part of my authentication process I could attach it to the $app object maybe, does that sound clean though?
11:43 jontaylor so in a controller I could go $self->app->authentication_failure_reason
11:48 sri the plugin does not appear to be very well designed
11:48 sri passing $app instead of $c to callbacks, which prevents $c->stash(reason => 'Whatever!')
11:49 jontaylor ahh yeah, the controller instance would have been handier
11:49 jontaylor especially because you can get to the $app through it as well
11:49 jontaylor I might fork it
11:49 jontaylor its likely a simple refactor
11:50 sri ah, looks like a documentation bug actually
11:50 sri it passes $c, but documents $app
11:50 jontaylor ahh ok, I can just stash the error message then
11:50 sri send a pull request! :)
11:50 jontaylor it does tie the user authentication code to the fact its a web app though
11:50 sri you need to make sure the documentation is wrong, or he might decide to fix the code instead
11:51 jontaylor ok, i'll do that over lunch then
11:52 jontaylor cheers sri
11:56 ghandmann joined #mojo
11:58 denis_boyun joined #mojo
12:25 nicolaas joined #mojo
12:26 dod joined #mojo
12:28 dod joined #mojo
12:37 bowtie_ joined #mojo
12:40 asarch joined #mojo
12:46 dod1 joined #mojo
12:54 marty Hmm,  my bridged routes are firing twice when I define the template in the route command (in startup) versus defining the template in a sub.
12:54 marty Example: my $bridge = $r->bridge('/bridge')->to('example#bridge');  $bridge->route('#junk')->to(template => 'bridge');
12:54 marty That will cause mojo to dispatch to controller Myapp::Bridge twice
12:54 crab '#junk'?
12:54 dod joined #mojo
12:55 marty Everyting I write it #junk.  :)
12:55 marty Just for testing.  :)
12:55 marty Same behavior if I use /:junk
12:55 crab for a request to what url?
12:56 marty /bridge/whatever_junk
12:56 marty If move the template definition to a sub, all works as expected
12:56 sri controller and action are inherited
12:57 marty s/if/if I/
12:57 sri and have precedence
12:57 crab yeah, that's it
12:57 marty Ahhhh
12:57 jontaylor joined #mojo
12:58 marty The different behavior between defining the template in the route command and defining the template in a sub threw me off.
13:03 dvinciguerra__ joined #mojo
13:04 marty sri++   that problem kept me up all night. now I can sleep.  :)
13:04 sri nn :)
13:04 batman joined #mojo
13:04 marcus_ joined #mojo
13:04 wsri joined #mojo
13:10 batman joined #mojo
13:10 marcus joined #mojo
13:11 wsri joined #mojo
13:11 Vandal joined #mojo
13:14 d4rkie joined #mojo
13:22 dqw joined #mojo
13:45 btyler joined #mojo
14:01 rem_lex joined #mojo
14:02 basiliscos Hello! How to tell controller to render my $information =  Mojo::Content::Single->new  ? ... http://bpaste.net/show/120139/ ?
14:03 xaka joined #mojo
14:12 bpmedley basiliscos: Do you have an example Mojolicious::Lite app that shows your issue?
14:32 basiliscos bpmedley: thanks for been ready to help. It was working on ::Lite app, and I have found the reason: I call $tx->resume, and then $c->render. The last isn't needed and caused my manually build $tx->res->content("...") to be forgotten
14:33 bpmedley Glad you found the bug.
14:40 sri basiliscos: http://mojolicio.us/perldoc/Mojolicio​us/Guides/Rendering#Custom_responses
14:41 gryphon joined #mojo
14:42 basiliscos sri: Even better! Thanks a lot!
14:47 denis_boyun joined #mojo
14:49 jast joined #mojo
14:55 dod joined #mojo
14:56 dqw joined #mojo
14:56 dod joined #mojo
15:04 al joined #mojo
15:05 marty joined #mojo
15:13 punter joined #mojo
15:17 kthakore hiya sri
15:18 kthakore if you had to, what would you say is the closest PHP framework to Mojolicioius?
15:18 PerlJam What an odd question.
15:18 sri dunno
15:19 sri depends in what regard, if you mean everything being built around an event loop then maybe http://reactphp.org
15:22 sri if you mean the high level framework, maybe http://laravel.com
15:23 sri in many regards mojolicious is pretty unique though
15:24 delias joined #mojo
15:27 kthakore PerlJam: a client insists on PHP
15:27 PerlJam kthakore: oh. and you want to use something that's as mojo-like as possible so that the pain is hopefully lessened?
15:28 kthakore yeap
15:28 kthakore I have done work in CakePHP before and not looking forward to it
15:30 bluescreen joined #mojo
15:30 bluescreen joined #mojo
15:32 PerlJam heh, google did a slightly unfortunate shortening of text:  CodeIgniter is a proven, agile & open PHP web application framework with a ... and thoroughly undocumented frameworks, then CodeIgniter might be a good fit."
15:32 bluescreen joined #mojo
15:33 PerlJam I read it as "CodeIgniter is a proven, agile, ... and thoroughly undocumented framework"  ;)
15:33 bluescreen joined #mojo
15:36 dhg joined #mojo
15:42 batman http://www.theregister.co.uk/20​13/08/05/html5_timing_attacks/ # cool:)
15:50 btyler joined #mojo
15:53 Britzel_ joined #mojo
15:54 jast I'm having a fun issue where my code is loading a Moose class, and (maybe during morbo's code reload?) the Moose method modifiers get applied a second time (and I get a bunch of "sub redefined" errors), breaking everything
15:55 jast should I just forget all about Moose, or is there still hope? does this even make sense?
15:58 PerlJam jast: no, it doesn't make sense (to me)
15:59 jast okay, that matches my intuition... that's equal parts calming and distressing :)
15:59 PerlJam got some output you can show?
16:00 PerlJam and some code?
16:02 jast I don't have any useful output handy... and I've been awake for ~30h now, so I don't think I can extract a minimal example or anything
16:11 marty jast: are you by any chance using bridges in your routes?
16:13 sri https://github.com/jehna/VerbalExpressions # hahaha
16:13 Britzel joined #mojo
16:14 jast marty: yes...
16:15 marty jast: I have no idea if this is related to your problem but just in case....  http://irclog.perlgeek.de/​mojo/2013-08-05#i_7411486
16:17 bluescreen joined #mojo
16:18 bluescreen joined #mojo
16:18 jast marty: I don't directly route to templates, but it was worth a shot...
16:20 bluescreen joined #mojo
16:23 tianon sri: that's pure gold :)
16:31 crab is it serious or meant to be a joke
16:31 crab ?
16:34 tianon crab: seems pretty serious - there's a whole github org. containing ports to a bunch of different languages
16:34 basiliscos joined #mojo
16:42 bluescreen joined #mojo
16:43 jberger joined #mojo
16:44 jberger Kinda makes me proud that there isn't a perl port
16:44 jberger rxrx ftw!
16:47 denisboyun joined #mojo
16:56 bluescreen_ joined #mojo
17:12 preflex_ joined #mojo
17:13 dod joined #mojo
17:15 gabiruh joined #mojo
17:16 * sri wonders if form validation should be like routes
17:19 sri app->validate('name')->is('​not_empty')->is(max_length => 10)->is(min_length => 10);
17:19 sri my $name = $self->valid('name');
17:21 sri perlhaps with AUTOLOAD extensions
17:21 sri heh... perlhaps
17:21 sri app->validate('name')->not_empty​->max_length(10)->min_length(5);
17:22 dod joined #mojo
17:24 sri app->validator->add_validator(not_empty => sub { my ($c, $value) = @_; return length $value });
17:24 bluescreen_ joined #mojo
17:25 rem_lex|pivo joined #mojo
17:27 delias joined #mojo
17:28 sri i suppose filters and validators make sense, filters for default values, alternative param names and the like
17:28 crab filters?
17:28 sri filters for validated params, they would run before validation
17:29 crab what would it look like?
17:29 sri app->validator->add_filter(sub { my ($c, $name, $value) = @_; return $c->param('different_name') })
17:30 sri oops
17:30 sri let me try again :)
17:33 sri app->validator->add_filter(alias => sub { my ($c, $name, $value, $alias, $target) = @_; return $name eq $target ? $c->param($alias) : $value });
17:33 sri app->validate('name')->alias('user');
17:33 sri i still have some arguments messed up :S
17:34 sri maybe you get the idea anyway
17:34 crab yes, i do
17:35 sri app->validator->add_filter(alias => sub { my ($c, $name, $value, $alias) = @_; return $value // $c->param($alias) });
17:35 sri ok, that should be more realistic
17:38 denisboyun joined #mojo
17:39 sri only thing i don't know how to handle yet is validation errors
17:40 sri making my $name = $self->valid('name') return undef for validation errors would be a simple indicator, but where to store them
17:40 crab app->validator->errors
17:40 sri can't work
17:40 sri app level
17:40 btyler joined #mojo
17:41 sri just storing them in the stash perhaps
17:41 sri say for @{$self->stash('validation_errors')->{name}}
17:42 PerlJam sri: maybe a callback? (that could put stuff in the stash or do whatever else the app designer wants)
17:42 sri $self->stash('invalid')->{name}[0]
17:42 sri PerlJam: example?
17:43 dotandimet joined #mojo
17:43 PerlJam I don't really have one, but I was thinking of something like the on('click', ...) stuff from javascript.
17:43 PerlJam erk jquery
17:44 sh4 joined #mojo
17:44 sri PerlJam: i don't follow
17:45 PerlJam that's okay, maybe I'm not making enough sense.
17:45 sri when would a callback be better than a structure will all error messages you can do whatever you like with?
17:45 sri s/will/with/
17:46 PerlJam because maybe you want to trigger some other stuff to happen on certain errors?
17:46 sri like?
17:47 PerlJam given that I can't readily think of an example (might just be indicative of my state of mind though), maybe  this is classic YAGNI  (i.e. I'm over-designing)
17:47 sri ok
17:48 sri i was thinking that $self->valid(...) calls would push errors into $self->stash->{invalid}{name}
17:49 sri *if* specific errors are necessary
17:49 sri they are kind of a i18n nightmare
17:49 sri perhaps undef for invalid is enough for most
17:51 * sri just wants a pragmatic validator that works for the most common use cases
17:52 sri considering all validators are just registered callbacks, i suppose one could just exchange the built in ones from a plugin to add detailed error messages too
17:52 PerlJam putting stuff in the stash like that, while it works, still gives me an icky feeling.  Like the stash is just some sort of random dumping ground.
17:52 sri PerlJam: are you a mojolicious user?
17:52 PerlJam sri: more of a mojolicious hobbyist at this point.
17:53 dvinciguerra joined #mojo
17:53 sri because that's just what the stash is
17:54 PerlJam Perhaps I'm just grumpy, but I don't like it.  I don't like it in Catalyst either.
17:54 sri and i don't care
17:55 sri the topic is form validation
17:58 * sri wonders how multiple params with the same name could be handled
18:02 basic6 joined #mojo
18:13 sri http://pastie.org/8208908 # that's basically how i imagine a minimalistic version
18:23 salparadise K_F: that works but whast is mproc and
18:24 salparadise oops wrong chan
18:33 dod joined #mojo
18:40 tianon sri: said validators could also be added within a specific action, right?  ie, as long as they're added before a call to ->valid, all's well and good, right?
18:40 tianon just in case param 'name' has different validation for different application paths
18:41 tianon ie, you don't want to validate password length on the login page, in case you've got users with a legacy password that was created before you bumped up the length, or something similar
18:57 dod joined #mojo
18:58 sri tianon: sure
18:59 sri if both actions define their own version it's all good
18:59 tianon sounds good to me, then :)
18:59 sri filters work too though, both can have ->alias('name')
19:00 sri validate('foo_name')->alias('name'); validate('bar_name')->alias('name')
19:00 marty They would almost certainly have to be tresspassing to hear anything
19:00 marty oppps sorry
19:00 marty doh!!!
19:01 sri the blocker atm is validation error messages, which i'd like to leave out for built-in validators
19:01 sri opinions would be very welcome, i'm on the edge about the whole thing atm
19:04 sri crab, marcus, tempire, jberger: CAN HAZ OPINIONZ?
19:04 amirite joined #mojo
19:04 marty sri:  I am reading backlog now.  Is form validation something new you are thinking of adding to Mojo core?
19:04 sri marty: ye
19:05 diegok sri: $self->valid('person/name') to validate parameter name on the "person" context ?
19:06 diegok having invalid errors on the stash with the same name of the param looks fine to me
19:06 sri not the end all answer to everything validation, just a basic core version to get people started
19:06 sri diegok: that still doesn't solve the i18n problem
19:07 sri i'm going to leave out error messages
19:07 sri you can always redefine the built-in validators with ones that set errors
19:07 diegok if I use i18n I'l manually call l($validation->{error}{blah}) on the output side...
19:07 diegok or the i18n plugin can intercept and fix this "after_validation" or something like that?
19:08 sri then your error messages can't ever change or be dynamic
19:08 sri 'needs to be 5 characters long'
19:08 diegok well... you use many validator errors dynamic?
19:08 sri it's too much of a pita that i don't want to deal with it
19:09 jberger Preliminary "looks good" here though admittedly I'm mostly commenting on the example
19:09 marcus sri: i want it.
19:09 jberger I can look more closely later tonight
19:09 sri diegok: context is a neat idea though
19:09 sri validate('person#name')->not_empty;
19:09 dotandimet joined #mojo
19:09 jberger Is this on a branch?
19:09 sri jberger: nope
19:10 sri brainstorming still
19:10 marcus sri: https://twitter.com/PerlSawy​er/status/364010300510441472 ;-)
19:10 diegok if I say validate('person')->not_empty... is good idea that to affect person in any context?
19:10 jberger Ok then. I'll say I like the direction this is going :-)
19:11 sri marcus: don't carem they are not relevant
19:12 sri diegok: think i would keep it all separate
19:12 gryphon joined #mojo
19:12 sri as in 'person' is completely different from 'person#name' and 'name'
19:12 sri i want it dead simple
19:13 marcus sri: One of the problems I've had with Input::Validator is different messages for the same validator for different fields.
19:13 marcus sri: for instance a required constraint that requires a custom message for one of the fields.
19:13 sri marcus: i don't want messages
19:14 marcus sri: I'd like to see some examples of how people should use your system in the .ep templates then.
19:14 sri also, i think server side messages will become obsolete anyway
19:15 sri you'll set html5 attributes on the input fields and just use the server side validation as a fallback
19:15 marcus I tend to just generate messages on the server side even for ajax validators.
19:15 marcus sri: you can't do everything with html5. Unique constraints for instance.
19:15 sri marcus: see my paste above
19:15 diegok I do the same as marcus...
19:16 diegok and on some js apps messages travel on the json response
19:16 sri marcus: if my $name = $self->valid('name') is undef you know it failed
19:16 marcus sri: I'd want to show the error message next to the relevant field tho.
19:16 sri and you add a message of what's ex[ected
19:17 marcus if you have a register field, the user wants to know if the user name is already taken, if it's too short, if it contains invalid characters
19:17 marcus not just that it 'failed'
19:17 sri %= 'lalalala length lalala characters' unless defined $self->valid('name')
19:17 diegok also, it;s useful to say "validate all this context"... meaning I should have a nave passing X rules, surname passing those rules...etc
19:18 sri marcus: now you're mixing up domains
19:18 sri name already taken is not a validator
19:18 marcus sri: that's where I've dealt with it in all my form validation up to date.
19:18 sri marcus: custom error messages for a specific validator failing is not gonna happen
19:19 marcus you have a form, you want to know if you can create something in the database based on that form
19:19 marcus that's validation imo
19:19 sri ok, i'm now slightly against the addition of validators to core :)
19:19 marcus sri: I guess I won't use it then.
19:19 sri dynamic error messages is a huge mess without a canonical solution
19:20 marcus \m/
19:20 sri guess validation will stay a problem for plugins to solve
19:24 sri everything about validation is easy, except for those fricking error messages
19:26 diegok having to deal with db to validate a field is the worst thing about validation IMHO :-/
19:26 sri i don't consider those validators though
19:30 Moataz-E hi guys, anybody here using perlbrew? I have a few questions
19:30 marcus sri: Typically they are a callback validator :)
19:30 marcus Moataz-E: yes
19:31 Moataz-E marcus: alright so i am trying to make hypnotoad run on port 80
19:32 Moataz-E marcus: when i sudo hypnotoad, i get this error: Can't locate Mojo/Server/Hypnotoad.pm in @INC (@INC contains: /home/ec2-user/perl5/perlbrew​/perls/perl-5.18.0/bin/../lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/ec2-user/perl5/perlbrew/p​erls/perl-5.18.0/bin/hypnotoad line 31.
19:32 Moataz-E marcus: apparently, there are some local perl references in INC, i want to change this.
19:33 marcus Moataz-E: where is your Mojo/Server/Hypnotoad.pm exactly? Seems like you have the perlbrew path in @INC there
19:33 Moataz-E ~/perl5/perlbrew/perls/perl-5.18.0/bin/hypnotoad
19:34 Moataz-E ohhh one second
19:34 marcus Moataz-E: seems your sudo is messing up your environment.
19:35 Moataz-E marcus: a Mojo folder is supposed to be in this directory right? /home/ec2-user/perl5/perlbrew​/perls/perl-5.18.0/lib/5.18.0
19:36 delias joined #mojo
19:36 sri Moataz-E: it's supposed to be where you installed it
19:36 sri reinstall and look at the log if you're unsure
19:37 sri or run "mojo eval -v 'app->home->mojo_lib_dir'"
19:38 sri which is "/Users/sri/perl5/perlbrew/perls/perl​-5.18.0/lib/site_perl/5.18.0/Mojo/.." for me
19:39 Moataz-E sri: it is /home/ec2-user/perl5/perlbrew/perls/pe​rl-5.18.0/lib/site_perl/5.18.0/Mojo/..  here too
19:41 Moataz-E sri: I found Hypnotoad.pm in this directory: /home/ec2-user/perl5/perlbrew/perls/perl-​5.18.0/lib/site_perl/5.18.0/Mojo/Server/
19:42 Moataz-E i will reinstall now
19:54 basiliscos joined #mojo
20:04 mire_ joined #mojo
20:06 good_news_everyone joined #mojo
20:06 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/qoZ0dg
20:06 good_news_everyone mojo/master a2524ab Sebastian Riedel: better AUTOLOAD tests
20:06 good_news_everyone left #mojo
20:08 amirite joined #mojo
20:10 good_news_everyone joined #mojo
20:10 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/OJ022g
20:10 good_news_everyone mojo/master 70acb04 Sebastian Riedel: fixed small bug in AUTOLOAD test
20:10 good_news_everyone left #mojo
20:14 espent joined #mojo
20:32 bpmedley Moataz-E: Try sudo -E
20:37 StinkfooT joined #mojo
20:50 asarch joined #mojo
20:52 rem_lex| joined #mojo
21:24 btyler_ joined #mojo
21:28 jberger sri: re error messages, its not core but my humane plugin make pop-up messages dead simple
21:34 lukep joined #mojo
21:57 cfedde joined #mojo
22:07 dotandimet joined #mojo
22:27 espent joined #mojo
22:58 btyler joined #mojo
23:04 amirite_ joined #mojo
23:19 dhg joined #mojo
23:50 jnbek joined #mojo
23:54 amirite joined #mojo
23:59 amirite_ joined #mojo

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