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

IRC log for #mojo, 2016-10-03

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

All times shown according to UTC.

Time Nick Message
00:19 ccakes joined #mojo
00:45 ivi joined #mojo
01:03 tchaves joined #mojo
02:26 kaare joined #mojo
02:48 bletch joined #mojo
02:59 noganex_ joined #mojo
03:18 ccakes joined #mojo
03:35 ccakes joined #mojo
03:45 ccakes joined #mojo
03:49 ccakes joined #mojo
04:07 inokenty-w joined #mojo
05:22 dod joined #mojo
05:23 dod joined #mojo
05:28 dod joined #mojo
06:07 dod joined #mojo
06:07 dod joined #mojo
06:50 parv joined #mojo
06:52 AndrewIsh joined #mojo
06:58 ccakes joined #mojo
07:04 mbudde joined #mojo
07:05 dod joined #mojo
07:20 trone joined #mojo
07:30 trone joined #mojo
07:31 batman joined #mojo
07:37 Atog joined #mojo
07:38 batman joined #mojo
07:40 osfabibisi joined #mojo
08:19 rshadow joined #mojo
08:53 che-quest joined #mojo
09:05 dod joined #mojo
09:43 kivilahtio joined #mojo
10:00 osfabibisi joined #mojo
10:52 tchaves joined #mojo
11:11 tchaves joined #mojo
11:23 osfabibisi joined #mojo
11:45 che-quest joined #mojo
11:52 itaipu joined #mojo
11:54 blonewolfs joined #mojo
12:04 dod joined #mojo
12:40 gizmomathboy joined #mojo
12:42 bwf joined #mojo
13:00 caesura joined #mojo
13:08 marty joined #mojo
13:13 ramortegui joined #mojo
13:25 jacoby joined #mojo
13:30 jacoby joined #mojo
13:40 itaipu joined #mojo
13:43 osfabibisi joined #mojo
13:58 mcsnolte joined #mojo
14:20 itaipu joined #mojo
14:43 ptolemarch joined #mojo
14:53 vytas joined #mojo
14:59 blonewolfs i'm trying to figure out how to properly create and use an app specific plugin.  so far i have run "mojo generate app PluginTest", "cd plugin_test/", & "mojo generate plugin TestPlugin".  how do i properly load "Mojolicious-Plugin-TestPlugin/lib/Mojolicious/Plugin/TestPlugin.pm" in "plugin_test/lib/PluginTest.pm"?
15:00 osfabibisi joined #mojo
15:01 jberger for an application-specific plugin I usually add a new namespace to the plugins loader
15:01 jberger so for MyApp.pm I create a directory <<project_root>>/lib/MyApp/Plugin
15:01 jberger any plugins go in there
15:02 jberger and just like you see here, I add the MyApp::Plugin namespace to the plugin loader: http://mojolicious.org/perldoc/Mojolicious#plugins
15:03 jberger I usually have one app-specific-plugin for Minion tasks, one for common helpers, one for model helpers, maybe one for authorization handling helpers
15:03 jberger the organization of those is entirely up to you depending on how you like to keep things separated
15:04 jberger all you are really doing is making your application's startup method cleaner, though, there is no magic in doing this
15:06 jberger Indeed you could take it even further and put all your routes into a plugin if you wanted and so all your startup method would be is loading plugins in an order
15:06 jberger I'm not sure I'd take it that far, but it is a good extreme case scenario that makes my point that this is just and organizational tool
15:08 blonewolfs i'm not sure i understand it yet, but, i'll give that a try.
15:10 blonewolfs in that link, how is $app defined?
15:18 jberger meaning, what does it contain?
15:19 jberger by convention in the documentation $app is always the primary instance of your application class
15:19 jberger said otherwise, it is the invocant (first argument) to the startup method in your application class, or the return value of the app keyword in a lite app
15:23 blonewolfs that is what i thought but, the various docs seem to waver between $self, $app, & $c.
15:24 zivester joined #mojo
15:26 blonewolfs when you load your plugin, do you do it in your startup sub or in the sub that actually makes a call to a sub in the plugin?
15:38 vytas joined #mojo
15:44 disputin joined #mojo
15:44 Atog I'm filling a hash with xml code this way: $vm->{$1} = $2 while $body =~ /<name>([^<]+)<\/name><value>(([^<]+))<\/value>/sg;
15:45 Atog I'm trying to convert it now to use Mojo::Dom, map/reduce seems to be the way to go around, but still i have no clue
15:46 Atog Now i'm trying something like that $res->dom->find('name + value')->reduce(sub { $vm->{$a} = $a->previous }
15:47 Atog but previous is not a valid method for $a
15:48 Atog i guess i'll just wrap around the sub some dumper/ref to see what's going on
16:00 Atog joined #mojo
16:05 vicash hello. how do I make the Mojolicious app write logs with app->log->debug in production mode. say some stuff is going bad in production, is there a way to make the app start logging in debug mode without restarting it ?
16:08 abra joined #mojo
16:09 Grinnz Atog: it doesn't sound like reduce is the right tool for this
16:10 Grinnz Atog: try ->each(sub { ... }) using $_ instead of $a
16:11 Grinnz Atog: but i think $_->previous would be your name and $_ would be the value, and you want ->text on each of those to get the text contents of that element
16:16 gregf_ joined #mojo
16:27 itaipu joined #mojo
16:28 disputin joined #mojo
16:40 PryMar56 joined #mojo
16:48 Triskelion joined #mojo
17:06 marty_ joined #mojo
17:15 jberger blonewolfs: in startup
17:16 jberger and $self is consistently used as "the local invocant" which is the controller if you are in a controller method or the app if you are in an app method etc
17:16 jberger $app and $c are used outside of those contexts
17:16 jberger though personally I use $app and $c even in their own classes, just to be clear
17:17 jberger other people think using $self is more consistent since it is the invocant, it is a matter of style
17:18 jberger vicash: you can use MOJO_MODE or MOJO_LOG_LEVEL from the environment (MOJO_MODE affects more than just the log level though, so just the log level is probably best)
17:18 jberger you can also just set the log level in the app startup
17:18 jberger any of these would need a restart though
17:19 jberger are you using hypnotoad?
17:21 blonewolfs jberger: when i load my plugin in "startup" i get 2 errors: "Use of inherited AUTOLOAD for non-method Katello_Data::Controller::DataExport::uri_call() is deprecated" and "Use of inherited AUTOLOAD for non-method Katello_Data::Controller::DataExport::uri_call() is deprecated".  any ideas what i might be doing wrong?
17:22 jberger you define the helper uri_call in a plugin?
17:24 blonewolfs yes.  inside my plugin, i have a register sub that contains $app->helper(uri_call => sub {...});
17:25 jberger and that line that declares it comes before it is used?
17:26 jberger more specifically, are you sure that you are loading the plugin?
17:26 blonewolfs as far as i know it does.
17:27 jberger put a line like `warn "plugin loaded"` as the last line of the plugin register method
17:27 jberger make sure you see that line in your console
17:29 blonewolfs i do not see it.
17:30 blonewolfs so, as i expected, the plugin is not being loaded correctly in my startup
17:36 jberger correct
17:37 jberger and to be certain, you do call $app->plugin(<<your plugin name>>) in your application startup?
17:37 jberger also, your plugin needs to inherit from Mojolicious::Plugin
17:38 blonewolfs here are the commands i am using: "my $plugins = $self->plugins(Mojolicious::Plugins->new);" "push @{$plugins->plugins->namespaces}, 'LinuxPortal::Plugin';", "$plugins->plugins->load_plugin('Common');"
17:38 jberger and needs to be in the correct path and have the correct package name etc
17:38 jberger first, don't put in a new plugins
17:39 jberger and don't load_plugin!
17:39 jberger so lots and lots is wrong there
17:39 jberger all you wanted to do is: push @{$app->plugins->namespaces}, 'MyApp::Plugin';
17:40 jberger then $app->plugin(<<your plugin name>>)
17:40 jberger so
17:40 jberger push @{$app->plugins->namespaces}, 'LinuxPortal::Plugin';
17:40 jberger $app->plugin('Common');
17:41 jberger where did you even find ->plugins->load_plugin?
17:41 blonewolfs http://mojolicious.org/perldoc/Mojolicious/Plugins#load_plugin
17:43 blonewolfs in startup, is $app = $self->app ?
17:43 jberger http://mojolicious.org/perldoc/Mojolicious#plugin
17:43 jberger yes
17:44 jberger the invocan't to the startup method is the app
17:50 blonewolfs okay. i now see the the warn output from the end of the plugin register sub.  so, that part appears to be working correctly.  i am still getting the AUTOLOAD error though.
17:51 jberger blonewolfs: I'm sorry, I just don't have time to walk through every step of this with you today
17:52 jberger if the register method is begin called then I'm guessing you aren't adding the helper correctly
17:52 jberger start there
17:54 blonewolfs okay.  i understand.  thank you for your help.  it has definitely been appreciated.
18:07 orev joined #mojo
18:11 dod joined #mojo
18:14 gizmomathboy joined #mojo
18:43 asarch joined #mojo
18:44 disputin joined #mojo
18:44 Adurah joined #mojo
18:48 vicash jberger: thanks. MOJO_LOG_LEVEL is what I want. I don't mind the restart. not using hypnotoad yet since we only have < 5 users but seeing "Connection closed" problems in production that we don't see in dev
18:52 abra joined #mojo
18:53 rshadow joined #mojo
19:00 Dandre joined #mojo
19:29 ptolemarch joined #mojo
19:40 gizmomathboy joined #mojo
20:08 blonewolfs joined #mojo
20:11 sri blonewolfs: http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Adding-a-plugin-to-your-application
20:11 sri jberger: why not just link to that?
20:11 sri coolo: i did get the apartment after all
20:12 jberger sri: it evolved around to where that link would have been useful, by that time I was too focused on getting back to work
20:12 jberger whoops
20:13 sri looks like rethinkdb is dead
20:13 sri https://discuss.horizon.io/t/are-rethink-and-horizon-dead-abandoned/619/6
20:17 sri heh, wondered why the news got censored off the hackernews frontpage, of course ycombinator is an investor
20:18 jberger the problem of getting project news from the project funder
20:18 jberger s/the/a/
20:20 sri someone else look into this please https://github.com/kraih/mojo/issues/1003
20:20 sri hope the shitty utf8 boilerplate in the example has no relevance
20:21 sri actually, i'll close it as a possible exploit
20:24 sri if he had linked to a hash instead of master, i might have let it slide
20:39 itaipu joined #mojo
20:50 disputin joined #mojo
21:26 marcus seems everyone are blaming me as usual.
21:47 jberger marcus: I bet you deserve it
21:47 jberger hey, how's the new gig? getting to work on mojo code again?!
21:48 marcus jberger: not very much so far. been quite busy cleaning in operations so far. But I've written a little Perl.
21:48 jberger nice that you have both skills
21:49 marcus yeah, makes for more variety :)
22:09 genio wrt RethinkDB... nooooooooooooooooooooooo.  man, that sucks
22:20 jberger sounds like time for a community fork
22:21 ccakes joined #mojo
22:23 genio This year has kind of been crappy.  Release a project using product X, product X folds.  Use Atlassian services, they keep screwing with pricing and feature sets to where it's nothing like what you agreed to pay for.  ServiceRocket pulls a bait and switch as well.
22:30 jberger everyone knew that Atlassian was going to do that
22:31 jberger and most of these projects that are only developed by a single corporate sponsor scare me to death
22:32 jberger that said, if enough people feel this way about RethinkDB and the source is available then you're ok :-P
23:00 lluad joined #mojo
23:43 zivester joined #mojo

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