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

IRC log for #mojo, 2015-01-22

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

All times shown according to UTC.

Time Nick Message
00:29 hernan604 joined #mojo
00:30 Averna joined #mojo
00:50 hernan604 joined #mojo
01:02 hernan604 joined #mojo
01:04 hshong joined #mojo
01:10 zivester joined #mojo
01:15 buu joined #mojo
01:26 cpan_mojo Finance-Bitcoin-Feed 0.03 by BINARY - http://metacpan.org/release/BINARY/Finance-Bitcoin-Feed-0.03 (depends on Mojolicious)
01:33 asarch joined #mojo
02:23 klapperl_ joined #mojo
02:33 lb joined #mojo
03:00 akhasanov joined #mojo
03:46 inokenty-w joined #mojo
03:53 noganex joined #mojo
04:52 rem_lex joined #mojo
05:10 irq joined #mojo
05:55 dotandimet joined #mojo
06:07 skittles_ joined #mojo
06:49 ovnimancer joined #mojo
07:12 dod joined #mojo
07:17 dod joined #mojo
07:20 cpan_mojo Mojolicious-Plugin-NYTProf 0.13 by Lee Johnson - http://metacpan.org/release/LEEJO/Mojolicious-Plugin-NYTProf-0.13
07:23 dotandimet joined #mojo
07:30 Vandal joined #mojo
07:30 reneeb joined #mojo
07:41 Lee joined #mojo
07:53 basiliscos joined #mojo
08:02 reneeb joined #mojo
08:05 eseyman joined #mojo
08:20 trone joined #mojo
08:34 batman jberger: Your arguments make sense.
08:35 batman I think I'm going to start working on a solution where I can use tape. Not sure if it can be merged with your module or not.
08:35 batman But I like to use the tools that is available in the language
08:36 batman Omitting the flag to import() makes sense
08:36 denis_boyun joined #mojo
08:36 batman No wait! I would keep the flag. But it might be personal reasons
08:37 batman I like to have a load.t file and doing stuff on import() withouth a flag mess up those tests
08:37 batman Maybe you could AUTOLOAD Test::Mojo instead, if it's not loaded :)
08:39 batman I wonder why it's not easy to implement... Is it because you're not familiar with tape or a technical reason?
09:05 irq joined #mojo
09:44 fhelmberger joined #mojo
09:57 amon joined #mojo
10:00 batman anyone who knows what a boolean value is in YAML? I'm trying "foo: true" without any success...
10:00 batman looks like true,false,yes,no, ... a bunch of things should be valid
10:02 Snelius yep
10:02 Snelius or just "1"
10:04 batman perl -MYAML::XS -MData::Dumper -e'print Data::Dumper::Dumper(YAML::XS::Load("---\nb: false"))' # prints empty string... so it doesn't seem like it has any "boolean" type
10:04 batman except what perl consider true/false
10:05 batman guess i'll stick to 1 and 0 then :/
10:05 Snelius (8
10:18 reneeb batman: http://yaml.org/type/bool.html
10:19 batman reneeb: yeah, i looked at it, but it doesn't seem like it's translated into a boolean object in perl space
10:19 batman thanks anyway
10:28 ashimema joined #mojo
10:39 Snelius batman: perl boolean object ? :)
10:40 batman Snelius: like mojo does for json booleans
10:40 Snelius but perl have not special boolean type
10:40 batman i know
10:40 basiliscos joined #mojo
10:41 Snelius Mojo::JSON->false|true it's just a constant for 0,1 i think
10:41 Snelius yml, key: 1 it must be true
10:41 pink_mist <@batman> perl -MYAML::XS -MData::Dumper -e'print Data::Dumper::Dumper(YAML::XS::Load("---\nb: false"))' # prints empty string... so it doesn't seem like it has any "boolean" type <-- that's because an empty string       IS     what perl defaults to using for a false value
10:42 pink_mist perl -E 'say "False: " . !1'
10:42 batman pink_mist: yeah. i think the case is closed.
10:43 Snelius :)
10:43 batman Snelius: https://metacpan.org/source/SRI/Mojolicious-5.72/lib/Mojo/JSON.pm#L15
10:43 Snelius http://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood
10:44 Snelius batman: oh :)
10:44 batman the problem is that there's no way to get from "" or "1" back to "true/false" from my perspective. but using an object like mojo::json does allows it
10:44 batman *from what i understand*
10:45 jberger batman: can you get tape to load from phantom?
10:45 jberger I can load it from node
10:45 jberger but not phantom
10:46 batman jberger: why not? isn't phantom a browser..?
10:46 jberger dependencies
10:46 purl dependencies are hard.
10:46 jberger thanks purl
10:46 jberger botsnack
10:46 purl thanks jberger :)
10:48 batman jberger: right. if you can't depend on tape, then you can't use it :-)
10:48 batman jberger: maybe this can give you some ideas: http://substack.net/how_I_write_tests_for_node_and_the_browser
10:49 batman *lunch*
10:50 jberger that seems easier
10:50 jberger I can give that a try
10:51 jberger that doesn't appear to use phantom at all (which is fine)
10:51 jberger of course that means no name collision if we wanted to do both
10:57 jberger documentation from testling looks useful too
11:23 basiliscos joined #mojo
11:36 wingfold joined #mojo
11:40 batman jberger: i think it should still be possible to use phantom. it might even be a good idea...
11:40 denis_boyun joined #mojo
11:40 batman too bad i haven't had time to investigate the subject myself :(
11:44 batman does mojolicious have any documentation regarding suggested ssl (tls) settings/versions?
11:44 batman sri: ^
11:44 batman is tls 1 a good idea..?
11:44 sri no, they change too fast
11:44 batman ok.
11:45 sri actually i believe we might need some more settings for the best possible security
11:45 sri for curves and stuff
11:45 sri (pull requests welcome!)
11:46 sri IO::Socket::SSL is supposed to have good defaults though... which we inherit
11:47 sri of course, most people who care simply end up using nginx for tls termination
11:47 ente in which module namespace do I put a module that adds support for a (custom...) protocol to a mojolicious application?
11:48 ente basically I invented my own protocol to talk to eggdrop, and now I'm unsure if this should even go on cpan
11:49 batman thanks
11:50 batman ente: Mojo::Eggdrop...? (Not sure)
11:51 ente well I don't want to add confusion since it's not an official part of Mojolicious, so I was wondering if there's a separate namespace for "extension that nobody uses" :P
11:51 batman ente: no. it doesn't matter if it's official or not.
11:51 batman i got Mojo::SNMP, Mojo::TFTPd, Mojo::mysql, ...
11:51 ente ah, good to know :)
11:51 sri MojoX contains a lot of stuff nobody uses ;p
11:52 ente what's MojoX about? :P
11:53 batman ente: X is often "eXtension", so it was probably the namespace you were looking for
11:53 sri we used that in th beginning... but things didn't work out
11:54 sri so now it contains mostly legacy stuff
11:54 sri the problem with using Mojo::* names is that you're potentially stealing names we might need for core stuff in the future
11:54 sri so don't steal generic names... like Mojo::File or whatever
11:55 batman yeah... so asking a a good idea unless you think the name is specific enough :)
11:56 sri first one to steal Mojo::HTTP2 gets punched on the node by me ;)
11:56 sri s/node/nose/
11:57 sri on the node too!
12:01 batman :D
12:04 ente I'll make sure to provide node.pm as part of Mojo::Node
12:08 * sri wonders what this one-liner should print perl -Ilib -Mojo -E 'say x("<div hidden>test</div>")->xml(1)'
12:08 sri currently it is <div hidden>test</div>
12:08 sri a possibility would be <div hidden="hidden">test</div>
12:10 sri i guess it could just be undefined behavior
12:10 sri who really wants to convert html to xml
12:19 ashimema joined #mojo
12:23 batman sri: +1 on undefined behavior
12:45 neilhwatson joined #mojo
12:47 wingfold joined #mojo
12:50 asarch joined #mojo
13:03 batman i don't get this. i thought "daemon" default to "production" environment..?
13:04 batman but perl -Mojo -e'app->start' daemon --listen http://*:5000 show me a development 404 page
13:04 batman though log level seem to be "info" :/
13:04 tencendur joined #mojo
13:13 disco joined #mojo
13:14 * jberger punches purl right on the node
14:11 PotatoGim^Home joined #mojo
14:25 basiliscos joined #mojo
14:27 jberger so, I realized that I was templating javascript, I may as well, you know, template it :-)
14:27 jberger https://github.com/jberger/Test-Mojo-Phantom/blob/master/lib/Test/Mojo/Phantom.pm
14:27 jberger it's starting to look better I think
14:31 batman jberger: this is the stuff Mojo::IOLoop::ReadWriteFork was created for btw: start process. read output.
14:31 jberger hmmmm, that's a good point
14:32 jberger would I ever need to talk back to the process?
14:32 jberger eh, maybe just the idea of not reinventing the wheel is enough reason
14:32 nicomen jberger: if you add some docs, I'll test it out
14:32 jberger yeah, I certainly need some docs
14:33 jberger the two included tests should make the usage fairly clear though
14:33 batman jberger: no need to use my module if what you have is already working of course :)
14:33 nicomen t => pod - now that would be somethin ;)
14:33 jberger batman: this does work
14:33 jberger I'm not sure how portable it is
14:34 mst nicomen: I have some ideas about POD -> tests
14:34 mst the existing solutions can extract tests from POD
14:34 jberger also it is using the same basic assumption as ForkCall, that when the pipe to the child process closes, the child has exitted
14:34 mst but I think I want something more halfway between inline tests and cucumber
14:35 zivester joined #mojo
14:35 nicomen ah
14:35 jberger every now and again I get the urge to look at cucumber, then I get all scared and run away again
14:36 batman jberger: test(['Test::More::diag', 'Failed to import cookie <%== $name %>']); shouldn't that just be "diag" instead of the fqn?
14:36 jberger aha, you have just found a recent improvement
14:37 jberger it now defaults to calling functions in the original callers namespace
14:37 jberger which is basically the same thing, since typically you will import Test::More
14:37 batman jberger: i would also suggest adding "helpers" for the common test cases. like test.ok($bool, "description") test.is() and test.diag()
14:37 jberger but if you want to import more things, then it will do that
14:37 jberger batman: that is on the TODO list
14:38 jberger or else figure out if no_such_method works in phantom
14:38 jberger which is a non-standard js form of AUTOLOAD
14:38 jberger https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/noSuchMethod
14:38 jberger I misspelt
14:38 jberger __noSuchMethod__
14:39 jberger if I leave the behavior as-is, I intend to rename the "test" function to "call"
14:44 batman jberger: https://ssl.thorsen.pm/paste/43efe8d392bd # one element on your TODO list is done ;)
14:45 batman call sounds like a bad idea, since it's a built int method on objects in javascript... not sure what happens if you define that in the global scope
14:45 jberger you you mean "call", hmmmm
14:46 jberger well I will think of some name
14:46 batman what's wrong with test?
14:46 jberger because it might not test
14:46 batman also, you probably don't want to allow fqn from javascript space into perl space
14:46 batman that sounds like a really bad idea :( ^^
14:46 jberger this isn't for outside use
14:46 batman what do you mean outside use?
14:47 jberger if you write a test that formats your hard drive in perl or js that's on you
14:47 batman but it's very easy to avoid it, so why not?
14:47 fhelmber_ joined #mojo
14:48 batman did you look at my paste, by the way?
14:48 jberger it does seem like a useful way forward
14:49 ichesnokov joined #mojo
14:49 jberger would it make things easier to make it work more like test('ok', [1, 'name'])
14:50 jberger then test.ok = function(args) { test.call(this, 'Test::More::ok', args) }
14:50 batman i don't get why you want those arrays at all
14:50 jberger because I didn't know how you do a variable length array
14:51 jberger of arguments
14:51 batman i just did in the paste!
14:51 jberger I see that
14:51 batman "arguments" is an object that contains a list of the arguments
14:51 batman but it's an object, and not an array.
14:51 batman so i use Array.prototype.slice.call() to make it into an array
14:52 jberger that does sound handy
14:52 fhelmberger joined #mojo
14:53 batman javascript works in mysterious ways.
14:53 batman :)
14:53 jberger fhelmberger: if your first name is fhelm you might be my long lost cousin (and have a really cool name)
15:03 sri \o\
15:03 ignacio_ joined #mojo
15:03 sri /o/
15:04 jberger \o-
15:04 jberger -o/
15:06 denny /o\
15:07 jberger denny: why so glum?
15:07 denny I'm not glum, I'm doing a handstand.  :-p
15:08 jberger denny++
15:08 * jberger spots
15:19 denny that'd be a good idea... can't remember the last time I actually tried a handstand, but it was definitely more than a few months.
15:19 jberger hehe
15:19 jberger batman: https://github.com/jberger/Test-Mojo-Phantom/compare/97c185470b562da73e0c84304849c9dd362ec1f0...master
15:20 jberger I think that makes a lot of sense
15:21 batman jberger: you know how i feel :/
15:22 jberger ?
15:22 jberger you don't want it calling generic functions?
15:22 batman i don't see any reason for it.
15:22 batman i'm also a bit confused by calling perl.ok() what does ok() have to to do with "perl"?
15:23 jberger ok lets start at, are you ok with calling functions in the invoking namespace?
15:23 jberger perl is the handle to talk to perl
15:23 batman i get how it works. i just don't think it's intuitive
15:23 jberger I suppose I could call it test.ok and have it call into perl()
15:24 jberger so, I can see a need to massage the inputs to a function called in perl via js
15:25 jberger for example, like will probably need a wrapper to call qr// on the second ard
15:25 jberger arg
15:25 jberger so maybe I provide that in Test::Mojo::Phantom::_like and have the wrapper function call it rather than Test::More::like
15:26 jberger I can think of a number of reasons to have it be able to call FQNs
15:26 batman sorry, but i think this makes less sense the more i think about it :(
15:26 batman it's cool. but i think i will try to make my javascript tests get run with javascript
15:26 jberger batman: go for it! I'm on board
15:27 jberger but I don't have enough experience in that world to get it working
15:27 batman i'm scared of wrappers for the sake of the wrapper :(
15:27 batman but do you have a requirement that your tests should exchange data with Test::Mojo ?
15:27 jberger so in your tape system, how does it talk to mojo?
15:28 batman what's the usecase for that?
15:28 jberger does it spawn a mojo instance?
15:28 jberger to get the page
15:28 jberger does it need a live server on a known port?
15:28 jberger otherwise, how to you integrate the tap into the harness?
15:28 * batman starts thinking
15:29 batman jberger: did you look at my old project by the way? https://github.com/jhthorsen/test-mojo-browser
15:29 batman (not that i think i ever want to complete it)
15:30 jberger no, I haven't seen that before
15:30 * jberger looks
15:30 batman i guess it's the opposite of what you're trying to do...
15:31 jberger that communicates over websocket?
15:31 jberger that's interesting, though you have to inject a websocket route to handle the traffic
15:31 batman test-mojo-browser sends instructions into the browser and waits for response
15:31 batman that's why i have the after_render hook
15:31 batman ^ inject the code
15:31 batman s/code/js code/
15:32 batman so from my perspective we probably want to solve two things: unit testing the javascript (which doesn't require a browser) and testing user experience (which require a browser)
15:32 batman do you agree?
15:33 jberger I certainly agree on the former
15:33 batman you can also have a look at https://github.com/jhthorsen/test-mojo-browser/blob/master/t/poc.t to see how the test actually looks
15:33 jberger I agree with the latter in concept, but I'm not sure how to do that, even with a browser
15:34 batman ok. but if you only need the former, then why do you need a browser and/or a running mojo instance?
15:34 jberger ok, nm, I see what you mean
15:34 batman can't you just do what i was mentioned in the blog post i posted earlier?
15:34 jberger yes, I agree on both
15:35 jberger so your thing sends the state of the page back after doing some manipulation
15:36 batman not quite. it sends actions (state) to the page and then you can run tests on the DOM in the next step
15:36 jberger https://github.com/jhthorsen/test-mojo-browser/blob/master/lib/Test/Mojo/Browser.pm#L138-L141
15:36 jberger you don't just delegate back to Test::Mojo then?
15:37 batman no. i use a custom element_exists() as you spotted
15:37 jberger so you would have to reimplement all of Test::Mojo?
15:37 * jberger prefers a wrapper :-P
15:37 jberger perhaps that is where we differ
15:38 tianon joined #mojo
15:38 batman the nice thing about test-mojo-browser is that you don't have to know javascript to write the tests.
15:39 batman and there's no weird hacks when it comes to communicating from STDOUT of the browser.
15:39 jberger true, but since you are writing test for javascript actions, I'm assuming you know it
15:39 jberger batman: that is a curious one
15:39 jberger I don't hate the idea of doing transport over websocket, if it can be unobtrusive
15:40 batman i know javascript, but you you can also test the css with this. maybe you don't have any javascript running...
15:41 jberger perhaps this is going to be another case where batman and jberger each implement a thing in different ways
15:41 jberger this would be number 3 right?
15:41 batman which was the two first?
15:42 batman forkcall is _not_ the same as readwritefork
15:42 jberger not the same, but serving a similar purpose
15:42 batman could be... what about the second?
15:42 jberger Mango::Model vs Mandle
15:43 batman aha. well... i kind of ate your code and made it into a monster ;)
15:43 jberger though admittedly Mandle was a fork then rewrite, and I jumped on board
15:43 * jberger likes the image of batman eating code
15:43 batman hehe
15:44 batman YUMMY BITS!!!!
15:44 jberger where is someone with design skills? I want to see a picture of Lego-movie batman eating code somehow!
15:44 jberger TEMPIRE!!!!
15:44 purl somebody said tempire was a ponycorn and always high on coffee and http://www.youtube.com/watch?v=7mZZd4gQrrg
15:44 jberger HAHAHAHAHA
15:44 purl LOLCON 5 reached.
15:45 sri let them eat code
15:45 nicomen batman: why?
15:45 nicomen ah
15:45 nicomen sorry
15:45 jberger sri: but robots eat code, obviously you are excluded
15:45 sri :(
15:46 * jberger feeds sri some tasty forth
15:46 sri http://www.quickmeme.com/img/01/0172d5ff995242bd1d283544b6004da8ce07457a61f99cad4a3db00378654ae0.jpg
15:50 jberger batman: put it this way, I will be happy to see some tape thing working
15:50 batman cool: this looks kind of what i was trying to do: http://angular.github.io/protractor/#/
15:50 jberger and I'm not opposed to merging/sharing efforts
15:50 batman maybe it's not such an awful idea after all...
15:50 jberger I would argue mine is not so far off from that
15:51 jkramer joined #mojo
15:51 jkramer Ahoy
15:51 jberger if I could get tape to work from inside phantom, have it emit the tap there and have it merge in with TAP::Stream then so be it
15:51 jberger jkramer: o/
15:51 jberger or should I say, ARGGGGH
15:52 batman jberger: yours is opposite: you want to run the tests _from_ the browser
15:52 jkramer Is there a way to recover from die() in modules used in a mojo app?
15:52 batman jberger: a bit like this http://qunitjs.com/
15:53 jberger I want tests to run, I don't care who owns them
15:53 jkramer I tried try/catch around the critical part, but the worker still seems to die and I get "[debug] Inactivity timeout."
15:53 batman jberger: maybe not, but your design says the javascript space should own the tests.
15:53 * batman installs phantom
15:54 jberger batman: I would be fine with sending back the entire state of the page, placing that in $t->tx->res and using Test::Mojo from there
15:54 jberger can we figure that out?
15:54 jberger jkramer: can you make a minimal example?
15:55 odc jkramer, using eval { die() }; should be enough
15:55 jberger you probably just need to handle the $tx->on(error => sub { }) event
15:55 batman jberger: are you sure you haven't gone from "trying to test things" to "i want to do crazy stuff in javascript space" ..?
15:56 jkramer jberger: What can I do in that error sub to recover/return something meaningful to the client? Can I ->render in there?
16:01 rem_lex joined #mojo
16:02 jberger jkramer: I think you must already be doing something odd, because this already sends a 500: perl -Mojo -E 'a("/" => sub { die })->start' get /
16:02 Grinnz_ jkramer: exceptions in actions are automatically handled to render an exception template
16:03 Grinnz_ is there somewhere else you're trying to handle errors?
16:03 jkramer I'm also using ->render_later, maybe that results in the timeout instead of the error page
16:03 Grinnz_ right, that would do it
16:03 jkramer But I think I'm onto it. There was another die I didn't catch
16:03 Grinnz_ if you want to render the exception page manually upon catching an error, use ->reply->exception($err)
16:04 Grinnz_ the delay default helper does this
16:05 jkramer Thanks, it's "working" now :)
16:07 jberger batman: I don't think that's true
16:07 jkramer Wow, this is one of the ugliest things I've done
16:07 batman ok. good
16:07 jberger jkramer: when you render_later is it because you are doing non-blocking stuff?
16:07 jkramer Yes
16:07 jberger if so, use a delay object to catch your errors
16:08 jberger I use a delay object in just about every non-blocking method I have
16:09 jberger I wish I could show you some recent code from $work
16:09 jberger but I really can't
16:10 jkramer I'm using $c->ua->get(..., sub { }) currently. How would I turn this into error-catching $delay-code?
16:11 Grinnz_ https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#delay
16:11 jberger do you intend to render in the sub {} or is this a method that gets called by something else?
16:11 Grinnz_ there's an example of exactly that
16:11 jberger if the former, follow Grinnz_ linke
16:11 reneeb jkramer: can you create a short gist with your current solution?
16:11 jberger s/e$//
16:13 marty joined #mojo
16:16 jkramer Yeah I'm rendering in the sub
16:16 jkramer Nice, I'll just copy that example :) Thanks
16:18 cpan_mojo Test-Clustericious-Cluster 0.19 by PLICEASE - http://metacpan.org/release/PLICEASE/Test-Clustericious-Cluster-0.19 (depends on Mojolicious)
16:20 jberger batman: my design goals
16:20 jkramer Hmm, can someone point me to the doc/definition of catch()?
16:20 jberger (1) have the test script not depend on a running mojolicious server (ie start one, like Test::Mojo scripts can), whether that be from a js or perl file doesn't matter
16:21 jberger jkramer: its just a shortcut for ->on(error =>
16:21 jberger see Mojo::EventEmitter::catch
16:21 jkramer Ah ok
16:21 Grinnz_ https://metacpan.org/pod/Mojo::EventEmitter#catch -> https://metacpan.org/pod/Mojo::IOLoop::Delay#error
16:21 jberger (2) emit tap in a normal way in a manner that prove -l can collect tests
16:22 jberger (3) not have to reimplement a large chunk of the test methods in either Test::More or Test::Mojo
16:23 sh4 joined #mojo
16:23 jberger (3.1) if tape has functionality like Test::* (that emits tap and can be collected subject to (1) and (2)) then that is sufficient
16:24 jberger if you can come up with an architecture that does that, especially in a way that is not TOO cumbersome for users to install/configure then by all means lets do that
16:24 reneeb jberger++ that would be great!!
16:25 jberger thing is, mine already meets those
16:26 jberger reneeb: looked recently?
16:26 jberger some improvements overnight
16:26 jberger at least I think they are improvements, you are welcome to weigh in
16:27 jberger batman is claiming too much magic (or something similar)
16:28 jkramer Is there a way to use ->catch in combination with $c->delay, or do I need to do it manually (Mojo::IOLoop->delay(...)->catch()->wait)?
16:28 jberger jkramer: the long version of the helper is shown in the documentation
16:28 jberger if you want it to do something else, just do that
16:29 jkramer Yes I've seen the long version and how it uses catch, but I wonder if I can also define my own catch-sub with the $c->delay helper
16:29 jberger it really isn't too hard to use Mojo::IOLoop->delay directly
16:29 jkramer I know, but $c->delay looks neat :)
16:29 jberger any generalization is beyond the scope, it's already only a thin wrapper for the common case
16:30 jberger use $c->delay where useful, use it's pattern elsewhere
16:30 reneeb jberger: no, I have to fight with JIRA REST API atm
16:30 jkramer Alright
16:31 jberger reneeb: I feel for ya
16:33 jberger jkramer: once you get comfortable with delay object, you will be using it all the time
16:34 jberger I was about to show my MojoForum example from MojoConf, but there have been enough improvements to Delay since then that it now looks cumbersome
16:35 jberger ok well
16:35 jberger https://github.com/jberger/MojoForum/blob/master/lib/MojoForum/Helpers.pm
16:36 jberger jkramer: most of the methods don't need to define a $delay at all anymore
16:36 jberger Mojo::IOLoop->delay( ... )->catch(sub { $c->$cb($_[1]) })->wait;
16:43 jkramer Thanks, works now
16:43 jberger batman / reneeb: added those design goals to the README
16:43 jberger jkramer++
16:43 jkramer Although $c->delay would be prettier :)
16:44 batman jberger: you could very much be right. At least if the only dep you want is phantomjs
16:44 * batman is waiting for the bus...
16:45 jberger I'm open to more deps, note that dependency radius is not on my goals list
16:45 jberger I would like installability to be a consideration
16:45 jberger but I will take the best solution, whose components can be installed via a short-ish description
16:47 jberger I do think that "Install node" will cut the number of people who use it in half
16:47 batman I still believe that I want to do the testing in js...
16:47 batman ETOOLITTLETIME
16:47 jberger batman: this can be the prototype we throw away
16:48 jberger I'm open to that
16:48 jberger but in the meantime, its working
16:48 batman jberger: I don't think so. I'm moving toward the npm/node direction
16:50 batman I think *maybe* I will start off by running phantomjs and then run mojo in a sub process.
16:50 batman It doesn't feel quite right though...
16:51 jberger I'm looking forward to seeing what you come up with
16:51 batman Yeah. Me too... Wonder when...
16:52 batman It will most probably depend on both node and npm
17:11 dod joined #mojo
17:12 tomboh joined #mojo
17:21 odin22 joined #mojo
17:26 jzawodn joined #mojo
17:29 irq joined #mojo
17:39 hahainternet god i need to write some mojo
17:39 hahainternet :(
17:39 hahainternet i need more time in the day
17:39 hahainternet and some sort of work related taser device that detects my procrastination
17:39 disputin joined #mojo
17:45 pink_mist or just sign up for a forced labour camp :P
17:45 pink_mist I'm sure they'll be happy to take you
17:50 tomboh it's not forced if you volunteer ;)
18:07 * jberger cracks the whip
18:11 Grinnz_ theres this pattern i'm doing a lot, i'm not sure if there's a better way... i want a route to have the option of getting a parameter either in the route or via GET/POST
18:11 Grinnz_ but if i make the route parameter optional by setting a default, then theres a default, it won't get the one from GET/POST
18:12 Grinnz_ so i end up having to make two routes, one with the parameter and one without
18:12 Grinnz_ i.e. ->any('/:type')->to(action => 'some_action'); ->any('/')->to(action => 'some_action');
18:13 Grinnz_ then i'm checking $self->param('type') in the action.
18:14 Grinnz_ i could name it something else, but then it's not as simple to check in the action, so kind of defeats the purpose
18:15 jberger Grinnz_: what should happen if the request / and don't provide the parameter?
18:15 Grinnz_ jberger: then it errors out.
18:16 Grinnz_ missing parameter error, whatever
18:16 Grinnz_ this is mostly because these are converted CGI scripts which had to get the parameter via GET/POST before :P
18:17 Grinnz_ i probably wont bother keeping both functionality around for most of them, but just something i've been thinking about
18:17 jberger could you set a falsey default ('') and then do $c->stash->{type} ||= $c->param('type')
18:17 Grinnz_ hmm maybe
18:18 Grinnz_ that wouldnt work if the param could be 0 though
18:18 pink_mist is it possible to set undef as the default? 0_o
18:18 Grinnz_ something to try i guess :P
18:19 jberger well you could still do some variant
18:19 jberger if $c->stash->{type} eq '' or some such, might not be as cute
18:20 jberger for the record (and the IRC log), I suggesting these since you have already stated that this is a back-compat workaround
18:23 Grinnz_ ok, this might actually work, though i'm wary since it's not documented
18:24 Grinnz_ perl -Mojo -lE 'a("/:type" => {type => undef} => sub { my $c = shift; $c->render(json => {type => $c->param("type")}); })->start' get /asdf
18:24 Grinnz_ and get /?type=asdf
18:24 Grinnz_ same result :P
18:25 jberger Grinnz_: you might want to investigate if it is something that could be proposed for a feature (tests and doc)
18:25 Grinnz_ perhaps, it seems reasonable enough
18:25 jberger especially if it already behaves that way
18:26 jberger note for the record that the router continues to be my weakest suit in the game of mojo
18:26 xtetsuji_ joined #mojo
18:26 muraiki joined #mojo
18:39 disputin joined #mojo
18:45 kaare joined #mojo
18:47 fhelmberger jberger: sorry, my name is florian helmberger :)
18:54 cpan_mojo Swagger2 0.27 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Swagger2-0.27 (depends on Mojolicious)
18:56 batman jberger: i need to stop thinking about phantomjs.
18:56 * jberger calls florian fhelm from now on anyway
18:56 jberger batman: hahahaha
18:56 purl LOLCON 4 reached.
18:56 jberger got you off on a tangent haven't I!?
18:59 denis_boyun joined #mojo
18:59 batman it's a sensitive area...
18:59 batman :)
19:03 batman now marcus sent me link to riotjs as well...
19:03 batman ETOOMUCHTOLEARN
19:08 batman jberger: what was the js library you've started to use?
19:09 jberger the only thing I have actually used is phantom
19:09 jberger tape looks useful and I can load it from node, but not from phantom
19:09 batman i meant not jquery, not react, but ...?
19:10 batman not angular, ..?
19:10 jberger oh
19:10 jberger rivets
19:10 tempire Oh my goodness.
19:11 tempire purl's response is the best thing I've seen ever.
19:11 jberger tempire: response to what?
19:11 batman jberger: thanks
19:14 jberger I have no idea how good it is, but it was understandable in an afternoon
19:14 jberger which is good for at least that
19:18 batman indeed
19:18 batman maybe you want to have a look at https://muut.com/riotjs/guide/
19:21 jberger I already see magic in there
19:22 jberger something about errors with whitespace before tags?
19:23 sivoais_ joined #mojo
19:23 batman hahaha
19:24 batman it's like <!DOCTYPE> in old browsers :P
19:24 batman had to be at (0,0) or ie (iirc) wouldn't read it
19:27 vaewyn joined #mojo
19:30 vaewyn Hey all... I have an app I am trying to get running under hypnotoad... and it appears to be totally ignoring the configuration I am sending it. This is a full app... uses the config plugin. I have it warn a dumper of the config right after calling the plugin and I see the settings I expect but hypnotoad just doesn't use them. Any ideas?  http://pastebin.com/zuKT32qN  has a dialog of the startup
19:33 Grinnz_ did you check if it's using the pidfile either?
19:33 batman vaewyn: try adding die; to the config file and see if it picks it up at all
19:33 batman it probably reads the wrong file...
19:33 batman die "DID NOT READ THIS?";
19:33 vaewyn Not using the right pidfile either
19:35 vaewyn It is reading the config file because the VAR1 dump is from $self->config  in the startup { ... }
19:35 vaewyn and shows the values from the file
19:36 batman how did you specify the config file the first time?
19:36 vaewyn and placing a die in it does kill it
19:37 batman environment variable, $app->homer->rel_file(..); ?
19:37 batman something else?
19:37 purl hmmm... something else is going on, but it could be anything.  Can you share the code?
19:37 vaewyn pieces yes... js
19:39 Grinnz_ purl: stop pretending to be human
19:39 purl Grinnz_: excuse me?
19:42 vaewyn Added some basics of the startup and such:  http://pastebin.com/kUDvTtMb
19:42 dotandimet joined #mojo
19:42 vaewyn actual config files contents... etc...
19:43 Grinnz_ you are listening on https but no cert/key is specified?
19:44 Grinnz_ also make sure you have IO::Socket::SSL installed with a new enough version (use mojo version to check)
19:45 vaewyn Everything is working with that... it's just on the wrong port and trying to write the pidfile in the wrong place :(
19:45 Grinnz_ if you change it to http://*:5001 does it still not work?
19:45 vaewyn just tried... correct... doesn't work
19:45 vaewyn still on 3001 wrong pidfile... etc..
19:47 Grinnz_ well the default listen is http://*:8080, so it's getting 3001 from somewhere
19:48 Grinnz_ is the MOJO_LISTEN env variable set by any chance?
19:48 vaewyn I found a hard config set for 3001... removed it and it changed to 3000
19:49 Grinnz_ "a hard config"?
19:49 vaewyn nope... No mojo env vars
19:49 vaewyn $self->config(hypnotoad => {listen => ['http://*:3001'], pid_file => '/var/run/access_hypnotoad.pid'});   etc
19:49 Grinnz_ well that would do it
19:49 Grinnz_ that would replace the whole hypnotoad section of config
19:50 vaewyn freaky...  even if the plugin load comes after it?
19:50 Grinnz_ no then the plugin should set it
19:50 vaewyn (this was a template we start with... I should have removed that but,...)
19:50 vaewyn hrm... let me try something here
19:51 vaewyn found it... we use base a local to set a couple things... that config is trashing it... I'll have to play with that.  Thanks for the help finding it
19:51 vaewyn :)
19:52 Grinnz_ dunno what that means, but glad you found it
19:53 Grinnz_ the way you'd update one thing in the hypnotoad hash (for example) would be something like $app->config->{hypnotoad}{pid_file} = '...'
19:53 Grinnz_ that way you dont blow away anything else
19:54 * vaewyn nods
19:54 vaewyn thanks!
20:05 berov joined #mojo
20:17 bwf joined #mojo
20:29 marmez joined #mojo
20:38 jberger see also: https://metacpan.org/pod/Mojolicious::Plugin::ConfigHashMerge
20:52 vaewyn left #mojo
21:00 punter joined #mojo
21:06 berov jberger: Thanks
21:07 jberger berov: you're welcome of course, but for what? :-P
21:07 berov for the link to Mojolicious::Plugin::ConfigHashMerge :)
21:08 berov did not know it exists
21:08 berov I will need it
21:19 jberger ah, well thank dotan too
21:24 disputin joined #mojo
21:54 jb360 joined #mojo
22:01 skittles_ joined #mojo
22:02 disputin joined #mojo
22:04 disputin joined #mojo
22:05 disputin joined #mojo
22:51 disputin1 joined #mojo
22:52 disputin joined #mojo
22:55 wingfold joined #mojo
23:24 alnewkirk joined #mojo
23:55 muraiki_ joined #mojo
23:58 cpan_mojo Mojolicious-Plugin-RESTRoutes 0.010011 by MAXHQ - http://metacpan.org/release/MAXHQ/Mojolicious-Plugin-RESTRoutes-0.010011

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