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

IRC log for #mojo, 2015-06-29

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

All times shown according to UTC.

Time Nick Message
00:00 CandyAngel The only other use case I can think would be if you wanted some other process to control when tasks are thawed
00:00 jontaylor joined #mojo
00:00 CandyAngel Like.. if they knew more about the machines they ran on or something
00:01 CandyAngel Say... backup jobs that get started by some process which has access to disk space (glacier?)
00:01 CandyAngel that get thawed*
00:02 CandyAngel Oh! Or if there are transfer limits. Backup job would be enqueued, then thawed by some "minder" that checks when a certain transfer quota is available
00:02 CandyAngel Like on Linode, I get 3TB of transfer a month, I might want to hold off backup jobs when it gets below 50GB ?
00:11 sri i'd say that's still just another variant of the same use case
00:12 CandyAngel Well, if you generalise it to "something external to the app authorises the job", yeah
00:12 * sri nods
00:12 bpmedley CandyAngel: Would you consider a workaround: Insert your authorization jobs with year 2030 for the delay.  Then, parse out year 2030 in your admin UI list.
00:13 sri you can't actually restart inactive jobs
00:13 sri it does not work with delay
00:13 * sri was wrong earlier
00:14 bpmedley Doh; sorry.
00:19 sri what i'm interested in now is more alternative use cases though
00:20 sri say, if enqueueing a job with an error had 2-3 decent use cases, it would be very easy to justify the addition
00:20 mattastrophe joined #mojo
00:21 CandyAngel I think by definition "something authorises the job" covers every possible use case
00:22 CandyAngel Umm
00:22 CandyAngel being able to start jobs at specific times, rather than after a delay? Is that a thing?
00:22 bpmedley Perhaps if the job needed to wait for a resource to come online.  For example, if an application needs to start for the job to interface with.
00:24 klapperl joined #mojo
00:25 bpmedley For example, if a SMTP server had to start for a Minion job to interface with.
00:26 CandyAngel It's possible you could use it for that (the SMTP server would start thawing jobs for it to do) but normally that would be handled by fail/retry, I think?
00:26 CandyAngel In a way, it allows Minion to be a "pull" system for job as well as a push
00:27 CandyAngel Services can, effectively, tell Minion that it can start processing X tasks
00:27 CandyAngel And for some reason, this immediately makes me think of IRC clients/bouncers
00:30 sri hahaha, i guess it would kinda work for job dependencies
00:30 bpmedley Yes, dependencies and authorization.
00:30 sri {error => {depends_on => 123456}}
00:31 CandyAngel ANd then when that job id finishes, you can thaw the task that depends on it?
00:31 sri yes
00:31 CandyAngel Hmm.. yeah, that could work
00:32 CandyAngel So you could have a 'transfer' task that depends on a 'backup' task, to back up the system and transfer it off site
00:32 mattastrophe joined #mojo
00:32 sri connection betweem the two jobs is weak though
00:32 CandyAngel And if the offsite machine isn't always on, it can thaw the 'transfer' job when it comes on
00:32 sri better to just have the first job enqueue the second
00:33 CandyAngel yeah, but you'd have to store the second jobs parameters in the first
00:33 CandyAngel Which could be messier
00:33 CandyAngel You could end up passing them down several layers of jobs
00:34 CandyAngel Depends whether you'd want to see the "full scale" of a job or not
00:36 mattastrophe joined #mojo
00:36 CandyAngel But on the flip side, it means if you edit a jobs code, it might miss the new steps (if you schedule them all at once)
00:42 bpmedley Are the dependency and authorization use cases sufficient?
00:51 mattastrophe joined #mojo
00:54 sri dependency doesn't really count, since it's so bad
01:00 jontaylor joined #mojo
01:01 damaya joined #mojo
01:07 hshong joined #mojo
01:12 jberger To find use cases, think of what could actually start the jobs
01:12 jberger Administrator is one
01:14 jberger Another might be something like a timer except not time
01:15 jberger Perhaps a system that is expensive to start, do you wait until there are many jobs pending
01:15 jberger s/do/so/
01:20 klapperl_ joined #mojo
01:27 jberger Then again that is still an abstract use case
01:27 jberger And try as I might I can't think of a concrete example of that that isn't trivially solved done other way
01:28 mattastrophe joined #mojo
01:28 mattastrophe joined #mojo
01:30 CandyAngel jberger: Care to share a trivial solution so I can implement it because everything I have tried doesn't work properly
01:30 CandyAngel Right now, I start jobs with a "is_suspended" argument which makes them fail when processed
01:30 CandyAngel And it creates another job with the same args, without the is_suspended when you resume it
01:30 CandyAngel Which makes it lose the creation datetime..
01:31 jberger I meant for my abstract use case of a batch of jobs whose startup is expensive
01:31 * sri still thinks that this might be best solved outside minion
01:32 jberger sri: I think so too
01:32 sri have your own system for reviewing jobs, that then actually enqueues them
01:32 jberger Agreed
01:32 CandyAngel But as I said, that requires reimplemting minion which is pointless
01:32 jberger Not at all
01:33 jberger You don't need the state machine there
01:33 CandyAngel Minion does everything I want other than having a state that doesn't make workers performs the jobs
01:33 jberger Unless you are trying to use the minion job states as you're business logic
01:33 jberger your
01:34 CandyAngel No, I just don't want to make an entire different job queue when Minion's very description is that it is a job queue
01:34 jberger CandyAngel: I understand and sympathize
01:35 jberger However it is supposed to be an automated job queue
01:35 CandyAngel It isn't called that, it's just a job queue
01:36 jberger And I can't really think of how else jobs would transition from stopped other than manual interaction
01:36 jberger True
01:36 jberger I just mean from implementation intention
01:36 jberger There is no web front end
01:36 CandyAngel It's like building a car with no handbrake and going "well cars are meant for driving"
01:36 sri worth mentioning that no other job queue has that feature either
01:37 jberger So to use this feature you have to implement a button for admins to push
01:37 CandyAngel yeah, and if I can use minion, that's all I have to do
01:37 jberger Right but who else is doing that?
01:37 CandyAngel And it can be part of the screen where admins can see what jobs are going on anyway
01:38 jberger We have talked about an admin console
01:38 jberger But the closest thing there is publicly available is my partial minion monitor command
01:38 jberger Partially completed
01:39 * CandyAngel shrugs
01:39 CandyAngel I'll implement one if you add frozen tasks
01:39 jberger sri I'm willing to make that trade, are you?
01:39 mst change a task's type to thetype-frozen
01:39 purl mst: that doesn't look right
01:39 jberger Gotta be pretty, for tempire
01:39 mst surely that'd work
01:40 tempire If it's not pretty, it's not done
01:41 mst tempire: I'm ok stipulating to that so long as I'm allowed to claim that in context, 'ls -l' output is pretty
01:41 tempire fine, as long as there are colors
01:42 CandyAngel mst: I tried $job -> task ('task_name_SUSPENDED') and it didn't do anything, if that is what you mean?
01:45 mst that's the idea
01:45 sri jberger: heh, that's not how we work
01:45 jberger I know, but I'd like a pretty admin console
01:45 sri well, find a clean implementation with two good use cases
01:45 sri for one use case, this one just isn't strong enough imo
01:45 jberger I agree, this feels like business logic
01:45 sri (and judging by earlier comments, i'm sure we agreed on that before the admin console offer... ;p)
01:45 jberger I do see CandyAngel's point
01:46 jberger But, it's just not quite.... something
01:47 sri certainly doesn't help that all implementation so far are not exactly pretty
01:47 sri ->enqueue('foo' => {error => "needs to be reviewed"}) is a hack at best
01:48 sri the other solution, with a dedicated frozen state requires much more code, and doesn't fit into the current terminology with "->retry"
01:48 CandyAngel Oh! I get it now. I'll fail it with the argument, then retry and is it has is_suspended and retries > 1, it doesn't fail
01:49 CandyAngel and if it has*
01:49 sri yes, you can rely on the retries value, since it is now documented
01:50 sri seems like a decent solution actually
01:50 CandyAngel yeah, seems to work okay
01:51 sri you could also use two separate task names
01:51 CandyAngel That makes it lose creation time though
01:51 sri and just make them share the same closure
01:51 sri creation time shouldn't change
01:51 CandyAngel Or.. I can't change the task of an existing job because I tried that and it didn't work
01:52 jberger CandyAngel: and see that's why I think that you are using this too close coupled with your business logic
01:52 jberger Why did it matter that the creation time changes
01:52 sri CandyAngel: don't change the task
01:52 CandyAngel Because the job was still created at X time whether it was started manually or automatically
01:54 sri return $job->fail('needs admin review') if $job->info->{retries} < 1;
01:55 sri have a $job->task eq 'foo_with_review' check as well if you use two task names
01:55 CandyAngel If we take the forum name change example, the job to change the name was created at 11:20. If the admin accepts it at 15:40, the job to change the name still was created at 11:20
01:55 CandyAngel I don't get the two tasks names thing
01:56 CandyAngel Jobs can only have one name as far as I can tell?
01:56 CandyAngel one task name*
01:56 sri my $task = sub {...}; ->add_task(foo => $task); ->add_task(foo_with_review => $task)
01:56 jberger The only reason I think about the job creation time is the cleanup time
01:57 jberger Once the job is accepted, why not reset it's completion time?
01:57 sri the restarted time is also there
01:57 sri there's timestamps for everything
01:58 mst guaranteed no white sand
01:58 sri umm i mean retried
01:58 mst not guaranteed: sri's senility
01:58 CandyAngel User says "I was waiting a week to get my name changed". How do you check that if the job only has the time the admin accepted it?
01:59 CandyAngel With the retry, you have creation == user request and retry == admin accept
02:00 CandyAngel I'm okay with the fail on is_suspended && retries < 1 workaround
02:01 CandyAngel It does what I want
02:02 preaction keep those records somewhere. how does the admin approve? have that thing add a line to a log
02:03 mattastrophe joined #mojo
02:03 CandyAngel Though I might change the "is_suspended" to "fail_on_spawn" or something more generic
02:03 sri CandyAngel: https://gist.github.com/anonymous/b892bec64fdc050bac17
02:03 CandyAngel "fail_on_first_try" :D
02:03 lluad joined #mojo
02:04 CandyAngel Ohhh
02:04 CandyAngel So you could enqueue foo, which is processed immediately or foo_with_review which requires manual retry
02:04 CandyAngel Is that what you are getting at?
02:04 sri yea
02:04 CandyAngel Ah okies
02:05 sri also makes it easier to find tasks that need review
02:06 CandyAngel Well, I have my workaround and it is 3am so I should head off to bed
02:06 noganex joined #mojo
02:06 CandyAngel Thanks for debating out my proposal :)
02:06 CandyAngel Have a nice night/day!
02:07 CandyAngel (also, yeah, you could make it so someone who has been on the forum less than a certain amount of time needs authorisation to change their name.. that would be cool)
02:12 klapperl joined #mojo
02:58 klapperl_ joined #mojo
03:06 kaare joined #mojo
03:10 klapperl joined #mojo
03:15 cpan_mojo Statocles-0.050 by PREACTION https://metacpan.org/release/PREACTION/Statocles-0.050
03:29 mattastrophe joined #mojo
04:09 irq joined #mojo
04:18 boygeorge joined #mojo
04:18 boygeorge Hi
04:19 boygeorge The servers at my work all have Perl 5.8.4. I am writing an app and I'd like to use Mojoloicious. What's the best way to easily package Perl and my app together?
04:19 boygeorge That way they can basically install the application on the server without having to install a newer Perl (perlbrew, etc).
04:21 preaction mojolicious doesn't work on 5.8.4
04:22 preaction oh, you mean build a perl yourself and tar.gz it all up?
04:22 boygeorge yeah, basically, sometyhing like that
04:22 boygeorge unfortunately, I cannot require the app have any dependencies that get installed, CPAN or otherwise :/
04:23 boygeorge The sites where the app is installed do not have internet access, and are running Solaris 10 with Perl 5.8.4
04:23 preaction oh. oh man. i do not envy you...
04:24 preaction yeah. you're going to have to tar up a full perl install and move that over to the prod boxes
04:24 boygeorge yeah, my other option is a tomcat 5.5 applet
04:24 boygeorge damn, I was hoping I could do something with carton or something
04:25 preaction but you'd need a perl
04:25 preaction mojo itself cannot run on 5.8.4
04:25 boygeorge ugh, yeah... looks like I have to work with Tomcat 5.5 :(
04:26 boygeorge Oh well, thanks for the answer
05:38 davido_ joined #mojo
06:00 berov joined #mojo
06:22 stl joined #mojo
06:24 stl hi everyone
06:24 purl Howdy, stl, you fantastic person you.
06:26 stl Tell me how to disable the IP connection to websocket, if this IP I was suspected of spamming or flooding
06:26 preaction use a firewall
06:26 dod joined #mojo
06:27 stl nope
06:27 preaction yep
06:30 stl with firewall i can disable all connections from IP to server. But I want something like fail2ban. Mojo-server with hook 'before_dispatch' check IP in banlist and if IP in this list - $tx->finish. But this works for all request except websocket
06:30 stl I want dynamically block only websocket connections
06:31 marcusr o/
06:31 stl and after some time disable block
06:34 stl main web-site written on php and it works under nginx. with nginx configuring reverse-proxy for my websocket component(users chat). or use nginx 'allow' and 'deny' for my purpose? but i want it do dynamically...
06:38 preaction if someone is spamming or flooding, don't let them do any damage to your system at all. block them at the kernel with a firewall.
06:38 preaction if you're talking just talking too often, just don't forward their chat on to the other users if they're talking too fast
06:39 preaction block them from sending on the client side, and enforce that fully on the server side
06:40 preaction but they're still sending things. you're not blocking the connection, you're preventing the content delivered over the socket from reaching its destination
06:58 dod joined #mojo
06:59 batman stl: how about $app->hook(before_dispatch => sub { my $c = shift; $c->render(text => "", status => 429) if ... ; }); ?
07:01 dod joined #mojo
07:06 AndrewIsh joined #mojo
07:08 trone joined #mojo
07:09 McA joined #mojo
07:27 stl preaction: you are right. I'll be blocking with firewall
07:27 klapperl_ joined #mojo
07:30 stl batman:  no, I don't like explain to user what is wrong. I'm usually use empty response with code 418
07:30 Vandal joined #mojo
07:32 klapperl joined #mojo
07:34 odc joined #mojo
07:45 AndrewIsh joined #mojo
07:47 batman yeah. explaining is the worst ;)
08:01 arpadszasz joined #mojo
08:15 batman i think there's a big difference between not saying anything and saying the wrong thing.
08:24 salva joined #mojo
08:36 CandyAngel Which one is better?
08:36 CandyAngel (also, morning everyone)
08:37 batman CandyAngel: i guess it depends, but from experience saying the wrong thing is rather confusing
08:37 batman that's why i started not saying anything instead
08:38 marcusr http://treasure.diylol.com/uploads/post/image/169566/resized_true-hero-meme-generator-he-s-the-hero-we-deserve-but-not-the-one-we-need-right-now-65e69f.jpg
08:40 salva joined #mojo
08:41 nicomen hm, I need a way to concatenate paths that might or might not have prepended/appended slashes. I was thinking Mojo::Util::trim could've had an optional arg of which characters to trim, or a Mojo::URL method to ignore slashes in parts. Is there any other elegant way to do this?
08:42 absolut_todd joined #mojo
08:45 irq joined #mojo
08:45 batman nicomen: push @{$url->path}, grep {length} split "/", $some_path;
08:46 batman so prepend would be unshift
08:47 nicomen hm
08:47 nicomen interesting ;)
08:48 batman it might not work of course, but i never work with urls with double slashes in them: //foo////bar/
08:53 nicomen works fine with double slashes it seems? at least to get what I want (single slashes)
08:53 nicomen thanks batman I like it
08:54 batman i meant, it won't work if you _want_ double slashes
08:54 batman nicomen: cool. happy to help :)
09:04 jontaylor joined #mojo
09:29 berov Hi, do you know anything similar on top of Mojo or in General written in Perl? https://github.com/cantino/huginn/blob/master/README.md
09:31 dp_ joined #mojo
09:31 dod joined #mojo
09:32 berov also https://en.wikipedia.org/wiki/IFTTT
09:53 bin_005 joined #mojo
10:14 bin_005 joined #mojo
10:16 ToApolytoXaos joined #mojo
10:29 nicomen is there an easy way to add 404 templates for specific filetypes?
10:35 punter joined #mojo
10:48 batman nicomen: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Rendering-exception-and-not_found-pages
10:50 batman echo '{"status":404}' > templates/not_found.production.json.ep
10:51 nicomen hm, tried running an strace here, but it didn't seem to stat for ...css.ep
10:51 nicomen or. format seemed to be html even if it was named /non-existent-file.css
10:52 nicomen will dig a bit more, thanks again
11:04 joelb joined #mojo
11:04 joelb ow do
11:05 joelb Is there a way to get the router to tell me which route definitions it tried?
11:05 joelb I have quite a few nested routes, and it would help a lot if I could see which branches of the tree is searched
11:07 batman joelb: mojo tries them all
11:07 batman joelb: have you tried perl scripts/yourapp routes ?
11:09 buu I wonder if you could do a backwards comparison where you compare a 'path' against every route
11:10 buu You'd have to do some manipulation..
11:10 buu Also, seriously, the amount of time I've spent debugging routes that went "Looks like no route matched!!" when the route it matched just didn't produce any output...
11:15 batman buu: you should see that if running with log level "debug"
11:15 batman it will say something like "Routing to ..."
11:15 joelb batman: it really doesn't
11:15 batman it really does.
11:15 joelb uh-uh
11:16 joelb For example, I have a "/*woops" as my last route
11:17 batman joelb: or... uhm.. what did you reply to? my answer to buu or something else?
11:17 joelb so batman is saying that the woops route is already tried and the user won't have to sit through a timeout
11:18 batman joelb: you only sit though a timeout if not render() is called. and it is called on not_found (no route matched)
11:18 batman mojo will however tell you if it found a route or not with log level debug
11:19 batman something might be weird if you have some funky "before_dispatch" hooks though.
11:19 batman since that hook is run before the route dispatcher (hence the name)
11:19 joelb "I have quite a few nested routes"
11:20 batman is that routes where you use under() or just plain chained routes?
11:20 joelb If the user doesn't meet the criteria for any of those nested routes, I'd expect it to hit the woops route
11:21 joelb but it does not
11:21 joelb the user has to wait through "Nothing has been rendered"
11:21 joelb So I'm wondering how to get some debug out of the router to tell me which branches it considered before rendering nothing
11:22 batman can't help you if you don't answer my questions :(
11:22 buu batman: Doesn't it default to debug?
11:22 joelb buu: it does for morbo
11:22 batman buu: depends which server you're using. hypnotoad default to info
11:22 joelb hypnotoad defaults to production
11:23 batman i think all other default to "debug" (not sure about prefork)
11:23 joelb (but it's easy to override via something like my $mode = $self->mode('development')->mode;
11:23 buu hrm
11:24 buu Is there any way to make morbo print log messages to stderr instead of foo.log?
11:24 joelb yes
11:24 batman yeah.. that doesn't really explicitly change the log level. $app->log->level("debug"); and probably MOJO_LOG_LEVEL="debug" does though.
11:24 joelb mv log log.bak
11:25 buu eh?
11:25 buu renaming the log file?
11:25 joelb it only logs to a file if it finds a dir in the expected location and called 'log'
11:25 wingfold joined #mojo
11:25 joelb and it's writeable
11:25 batman buu: no. if you have directly called "log" in your project dir, it will log to a file inside that directory
11:25 batman if you mv (or remove) that "./log" dir, it will print to stderr
11:26 buu Ohhh
11:26 buu The log dir
11:26 batman so... joelb i will try again... is "nested routes" routes where you use under() or just plain chained routes?
11:26 buu ok
11:27 joelb batman: many uses of 'under'
11:27 buu Is there anyway to configure morbo to use stderr vs log file? If there isn't is that worth a patch?
11:27 batman joelb: and are any of those async as well, or blocking?
11:27 joelb the conditions?
11:27 purl somebody said the conditions was plural
11:28 joelb I think conditions have to be blocking (but not sure)
11:28 batman joelb: the under() routes
11:29 joelb let's assume all my routes are blocking
11:29 batman (under() does not need to be blocking)
11:29 joelb btw, if you're thinking my timeout periods aren't big enough, it's not that)
11:31 joelb just one example: s is a guarded subroute of r, and f is a guarded subroute of s
11:31 joelb my woops route is a subroute of r (unguarded)
11:32 joelb The user is asking for a subroute of f, but they don't (currently) meet the criteria (satisfy the guard) of f
11:32 joelb so I want to catch and do something useful, but I'm not spotting where
11:32 joelb I don't want to do this within f because f has many many siblings
11:32 joelb so that wouldn't scale
11:33 joelb nicely
11:33 joelb I think I could design a solution if I understood why they never trigger the woops route
11:34 joelb oh, I should have mentioned, they do satisfy the guard of s
11:34 batman right... not following that those letters at all.
11:34 joelb they're just letters
11:34 batman what i think is that you have an under() that doesn't return true and doesn't render.
11:34 joelb I've got another 23 -- you probably have more :)
11:35 batman i meant, i'm not going to draw a diagram out of your explanation with single characters instead of descriptive words.
11:36 joelb I think it's because if it satisfies s then it won't consider any more r routes
11:36 batman yeah.
11:36 batman https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Routing.pod#Under
11:37 joelb but nope, putting $s->any('*yourekidding' => sub { shift->reply->not_found }); does not catch it
11:37 batman i think it says exactly what you said in the documentation i just shared with you.
11:37 batman have you read it?
11:38 joelb different (related) question...  I get "Routing to a callback" each time it weighs up a guard -- is there a way for it to tell me which guard it was weighing up?
11:39 batman joelb: also have a look at "Broken dispatch chains" at the end of that section. i think that will make it clearer to you why you get the timeout.
11:39 batman i don't think you can when you're using callbacks. you could however move them into a controller to get a better description.
11:40 batman also... sorry about the "it tries all the routes before". mojo starts from the beginning and then tries all the routes until you get a match.
11:42 batman what i meant is that mojo has tried all the routes if you get a 404.
11:42 batman joelb: does the documentation for "Under" make any sense to you?
11:42 joelb I think (a) "Broken dispatch chains" is _exactly_ what I needed to read, and (b) moving them to a controller will give me exactly the debug info I need
11:42 joelb thank you batman on both counts
11:43 batman joelb: you're very welcome.
11:43 batman i'm sorry if the conversation started out a bit rough.
11:44 joelb not a problem; you took me somewhere productive :)
11:45 batman joelb: here is a small example which might make sense... https://ssl.thorsen.pm/paste/fe5ff6376dfc
11:48 dvinciguerra joined #mojo
11:53 batman sri: would it be an idea to add the name of the route to the log output?
11:56 neilhwatson joined #mojo
11:57 nicomen what's the best way to merge to Mojo::Collection elements?
11:57 nicomen elements=objects
11:58 nicomen Mojo::Collection->new($a->to_array, $b->to_array) ?
12:02 damaya joined #mojo
12:03 CandyAngel nicomen: If you want to create a new collection, yeah
12:04 CandyAngel Otherwise, I think you can do: push @{$col_a}, $col_b -> each;
12:05 CandyAngel In the docs, it says you can access it directly: http://mojolicio.us/perldoc/Mojo/Collection#DESCRIPTION
12:06 nicomen I thought perhaps flatten did something like that....
12:07 marcusr I'm seeing a strange error when trying to "use Mojo::Base -base' - What am I missing? https://gist.github.com/marcusramberg/8d60799f3f501e435315
12:07 marcusr Mondays...
12:07 purl hmmm... mondays is http://www.dieselsweeties.com/archive.php?s=910
12:08 damaya joined #mojo
12:09 marcusr I don't understand where 'loaded' comes from. It's not in my source code.
12:10 marcusr Could it be because of Test::More?
12:10 marcusr seems like use_ok is fucking me :-/
12:11 batman nicomen: what CandyAngel said: it's a blessed array, so you can just do push, or if you want a new collection do Mojo::Collection->new(@$one, @$two);
12:11 batman marcusr: language..?
12:11 purl language is horrifyingly verbose
12:12 marcusr batman: perl
12:12 nicomen version..?
12:12 purl version is probably 'special'
12:12 nicomen must be
12:12 batman i was referring to f***** :)
12:12 marcusr batman: I was being willfully obtuse :p
12:12 batman marcusr: <3
12:12 nicomen I was following up marcusr joke
12:13 damaya joined #mojo
12:13 batman marcusr: but... good think you figured it out. anyway: it's very useful to see the thing producing the error, and not just the error message.
12:13 batman protip ;)
12:13 marcusr but yeah, it seems like use_ok doesn't work great with 'use Mojo::Base -base'
12:13 * jberger yawns
12:13 nicomen marcusr: yeah you are loucky mst wasn't reading :-P
12:14 jberger o/
12:14 batman marcusr: do you have use Mojo::Base -base; in your test file?
12:14 jberger marcusr: use_ok is rarely a good option alway
12:14 marcusr batman: no, I'm trying to test a class using it.
12:14 jberger anyway*
12:14 marcusr jberger: Seems you're right.
12:15 batman marcusr: do you have use_ok $class or use_ok($class); ?
12:15 * jberger breaks the first rule of swipe type, no swipe before coffee
12:16 batman i've been bitten quite a few times of use_ok and indirect method calls (or what it's called)
12:16 batman marcusr: i also do ok eval "use $module; 1", "use $module" or diag $@; instead of use_ok() in the my basic.t tests (generated by git-ship)
12:16 nicomen black-stupid-we want to be C++-magic is what's it's called.
12:16 marcusr It's all my fault
12:17 batman i still care deeply about you marcusr :)
12:17 marcusr use_ok('Foo', 'Foo is loaded'); <- not how use_ok works
12:17 batman word.
12:19 joelb joined #mojo
12:22 sri so frustrating to see people complain about stuff that's explained right in the tutorial
12:22 batman yeah... i heard that if we had a book..........
12:22 * batman hides
12:23 batman (sorry. bad joke)
12:24 Nemix joined #mojo
12:27 sri is it terrible jokes monday again? :S
12:28 batman i hope one terrible joke is enough for one day :/
12:29 ajr_ joined #mojo
12:29 ashimema joined #mojo
12:59 joelb joined #mojo
13:07 gryphon joined #mojo
13:08 sri so, what else could the mojolicious router log?
13:09 sri as far as i can see, the main problem is simply that people don't read the tutorial, and therefore just don't notice there's a log at all
13:11 sri the log is even included in the 404/500 pages now, i have a hard time believing people can still miss it
13:14 batman i think they do :/
13:15 batman but it would be useful if the router could log the name of the route. i tried to look into the Mojolicious::Routes::Match, but i only managed to find a way to log the endpoint route name
13:16 batman like: Routing to a callback for the route "some-route-name"
13:16 batman that might help, but i thought it was a bit confusing
13:23 zivester joined #mojo
13:27 fletch joined #mojo
13:27 fletch ola
13:27 jb360 joined #mojo
13:28 fletch in a full app, how do I specify a template without a controller?
13:28 fletch $b->get('path')->to(template => 'my/template');   ?
13:29 fletch I get "expecting delayed response" and thinking I told you the template already
13:30 Lee_ ->to('public#index'); # would render public/index.html.ep
13:30 Lee_ ->to('public-foo#index'); # would render public/foo/index.html.ep
13:31 fletch Lee_: you serious?
13:31 Lee_ that's what i'm looking at on my screen at the moment
13:32 fletch is not giving Public/Foo + index.html.ep ?
13:32 Lee_ no
13:32 sri umm ->to(template => 'my/template') is perfectly fine
13:32 fletch I think I want auto render
13:33 fletch okay, my problem must lie in other places
13:33 fletch thanks you
13:38 jberger fletch: templates/my/template.html.ep
13:39 sri jberger: that is incorrect
13:39 jberger ?
13:39 sri you don't specify the whole path
13:40 jberger No that is what it would render
13:40 pink_mist I think jberger wanted to let him know where he should put said template
13:40 jberger Right, I notice that fletch mentions full apps in a way that makes me think he is moving from lite
13:41 jberger Thus I mention that non __DATA__ templates (by default) are located in the templates folder
13:41 sri the log already tells him that!!!
13:41 sri MOJO_LOG_LEVEL=debug perl -Mojo -E 'a({template => "my/template"})->start' get /
13:42 * sri is sooo annoyed with people ignoring the log
13:43 jberger and the growing guide, to be sure
13:44 sri in the last few days that has been the number one problem, what's going on?
13:44 Lee people not running with MOJO_LOG_LEVEL=debug ?
13:45 sri is ignoring the docs a reaction to getting faster answers here than usual?
13:45 sri (the channel has been a but more active)
13:45 jberger I usually have correlated those days with a mojo post or announcement making it out farther than the usual echo chamber
13:46 jberger new users come in and don't read the Guides as carefully as they should
13:46 sri nothing in my twitter stream
13:47 jberger top post on r/perl is a mojo lite app
13:47 sri Lee: that's only needed for one-liners
13:51 Lee oh
13:51 * Lee doesn't know why then
13:53 nicomen I would expect this to work without setting { format => ... } myself, can someone explain to me why I have to do it?
13:53 nicomen any     => { layout => undef, template => 'article/list', format => $self->stash('format') },
13:53 nicomen (in a respond_to() call
13:55 CandyAngel Sorry sri
13:57 PotatoGim^Home joined #mojo
14:15 jberger is format actually in the stash or does that become undef?
14:19 nicomen it's in the stash
14:20 nicomen I guess respond_to leaves you on your own, but not really, as it seems layout and template is honoured
14:20 pink_mist do you really need to specify a format => .. if it's in the stash? wouldn't that just put it right back there?
14:20 pink_mist or am I missing something?
14:24 nicomen it is there before the respond_to call
14:27 jberger nicomen: can you make a more complete example?
14:28 jberger also, what format are you targeting?
14:28 nicomen many different ones
14:28 nicomen but I'll try
14:30 jberger nicomen: see also: https://github.com/jberger/Mojolicious-Plugin-ReplyTable/blob/master/lib/Mojolicious/Plugin/ReplyTable.pm#L30-L32
14:43 PryMar56 joined #mojo
14:46 lluad joined #mojo
14:50 jberger so I guess Java is done then
14:55 sri what an odd comment :S https://github.com/rurban/Cpanel-JSON-XS/issues/37#issuecomment-116609265
14:59 sh4 joined #mojo
15:00 sri jberger: haha, so there is hope android might get a proper programming language :)
15:01 genio What did I miss about Java finally going away?  I've been on vacation for a week
15:01 sri apparently oracle won in court against google and can now license apis
15:02 disputin joined #mojo
15:02 Grinnz_ oy
15:02 genio Oracle--
15:02 sri for you americans... things might get interesting when others start licensing apis
15:02 Grinnz_ things being interesting is a given when oracle is involved
15:03 mattastrophe joined #mojo
15:03 sri not that europe is much better off... some damn corrupt shit going on with net neutrality atm :(
15:04 zackiv31 joined #mojo
15:05 genio fluffy words that sound like a good idea but have lots of hidden evil stuff?
15:05 Lee Oracle--
15:06 jberger perl and/or mojo should make an official announcement offering the perl api as open under the same terms as the perl interpreter itself
15:07 jberger (mojo == mojo api)
15:07 sri the original plan was so great, regulated roaming prices for mobile networks all over europe and actual net neutrality
15:08 sri but the eu commissioner in charge of all things digital in an industry shill
15:09 sri and so he's taking net neutrality hostage, to kill regulated roaming prices
15:09 nicomen jberger: https://gist.github.com/nicomen/e70ac2cc93c21fdfe173
15:13 sri http://www.vox.com/2014/11/18/7238825/copyright-for-apis-is-going-to-be-a-disaster-and-only-the-supreme
15:14 nicomen jberger: added a comment in expected results
15:25 genio including the names of functions (such as "max" for the maximum function), as well as what type of data these functions accept and return (like the fact that "max" takes two integers and returns an integer) — was eligible for copyright protection.
15:25 genio What the actual fuck?
15:26 Grinnz_ wat
15:26 CandyAngel Sounds legit
15:26 genio having a function name the same and taking the same arguments is against the rules for something as generic as max()?
15:28 * pink_mist flips his table
15:28 Grinnz_ pink_mist: flipping tables is copyrighted
15:28 jberger nicomen: that wouldn't be in the stash
15:28 Mikey making apis copyrightable might be good for Perl.
15:29 Grinnz_ uh, no?
15:29 Mikey lots of first use scenarios i'd bet
15:29 pink_mist making apis copyrightable is horrible for /everyone/
15:29 purl Hmm.  No matches for that, pink_mist.
15:29 Grinnz_ perl programmers aren't going to be claiming those copyrights
15:29 Grinnz_ oracle is
15:29 Mikey pink_mist: i agree with that, im just saying.
15:29 Kogurr joined #mojo
15:31 Mikey the only thing that will happen is people will move away from Java toward truly open platforms.
15:31 jberger nicomen: perl -Mojo -E 'a("/" => { inline => q[<%= param "format" %>] })->start' get /.rss
15:31 Grinnz_ it's not just about java, but about the precedent
15:31 jberger .rss does not set param 'format' to rss
15:32 Grinnz_ if java manages to copyright this stuff, there won't -be- open platforms
15:32 pink_mist s/java/oracle/
15:33 jberger nicomen: perl -Mojo -E 'a("/" => { inline => q[<%== dumper $c->accepts %>] })->start' get /.rss
15:33 Mikey i think im missing something.  if it can be (c), then it can be licensed?  so an API could be licensed as openly as the implementation of that API, no?
15:34 jberger nicomen: format and accepts are related concepts, but are not the same
15:36 jberger since the default format is html, and you don't have an rss entry in your respond_to, you will always render the html template when called with .rss
15:36 jberger given that code
15:38 lluad_ joined #mojo
15:44 odc best mojo app ever: http://blogs.perl.org/users/yuki_kimoto/2015/06/bbs-applicaton-implemented-by-mojolicious-which-can-run-as-cgi-and-embdded-web-server.html
15:44 mikegrb but does it support inbound phone calls?
15:45 jberger ah
15:45 jberger nicomen: any explicitly unsets format: https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Controller.pm#L238-L241
15:46 lluad_ joined #mojo
15:52 jberger nicomen: the problem is that since you have a fallback (any) but don't explicitly include rss accepts, the fallback mode is to unset format before merging the new stash values
15:52 jberger its a little odd to think about at first, but it makes sense in the end I think
15:52 jberger https://gist.github.com/jberger/378832f0749d75d237bf
15:56 nicomen jberger: I don't want explicit accepts ;)
15:57 nicomen or I want: try templates, except for some formats...
15:57 nicomen is there a cleaner way?
15:58 nicomen jberger: thanks for your help/explanation though! ;)
15:59 jberger probably not while also rendering json in that manner
15:59 * jberger tries
15:59 nicomen hm, I would like to skip being explicit about json too
15:59 jberger nicomen: well that's just silly
15:59 nicomen if I can catch json before_render or something that should be fine
16:00 nicomen (it's just to add jsonp-support)
16:00 jberger that's what respond_to is for
16:00 nicomen yeah, but it kind of litters the code
16:00 jberger I don't see it that way
16:01 nicomen well, but sure, I handle json specially, then I would like any to do the usual. But perhaps one could only call explicit respond_to if format is json...
16:01 nicomen which sounds like an ugly hack of something _almost_ doing what I want :-/
16:01 nicomen so I guess I will just set format => ...
16:02 nicomen at least it's clear what happens
16:03 nicomen I guess the surprising bit is that what any gets is the stash, except the "negotiated" format
16:04 gtodd joined #mojo
16:06 jberger nicomen: pushed a change to only have to handle json separately
16:06 nicomen ok
16:06 PotatoGim^Home Hi. what's the best thing to draw a graph in real-time?
16:06 jberger nicomen: I guess I can see that as "surprising" but I think that that is intended to make you choose a format
16:07 nicomen jberger: ok, I think I had it like that in the beginning, and then I started getting clever about things ;-)
16:07 nicomen but that's like two years ago
16:08 nicomen maybe it is possible to overload rendering object and have even more control...
16:10 nicomen jberger: thanks again ;)
16:10 jberger nicomen: np
16:17 aggrolite joined #mojo
16:31 jberger does anyone have a small javascript side router that they like
16:31 jberger something decoupled from a larger application framework?
16:32 jberger something like this perhaps? https://github.com/flatiron/director
16:33 jberger preferably something that doesn't require model definitions etc, just fire a function call
16:45 batman jberger: i built my own that i use in convos: https://github.com/Nordaaker/convos/blob/batcode/public/js/router.js
16:46 batman should be fairly simple to replace the riot stuff with whatever you're doing.
16:46 batman it doesn't support nested layouts though, like react-router
16:46 batman oh. i see now that it's not straight forward to understand what it does :P
16:46 batman sorry...
16:46 purl It's okay, batman.
16:51 jberger batman: yeah, I've thought about implementing one of my own
16:51 jberger but it seems like if I could just get a tiny thing that someone has already thought about that it would save me headache
16:52 Grinnz_ jberger: i used rlite, it's incredibly minimal
16:52 batman this is how i use it: Router.add(/^logout$/,   function() { alert("matching route!") });
16:52 Zoffix joined #mojo
16:52 Grinnz_ https://github.com/Grinnz/PYX-Mojo/blob/master/public/js/rlite.js
16:52 Grinnz_ the github repo is probably easy to find by google
16:53 jberger kinda odd that it conflates query args and "stash values"
16:54 jberger I know that mojo does it, I just was surprised to see it in a front-end library
16:56 Zoffix A vague question: is stuff like MojoX::Renderer::* still supported in newer Mojolicious? I'm fixing up MojoX::Renderer::Alloy to work with newer Mojolicious as part of CPAN PR challenge... I'm already knee deep in its guts and I notice in its test it's not finding special .hte templates but is looking for .ep. Does that sound like something someone asked about, perhaps? Before I go neck-deep into this module's guts :)
16:56 jberger Zoffix: you'll have to set the default handler extension
16:57 jberger or some such, its been a while since I looked at that
16:57 Zoffix jberger, thanks. I'll look into that.
16:57 jberger I know that there is an example somewhere
16:58 nicomen wouldn't it make sense at the TT one?
16:58 nicomen +to look at
16:58 Zoffix Also a plan.
16:59 Zoffix It's also failing the same way :D
16:59 Zoffix (part of the same distro)
16:59 Zoffix Unless you mean MojoX::Renderer::TT... then it's not on CPAN anymore
17:00 Grinnz_ i think we just discussed this yesterday, everything that is MojoX::Renderer is probably terribly out of date
17:00 Zoffix Hm. Maybe I'm wasting my time with this stuff.
17:00 nicomen http://search.cpan.org/~plicease/Mojolicious-Plugin-TtRenderer/lib/Mojolicious/Plugin/TtRenderer/Engine.pm <-- this?
17:02 ajr_ joined #mojo
17:05 Zoffix Fuck it. The author has been inactive for years anyway and might not merge my pull. I'll just submit for the Challenge whatever updates I could make thanks to the Mojo Upgrading Wiki and call it it. ( Grinnz_++ for the wiki)
17:07 mst Zoffix: you can always get co-maint if they fail to pay attention
17:07 mst I've done a lot of adoptions over the years
17:08 Zoffix Maybe. But if everything that is MojoX::Renderer is "terribly out of date", then perhaps there's no demand for this stuff any more.
17:09 Grinnz_ well, it just doesn't need to be a module named MojoX::Renderer
17:09 Grinnz_ it should just be a regular plugin
17:09 Grinnz_ that adds a handler
17:29 irq joined #mojo
18:04 amon joined #mojo
18:07 trone joined #mojo
18:18 dod joined #mojo
19:08 aggrolite joined #mojo
19:22 lluad joined #mojo
19:37 aggrolite joined #mojo
19:40 disputin joined #mojo
19:52 CandyAngel Can you change a jobs arguments once it is enqueued or are they fixed?
19:52 lluad_ joined #mojo
20:08 jberger CandyAngel: fixed
20:08 CandyAngel Okies, thank you
20:15 CandyAngel More and more tempted to write my own job system :P
20:18 jberger CandyAngel: you were just worried about the audit control of the start time
20:18 jberger now you want the arguments to be mutable?
20:18 jberger is that consistent?
20:19 CandyAngel I'm not only working on one Mojolicious project :P
20:20 jberger sure, but you can see why that would negate audit control right?
20:20 CandyAngel Auditing of job arguments, yeah
20:21 CandyAngel It's alright, I'm okay with "cloning" jobs with changed params
20:24 CandyAngel Like.. I'm fine with that, because it is a different job. Mixing cement without sand is a different job to mixing it with sand
20:24 CandyAngel but being told by your boss to mix cement later, when he tells you.. is the same job :)
20:25 pink_mist CandyAngel: might be a worthwhile read: http://shadow.cat/blog/matt-s-trout/do-you-copy/
20:38 aggrolite joined #mojo
20:48 PryMar56 joined #mojo
20:55 mattastrophe joined #mojo
20:56 CandyAngel pink_mist: It was, thankies
20:58 absolut_todd joined #mojo
21:02 * CandyAngel engages pyjamas-coding-mode
21:17 sri making your own job queue is not as easy as it may seem, getting minion right took about a year
21:19 sri if you can focus on one backend, then it might be quite fun though
21:19 sri pluggable backends make everything a bit of a headache
21:26 ToApolytoXaos joined #mojo
21:27 CandyAngel sri: I kind of have one at work, with dependencies and everything
21:27 CandyAngel I'm currently recoding it because it written really badly (like.. when I first started learning Perl)
21:29 wingfold joined #mojo
21:40 neilhwatson joined #mojo
21:46 disputin joined #mojo
22:09 melo joined #mojo
22:18 mattastrophe joined #mojo
22:33 * sri wonders if sco will claim the copyright on everything posix
22:39 * jberger claims the copyright on email addresses
22:40 * Grinnz_ claims the copyright on functions named "start"
22:41 * nicomen claims the copyright on functions named main
22:41 Grinnz_ welp, there goes C
22:41 nicomen try running your code now! ;D
22:42 * CandyAngel copyrights JMP
22:43 CandyAngel and MOV while I'm at ti
22:43 CandyAngel at it*
22:43 Grinnz_ i think apple beat you to that one
22:43 jberger Well I trump you, I'm claiming copyright on file extensions
22:43 * nicomen claims copyright on 1
22:44 jberger nicomen++
22:44 jberger Oh a want ++ too
22:44 nicomen jberger.plusplus
22:44 CandyAngel Sorry, it's copyrighted
22:44 nicomen jberger.inc.inc
22:45 Grinnz_ org.jberger.utils.math.increment.byone
22:45 CandyAngel Basically, I made an API which just AUTOLOADs any method call and echoes it and copyrighted that
22:45 nicomen too bad AUTOLOAD is already copyrighted
22:46 CandyAngel Fudge
22:46 Grinnz_ o:
22:46 Grinnz_ but what about AUTOLOAD called as a method
22:47 nicomen hm, weird I search for assembly and get Go at the top
22:47 nicomen seems Google is skewing their stuff pretty hard
22:48 Grinnz_ eh, i wouldn't be surprised if that's legit
22:48 Grinnz_ nobody cares about actual ASM
22:48 CandyAngel Unless they are playing that game from the SpaceChem people
22:48 CandyAngel Zachtronics?
22:49 nicomen new version of Coro...
22:49 Grinnz_ # tumbleweeds
22:53 mattastrophe joined #mojo
22:56 CandyAngel Bleh, silly gzip, why you EOF unexpectedly
22:58 buu joined #mojo
23:01 zivester joined #mojo
23:07 Grinnz_ you mean, "why you unexpe"
23:07 CandyAngel :P
23:16 nicomen it accidentally the whole?
23:23 mattastrophe joined #mojo
23:27 zackiv31 joined #mojo
23:36 lluad_ joined #mojo
23:54 mattastrophe joined #mojo

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