Camelia, the Perl 6 bug

IRC log for #mojo, 2013-01-16

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

All times shown according to UTC.

Time Nick Message
00:04 dhg joined #mojo
00:11 Molaf_ joined #mojo
00:13 * sri considers splitting up Hypnotoad into two modules again
00:13 dhg left #mojo
00:23 al802 joined #mojo
00:23 al802 Hi, does anyone know the syntax for "under" in a non-lite app
00:24 al802 the videos and examples only give lite syntax which fails in full app
00:24 al802 I tried    $self->under( => sub {    my $self = shift;    return 1 if ($self->is_auth);    return;    });
00:25 al802 $self->under => sub {    my $self = shift;    return 1 if ($self->is_auth);    return;    };
00:25 al802 $self->under sub {    my $self = shift;    return 1 if ($self->is_auth);    return;    };
00:25 sri please do not paste into the channel
00:25 al802 sorry
00:25 anewkirk $self->bridge() I believe
00:26 al802 confused
00:27 al802 under allows code under it to execute/to be matched if true
00:28 ask joined #mojo
00:31 al802 so you cannot use under in a non-lite app?
00:32 sri also, please stick to one nick, don't change every time you rejoin
00:36 al802 this is my final nic, the chat client was picking random names :( sorry about that
00:41 mattastrophe joined #mojo
00:41 rem_lex|pivo joined #mojo
00:47 tempire al802: under in a lite app is shorthand for a bridge
00:51 al802 ahh, thank you
00:51 sri dammit, i have Mojo::Server::Prefork working perfectly, but Hypnotoad is really slow for some reason :S
00:53 sri zero downtime restarts work, it's just soooo damn slow
00:54 al802 maybe its wating for connections to close
01:04 laouji joined #mojo
01:07 jberger you can still use under
01:07 jberger my $u = $r->under(sub{ ... });
01:07 jberger $u->any(...)
01:08 al802 will try that, thanks
01:08 mattastrophe joined #mojo
01:08 al802 is there a way to get a list of installed plugins
01:09 al802 I'm looking at plugins at cpan for mojo, but it seems some of them are already part of mojo;
01:10 jberger http://mojolicio.us/perldoc/​Mojolicious::Plugins#PLUGINS
01:10 Mike-PerlRecruiter_ joined #mojo
01:12 dotan joined #mojo
01:12 ka2u joined #mojo
01:13 hlin joined #mojo
01:18 dotan joined #mojo
01:19 al802 jberger: thanks, under works :)
01:33 bluescreen joined #mojo
01:37 sri oh noes, i'm a moron again
01:39 sri i overloaded a private method from a base class... and the only symptom was slow connection shutdown
01:40 sri it's hilarious, al802 was basically right xD
01:43 sri looks pretty good now, only question now is if we actually want hypnotoad split in two parts
01:43 sri i kinda want it for better unit tests
01:44 sri hypnotoad would just be about 100 lines of wrapper code, everything else would be a general purpose prefork server without restarting but a real API
01:48 sri tempire, marcus, crab: CAN HAZ OPINIONZ?
01:48 jberger joined #mojo
01:49 tempire almost sounds like the original plan
01:51 sri you mean pre-hypnotoad?
01:51 tempire yes
01:52 sri it kind of is
01:52 tempire what are the downsides?
01:52 tempire because it sounds great
01:52 sri and i know, some folks miss the original prefork server too
01:52 sri downside is documentation
01:53 sri it's another server to explain
01:53 tempire people getting confused with prefork when they really want hypnotoad
01:53 sri we kind of have that already with morbo and the plain old daemon
01:53 tempire I feel like that's only people coming from catalyst, though.
01:54 tempire what do people want a prefork server?
01:54 tempire for?
01:55 sri not even sure it's really a downside, we will mostly hide prefork for very specific use cases and recommend hypnotoad
01:55 sri tempire: more control while testing apps in a prefork environment?
01:56 sri i'm not sure, my use case is only better test coverage for hypnotoad
01:57 sri perhaps devops will like a vry customizable prefork server for mojo apps
01:57 sri i've implemented hypnotoad through new events the prefork server emits, you could use those for collecting metrics too
01:57 sri (currently spawn, reap, manage and finish)
01:57 tempire "better test coverage for hypnotoad" <- enough reason
01:58 tempire oh
01:58 tempire metrics
01:58 tempire +2
01:58 tempire +3, actually.  that sounds awesome.
01:58 sri hypnotoad might benefit indirectly once we add a way to hook into it from apps
01:58 sri the events would already be there
01:59 Adura joined #mojo
01:59 sri oh, another downside might be regressions i'm overlooking of course
02:00 sri not breaking any tests, but hypnotoad is a bit weak there
02:01 d4rkie joined #mojo
02:03 sri on the other hand, all regression could prolly result in new unit tests :)
02:24 mattastrophe joined #mojo
02:24 xaka joined #mojo
02:30 egopro joined #mojo
02:33 edenc left #mojo
02:53 mattastrophe joined #mojo
03:09 noganex_ joined #mojo
03:35 jberger is there any way to control access to static files in the static files folders?
03:36 jberger a friend is publishing a webcomic and I'm helping him make a site for it
03:36 jberger it would be nice if I could say allow a picture after a certain date
03:37 jberger the hacky way would be put each picture in its own directory and add that directory to the static paths at the right time
03:37 jberger I'm curious if there's something more clever than that?
03:54 good_news_everyone joined #mojo
03:54 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/GmLnRQ
03:54 good_news_everyone mojo/master cc86d1a Sebastian Riedel: added modules Mojo::Server::Prefork and Mojolicious::Command::prefork
03:54 good_news_everyone left #mojo
03:54 sri phew... that was a lot of work
03:54 sri tempire, marcus, crab: this one seriously needs review!
03:55 xaka jberger: there is after_static_dispatch hook that you could use to control the access like send 404 or 500 responses in case you dont want the file to be served
03:56 jberger xaka, yes, perfect
03:56 jberger I was thinking of a policy or router or something
03:56 jberger but yeah, thats perfect, thanks!
03:56 sri these options need better names https://github.com/kraih/mojo/commit/cc86d​1a2a8bb096e42b2342340ab518d87d84e64#L4R12
03:57 sri some like -f are pretty bad
04:00 sri prefork might also come in handy for environments where you can't run hypnotoad, like on heroku
04:01 sri hypnotoad is now only 98 lines of code :)
04:13 tempire HYPNOTOAD_REV?
04:14 sri revision
04:17 good_news_everyone joined #mojo
04:17 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/5gHesA
04:17 good_news_everyone mojo/master 33f97a5 Sebastian Riedel: removed unused argument
04:17 good_news_everyone left #mojo
04:17 xaka dunno why but i like when everything starts in foreground by default so i could stop it by Ctrl+C w/o passing additional options. plus init services (smf, upstart, systemd) take care of daemonizing and pid files this days
04:18 tempire well it's certainly much easier to follow
04:18 tempire I know I'm late to the party, but I'm really happy with OSX' filevault
04:20 xaka tempire: does it mean you have something to hide? ;)
04:20 tempire always.
04:20 tempire What's HYPNOTOAD_REV used for?
04:21 sri to make sure certain things only happen after the first start
04:22 sri or actually, after the first and after the second
04:22 sri daemonize after second, because the first restart happens automatically, to test if evrything works
04:23 davehorner joined #mojo
04:29 mattastrophe joined #mojo
04:42 good_news_everyone joined #mojo
04:42 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/uG2ZUA
04:42 good_news_everyone mojo/master c3c0c46 Sebastian Riedel: added heartbeat event to Mojo::Server::Prefork
04:42 good_news_everyone left #mojo
04:43 sri that makes testing easier and should be useful for metrics
04:47 sri i don't really like the manage event, wish it would serve a real purpose
04:47 hesperaux joined #mojo
04:48 good_news_everyone joined #mojo
04:48 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/iOkLGg
04:48 good_news_everyone mojo/master 2193818 Sebastian Riedel: documentation tweak
04:48 good_news_everyone left #mojo
04:55 yakudza joined #mojo
04:58 sri hmm, somehow i'm not happy with prefork
05:02 d4rkie joined #mojo
05:02 sri could be the message event, bad command line option names or just that it's about 100 lines of new code :S
05:03 D4RK-PH0ENiX joined #mojo
05:04 sri or i'm just tired :)
05:07 mattastrophe joined #mojo
05:16 ka2u joined #mojo
05:22 mattastrophe joined #mojo
05:27 ka2u joined #mojo
05:36 good_news_everyone joined #mojo
05:36 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/oLrhpA
05:36 good_news_everyone mojo/master a21896e Sebastian Riedel: better command line options
05:36 good_news_everyone left #mojo
05:41 good_news_everyone joined #mojo
05:41 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/wi7RFA
05:41 good_news_everyone mojo/master 273b29d Sebastian Riedel: renamed manage event to wait
05:41 good_news_everyone left #mojo
05:48 good_news_everyone joined #mojo
05:48 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ov7CAw
05:48 good_news_everyone mojo/master c41bc64 Sebastian Riedel: documentation tweak
05:48 good_news_everyone left #mojo
06:14 atz__ joined #mojo
06:24 ver joined #mojo
06:57 good_news_everyone joined #mojo
06:57 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/SjZLkQ
06:57 good_news_everyone mojo/master b694b2b Sebastian Riedel: allow Mojo::Server::Prefork to restart workers automatically
06:57 good_news_everyone left #mojo
07:02 jwang joined #mojo
07:07 Miked joined #mojo
07:09 Vandal joined #mojo
07:15 dod joined #mojo
07:16 dpetrov_ joined #mojo
07:18 good_news_everyone joined #mojo
07:18 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UOnR1A
07:18 good_news_everyone mojo/master a85f2bf Sebastian Riedel: fixed automatic restarting of worker processes
07:18 good_news_everyone left #mojo
07:19 sri that's a lot of options https://github.com/kraih/mojo/blob/maste​r/lib/Mojolicious/Command/prefork.pm#L12
07:30 dod joined #mojo
07:48 ObseLeTe joined #mojo
08:03 amirite joined #mojo
08:15 suy joined #mojo
08:19 taryk joined #mojo
08:20 taryk left #mojo
08:31 alnewkirk joined #mojo
08:52 d4rkie joined #mojo
09:02 ObseLeTe joined #mojo
09:03 tm1 joined #mojo
09:06 tm1 good morning :)
09:34 egopro joined #mojo
10:06 nicomen is there a hypnotoad munin plugin for checking amount of clients etc?
10:10 SmokeMachine joined #mojo
10:20 amirite_ joined #mojo
10:31 cosmincx joined #mojo
10:38 judofyr joined #mojo
10:46 ryozi joined #mojo
10:47 mattastrophe joined #mojo
10:59 mattastrophe joined #mojo
11:01 tm joined #mojo
11:01 dvinciguerra joined #mojo
11:03 egopro joined #mojo
11:06 TitanOfOld joined #mojo
11:12 mattastrophe joined #mojo
11:59 spleenjack1 joined #mojo
12:01 mattastrophe joined #mojo
12:17 mattastrophe joined #mojo
12:57 tm left #mojo
13:00 spleenjack joined #mojo
13:08 egopro joined #mojo
13:11 Mike-PerlRecruiter_ joined #mojo
13:12 Vandal joined #mojo
13:22 mattastrophe joined #mojo
13:34 mike___ joined #mojo
13:34 egopro joined #mojo
13:35 egopro joined #mojo
13:52 egopro joined #mojo
14:03 wircus https://www.evernote.com/shard/s22/sh/90ef1cf4-b4f​5-4ec7-b0ea-4eec32ffcea6/de58ba13fad7df899e1543ee5​0c1edb1/deep/0/Screenshot%2016.01.13%2015:02.jpg # wat?
14:08 judofyr wircus: old executable in $PATH?
14:09 jberger https://github.com/kraih/mojo/blob/ma​ster/lib/Mojolicious/Commands.pm#L112
14:09 jberger sri went a little code-happy last night it seems!
14:11 wircus judofyr: spot on
14:11 wircus judofyr: old mojo in /usr/local/bin
14:12 bluescreen joined #mojo
14:14 d4rkie joined #mojo
14:16 SmokeMachine joined #mojo
14:18 Miked joined #mojo
14:20 mattastrophe joined #mojo
14:35 daniel_ joined #mojo
14:41 jberger oh, I was thinking sri renamed app->start to app->start_app, I got it now
14:41 jberger nm
14:41 sri :o
14:46 TitanOfOld joined #mojo
14:50 al802 joined #mojo
14:53 al802 Need help understanding how a plugin works from none-lite app; Specifically; how to do I "Use" it from the app and where does it live (on disk) in relation to the app created by mojo generate pluging
14:54 judofyr al802: the plugin structure is the same for all plugins. you enable plugins in non-lite apps in startup: sub startup { my $self = shift; $self->plugin("…") }
14:55 al802 I don't understand, for example here: http://mojolicio.us/perldoc/Mojolicious/Plugin is a plugin that has a fuction register
14:56 al802 do I need to call register to initialise it
14:56 judofyr al802: no. calling $self->plugin("Foo") will call Foo->register($self)
14:57 judofyr al802: it's trying to tell you that you should override this method
14:57 judofyr al802: you should never (directly) call register. it's called by $self->plugin(…)
14:58 al802 normally you wuold call my $obj=foo::bar->new;
14:58 al802 but before that you would "use foo:;bar"
14:58 vervain That's a very broad definition of normally there.
14:59 al802 that's what I don't understand;
14:59 judofyr al802: you're not really supposed to initialize plugins yourself. Mojolicious handles all that for you.
14:59 al802 so how do I access them
15:00 judofyr al802: it will call ->register: sub register { my ($self, $app, $conf) = @_ }
15:00 al802 ok, how do I tell my app to include it in the first place
15:01 al802 e.g. in perl I would use "foo::bar"
15:01 judofyr al802: $self->plugin("MyPlugin") in the startup-sub, or just `plugin "MyPlugin"` in Lite
15:02 amirite joined #mojo
15:02 al802 so to access the functions with the plugin;
15:03 al802 I assume self->plugin("MyPlugin") does a Use MyPlugin; and calls $x=MyPlugin->register();
15:04 judofyr al802: yup
15:04 al802 in other words how to a get the accessor object in order to use it later
15:04 judofyr al802: depends on how you want to use it. you can define a helper: sub register { $app->helper(do_shit => sub { … }) }
15:04 al802 do I create my own ->new function
15:04 vervain Most of the time your plugin will probably either alter the behavior of the app or provide helper functions... that you just call like any other.
15:04 vervain For some definition of Most.
15:06 vervain The plugin will 'use Mojo::Base 'Mojolicious::Plugin'' which will build things like 'new' for you.
15:06 al802 but where is the object I must use?
15:06 al802 to refer to the plagin
15:06 * vervain doesn't know for sure if Mojolicious::Plugin has a new or not.
15:06 vervain I'm just saying things 'like' new.
15:07 vervain You don't.  The plugin either alters yoru app or provides helpers.  Read the docs for the Plugin.
15:07 al802 I've read the docs;
15:08 vervain In which case it may help if you use pastebin or some such to post specific code with specific questions. :-)
15:09 al802 ok give me a sec.
15:11 good_news_everyone joined #mojo
15:11 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/fXn8vA
15:11 good_news_everyone mojo/master 8e45606 Sebastian Riedel: better descriptions for prefork options
15:11 good_news_everyone left #mojo
15:15 al802 http://mibpaste.com/tWx1Ix MyApp and plug
15:15 al802 question how does the app call the plugin
15:16 egopro joined #mojo
15:17 Britzel_ joined #mojo
15:18 al802 so for example I get Plugin "Auth" missing, maybe you need to install it?
15:18 al802 so I must use it somehow
15:19 al802 The other part of my original question is where does it live on disk in relation to the main app such that it can be found
15:20 al802 does it live in side the lib/MyApp/Auth.pm or does it live at the same level as my_app
15:21 sri marcus: thoughts on the prefork/hypnotoad split?
15:21 judofyr al802: plugins should be in lib/Mojolicious/Plugin/Auth.om
15:21 judofyr pm*
15:26 good_news_everyone joined #mojo
15:26 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/qYeHCQ
15:26 good_news_everyone mojo/master a7b0e8b Sebastian Riedel: removed daemonize method from Mojo::Server::Prefork
15:26 good_news_everyone left #mojo
15:46 mattastrophe joined #mojo
15:46 egopro joined #mojo
15:47 al802 Can someone help get understand/get past first base on plugins -> http://mibpaste.com/VNBwKc
16:02 judofyr joined #mojo
16:11 al802 Does anyone know who to call a function in a plugin
16:19 labrown joined #mojo
16:19 al802 for example; if I do # mojo generate app TestApp
16:20 al802 then mojo generate plugin Auth
16:20 al802 I want to now include Auth in my TestApp
16:21 al802 I would like to call a function in my plugin from the startup function of my TestApp
16:21 al802 and get a return value
16:22 al802 but I cannot found documentation that explains how to do this;
16:25 dhg joined #mojo
16:27 al802 anyone around?
16:38 good_news_everyone joined #mojo
16:38 good_news_everyone [mojo] kraih pushed 2 new commits to master: http://git.io/dr50Dg
16:38 good_news_everyone mojo/master 3322bb8 Bernhard Graf: fixed memory problem with uploads > 2G on 32-bit Perls
16:38 good_news_everyone mojo/master 2acdad7 Sebastian Riedel: Merge pull request #445 from augensalat/master...
16:38 good_news_everyone left #mojo
16:40 augensalat \o/
16:41 GabrielVieira joined #mojo
16:43 sri i messed up, i didn't mean to merge that
16:44 anaio joined #mojo
16:44 yakubori joined #mojo
16:44 yakubori o/
16:44 marty al802:  I'd probably use a helper.
16:45 good_news_everyone joined #mojo
16:45 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Uvhz_Q
16:45 good_news_everyone mojo/master 7cc950a Sebastian Riedel: fixed content test
16:45 good_news_everyone left #mojo
16:47 al802 I want to learn by example
16:48 al802 I thnk it is a fair question, plugins exist,I just don't understand how they work;
16:50 yakubori al802: there's a video on plugins that's decent.
16:51 yakubori in the context of going from helper, to helper with plugin, iirc
16:51 al802 I've watched all the videos; they specifically refer to ::lite;
16:52 egopro joined #mojo
16:52 good_news_everyone joined #mojo
16:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/JD9Kow
16:52 good_news_everyone mojo/master 8321dd8 Sebastian Riedel: fixed a few examples
16:52 good_news_everyone left #mojo
16:52 al802 look, my question is; from all the videos; I should be able to 1) create an app, 2) create a plugin; 3) call the plugin from the app
16:52 yakubori ya, you can
16:53 al802 can you help me understand how?
16:53 jberger joined #mojo
16:54 yakubori if you've got something done with ::Lite, a "real" app is similar, except you call launch a module that inherits from Mojolicious
16:54 yakubori so, in that modules handlers for each route, you should be able to use whatever plugins you have developed or grabbed from the archive
16:55 jberger al802, I have an example: https://github.com/jberger/Mojolicious-Plugin-Hum​ane/blob/master/lib/Mojolicious/Plugin/Humane.pm
16:55 jberger my Mojolicious::Plugin::Humane stores a reference to itself in a helper so you can refer to it later
16:56 jberger the module it self is still hit-or-miss, I hope to have some time to work on it later
16:56 yakubori inside that module, the guts of what you see inside of ::Lite will be inside a sub (which you need to write) called startup
16:56 jberger but it should be an example of what you are needing
16:56 marty al802:  Also, if all of the examples and videos are for ::lite, you should create a small lite app and get things working they way you want.  Then, converting to a full app is painless.
16:56 yakubori inside startup, you can do $self->plugin('MyApp::Plugin::Thingie');
16:57 yakubori and, ya, take a look at jberger's Humane plugin. it helped me as well.
16:57 yakubori marty: there's a cli for transition, no?
16:57 yakubori (thought i read that somewhere)
16:58 jberger https://github.com/jberger/Mojolic​ious-Plugin-Humane/blob/master/lib​/Mojolicious/Plugin/Humane.pm#L56
16:58 marty yakubori: ye
16:58 al802 ok that ;s a million miles away from where I am at the moment; I really am on first base; I simply wish to understand how you call a pluging given the simplist app plssible
16:58 al802 e.g. the plugin returns true
16:58 al802 how do I call that
16:58 al802 Now I've just freshley installed Mojo
16:58 al802 I've just created an app
16:58 al802 I've just cated a plugin
16:59 al802 that's where I'm at
16:59 jberger packagae MyApp; sub startup{ my $self = shift; $self->plugin('MyPlugin') ...
16:59 yakubori ^^
16:59 al802 ok can you explain to ne what "$self->plugin('MyPlugin')" does;
16:59 al802 my understanding is that it registers the plugin somewhere
17:00 jberger it will "use Mojolicious::Plugin::MyPlugin", make an instance and call register
17:00 al802 and return what ?
17:00 jberger I believe it returns the instance of the plugin
17:01 al802 To what?
17:01 al802 you said $self->plugin
17:01 yakubori it loads the plugin so you can use its functions from the app. so if you've defined a method foobar in the plugin, and loaded the plugin, you can do $self->foobar from the app (correct me if i'm wrong, jberger)
17:01 al802 not my $obl=$self->plugin(''blar")
17:02 yakubori once it's loaded in the app, you can use it anywhere else, like in a controller afaik
17:02 al802 that is what I'm expacting
17:02 yakubori i don't think there's an assignment
17:02 al802 So all methods must be unique in name?
17:03 yakubori it's loading the plugin, making it available from the context of you app
17:03 al802 So it basically extends the syntax rather than provide a function
17:04 jberger I don't think the plugin methods are exported, just any helpers that are defined
17:04 al802 if I have two plugins each with a method "test" how do I specify which test
17:04 xaka joined #mojo
17:05 jberger it appears that the return is whatever is returned from sub register {}
17:06 al802 Do I need to du a "use" to include the plugin in my app?
17:06 jberger al802, NO
17:06 jberger the call to plugin() does that for you
17:07 al802 so, if I do mojo generate app TestApp; then mojo generate pluging TestPlugin
17:07 jberger are these plugins just for your app?
17:08 al802 yes
17:08 jberger plugins are just a way to package helpers
17:08 yakubori sorry, you're right jberger. the helper name, not a method name
17:08 jberger if these are only for your app, just start by making helpers not packaging them as plugins
17:09 al802 I'm trying to understand this, I don't want to do something else;
17:09 al802 Can I show you what happens from scratch; let me create an app
17:09 jberger in my early apps I had helpers and callbacks etc to deal with using humane.js in my templates
17:10 jberger once I did it a few times, I decided it might be nice to abstract that so that I could use it more painlessly in all my apps
17:10 jberger so I bundled it up into a plugin
17:10 al802 # mojo generate app TestApp
17:11 al802 output http://mibpaste.com/LgwExx
17:11 jberger al802, I'm not trying to sound mean, but do you understand how helpers work?
17:11 jberger I'm just trying to gauge a starting point
17:11 al802 please bear with me
17:12 al802 # mojo generate plugin Auth
17:12 jberger I have work to do
17:12 jberger the next guy can bear with you, sorry, thats all the time I have
17:12 al802 output http://mibpaste.com/fxYvWp
17:12 al802 Thanks
17:13 marty al802:  I agree with jberger.   It sounds like you need to step back and work through the lite tutorial. If you take the time to do that it will help you a whole lot
17:14 al802 I have done that and it seems no on can/will take the time to explain to me where I am going wrong
17:14 marty Did you get a plugin working in a lite app?
17:14 al802 No I did not want to use the lite
17:15 marty There is your problem
17:15 marty Lite = full app (in a wrapper)
17:15 al802 Lite=1 file
17:15 al802 I have a need > 1 file
17:16 al802 I am simply tring to  understand how a pluging is initialliszed, accessed and can return some result
17:18 al802 Maybe my understanding of a pluging is completely wrong
17:19 al802 in my mind a plugin is like any perl class/module such that I can create an instance and call function/methods
17:19 al802 is this the case with mojo plugins ?
17:19 yakubori I think, if you're unfamiliar with the framework, that's gonna be hard to justify in the first place. You're gonna have to start with ::Lite if you're completely new to its approach.
17:20 yakubori no, that's just a class. you can use plain old perl, or inside out classes, or moose, etc. for that.
17:21 al802 Can you explain in 1 line; what a plugin does
17:21 yakubori a plugin might register a helper that uses 0 or more classes
17:21 yakubori does that make sense?
17:22 al802 yes
17:22 al802 but then the problem is helper;
17:22 yakubori it could do nothing but 'say "HI!";'
17:23 yakubori what's the issue with the helper?
17:23 al802 If I wanted to abstrat some functionaility of my app, would I use a plugin
17:23 yakubori right. so it can be shared with other apps
17:24 al802 I cam back to my original question; how do I call a pluging in order to acces the abstractiobn functionaility in that plugin
17:25 al802 OK
17:25 al802 what is teh difference between a plugin and a class
17:25 al802 I mean when I use a lpugin, you do a "use" and you call a function called register right
17:26 yakubori no
17:26 yakubori you load a plugin, which registers helpers
17:26 vervain I think you need to be thinking about controllers not classes, plugins, or helpers.
17:26 yakubori those helpers are accessible within the context of the app
17:26 vervain al802: Are you completely up to speed with routing?
17:26 vervain Did you read all of the Guides in order?
17:27 al802 I've have a good idear and use routing
17:27 al802 yes
17:27 sri plugins implement the decorator pattern
17:29 al802 decorator pattern ?
17:29 sri i'm not gonna google that for you :)
17:30 vervain al802: Don't be distracted by that comment. And sri behave ;-)
17:30 yakubori right. so, i think from your point of view, al802… a class would have to be "used" each time you wanted its functionality. a plugin would only have to be loaded once, and you would have access to its registered helpers *anywhere* within the context of the app.
17:31 * sri just broke his perlbrew somehow :S
17:31 al802 Thank you, that makes sense
17:32 vervain perlbrew + git = bliss :-)
17:32 al802 not yet!
17:34 al802 I'm almist afriad to ask
17:34 yakubori what's up?
17:34 al802 for exampel, in my startup do I register the plugin?
17:35 yakubori yes
17:35 al802 e.g. $self->plugin('Auth') as I've seen in other examples
17:35 yakubori yep
17:35 al802 once that is done
17:35 al802 how do I use the methods in that plugin
17:36 al802 lets assume I had a check function that required a username
17:36 al802 and I wanted a result back, true or false
17:36 vervain You could always have a look at Mojolicious::Plugin::Authentication and the example app that hangs around with it.
17:37 vervain The plugin and the App are both quite small and relatively approachable.
17:37 vervain May help you understand how the pieces are glued together.
17:39 al802 OKI thnk I know what my problem is now
17:39 ObseLeTe joined #mojo
17:41 al802 by your example; $self->plugin('authentication' )
17:41 ObseLeTe joined #mojo
17:42 al802 Would I call other methods in the plugin other than authenticatio, in this case
17:42 al802 and if so, how would I address them in the syntax of the above example
17:44 al802 or does the plugin method just automatically know such that I could call self->plug('anotherfunction')
17:44 al802 which exists within my plugin
17:45 jberger Part1: https://gist.github.com/4549078
17:45 jberger Part2: https://gist.github.com/62db71eda22965066fa0
17:46 jberger hmmm that second one my have been private, should still show with url
17:47 jberger tiny fix, updated part2
17:47 jberger thats all it is
17:47 al802 yep I get all that
17:48 al802 How does you app know to you your plugin
17:48 al802 you=your
17:49 jberger magicc
17:49 jberger (Mojo::Loader)
17:49 jberger $app->plugin() does that for you
17:49 jberger the plugin must be in @INC
17:50 jberger and it must be in the namespace Mojolicious::Plugin
17:50 al802 I get it all now; thank you so much for explaining this :)
17:51 jberger from this link: http://mojolicio.us/perldoc/Mojolicious#plugin
17:51 jberger it appears that if you give a fully qualified module name, it doesn't need to be in Mojolicious::Plugin namespace
17:51 jberger thats new to me
17:52 jberger you can add another namespace by doing:
17:52 egopro joined #mojo
17:53 jberger push @{ $app->plugins->namespaces }, 'MyApp::Plugin';
17:53 jberger see: http://mojolicio.us/perldoc/M​ojolicious/Plugins#namespaces
17:53 jberger all the "using" is done by mojolicious knowing that information
17:53 jberger fin
17:54 al802 yep, I fully get it now; thank you; I think the magic was getting to me
17:55 jberger its not really magic, its actually been a perl concept for a long time, http://p3rl.org/Module::Pluggable
17:56 jberger mojolicious doesn't use this, it reimplements it, but its not really magic
17:57 good_news_everyone joined #mojo
17:57 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/aZ0SfA
17:57 good_news_everyone mojo/master e5e7518 Sebastian Riedel: documentation tweaks
17:57 good_news_everyone left #mojo
17:58 jberger use the source Luke!
17:58 jberger https://github.com/kraih/mojo/blo​b/master/lib/Mojolicious.pm#L177
17:58 jberger https://github.com/kraih/mojo/blob/m​aster/lib/Mojolicious/Plugins.pm#L50
18:04 davehorner joined #mojo
18:05 sh4 joined #mojo
18:06 jberger part3: using normal perl
18:06 sh727 joined #mojo
18:06 jberger warning! don't do this, because sri is allowed to change the internals however he wants
18:06 jberger https://gist.github.com/4549286
18:06 jberger in practice though nothing prevents you from doing this
18:07 jberger all you are doing is moving some logic to another file
18:09 al802 I complete get it now, thanks
18:11 sri jberger: that seems pretty safe though
18:12 jberger sri: it does, thats why I added the note
18:12 jberger in principle plugin could do more than load and call register
18:12 jberger maybe it would want to cache an instance of the plugin
18:12 jberger or keep record that it was loaded
18:13 jberger doing this manually circumvents this option
18:13 jberger still, nothing prevents you from doing it manually, as I said :-)
18:14 sri tempire: btw. filevault sucks for me now :(
18:15 tempire sri: why?
18:16 sri sandforce ssd controller
18:16 sri performance depends greatly on data compression, but filevault data is uncompressible
18:20 dhg joined #mojo
18:21 mattastrophe joined #mojo
18:31 basic6 joined #mojo
18:31 jdoe sri: as compared to what?
18:32 basic6 left #mojo
18:33 basic6 joined #mojo
18:35 inokenty joined #mojo
18:36 vervain jdoe: Compression algorithms are inefficient with encrypted / randomish data.
18:36 sri jdoe: all other ssd controllers
18:37 jdoe vervain: I understand.
18:38 jdoe sri: I dunno, I just went looking for benchmarks. Tom's shows it as a bit slower than an intel one (a few mb/s) but not significantly.
18:38 jdoe I think it was an intel 520 vs. an ocz vertex 3
18:38 sri even intel uses sandforce i believe
18:39 sri ocz and samsung have their own
18:39 jdoe ocz uses sandforce
18:39 jdoe at least, the vertex def. does.
18:39 sri then it's all mixed up
18:39 jdoe samsung is usually indilinx I think
18:39 dhg joined #mojo
18:50 ka2u joined #mojo
18:52 egopro joined #mojo
19:00 ObseLeTe joined #mojo
19:00 ObseLeTe joined #mojo
19:12 sri anyone built a 32bit perl with perlbrew on osx yet?
19:32 good_news_everyone joined #mojo
19:32 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/4v7PBQ
19:32 good_news_everyone mojo/master 86d51fd Sebastian Riedel: added event examples
19:32 good_news_everyone left #mojo
19:34 sri even though i know prefork is the right way to go... i still hate that it's 100 lines of additional code :S
19:36 sri and evryone who wants a metrics collection api for hypnotoad, you should start thinking about how we bridge the gap between hypnotoad config and $prefork
19:53 egopro joined #mojo
19:59 good_news_everyone joined #mojo
19:59 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/XgP4hQ
19:59 good_news_everyone mojo/master a5d572b Sebastian Riedel: documentation tweaks
19:59 good_news_everyone left #mojo
20:00 noganex joined #mojo
20:09 atz joined #mojo
20:11 good_news_everyone joined #mojo
20:11 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/k-Ty9Q
20:11 good_news_everyone mojo/master 1b6fd05 Sebastian Riedel: better log messages for prefork server
20:11 good_news_everyone left #mojo
20:16 ka2u joined #mojo
20:28 BeDa joined #mojo
20:32 lukep joined #mojo
20:49 bobkare sri: had a quick look and it looks like it should be pretty straight forward to automate deployment of mojo apps with prefork
20:50 sri bobkare: thought you would like it :)
20:53 nicomen joined #mojo
20:53 bobkare It's pretty crazily busy at work at the moment, but if I find the time to create an updated puppet module I'll get it published somewhere. Maybe it could be linked to from the deployment part of the cookbook.
20:53 egopro joined #mojo
20:54 HtbaaPi sri: https://twitter.com/kraih/​status/291605321456168962 does this mean the hypnotoad script will disapear? e.g. am I going to need to change anything when using hypnotoad?
20:54 tempire HtbaaPi: you won't notice anything
20:55 tempire It's transparent from your perspective
20:55 bluescreen joined #mojo
21:00 HtbaaPi tempire: ah good
21:00 HtbaaPi I suspected as much
21:00 ask Shouldn't Test::Mojo have put_json_ok (like post_json_ok) -- or is there an easy way to make it PUT instead of POST?
21:03 ask hah, I think I asked this about a year ago. It suddenly rung a bell and I found an older project where I have a module with a bunch of helpers to do tests for PUT/DELETE/...
21:03 * ask & # lunch
21:39 good_news_everyone joined #mojo
21:39 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/yGBuSw
21:39 good_news_everyone mojo/master 916a5f9 Sebastian Riedel: more prefork tests
21:39 good_news_everyone left #mojo
21:41 xaka joined #mojo
21:45 yakubori do you guys happen to know the biggest site running mojolicious?
21:46 yakubori literally that is, not just in name
21:48 yakubori my POC is coming along and i'm just curious about performance feedback
21:50 good_news_everyone joined #mojo
21:50 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/6xXwKQ
21:50 good_news_everyone mojo/master 935a306 Sebastian Riedel: better content test
21:50 good_news_everyone left #mojo
21:51 sri substr breaks with integers that exceed 64bit as well
21:54 egopro joined #mojo
22:21 ObseLeTe joined #mojo
22:24 mattastrophe joined #mojo
22:38 TitanOfOld joined #mojo
22:48 davehorner joined #mojo
22:54 egopro joined #mojo
23:05 al joined #mojo
23:13 dhg joined #mojo
23:29 mojobot23789 joined #mojo
23:40 dhg joined #mojo
23:45 yakubori joined #mojo
23:51 good_news_everyone joined #mojo
23:51 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/99jTmA
23:51 good_news_everyone mojo/master bef1b70 Sebastian Riedel: added pid_from_file method to Mojo::Server::Prefork
23:51 good_news_everyone left #mojo
23:52 Averna joined #mojo
23:55 egopro joined #mojo
23:55 sri i kinda would like to keep pid file handling in hypnotoad only, but it's so much easier to test this way :S
23:57 jzawodn joined #mojo

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