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

IRC log for #mojo, 2014-12-05

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

All times shown according to UTC.

Time Nick Message
00:00 Grinnz_ sri: something i was wondering, does $c->every_param include all possible parameters that $c->param can return, or just the GET/POST params?
00:00 Grinnz_ (an array with both say GET/POST and file uploads could be a little odd)
00:02 linagee Grinnz_: I tried to_hash. I think that only works for Mojolicious and not Mojolicious::Lite?
00:02 Grinnz_ possibly. how do you have a $self with Mojolicious::Lite?
00:03 Grinnz_ you *should* still be getting a regular controller, so it should still work
00:04 linagee my example code is using $self and not $c. :-P
00:05 jberger there really is only one thing that exists in ::Lite that has no direct parallel in Full: the group keyword
00:05 Grinnz_ linagee: well $self indicates that you are writing an object class. which you are not. but if it's the first parameter the action gets, then it's the same thing as $c
00:06 Grinnz_ so please elaborate on how $c->req->params->to_hash doesn't work
00:08 linagee awesome. I got it working. no use of ->params->params as above.
00:08 linagee so what I wanted to do was: allow all _stuff=val to pass through to an array.
00:08 linagee er, to a hash
00:08 linagee someone tell me if this makes you go cross eyed. :)
00:08 linagee my %where = map { $_ => $self->param($_) } grep { $_ =~ /^_/ } $self->param;
00:11 linagee I need to add extra fancyness and then remove the underscore from the resulting $_ (hash key)
00:19 linagee haha! my %where = map { substr($_, 1) => $self->param($_) } grep { $_ =~ /^_/ } $self->param;
00:19 linagee will I ever know wtf this does in the future? hah
00:23 zivester joined #mojo
00:29 sri perhaps someone here cares about unique jobs in Minion too? https://github.com/kraih/minion/issues/7
00:30 sri funny how the fact that Mojo::JSON doesn't generate canonical JSON makes it really hard
00:30 sri yay for me arguing against it :(
00:34 mattastrophe joined #mojo
00:36 Grinnz heh
00:36 Grinnz can't rely on that anyway, someone might monkey patch your json module :P
00:39 sri wouldn't that be great "goober a: lets load Mojo::JSON_XS, to speed up our job queue", "goober b: great idea, do it!", "goober b: you guys? why are there suddenly millions of duplicate jobs?"
00:39 Grinnz hehe
00:39 sri s/b/c/
00:41 jberger I think unique jobs is a terrible idea
00:42 jberger I don't want something deciding for me if a job should be skipped, if I queue a job then it should do it
00:42 Grinnz well, there are legit use cases
00:42 Grinnz like, a system where a job being done twice makes no sense and just uses extra cycles
00:42 jberger Grinnz: and in those cases, I shouldn't queue a job
00:42 Grinnz well you still want to queue it with other stuff
00:43 Grinnz i can think of a couple examples from work where we dedup stuff like that
00:43 Grinnz but we do that at the job creation level
00:43 jberger your job can check for a "recently don
00:43 Grinnz i.e. if this job has been done in the past 5 min skip it
00:43 jberger your job can check for a "recently done" marker somwhere else and bailout early
00:43 Grinnz right
00:44 Grinnz or "currently in action", which is closer to what the ticket is saying
00:44 jberger I mean, your job callback, you can check
00:44 Grinnz i would say a better "standardized" way to do it would be to have them provide some unique key
00:44 Grinnz and if another job is submitted with that same key then its ignored
00:45 jberger $minion->add_task( name => sub { return if $bailout_condition; ...
00:45 * sri just wrote that too :) https://github.com/kraih/minion/issues/7#issuecomment-65730321
00:46 jberger Grinnz: I can't think of something generic enough for reuse that would make sense
00:46 jberger hash a set of inputs?
00:46 Grinnz ?
00:46 Grinnz i just said :P
00:46 Grinnz oh you mean, how to come up with the key? thats the application's problem ;)
00:47 sri i think he means ->enqueue(foo => [...] => {lock => 'some_unique_key_12345678'})
00:47 Grinnz exactly
00:47 jberger Grinnz: sorry, I misread
00:47 Grinnz it's how you dedup cached handles in DBI
00:47 jberger I thought you meant that the job should return some unique key, which wouldn't work
00:47 Grinnz yeah totally user-supplied would be the only way
00:51 * jberger uses the prospect of a terrible (american) football game as a excuse to hang out with his dad
00:51 jberger o/
00:54 akhasanov joined #mojo
01:06 akhasanov joined #mojo
01:09 sri \o
01:09 akhasanov joined #mojo
01:10 sri he made a Redis backend for Minion btw. https://github.com/ravengerUA/minion/commit/522999014aadab389f075f78e882fe7c17ad9a63
01:46 davido__ joined #mojo
01:47 rem_lex|pivo joined #mojo
01:55 zivester joined #mojo
02:04 zivester joined #mojo
02:54 akhasanov joined #mojo
02:57 klapperl_ joined #mojo
03:19 noganex joined #mojo
03:21 hesperaux joined #mojo
03:38 woz joined #mojo
03:53 tbushell joined #mojo
03:59 zivester joined #mojo
04:03 * tempire tries mojo::redis2 for the first time
04:30 Akron joined #mojo
05:15 Eke- joined #mojo
05:32 good_news_everyon joined #mojo
05:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/-EfOqw
05:32 good_news_everyon mojo/master 20475e7 Sebastian Riedel: removed a few deprecated methods
05:32 good_news_everyon left #mojo
05:32 sri time flies, feels like i've added nested helpers just last week
05:35 davido_ joined #mojo
05:36 cfedde__ joined #mojo
05:36 cfedde__ joined #mojo
05:41 Vertig0 joined #mojo
05:44 cfedde joined #mojo
06:16 absolut_todd joined #mojo
06:31 rem_lex|pivo joined #mojo
06:38 woz joined #mojo
07:02 crab joined #mojo
07:03 Eke- joined #mojo
07:22 amon joined #mojo
07:29 dod joined #mojo
07:43 Vandal joined #mojo
08:10 eseyman joined #mojo
08:24 trone joined #mojo
08:27 woz joined #mojo
08:30 McA2 joined #mojo
08:33 McA3 joined #mojo
08:59 dod joined #mojo
09:05 woz joined #mojo
09:07 batman anyone looked at swagger? i'm making a module now: https://metacpan.org/release/JHTHORSEN/Swagger2-0.02
09:07 batman http://swagger.io/ <-- "The World's Most Popular Framework for APIs"
09:08 Snelius hmm, what is it
09:08 purl it's it!
09:10 jkramer Sounds interesting, but I refuse to use modules/protocols/whatever with stupid names :D
09:12 marcusr jkramer has too much swagger.
09:14 jkramer It's just that I don't want to look at 'use ...Swagger' or anything like that in my code all the time.
09:15 batman good thing mojolicious doesn't have shagadelic; anymore then :)
09:16 jkramer One thing I love about Perl is that modules usually have sane names that tell you what it does or at least what it's about, instead of random made-up words that are supposed to sound cool or interesting.
09:17 jkramer Also proper namespaces
09:17 batman jkramer: my module name has exactly that name for that reason
09:17 jkramer Yes, I don't blame you for using that name. I blame swagger.io :)
09:18 batman swagger is the name of the api spec
09:18 fhelmberger joined #mojo
09:18 batman if i wanted to be explicit, the module could be named API::Spec::Swagger2, but.... i don't like it
09:20 jkramer You could just implement a protocol that coincindentally looks exactly like swagger, but never mention the name :)
09:21 batman that wouldn't be confusing at all :P
09:21 jkramer But let's not discuss this, I'm just being silly because it's friday morning
09:21 batman :)
09:22 Snelius swagger.. hmm, is better than https://metacpan.org/pod/Raisin ?
09:47 punter joined #mojo
10:04 batman Snelius: looks like raisin use swagger. not sure which version
10:05 batman ah. it use v1.2
10:07 batman Snelius: but i think i do it the other way around: i build the application from a swagger spec file
10:08 sugar joined #mojo
10:13 sugar_ joined #mojo
10:15 Snelius ok
10:23 batman Snelius: https://metacpan.org/pod/Mojolicious::Plugin::Swagger2 <-- you specify an url to your swagger spec, and the routes gets defined automatically
10:23 batman so it enforces "document first" approach :)
10:24 batman doesn't check if the documentation is good though, hehe
10:58 sugar_ joined #mojo
11:01 denis_boyun joined #mojo
11:15 wim joined #mojo
11:21 arthas joined #mojo
11:47 ver joined #mojo
11:58 neyasov joined #mojo
12:05 McA3 joined #mojo
12:14 memowe_ joined #mojo
12:24 ilbot2 joined #mojo
12:24 Topic for #mojo is now ???? hear me roar | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
12:24 caeles joined #mojo
12:31 howitdo joined #mojo
12:41 sugar__ joined #mojo
12:44 mau-tauu-ajaah joined #mojo
12:47 neilhwatson joined #mojo
12:50 mtj- joined #mojo
12:52 jberger sri: I'm using nested helpers already at the new job
12:52 jberger <3
13:07 amon joined #mojo
13:17 dvinciguerra joined #mojo
13:34 neyasov_ joined #mojo
13:35 wim joined #mojo
13:35 bwf joined #mojo
13:38 jamesw joined #mojo
13:38 sugar__ joined #mojo
13:55 suy joined #mojo
13:59 ignacio_ joined #mojo
14:16 zivester joined #mojo
14:19 aleksey joined #mojo
14:20 neyasov__ joined #mojo
14:33 wim joined #mojo
14:41 sri wat? https://github.com/kraih/minion/issues/8
14:43 Eke- joined #mojo
14:57 tbushell joined #mojo
15:04 akhasanov joined #mojo
15:08 Grinnz rofl
15:11 sugar__ joined #mojo
15:20 Ptolemarch joined #mojo
15:21 jberger sri: WHY NO YOU MAINTAIN MODULE::BUILD::TINY??~?~
15:21 * jberger thinks sri should also maintain DateTime
15:22 jberger probably Moose too
15:23 punter joined #mojo
15:24 Grinnz lol
15:27 punter What would be cool, would be having an ORM that works non-blocking with Mojo::mysql (or Pg)
15:34 batman haha. best bug report :)
15:55 sugar joined #mojo
16:20 PotatoGim^Home joined #mojo
16:26 akhasanov joined #mojo
16:29 franzkafka Good morning friends.
16:34 muraiki hi
16:34 PotatoGim^Home hi
16:41 asarch joined #mojo
16:42 franzkafka I am wanting to use a Mojolicious plugin as boilerplate. Can anyone recommend to me a good plugin to use that is up-to-date?
16:43 Grinnz_ there isn't too much to it, from what i can tell; use Mojo::Base 'Mojolicious::Plugin', and then have a register sub
16:43 Grinnz_ theres a bunch of plugins in the mojolicious dist you could look at
16:44 Grinnz_ https://metacpan.org/source/SRI/Mojolicious-5.68/lib/Mojolicious/Plugin/DefaultHelpers.pm
16:48 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Helper-plugins
17:23 Ptolemarch joined #mojo
17:26 franzkafka Excellent, thank you Grinnz_ and sri.
17:26 franzkafka After I am done writing this plugin, can I post in here for some code review before putting on CPAN?
17:28 jberger franzkafka: please do
17:28 franzkafka jberger, thank you :D
17:28 jberger also there is a site called prepan if you are interested, though I never have used it
17:29 franzkafka Whoa, prepan looks awesome. Thanks!
17:29 jberger if you use that, ping us here so we see it
17:29 franzkafka I think I will post here since I'll probably get the best feedback here, but if it's not Mojolicious related I will definitely be using PrePAN
17:29 jberger k
17:33 Eke- joined #mojo
17:39 dod joined #mojo
17:40 Grinnz_ where is it documented what Mojo will use optional dependencies for? i remember seeing it somewhere
17:43 Grinnz_ https://metacpan.org/pod/Mojo::Server::Daemon#DESCRIPTION aha
17:49 Ptolemarch joined #mojo
17:59 mau-tauu-ajaah joined #mojo
18:28 wim joined #mojo
18:30 stephan48 joined #mojo
18:33 mau-tauu-ajaah joined #mojo
18:43 akhasanov joined #mojo
19:02 mau-tauu-ajaah joined #mojo
19:05 mattastrophe joined #mojo
19:07 Ptolemarch joined #mojo
19:14 jb360 joined #mojo
19:17 wim joined #mojo
19:30 Eke- joined #mojo
19:31 * sri yawns
19:31 neilhwatson joined #mojo
19:33 sri finally super green again http://www.cpantesters.org/distro/M/Mojolicious.html?oncpan=1&amp;distmat=1&amp;version=5.68
19:39 Rallias joined #mojo
19:42 mau-tauu-ajaah joined #mojo
19:56 Grinnz_ vulcan blood
19:58 jamesaxl joined #mojo
20:03 romel cool :)
20:05 tbushell joined #mojo
20:28 Ptolemarch joined #mojo
20:48 marty joined #mojo
20:48 marty joined #mojo
21:06 alnewkirk joined #mojo
21:09 rem_lex joined #mojo
21:11 basiliscos joined #mojo
21:25 rem_lex joined #mojo
21:27 woz joined #mojo
21:44 punter joined #mojo
22:28 * sri wonders if the get command should learn about content generators https://gist.github.com/anonymous/5877a1fcfff5be7f7048
22:29 sri maybe not... hmmm
22:30 cfedde TIL: Mojolicious::Command
22:35 neyasov__ joined #mojo
22:36 jberger cfedde: its such a cool thing
22:36 cfedde jberger: it seems so.
22:37 jberger some examples: https://github.com/jberger/Galileo/tree/master/lib/Galileo/Command
22:39 jberger srI: seems nice
22:44 Fistful_of_Coins joined #mojo
22:48 * cfedde looks
22:52 wim joined #mojo
23:05 linagee joined #mojo
23:06 linagee wtf. I was going to do a big complex get headers thing, then I found hypnotoad => {proxy => 1}  hah.
23:07 Grinnz_ yeah.
23:09 marcusr So excited for pg 9.4
23:10 sri just to make sure... this is a valid use case for the :fu: emoji on github, right? ;p https://github.com/kraih/minion/issues/8#issuecomment-65869098
23:10 Grinnz_ rofl
23:16 linagee hrm... TIL - hypnotoad config option only applies to hypnotoad and not morbo.... hah. (probably a newb thing)
23:16 woz joined #mojo
23:17 linagee can hypnotoad do "watch directory" like morbo?
23:21 linagee (is there a reason this isn't done? because of a dev/prod split?)
23:22 Grinnz_ nope, because thats what morbo is for
23:22 linagee :(
23:23 Grinnz_ in a production environment you won't be changing files without the intention of hot-restarting hypnotoad
23:32 tempire arg
23:32 tempire chained certificate setup
23:32 tempire will be the death of me
23:33 Grinnz_ concatenate all the certificates!
23:33 linagee how does my app know if its under morbo or hypnotoad?
23:33 Grinnz_ its kind of annoying, nothing other than apache will concatenate certificate chains for you :)
23:34 tempire linagee: It doesn't. It only knows the mode
23:34 linagee tempire: and how do I know that?
23:34 Grinnz_ morbo defaults to development, hypnotoad defaults to production
23:34 Grinnz_ $c->app->mode
23:35 linagee (I know that seems kind of evil, but its also evil that morbo doesn't have proxy=>1 header detection.)
23:35 tempire linagee: You probably shouldn't be using morbo if you need that.
23:35 tempire use daemon
23:35 linagee tempire: I want to simulate what it will be like when its running in prod
23:36 Grinnz_ then run hypnotoad, or morbo in production mode
23:36 linagee Grinnz_: my IP will always come back as 127.0.0.1 and its bugging me. (because reverse proxy from apache)
23:36 Grinnz_ right, is it actually a problem while developing?
23:36 linagee I feel like I'm just fighting this framework or something. lol.
23:37 linagee also, it sucks that I'm running it under apache. because then websockets don't work, right? :-( :-(
23:38 Grinnz_ theres apparently a way to do websockets through apache in the latest version. but it sounds somewhat experimental
23:38 linagee you have to compile your own apache binary. no thanks. :)
23:38 Eke- joined #mojo
23:38 linagee (or at least have the source to compile your own apache module. still no thanks.)
23:39 Grinnz_ personally, if it gives us a reason to eventually ditch apache i'm all for it :P
23:39 Grinnz_ the websockets thing that is
23:39 linagee Grinnz_: which is quite a weird opinion. a lot of people here are fond of apache. when I talk negatively of it, its like I'm dissing sliced cheese or something
23:39 linagee (which is weird in an of itself because I hate sliced cheese, but that's besides the point)
23:40 Grinnz_ dunno. no one here seems to care for it much
23:40 Grinnz_ its just the thing that runs our web stuff
23:40 linagee "You dislike Apache?!?! heretic!!!"
23:40 Grinnz_ if i was particularly optimistic, i'd suggest we switch to nginx, but fastCGI under nginx isnt easy ive heard
23:41 linagee we run nginx in front of Apache
23:41 Grinnz_ wat
23:42 Grinnz_ to me, apache is a giant ball of cruft, apache vs nginx is like XML vs JSON
23:42 linagee people here hate JSON too. because it costs them a lot of time in the past.
23:43 Grinnz_ wat.
23:43 linagee and we hate ORM
23:43 linagee DBIx isn't even an option
23:43 Grinnz_ well, hating ORMs is sensible, there are a lot of bad ones
23:43 linagee we have a home grown ORM. its worse than bad
23:43 Grinnz_ a bad ORM is far worse than no ORM
23:43 linagee (and I don't mean a home grown implementation. I mean the ORM itself is custom.)
23:44 tempire Grinnz_: disagree
23:44 linagee Grinnz_: we also have MySQL. and half the things have foreign relations and half don't.
23:44 tempire I don't see why it's necessary to map data to objects
23:44 marcusr I don't either
23:44 marcusr it's a bad pattern
23:45 tempire structured data, sure
23:45 Grinnz_ tempire: if a bad ORM runs 32500 queries when you were trying to do an operation in a loop, its worse than spending a day constructing queries
23:45 Grinnz_ oh, wait
23:45 Grinnz_ i dont think you were disagreeing
23:45 linagee we also have an AS400 hiding in the closet with all of the actual data running through it. then we replicate to MySQL and do a bunch of other mind numbing stuff that makes my head hurt.
23:46 tempire oh, you're right.
23:46 Grinnz_ mysql... another fun topic
23:46 tempire I misread your statement.
23:46 linagee I've just exposed some of our stuff using Mojolicious and making a simple REST based interface and its just about the most modern thing here
23:46 Grinnz_ yep... slowly but surely working on that here
23:46 Grinnz_ mysql, however, won't be going away this decade
23:48 Grinnz_ the js guys realllly want to use websockets though. so we're going to need to bypass apache at some point ;)
23:48 linagee Grinnz_: hahahaha. similar here too, yes.
23:50 Grinnz_ tempire: i think an ORM can be a good idea, in moderation, and if there's an easy way to bypass the ORM... but there usually end up being too many exceptions for it to be useful
23:50 Grinnz_ the database is often one of the slowest parts of the app... so optimization isn't just an afterthought
23:50 linagee how is the mojolicio.us perldoc done? PODRenderer? can I use this to document my REST interface?
23:51 marcusr linagee: yes.
23:51 linagee Grinnz_: ORM is evil because: "oh how fun, we can rename all of our stupid variable names to easy to understand english". (Instead of just renaming everything and fixing the problem.)
23:51 marcusr but you should probably use batman's new shiny thing (Swagger)
23:51 linagee its like slapping a large bandaid onto everything that can easily come out of sync if someone doesn't understand what an ORM is.
23:52 Grinnz_ its abstraction where abstraction can be dangerous
23:52 linagee Grinnz_: until someone accesses the database directly without going through the ORM because they're a perl beginner.
23:52 jeff joined #mojo
23:52 Grinnz_ but there are some cases where it's nice, still
23:53 linagee or until someone creates a huge number of abstraction layers in the ORM that makes things hard to understand, so a future dev just ignores it all and violates some obscure DB rule.
23:53 Grinnz_ well.. thats up to code conventions, i can have the same problem when someone doesn't use my function to create a user ;)
23:53 linagee Grinnz_: btw, that problem becomes even worse when you have employee turnover and the guys who used the ORM no longer even work for the company. :)
23:53 franzkafka Hi guys, I'm trying to understand methods in Mojolicious::Plugin. I get that helpers are the methods, but what I'm trying to understand (what I want to do) is have the methods be dynamicly set by options to the plugin. Are there any plugins doing this that I can look at to see how they are doing it?
23:54 linagee Grinnz_: maybe you should have a daemon that always reads over code and gets made when they don't use your functions? that could last longer than your job at a company. lol.
23:54 Grinnz_ hah... i call that "grep"
23:55 Grinnz_ franzkafka: i don't know of any way to pass options... but the plugin does get the $app passed to it, so you could set the options in the $app->config
23:55 Grinnz_ or something like that
23:56 Grinnz_ (similar to setting options for hypnotoad to use)
23:56 franzkafka Grinnz_, the options are set in $app->config, which is set up when the user first invokes the plugin with plugin 'orchestrate' => { option => 'blah' }
23:57 franzkafka One of the options is an array, and I want each item of the array to become a helper.
23:57 linagee Grinnz_: I fear that future people beyond me might have no idea how to make sense of the custom AS400/custom perl/custom sass/custom css/custom js/custom jQuery/custom Angular/custom Borland C++
23:57 Grinnz_ franzkafka: well it sounds like you know what you need to do then
23:57 franzkafka Sorry if I'm not making a lot of sense. I have a head cold because the guy who sits next to me at work chooses to come in when he is sick :/
23:57 linagee Grinnz_: I'm not sure if its a giant jenga or a giant pile of crap. maybe even something in between.
23:57 franzkafka Grinnz_, I know what I want to do, just not how to do it ;)
23:58 Grinnz_ linagee: heh... yeah theres a reason we've converted to pure perl, when i got here there was some C and java :)
23:58 franzkafka I'm looking at plugins on MetaCPAN (e.g., Mojolicious::Plugin::PayPal), but not seeing any that create methods dynamically.
23:58 Grinnz_ franzkafka: check $app->config for what you've set, and set up the logic appropriately
23:58 Grinnz_ franzkafka: however you call $app->handler is what will create the helper
23:59 linagee there's a paypal plugin for mojolicious? lol.
23:59 Grinnz_ lol
23:59 franzkafka Ah, thank you. I think I get it.
23:59 linagee is there a reason its mojolicious specific and not just a perl module?
23:59 Grinnz_ i'm sure there's plenty that aren't.

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