Camelia, the Perl 6 bug

IRC log for #mojo, 2012-11-04

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

All times shown according to UTC.

Time Nick Message
00:29 * sri doesn't understand why riak doesn't get more bad press... their mailing list is full of stories about horrible database failures and data loss :o
00:36 Britzel riak?
00:37 Britzel ah, found it
00:37 sri yea, i guess that's the problem, too few people who care
00:53 lammel2 joined #mojo
01:17 Mike-PerlRecruiter_ joined #mojo
03:30 asarch joined #mojo
03:40 noganex_ joined #mojo
06:35 Foxcool_ joined #mojo
06:37 Vandal joined #mojo
06:55 davido joined #mojo
07:33 dpetrov_ joined #mojo
08:27 dod joined #mojo
08:34 dabudabu joined #mojo
08:51 dod joined #mojo
09:25 yakudza joined #mojo
09:44 Britzel_ joined #mojo
09:58 kitt_vl joined #mojo
11:10 d4rkie joined #mojo
11:10 d4rkie joined #mojo
11:19 marcus anyone done any unit-testing of mails generated with Mojolicious-Plugin-Mail?
11:21 pierrick joined #mojo
11:35 sh4 joined #mojo
11:38 ObseLeTe joined #mojo
11:41 dpetrov_ joined #mojo
11:41 Adura It sent a mail, I was happy with it.
12:04 marcus Adura: yes,that is fine. Would be nice to be able to capture and test mail contents tho. Like Iif you are testing a login flow.
12:21 ObseLeTe joined #mojo
12:52 lammel2 joined #mojo
12:58 kitt_vl joined #mojo
13:17 Mike-PerlRecruiter_ joined #mojo
13:21 ladnaV joined #mojo
13:54 Vandal joined #mojo
14:03 ObseLeTe joined #mojo
14:09 asarch joined #mojo
14:18 jnbek joined #mojo
14:20 sh4 joined #mojo
14:23 ObseLeTe joined #mojo
14:29 gryphon joined #mojo
14:34 Caelum joined #mojo
15:05 Vandal joined #mojo
15:06 Vandal joined #mojo
15:06 marcus https://code.google.com/p/jerl/ # what manner of evil is this.
15:58 ryozi joined #mojo
16:17 d4rkie joined #mojo
16:30 asarch joined #mojo
16:38 sjn joined #mojo
16:38 sjn \o
16:38 * sjn is playing around with mojo
16:39 sjn trying out morbo, but getting an error saying "Can't locate object method "new" via package "Test" at /home/sjn/perl5/lib/perl5/Mojo/Server.pm line 21."
16:40 sjn running the script as a regular daemon works fine :-\
16:41 sjn the script I'm starting is basically identical to the example on http://mojolicio.us/perldoc/Moj​olicious/Guides/Growing#Script
16:41 sjn <- confused
16:43 sjn Hm. did't get all of the error above.
16:43 sjn didn't*
16:43 sjn The error starts with "Couldn't load application from file "script/test":
16:44 jberger sjn: what full command are you using to start your application using morbo
16:44 sjn morbo ./script/test # running from the project root dir
16:45 sjn lib/Test.pm is basically the same as in the example found at http://mojolicio.us/perldoc/Mojolici​ous/Guides/Growing#Application_class
16:46 jberger first of all, using Test as a package name (or Test.pm as a file name) is likely to cause heartache, because of the testing framework (Test::More etc) which already comes with perl
16:46 jberger call you things MyTest or the like to avoid confusion
16:46 jberger *your
16:47 jberger second, are you using the indirect object syntax anywhere? (i.e. my $obj = new Class)
16:48 sjn jberger: no inderect object syntax used, no
16:48 jberger ok, then I think the problem is likely the first point, try renaming to MyTest or some such
16:48 sjn jberger: when I say "Test" I really mean "some internal name that is not Test" :)
16:49 jberger ok
16:49 sjn one difference, I'm not using "MyUsers", but instead another class, "Test::Users"
16:50 sjn perhaps that confuses things?
16:50 jberger are you sure you have `app->start` or the full app equivalent in your test file, its easy to forget that
16:50 jberger I try to avoid using the Test:: namespace completely
16:50 sjn s/Test/SomethingElse/
16:50 sjn sorry
16:51 sjn just trying to be consistent in my renaming scheme here :)
16:51 jberger as long as you are using a free toplevel namespace you should be fine
16:51 sjn just assume s/Test::Users/MyApp::Users/
16:51 sjn exactly
16:52 jberger ok, so are you sure your script has app->start or the like at the end
16:52 jberger its easy to forget
16:52 sjn do the routes set up in the startup sub have to correspond?
16:52 jberger yes
16:53 sjn the script ends with Mojolicious::Commands->start_app('MyApp');
16:53 sjn (just as in the example)
16:53 jberger you can add additional namespaces somehow, but its easiest if the controllers etc are in the same namespace as your app
16:53 sjn They're all in the same namespace
16:54 jberger then without seeing your code, I think thats all my guesses
16:54 sjn hm
16:54 jberger the more experienced devs might know more, I'm just a user
17:01 batman sjn: did you use "mojo" to init your app?
17:02 batman does your class compile? perl -Ilib -c lib/Test.pm
17:05 sjn batman: the app library uses use Mojo::Base 'Mojolicious';
17:05 batman how is that an answer to any of my questions? :/
17:06 sjn I don't use "mojo" to init my app
17:07 sjn batman: I basically have exactly the examples in the URLs above
17:07 batman ok. i think you should. it's the quickest way to start a project: mojo generate app My::App
17:07 sjn oh
17:07 sjn yeah, I did that when I started
17:07 sjn I'm way past that in the tutorial :)
17:07 batman ok
17:08 * sjn misunderstood what batman meant with "to init my app"
17:09 batman i think you should start over and not call your app Test but rather Salve, App::Salve or something
17:12 sjn batman: I didn't call it test. (that name was just a badly chosen replacement for a much longer name)
17:12 batman ok...
17:15 batman can you pastebin the content in your script/whatever ?
17:15 batman without trying to rename stuff to "test"?
17:15 batman oh. wait. you said that ./script/foo works, but not morbo script/foo ?
17:16 batman or even "./script/foo daemon"
17:18 * sjn is redoing the whole thing, slavisly following the Mojolicious::Guides::Growing examples
17:19 sjn batman: yes ./script/foo works fine
17:19 sjn morbo doesn't, it gives an error
17:19 batman just "./script/foo" ?
17:19 batman or ./script/foo daemon
17:19 sjn works fine too
17:20 batman does your ./script/foo contain use Mojo "Mojolicious::Lite" ?
17:21 sjn batman: no
17:21 batman ok
17:26 sjn right
17:26 sjn I've made an exact copy of the example in the docs
17:26 sjn when running it with morbo, I get the following error:
17:26 sjn Couldn't load application from file "./script/myapp": Can't locate object method "new" via package "MyApp" at /home/sjn/perl5/lib/perl5/Mojo/Server.pm line 21.
17:27 sjn so either there's a bug in the docs or a bug in morbo
17:27 sjn or Mojo::Server
17:27 batman sjn: try this: PERL5LIB=lib morbo script/myapp
17:28 sjn PERL5LIB=./lib:$PERL5LIB morbo script/myapp
17:28 sjn that did the trick
17:28 batman sjn: ok. so if you generated your app instead of reading the howto, it would just work :)
17:29 batman the generated app has extra "use lib ..." statements
17:29 batman instead of just   use lib 'lib';
17:29 sjn my app has the following two lines in it:
17:29 batman don't care.
17:29 sjn use FindBin;
17:29 sjn use lib "$FindBin::Bin/../lib";
17:29 sjn (as the example does)
17:29 batman sorry "don't care" was in the wrong window (my computer is sooo sluggish) today :(
17:30 batman chrome is feeding on my cpu...
17:30 * jberger puts away the fish that he was about to smack batman with :-)
17:31 batman jberger: hehe. yeah. it wouldn't be nice of me if i meant it :)
17:31 batman sjn: but the example earlier also says use lib 'lib';
17:31 jberger sjn: the problem is likely that morbo is its own bin
17:31 jberger so FindBin is finding morbo not your script
17:31 sjn hm
17:32 sjn that could be it, yes
17:32 batman jberger: sounds very reasonable
17:32 batman not only "could", but it's how it works.
17:32 batman try to print whatever you're giving to "use lib"
17:32 sjn so... how about changing the example to use the safer method like the one used when you run mojo generate app ?
17:33 jberger https://github.com/jberger/Gali​leo/blob/master/bin/galileo#L10
17:33 batman sjn: wouldn't this work? http://mojolicio.us/perldoc/Mojolicious/Gu​ides/Growing#Simplified_application_script
17:33 jberger this is how I do it for Galileo, which I can test any way I know and I haven't had any problems yet
17:34 jberger I'm pretty sure I didn't come up with that
17:34 * jberger tries to find it in the docs
17:34 sjn batman: that's exactly the one that doesn't work with morbo
17:34 batman use lib 'lib'; ?
17:34 batman no FindBin in that example
17:35 sjn uhm
17:35 sjn ok, sorry
17:35 batman but i agree. the findbin example should be fixed
17:35 sjn it's the one below that, under #Script :)
17:35 batman yeah. i see it.
17:36 batman it should have both the findbin and use lib 'lib'; or no findbin at all... not sure what is best
17:36 * sjn is looking at the section that starts off with "Finally myapp.pl can be replaced with a proper Mojolicious script." :)
17:36 jberger and like I said, the thing I use in Galileo has a distinctly sri look to it
17:36 sjn batman: or use the code that generate app creates
17:36 batman sjn: but IF you generated your app, instead of doing copy/paste, you wouldn't have any issues
17:36 sjn batman: ya
17:36 sjn fair enough
17:37 sjn although I'm in "going through the docs" mode
17:37 xaka joined #mojo
17:37 sjn so when I find something weird there, I start whining on IRC :)
17:38 jberger https://github.com/kraih/mojo/commit/b9​a80d875175cd295e50ab0148b5d5da17b33589
17:38 jberger its a recent change in the docs
17:38 jberger I think you should file a bug on that doc section
17:38 jberger reference that commit
17:38 batman sjn: what about the "Both application skeletons can be automatically generated." part in the growing docs?
17:39 jberger batman, it doesn't matter, the docs are wrong
17:39 sjn jberger: yeah, looks like a fix :)
17:39 jberger and if you have been working on a script, you aren't going to go back and regenerate with the mojo
17:39 sjn two months ago though
17:40 batman jberger: no. but maybe the error message from morbo could be better instead...
17:40 batman like adding "maybe you need to set up your PERL5LIB envionment variable?" or something like that...
17:40 batman not sure
17:40 jberger I think that that warning is coming from Perl not morbo
17:42 jberger to finish my previous thought, if there is a ton of boilerplate then one should rely on a generator (in any context), but for mojolicious this isn't true
17:42 batman jberger: it's mojo: https://metacpan.org/source/SRI/Mojo​licious-3.54/lib/Mojo/Server.pm#L45
17:42 sjn uhm. the code I got generated with "mojo generate app" doesn't match what's in the commit...
17:42 jberger and especially when making a mojolicious::lite application then growing is encouraged, it should work
17:43 jberger sjn: yeah, then thats a bug, either way
17:43 jberger at least in my mind
17:44 * sjn agrees with jberger that the generate lite-and-then-grow path should "just work"
17:44 sjn where to file a bug report?
17:45 batman i would file it on github with a pull request
17:45 sjn batman: go ahead :)
17:45 batman but i think i was wrong the last time i said something similar :/
17:46 jberger with sri, you have to make a good case
17:46 jberger hes not unfair, but the burden of proof is on you
17:46 batman i would just argue that the two script examples are not the same
17:47 jberger theres that, and theres the fact that morbo doesn't find the right libs
17:47 batman morbo finds the right libs if you tell it where to look...
17:48 jberger but not when you follow the example in the docs, thats a bug in the docs
17:49 batman it wouldn't help to add use lib 'lib'; if you're starting the app from the script/ dir either...
17:49 jberger thats why the __FILE__ token was used in the previous example
17:50 batman ah! true. it's a lot better now than before :)
17:50 batman it was crazy last time i looked into the app script
17:51 jberger batman: but now it doesn't work? how is that better?
17:51 batman doesn't work..?
17:51 batman i don't get the "Check if Mojolicious is installed" part though... it says "use Mojo::Base" on top :S
17:51 batman is that also fixed?
17:52 * sjn added https://github.com/kraih/mojo/issues/409
18:03 sjn Ooh
18:03 sjn dammit
18:03 sjn I'm using an old version of Mojo
18:03 sjn that might explain something
18:03 * sjn updates his local CPAN mirror
18:05 sjn what a waste
18:08 sjn ticket closed, upgrading fixed it
18:08 jberger sjn: ok, well at least thats good to know
18:08 batman isn't the doc still wrong?
18:08 sjn no
18:08 * sjn looked at the latest docs all the time
18:08 xaka joined #mojo
18:09 sjn the docs match the expected behaviour now
18:10 sjn (or the other way around, I mean)
18:10 jberger https://github.com/kraih/mojo/commit/b9a80​d875175cd295e50ab0148b5d5da17b33589#L1R33
18:10 jberger yeah, there it is
18:11 jberger honestly I think I'll keep Galileo using the old code, personally I like it more
18:11 jberger IMO it expresses intent
18:20 sjn anyways, thanks for the help, guys :)
18:20 sjn (note to self: check version of modules before pestering people)
18:21 sjn btw, would it be sensible to show Mojo version numbers as part of the banner when starting it up?
18:22 batman ./script/foo version <-- this show versions
18:22 sjn e.g. instead of "Server available at http://127.0.0.1:3000.", show "Mojolicious v3.54 Server available at http://127.0.0.1:3000." ?
18:22 sjn batman: yeah, I know :)
18:23 sjn just thinking of ways to catch myself with this type of error again :)
18:24 sjn myself, and anyone else who forgets to check if Mojo is up to date before coming here and whining
18:29 batman i think it's better to learn that the hard way, so you remember to always check that before asking for help
18:30 batman it's not a mojo related issue. it's for every module you want help with
18:34 sjn fair enough :)
18:42 marcus sjn: we do have a 'mojo version' command to show you version information
18:42 sjn marcus: batman mentioned that
18:45 batman is there a way to search for \xc2 in sublimetext2?
18:46 batman (as in searching for a char by the hex value)
18:47 batman that's weird "\x62" works, but not \xC2 :/
19:30 Netfeed m
19:54 pierrick joined #mojo
19:56 asarch joined #mojo
20:10 sh4|2 joined #mojo
20:16 sri sjn, batman: haha, that's why the new contributing guide tells you to upgrade mojolicious before opening a ticket! ;p
20:18 sri http://mojolicio.us/perldoc/Mojolicio​us/Guides/Contributing#REPORTING_BUGS
20:21 sri jberger: the old code looks horrible though and the intent is much harder the decypher imo
20:21 sri local $0 = lalala; FindBin::again; is horrible too, but at least we can hide the gory bits
20:26 sri s/the/to/
20:28 sri and of course, it's in line with how the Plack handler works now, so overall more predictable for users imo
20:28 sri s/handler/loader/
20:30 * sri wonders if subimetext development is dead now
20:34 lukep joined #mojo
20:35 DaTa vim is alive! :)
20:36 batman sri: hehe
20:42 lammel2 joined #mojo
20:47 jberger sri: I wouldn't expect FindBin to find my script when run through another perl-based application
20:48 jberger sri: I'm glad you have it working, I'm not complaining
20:48 jberger when I see the old (admittedly convoluted) code
20:49 jberger I can see within it what its doing, find the lib dir relative to this file, and push it appropriately onto @INC
20:49 jberger a little ugly, but descriptive
20:52 * sri remembers actually looking up how often FindBin::again was used on CPAN before applying the patch http://grep.cpan.me/?q=FindBin​%28%3A%3A%7C%5C-%5C%3E%29again
20:58 batman left #mojo
21:30 asarch joined #mojo
21:51 gryphon joined #mojo
22:15 daniel_ joined #mojo
22:47 jzawodn joined #mojo
23:27 Averna joined #mojo
23:35 Polarn joined #mojo
23:54 dabudabu joined #mojo

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