Camelia, the Perl 6 bug

IRC log for #mojo, 2013-01-01

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

All times shown according to UTC.

Time Nick Message
00:00 vervain Verifying session validity is definitely something that would be done with a bridge.
00:00 PanzerBjorn I created a new bald spot on my head the last time I tried to get a bridge working.
00:01 vervain I like to start off with hybrid ( ...->to( cb => sub { ... } ) routes for bridges.
00:02 vervain The most basic being 'sub { return 1; }'
00:03 PanzerBjorn So bridges are the full app version of under, that's about all I know. Wiring them up is where I get lost.
00:03 PanzerBjorn Under worked beautifully in Lite.
00:04 PanzerBjorn under->('/')... is basically what I want to do in my full app. The example in the Mojo docs looks like it creates a circular reference and I'm not grokking it.
00:05 PanzerBjorn The issue with using an anon method in a callback anyway would still be that it's not in controller-land right? If startup could set cookies, I'd just create a helper.
00:06 vervain No... in 'cb => sub { $self = shift; }' $self is a Mojolicious::Controller
00:06 vervain It behaves the same as if it were in a different module/action.
00:06 PanzerBjorn Oh, no kidding? I'd ask to have that magic explained, but it's probably over my head.
00:07 PanzerBjorn Are helpers controllers as well, then?
00:07 vervain That's why I start with hybrid and then when I've got it ironed out I move it to Controller/Action just for good code maintenance.
00:09 PanzerBjorn So to crate a bridge that will proc for every address on my site prior to routing, would it go something like this in startup? $r->bridge('/')->to( cb => sub {...} );
00:10 vervain Look at this snippet http://pastebin.com/gBeLVqgv
00:11 vervain Yes
00:12 tempire vervain: you can leave the ('/') off the bridge
00:12 PanzerBjorn Ohhhh, so after you make a bridge you need to add all other routes to the bridge instead of to $self->routes ?
00:12 Molaf__ joined #mojo
00:12 vervain *nod* but for such a small number of chars I prefer explicit.
00:13 vervain <ding>
00:13 PanzerBjorn So what Lite is doing behind the scenes then is folding all the routes after an under into the bridge created for the under instead of a root level route.
00:14 PanzerBjorn That was the piece of logic I wasn't grokking, thanks.
00:17 vervain np.  More than anything I love those Eureka moments. :-)
00:18 PanzerBjorn I've had a lot of those. And once I make them, I love Mojo even more.
00:18 PanzerBjorn In converting my old libraries to Mojo libs, I've greatly reduced the number of lines of code and made it much more readible.
00:19 PanzerBjorn And EP templates are a godsend over how I was doing TOHEREs in the past...
00:19 vervain Cool
00:21 PanzerBjorn Helpers + Perl 5.10 state variables = huge win too. Holy crap that alone killed hundreds of lines of code.
00:21 jberger <3 state
00:23 vervain I really like the idea of state but I'm not in the habit yet myself.  For some reason my instinct suspects it's a trap waiting to happen and I've not had the time to convince myself otherwise.
00:23 jberger it seems to me that features start showing their warts after about 2-3 years
00:23 PanzerBjorn It does seem far too convenient to be true... But it is. =)
00:23 jberger smartmatch
00:23 jberger given/when
00:24 jberger push $ref, @_
00:24 jberger but state has been available since 5.10 and I've never heard anything but praise
00:24 jberger its only issue is that you have to use 5.10
00:25 jberger but when you do you also get //=
00:25 PanzerBjorn And I think starting in 5.14 it's automagic without needing to use use.
00:25 vervain My caution is in a hunch that it's easy to use badly.  And like I say I've not taken the time to settle on what 'not badly' means. :-)
00:26 PanzerBjorn Bad Perl code is almost part and parcel, though. Then again, that's true of any language.
00:26 PanzerBjorn If your code is bad, you only have one person to blame. ;)
00:26 jberger we're trying to break the myth of bad Perl code, do so by writing good code, and telling other people to stop talking about bad Perl code
00:26 jberger :-)
00:27 PanzerBjorn I've always written good Perl code. Might be why I always lose my Perl jobs. ;D
00:27 vervain Right, as I say, I like the idea, I've just not had the time to discover 'best practices' for state.
00:33 PanzerBjorn Just out of morbid curiosity... Can someone speak to why cookie() lives in Controller land and not in Mojolicious::Base? tempire? sri?
00:34 vervain A request passes through the dispatch mechanism and the first rational point to start manipulating the request is with a Controller.
00:34 vervain That's what controllers do ( in the MVC world ).
00:35 PanzerBjorn Oh yeah, that old pattern.
00:35 vervain and when I say request I mean response too
00:35 PanzerBjorn I almost forgot about it.
00:35 vervain MVC isn't as much of a pattern as it is an architecture.  IYSWIM
00:35 PanzerBjorn I've been living in MVVM/MVVMC land for the last 8 years in my career.
00:36 vervain Fair... and as I typed MVC I _almost_ types MV.*C ;-)
00:41 mattastrophe joined #mojo
00:42 PanzerBjorn Okay, so for code cleanup, how do you move this CB anon sub to a real controller? Just create a new Controller class like normal? And then how do you route to it, just a normal ->to('classname#method') ?
00:42 vervain <ding>
00:42 PanzerBjorn Cake! I like when things just make sense. =)
00:46 * vervain gobbles up some cake.
00:47 * jberger throws cake at PanzerBjorn
00:48 jberger PanzerBjorn, a while ago, I posted this link at you, but I think you had left the room before I did: http://www.slideshare.net/rjb​s/whats-new-in-perl-v510-v516
00:49 PanzerBjorn That probably would have been more handy than what I've already done and read all of the perldoc deltas. ;D
00:49 PanzerBjorn Some awesome new stuff. I'm glad to see Perl moving forward again.
00:49 jberger eh, the deltas a good stuff
00:50 jberger yeah, all it took was admitting that 6 wasn't going to kill 5 and it all started up again
00:50 jberger or so I'm told
00:50 jberger I only started programming with 5.10
00:50 PanzerBjorn Wow. I started on 5.2 =)
00:50 PanzerBjorn (Which I believe was 1997.)
00:50 jberger (I was in 7th grade)
00:51 PanzerBjorn I was desperately trying to leave behind my career as a network engineer to become a web developer. It worked. ;)
00:51 jberger good for you
00:52 PanzerBjorn 8 years of web devel later I kinda came-to and was like, "Wait, I thought I got into all this programming jive to make video games?" So I then pushed to get into the client-side world but I still dabble in web. Some of the technologies I invested in are being killed by Microsoft, so I may fall-back on web dev soon.
00:53 jberger I'm desperately trying to get my Ph.D. in physics and get out into the real world, but this web stuff is shiny
00:53 PanzerBjorn It is awfully shiny. ;D And even as a Ph.D it's useful, web tools can improve and innovate science.
00:53 PanzerBjorn Believe it or not, I've written some fairly deep astrophysics modelling in Perl.
00:54 jberger its true, plus its a cross platform user-interface that everyone is familiar with
00:54 jberger PDL?
00:54 jberger have I shown you my magnum opus? https://metacpan.org/module/Physics::UEMColumn
00:55 PanzerBjorn Not sure what PDL is, but I just used Perl's stock math libs for long-value math and such.
00:55 jberger PDL is NumPy for Perl (but came first IIRC)
00:55 PanzerBjorn Ooooh, neat! =D
00:56 jberger see also: http://perl4science.github.com/videos/
00:56 PanzerBjorn By Gaussian you mean megnetic field theory as opposed to Gaussian numbers then?
00:56 jberger Gaussian distribution of particles
00:57 nic "Perl 5.10 for People Who Aren't Totally Insane" :)
00:57 PanzerBjorn Okay, so the numeric principle associated with particle distribution, got it. =)
00:57 jberger yeah
00:57 jberger nic: I liked that too :-P
00:58 * jberger realizes I haven't added anything to Perl4Science site in a while
00:58 PanzerBjorn Most of the stuff I've used Perl for was regarding theoretical planetary nebula formation and stability.
00:58 vervain HTTP/HTML came from the physics dept.  When I got my CS degree there were stories of how the CS staff went to the Physics dept to see the 'new shiny idea'
00:58 nic You can tell it's New Year's Day when people start flashing their magnum opus in public chatrooms
00:58 jberger PDL was written by astronomers, I'm surprised you haven't heard of it
00:58 jberger its a big opus ;-)
00:59 jberger took some clever coding, If I may say so myself
00:59 PanzerBjorn Astronomy isn't as tight a group as most folks think. ;D And frankly I'm a citizen scientist, my degree WOULD have been a double major in English and CompSci. I got hired out of college after 2 years though, the money was too alluring.
01:00 jberger XS hooks to GSL which solve differential equations defined by Perl-level closures
01:00 PanzerBjorn Being a career academic would have been nice, like my brothers, but I decided to make money the hard way (joking) instead of grants.
01:00 jberger https://metacpan.org/module/PerlGSL::DiffEq
01:00 jberger I'm thinking of going to industry too
01:00 tempire academia always sounded like a exercise in futility
01:00 PanzerBjorn So I just buy college coursebooks in topics that interest me and try to keep up with the science in my own time.
01:00 nic keep them differential equations away from me
01:00 jberger make lots of money, vs beg for grants
01:01 jberger wish I felt like fighting the good fight
01:01 PanzerBjorn I think science should honestly be the focal point of our entire society... But that's a long digression.
01:01 tempire once I realized it was just another political game, I lost interest
01:01 jberger the Federation agrees with you
01:02 PanzerBjorn Dude, the Federation ROCKS. I so can't wait for the 24th century.
01:02 PanzerBjorn (Hope I'm still around by then...)
01:02 jberger tempire: I have seen great grant proposals torpedoed because some reviewer didn't get their paper referenced
01:03 jberger the egos are colossal
01:03 tempire yeah
01:03 tempire every time I hear someone talk about science vs religion, I think they probably haven't ever been involved in the dissertation process
01:03 PanzerBjorn lol
01:04 PanzerBjorn Science vs Religion is one of the single biggest interests I have, personally. That whole debate fascinates me.
01:04 PanzerBjorn It's rare that you can watch a 3-hour debate where both sides completely miss the point. =)
01:04 * tempire puts the lid back on pandora
01:04 jberger I was raised on the religion side and now I live on the science side, its a debate I can be on for days
01:04 jberger but I won't :-P
01:05 PanzerBjorn Heh, I'll zip-it. ;)
01:05 tempire I'll reopen it next time the three of us are in the same room.
01:05 jberger with a nice scotch
01:05 tempire then I will reign down fury on your faulty opinions
01:05 tempire !!!!
01:06 * jberger throws Galapagos turtles at tempire
01:07 * jberger likes throwing things on IRC
01:07 nic anyone done direct uploading to cpan from github?
01:07 * jberger throws St. Augustine at PanzerBjorn
01:07 nic apparently there was a blog post everyone refers to, but it's down now
01:08 jberger nic: mojo cpanify?
01:08 nic no, directly from github
01:08 jberger like from a hook?
01:08 nic I told pause.cpan.org my github url
01:08 nic but then I all over the place
01:09 nic .../tarball/master
01:09 jberger hmmmm, never tried that
01:09 nic should have worked, but it has messed up the distribution name (everything else looks ok)
01:09 jberger can I see a link to your project?
01:10 nic cpan or github?
01:10 jberger github
01:10 nic https://github.com/niczero/mojar
01:10 jberger I've gotten to be a bit of a deep hacker on Module::Build
01:12 jberger you're trying to distribute this directly from github? there are no meta files, nor manifest
01:12 nic actually, I think it has worked fine
01:13 nic it looks really weird with the github filename being the distribution name, but that's possibly correct
01:13 nic it's on metacpan, but not showing up on search.cpan.org yet
01:13 jberger metacpan refreshes faster
01:14 nic metacpan++
01:14 jberger dude, sorry, but thats realllly icky
01:15 nic ?
01:15 jberger the dist name is that long string
01:16 jberger because you don't have proper META files and your file coming from github has that long string
01:16 nic yeah, shame to have spent so long getting the content looking better and then have the ugliest distribution name
01:16 jberger without a manifest, I'm not sure its installable
01:16 nic it's installable
01:16 jberger I would actually say you should remove it from CPAN and do it again properly
01:16 nic you don't need all that meta-para-funnalia
01:17 jberger actually I'm gonna guess each time you do that is a new dist
01:17 nic no, it's just showing the filename it came from
01:17 jberger yes but the PAUSE indexer uses that as the dist name
01:17 nic hm, that's a point
01:18 jberger and the META stuff is generated by the makefile
01:18 nic I really don't want "niczero" being part of the dist name
01:18 jberger so why not do it
01:18 jberger ?
01:18 nic jberger: are you saying you don't see the makefile?
01:18 jberger when you do `perl Makefile.PL && make dist`
01:18 jberger you the developer
01:19 nic eh?  I've never done that
01:19 nic do people really do that?
01:19 jberger then you can use mojo cpanify to upload it
01:19 jberger yeah, thats THE way
01:19 jberger (not the cpanify, the other stuff)
01:20 jberger you will need to run make manifest too
01:20 nic boo.  I really wanted to finish this last year and get to be 3 hrs ago
01:20 jberger seriously, this doesn't take long
01:20 nic I'm genuinely surprised.  Why do I need to do all that manual stuff when it's all in the makefile?
01:21 nic are you sure you're not doing redundant steps?
01:21 jberger sorry, nope, gotta do it
01:21 nic right, there's one way to find out
01:21 jberger it does seem like pause should do it when you upload, but it doesn't
01:21 nic I'm going to change the uploaded filename so the daft "niczero-" isn't there; then I'll do a simple upload
01:22 jberger when you do make dist it should make the right filename
01:22 nic If it's all fine tomorrow that means your steps are silly and you owe us all a new year drink
01:22 jberger seeing as I have a perl foundation grant to extend Module::Build, I think I know what I'm on about :-)
01:23 nic we'll see :)
01:23 jberger also, you dont have a changes file, which is polite
01:23 nic you just haven't found it
01:25 jberger hmmmm, I'm not sure how CPANTS will deal with that
01:25 jberger if you care
01:27 nic I care, but not as much as I care about getting to bed
01:27 jberger understood
01:27 jberger we all started from somewhere
01:28 jberger but believe me, old bearded Perlers won't take you seriously if your dists look like that
01:28 jberger and since it doesn't take too much more work to do it right, I recommend it
01:28 jberger I'm happy to help too
01:29 jberger I wonder if there is a good document for this?
01:29 jberger this is also why Dist::Zilla was made, minimal boilerplate
01:29 jberger but I have decided that the slight amount of effort is worth it
01:30 nic thanks -- I'll see how things look tomorrow and then adjust
01:30 jberger cool
01:31 jberger maybe I should make a blog post about what steps should be taken for a release
01:31 jberger (seems like something brian d foy must have already done)
01:33 jberger http://www.perlmonks.org/?node_id=879515
01:40 PanzerBjorn Okay, next little curiosity... We have bridges, which can be used to call a Controller before any routing is done... How about a global post-routing call? Sort of a destructor, if you will. I'd like to close the database handle after everything is done.
01:41 nic PanzerBjorn: where are you holding the db handle?  in the stash?
01:42 PanzerBjorn Nope, in a helper using a state variable.
01:42 nic so how do you know that another hit isn't trying to use the handle?
01:42 PanzerBjorn Putting a DB handle in a place like the stash where it could be gleaned by a template is scary business.
01:43 PanzerBjorn Another hit wouldn't be in the same lexical scope.
01:43 PanzerBjorn (Or is this mod_perl all over again?)
01:44 nic if your handle is lexically scoped then there's nothing you need do, it'll be closed automatically when scope is dropped
01:45 jberger PanzerBjorn, why close it?
01:45 PanzerBjorn DBBI complains with a warning to STDERR when you fail to close the DB connection gracefully.
01:45 PanzerBjorn DBI
01:46 jberger hmmmm, I'm not your guy on this, DBIC does it all for me
01:46 vervain But the connection won't be closed.  It'll persist waiting for the next request ( if it's part of your app )
01:46 vervain app ~= helper
01:47 PanzerBjorn Oh, so this is mod_perl all over again?
01:48 PanzerBjorn If that's the case then the DB connection handle could timeout and die if it goes unused long enough or exceeds the maximum number of requests per connection.
01:48 jberger I really don't think this is mod_perl?
01:49 vervain Your helper should deal with those cases.
01:50 jberger there is some wrapper class, DBI::Connection or something
01:50 vervain But this is neither a Mojolicious or mod_perl thing... it's just daemon/fork orientated programming with a DB handle.
01:50 PanzerBjorn I didn't realize that each request was re-using lexically defined values like mor_perl does, every indication I've seen in my apps in Mojo thus far never pointed to that.
01:50 vervain DBIx::Connector is one way to deal with this paradigm
01:51 jberger vervain, yep, thats what I was trying to remember
01:51 jberger see also: http://stackoverflow.com/a/8353659/468327
01:54 PanzerBjorn Interesting, so using straight-up DBI $dbh in Mojo is a nono?
01:55 nic PanzerBjorn: I'd recommend keeping a connector global to the app and get it to generate a dbh for each block that requires one
01:55 vervain This thread intrigues me too but again I've not quite digested it all: https://groups.google.com/d/msg/mo​jolicious/5AQ_0vowKEs/AmrNhoEwy84J
01:55 PanzerBjorn That's incredibly wasteful of connections if you've got a large number of code chunks. =/
01:56 nic are you connecting to oracle?
01:56 PanzerBjorn No, worse: MySQL.
01:56 nic I don't think you've benchmarked any of this have you?
01:56 vervain que?
01:56 nic connections to mysql are very lightweight and fast
01:57 PanzerBjorn With mod_perl and a test harness you can exceed max connection pool very quickly.
01:57 nic esp if you have already set up all your params in a connector
01:57 nic you don't need a connection pool with mysql
01:57 nic that's for oracle and others slow at connecting
01:57 PanzerBjorn No, MySQL's connection pool. MAX_SOCKETS.
01:58 vervain If your DB is connecting per request instead of per-daemon/child instance or per handle definition then you have bigger problems.
01:58 jberger vervain, I think thats the disconnect here
01:58 nic PanzerBjorn: maybe you're thinking of server connections
01:58 PanzerBjorn 10k simultaneous users at 5 connections/queries per second and fall-down-go-boom comes pretty quickly.
01:59 nic you can only waste those if you leave connections open -- I'm saying only have them for the block that needs them
01:59 nic your db can only handle 5 q/sec?
01:59 PanzerBjorn 50,000 connections per second.
01:59 vervain I think he is suggesting 50k / sec
02:00 vervain <snap>
02:00 jberger well you guys have fun sorting this out
02:00 PanzerBjorn Assuming a request calls 10 modules that each need to make a query, etc. and a user makes a request every 2 seconds, 10,000 concurrent users. This is a pretty typical load.
02:01 jberger I'm off to celebrate the the rolling of a bit on our calendar
02:01 jberger happy new year all
02:01 jberger o/
02:01 PanzerBjorn Cheers! =)
02:02 nic PanzerBjorn: I thought previously you said you were going to put it in the stash and then delete it before rendering?
02:02 PanzerBjorn No, I asked if that's best practice in Mojo. I've since been informed that it's much more nice to make use of a Helper with a state variable.
02:03 PanzerBjorn A la $self->helper( dbo => sub { state $dbo = PDM::DBObj->new });
02:03 PanzerBjorn Then every controller that needs to make any queries just uses $self->dbo->query(...) etc.
02:04 nic doesn't that just create a single dbh per app?  (maybe I'm reading it wrong)
02:05 vervain Per app instance/fork I think.
02:05 PanzerBjorn For the sake of not pissing off whoever it is who maintains DBI that makes it send a warning to STDERR each time I fail to call $dbh->disocnnect I was simply wondering if there's a way to make that call when the script is done.
02:06 nic vervain: yeah, so with 4 processes you'd have 4 db handles
02:06 vervain I'd have to look at previous code but I'm nearly 100% certain you can stop DBI from making that complaint.
02:06 nic which is really not what anyone wants
02:06 vervain nic: why not?
02:06 PanzerBjorn Yeah, why not? ;D
02:06 nic cos you don't get any new ones
02:07 PanzerBjorn Good point.
02:07 nic what happens when one gets closed by the server?
02:07 PanzerBjorn Then that thread goes dark. o.O
02:07 nic :)
02:07 nic that could be a novel... Dark Threads
02:07 PanzerBjorn ... except that I have mysql_auto_reconnect set.
02:08 nic ah, was going to ask about that
02:08 nic so your connections are read-only?
02:08 PanzerBjorn Don't leave home without it. Yeah, it means I don't have to write my own code to check the handle's connection state before I use it every time.
02:08 PanzerBjorn No, read/write.
02:09 nic ooh, dangerous
02:09 PanzerBjorn Oh?
02:09 nic how can you know if the previous write succeeded?
02:09 nic i take you're not using any transactions?
02:10 PanzerBjorn In places where I do transact, I do a begin, then push all the data in do's, then a commit.
02:10 PanzerBjorn In one place.
02:11 PanzerBjorn For instance inserting a record that needs to setup foreign key refs, so begin, create the master record, get last insert id, insert key ref, commit.
02:11 nic If your connection drops then reconnects during a transaction, you think you've committed but the data is screwed
02:11 PanzerBjorn Yeah, that's true.
02:12 PanzerBjorn Odds of that happening are probably quite low though and I have the rollback on close flag turned on so nothing gets committed halfway.
02:12 nic I'd recommend using DBIx::Connector (as someone mentioned earlier) or the Mojar::Mysql::Connector that I've kind of just uploaded
02:13 nic rollback won't help you
02:14 PanzerBjorn I don't want to sound ungrateful for the advice, I just don't know when I can rewrite yet another library. =/
02:14 nic BEGIN-->break-->COMMIT -- everything from break to COMMIT gets committed but that's not what you meant
02:15 PanzerBjorn Good point. =/
02:15 nic actually, I think you'd just lose the connection cos auto_reconnect is supposed to get disabled when you BEGIN
02:15 nic though it's slightly unreliable
02:15 PanzerBjorn Amazingly the existing site's been running for 12 years like this with thousands of concurrent users... I suppose we have been incredibly lucky.
02:16 PanzerBjorn Then again, 12 years ago things were a lot more innocent.
02:18 nic it shouldn't take long to set it up to use connectors, you just need to decide where you'll create connections and where you'll drop them
02:19 PanzerBjorn And then rewrite my DBObj library to be ecumenical to DBBIx::Connector as opposed to DBBI $dbh. =/
02:19 nic anyway, really need to head to bed.  happy 2013.  if I don't wake up before 2014 I'll read the logs
02:19 nic no, you're still dealing with DBI handles
02:19 PanzerBjorn Thank you Razer for doubling capital Bs on your keyboards after someone types a capital D.
02:20 nic you just store a connector somewhere so it's ready to pass you a DBI handle when you want one
02:20 PanzerBjorn Cheers, have a great new year. =)
02:20 PanzerBjorn I'll read up on COnnectors when I have a moment.
02:21 vervain You'll need to find the DBIx::Connector equivalent for your DBObj thingy or do something similar.
02:21 vervain Oh... DBObj is a DBIx thingy... so maybe it'll just work.
02:22 PanzerBjorn DBObj is just a OOP class I made for fast and easy handling of $dbh, it just wraps core DBI methods.
02:23 PanzerBjorn So I can do things like $dbo->do("INSERT something"); and $dbo->singlerow("SELECT single row blah blah");
02:23 PanzerBjorn The error-checking, attribute handling, prepares, etc are all handled in the lib so I don't have to.
02:47 bluescreen joined #mojo
02:51 b2b joined #mojo
03:09 iskyee joined #mojo
03:25 noganex_ joined #mojo
03:47 jpn joined #mojo
03:50 tempire Well
03:51 tempire This time 2 years ago, I was on a couch writing tls authentication support
03:51 tempire time flies
04:21 mattastrophe joined #mojo
04:27 Miked joined #mojo
04:29 mattastrophe joined #mojo
04:32 greytrader joined #mojo
05:13 d4rkie joined #mojo
05:34 noganex joined #mojo
05:46 mattastrophe joined #mojo
06:23 Foxcool_ joined #mojo
07:06 PanzerBjorn 2 years ago I was working for Atheros/Qualcomm writing cobranded network configuration tools... Ironically one of the most successful string of software releases for many years in my career.
07:07 PanzerBjorn Most places dump tons of money and time into products they never launch or ideas they never let come to fruition.
07:19 Vandal joined #mojo
08:29 kitt_vl joined #mojo
08:38 rem_lex joined #mojo
08:46 ladnaV joined #mojo
09:08 Miked joined #mojo
09:10 iskyee joined #mojo
09:17 davido joined #mojo
09:19 kitt_vl joined #mojo
09:25 sri holy backlog batman
09:25 sri o/
09:58 human39 joined #mojo
10:02 wircus i/
10:23 wircus \o
10:37 dod joined #mojo
10:39 lammel2 joined #mojo
10:56 ObseLeTe joined #mojo
11:00 mire_ joined #mojo
11:07 dod joined #mojo
11:12 Vandal joined #mojo
11:15 ladnaV joined #mojo
11:30 ObseLeTe joined #mojo
11:50 Vandal joined #mojo
11:51 sinkovsky joined #mojo
11:51 Mad_Dud joined #mojo
12:11 sinkovsky joined #mojo
12:22 ObseLeTe joined #mojo
12:23 Britzel_ \o/
12:30 memowe Happy new year, mojo folks! :)
12:39 ladnaV joined #mojo
13:03 Vandal joined #mojo
13:07 ladnaV joined #mojo
13:15 Vandal joined #mojo
13:15 iskyee joined #mojo
13:22 sinkovsky joined #mojo
13:32 ObseLeTe joined #mojo
13:42 ObseLeTe joined #mojo
13:43 Vandal joined #mojo
13:45 mire_ joined #mojo
13:59 wircus happy new year, memowe
13:59 memowe \o/
14:00 kitt_vl joined #mojo
14:01 sri \o\
14:01 sri /o/
14:01 wircus hmm, bluestacks is actually kinda neat, just wish it supported retina display and fullscreen
14:26 iskyee joined #mojo
14:33 yakubori joined #mojo
14:34 yakubori hello. happy new year :)
15:02 yakubori if i want to write a test case that starts with a redirect (e.g. for unauthorized access), what should I chain after the 'status_is(302);' part in order to make sure I was redirected to the right url?
15:15 Britzel joined #mojo
15:28 gryphon joined #mojo
15:30 Miked joined #mojo
15:58 gryphon_ joined #mojo
15:58 gryphon__ joined #mojo
15:59 gryphon__ left #mojo
16:11 gryphon joined #mojo
16:14 jberger yakubori, presumably the redirect target tells the user that (s)he isn't authorized
16:15 jberger text_like(qr/not authorized/);
16:15 jberger if you aren't already doing that, its the prime use case for Mojolicious::Plugin::Humane
16:15 jberger just a little self-promotion
16:17 jberger it lets you flash forward a message that pops up without having to add anything to your page (at least not manually) :-)
16:17 gryphon joined #mojo
16:17 ObseLeTe joined #mojo
16:19 ObseLeTe joined #mojo
16:24 ObseLeTe joined #mojo
16:26 yakubori cool, jberger. i'll take a look. thanks :)
16:30 jberger yakubori, shoot, I thought I had uploaded a newer version
16:30 jberger hold on a few
16:30 jberger sry
16:30 yakubori i was think perhaps something with the flash() method might help
16:30 yakubori for a message check
16:30 jberger that will work
16:30 jberger its the template inclusino
16:30 jberger inclusion
16:30 yakubori but, ideally, i would like to check for the 302, then a 200 on the redirected url
16:30 jberger it gets confused by the controller
16:31 yakubori i just don't know how/if I can chain them
16:31 jberger I would say don't allow your test object to redirect, then check for the 302
16:31 jberger then the next test allow a redirect and test for the 200
16:39 sri the custom transaction example might help http://mojolicio.us/perldoc/Test/Mojo#tx
16:40 sri redirects are chained together through ->previous
16:46 yakubori ah, that looks like it might do it. let me give it a shot.
16:51 jberger sri: cool, I didn't know that
16:51 yakubori ya -- took both you guys' advice: have a test for the 302 preceded by a max_redirect(0); then a max_redirect(1) followed by a 200 check and a content check, then followed by a previous() check. thanks very much fellas :)
16:51 jberger yakubori, new version release of ::Humane
16:51 jberger https://metacpan.org/module/JBERGER/Mojolicious-Pl​ugin-Humane-0.02/lib/Mojolicious/Plugin/Humane.pm
16:51 sri \o/
16:52 yakubori so, my tests look a bit paranoid already, but that's probably not a bad thing ;)
16:54 yakubori whoa, humane.js looks nice
16:56 jberger thats why I wanted to make a plugin for it, its too cool
16:57 yakubori ya, thanks for that. this looks perfect.
17:13 mire_ joined #mojo
17:16 gryphon joined #mojo
17:17 dod joined #mojo
17:35 jwang joined #mojo
17:51 Vandal joined #mojo
17:51 rhaen_ithreads joined #mojo
18:04 yakubori if there were a block of code I wanted to run for each method inside of a controller, would I do something like, '$tx->on( request => do_this() );' ? If so, would that simply live within the scope of my entire module?
18:07 ObseLeTe joined #mojo
18:19 buu yakubori: Each method or each handler?
18:21 yakubori each handler, sorry
18:22 yakubori i thought i saw a way to do that in the docs somewhere already. but i might be mistaken.
18:23 sri see hooks and bridges
18:24 yakubori ok, sri
18:25 sri if both work, pick bridges
18:27 rem_lex|pivo joined #mojo
18:32 d4rkie joined #mojo
18:33 jzawodn joined #mojo
18:34 yakubori cool, i think this is what I saw before. thanks.
18:43 jiyuperl joined #mojo
19:00 mattastrophe joined #mojo
19:07 mattastrophe joined #mojo
19:27 rhaen_ithreads joined #mojo
19:42 priodev joined #mojo
19:55 tempire sri: https://gist.github.com/4422901
19:55 * tempire can't
19:55 sri tempire: ?
19:56 tempire the url redirects, but the redirect is not followed when $tx->req or $tx->res is used within the finish event.
19:56 sri not true
19:56 sri perl -Mojo -E 'my $ua = Mojo::UserAgent->new(max_redirects => 10); my $tx = $ua->build_tx(GET => "irclog.perlgeek.de/mojo/today"); $tx->on(finish => sub { say shift->res->code }); say $ua->start($tx)->res->code'
19:56 * tempire puts $10 down on it
19:57 tempire hmm
19:58 jiyuperl joined #mojo
19:58 sri paypal link is on my metacpan profile ;p
20:00 tempire huh
20:00 tempire maybe I was looking at old docs
20:00 tempire $ua doesn't get passed, only $tx
20:00 * tempire retracts $10
20:00 sri :o
20:09 tempire hmm
20:09 tempire I see where the emit happens, but where does the txn get passed?
20:31 rem_lex| joined #mojo
20:36 good_news_everyone joined #mojo
20:36 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/u9W1oA
20:36 good_news_everyone mojo/master f7d7a23 Sebastian Riedel: improved Mojo::UserAgent to warn more often about failed events
20:36 good_news_everyone left #mojo
20:36 sri tempire: that should make it obvious
20:56 good_news_everyone joined #mojo
20:56 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/j87YOg
20:56 good_news_everyone mojo/master d41ccd0 Sebastian Riedel: better error event fallback for Mojo::UserAgent
20:56 good_news_everyone left #mojo
20:58 good_news_everyone joined #mojo
20:58 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/lDlRNA
20:58 good_news_everyone mojo/master 4717de2 Sebastian Riedel: no need to unsubscribe from error event
20:58 good_news_everyone left #mojo
21:09 perlite_ joined #mojo
21:18 Miked joined #mojo
21:23 good_news_everyone joined #mojo
21:23 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/5QPXZQ
21:23 good_news_everyone mojo/master 5531616 Sebastian Riedel: moved error event fallbacks to Mojo::EventEmitter
21:23 good_news_everyone left #mojo
21:23 sri ok, i think that's the cleanest solution
21:24 sri if there's no other subscriber it warns on errors
21:26 tempire excellent
21:49 amirite joined #mojo
21:49 amirite oo
21:52 good_news_everyone joined #mojo
21:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/PuyRzQ
21:52 good_news_everyone mojo/master fd5c755 Sebastian Riedel: test unhandled error events
21:52 good_news_everyone left #mojo
22:23 sinkovsky joined #mojo
22:24 yakubori can bridges take a regex?
22:56 lammel2 left #mojo
23:41 ObseLeTe joined #mojo
23:43 jzawodn joined #mojo
23:58 mire_ joined #mojo

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