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

IRC log for #mojo, 2015-08-24

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

All times shown according to UTC.

Time Nick Message
00:00 jontaylor joined #mojo
00:40 meshl joined #mojo
00:44 cfedde why does the debugger allways start at "IO::Socket::SSL::CODE(0x2dde318)(/home/cfedde/.plenv/versions/5.20.2/lib/perl5/site_perl/5.20.2/IO/Socket/SSL.pm:192):"
00:45 Adura You have IO::Socket::SSL installed.
01:01 jontaylor joined #mojo
01:11 jontaylor joined #mojo
01:12 mattastrophe joined #mojo
01:17 jberger cfedde: isn't that a CHECK block or some such
01:18 bpmedley jberger: I think it's an INIT
01:18 jberger ah yeah
01:18 jberger I'm on mobile atm so I couldn't check
01:43 kwakwa joined #mojo
01:51 kaare joined #mojo
02:22 noganex joined #mojo
02:31 asarch joined #mojo
03:14 lluad joined #mojo
03:44 cfedde yeah.  It's a bit of a pain.
03:51 bpmedley cfedde: Can you workaround with $DB::single = 1; and other stuff?
03:51 cfedde bpmedley: yeah. that would be the best way to go.
03:52 cfedde somehow today I've been thick.
03:52 bpmedley It's a Manic monday.
03:52 preaction I wish it were Sunday...
03:53 cfedde cause that's my fun day.
03:53 bpmedley Unless you're thick in the head on.. Sunday..
03:55 preaction my "I don't have to run" day
03:55 cfedde Your wise men don't know how it feels to be thick as a brick.
03:56 bpmedley That happens to me on int(rand(1)) day.
03:57 cfedde this code uses a lot of the old magic.
04:09 jzawodn_ joined #mojo
04:21 inokenty-w joined #mojo
05:03 berov joined #mojo
05:33 * sri yawns
05:38 hshong joined #mojo
05:50 berov joined #mojo
05:51 arpadszasz joined #mojo
05:57 * crab yaws
06:04 berov joined #mojo
06:05 Vandal joined #mojo
06:05 * batman drinks coffee
06:07 jontaylor joined #mojo
06:11 * ashimema drinks tea
06:19 McA joined #mojo
06:19 lsm joined #mojo
06:21 plicease joined #mojo
06:30 * sri still wonders about this pull request https://github.com/kraih/mojo-pg/pull/10
06:30 sri really too bad the example is not good
06:31 sri little funny, if he hadn't included the example it would be easier to convince me
06:35 sri guess i'm neutral on the actual methods, but -1 on the example
06:47 batman sri: i personally don't like the api very much. it would be cooler if the savepoints were objects that was rolled back to when they go out of scope
06:47 batman just like the transaction
06:48 HtbaaPi joined #mojo
06:48 jontaylor joined #mojo
06:48 batman $sp = $tx->savepoint; .... $tx->commit; # "invalidates" all the savepoints
06:49 batman $sp = $tx->savepoint; .... undef $sp; # rollback to the given savepoint
06:49 Grinnz that could probably translate well to Mojo::SQLite as well
06:49 batman is it worth it if i comment?
06:50 batman i don't have a usecase, but i don't think it's not worth adding the methods unless they give extra value.
06:50 batman s/not//
06:54 * tempire has never used savepoints
06:54 Snelius real men
06:59 sri batman: for a complicated api, it would have to have strong use cases
06:59 sri but go ahead, comment away :)
07:00 * sri waits for the new hearthstone expansion to be released in the next few hours
07:03 talexb_ joined #mojo
07:08 dod joined #mojo
07:13 dod joined #mojo
07:13 salva joined #mojo
07:16 eseyman joined #mojo
07:20 McA joined #mojo
07:59 berov joined #mojo
08:02 berov left #mojo
08:03 berov joined #mojo
08:29 KCL_ joined #mojo
08:36 punter joined #mojo
08:54 AndrewIsh joined #mojo
09:18 meshl joined #mojo
09:24 sri btw. my $sp = $tx->safepoint('foo'); ...; $sp->commit; looks weird
09:31 melo joined #mojo
09:34 marcus sri: I'm waiting too :)
09:34 marcus sri: Did you preorder?
09:42 buu marcus: but mtg exists
09:43 marcus buu: I have a long standing hate of mtg.
09:43 marcus since it ruined my role playing group back in 1992.
09:44 buu =[
09:44 buu That is a heck of a grudge.
09:44 buu But which is worse, mtg for ruining your group, or your grudge for forcing you to play hs instea
09:44 marcus HS is awesome
09:45 buu It's like magic with all the fun bits removed and a lot more dice rolls
09:45 marcus It's like magic but built for online, imo
09:45 buu Well, yes, both things are true
09:45 sri yea, HS is really good
09:46 sri marcus: i did, and have tons of gold saved :)
09:46 marcus Sure, there's RNG, but you could say the same about poker :)
09:46 buu Well, there are lots of people who play clash of clans I guess
09:46 marcus sri: I've got 2300 gold now :)
09:46 marcus but I didn't preorder.
09:46 buu marcus: you realize magic is also online right
09:46 marcus buu: Of course, but it's not native
09:47 marcus Also, it feels like a huge barrier to learn all the dynamics of magic at this point. so many cards
09:47 buu heh
09:47 buu If you can learn perl..
09:47 marcus But can you?
09:48 buu dunno, jury is still out
09:48 buu To be fair they've simplified a lot of the actual rules interactions
09:48 pink_mist we're all just faking it
09:48 buu It's a lot easier to get the fundamental set of rules down
09:49 nigel joined #mojo
09:55 sh4 joined #mojo
09:59 * sri played MTG in the 90s too
10:00 jontaylor_ joined #mojo
10:00 sri the online version seems just bad
10:02 sri HS is absolutely amazing on tablets
10:04 sri marcus: 5000 :)
10:05 sri so, i should theoretically be able to get all the useful cards
10:44 punter joined #mojo
10:50 marcus sri: sounds good in theory.
10:54 batman sri: not $sp->commit. it was $tx->commit;
10:59 sri batman: no
10:59 sri you need to call something on $sp
11:00 batman ok.
11:00 sri $tx->commit is another scope
11:00 batman but can you commit savepoints..? i thought you could only rollback...
11:01 sri eval { my $tx = $db->begin; eval { my $sp = $tx->safepoint('foo'); ... } ... }
11:01 Quai */win 32
11:01 sri batman: YOU PROPOSED THAT KIND OF API!
11:01 sri scopeguard means automatic rollback, but you have to call something to prevent it
11:07 phips joined #mojo
11:09 phips left #mojo
11:22 batman sri: yeah, $tx->commit. not $sp->commit
11:23 pink_mist that doesn't make sense to me
11:25 batman http://www.postgresql.org/docs/9.1/static/sql-savepoint.html <-- i see "release", but no "commit" on the savepoints
11:26 pink_mist well release is analogous to commit in this case, just a different name
11:27 jabberwok English: seven words for same thing. German: one word, but it's seven syllables.
11:27 sri batman: that makes no sense
11:28 sri just look at my example
11:28 sri two scopes
11:28 batman where is your example?
11:28 sri http://irclog.perlgeek.de/mojo/2015-08-24#i_11105587
11:30 batman ok, so i guess you need eval { my $tx = $db->begin; eval { my $sp = $tx->safepoint('foo'); ... $sp->release } ... }
11:30 batman in my original idea (which unfortunately partly just in my brain), i would create the $sp object outside the eval.
11:31 batman like this: eval { my $tx = $db->begin; ... my $sp = $tx->savepoint('foo'); eval { ... } ... }
11:31 sri anyway, unless there's more participants i'm closing https://github.com/kraih/mojo-pg/pull/10
11:32 batman yeah. i'm -1 on #10 (if that matters)
11:33 batman i really don't like named savepoints. my "sausage fingers" (is that even an english expression?) often mess up strings :/
11:34 jabberwok "fat-finger" was an old typewriter-days expression
11:35 jabberwok now Politically Incorrect as insensitive to the avoirdupois-challenged
11:35 buu the .. pounds challenged?
11:36 buu "Avoirdupois is a system of measuring weight based on the fact that sixteen ounces are in a pound. The metric system is based on grams, and the avoirdupois system is based on pounds.
11:36 jabberwok <- trying to be as archaic as possible
11:37 batman jabberwok: thanks :)
11:38 berov1 joined #mojo
11:41 nic joined #mojo
11:41 nic Is there a way to name routes in a lite app?
11:42 nic I mean $r->get('/')->name('main'); works, but detracts from the advantages of lite
11:42 batman nic: get "/" => sub {}, "main";
11:42 nic ah, thanks batman
11:48 mattastrophe joined #mojo
11:56 neilhwatson joined #mojo
12:38 hernanGOA joined #mojo
13:01 sri marcus: looks like we'll have to wait until 19:00
13:02 sri :S
13:04 marcus :'(
13:05 marcus I think I'll actually just play my current decks and grief all the people trying out new decks ;)
13:06 marcus THE FACE IS THE PLACE
13:23 gryphon joined #mojo
13:40 PopeFelix joined #mojo
13:43 PopeF joined #mojo
13:44 hesco left #mojo
14:04 meshl joined #mojo
14:10 sri marcus: but i want to try the new druid cards :/
14:11 marcus sri: Nature will rise against you!
14:14 sri marcus: That didn't... quite hit the mark.
14:14 mst marcus: you can get anti-allergy meds for that
14:19 marcus mst: I guess sri will be fine with druid cards then.
14:21 cpan_mojo JSON-Validator-0.51 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/JSON-Validator-0.51
14:23 * sri sneezes
14:30 cpan_mojo Swagger2-0.50 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.50
14:30 ZoffixWork joined #mojo
14:34 batman about JSON::Validator... i'm thinking about adding a function validate_json(), but i'm not sure if it should be validate_json($data, $schema) or the other way around
14:35 ZoffixWork validate_json($data, $schema).... You could then have the option of making $schema optional
14:36 ZoffixWork (or some default *shrug* I haven't looked at the module yet)
14:37 batman :)
14:49 SmokeMachine batman: https://www.irccloud.com/pastebin/GAmrsxyL/
14:49 PryMar56 joined #mojo
14:49 batman SmokeMachine: not against it. just that i'm not sure if i want to write the code :(
14:50 batman SmokeMachine: check this out: https://github.com/jhthorsen/json-validator/commit/97e659b05f405d71181a8ab8a17b3e43aa9807e4
14:50 batman what do you think?
14:51 njlg joined #mojo
14:51 batman check out the test in the bottom for actual usage
14:53 disputin joined #mojo
14:54 SmokeMachine I'll do that!
14:54 SmokeMachine after lunch... :)
14:54 batman right...
14:54 * batman goes home
14:56 jberger batman: can you do `use Mojo::Base -base;` with `use Exporter 'import';`?
14:56 jberger that looks worrisome to me
14:57 batman jberger: same code as Mojo::Util
14:57 jberger Mojo::Util isn't a class
14:57 jberger -strict vs -base
14:57 jberger load order might make it work
14:58 * jberger scratches head
14:58 batman sorry. i don't follow. what doesn't work?
14:59 batman i guess use JSON::Validator -base doesn't work, but... who cares? :)
15:00 hernanGOA joined #mojo
15:02 jberger right, so you agree that it is a load order thing that makes it work
15:03 jberger I can understand that
15:05 batman no. i don't agree to anything, since i don't know what issue you think might arise :(
15:10 batman jberger: are you thinking that Exporter::import() somehow mess up Mojo::Base::import() ?
15:11 jberger since packages that use Mojo::Base -base inherit from Mojo::Base they also inherit the import method
15:11 batman Mojo::Base::import() define has and friends in JSON::Validator, but is not actually in use in JSON::Validator, so i think it's perfectly fine to override it in the sub class
15:11 batman yes. but i don't use it.
15:11 jberger but then you import the import method from Exporter
15:12 jberger oh, right, that just ends up being an override
15:12 batman yes. because i want that one, and not the one from Mojo::Base.
15:12 jberger sorry, my logic was thinking it was two different imports
15:12 batman i've never used import() from Mojo::Base in any sub class... not sure when that is required
15:12 jberger but even as I typed it I started seeing my error
15:12 batman glad we agree :)
15:12 jberger nevermind, false alarm ;D
15:13 batman i was afraid i had missed out on something big :/
15:13 jberger my perl-foo just had a brain-fart
15:13 jberger perl-fu even
15:13 batman it happens.
15:13 batman actually... it has happened once or maybe twice with me as well
15:13 batman ;D
15:13 batman "to me" ?
15:13 Grinnz_ perl-bar
15:14 jberger I hope it serves those drinks from the other night
15:14 batman Grinnz_: can i order a mojohito in perl-bar?
15:16 Kogurr joined #mojo
15:16 meshl joined #mojo
15:20 sri SmokeMachine: Mojo::Pg::Migrations has something like that https://github.com/kraih/mojo-pg/blob/master/lib/Mojo/Pg/Migrations.pm#L15
15:21 sri https://github.com/kraih/mojo-pg/blob/master/lib/Mojo/Pg/Migrations.pm#L169
15:22 sri uses Mojo::Loader::data_section and the fact that DATA sections without file extensions cannot be static files or templates (hidden from the outside world)
15:24 sri the example app actually uses it https://github.com/kraih/mojo-pg
15:24 sri in the README
15:24 Ptolemarch joined #mojo
15:31 jontaylor my mojo::pg migrations file is getting on for 1200+ lines now, might have to put a shim in place to load from files with a timestamp on instead
15:33 sri wow, you know you can merge old migrations?
15:33 sri only the currently active version number is important
15:33 sri i usually merge old migrations into the original schema after everything has been upgraded
15:35 sri well... currently active, and version you need to upgrade from
15:35 sri umm, to
15:35 sri argh
15:35 sri anyway... just merge ;p
15:39 jontaylor by merge do you mean take a current schema dump, delete all the old migrations, and just continue with the next number in the file?
15:39 sri almost
15:40 sri i manually merge all old changes into the original first version
15:40 sri and keep the last migration as is
15:40 jontaylor ahh right I see
15:40 mst the way we've done it for DBIx::Class is to have a file per version and a file per upgrade
15:40 mst but that's all generated via SQL::Translator
15:41 mst if you insist on manual schema management you have to do a lot more work
15:41 jontaylor I have loads of migrations to create postgres custom aggregation functions, and I reference them all a load to work out my old mistakes :)
15:41 sri i never liked how most migration systems keep dragging around old stuff
15:41 sri it's enough for me to be able to see the history in git
15:42 mst right, that's why we don't do that
15:42 mst but with DeploymentHandler you can just rm the old versions' migration info
15:42 mst and you're done
15:42 jontaylor it does mean though if someone wants to catch up, they need to checkout each version in turn surely?
15:42 mst only if they've ended up way behind
15:42 mst the point here is you do that after people aren't
15:42 sri jontaylor: wouldn't the schema be enough?
15:43 mst development databases that are two years old can probably be wiped rather than upgraded for example
15:43 sri why do they need to know how everything evolved?
15:43 mst and I think sri's talking about apps where he controls the deployment
15:43 mst so he knows when all instances have been upgraded
15:43 mst so he knows there's nobody left wanting to catch up
15:43 sri that's correct
15:43 jontaylor that sounds workable
15:43 mst I do similar, just I do it the easy way
15:43 sri if you distribute upgrades to customers...well
15:44 sri then you should keep the 1200 line migration file
15:44 jontaylor my workflow is heavily rails influenced, which has its pros and cons
15:44 genio in our distributed software it's much more cumbersome as many of our clients are government entities and are extremely slow to upgrade
15:44 sri since i imagine clean upgrades between hundreds of versions is something people pay for
15:45 mst jontaylor: ah, InactiveRipcord
15:45 mst the FormMail.PL of ORMs
15:46 jontaylor i never thought ActiveRecord was that bad, only that it was only suitable to very simple use cases
15:46 mst for some years it didn't believe foreign keys should exist
15:46 * sri never hated the rails before 3.0, but the quality really went down since then
15:46 jontaylor or things like composite keys
15:47 jontaylor sri: thats when I stopped too
15:47 mst but, yeah, ok, if you define it as 'an object to mysql 3.23 admined by a 5 year old mapper'
15:47 mst then maybe it's ok
15:47 mst I actually like databases
15:47 mst hence why DBIx::Class lets you use them properly
15:47 Grinnz_ mysqls before 5... that's a special kind of crazy
15:47 jontaylor It had some advantages, like it removed the level of abstraction of having to know to pass around a schema, by keeping the connection info in the Class, which obviously doesn’t scale to a big app
15:48 jontaylor but being able to go User.find(blah) anywhere is quite nice for trivial apps
15:49 mst global database handles are an error
15:49 jontaylor but too many mistakes, validation in the model instead of the controller, so you’d have to hack around if you wanted different users to validate differently
15:49 mst perl abandoned those over ten years ago
15:50 mst actually DBIx::Class is a lot more like the Repository pattern from Domain Driven Design
15:50 mst hence why it actually works
15:50 jontaylor Dbix::Class is better in another way I like too, in that it seperates the resultset from the result
15:50 mst that''s exactly what I'm referring to
15:50 mst having a proper collection object
15:50 jontaylor I never liked how the Class represented the table, and the instance represented the row in Rails, was nasty
15:51 mst Class::DBI did that
15:51 mst I hated it
15:51 mst so when I wrote DBIx::Class I made sure to not do that
15:53 jontaylor DBIx::Class could do with some documentation though, to show how you don’t have to go all in, like i’ve used DBIx Class to just return hashes before, and that makes it suitable for some more performance oritented tasks, but its hidden away in the docs
15:53 dvinciguerra joined #mojo
15:54 PopeF Unrelated question. Does anyone know how Role::REST::Client handles XML serialization?
15:54 mst that sounds like it's more a problem of not finding it than of it not being documented
15:54 jontaylor The thing that attracted me to Mojolicious in the first place was the example of Mojo::Lite, and then it kind of says, “Want a bit more, try doing this, want more? Add this in”
15:54 mst and the trouble is, it's really hard for us to know where we'd need to put a link, since we're not the ones looking
15:55 jontaylor and you can immediately evaluate that its good for a very wide range of use cases
15:56 mst plus when DBIx::Class was first written the "I don't want an ORM" zealots were all utterly convinced that doing anything except writing all your queries by hand was an offence against god or something
15:56 mst so if you look at the way the intro docs work, they do sort of do that, but for people coming from the ORM side
15:56 mst there's no similar set of docs for people coming from the SQL side that ever got finished
15:57 jontaylor that makes sense
15:59 jontaylor I kind of think from the SQL perspective onwards, like I want something to just give me a hand with some queries, but want hashes back, then I might think, hmm scoping these searches looks nice, I’ll have a resultset class for this one, then think I could do with a couple of methods on, so i’ll go and make it return an object instead
15:59 jontaylor kind of way, if that makes sense
15:59 bc547 joined #mojo
16:00 mst right, so DBIx::ResultSet is a good gateway drug for that
16:00 jontaylor however its not a big deal, because everyone gets it eventually anyway
16:00 jontaylor thats a better term for it, gateway drug
16:01 Ptolemarch joined #mojo
16:02 lluad joined #mojo
16:04 SmokeMachine batman: that looks almost exactly what I want...
16:04 batman Try it out and let me know what you think.
16:07 SmokeMachine I was thinking just about that, but it automatically getting the route name and using it to search the schema file (or data section) with the same name
16:12 SmokeMachine something like the render does...
16:12 SmokeMachine the render()
16:12 batman Then use swagger! :(
16:12 SmokeMachine :)
16:14 SmokeMachine batman: I like the opposite approach for swagger... I like to write the code for my service and the code generate the swagger file...
16:15 SmokeMachine we've done that approach here where I work for node and for java...
16:15 SmokeMachine so, here our service framework automatically generates the swagger file...
16:16 batman SmokeMachine: No idea how to do that. Let me know when you figure it out and I'll implement it.
16:21 batman Note that the generated file need to contain all the features swagger provide
16:21 batman Making a route and placeholder spec is easy, but it must also contain types, query/post params and type constraints
16:22 batman To sum up: I'm not making the mojo plugin, but I have nothing against it.
16:26 SmokeMachine batman: translating some of my nodejs code to something that looks like Mojo: https://www.irccloud.com/pastebin/xA8PxFsu/
16:27 SmokeMachine our nodejs routes looks like something like that...
16:31 SmokeMachine makes any sense?
16:38 batman sort of.
16:39 batman i think it clutters the code though.
16:40 batman how do you sort "$ref". would you store the definitions in defaults() ?
16:43 SmokeMachine sorry, what do you mean?
16:44 batman shared information. nevermind... i'm not going that direction. at least not at this point.
16:45 batman i might take a PR
16:48 disputin joined #mojo
16:53 SmokeMachine :)
17:05 sri marcus: looks like the HS server already crashed :(
17:06 sri blizzard makes cool games, but their servers are terrible
17:07 sri a game with like 20 million players, and they have only like 4 individual server blades for 4 regions
17:09 dod joined #mojo
17:12 sri you know, if it was hand optimized assembler, and crazy compressed io... but their web sites end in .jsp and give apache tomcat errors...
17:18 genio tomcat?! *shudders* that brings back unwanted memories
17:18 mst ah, yes, that thing was very definitely a billable hours generator
17:21 berov1 joined #mojo
17:33 eseyman left #mojo
17:37 hernanGOA joined #mojo
17:41 eitz joined #mojo
17:49 bwf joined #mojo
18:03 Ptolemarch joined #mojo
18:15 kwakwa joined #mojo
18:20 sri 2 hour login queues... i guess the technology just isn't there yet -.-
18:23 ajr_ joined #mojo
18:34 marcus sri: Still trying to get in...
18:35 Grinnz they need more web scale!
18:35 * genio lines up Grinnz in his sights
18:37 * genio impersonates Samuel L Jackson and says "Say 'web scale' one more time!"
18:37 jberger http://www.troll.me/images/hipster-programmer/postgresql-gets-nosql-features-dont-care-i-bet-its-not-web-scale-thumb.jpg
18:37 Grinnz The most irritating part of that picture is "get's"
18:38 genio eww. :/ I didn't even notice that.
18:39 jabberwok po'stgre's
18:39 jberger http://imgur.com/OxxHYHG
18:41 marcus WEB SCALES
18:41 * jberger calls The Wolf
18:42 marcus http://www.dhresource.com/0x0s/f2-albu-g3-M00-04-58-rBVaHVWQmHWAS1B8AAC6Hs1ffDk382.jpg/double-wolf-3d-print-british-style-t-shirt.jpg
18:44 buu joined #mojo
18:46 marcus I suspect I got kicked, but convos doesn't really show it.
18:47 jberger http://imgur.com/KTSN22K
18:47 jberger marcus: ^^
18:47 talexb_ I'm using Test::Mojo to check my API is behaving correctly. It's getting a bit tricky because it's now outputting an array.
18:47 talexb_ How do I get the JSON data strucrture so I check all of the elements?
18:48 jberger talexb_: I don't follow, can you pastie some snippet?
18:48 marcus http://media4.teenormous.com/items/ih2.redbubble.net/image.14095117.0006-fc-550x550-black.u1.jpg
18:48 * jberger misses purl :'(
18:48 marcus somehow being kicked out of hearthstone constantly upsets me more
18:49 jberger purl had such a nice zoidberg factoid
18:50 marcus is she dead?
18:50 marcus or just pining for the fjords?
18:52 Grinnz talexb_, $t->tx->res->json
18:52 talexb_ Grinnz, Oooooh .. that looks exactly like what I'm looking for .. Thanks.
18:53 talexb_ jberger, Sorry for the delay -- try to boil down my code to a pastie had me stumped. Going to try Grinnz' suggestion.
18:53 talexb_ s/try/trying/
18:55 talexb_ Grinnz++ Brilliant. Thanks so much. I think I'm going to see about adding that to the Test::Mojo POD.
18:57 jberger talexb_: IMO that doesm'
18:57 jberger n't need to be added
18:57 jberger http://mojolicio.us/perldoc/Test/Mojo#tx
19:00 talexb_ jberger, You're absolutely right -- it is there. Thank FSM for IRC.
19:00 jberger talexb_++
19:00 sri talexb_: json pointers also work on arrays
19:00 sri just use numbers
19:00 jberger sri: that was what I thought (s)he was asking about
19:00 jberger so I was waiting for a pasite
19:01 jberger *pastie
19:01 talexb_ sri Thanks -- actually, I want to iterate over the array I get back.
19:01 sri marcus: i never managed to log in
19:02 marcus sri: Me neither. Gonna take a break with last week tonight now.
19:02 sri hearthstone is crazy, there's 250k people on twitch watching card packs getting opened :o
19:02 Grinnz it's like if MTG was the in thing today...
19:03 sri wizard poker
19:04 sri i guess what really differentiates it from MTG is that it's also a lot of fun to watch, constantly the number one game on twitch
19:05 sri hehe, sql firewalls are a thing now i guess https://github.com/uptimejp/sql_firewall
19:05 jabberwok So if I write a MyApp::Model::Galleries that, e.g., finds directories which imply parts of the actual app's site structure, and build data structures accordingly -- where is the best-practices place to add the computed routes to Mojolicious: in the main program? surely not in the model itself, nor in the controller, right?
19:06 Grinnz uhhhhh k
19:12 Dada joined #mojo
19:21 Dada Hi! Question : I'm working on a mojo app, and I have trouble with a route : when I try to access the page, I see this error message : "Compilation error at /usr/share/perl/5.14/utf8_heavy.pl line 447" . In my  stash, the controller and action are the good ones, but I also see "cb" => sub { "DUMMY" } and I don't know what that is.. Any ideas? Thanks
19:26 Grinnz_ that is a callback, sub references are output as sub { "DUMMY" } by Data::Dumper
19:27 jabberwok actually my question would be better phrased as:  Can I create a route that is any number of standard placeholders separated by slashes?  to match /events, /events/sturgis, /events/sturgis/devilstower, ... but still have format detection?
19:31 Dada ok, thanks Grinnz.
19:39 * jberger sends marcus some seed
19:39 Grinnz_ srand?
19:40 jberger Grinnz_: you must not watch Last Week Tonight
19:40 Grinnz_ no but i should
19:41 Dada I cant figure out where this "cb" => sub { "DUMMY" } comes from.. Is this a normal thing to have in the stash?
19:43 jberger Dada: are you using either the Lite DSL or the hybrid routes?
19:43 jberger if so I would guess you are still passing one in that way
19:43 jberger you can maybe get a little more info by dumping the callback
19:43 Grinnz_ i recognize that utf8_heavy error btw, i just can't recall from where
19:44 Ptolemarch joined #mojo
19:44 jberger Dada: https://metacpan.org/pod/B::Deparse#coderef2text
19:44 Grinnz_ a blind guess would be upgrading the perl installation without upgrading associated modules that were installed with cpan
19:44 Dada I don't now what "Lite DSL" is, but since i'm not using Mojolicious::Lite, then I guess i'm not using Lite DSL.
19:44 jberger no
19:45 mst "Lite DSL" basically means the subroutines that ::Lite exports
19:45 jberger are you passing any form of sub { } to your router/
19:45 jberger ?
19:47 Dada I have $auth->get('/saveTip')->to('tipsting#save_tip'); my $auth = $r->under(sub {  my $self = shift; return unless $self->check_connected();return 1;}); then $auth->get('/space')->to('space#space');
19:47 Grinnz_ ok, that under callback is it probably
19:48 Grinnz_ also most likely not related to your error
19:48 melo joined #mojo
19:49 mattastrophe joined #mojo
19:51 Dada So.. what do I do? Should I upgrade perl or someting as you mentionned earlier Grinnz?
19:51 Grinnz_ no
19:51 Grinnz_ that was my guess as to what could cause that problem
19:52 PopeF Is there any way to mock Mojo::UserAgent?
19:53 Dada jberger: since I can't load the page and I only see the "Server error" page, I can't use coderef2text, can I?
19:53 PopeFelix If I can avoid forking and creating a HTTP endpoint strictly for testing, that would be preferable.
19:54 jberger PopeFelix: why do you want to mock the user agent?
19:54 jberger do you want to mock some service it attaches to?
19:54 PopeFelix jberger, I'm testing a Moose role that connects to an HTTP endpoint.
19:55 jberger PopeFelix: here is something I use in one of my cpan modules: https://metacpan.org/source/JBERGER/Webservice-Shipment-0.03/lib/Webservice/Shipment/MockUserAgent.pm
19:55 jberger it isn't really mocking the user agent per se
19:56 PopeFelix Right, I remember you showing that to me before, now that you mention it.
19:56 jberger it is mocking the external resource
19:59 PopeFelix Right.  That's not exactly what I want, though. I can mock an external resource just fine. I'm just looking to avoid having to fire off a separate process to do it.
20:00 Dada owww, found it! Thanks for your help Grinnz and jberger. I had many syntax error : a } and a $ missing, but the error messages weren't very helpful. Thanks again
20:01 jberger PopeFelix: why would that need a separate process?
20:01 jberger Dada: ouch!
20:03 PopeFelix jberger, how would it not?  You have the process that makes the request, then you have another process that is listening for, and will respond to, the request.
20:03 mst PopeFelix: er, Mojo's testing stuff runs the app in process
20:03 mst PopeFelix: no second process required
20:03 mst PopeFelix: not sure what you're imagining here?
20:03 jberger what mst said
20:04 PopeFelix mst, I've seen that.  I'm not sure how Mojo does it, though. :)
20:04 mst so why not just use Mojo to do it?
20:04 PopeFelix To create the mock endpoint?
20:04 jberger that mock ua I showed you lets you inject the service response and then sits and waits for you to request of it
20:05 mst PopeFelix: right
20:06 PopeFelix I'm not sure how that would work in context.  Let me work up a paste; that might help.
20:06 jberger PopeFelix: as that example does, it just makes a new mojolicious app, attaches it to the user agent and then rewrites requests to point at it
20:06 jberger see this usage: https://metacpan.org/source/JBERGER/Webservice-Shipment-0.03/t/ups.t
20:08 PopeFelix jberger, that's pretty much what i want.
20:08 PopeFelix Thanks.  Now to adapt the thing. :)
20:08 jberger its pretty much the stupidest thing that could work
20:09 jberger I really should have a hook to check that the correct url was requested etc
20:09 jberger but you should be able to work from there as a starting point
20:09 PopeFelix cool.
20:10 jberger note carefully how it has to switch modes for testing non-blocking requests
20:11 jberger if that is relevant to you
20:11 PopeFelix jberger, no, not really. I want this to block.
20:12 jberger in that case, this line gets easier: https://metacpan.org/source/JBERGER/Webservice-Shipment-0.03/lib/Webservice/Shipment/MockUserAgent.pm#L21
20:13 jberger oh I do have that mock_request event that I emit ;-)
20:13 jberger I forgot about that
20:13 damaya joined #mojo
20:14 damaya Hey all, this is a silly question, but, on my site I have a leaderboard (best ranked) and a page for worst ranked. I'm trying to come up with a good name for the worst ranked (peterboard? bleh), but having some trouble thinking of a good name.
20:15 damaya Just curious if anyone has any ideas. Basically, the other board is for the worst.
20:15 damaya :)
20:15 batman Looserboard?
20:16 damaya Loserboard! Awesome, thanks batman :D
20:16 damaya haha, love it
20:18 * mst also likes bleederboard
20:18 damaya haha
20:20 mst but I think loserboard is, on the whole, better
20:23 mattastrophe joined #mojo
20:23 jberger wall of shame
20:23 jberger but yeah, loserboard is best
20:29 KCL joined #mojo
20:32 damaya I had wall of fame/wall of shame. I dunno, didn't like it for some reason.
20:32 mst leaderboard/loserboard is way cooler
20:32 damaya heck yes
20:32 jberger ^^ agreed
20:36 dave Is there an easy way to get a DOM object from a test in Test::Mojo? So far I'm doing "$t->post_ok(...)->tx->res->text" and putting that in a fresh DOM object
20:39 dave ahhh. nm...tx->res->dom ... didn't cross reference docs enough :)
20:40 jberger yeah, its just a regular tx object
20:40 hernanGOA joined #mojo
20:41 Grinnz_ if it's XML you might want to grab the text and put it in a DOM object anyway, so you can set the DOM object to XML mode first
20:43 genio if the <?xml  tag is there, autodetection happens, right?
20:44 dave wish I'd have discovered Test::Mojo a month earlier, I'll be writing unit tests for a week
20:45 sri that's a processing instruction, and yes
20:46 sri (although, the spec calls it something else i believe)
20:50 meshl joined #mojo
21:00 mattastrophe joined #mojo
21:18 jzawodn joined #mojo
21:25 Ptolemar_ joined #mojo
21:53 lluad Is there any way to give Test::Mojo a base URL, so that $t->get_ok('/foo') will go to http://my.base.url/foo rather than an instance of the local Mojolicious app?
21:53 lluad (It's a nice enough test framework I'm migrating my non-Mojo apps across to it ... :) )
22:00 Grinnz_ https://metacpan.org/pod/Test::Mojo#get_ok theres actually an example of that
22:00 Grinnz_ it just calls $ua->get really, so you can pass it anything
22:05 lluad Excellent. I'll give that a try.
22:07 Zoffix Any of you guys in Toronto area? There's a call for local Perl Monger's Mojolicious talkers: http://www.meetup.com/Toronto-Perl-Mongers/events/224854421/?a=ea1_grp&amp;rv=ea1
22:07 Zoffix for October
22:07 * Zoffix wonders if they should volunteer...
22:08 Zoffix though I'm hardly the most knowledgable one
22:08 njlg joined #mojo
22:17 * Zoffix reads through TPM's email backlog
22:17 Zoffix I think a talk presenting Mojo* as a toolkit rather than just a web framework would be more apropos
22:35 SmokeMachine is there a way to a plugin get a "file" from data section or from a real file transparently with mojo?
22:35 Zoffix Well, I guess I'm drunk enough to be brave: http://i.imgur.com/WrEej8w.png
22:35 Zoffix batman, jberger, sri, if you have any premade material I could use, share :)
22:35 Grinnz_ Zoffix++
22:37 Grinnz_ SmokeMachine: dunno about plugin, but you can use data_section from Mojo::Loader for the first part
22:38 Grinnz_ SmokeMachine: if you're getting this file for a particular purpose there might be something better suited
22:39 damaya joined #mojo
22:39 SmokeMachine I am trying to get the file to use as a son-schema and use JSON::Validator to validate the input
22:41 jberger Zoffix: http://jberger.github.io/MojoliciousIntroduction/#/
22:41 Dada2 joined #mojo
22:41 Zoffix jberger++
22:42 jberger I'm not so far from Toronto either actually
22:42 Zoffix Wanna do a talk? :)
22:42 jberger I'd probably do it for a place to sleep
22:43 jberger But you do it if you want
22:43 jberger Zoffix: where do you hail from?
22:43 Zoffix jberger, Brampton. About a 40-50 minutes drive by car from Brampton
22:44 Zoffix I can do the talk. I think it's time for me to participate in the community more than just logging in on IRC drunk :P
22:44 Zoffix s/from Brampton/from Toronto/;
22:45 jberger Go for it!
22:53 damaya joined #mojo
23:00 damaya joined #mojo
23:16 mattastrophe joined #mojo
23:45 Zx3 joined #mojo

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