Camelia, the Perl 6 bug

IRC log for #mojo, 2012-01-28

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

All times shown according to UTC.

Time Nick Message
00:20 j3nnn1 joined #mojo
00:23 elb0w_ joined #mojo
00:58 paul hmm so i changed my system to waypoint, and it's definitely dispatching the templating
00:58 paul but it never seems to call the actual class method!
01:54 GabrielVieira joined #mojo
02:02 mire joined #mojo
02:51 abstract joined #mojo
02:51 ZadYree joined #mojo
02:52 ZadYree All glory to the Hypno Toad!
02:54 ZadYree Hey I am using mojolicious and I am wondering how to make a file being downloaded by a client, on a page like /foo/down
02:59 tempire ZadYree: you want it to prompt for downloading, I presume?
02:59 ZadYree yup
02:59 ZadYree I have no talents for expressing myself in english :P
03:00 tempire set the content-disposition header
03:00 tempire Content-Disposition: Attachment;filename=afilename
03:02 ZadYree ah ty!
03:09 paul hmm, i have no idea where i'm going wrong
03:09 paul gonna have to find some existing mojo apps and read their code i think
03:26 Debolaz Hrmm, seems I'll continue using DBIx::Class for now.
03:28 Debolaz I was looking into using DBIx::Simple as a more lightweight alternative, but a problem immediately pops up: Database deployment.
03:33 tempire paul: what are you trying to do?
03:35 elb0w_ joined #mojo
03:38 Psyche^ joined #mojo
03:41 paul tempire: i'm just trying to do some simple routing, but i think perhaps i don't quite 'get it'
03:41 paul tempire: one second
03:41 purl one second is second is the duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom.
03:42 paul that is useful
03:42 paul anyhow, http://pastebin.com/nAvLh8pJ was my first attempt
03:42 paul and ./app routes seems to show them
03:42 paul the template name changes based on the action listed
03:43 paul but the class method doesn't run
03:43 tempire just describe how you want it to work
03:43 paul i want to map root level urls, so /get, /set, /whatever to the 'Web' controller and named functions under there
03:43 paul then i want to map second level urls, so /user/get, /user/details etc, to the Web::User controller etc
03:44 alnewkirk Debolaz: NoSQL?
03:44 purl i heard NoSQL was a public domain rdb, that is faster than rdb (which is perl-based evidently). It uses awk - http://www.strozzi.it/cgi-bin/CSA​/tw7/I/en_US/NoSQL/Speed%20Tests
03:44 paul i only just picked mojo up and it seems excellent, but i haven't really debugged or messed around with this much, so don't worry if it's just me being dumb
03:44 tempire is "Web" not the name of your application?
03:45 paul tempire: oh sorry no the classes are actually MyName::Web and myName::Web::User
03:45 paul MyName*
03:45 Debolaz alnewkirk: Scares me.
03:45 Debolaz alnewkirk: Or rather, the lack of traditional transactions scares me.
03:46 alnewkirk Debolaz: design your documents properly and you dont have to worry about things like transactions
03:46 tempire what's the name of your app? MyName?
03:46 paul tempire: yeah
03:47 Debolaz alnewkirk: Its not really obvious what constitutes "properly", and when something isn't obvious, it's guaranteed to be bug-ridden.
03:47 tempire is there a particular reason you're putting stuff into MyName::Web::User, as opposed to MyName::User?
03:48 paul tempire: i figured it was a reasonable heirarchy, i do plan to have non web user related stuff in here too
03:49 tempire by default, it assumes MyName::User, wherein you have $r->get('/somewhere/:name')->to('user#asub')
03:49 tempire but if you want another class, use a namespace
03:49 tempire http://mojolicio.us/perldoc/Mojolicious/Gui​des/Routing#Route_to_class_28_namespace_29
03:50 paul tempire: i see, what i did was to set up $r->waypoint('/user')->to(control​ler=>'Web-User',action=>'home'); but that also didn't seem to work
03:50 paul should i be using namespaces instead of classes named like that?
03:51 alnewkirk Debolaz: "properly" means normalization
03:51 tempire namespaces let you use classes other than the default MyApp::SomeName
03:52 tempire the above link gives you an example of what you're trying to do, though.
03:52 alnewkirk also, ... bugs seem to find there way into code irregardless ...
03:54 paul tempire: i'll check it out, i must be doing something dumb :D
03:54 jnap joined #mojo
03:54 tempire if you look at that link above, everything will be clear.
03:54 paul it's nearly clear, but i just finished a meal so i'm going to sit down with a drink for a while
03:54 paul and then i'll get back on this
03:55 alnewkirk read the routes doc in its entirety and it shall be illuminated
03:56 paul i'm sure i did haha, but i'm not gonig to protest, i'll read it, re-write my crap and get back to you
03:57 alnewkirk s/read/understand/g
03:58 paul haha well one could argue that anyone with questions doesn't understand it, but yeah i will go over it and make sure i figure out where i'm going wrong
03:59 * tempire sprinkles illuminating glitter on paul
04:00 * alnewkirk watches the transformation
04:08 Debolaz alnewkirk: That bugs always are likely to be present does not mean different solutions are likely to have an equal number of bugs in them.
04:11 alnewkirk Debolaz: im not trying to sell you, nor debate on the merits of employing different technologies
04:12 Debolaz alnewkirk: I'm just pointing out that "all software has bugs in it" is a completely irrelevant argument to anything, except if someone claims something is absolutely bug free. :)
04:13 Debolaz Don't ever use that argument again. :-P
04:13 alnewkirk i never argued anything so ..., anyways, if you need an easily deployable, adaptable datastore, ... you probably want a NoSQL solution is all
04:15 Debolaz Sigh...
04:15 * Debolaz will probably just stop replying to alnewkirk from now on.
04:16 alnewkirk oh nooooo, that would be aweful
04:21 Debolaz And saying things like that and "I didn't make any argument" right after you make one would be why.
04:21 Debolaz While certainly not trolling, its still very annoying. :-P
05:25 * crab shakes his cane at everyone
05:26 d4rkie joined #mojo
05:26 * alnewkirk stares at crab with a bucket of hot water in his left hand
05:27 elb0w_ has anyone done a mojo DBIx::Connector plugin yet?
05:27 elb0w_ before I write this now
05:28 elb0w_ yep
05:28 elb0w_ good
05:29 elb0w_ put its not on cpan
05:29 elb0w_ This person did https://github.com/vti/mojox-common/blob/mas​ter/lib/Mojolicious/Plugin/DbixConnector.pm
05:29 elb0w_ but its not packaged or anything
05:30 elb0w_ Is it wrong to redo it and put it on cpan?
05:30 crab why don't you ask him?
05:31 elb0w_ yeah I should
05:33 crab i'd start from scratch, though. it's not like it needs a lot of code, and that thing is part of a big blob of stuff.
05:34 crab and vti may not even be interested in it any more, considering that he doesn't use mojo any more.
05:34 elb0w_ What does he use now?
05:35 alnewkirk vti is pretty active in Dancer-land right?
05:35 elb0w_ why dancer over mojo
05:35 elb0w_ I don't get these things
05:35 crab elb0w: you'd have to ask him. i just know he took his toys and left.
05:36 crab hmm. and it happened almost at the same time that i appeared on the scene.
05:36 elb0w_ maybe he doesn't like crabs?
05:36 alnewkirk elb0w_: its called preference
05:36 elb0w_ alnewkirk: I dunno, I love mojo
05:37 alnewkirk we all do elb0w_ , ,,, we all do
05:37 elb0w_ I honestly would be doing all python / ruby now if I didn't find mojo. It kept me writing perl
05:38 elb0w_ but then again, working with apache2 and mod_perl for 4 years would make anyone not want to write anymore perl
05:45 GitHub141 joined #mojo
05:45 GitHub141 [mojo] amenonsen pushed 1 new commit to master: http://git.io/11oRzQ
05:45 GitHub141 [mojo/master] Fix example (closes #274) - Abhijit Menon-Sen
05:45 GitHub141 left #mojo
05:51 vel joined #mojo
05:53 elb0w_ crab: you think it makes sense to use dbix or just add a before sub to test DBI connect and attempt to re-establish?
05:53 elb0w_ actually nvm dbix would have less overhead
05:53 elb0w_ it assumes your connection is good
05:53 elb0w_ testing before every request would be silly
05:54 crab right.
05:54 elb0w_ ll
05:54 crab i don't like DBIx::Connector much, but it beats pinging manually for sure.
05:57 elb0w_ Yeah
05:58 elb0w_ I want to swap to mongo eventually
05:58 elb0w_ really sucks I can't use rdbms
05:58 elb0w_ I do a lot of the math in the queries
05:58 elb0w_ would be too big of a pain to pull it out and do it in code
05:58 elb0w_ er
05:58 elb0w_ I have to use rdbms
06:15 elb0w_ man theres a ton of mojo plugins in git not on cpan
06:15 elb0w_ what a waste
06:15 purl i think a waste is a terrible thing to mind... or We Await Silent Tristero's Empire or We Await Simon Travaglia's Empire or We Await Stimps' Toast Empire or What A Stupid Tantrum, Eh?
06:41 Vandal joined #mojo
07:24 GitHub162 joined #mojo
07:24 GitHub162 [mojo] amenonsen pushed 4 new commits to master: http://git.io/517SMg
07:24 GitHub162 [mojo/master] Added a merge method to Mojo::Collection. - Israel Fimbres Delgado
07:24 GitHub162 [mojo/master] Merge branch 'ifimbres-collection-merge' of git://github.com/ifimbres/mojo into collection-union - Abhijit Menon-Sen
07:24 GitHub162 [mojo/master] Rename merge to union, include $self - Abhijit Menon-Sen
07:24 GitHub162 left #mojo
07:29 paul so i think where i was getting confused is partly that when using ->to('controller#action'), the controller hash value doesn't get passed to the function inflated
07:30 paul i think i'm there anyway, only just restarted looking at it
07:30 paul lets see :)
07:30 crab what do you mean, inflated?
07:30 paul well in this instance it's ->to('web-user#home');
07:30 paul and it actually calls MyApp::Web::User->home
07:30 paul but the stash value remains:
07:30 paul "action"        => "home",
07:30 paul "controller"    => "web-user",
07:31 paul anyway i haven't checked if i know what i'm talking about so give me a few mins
07:32 crab foo#bar _means_ controller => foo, action => bar
07:32 crab it's just shorthand.
07:33 paul crab: sure, that's not what confused me, i was expecting 'controller' to be translated to 'Web::User'
07:34 crab ah.
07:35 paul i was confused with routes too, but i'm just reading through the guide now and trying each bit before i complain :D
07:35 crab it takes a while to get used to routing, but it's simple really.
07:41 paul right, well waypoints seem to be working exactly as i would expect now
07:41 paul so clearly i'm just a bit of an idiot :p
07:42 hshong joined #mojo
07:43 paul crab: i asked a question earlier but got no answer, i'm using some preexisting tt templates so i've set default_handler to 'tt', but i want to use 'ep' for exception pages so I can get nice stack traces for now
07:44 paul is there an easy way to do this? I could start redefining functions but it seems a little invasive
07:45 crab dunno. i
07:45 crab 've only ever used ep.
07:47 paul fair enough, i have to work on my dbi error handling so it would come in handy :)
07:57 elb0w_ left #mojo
08:33 Foxcool joined #mojo
08:42 paul fair enough, i have to work on my dbi error handling so it would come in handy :)
08:42 paul whoops
08:42 paul wrong damn window
08:44 d4rkie joined #mojo
08:54 GitHub68 joined #mojo
08:54 GitHub68 [mojo] amenonsen pushed 1 new commit to master: http://git.io/NjzQIA
08:54 GitHub68 [mojo/master] Update POD too - Abhijit Menon-Sen
08:54 GitHub68 left #mojo
09:19 kaare joined #mojo
09:29 kaare joined #mojo
10:10 memowe I HAI
10:10 memowe s/I/O/
10:11 crab hi memowe
10:14 paul so i'm working on this project still, and notice MojoX::Session, it all looks good but unfortunately the transport module doesn't have httponly support
10:14 paul i've made a local version and included that, and i assume that will work fine
10:14 paul but should i just send vti an email and plead?
10:24 crab paul: you probably shouldn't be using MojoX::Session
10:24 crab it's very old and abandoned.
10:25 paul crab: oh? i went through the code and it seemed fairly sane
10:25 paul i need to use redis on the backend so i could roll my own plugin
10:26 paul but frankly it would just be reimplementing most of MX::Session
10:26 crab *shrug* ok.
10:26 crab why can't you use built-in sessions, though?
10:27 paul no particular reason, i'll just have to add my own code to add to redis
10:31 crab i think: if you're not using signed cookies, you're doing it wrong.
10:42 paul crab: signed cookies is ok, but i use redis on the backend so i need to push data there too
10:42 paul i'll just add in a plugin hook, i can read session data there
10:51 paul yeah it looks like i can just grab mojo.session from the stash
11:21 GabrielVieira joined #mojo
11:22 crab you want to store session data in redis?
11:22 crab or what? i'm not sure what you're trying to do.
11:30 paul crab: i just need to store an ID to indicate they've logged in
11:35 paul and it's fine, thanks for the help :)
11:43 briang joined #mojo
11:49 ki0_ joined #mojo
12:03 crab paul: you don't need any server-side storage for that. you can just do: if ($self->stash('user_id')) ...
12:04 crab but you've already got it working to your satisfaction, fine.
12:07 paul crab: right but that's only within that session, i need this for non-web clients too :)
12:07 paul so i wouldn't even have a signed cookie to go on
12:08 paul but yeah i have it working with an anyevent redis module, that managed to error and not auto reconnect, which now is going to be a pain
12:26 paul hmm and it seems setting session expiry doesn't work in mojo, very odd
12:27 paul oh wait it was just me being stupid
12:35 paul hmm or not, i'm setting expires but it isn't actually setting it in chrome :/
12:44 paul oh, it's because i'm going to another page and it's resetting it to shorter by default, that's rather aggravating
12:45 paul sorry for liveblogging my discoveries, but it's quite annoying that i have to set the cookie expiry on every page independently?
12:48 paul ah, $self->app->sessions->default_expirat​ion($self->stash('session_expire'));
12:49 paul that works
12:51 jnap joined #mojo
13:46 herrclark joined #mojo
13:54 GabrielVieira joined #mojo
14:19 stephan48 sri: any idea what this error means? Read failed: Can't use an undefined value as a symbol reference at /usr/local/share/perl/5.10.0/Mojo/IOWatcher.pm line 19, <GEN836> line 5.
14:46 sri crab: what's the real world use case for union?
14:47 sri stephan48: if i knew there would be no such error
14:49 stephan48 usually when my app shows this error it ran for some time(this time about a week, but often it manages to stay alive a month).. and it would need a restart
14:52 sri stephan48: and don't ever ask me about an error if you're not using the latest version
14:53 sri just wanted to look into it and that line doesn't even exist anymore...
14:54 stephan48 will try to run it on some current perl...
14:54 stephan48 also this is a problem which also occours after the app ran for a long time
14:55 sri i don't care at all
14:55 sri for all i know it's fixed already
14:55 stephan48 k
14:57 sri crab: all modern oo languages appear to be calling "union" just "concat"
14:57 sri and don't create a new array
15:06 tabbi joined #mojo
15:19 sri crab: i don't quite get why you want to create a new collection
15:21 sri after all you're not even testing that behavior
15:23 sri hmm, i don't get the whole thing
15:25 sri i can't reopen the issue :(
15:26 kaare_ joined #mojo
15:34 sri marcus/tempire: i'd really like to know the use case
15:36 sri and i can't find a public discussion, did you discuss it in private?
15:38 crab back from dinner. why a new collection? because the other methods all create one. concat would be ok if it didn't create a new collection, but would have served my purpose just as well.
15:38 crab otoh, i am an idiot, because i didn't mark it experimental.
15:39 * crab sticks a fork in his head
15:39 sri crab: who else voted for adding it?
15:39 sri and what's the use case?
15:40 sri i'm trying to think of uses for Mojo::DOM, but having a hard time
15:41 crab nobody voted. i thought it was "obvious". my bad. i've often written scraping code that collected children based on the content of the first item in a list and then iterated over them, which i've done by having a collection array.
15:42 sri crab: ok, please vote on new features in the future
15:42 crab sri: will do. sorry.
15:42 sri do you have an example?
15:43 crab somewhere, yes. let me dig up one.
15:43 sri when you're iterating over something and using multiple lines it seems to make more sense to use a normal array to me
15:45 sri btw. i've renamed it to concat in master for now, since i couldn't find another language using union
15:47 sri actually i lied
15:47 sri found .Net, but that's an argument against it :)
15:55 sri there are a few open questions about semantics that depend very much on the use case
15:56 sri like $c1->concat($c2) vs $c1->concat($c2->each)
15:57 sri or $c3 = $c1->concat($c2) vs $c1 = $c1->concat($c2)
15:58 Netfeed why would you use $c1->concat($c2->each) ?
15:58 sri to append individual elements
15:58 sri $c1->concat($c2->slice(4 .. 7))
15:58 Netfeed ah, yeah
15:59 sri collections are all about these little hacks, that's why a strong use case is so important
16:00 sri otherwise i'd just say, use push(@$c1, @$c2) when you have to
16:01 sri concat/union is actually longer, so there needs to be another benefit
16:02 Netfeed isn't concat usually used to just add stuff to one collection wihtout creating a new?
16:02 sri it can be, without use case we don't know what it needs to do ;p
16:02 Netfeed :)
16:15 crab http://hastebin.com/xukimolotu.coffee is approximately the code i had, but i can't find an example of the horrid html i was trying to extract stuff from at the time.
16:24 crab some government site.
16:29 inokenty joined #mojo
16:34 sri crab: i don't quite get how ->concat makes that better?
16:35 sri marcus/tempire: i'd like to hear your opinions about this too
16:35 * sri cracks the whip
16:48 marty Is there any performance advantage to using reusable template blocks versus an include tag helper?
16:55 sri marty: yes, but not enough to care i think
16:56 marty ty, sri.
16:56 mire joined #mojo
16:59 sri hmm, as far as i can see push(@$c1, @$c2) is always better, unless there's a oneliner usecase for ->concat
17:22 sri crab: guy who sent the pull request doesn't have a use case
17:24 sri so my proposal is now to remove ->concat and document array access
17:36 GitHub195 joined #mojo
17:36 GitHub195 [mojo] kraih pushed 1 new commit to master: http://git.io/KICrRg
17:36 GitHub195 [mojo/master] replaced concat method in Mojo::Collection with examples and tests for direct array access - Sebastian Riedel
17:36 GitHub195 left #mojo
17:50 sri we have to support array access anyway, might as well call it a feature
18:29 tempire without a use case, it's just guessing.
18:47 mire joined #mojo
19:12 d4rkie joined #mojo
19:14 Foxcool joined #mojo
20:01 mire joined #mojo
20:29 d4rkie joined #mojo
21:00 marcus hi guys
21:06 marcus sri: I'm fine with direct array access.
21:33 memowe O HAI. :)
21:33 memowe This night I'll get my girlfriend back! \o/
21:34 memowe O, this is #mojo, not #teen-base?
21:48 dmn001 joined #mojo
21:48 larsx2 joined #mojo
21:50 larsx2 alo alo, i have been searching how to increment the timeout on morbo, does anyone knows how to change it from 15s to other value?
21:52 sri you can't
21:53 larsx2 sri: i guess the same applies to hypnotoad right?
21:53 sri nope, hypnotoad can
21:54 sri and for morbo you only can't change the global timeout, per connection with Mojo::IOLoop->stream works for all servers
21:57 larsx2 sri: right, ill give that a try then thanks
21:57 sri morbo just doesn't expose more options because passing them to the forked process it tedious
21:57 sri is
21:58 larsx2 i see
21:58 sri and it's closer to Test::Mojo that way
21:58 sri if someone wants to solve the issue i'm all ears
22:01 sri most options are pretty much useless for testing and devlopment though
22:05 mattastrophe joined #mojo
22:05 larsx2 sri: do you recommend using morbo for a production environment?
22:05 sri hell no
22:09 tempire larsx2: morbo is development only
22:09 tempire hypnotoad is for production
22:12 sri oh, you can disable the ugly scrollbar in macvim
22:17 d4rkie joined #mojo
22:22 sri maybe we should just be more generous with the default inactivity timeouts?
22:22 sri it's currently 20 seconds for user-agent and 15 seconds for servers
22:26 * tempire disabled his scrollbar on day one
22:27 tempire for morbo?
22:29 sri for all
22:34 vel joined #mojo
22:35 sri lets say 60 seconds for server and 90 seconds for user agent
22:44 sri nginx for example uses 60s for most timeouts
22:48 sri heartbeat_timeout and graceful_timeout in hypnotoad are more candidates for a timeout increase
22:48 sri they are at 15s and 30s now
22:50 sri larsx2: what timoeuts do you have in mind?
22:51 sri so far whenever i see someone increase the timeouts it's usually around the 60s mark
22:53 sri it used to be for shitty websites that ran some huge sql query and then rendered a response
22:55 sri but these days it could just as well be an ajax request with long-polling to get progress updates for long running backend jobs
22:56 sri then again, for those tasks an individual connection timeout might be best
22:56 * sri shrugs
22:57 sri and considering i'm talking to myself, that might not be a pressing matter :)
23:03 larsx2 sri: yeah, basically i just wanted to know if it was possible
23:04 kamu joined #mojo
23:05 larsx2 sri: but i have another question of more interest, from the wiki, irc logs, some blog posts, ppl recommend to have 1 db handle per connection using attr or helper
23:05 larsx2 and avoid creating a dbh on startup
23:05 sri you're misunderstanding
23:06 sri 1 dbh per worker
23:06 larsx2 ohhh right
23:06 sri unless you want to do async magic
23:07 sri but you don't
23:07 larsx2 sri: i have this singleton pool that has 10 AnyEvent::DBI handles
23:09 larsx2 and wanted it to be used by these workers, but instead of creating a new async dbh for every worker, just reuse them from the pool
23:20 larsx2 hrm seems i was indeed misunderstanding the prefork model
23:27 * Debolaz ponders how to best hook up his new database module to Mojo.
23:27 Debolaz (Okay, its not "new" :-P )

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